index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/wtf | 59 |
@@ -2,45 +2,30 @@ # shellcheck disable=SC2119,SC2120 +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" + +# TODO: search i486, too + search="$*" -wget -qO- 'https://pkgapi.arch32.tyzoid.com/esearch/'"${search##*/}"'.xml' | \ - awk ' - BEGIN { - package=""; - version=""; - repo=""; - filelen=0; - } - { - if ($1 == "</package>") { - printf "[" repo "] " package " (" version "):"; - for (i=1; i <= filelen; i++) { - printf " " file[i]; - } - print ""; - package=""; - version=""; - repo=""; - filelen=0; - } - if ($1 ~ /^<name>/) { - package = gensub(/<[^>]+>/, " ", "g", $1); - } - if ($1 ~ /^<version>/) { - version = gensub(/<[^>]+>/, "", "g", $1); - } - if ($1 ~ /^<repo>/) { - repo = gensub(/<[^>]+>/, "", "g", $1); - } - if ($1 ~ /^<file>/) { - file[++filelen] = gensub(/<[^>]+>/, "", "g", $1); - } - } - ' | \ +pkgfile -wC "${base_dir}/misc/pacman-i686.conf" -s "${search##*/}" | \ + xargs -rn1 pkgfile -wC "${base_dir}/misc/pacman-i686.conf" -l | \ if printf '%s\n' "${search}" | \ - grep -q '/'; then + grep -q '^/'; then grep -w "${search}" || true else - cat - fi + grep "/${search}\\(/\\|\$\\)" || true + fi | \ + sort -k2,2 | \ + sed ' + s,^\([^/[:space:]]\+\)/\([^/[:space:]]\+\)\s\(\S.*\)$,\2 [\1]: \3, + ' | \ + sed ' + :a + $!N + s#^\(\([^/:[:space:]]\+ [^/:[:space:]]\+, \)*[^/:[:space:]]\+ [^/:[:space:]]\+\): \([^\n]\+\)\n\([^/:[:space:]]\+ [^/:[:space:]]\+\): \3$#\1, \4: \3# + ta + P + D + ' |