Fixup internal blacklist handling, i.e. see remainder of commit

This creates a blacklist of package names from regexp in original
file (/etc/slackpkg/blacklist) and uses the precreated list for
later comparison

Signed-off-by: Robby Workman <rworkman@slackware.com>
This commit is contained in:
Dave Woodfall 2021-02-11 17:10:25 -06:00 committed by Robby Workman
parent f87bf1bf68
commit 3ea13bebcb

View file

@ -583,6 +583,33 @@ function listpkgname() {
cut -f1 -d\ | uniq > ${TMPDIR}/dpkg cut -f1 -d\ | uniq > ${TMPDIR}/dpkg
} }
# create a blacklist of single package names from regexps in original blacklist
# any sets such as kde/ are converted to single package names in the process
# the final list will be used by 'applyblacklist' later
function mkregex_blacklist() {
# create tmp blacklist in a more usable format
sed -E "
/(^#|[[:blank:]]+$|^[[:blank:]]+|^$)/d
s,^, ,
s,$, ,
s,^\s(extra|pasture|patches|slackware(|64)|testing)\s$,\1 ,
s,^\s(tgz|txz)\s$, \1,
s,^\s([^/]+)/\s$, ./$PKGMAIN/\1 ,
" ${ROOT}/${CONF}/blacklist > ${TMPDIR}/blacklist.tmp
# create second blacklist of single packages from tmp list
cat ${ROOT}/${WORKDIR}/pkglist | grep -E -f ${TMPDIR}/blacklist.tmp |
awk '{print $2}' | sed -E "s,^, ,; s,$, ," > ${TMPDIR}/blacklist
# remove sets from tmp blacklist, join both lists to create unique list
sed -E "/\.\/$PKGMAIN\/[^/]+/d" ${TMPDIR}/blacklist.tmp |
sort -u -o ${TMPDIR}/blacklist ${TMPDIR}/blacklist -
# clean up
rm -f ${TMPDIR}/blacklist.tmp
}
# blacklist filter
function applyblacklist() { function applyblacklist() {
grep -vE -f ${TMPDIR}/blacklist grep -vE -f ${TMPDIR}/blacklist
} }
@ -595,21 +622,15 @@ function makelist() {
local VRFY local VRFY
INPUTLIST=$@ INPUTLIST=$@
mkregex_blacklist
grep -vE "(^#|^[[:blank:]]*$)" ${ROOT}/${CONF}/blacklist | \
sed -E "
s,^, ,
s,$, ,
s,^\s(extra|pasture|patches|slackware(|64)|testing)\s$,\1 ,
s,^\s(tgz|txz)\s$, \1,
s,^\s([^/]*)/\s$, ./$PKGMAIN/\1 ,
" \
> ${TMPDIR}/blacklist
if echo $CMD | grep -q install ; then if echo $CMD | grep -q install ; then
ls -1 $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist ls -1 $ROOT/var/log/packages/* |
awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist
else else
ls -1 $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist ls -1 $ROOT/var/log/packages/* |
awk -f /usr/libexec/slackpkg/pkglist.awk |
applyblacklist > ${TMPDIR}/tmplist
fi fi
cat ${ROOT}/${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist cat ${ROOT}/${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist