Thu Jul 9 20:10:39 2009 UTC ()
Pullup ticket #2804 - by he
mk/bulk/build: robustness improvement
Revisions pulled up:
- mk/bulk/build 1.106
---
Module Name: pkgsrc
Committed By: he
Date: Thu Jul 9 12:46:50 UTC 2009
Modified Files:
pkgsrc/mk/bulk: build
Log Message:
With the most recent pkg_install, directories are removed when the
last file in a directory is removed. This might cause common and
expected-to-be-existing directories in /usr/pkg to be removed, and
a subsequent attempt at installing a file to the now non-existent
directory will instead create a file with the name of the expected
directory.
This will create PLIST errors for the package in question, but also will
cause the erroneously named file to not be removed on package removal.
This can cause cascading bulk build failures for subsequent packages.
To prevent this, after each package is done, check if some of the
common top-level expected-to-be directories are now files, and
remove them and emit an error message if so.
I *think* I already fixed the single package which had the unfortunate
problem of not declaring "include" as an installation directory, but
this should prevent the problem from re-occurring in the future as well.
Thanks to joerg@ for the hint for pulling in the value of PREFIX.
(tron)
diff -r1.105 -r1.105.14.1 pkgsrc/mk/bulk/build
--- pkgsrc/mk/bulk/Attic/build 2008/06/13 21:52:16 1.105
+++ pkgsrc/mk/bulk/Attic/build 2009/07/09 20:10:39 1.105.14.1
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: build,v 1.105 2008/06/13 21:52:16 sketch Exp $
+# $NetBSD: build,v 1.105.14.1 2009/07/09 20:10:39 tron Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org>
@@ -260,6 +260,7 @@
BULK_DBFILE DEPENDSFILE INDEXFILE ORDERFILE STARTFILE
SUPPORTSFILE BULK_BUILD_ID_FILE BUILDLOG BROKENFILE
BROKENWRKLOG
+ PREFIX
AWK GREP MAIL_CMD MKDIR PAX PERL5 SED
PKG_DELETE PKG_INFO PKGBASE"
@@ -333,10 +334,20 @@
$makeargs </dev/null | post_filter_cmd
) || true
echo "$pkgdir" >> "${main_buildlog}"
+ check_pkg_dirs
fi
done
echo "build> Build finished."
+}
+
+check_pkg_dirs () {
+ for d in bin etc include info lib libexec man sbin share; do
+ if [ -f $PREFIX/$d ]; then
+ echo "Removing file, should be dir: $PREFIX/$d" >&2
+ rm -f $PREFIX/$d
+ fi
+ done
}
# clean up installed packages left over