Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2014 23:01:01 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r275089 - projects/building-blocks/tools
Message-ID:  <201411252301.sAPN11AC041536@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Nov 25 23:01:01 2014
New Revision: 275089
URL: https://svnweb.freebsd.org/changeset/base/275089

Log:
  Add script I'm using to add entries to OptionalObsoleteFiles.inc

Added:
  projects/building-blocks/tools/add-optional-obsolete-files-entries.sh   (contents, props changed)

Added: projects/building-blocks/tools/add-optional-obsolete-files-entries.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/building-blocks/tools/add-optional-obsolete-files-entries.sh	Tue Nov 25 23:01:01 2014	(r275089)
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Simple script for enumerating installed files for a list of directories
+#
+# usage: add-optional-obsolete-files-entries.sh directory ..
+#
+# $FreeBSD$
+
+: ${TMPDIR=/tmp}
+
+DESTDIR=$(mktemp -d $TMPDIR/tmp.XXXXXX) || exit
+trap "rm -Rf $DESTDIR" EXIT INT TERM
+
+# Don't pollute the output with 
+: ${SRCCONF=/dev/null}
+: ${__MAKE_CONF=/dev/null}
+
+if [ $# -gt 0 ]
+then
+	directories=$*
+else
+	directories=.
+fi
+
+export __MAKE_CONF DESTDIR SRCCONF
+
+SRCTOP=$(cd $(make -V'${.MAKE.MAKEFILES:M*/share/mk/sys.mk:H:H:H}'); pwd)
+
+# Don't install the manpage symlinks
+(cd $SRCTOP; make hier INSTALL_SYMLINK=true MK_MAN=no >/dev/null)
+
+for directory in $directories
+do
+	(cd $directory && make install >/dev/null) || exit
+done
+# Prune empty directories
+# XXX: is [ -n ... ] call necessary?
+while empty_dirs=$(find $DESTDIR -type d -and -empty) && [ -n "$empty_dirs" ]
+do
+	rmdir $empty_dirs
+done
+
+# Enumerate all of the installed files/directories
+(cd $DESTDIR;
+ find -s . -type f -mindepth 1 | sed -e 's,^,OLD_FILES+=,';
+ find -s . -type d -mindepth 1 -and \! -empty | \
+    egrep -v '^\./(s*bin|libexec|usr|usr/include|usr/lib|usr/libexec|usr/s*bin|usr/share|usr/share/man|usr/share/man/man[0-9])$' | \
+    sed -e 's,^,OLD_DIRS+=,'
+) | sed -e 's,+=\./,+=,'



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