Warning: there may be occasional oddness due to css and blog edits. **KNOWN ISSUE: possible hidden text**

Friday, March 12, 2021

Poudriere blacklist filter

Remember when I mentioned in a previous blog post how it seemed strange that the blacklist was not applied to the input file at the outset?  I have finally perfected a script which will do this with only minor adjustment to the poudriere commandline invocation.  Of course, file names, script names, may need adjustment to suit your environment or tastes.  Below is the relatively simple sh script named p-keg-deblack which does the work.

#!/bin/sh
rm /var/tmp/cleaned_blacklist 2>/dev/null
grep -v \# ~/Symbolic_Links/13amd64-blacklist | sort -d -u >> /var/tmp/cleaned_blacklist

diff $1 /var/tmp/cleaned_blacklist | grep \< |sed  -e 's/^<\ //g' -e 's/---//g' -e '1d' > ~/$1-deblack

echo $1-deblack

First, it removes any temporary files it had created, if none exist the error is silenced.  Your blacklist file for poudriere may include comment lines which would begin with # and so those are excluded by an inverted grep.  Since my build lists are all sorted in dictionary order with only unique lines, we treat the blacklist the same way, regardless of how it is actually organized, the output is placed in a temporary file.  Now we compare the build list with the cleaned blacklist.  Diff will place all the lines unique to each file preceded with a < or > depending upon which file, the first is on the left "<" and the second is on the right ">".  We want those lines which are only in the build list, so we grep all lines beginning with "<" then we remove "< " to prepare the list for poudriere.  The first line of the diff indicates where in the file that section begins, and there is another line "---" which we do not want.  We create a file with your input file name adding a suffix of -deblack.  When this script is used, all that poudriere will see is this filename with suffix we just created.

How do we use this script when we invoke poudriere?  This makes the process as unobtrusive as possible, we add one more word and two characters.  Normally we would do something like the following:

poudriere bulk -f installed-pkgs-Gross -j 13amd64 -J 2:16
However, to include the script we use the line below:
poudriere bulk -f `p-keg-deblack installed-pkgs-Gross` -j 13amd64 -J 2:16

Essential caveat: Use this script at your own risk, I make no promises.

No comments:

Post a Comment

Thank you for your interest!

Frequently viewed this week