Request for test patch #5

Open
opened 2025-03-15 22:58:30 +01:00 by rizitis · 0 comments
rizitis commented 2025-03-15 22:58:30 +01:00 (Migrated from github.com)

Hello, I have a patch for slackpkg (original), my request is to test it how it work when also slackpkg+ is installed.

The patch concerns /usr/libexec/slackpkg/core-functions.sh
Note that, after applying the patch, the user must create a new file: /etc/slackpkg/whitelist

In the whitelist, he can list package names that he wants to be excluded from the blacklist even if the entire set is described in the blacklist.

Example:
Let's assume that the user has all of kde/ in the blacklist
But he wants to have in his installation and update some packages from the kde set. He can list these in the whitelist and they will be excluded from the blacklist

Personally, I have my own plasma6 on my system (Slackware64-current) and I have all of kde/ blacklisted. But my whitelist is:

cat /etc/slackpkg/whitelist
# Add here packages that you DONT want to be blacklisted even if all set include them is in blacklist.
# Assume in /etc/slackpkg/blacklist you have: kde/
# Add here any package name from kde set you DONT what to be blacklisted:
qca
futuresql
qcoro
digikam

This way the listed packages are updated normally.

Please try it if it creates problems or if it is compatible with slackpkg+
or if it needs improvement.

Thanks.


patch:

--- /usr/libexec/slackpkg/core-functions.sh.BAK	2025-03-13 23:43:00.857026637 +0200
+++ /usr/libexec/slackpkg/core-functions.sh	2025-03-15 23:14:00.495021224 +0200
@@ -628,38 +628,78 @@
 # names (lpkg) and packages unique to one or other file (dpkg)
 #
 function listpkgname() {
-	cut -f2 -d\  ${TMPDIR}/pkglist | sort > ${TMPDIR}/spkg	
-	cut -f2 -d\  ${TMPDIR}/tmplist | sort > ${TMPDIR}/lpkg
-	cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
-		cut -f2-6 -d\ |sort | uniq -u | \
-		cut -f1 -d\  | uniq > ${TMPDIR}/dpkg
+    # Generate spkg (mirror package names) and lpkg (local package names)
+    cut -f2 -d\  ${TMPDIR}/pkglist | sort > ${TMPDIR}/spkg
+    cut -f2 -d\  ${TMPDIR}/tmplist | sort > ${TMPDIR}/lpkg
+
+    # Create dpkg (packages unique to one or the other file)
+    cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
+        cut -f2-6 -d\ | sort | uniq -u | \
+        cut -f1 -d\  | uniq | sort > ${TMPDIR}/dpkg
+
+    # Ensure dpkg is sorted for the comm comparison
+    sort ${TMPDIR}/dpkg -o ${TMPDIR}/dpkg
+
+    # Check if the whitelist exists and log its contents for debugging
+    if [ -f $CONF/whitelist ]; then
+        echo "Whitelist found, processing..."
+        # Process and append the whitelist to dpkg list
+    while read whitelist_package; do
+    # Skip lines that are comments (starting with #) or empty lines
+    if [[ "$whitelist_package" =~ ^#.* ]] || [[ -z "$whitelist_package" ]]; then
+        continue
+    fi
+    # Check if the package is already in dpkg
+    if grep -q "^$whitelist_package$" ${TMPDIR}/dpkg; then
+        echo "Package $whitelist_package already in dpkg, skipping."
+    else
+        echo "Adding to dpkg: $whitelist_package"
+        echo "$whitelist_package" >> ${TMPDIR}/dpkg
+    fi
+    done < $CONF/whitelist
+
+    else
+        echo "Whitelist not found."
+    fi
+
+    # Ensure dpkg is sorted again after whitelist is added
+    sort ${TMPDIR}/dpkg -o ${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() {
-	# Check that we have the files we need
-	if [ ! -f ${WORKDIR}/pkglist ] || [ ! -f ${CONF}/blacklist ];then
-		return 1
-	fi
-
-	# Create tmp blacklist in a more usable format
-	sed -E "s,(^[[:blank:]]+|[[:blank:]]+$),,
-		/(^#|^$)/d
-		s,^, ,
-		s,$, ,
-		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
-	) | cut -d\  -f1-7 | grep -E -f ${TMPDIR}/blacklist.tmp |
-		awk '{print $2}' | sort -u | sed "s,[+],[+],g
-		s,$,-[^-]+-($ARCH|noarch|fw)-[^-]+,g" > ${TMPDIR}/blacklist
+    # Check that we have the necessary files
+    if [ ! -f ${WORKDIR}/pkglist ] || [ ! -f ${CONF}/blacklist ]; then
+        return 1
+    fi
+
+    # Create a temporary blacklist in a more usable format
+    sed -E "s,(^[[:blank:]]+|[[:blank:]]+$),,
+        /(^#|^$)/d
+        s,^, ,
+        s,$, ,
+        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
+    ) | cut -d\  -f1-7 | grep -E -f ${TMPDIR}/blacklist.tmp |
+        awk '{print $2}' | sort -u | sed "s,[+],[+],g
+        s,$,-[^-]+-($ARCH|noarch|fw)-[^-]+,g" > ${TMPDIR}/blacklist
+
+    # Now exclude whitelist packages from being blacklisted
+    if [ -f ${CONF}/whitelist ]; then
+        while read whitelist_package; do
+            # If the package is in the blacklist, remove it
+#           sed -i "/^$whitelist_package-/d" ${TMPDIR}/blacklist
+sed -i "/^$whitelist_package-[^a-zA-Z0-9 -]\+/d" ${TMPDIR}/blacklist
+		done < ${CONF}/whitelist
+    fi
 }
 
 # Blacklist filter

Hello, I have a patch for slackpkg (original), my request is to test it how it work when also slackpkg+ is installed. The patch concerns /usr/libexec/slackpkg/core-functions.sh Note that, after applying the patch, the user must create a new file: /etc/slackpkg/whitelist In the whitelist, he can list package names that he wants to be excluded from the blacklist even if the entire set is described in the blacklist. Example: Let's assume that the user has all of kde/ in the blacklist But he wants to have in his installation and update some packages from the kde set. He can list these in the whitelist and they will be excluded from the blacklist Personally, I have my own plasma6 on my system (Slackware64-current) and I have all of kde/ blacklisted. But my whitelist is: ``` cat /etc/slackpkg/whitelist # Add here packages that you DONT want to be blacklisted even if all set include them is in blacklist. # Assume in /etc/slackpkg/blacklist you have: kde/ # Add here any package name from kde set you DONT what to be blacklisted: qca futuresql qcoro digikam ``` This way the listed packages are updated normally. Please try it if it creates problems or if it is compatible with slackpkg+ or if it needs improvement. Thanks. --- patch: ``` --- /usr/libexec/slackpkg/core-functions.sh.BAK 2025-03-13 23:43:00.857026637 +0200 +++ /usr/libexec/slackpkg/core-functions.sh 2025-03-15 23:14:00.495021224 +0200 @@ -628,38 +628,78 @@ # names (lpkg) and packages unique to one or other file (dpkg) # function listpkgname() { - cut -f2 -d\ ${TMPDIR}/pkglist | sort > ${TMPDIR}/spkg - cut -f2 -d\ ${TMPDIR}/tmplist | sort > ${TMPDIR}/lpkg - cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \ - cut -f2-6 -d\ |sort | uniq -u | \ - cut -f1 -d\ | uniq > ${TMPDIR}/dpkg + # Generate spkg (mirror package names) and lpkg (local package names) + cut -f2 -d\ ${TMPDIR}/pkglist | sort > ${TMPDIR}/spkg + cut -f2 -d\ ${TMPDIR}/tmplist | sort > ${TMPDIR}/lpkg + + # Create dpkg (packages unique to one or the other file) + cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \ + cut -f2-6 -d\ | sort | uniq -u | \ + cut -f1 -d\ | uniq | sort > ${TMPDIR}/dpkg + + # Ensure dpkg is sorted for the comm comparison + sort ${TMPDIR}/dpkg -o ${TMPDIR}/dpkg + + # Check if the whitelist exists and log its contents for debugging + if [ -f $CONF/whitelist ]; then + echo "Whitelist found, processing..." + # Process and append the whitelist to dpkg list + while read whitelist_package; do + # Skip lines that are comments (starting with #) or empty lines + if [[ "$whitelist_package" =~ ^#.* ]] || [[ -z "$whitelist_package" ]]; then + continue + fi + # Check if the package is already in dpkg + if grep -q "^$whitelist_package$" ${TMPDIR}/dpkg; then + echo "Package $whitelist_package already in dpkg, skipping." + else + echo "Adding to dpkg: $whitelist_package" + echo "$whitelist_package" >> ${TMPDIR}/dpkg + fi + done < $CONF/whitelist + + else + echo "Whitelist not found." + fi + + # Ensure dpkg is sorted again after whitelist is added + sort ${TMPDIR}/dpkg -o ${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() { - # Check that we have the files we need - if [ ! -f ${WORKDIR}/pkglist ] || [ ! -f ${CONF}/blacklist ];then - return 1 - fi - - # Create tmp blacklist in a more usable format - sed -E "s,(^[[:blank:]]+|[[:blank:]]+$),, - /(^#|^$)/d - s,^, , - s,$, , - 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 - ) | cut -d\ -f1-7 | grep -E -f ${TMPDIR}/blacklist.tmp | - awk '{print $2}' | sort -u | sed "s,[+],[+],g - s,$,-[^-]+-($ARCH|noarch|fw)-[^-]+,g" > ${TMPDIR}/blacklist + # Check that we have the necessary files + if [ ! -f ${WORKDIR}/pkglist ] || [ ! -f ${CONF}/blacklist ]; then + return 1 + fi + + # Create a temporary blacklist in a more usable format + sed -E "s,(^[[:blank:]]+|[[:blank:]]+$),, + /(^#|^$)/d + s,^, , + s,$, , + 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 + ) | cut -d\ -f1-7 | grep -E -f ${TMPDIR}/blacklist.tmp | + awk '{print $2}' | sort -u | sed "s,[+],[+],g + s,$,-[^-]+-($ARCH|noarch|fw)-[^-]+,g" > ${TMPDIR}/blacklist + + # Now exclude whitelist packages from being blacklisted + if [ -f ${CONF}/whitelist ]; then + while read whitelist_package; do + # If the package is in the blacklist, remove it +# sed -i "/^$whitelist_package-/d" ${TMPDIR}/blacklist +sed -i "/^$whitelist_package-[^a-zA-Z0-9 -]\+/d" ${TMPDIR}/blacklist + done < ${CONF}/whitelist + fi } # Blacklist filter ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
alienbob/slackpkgplus#5
No description provided.