Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 2014 04:56:05 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r351446 - head/Mk/Scripts
Message-ID:  <201404170456.s3H4u5GW038413@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404170456.s3H4u5GW038413>