diff options
-rw-r--r-- | README | 20 | ||||
-rwxr-xr-x | xdiff | 9 | ||||
-rwxr-xr-x | xgrep | 8 | ||||
-rwxr-xr-x | xlg | 5 | ||||
-rwxr-xr-x | xlocate | 4 | ||||
-rwxr-xr-x | xlog | 5 | ||||
-rwxr-xr-x | xls | 12 | ||||
-rwxr-xr-x | xq | 17 | ||||
-rwxr-xr-x | xsrc | 6 |
9 files changed, 86 insertions, 0 deletions
diff --git a/README b/README new file mode 100644 index 0000000..23fadf8 --- /dev/null +++ b/README @@ -0,0 +1,20 @@ +# xtools - a few helpers for working with XBPS + +These are a few small utilities for use with XBPS: +https://github.com/voidlinux/xbps + + xdiff [DIR] - merge XBPS .new-* files + xgrep PATTERN PKGS... - search files limited to XBPS package contents + xlg PKG - open short commit log for XBPS template + xlocate PATTERN - locate files in all XBPS packages + xlog PKG - open commit log for XBPS template + xls PKGS... - list files contained in PKGS (including binpkgs) + xq PKGS... - query information about XBPS package + xsrc PKG - list source files for XBPS template + +A few tools assume xbps-packages is checked out at ~/xbps-packages. + +To the extent possible under law, Christian Neukirchen has waived +all copyright and related or neighboring rights to this work. + +http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/xdiff b/xdiff new file mode 100755 index 0000000..e6c7cdb --- /dev/null +++ b/xdiff @@ -0,0 +1,9 @@ +#!/bin/sh +# xdiff [DIR] - merge XBPS .new-* files + +DIR=${1:-/etc} + +for newfile in $(find "$DIR" -name '*.new-*_*'); do + vimdiff "${newfile}" "${newfile%.new-*_*}" && + rm -vi "${newfile}" +done diff --git a/xgrep b/xgrep new file mode 100755 index 0000000..20be2a3 --- /dev/null +++ b/xgrep @@ -0,0 +1,8 @@ +#!/bin/sh +# xgrep PATTERN PKGS... - search files limited to XBPS package contents + +PATTERN=${1:?pattern missing} +shift +for pkg; do + xbps-query -f "$pkg" +done | sed 's/ -> .*//' | xargs grep -d skip -e "$PATTERN" diff --git a/xlg b/xlg new file mode 100755 index 0000000..7209200 --- /dev/null +++ b/xlg @@ -0,0 +1,5 @@ +#!/bin/sh +# xlg PKG - open short commit log for XBPS template + +cd ~/xbps-packages/srcpkgs +git log --date=short --pretty='%cd %h%d %s' "$@" diff --git a/xlocate b/xlocate new file mode 100755 index 0000000..63c2d9b --- /dev/null +++ b/xlocate @@ -0,0 +1,4 @@ +#!/bin/sh +# xlocate PATTERN - locate files in all XBPS packages + +xbps-query --regex -Ro "$@" | sed 's/(http:.*)$//; s/-[^-]*:/\t/' diff --git a/xlog b/xlog new file mode 100755 index 0000000..b6bf889 --- /dev/null +++ b/xlog @@ -0,0 +1,5 @@ +#!/bin/sh +# xlog PKG - open commit log for XBPS template + +cd ~/xbps-packages/srcpkgs +git log -p "$@" diff --git a/xls b/xls new file mode 100755 index 0000000..126bf23 --- /dev/null +++ b/xls @@ -0,0 +1,12 @@ +#!/bin/sh +# xls PKGS... - list files contained in PKGS (including binpkgs) + +BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) + +for pkg; do + xbps-query \ + --repository=hostdir/binpkgs/$BRANCH \ + --repository=../hostdir/binpkgs/$BRANCH \ + --repository=../../hostdir/binpkgs/$BRANCH \ + -f $pkg +done diff --git a/xq b/xq new file mode 100755 index 0000000..34f26c7 --- /dev/null +++ b/xq @@ -0,0 +1,17 @@ +#!/bin/sh +# xq PKGS... - query information about XBPS package + +BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) +ADDREPO="--repository=hostdir/binpkgs/$BRANCH + --repository=../hostdir/binpkgs/$BRANCH + --repository=../../hostdir/binpkgs/$BRANCH" + +for pkg; do + xbps-query $ADDREPO -S "$pkg" + xbps-query $ADDREPO -x "$pkg" | sed 's/^/ /;1s/^/depends:\n/' + REVDEP=$(xbps-query -X "$pkg" | sed 's/^/ /' ) + if [ "$REVDEP" ]; then + printf "%s\n" "required-by:" "$REVDEP" + fi +done + diff --git a/xsrc b/xsrc new file mode 100755 index 0000000..811a1a9 --- /dev/null +++ b/xsrc @@ -0,0 +1,6 @@ +#!/bin/sh +# xsrc PKG - list source files for XBPS template + +~/xbps-packages/xbps-src show "$1" | sed -n '/distfiles:/s/[^:]*:[\t]*//p' +find ~/xbps-packages/srcpkgs/$1/files 2>/dev/null +find ~/xbps-packages/srcpkgs/$1/patches 2>/dev/null |