diff options
Diffstat (limited to 'debian/pkgarchs.sh')
-rw-r--r-- | debian/pkgarchs.sh | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/debian/pkgarchs.sh b/debian/pkgarchs.sh index e8b15fb..c6e5fad 100644 --- a/debian/pkgarchs.sh +++ b/debian/pkgarchs.sh @@ -18,14 +18,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA. # -# Depends: devscripts liburi-perl curl ca-certificates +# Depends: libwww-perl set -e defaultsuite="unstable" pkgsuite="$(dpkg-parsechangelog -S Distribution)" -pkg="$1" suite="$pkgsuite" case "$pkgsuite" in @@ -41,12 +40,15 @@ case "$pkgsuite" in ;; esac -echo >&2 "INFO: Resolving architectures for package \"$pkg\" through rmadison Internet request." -dump="$(rmadison -s "$suite" "$pkg")" -archs="$(echo "$dump" \ - | awk -F'|' '{ print $4 }' \ - | sed 's/source,//;s/ //g;s/,/\n/g' \ - | LANG=C sort -u \ - | tr '\n' ' ' \ - | sed 's/^ //;s/ $/\n/;s/\ball\b/any/')" -echo "${archs:-none}" +pkgarchs() { + echo >&2 "INFO: Query Debian for package \"$1\" architectures..." + GET "https://qa.debian.org/madison.php?package=$1&table=debian&s=$suite&text=on" \ + | perl -MList::Util=uniq -F'\|\s*' \ + -E 'for (split(/[,\s]+/, pop @F)) {' \ + -E 'next if ($_ eq "source");' \ + -E '$_ = "any" if ($_ eq "all");' \ + -E 'push @a, $_};' \ + -E 'END{if (@a) {say join(" ", uniq sort @a)} else {say "none"}}' +} + +pkgarchs "$1" |