xdeb-org / xdeb

XDEB - Convert deb (Debian) packages to xbps (Void Linux)
MIT License
322 stars 16 forks source link

question: how to convert Build prerequisites from debian to void #13

Open ayoubelmhamdi opened 3 years ago

ayoubelmhamdi commented 3 years ago

when searching to build a package from scratch, am fonds a dependency of Build prerequisites of ubuntu like:

#Ubuntu / Debian:
$ sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl

sometimes, I can't find all dependencies of void-linux or, I spend a lot of time to found it my question/demand from you: can you add some function in this shell script or build another repo to solve this problem

toluschr commented 3 years ago

This is not trivial to implement. Here is a basic script of questionable quality I just wrote:

./xdep:

#!/bin/sh

XDEP_SYNC="${XDEP_SYNC-0}"

if [ "${XDEP_SYNC}" != 0 ]; then
    xlocate -S

    mkdir -p Contents

    cat sources | while read -r line; do
        set -- ${line}
        repo="${1}"; shift
        arch="${1}"; shift
        dist="${1}"; shift

        for arg in "${@}"; do
            curl "${repo}/dists/${dist}/${arg}/Contents-${arch}.gz" | gunzip -c > "Contents/${arg}"
        done
    done
fi

# Craft pattern instead of looping over arguments (improves performance significantly)
pattern="$(rg -I "$(echo "${@}" | tr ' ' '\n' | awk 'NR > 1 { printf "|" } { printf "/%s$",$1 }')" Contents | awk 'NR > 1 { printf "\\|" } { printf "/%s",$1 }')"

echo "found files, now reversing dependencies (this might take a while)" 1>&2

[ -z "${pattern}" ] && exit 1
git -c grep.lineNumber=false --git-dir="${XDG_CACHE_HOME}/xlocate.git" grep -- "${pattern}" @ | awk -F: '{print $2}' | sort -u


./sources:

http://ftp.debian.org/debian  amd64 testing  main contrib non-free
ayoubelmhamdi commented 3 years ago
XDEP_SYNC="${XDEP_SYNC-0}" 

is not declare it in this script, I should use :

XDEP_SYNC=?? ./xdeb

if it's true, what's meeting XDEP_SYNC

toluschr commented 3 years ago
XDEP_SYNC="${XDEP_SYNC-0}" 

is not declare it in this script, I should use :

XDEP_SYNC=?? ./xdeb

if it's true, what's meeting XDEP_SYNC

It's supposed to download the debian package cache. Set it to anything, but zero and it will sync.

ayoubelmhamdi commented 3 years ago
$ git -c grep.lineNumber=false --git-dir="~/.cache/xlocate.git" grep -- "${pattern}" @

fatal: not a git repository: '~/.cache/xlocate.git'

but

$ ls ~/.cache/xlocate.git

info  logs  objects  refs  config  FETCH_HEAD  HEAD

I think xlocate.git is a bare repository

toluschr commented 3 years ago
$ git -c grep.lineNumber=false --git-dir="~/.cache/xlocate.git" grep -- "${pattern}" @

fatal: not a git repository: '~/.cache/xlocate.git'

but

$ ls ~/.cache/xlocate.git

info  logs  objects  refs  config  FETCH_HEAD  HEAD

I think xlocate.git is a bare repository

This is weird, I copied the line from the xlocate script https://github.com/leahneukirchen/xtools/blob/master/xlocate#L81

Try "${XDG_CACHE_HOME}/xlocate.git", or "${HOME}/.cache/xlocate.git"

ayoubelmhamdi commented 3 years ago

just set

XDG_CACHE_HOME=$HOME/.cache # and not ~/.cache

it will be work fine

ayoubelmhamdi commented 3 years ago

thank you very mush