diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-04-17 12:56:04 +0800 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-04-17 12:56:04 +0800 |
commit | 1c7777affab0adb11b83770861eb15e08b950d40 (patch) | |
tree | 53d31d44f33644e28fa91a9318ef7bdc4f8e94f8 | |
parent | 9483e14edbce92a5e785b18aa184be5b07fd977e (diff) | |
download | freebsd-ports-gnome-1c7777affab0adb11b83770861eb15e08b950d40.tar.gz freebsd-ports-gnome-1c7777affab0adb11b83770861eb15e08b950d40.tar.zst freebsd-ports-gnome-1c7777affab0adb11b83770861eb15e08b950d40.zip |
- Add script for handling leftover processing by poudriere/tinderbox.
This will contain all approved/whitelisted leftovers in a single
reference. It will also allow us to update the whitelist without
needing a new release of poudriere/tinderbox and forcing users
to update those tools.
Usage: env PORTSDIR=... check_leftovers.sh category/port
stdin:
- missing-file
+ new-file
M modified-file reason...
stdout:
same -/+/M format, but with files substituted, without approved
whitelisted files, and hides any directories already in plist.
- Add /var/qmail/queue to the list of whitelisted directories just as
/var/mail is. This queue directory contains mails in flight and may receive
or have mail removed during an upgrade.
Obtained from: Mostly poudriere
Reviewed by: antoine
With hat: portmgr
-rw-r--r-- | Mk/Scripts/check_leftovers.sh | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/Mk/Scripts/check_leftovers.sh b/Mk/Scripts/check_leftovers.sh new file mode 100644 index 000000000000..73a04d702894 --- /dev/null +++ b/Mk/Scripts/check_leftovers.sh @@ -0,0 +1,139 @@ +#! /bin/sh +# $FreeBSD$ +# +# MAINTAINER: portmgr@FreeBSD.org +# +# This script is used by poudriere and tinderbox(soon) as the source-of-truth for +# what should be considered a leftover and what is whitelisted. +# +# !!!! This script's input/output format must remain backwards-compatible. +# !!!! If you want to change it, create a new script and have the calling +# !!!! scripts use the new one if available. +# +# Usage: env PORTSDIR=... check_leftovers.sh category/port +# stdin: +# - missing-file +# + new-file +# M modified-file reason... +# +# stdout: +# same -/+/M format, but with files substituted, without approved +# whitelisted files, and hides any directories already in plist. + +origin="$1" +[ $# -eq 1 ] || { echo "Must supply ORIGIN as parameter" >&2; exit 1; } +[ -n "${PORTSDIR}" ] || { echo "PORTSDIR must be set" >&2; exit 1; } + +portdir="${PORTSDIR}/${origin}" + +# PREFIX/LOCALBASE may be set in env or want default from port. +if [ -n "${PREFIX}" ]; then + PORT_FLAGS="${PORT_FLAGS} PREFIX=${PREFIX}" +else + PREFIX=$(make -C ${portdir} -VPREFIX) +fi +if [ -n "${LOCALBASE}" ]; then + PORT_FLAGS="${PORT_FLAGS} LOCALBASE=${LOCALBASE}" +else + LOCALBASE=$(make -C ${portdir} -VLOCALBASE) +fi +homedirs=$(awk -F: -v users=$(make -C ${portdir} -V USERS|sed -e 's, ,|,g;/^$/d') '$1 ~ users {print $9}' ${PORTSDIR}/UIDs|sort -u|sed -e "s|/usr/local|${PREFIX}|") +plistsub_sed=$(make -C ${portdir} -VPLIST_SUB_SED) +tmpplist=$(make -C ${portdir} -VTMPPLIST) + +while read modtype path extra; do + ignore_path=0 + sub_path=$(echo "$path" | sed -e "s|^${PREFIX}/||" -e "${plistsub_sed}") + # If this is a directory, use @dirrm in output + [ -d "${path}" ] && sub_path="@dirrm ${sub_path}" + + # Ignore everything from these files/directories + case "${path}" in + ${HOME:-/root}/.ccache/*|\ + /compat/linux/proc/*|\ + /dev/*|\ + /etc/make.conf.bak|\ + /proc/*|\ + /tmp/*|\ + /var/db/pkg/*|\ + /var/db/ports/*|\ + /var/log/*|\ + /var/mail/*|\ + /var/run/*|\ + /var/tmp/*) continue ;; + # fc-cache - skip for now + /var/db/fontconfig/*) continue ;; + esac + case $modtype in + +) + if [ -d "${path}" ]; then + # home directory of users created + case " ${homedirs} " in + *\ ${path}\ *) continue ;; + *\ ${path}/*\ *) continue ;; + esac + # Don't show dirs already in plist (due to parents) + grep -qE \ + "^@(unexec rmdir \"?(%D/|${PREFIX})?${path#${PREFIX}/}[ \"]|dirrm(try)? ${path#${PREFIX}/}\$)" \ + ${tmpplist} && continue + fi + + # Check absolute paths + case "${path}" in + # Leave qmail's queue dir alone to not cause lost mail + # during upgrades, just as /var/mail is left alone. + /var/qmail/queue/*|/var/qmail/queue) continue ;; + esac + + # Check relative/plist paths + case "${sub_path}" in + # gconftool-2 --makefile-uninstall-rule is unpredictable + etc/gconf/gconf.xml.defaults/%gconf-tree*.xml) ;; + *) echo "+ ${sub_path}" ;; + esac + ;; + -) + # Skip if it is PREFIX and non-LOCALBASE. See misc/kdehier4 + # or mail/qmail for examples + [ "${path}" = "${PREFIX}" -a "${LOCALBASE}" != "${PREFIX}" ] && + ignore_path=1 + + [ $ignore_path -eq 0 ] && echo "- ${sub_path}" + ;; + M) + # Check relative/plist paths + case "${sub_path}" in + # gconftool-2 --makefile-uninstall-rule is unpredictable + etc/gconf/gconf.xml.defaults/%gconf-tree*.xml) ;; + # This is a cache file for gio modules could be modified + # for any gio modules + lib/gio/modules/giomodule.cache) ;; + # removal of info files leaves entry uneasy to cleanup + # in info/dir + info/dir) ;; + */info/dir) ;; + # The is pear database cache + %%PEARDIR%%/.depdb|%%PEARDIR%%/.filemap) ;; + #ls-R files from texmf are often regenerated + */ls-R) ;; + # Octave packages database, blank lines can be inserted + # between pre-install and post-deinstall + share/octave/octave_packages) ;; + # xmlcatmgr is constantly updating catalog.ports ignore + # modification to that file + share/xml/catalog.ports) ;; + # Ignore common system config files + /etc/group|\ + /etc/make.conf|\ + /etc/master.passwd|\ + /etc/passwd|\ + /etc/pwd.db|\ + /etc/shells|\ + /etc/spwd.db) ;; + *) echo "M ${sub_path#@dirrm } ${extra}" ;; + esac + ;; + esac +done + +exit 0 |