Open ayoubelmhamdi opened 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
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
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.
$ 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
$ 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 abare
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"
just set
XDG_CACHE_HOME=$HOME/.cache # and not ~/.cache
it will be work fine
thank you very mush
when searching to build a package from scratch, am fonds a dependency of
Build prerequisites
of ubuntu like: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