summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-01-16 14:20:08 +0000
committerjoerg <joerg@pkgsrc.org>2008-01-16 14:20:08 +0000
commit4498fe021cddbaf4a226e80bf4b64a1f5ce13ade (patch)
treea38018fab937fe1d9cb8771334bcd5291a0c8494
parentdaa4ab947066635c89693b716b8ad3554786b155 (diff)
downloadpkgsrc-4498fe021cddbaf4a226e80bf4b64a1f5ce13ade.tar.gz
pbulk-0.19:
- add support for building using DESTDIR.
-rw-r--r--pkgtools/pbulk/Makefile4
-rw-r--r--pkgtools/pbulk/files/pbulk/pbulk.conf4
-rwxr-xr-xpkgtools/pbulk/files/pbulk/scripts/pkg-build51
3 files changed, 46 insertions, 13 deletions
diff --git a/pkgtools/pbulk/Makefile b/pkgtools/pbulk/Makefile
index e520cf2928a..d8f3ab8a668 100644
--- a/pkgtools/pbulk/Makefile
+++ b/pkgtools/pbulk/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.24 2008/01/15 21:43:31 joerg Exp $
+# $NetBSD: Makefile,v 1.25 2008/01/16 14:20:08 joerg Exp $
-DISTNAME= pbulk-0.18
+DISTNAME= pbulk-0.19
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pbulk/files/pbulk/pbulk.conf b/pkgtools/pbulk/files/pbulk/pbulk.conf
index 9ebe76ecc76..c554688ee62 100644
--- a/pkgtools/pbulk/files/pbulk/pbulk.conf
+++ b/pkgtools/pbulk/files/pbulk/pbulk.conf
@@ -1,4 +1,4 @@
-# $NetBSD: pbulk.conf,v 1.10 2008/01/15 21:43:32 joerg Exp $
+# $NetBSD: pbulk.conf,v 1.11 2008/01/16 14:20:09 joerg Exp $
# The URL where the build report will be made available. This is only
# used in the .txt version of the report.
@@ -38,6 +38,8 @@ bootstrapkit=/usr/pkgsrc/bootstrap/bootstrap.tar.gz
report_graph_script_limit=512
+unprivileged_user=pbulk
+
# The directories where the various files are created.
#
bulklog=/bulklog
diff --git a/pkgtools/pbulk/files/pbulk/scripts/pkg-build b/pkgtools/pbulk/files/pbulk/scripts/pkg-build
index 03a8500b1f6..0508f31fae4 100755
--- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build
+++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build
@@ -1,7 +1,7 @@
#!@SH@
-# $NetBSD: pkg-build,v 1.7 2007/09/21 13:42:54 rillig Exp $
+# $NetBSD: pkg-build,v 1.8 2008/01/16 14:20:09 joerg Exp $
#
-# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+# Copyright (c) 2007, 2008 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
#
# This code was developed as part of Google's Summer of Code 2007 program.
@@ -43,8 +43,14 @@ cleanup() {
exit 1
}
+run_direct() "$@"
+run_su() su ${unprivileged_user} -c '"$@"' make "$@"
+
run_make() {
- ${make} $1 \
+ local run_cmd
+ run_cmd=$1
+ shift
+ ${run_cmd} ${make} $1 \
BATCH=1 \
DEPENDS_TARGET=/nonexistent \
${MAKE_FLAGS} \
@@ -64,16 +70,33 @@ while read build_info_line; do
dependencies=${build_info_line#DEPENDS=}
;;
MULTI_VERSION=*)
- MAKE_FLAGS=${build_info_line#MULTI_VERSION=*}
+ MAKE_FLAGS=${build_info_line#MULTI_VERSION=}
;;
+ USE_DESTDIR=*)
+ use_destdir=${build_info_line#USE_DESTDIR=}
esac
done
+case "$use_destdir" in
+user-destdir)
+ run_build=run_su
+ run_install=run_su
+ ;;
+destdir)
+ run_build=run_su
+ run_install=run_direct
+ ;;
+*)
+ run_build=run_direct
+ run_install=run_direct
+ ;;
+esac
+
${pkg_up_to_date_script} ${pkgname} ${dependencies} && exit 0
set -e
-@PREFIX@/libexec/pbulk/client-clean
+/usr/pkg_bulk/libexec/pbulk/client-clean
# Create the output directory and clean it up
mkdir -p ${bulklog}/${pkgname}
@@ -88,13 +111,21 @@ if [ ! -z "$dependencies" ]; then
PKG_PATH=${packages}/All ${pkg_add} $dependencies > ${bulklog}/${pkgname}/depends.log 2>&1
fi
# Build package, create a separate log file for each major phase
-run_make checksum > ${bulklog}/${pkgname}/checksum.log 2>&1 || cleanup
-run_make configure > ${bulklog}/${pkgname}/configure.log 2>&1 || cleanup
-run_make all > ${bulklog}/${pkgname}/build.log 2>&1 || cleanup
-run_make install > ${bulklog}/${pkgname}/install.log 2>&1 || cleanup
-run_make package > ${bulklog}/${pkgname}/package.log 2>&1 || cleanup
+run_make ${run_build} checksum > ${bulklog}/${pkgname}/checksum.log 2>&1 || cleanup
+run_make ${run_build} configure > ${bulklog}/${pkgname}/configure.log 2>&1 || cleanup
+run_make ${run_build} all > ${bulklog}/${pkgname}/build.log 2>&1 || cleanup
+run_make ${run_install} install > ${bulklog}/${pkgname}/install.log 2>&1 || cleanup
+run_make ${run_install} package > ${bulklog}/${pkgname}/package.log 2>&1 || cleanup
+
+# When using DESTDIR build, add the package once to test install rules.
+if [ "$use_destdir" != "no" ]; then
+ PKG_PATH=${packages}/All ${pkg_add} ${pkgname} \
+ > ${bulklog}/${pkgname}/package.log 2>&1 || cleanup
+fi
+
# Clean build area
${make} clean > ${bulklog}/${pkgname}/clean.log 2>&1
+
# Test uninstall rules
${pkg_delete} ${pkgname} > ${bulklog}/${pkgname}/deinstall.log 2>&1