diff options
-rw-r--r-- | README | 20 | ||||
-rw-r--r-- | _xtools | 3 | ||||
-rw-r--r-- | fish/completions/xbuildbarf.fish | 2 | ||||
-rwxr-xr-x | xbuildbarf | 5 | ||||
-rwxr-xr-x | xchroot | 2 | ||||
-rwxr-xr-x | xdeptree | 90 | ||||
-rwxr-xr-x | xgensum | 55 | ||||
-rwxr-xr-x | xlint | 3 | ||||
-rw-r--r-- | xtools.1 | 13 | ||||
-rwxr-xr-x | xvoidstrap | 1 |
10 files changed, 169 insertions, 25 deletions
diff --git a/README b/README index dff0baa..7c833a1 100644 --- a/README +++ b/README @@ -7,16 +7,14 @@ COMMANDS xbarf – Display build logs of last build - xbuildbarf [arch] - – Spy on current buildbot output - xbulk [-n] [-k] [xbps-src flags] pkgs ... – simple XBPS bulk builder -n dry-run mode -k keep going on errors xbump pkgname [git commit options] - – git commit a new package or package update + – git commit a new package or package update. If pkgname is ‘:’, a + commit will be made for each template staged in the git index. xchangelog template | pkgname – open package changelog @@ -37,6 +35,12 @@ COMMANDS xdbg pkgs ... – list debugging packages for pkgs and recursive dependencies + xdeptree [-L level] [-R] pkgname + – generate a tree of a package's dependencies + -L level + Max depth of tree + -R Query remote repos + xdiff [-u | -l] [basedir] – merge/diff/list XBPS .new-* files -l list .new files @@ -51,11 +55,13 @@ COMMANDS xetcchanges – show diff of /etc against binary packages - xgensum [-f] [-c] [-i] [-H hostdir] templates ... + xgensum [-f] [-c] [-i] [-a arch] [-H hostdir] templates ... – update SHA256 sum in templates -f force (re-)download of distfiles -c use content checksum -i replace checksum in-place + -a architecture to generate the checksum for (default: native or + first available architecture) -H absolute path to hostdir xgrep pattern pkgs ... @@ -181,6 +187,10 @@ COMMANDS – list all subpackages of a package -m only print main package + xtree pkg ... + – list files contained in pkg (including binpkgs) in a tree(1) -style + format. If tree is not installed, falls back to xls. + xuname – display system info relevant for debugging Void diff --git a/_xtools b/_xtools index 8284ed0..352141c 100644 --- a/_xtools +++ b/_xtools @@ -1,4 +1,4 @@ -#compdef xbuildbarf xbulk xbump xchangelog xcheckrestart xdbg xdiff xdowngrade xgensum xgrep xi xilog xlg xlocate xlog xls xmypkgs xoptdiff xpkg xpkgdiff xq xrecent xrevbump xrevshlib xsrc xsubpkg xtree +#compdef xbulk xbump xchangelog xcheckrestart xdbg xdiff xdowngrade xgensum xgrep xi xilog xlg xlocate xlog xls xmypkgs xoptdiff xpkg xpkgdiff xq xrecent xrevbump xrevshlib xsrc xsubpkg xtree _xbps # force autoload @@ -133,7 +133,6 @@ _xsubpkg() { _xtools() { case "$service" in - xbuildbarf) _xtools_one_arch "$@";; xbulk) _xbulk "$@";; xbump) _xtools_one_template "$@";; xchangelog) _xtools_one_template "$@";; diff --git a/fish/completions/xbuildbarf.fish b/fish/completions/xbuildbarf.fish deleted file mode 100644 index e89a1b2..0000000 --- a/fish/completions/xbuildbarf.fish +++ /dev/null @@ -1,2 +0,0 @@ -complete -c xbuildbarf -f -complete -c xbuildbarf -n '[ (count (commandline -poc)) -eq 1 ]' -a '(__xtools_complete_archs)' diff --git a/xbuildbarf b/xbuildbarf deleted file mode 100755 index 764cbf8..0000000 --- a/xbuildbarf +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# xbuildbarf [ARCH] - spy on current buildbot output - -arch=${1:-$(xbps-uhelper arch)} -curl -sL "http://build.voidlinux.org/builders/${arch}_builder/builds/-1/steps/shell_3/logs/stdio/text" diff --git a/xchroot b/xchroot index d01979c..755dcd0 100755 --- a/xchroot +++ b/xchroot @@ -41,7 +41,7 @@ fi printf "\033[1m=> Entering chroot $CHROOT\033[m\n" export PS1="[xchroot $CHROOT] $PS1" -chroot "$CHROOT" ${@:-$INNER_SHELL} +chroot "$CHROOT" "${@:-$INNER_SHELL}" STATUS=$? if [ $STATUS -ne 0 ]; then printf "\033[1m=> Exited chroot $CHROOT\033[m\n" diff --git a/xdeptree b/xdeptree new file mode 100755 index 0000000..c6db13c --- /dev/null +++ b/xdeptree @@ -0,0 +1,90 @@ +#!/bin/bash + +get_deps() { + local parents="$1" pkg="$2" + local -i lvl="$3" + local -a deps + + parents="${parents:+$parents/}$pkg" + + if (( MAXLVL > 0 && lvl >= MAXLVL )); then + echo "${parents}" + return + fi + + if [ "${cache[$pkg]+_}" ]; then + read -r -a deps <<< "${cache[$pkg]}" + else + mapfile -t deps < <( xbps-query ${REPO:+$ADDREPO} -x "$pkg" | xargs -rn1 xbps-uhelper getpkgdepname ) + cache[$pkg]="${deps[*]}" + fi + + if [ "${#deps[@]}" -eq 0 ]; then + echo "${parents}" + fi + + lvl=$(( lvl + 1 )) + for dep in "${deps[@]}"; do + get_deps "$parents" "$dep" "$lvl" + done +} + +usage() { + echo "Usage: xdeptree [-L level] [-R] <pkgname>" >&2 +} + + +BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) +if [ -n "$XBPS_HOSTDIR" ]; then + XBPS_BINPKGS="$XBPS_HOSTDIR/binpkgs" +else + XBPS_DISTDIR="$(xdistdir 2>/dev/null)" || XBPS_DISTDIR=. + XBPS_BINPKGS="$XBPS_DISTDIR/hostdir/binpkgs" +fi +ADDREPO=" + --repository=$XBPS_BINPKGS/$BRANCH + --repository=$XBPS_BINPKGS/$BRANCH/nonfree + --repository=$XBPS_BINPKGS/$BRANCH/multilib + --repository=$XBPS_BINPKGS/$BRANCH/multilib/nonfree + --repository=$XBPS_BINPKGS/$BRANCH/debug + --repository=$XBPS_BINPKGS + --repository=$XBPS_BINPKGS/nonfree + --repository=$XBPS_BINPKGS/multilib + --repository=$XBPS_BINPKGS/multilib/nonfree + --repository=$XBPS_BINPKGS/debug +" + +declare -i MAXLVL=0 +REPO='' + +while getopts L:Rh flag; do + case "$flag" in + L) + if ! [[ "$OPTARG" =~ ^[0-9]+$ ]]; then + usage; exit 1 + fi + MAXLVL="$OPTARG" + ;; + R) REPO=1 ;; + h) usage; exit 0 ;; + ?) usage; exit 1 ;; + esac +done + +shift $(( OPTIND - 1 )) + +PKG="$1" + +if [ -z "$PKG" ]; then + usage + exit 1 +fi + +if ! command -v tree >/dev/null 2>&1; then + echo "missing tree(1) command" + exit 1 +fi + +declare -A cache=() + +get_deps '' "$PKG" 0 | sort -u | tree -n --noreport --fromfile . diff --git a/xgensum b/xgensum index 58829cb..208e109 100755 --- a/xgensum +++ b/xgensum @@ -1,21 +1,40 @@ #!/bin/bash -# xgensum [-f] [-c] [-i] [-H hostdir] TEMPLATES ... - update SHA256 sums in templates +# xgensum [-f] [-c] [-i] [-a arch] [-H hostdir] TEMPLATES ... - update SHA256 sums in templates usage() { - echo 'Usage: xgensum [-f] [-c] [-i] [-H hostdir] TEMPLATES ...' >&2 + echo 'Usage: xgensum [-f] [-c] [-i] [-a arch] [-H hostdir] TEMPLATES ...' >&2 exit 1 } +target_is_native() { + tgt="$1" + host="$(uname -m)" + case "$host" in + x86_64) + case "$tgt" in + i686*|x86_64*) return 0 ;; + esac + ;; + aarch64) + case "$tgt" in + armv7*|aarch64*) return 0 ;; + esac + ;; + esac + return 1 +} + gensum_template() { local template="$1" . "$template" - # pick the first supported arch. This is required for packages unavailable for - # the host arch - FLAG_a= - if ! "$XBPS_DISTDIR/xbps-src" show-avail "$pkgname" ; then - FLAG_a="-a $("$XBPS_DISTDIR/xbps-src" show "$pkgname" | sed -En -e 's/archs:[[:space:]]*([.*]*)/\1/p' | sed -e 's/\*$//' | grep -v -e '^~' | head -n1 )" + if [ -z "$FLAG_a" ]; then + # pick the first supported arch. This is required for packages unavailable for + # the host arch + if ! "$XBPS_DISTDIR/xbps-src" show-avail "$pkgname" ; then + FLAG_a="-a $("$XBPS_DISTDIR/xbps-src" show "$pkgname" | sed -En -e 's/archs:[[:space:]]*([.*]*)/\1/p' | sed -e 's/\*$//' | grep -v -e '^~' | head -n1 )" + fi fi # Try to source the build-style as well. This is required for R-cran packages. @@ -114,8 +133,11 @@ gensum_template() { return $ret } -while getopts fciH:h flag; do +ARCH= + +while getopts fciH:a:h flag; do case $flag in + a) ARCH="$OPTARG" ;; f) FLAG_f=1 ;; c) FLAG_c=1 ;; i) FLAG_i='-i' ;; @@ -128,6 +150,23 @@ shift $(( OPTIND - 1 )) XBPS_DISTDIR=$(xdistdir) || exit 1 +if [ -n "$ARCH" ]; then + if target_is_native "$ARCH"; then + FLAG_a="-A $ARCH" + XBPS_TARGET_MACHINE="$ARCH" + if [ "$ARCH" = "${ARCH%-*}" ]; then + XBPS_TARGET_LIBC="glibc" + else + XBPS_TARGET_LIBC="${ARCH#*-}" + fi + else + FLAG_a="-a $ARCH" + if [ -f "${XBPS_DISTDIR}/common/cross-profiles/${ARCH}.sh" ]; then + . "${XBPS_DISTDIR}/common/cross-profiles/${ARCH}.sh" + fi + fi +fi + rv=0 for template; do diff --git a/xlint b/xlint index 5e6f1f4..c0d2c81 100755 --- a/xlint +++ b/xlint @@ -243,9 +243,11 @@ no_generic_pkgconfig_link nocross nodebug nopie +nopyprovides noshlibprovides nostrip nostrip_files +noverifypydeps noverifyrdeps patch_args pkgname @@ -253,6 +255,7 @@ preserve provides pycompile_dirs pycompile_module +python_extras python_version register_shell replaces diff --git a/xtools.1 b/xtools.1 index d175900..d371c19 100644 --- a/xtools.1 +++ b/xtools.1 @@ -8,8 +8,6 @@ .Bl -tag -width x .It Nm xbarf .Nd Display build logs of last build -.It Nm xbuildbarf Op Ar arch -.Nd Spy on current buildbot output .It Nm xbulk \ Oo Fl n Oc \ Oo Fl k Oc \ @@ -45,6 +43,14 @@ verbose mode, also print the library names .Nd detect file conflicts between XBPS packages .It Nm xdbg Ar pkgs ... .Nd list debugging packages for pkgs and recursive dependencies +.It Nm xdeptree Oo Fl L Ar level Oc Oo Fl R Oc Ar pkgname +.Nd generate a tree of a package's dependencies +.Bl -tag -offset 2n -width 2n -compact +.It Fl L Ar level +Max depth of tree +.It Fl R +Query remote repos +.El .It Nm xdiff \ Oo Fl u | l Oc \ Op Ar basedir @@ -68,6 +74,7 @@ against binary packages Oo Fl f Oc \ Oo Fl c Oc \ Oo Fl i Oc \ +Oo Fl a Ar arch Oc \ Oo Fl H Ar hostdir Oc \ Ar templates\ ... .Nd update SHA256 sum in templates @@ -78,6 +85,8 @@ force (re-)download of distfiles use content checksum .It Fl i replace checksum in-place +.It Fl a +architecture to generate the checksum for (default: native or first available architecture) .It Fl H absolute path to hostdir .El diff --git a/xvoidstrap b/xvoidstrap index 13a3889..eca9ac2 100755 --- a/xvoidstrap +++ b/xvoidstrap @@ -57,5 +57,6 @@ Void post-install checklist - Make dracut hostonly: echo hostonly=yes >/etc/dracut.conf.d/hostonly.conf - Rebuild initrd and grub config: xbps-reconfigure -f linux5.?? - Enable default services: ln -s /etc/sv/... /etc/runit/runsvdir/default/ +- Install and enable an ntpd, and optionally cron and syslog. EOF |