diff options
-rw-r--r-- | pkgtools/pbulk/MESSAGE | 5 | ||||
-rw-r--r-- | pkgtools/pbulk/Makefile | 9 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pbulk.conf | 23 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/build | 4 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/client-clean | 17 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/pkg-build | 45 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date | 6 | ||||
-rwxr-xr-x | pkgtools/pbulk/files/pbulk/scripts/pre-build | 17 |
8 files changed, 94 insertions, 32 deletions
diff --git a/pkgtools/pbulk/MESSAGE b/pkgtools/pbulk/MESSAGE new file mode 100644 index 00000000000..46ca0e16aab --- /dev/null +++ b/pkgtools/pbulk/MESSAGE @@ -0,0 +1,5 @@ +$NetBSD: MESSAGE,v 1.1 2008/01/26 23:44:08 joerg Exp $ + +If you are updating pbulk from earlier versions, please don't forget +to update the configuration file. Otherwise unexpected results can +occur. diff --git a/pkgtools/pbulk/Makefile b/pkgtools/pbulk/Makefile index 2e4a5cd15d6..74ff6281084 100644 --- a/pkgtools/pbulk/Makefile +++ b/pkgtools/pbulk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.32 2008/01/26 01:57:00 joerg Exp $ +# $NetBSD: Makefile,v 1.33 2008/01/26 23:44:08 joerg Exp $ -DISTNAME= pbulk-0.25 +DISTNAME= pbulk-0.26 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty @@ -17,7 +17,7 @@ NO_CHECKSUM= YES USE_FEATURES= nbcompat USE_TOOLS+= awk:run bzip2:run digest:run gzip:run ident:run make:run \ - mail:run tar:run + mail:run sed:run tar:run DEPENDS+= rsync-[0-9]*:../../net/rsync .include "../../mk/bsd.prefs.mk" @@ -41,7 +41,8 @@ SUBST_FILES.tools= pbulk.conf scripts/build scripts/build-client-start \ scripts/create-report-html.awk scripts/create-report-txt.awk \ scripts/create-report.awk SUBST_VARS.tools= AWK BZIP2 DIGEST GZIP_CMD IDENT MAIL_CMD NEATO \ - PBULK_CONFIG PKG_INFO PREFIX SH TAR TARGET_MAKE + PBULK_CONFIG PKG_ADD_CMD PKG_DELETE_CMD \ + PKG_INFO_CMD PREFIX SED SH TAR TARGET_MAKE CONF_FILES+= share/examples/pbulk/pbulk.conf ${PKG_SYSCONFDIR}/pbulk.conf diff --git a/pkgtools/pbulk/files/pbulk/pbulk.conf b/pkgtools/pbulk/files/pbulk/pbulk.conf index 9bd33df828c..183fafb9579 100644 --- a/pkgtools/pbulk/files/pbulk/pbulk.conf +++ b/pkgtools/pbulk/files/pbulk/pbulk.conf @@ -1,4 +1,4 @@ -# $NetBSD: pbulk.conf,v 1.12 2008/01/26 03:14:18 joerg Exp $ +# $NetBSD: pbulk.conf,v 1.13 2008/01/26 23:44:08 joerg Exp $ # The URL where the build report will be made available. This is only # used in the .txt version of the report. @@ -43,6 +43,12 @@ report_graph_script_limit=512 # unprivileged_user=pbulk +# Variables used for the optional cross-compiling of packages. +# +cross_compile=no +target_arch=vax +target_destdir=/usr/src/destdir.${target_arch} + # The directories where the various files are created. # bulklog=/bulklog @@ -52,16 +58,10 @@ pkgsrc=/usr/pkgsrc pkgdb=/var/db/pkg varbase=/var -pkg_install_prefix=/usr/pkg -# For pkg_install from base (NetBSD only): -# pkg_install_prefix=/usr -# external_pkg_info=/usr/sbin/pkg_info -# For pkg_install from pkgsrc: -# pkg_install_prefix=$prefix -# Note that ${external_pkg_info} must be outside ${prefix}! -external_pkg_info="@PKG_INFO@" -pkg_add=${pkg_install_prefix}/sbin/pkg_add -pkg_delete=${pkg_install_prefix}/sbin/pkg_delete +# The following programs must NOT be inside ${prefix} +pkg_info=@PKG_INFO_CMD@ +pkg_add=@PKG_ADD_CMD@ +pkg_delete=@PKG_DELETE_CMD@ # The tools that are used for building the packages. If you do not want # to publish anything at all, set rsync=: and mail=:. @@ -76,6 +76,7 @@ make=@TARGET_MAKE@ mail=@MAIL_CMD@ neato=@NEATO@ rsync=@PREFIX@/bin/rsync +sed=@SED@ tar=@TAR@ loc=${bulklog}/meta diff --git a/pkgtools/pbulk/files/pbulk/scripts/build b/pkgtools/pbulk/files/pbulk/scripts/build index 6b6cb222107..afc094caa8e 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/build +++ b/pkgtools/pbulk/files/pbulk/scripts/build @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: build,v 1.3 2008/01/15 21:43:32 joerg Exp $ +# $NetBSD: build,v 1.4 2008/01/26 23:44:08 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -52,7 +52,7 @@ date '+BUILD_END_ISO=%Y-%m-%d %H:%M' >> ${loc}/status echo "Building pkg_summary..." cd ${packages}/All -sed 's/$/.tgz/' < ${loc}/success | sort | xargs ${external_pkg_info} -X | ${gzip} -c > pkg_summary.gz +sed 's/$/.tgz/' < ${loc}/success | sort | xargs ${pkg_info} -X | ${gzip} -c > pkg_summary.gz ${gzip} -dc < pkg_summary.gz | ${bzip2} -c > pkg_summary.bz2 if [ "${checksum_packages}" != "no" ] && \ diff --git a/pkgtools/pbulk/files/pbulk/scripts/client-clean b/pkgtools/pbulk/files/pbulk/scripts/client-clean index c6ec1302246..f1c85a15d87 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/client-clean +++ b/pkgtools/pbulk/files/pbulk/scripts/client-clean @@ -1,21 +1,28 @@ #!@SH@ -# $NetBSD: client-clean,v 1.7 2007/11/14 12:38:18 rillig Exp $ +# $NetBSD: client-clean,v 1.8 2008/01/26 23:44:08 joerg Exp $ . @PBULK_CONFIG@ set -e +if [ "$cross_compile" != "no" ]; then + cur_destdir=${target_destdir} +else + cur_destdir= +fi + # Clean build system first -rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true +rm -rf ${cur_destdir}${prefix} ${cur_destdir}${pkgdb} 2> /dev/null || true +rm -rf ${cur_destdir}${varbase}/qmail 2> /dev/null || true # Note: It is not an error if ${prefix} still exists at this point, # because it might be a mount point. # Install fresh bootstrap state if [ -f "${bootstrapkit}" ]; then - ${tar} -xzf ${bootstrapkit} -C / + ${tar} -xzf ${bootstrapkit} -C ${cur_destdir}/ elif [ -d "${bootstrapkit}" ]; then - [ -d ${prefix} ] || mkdir ${prefix} - cp -R ${bootstrapkit}/* ${prefix} + [ -d ${prefix} ] || mkdir ${cur_destdir}${prefix} + cp -R ${bootstrapkit}/* ${cur_destdir}${prefix} else : "Do nothing" fi diff --git a/pkgtools/pbulk/files/pbulk/scripts/pkg-build b/pkgtools/pbulk/files/pbulk/scripts/pkg-build index 295901cb7a1..e507861fe69 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build +++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: pkg-build,v 1.11 2008/01/21 12:37:46 tnn Exp $ +# $NetBSD: pkg-build,v 1.12 2008/01/26 23:44:08 joerg Exp $ # # Copyright (c) 2007, 2008 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -37,7 +37,12 @@ cleanup() { ${make} pbulk-save-wrkdir INTO=${bulklog}/${pkgname}/wrkdir.tar.gz fi if [ "$keep_prefix" = yes ] && [ -f ${bulklog}/${pkgname}/install.log ]; then - tar cfz ${bulklog}/${pkgname}/prefix.tar.gz ${prefix} + if [ "$cross_compile" != "no" ]; then + cur_destdir=${target_destdir} + else + cur_destdir= + fi + ${tar} cfz $${bulklog}/${pkgname}/prefix.tar.gz ${cur_destdir}${prefix} fi ${make} clean > /dev/null 2>&1 || true exit 1 @@ -107,13 +112,38 @@ if [ "$use_destdir" = "user-destdir" ]; then chown ${unprivileged_user} ${bulklog}/${pkgname}/work.log fi +pkg_add_normal() { + PKG_PATH=${packages}/All ${pkg_add} -K ${cur_pkgdb} "$@" +} + +pkg_add_cross() { + PKG_PATH=${packages}/All ${pkg_add} -K ${cur_pkgdb} \ + -m ${target_arch} -I -p ${target_destdir}${prefix} "$@" + echo "Fixing recorded cwd..." + ${pkg_info} -K ${target_destdir}${pkgdb} | while read pkg junk; do + ${sed} -e 's|@cwd '"${target_destdir}"'|@cwd |' \ + ${cur_pkgdb}/"${pkg}"/+CONTENTS > \ + ${cur_pkgdb}/"${pkg}"/+CONTENTS.tmp + mv ${cur_pkgdb}/"${pkg}"/+CONTENTS.tmp \ + ${cur_pkgdb}/"${pkg}"/+CONTENTS + done +} + +if [ "$cross_compile" != "no" ]; then + pkg_add_cmd=pkg_add_cross + cur_pkgdb="${target_destdir}${pkgdb}" +else + pkg_add_cmd=pkg_add_normal + cur_pkgdb="${pkgdb}" +fi + # Go to target directory cd ${pkgsrc}/${pkgdir} # Clean build area, just in case ${make} clean > ${bulklog}/${pkgname}/pre-clean.log 2>&1 # Install all dependencies the package said it would need if [ ! -z "$dependencies" ]; then - PKG_PATH=${packages}/All ${pkg_add} $dependencies > ${bulklog}/${pkgname}/depends.log 2>&1 + ${pkg_add_cmd} $dependencies > ${bulklog}/${pkgname}/depends.log 2>&1 fi # Build package, create a separate log file for each major phase run_make run_direct checksum > ${bulklog}/${pkgname}/checksum.log 2>&1 || cleanup @@ -124,15 +154,18 @@ run_make run_direct 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} \ + ${pkg_add_cmd} ${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 +# Test uninstall rules. This is not for cross-compiling as the install script +# is not run in that case anyway. +if [ "$cross_compile" = "no" ]; then + ${pkg_delete} -K ${cur_pkgdb} ${pkgname} > ${bulklog}/${pkgname}/deinstall.log 2>&1 +fi # Comment the following out if you want to test all deinstall scripts. # This is quite expensive and mostly redundant, so it is disabled by default. diff --git a/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date b/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date index b0e14f6869c..372227b9011 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date +++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: pkg-up-to-date,v 1.1.1.1 2007/06/19 19:49:59 joerg Exp $ +# $NetBSD: pkg-up-to-date,v 1.2 2008/01/26 23:44:09 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -37,7 +37,7 @@ set -e pkg="${packages}/All/$1.tgz" [ -f ${pkg} ] -${external_pkg_info} -qb ${pkg} | sed 's/:/ /' | while read file file_id; do +${pkg_info} -qb ${pkg} | sed 's/:/ /' | while read file file_id; do [ -z "$file" ] && continue id=`${ident} ${pkgsrc}/${file} 2> /dev/null | head -n 2 | sed -e 1d -e 's/^ //'` @@ -49,7 +49,7 @@ done # Remove current package, so that only dependencies are in $* now. shift -${external_pkg_info} -qN ${pkg} | while read dep; do +${pkg_info} -qN ${pkg} | while read dep; do # pkg_info prints a trailing newline, ignore that [ -z "${dep}" ] && continue found=0 diff --git a/pkgtools/pbulk/files/pbulk/scripts/pre-build b/pkgtools/pbulk/files/pbulk/scripts/pre-build index 5d06f895807..041db534d9a 100755 --- a/pkgtools/pbulk/files/pbulk/scripts/pre-build +++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build @@ -1,5 +1,5 @@ #!@SH@ -# $NetBSD: pre-build,v 1.6 2008/01/17 17:47:09 joerg Exp $ +# $NetBSD: pre-build,v 1.7 2008/01/26 23:44:09 joerg Exp $ # # Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. # All rights reserved. @@ -34,6 +34,21 @@ set -e +if [ "$cross_compile" != "no" ]; then + if [ -z "${target_destdir}" ]; then + echo "target_destdir must be set for cross-compiling." + exit 1 + fi + if [ ! -d "${target_destdir}" ]; then + echo "target_destdir must exist for cross-compiling." + exit 1 + fi + if [ `cd "${target_destdir}" && pwd` = "/" ]; then + echo "target_destdir must not be / for cross-compiling." + exit 1 + fi +fi + if [ -d "${bulklog}/meta" ]; then echo "Warning: All log files of the previous pbulk run will be" echo "removed in 5 seconds. If you want to abort, press Ctrl-C." |