Add support for FLAVORs (trade-off between slowness and functionality.

This commit is contained in:
Tomoaki AOKI [aka Junchoon] 2024-05-31 23:15:50 +09:00
parent 0596c76c90
commit 29bb76c04a
2 changed files with 26 additions and 4 deletions

View file

@ -2,7 +2,10 @@
## Description
A small script to generate a list of all ports installed, excluding leaf ports which you don't want to be rebuilt in conjunction of others.<br>
The author created this script because `poudriere bulk -a -j jailname` forces rebuilding ALL ports, which any of ports they depends on are updated, regardless it's too time-consuming or not.
The author created this script because `poudriere bulk -a -j jailname` forces rebuilding ALL ports, which any of ports they depends on are updated, regardless it's too time-consuming or not.<br>
This script recognizes FLAVORS.
The logic to support FLAVORs are tricky, as pkg does not support providing to list all installed ports as category/origin[@flavor] format.<br>
Currently, flavors of individual ports installed is listed only in annotations with other entries.
## Usage
No command line arguments.Simply run it as a bourne shell script.<br>
@ -14,8 +17,9 @@ You need to edit the script and set variables in it.
### Variables for configuration
#### BLOCKLISTS
ports origins you want to block from building.<br>
Origins of ports you want to block from building.<br>
Each origins must be the form poudriere can accept.<br>
For ports having flavors, if you want to block specific flavor only, you can specify the flavor by adding @flavor like `textproc/fcitx5-qt@qt6`. Otherwise, all flavors installed for the origin are blocked from listing.<br>
Note that poudriere does not block building listed ports if it is depended upon by any non-listed ports.
Beware! If the origin is NOT a leaf ports, you must specify ALL origins of the ports/pkgs which depends on it, for example, japanese/libreoffice as the actual leaf of editors/libreoffice must be specified in conjunction with editors/libreoffice.

View file

@ -40,6 +40,8 @@ TMPFILE=${LISTFILE}-`id -u`-`date "+%Y%m%d%H%M%S"`
echo Output = ${LISTDIR}/${LISTFILE}
echo Temporary = ${TMPDIR}/${TMPFILE}
# End configurations section.
# Cleanup old lists if exists, and rotate list.
@ -50,15 +52,31 @@ if [ -f ${LISTDIR}/${LISTFILE}.old ] ; then chmod 666 ${LISTDIR}/${LISTFILE}.old
# Regenerate list with newly installed ports.
for PORT in `pkg query -a %n` ; do
for PACKAGE in `pkg query -a %n` ; do
PORT=`pkg query %o ${PACKAGE}`
FLAVOR=`pkg info -A ${PACKAGE} | fgrep "flavor" | cut -f 4 -w`
FLG=NO
for NONEED in ${BLOCKLISTS} ; do
if [ -n ${FLAVOR} ] ; then
if [ ${PORT}@${FLAVOR} = ${NONEED} ] ; then FLG="YES" ; fi
fi
if [ ${PORT} = ${NONEED} ] ; then FLG="YES" ; fi
done
fgrep "${PORT}\|\|" ${PORTSDIR}/MOVED > /dev/null
RET=$?
if [ 0 -eq $((RET)) ] ; then FLG="YES" ; fi
if [ "NO" = ${FLG} ] ; then echo ${PORT} >> ${TMPDIR}/${TMPFILE} ; fi
if [ -n ${FLAVOR} ] ; then
fgrep "${PORT}@${FLAVOR}\|\|" ${PORTSDIR}/MOVED > /dev/null
RET=$?
if [ 0 -eq $((RET)) ] ; then FLG="YES" ; fi
fi
if [ "NO" = ${FLG} ] ; then
if [ -z ${FLAVOR} ] ; then
echo ${PORT} >> ${TMPDIR}/${TMPFILE}
else
echo ${PORT}@${FLAVOR} >> ${TMPDIR}/${TMPFILE}
fi
fi
done
sort ${TMPDIR}/${LISTFILE} | uniq > ${LISTDIR}/${LISTFILE}