From 26ab531a0abac615aaedf17622ee2aa5e19c5114 Mon Sep 17 00:00:00 2001 From: Marcel Telka <marcel@telka.sk> Date: Fri, 05 Apr 2024 12:30:27 +0200 Subject: [PATCH] python/pipdeptree: update to 2.17.0 --- tools/perl-meta-deps | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-) diff --git a/tools/perl-meta-deps b/tools/perl-meta-deps index 2b6a07a..a8c9d70 100755 --- a/tools/perl-meta-deps +++ b/tools/perl-meta-deps @@ -18,7 +18,7 @@ function usage { [[ -n "$1" ]] && printf "ERROR: %s\n\n" "$1" - printf "Usage: perl-meta-deps WS_MACH BUILD_DIR [build|test|runtime] PERL_VERSION\n" >&2 + printf "Usage: perl-meta-deps WS_MACH BUILD_DIR [configure|build|test|runtime]... [suggests] PERL_VERSION\n" >&2 [[ -n "$1" ]] && exit 1 exit 0 } @@ -32,18 +32,25 @@ BUILD_DIR="$1" [[ -d "$BUILD_DIR" ]] && shift || usage "BUILD_DIR does not exist" -PHASES=".configure,.build,.test,.runtime" -case "$1" in - "build") PHASES=".configure,.build" && shift ;; - "test") PHASES=".test" && shift ;; - "runtime") PHASES=".runtime" && shift ;; -esac +PHASES= +while true ; do + case "$1" in + configure|build|test|runtime) + PHASES="$PHASES,.$1" && shift ;; + *) break ;; + esac +done +PHASES=${PHASES/#,} +[[ -z "$PHASES" ]] && PHASES=".configure,.build,.test,.runtime" + +RELATION=".requires,.recommends" +[[ "$1" == "suggests" ]] && RELATION=".$1" && shift (($# == 0)) && usage "PERL_VERSION missing" PERLVER=$1 && shift PLV=${PERLVER//.} PERL=/usr/perl5/$PERLVER/bin/perl -[[ -x "$PERL" ]] || usage "perl $PERLVER not found" +[[ -x "$PERL" ]] || usage "Perl $PERLVER not found" PERL_ARCH=$($PERL -e 'use Config; print $Config{archname}') (($# != 0)) && usage "Too many arguments" @@ -57,7 +64,7 @@ find "$CACHEDIR" -type f -mtime +7 -exec rm -f {} \; -/usr/bin/jq -r '.prereqs|'"$PHASES"'|.requires,.recommends|to_entries?|.[]|.key+" "+(.value|tostring)' | while read PREREQ VERSION ; do +/usr/bin/jq -r '.prereqs|'"$PHASES"'|'"$RELATION"'|to_entries?|.[]|.key+" "+(.value|tostring)' | while read PREREQ VERSION ; do # Convert perl version number to pkg(5) compatible form VER=$("$PERL_VERSION_CONVERT" "$PREREQ" "$VERSION") [[ "$VER" != "0" ]] && VER="@$VER" || VER= @@ -65,7 +72,7 @@ CACHEFILE="$CACHEDIR/$PREREQ-$PERLVER" # Resolve the dependency if not in cache already - if [[ ! -s "$CACHEFILE" ]] ; then + if [[ ! -e "$CACHEFILE" || ("$RELATION" != ".suggests" && ! -s "$CACHEFILE") ]] ; then # We must replace '::' by '-' otherwise 'pkgdepend resolve' fails MANIFEST="$BUILD_DIR/META-${PREREQ//::/-}-$PERLVER" @@ -91,21 +98,25 @@ # Remove version number and cache the result cat "$MANIFEST.res" | sed -e 's/@[^ ]*//g' -e 's/-'$PLV'/-$(PLV)/g' > "$CACHEFILE" else - printf "ERROR: Prerequisite %s not found\n" "$PREREQ" >&2 - cat "$MANIFEST" + if [[ "$RELATION" != ".suggests" ]] ; then + printf "ERROR: Prerequisite %s not found\n" "$PREREQ" >&2 + cat "$MANIFEST" + fi + # Cache negative result + [[ ! -e "$CACHEFILE" ]] && > "$CACHEFILE" fi fi - # Use cached result (if any), add required version number and drop runtime/perl - [[ -f "$CACHEFILE" ]] && cat "$CACHEFILE" | sed -e 's/\(fmri=[^ ]*\)/\1'$VER'/g' -e '/fmri=pkg:\/runtime\/perl-\$(PLV)/d' + # Use cached result, add required version number and drop runtime/perl + cat "$CACHEFILE" | sed -e 's/\(fmri=[^ ]*\)/\1'$VER'/g' -e '/fmri=pkg:\/runtime\/perl-\$(PLV)/d' done | /usr/bin/pkgfmt -u | uniq | ( PREV_LINE_H= PREV_FMRI= PREV_VER= PREV_LINE_T= while read LINE ; do - # Copy verbatim lines without "fmri=" - [[ "${LINE//*fmri=*/FMRI}" != "FMRI" ]] && printf "%s\n" "$LINE" && continue + # Copy verbatim lines without "fmri=pkg:" (e.g. unresolved lines) + [[ "${LINE//*fmri=pkg:*/FMRI}" != "FMRI" ]] && printf "%s\n" "$LINE" && continue LINE_H=${LINE%%fmri=*} LINE_T=${LINE#*fmri=} -- Gitblit v1.9.3