From 844b3a542434cf29681bb83734ad762e291c82d2 Mon Sep 17 00:00:00 2001 From: Dave Woodfall Date: Sat, 6 Mar 2021 08:01:53 +0000 Subject: Avoid matching txz/tgz etc extension when blacklisting. Make blacklist file a full package name regex. Replace redundant 'print $0 } else { print $0' in cutpkg.awk. Fix formatting on 'blacklist or ignore' message. --- files/core-functions.sh | 27 ++++++++++++++------------- files/cutpkg.awk | 4 +--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/files/core-functions.sh b/files/core-functions.sh index 61b61e0..db7cd5d 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -601,24 +601,23 @@ function mkregex_blacklist() { /(^#|^$)/d s,^, , s,$, , - s,^\s(extra|pasture|patches|slackware(|64)|testing)\s$,\1 , - s,^\s(tgz|txz)\s$, \1, - s,^\s([^/]+)/\s$, ./$PKGMAIN/\1 , + s,^ (extra|pasture|patches|slackware(|64)|testing)/ $,^\1 , + s,^ ([^/]+)/ $, \\\.\\\/$PKGMAIN\\\/\1\$, " ${CONF}/blacklist > ${TMPDIR}/blacklist.tmp # Filter server and local package lists through blacklist ( cat ${WORKDIR}/pkglist printf "%s\n" $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk - ) | grep -E -f ${TMPDIR}/blacklist.tmp | - awk '{print $2}' | sed -E "s,[+],\\\+,g" | - sort -u > ${TMPDIR}/blacklist + ) | cut -d\ -f1-7 | grep -E -f ${TMPDIR}/blacklist.tmp | + awk '{print $2}' | sort -u | sed "s,[+],[+],g + s,$,-[^-]+-($ARCH|noarch|fw)-[^-]+[\.t(b|l|x|g)z]*,g" > ${TMPDIR}/blacklist } # Blacklist filter # function applyblacklist() { - grep -vF -f ${TMPDIR}/blacklist + grep -vxE -f ${TMPDIR}/blacklist } # Function to make install/reinstall/upgrade lists @@ -808,7 +807,7 @@ function makelist() { return ;; esac - LIST=$( printf "%s\n" $LIST | applyblacklist | sort -u ) + LIST=$( printf "%s\n" $LIST | applyblacklist | uniq ) rm ${TMPDIR}/waiting @@ -1259,9 +1258,10 @@ function sanity_check() { done DOUBLEFILES=$( ls -1 $ROOT/var/log/packages/ | - rev | cut -d- -f4- | rev | uniq -D | sort -u | applyblacklist | - xargs -I '{}' find $ROOT/var/log/packages/ -regex \ - ".*/{}-[^-]+-\($ARCH\|noarch\|fw\)-[^-]+" | xargs -I '{}' basename '{}' ) + batchcutpkg | uniq -D | sort -u | sed "s,[+],[+],g" | + xargs -I '{}' find $ROOT/var/log/packages/ -regextype awk -regex \ + ".*/{}-[^-]+-($ARCH|noarch|fw)-[^-]+" | awk -F/ '{print $NF}' | + applyblacklist ) rm ${TMPDIR}/waiting echo -e "DONE" @@ -1283,8 +1283,9 @@ Select your action (R/I): " remove_pkg ;; *) - echo "Remove one or more of OR blacklist the affected packages \ -in order for slackpkg to work properly." + echo "Remove one or more of OR blacklist the affected packages in order +for slackpkg to work properly. +" echo "To blacklist the affected packages, edit /etc/slackpkg/blacklist" cleanup ;; diff --git a/files/cutpkg.awk b/files/cutpkg.awk index 62aaad7..d4cc57c 100644 --- a/files/cutpkg.awk +++ b/files/cutpkg.awk @@ -1,8 +1,6 @@ OFS="-" { if ( NF > 3 ) { NF=NF-3 - print $0 - } else { - print $0 } } +1 -- cgit v1.2.3