pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pbulk pbulk-0.26:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/83f46b13fa03
branches:  trunk
changeset: 538063:83f46b13fa03
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sat Jan 26 23:44:08 2008 +0000

description:
pbulk-0.26:
Add first pile of patches for cross-compiling support.
This still depends on the packages being pre-installed to
the normal prefix, but otherwise works. Cross-compiling
needs pkg_install-20080126. While here, simplify configuration
and allow using one pkg_install installation for everything.
As a side effect remove the pkgdb limitation for NetBSD builds.
Add a message that tells users to check the configuration file
on updates.

diffstat:

 pkgtools/pbulk/MESSAGE                            |   5 ++
 pkgtools/pbulk/Makefile                           |   9 ++--
 pkgtools/pbulk/files/pbulk/pbulk.conf             |  23 ++++++-----
 pkgtools/pbulk/files/pbulk/scripts/build          |   4 +-
 pkgtools/pbulk/files/pbulk/scripts/client-clean   |  17 ++++++--
 pkgtools/pbulk/files/pbulk/scripts/pkg-build      |  45 +++++++++++++++++++---
 pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date |   6 +-
 pkgtools/pbulk/files/pbulk/scripts/pre-build      |  17 ++++++++-
 8 files changed, 94 insertions(+), 32 deletions(-)

diffs (293 lines):

diff -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/MESSAGE
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pbulk/MESSAGE    Sat Jan 26 23:44:08 2008 +0000
@@ -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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/Makefile
--- a/pkgtools/pbulk/Makefile   Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/Makefile   Sat Jan 26 23:44:08 2008 +0000
@@ -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 @@
 
 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 @@
        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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/pbulk.conf
--- a/pkgtools/pbulk/files/pbulk/pbulk.conf     Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/pbulk.conf     Sat Jan 26 23:44:08 2008 +0000
@@ -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 @@
 #
 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 @@
 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 @@
 mail=@MAIL_CMD@
 neato=@NEATO@
 rsync=@PREFIX@/bin/rsync
+sed=@SED@
 tar=@TAR@
 
 loc=${bulklog}/meta
diff -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/scripts/build
--- a/pkgtools/pbulk/files/pbulk/scripts/build  Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/build  Sat Jan 26 23:44:08 2008 +0000
@@ -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@localhost>.
 # All rights reserved.
@@ -52,7 +52,7 @@
 
 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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/scripts/client-clean
--- a/pkgtools/pbulk/files/pbulk/scripts/client-clean   Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/client-clean   Sat Jan 26 23:44:08 2008 +0000
@@ -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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/scripts/pkg-build
--- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build      Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build      Sat Jan 26 23:44:08 2008 +0000
@@ -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@localhost>.
 # All rights reserved.
@@ -37,7 +37,12 @@
                ${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 @@
        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 @@
 
 # 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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date
--- a/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-up-to-date Sat Jan 26 23:44:08 2008 +0000
@@ -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@localhost>.
 # All rights reserved.
@@ -37,7 +37,7 @@
 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 @@
 # 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 -r 6978e37fdb9f -r 83f46b13fa03 pkgtools/pbulk/files/pbulk/scripts/pre-build
--- a/pkgtools/pbulk/files/pbulk/scripts/pre-build      Sat Jan 26 23:30:24 2008 +0000
+++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build      Sat Jan 26 23:44:08 2008 +0000
@@ -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@localhost>.
 # 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."



Home | Main Index | Thread Index | Old Index