From owner-svn-ports-all@FreeBSD.ORG Thu Apr 17 04:56:05 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6CAB7947; Thu, 17 Apr 2014 04:56:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9BD12C5; Thu, 17 Apr 2014 04:56:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3H4u5Vp038414; Thu, 17 Apr 2014 04:56:05 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3H4u5GW038413; Thu, 17 Apr 2014 04:56:05 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201404170456.s3H4u5GW038413@svn.freebsd.org> From: Bryan Drewery Date: Thu, 17 Apr 2014 04:56:05 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r351446 - head/Mk/Scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Apr 2014 04:56:05 -0000 Author: bdrewery Date: Thu Apr 17 04:56:04 2014 New Revision: 351446 URL: http://svnweb.freebsd.org/changeset/ports/351446 QAT: https://qat.redports.org/buildarchive/r351446/ Log: - 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 Added: head/Mk/Scripts/check_leftovers.sh (contents, props changed) Added: head/Mk/Scripts/check_leftovers.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Mk/Scripts/check_leftovers.sh Thu Apr 17 04:56:04 2014 (r351446) @@ -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