auditing port options and following default option value changes

Don Lewis truckman at FreeBSD.org
Fri Aug 29 01:10:13 UTC 2014


On 28 Aug, Don Lewis wrote:
> On 28 Aug, Matthew Seaman wrote:

>> poudriere options creates a directory structure under
>> /usr/local/etc/poudriere.d/options [*] identical to what's under
>> /var/db/ports
>> so you can just make a link...
>> 
>> # cd /usr/local/etc/poudriere.d
>> # ls -la options
>> lrwxr-xr-x  1 root  wheel  13 Dec 24  2012 options@ -> /var/db/ports
> 
> I noticed that, but I figure this is a good opportunity to clean out all
> the cruft that accumulated.  Off the top of my head, I can think of only
> a small handful of things that I don't want at their default settings,
> and I suspect that can mostly be handled by setting them in make.conf.
> I just want to make sure that I'm not overlooking something in those 509
> option files ...

I discovered "make showconfig" and used it to hack together this script
that prints out port options that are set to non-default values:
<http://people.freebsd.org/~truckman/portoptions>

#!/bin/sh
PORTSDIR=/usr/ports

EMPTYPORTDBDIR=`mktemp -d /tmp/emptyXXXXXXX`
OPTIONDEFAULTS=`mktemp /tmp/optiondefaultsXXXXXX`
OPTIONSETTINGS=`mktemp /tmp/optionsettingsXXXXXX`
DEFAULTS=`mktemp /tmp/defaultsXXXXXX`
SETTINGS=`mktemp /tmp/settingsXXXXXX`
DESCR=`mktemp /tmp/descrXXXXXX`

FILTEREXP="/^===> Use 'make config'/d;s/The following configuration options are available for//;s/^ *//"
for port in `pkg info -ao | awk '{print $2;}' | sort`; do
  if [ -d ${PORTSDIR}/${port} ]; then
	(cd ${PORTSDIR}/${port} &&					\
         make PORT_DBDIR=${EMPTYPORTDIR} showconfig |			\
         sed -e "${FILTEREXP}" >> ${OPTIONDEFAULTS})
	(cd ${PORTSDIR}/${port} &&					\
	 make showconfig |						\
	 sed -e "${FILTEREXP}" >> ${OPTIONSETTINGS})
  fi
done
FILTEREXP2='s/^===.*/                /;s/^([^[:space:]]+=[^[:space:]]*):[[:space:]].*/\1                /;s/(................).*/\1/'
sed -E -e "${FILTEREXP2}" < ${OPTIONDEFAULTS} > ${DEFAULTS}
sed -E -e "${FILTEREXP2}" < ${OPTIONSETTINGS} > ${SETTINGS}
sed -E -e 's/^[^[:space:]]+=[^[:space:]]+:[[:space:]]*//' < ${OPTIONDEFAULTS} > ${DESCR}
echo "Default        	Current Setting"
paste ${DEFAULTS} ${SETTINGS} ${DESCR} | awk '{if ($1 != $2) print $0;}'
rmdir ${EMPTYPORTDBDIR}
rm ${OPTIONDEFAULTS}
rm ${OPTIONSETTINGS}
rm ${DEFAULTS}
rm ${SETTINGS}
rm ${DESCR}



More information about the freebsd-ports mailing list