From 0d419d1ab05ae63ca19c8ef00ab87fcc2c141ef5 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 23 Jun 2017 12:31:11 +0200 Subject: Tidy pkgarchs.sh: Use perl for essential parts, wrapped as function. --- debian/pkgarchs.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'debian') 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" -- cgit v1.2.3