#!/bin/sh -ef hshdir="${1:-$TMPDIR/build}" mkdir -p "$hshdir" cd "${workdir:?}" . trap.sh hsh -q --no-stuff --initroot-only "$hshdir" add_trap hsh -q --cleanup-only "$hshdir" conflicts='perl-Geo-IPfree perl-Module-Signature perl-SOAP-Lite-examples perl-SOAP-Lite perl-Spreadsheet-WriteExcel' # install all perl packages "$hshdir"/aptbox/apt-cache -q --no-all-names pkgnames perl | grep -Fx -v "$conflicts" | xargs hsh-install -q -- "$hshdir" >/dev/null # query CPAN database hsh-run -q -- "$hshdir" perl -MCPAN -e 'CPAN::Shell->r' >cpan.out <modules # list packages that need updating while read -r mod v0 v1 dist; do dep="${mod//:://}"; dep="perl($dep.pm)" pkg="$(hsh-run -q -- "$hshdir" rpm -q --whatprovides --qf '%{NAME}\n' "$dep")" pkg="$(echo "$pkg" |head -1)" who="$(hsh-run -q -- "$hshdir" rpm -q --whatprovides --qf '%{PACKAGER}\n' "$dep")" who="$(echo "$who" |head -1)" who="${who// at /@}"; who="${who// dot /.}" dist="${dist##*/}" printf "%s\t%s\t%s\t%s\t%s\t%s\n" "$pkg" "$mod" "$v0" "$v1" "$dist" "$who" done /dev/null # group by packager xfmt1() { sort -t$'\t' +5 |awk -F'\t' 'who != $6 { who = $6; printf "\n%s:\n", who; } { printf "%-16s\t%s\t%s\t%s\t%s\n", $1, $2, $3, $4, $5; }' } fmt_plus() { subj="$subj +$1" echo " $1 NEW $2 added to the list" xfmt1; echo } fmt_minus() { subj="$subj -$1" echo " $1 $2 REMOVED from the list" xfmt1; echo } fmt_total() { subj="$subj ($1)" echo " Total $1 $2 need updating" xfmt1; echo }