From dfdfb427c30b1b342a7aedb3a47db0c529c94430 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Fri, 10 Jun 2022 12:45:16 +0200 Subject: prtwash: fix source index, compression mode --- prtwash | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/prtwash b/prtwash index 9a69226..076115e 100644 --- a/prtwash +++ b/prtwash @@ -161,6 +161,10 @@ finalwarning() { } nwash() { + SRCGLOB=$(echo "$SRCGLOB" | sed 's/PortName/$name/') + PKGGLOB=$(echo "$PKGGLOB" | sed 's/PortName/$name/') + BLTGLOB='$name#$version-$release.pkg.tar.$COMPRESSION_MODE' + if [ "$auto" = 0 ]; then for p in ${prtdirs[@]}; do @@ -244,9 +248,9 @@ wash() { for (( p=2; p<${#pkgfiles[@]}; p++ )) ; do src="${pkgfiles[$p]}" pkgfiles[$p]=$(get_filename $src) - [ "${src:0:7}" = "ftp://" \ - -o "${src:0:8}" = "http://" \ - -o "${src:0:6}" = "https://" ] || + [ "${src:0:6}" = "ftp://" \ + -o "${src:0:7}" = "http://" \ + -o "${src:0:8}" = "https://" ] || tosave=( "${tosave[@]}" "${pkgfiles[$p]}" ) done fi @@ -377,38 +381,35 @@ getoptions $@ checkparams $@ COMPRESSION_MODE="gz" -if [ -f $PKGCONFIG ]; then - COMPRESS_CFG=$(grep "PKGMK_COMPRESSION_MODE" $CONF_PMK | \ - sed 's/[\t w]*#.*//;s/.*=//;s/\"//g') - [ -n "$COMPRESS_CFG" ] && COMPRESSION_MODE=$COMPRESS_CFG - SRCGLOB=$(grep "PKGMK_SOURCE_DIR" $CONF_PMK | sed 's/[\t w]*#.*//; s/.*=//; s/\"//g') - PKGGLOB=$(grep "PKGMK_PACKAGE_DIR" $CONF_PMK | sed 's/[\t w]*#.*//; s/.*=//; s/\"//g') +if [ -f $CONF_PMK ]; then + eval $(grep COMPRESSION_MODE $CONF_PMK | sed 's/PKGMK_//') + eval $(grep PKGMK_SOURCE_DIR $CONF_PMK | sed 's/PKGMK_SOURCE_DIR/SRCGLOB/; s/\$name/PortName/') + eval $(grep PKGMK_PACKAGE_DIR $CONF_PMK | sed 's/PKGMK_PACKAGE_DIR/PKGGLOB/; s/\$name/PortName/') fi -BLTGLOB='$name#$version-$release.pkg.tar.$COMPRESSION_MODE' - # First determine the type of fs layout the admin configured for source downloads. # Layouts 1 and 2: at least one directory is shared among all ports (for sources or built packages), # or the admin has organized downloads in some other way outside of $PORTS_ROOT. -if [ -n "${SRCGLOB}" ] && echo "${SRCGLOB}" | grep -q -v '\$name'; then +if [ -n "$SRCGLOB" ] && echo "$SRCGLOB" | grep -q -v 'PortName'; then swash nwash -elif [ -n "${PKGGLOB}" ] && echo "${PKGGLOB}" | grep -q -v '\$name'; then +elif [ -n "$PKGGLOB" ] && echo "$PKGGLOB" | grep -q -v 'PortName'; then swash nwash fi # Layout 3: separate directories, named according to port, are potentially cluttered with downloads. -# Unlike prtsweep, actually try to follow these dynamically-defined paths and clean them up. +# nwash() will restore the globs (SRC and PKG) to their original versions so that +# dynamically-defined paths can be followed appropriately and cleaned up. # $PORTS_ROOT might still remain cluttered after this "wash", but the admin can just run prtsweep. # For such filesystem layouts, the two scripts complement each other nicely. if [ -z "${SRCGLOB}" -o -z "${PKGGLOB}" ]; then - nwash -elif [ -n "${SRCGLOB}" ] && echo "$SRCGLOB" | grep -q '\$name'; then - nwash -elif [ -n "${PKGGLOB}" ] && echo "$PKGGLOB" | grep -q '\$name'; then - nwash + nwash +elif [ -n "${SRCGLOB}" ] && echo "$SRCGLOB" | grep -q 'PortName'; then + nwash +elif [ -n "${PKGGLOB}" ] && echo "$PKGGLOB" | grep -q 'PortName'; then + nwash else # Should have exited by now, but if not, # offer another chance to abort. -- cgit v1.2.3