Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/wtf59
1 files changed, 22 insertions, 37 deletions
diff --git a/bin/wtf b/bin/wtf
index 1963cff..232ffe7 100755
--- a/bin/wtf
+++ b/bin/wtf
@@ -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
+ '