pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pbulk/files/pbulk/scripts Removed code duplic...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bdc8bb3b746e
branches:  trunk
changeset: 533568:bdc8bb3b746e
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Sep 21 13:42:54 2007 +0000

description:
Removed code duplication by calling the client-clean script.

Before removing prefix, fix the permissions. Everything inside that
directory must be writable and all directories must be searchable.
NetBSD's chmod has an option -P which I would have liked to use, but
POSIX requires only -R to be implemented. Therefore, it is possible that
permissions of files outside the prefix are changed due to symlinks.

The client-clean program promises to clean $prefix, so fail if that is
not possible. A common cause for this is that some files inside have
their flags set (see chflags(1) on NetBSD).

When installing the bootstrap kit, the source may be either a regular
file (which is then assumed to be a tar archive) or a directory (which
is copied directly). The latter option is new and allows for easier
changes of files once the bulk build has started.

diffstat:

 pkgtools/pbulk/files/pbulk/scripts/client-clean |  16 ++++++++++++++--
 pkgtools/pbulk/files/pbulk/scripts/pkg-build    |   7 ++-----
 pkgtools/pbulk/files/pbulk/scripts/pre-build    |   7 ++-----
 3 files changed, 18 insertions(+), 12 deletions(-)

diffs (73 lines):

diff -r 4a810d66aa34 -r bdc8bb3b746e pkgtools/pbulk/files/pbulk/scripts/client-clean
--- a/pkgtools/pbulk/files/pbulk/scripts/client-clean   Fri Sep 21 13:34:52 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/client-clean   Fri Sep 21 13:42:54 2007 +0000
@@ -1,11 +1,23 @@
 #!@SH@
-# $NetBSD: client-clean,v 1.3 2007/08/15 21:10:55 joerg Exp $
+# $NetBSD: client-clean,v 1.4 2007/09/21 13:42:54 rillig Exp $
 
 . @PBULK_CONFIG@
 
 set -e
 
 # Clean build system first
+chmod -R 700 ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
 rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
+if [ -d "${prefix}" ]; then
+       echo "ERROR: [client-clean] Could not remove $prefix" 1>&2
+       exit 1
+fi
+
 # Install fresh bootstrap state
-[ -z "${bootstrapkit}" ] || ${tar} -xzf ${bootstrapkit} -C /
+if [ -f "${bootstrapkit}" ]; then
+       ${tar} -xzf ${bootstrapkit} -C /
+elif [ -d "${bootstrapkit}" ]; then
+       cp -R ${bootstrapkit} ${prefix}
+else
+       # Do nothing
+fi
diff -r 4a810d66aa34 -r bdc8bb3b746e pkgtools/pbulk/files/pbulk/scripts/pkg-build
--- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build      Fri Sep 21 13:34:52 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build      Fri Sep 21 13:42:54 2007 +0000
@@ -1,5 +1,5 @@
 #!@SH@
-# $NetBSD: pkg-build,v 1.6 2007/09/21 13:34:52 rillig Exp $
+# $NetBSD: pkg-build,v 1.7 2007/09/21 13:42:54 rillig Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -73,10 +73,7 @@
 
 set -e
 
-# Clean build system first
-rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
-# Install fresh bootstrap state
-[ -n "${bootstrapkit}" ] &&  ${tar} -xzf ${bootstrapkit} -C /
+@PREFIX@/libexec/pbulk/client-clean
 
 # Create the output directory and clean it up
 mkdir -p ${bulklog}/${pkgname}
diff -r 4a810d66aa34 -r bdc8bb3b746e pkgtools/pbulk/files/pbulk/scripts/pre-build
--- a/pkgtools/pbulk/files/pbulk/scripts/pre-build      Fri Sep 21 13:34:52 2007 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build      Fri Sep 21 13:42:54 2007 +0000
@@ -1,5 +1,5 @@
 #!@SH@
-# $NetBSD: pre-build,v 1.3 2007/08/15 21:10:55 joerg Exp $
+# $NetBSD: pre-build,v 1.4 2007/09/21 13:42:54 rillig Exp $
 #
 # Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 # All rights reserved.
@@ -37,10 +37,7 @@
 rm -rf "${bulklog}" || true
 mkdir -p "${bulklog}" "${loc}"
 
-# Clean build system first
-rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
-# Install fresh bootstrap state
-[ -n "${bootstrapkit}" ] && ${tar} -xzf ${bootstrapkit} -C /
+@PREFIX@/libexec/pbulk/client-clean
 
 # Log common settings...
 opsys=`cd ${pkgsrc}/pkgtools/pkg_install && ${make} show-var VARNAME=OPSYS`



Home | Main Index | Thread Index | Old Index