From 4dbef9fd357e0aca276d69980527138203f7a9e6 Mon Sep 17 00:00:00 2001 From: Junichi Uekawa Date: Sat, 7 Mar 2009 10:29:36 +0900 Subject: implement --inputfile option. Copies extra files to inside chroot. --- pbuilder | 3 ++- pbuilder-buildpackage | 1 + pbuilder-checkparams | 13 +++++++++++++ pbuilder-modules | 15 ++++++++++++++- pbuilder.8 | 15 +++++++++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/pbuilder b/pbuilder index 1a7d525..8a092f8 100755 --- a/pbuilder +++ b/pbuilder @@ -56,6 +56,7 @@ case "$1" in . /usr/lib/pbuilder/pbuilder-runhooks extractbuildplace trap umountproc_cleanbuildplace_trap exit sighup + copyinputfile "${BUILDPLACE}/tmp/buildd" loadhooks recover_aptcache trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup @@ -110,7 +111,7 @@ File extracted to: $BUILDPLACE extractbuildplace trap umountproc_cleanbuildplace_trap exit sighup - + copyinputfile "${BUILDPLACE}/tmp/buildd" loadhooks recover_aptcache trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage index 02d4b49..2be908e 100755 --- a/pbuilder-buildpackage +++ b/pbuilder-buildpackage @@ -96,6 +96,7 @@ trap umountproc_cleanbuildplace_trap exit sighup log "I: Copying source file" copydsc "$PACKAGENAME" "$BUILDPLACE/tmp/buildd" +copyinputfile "$BUILDPLACE/tmp/buildd" log "I: Extracting source" if echo "chown $BUILDUSERNAME:$BUILDUSERNAME /tmp/buildd /tmp/buildd/*" | $CHROOTEXEC /bin/bash; then diff --git a/pbuilder-checkparams b/pbuilder-checkparams index 523e21e..4d56838 100755 --- a/pbuilder-checkparams +++ b/pbuilder-checkparams @@ -198,6 +198,19 @@ while [ -n "$1" ]; do SAVE_AFTER_LOGIN=yes; shift; ;; + --inputfile) + if [ ! -f "$2" ]; then + log "E: Input file $2 does not exist" + exit 1 + fi + INPUTFILE[${#INPUTFILE[@]}]="$2"; + shift; shift; + ;; + --outputfile) + OUTPUTFILE[${#OUTPUTFILE[@]}]="$2"; + shift; shift; + ;; + ## internal options. --internal-chrootexec) # specify custom chrootexec function -- this is internal debugging function diff --git a/pbuilder-modules b/pbuilder-modules index 12e4da7..ac03ad8 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -1,7 +1,7 @@ #! /bin/bash # common modules for pbuilder. # pbuilder -- personal Debian package builder -# Copyright (C) 2001-2007 Junichi Uekawa +# Copyright (C) 2001-2009 Junichi Uekawa # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -489,6 +489,19 @@ function create_basetgz() { ) } +function copyinputfile() { + # copy files to inside chroot, copy all files specified by INPUTFILE[] parameter. + TARGETDIR="$1" + if [ -z "$TARGETDIR" ]; then + log "E: Unexpected error in copyinputfile" + exit 1x + fi + if [ -n "$INPUTFILE" ]; then + log "I: copy ${INPUTFILE[*]} to taget directory" + cp "${INPUTFILE[@]}" "${TARGETDIR}" + fi +} + # all trap hooks that should lead to 'exit'; and error exit. function cleanbuildplace_trap () { cleanbuildplace diff --git a/pbuilder.8 b/pbuilder.8 index 4c32c78..4c34fa0 100644 --- a/pbuilder.8 +++ b/pbuilder.8 @@ -530,6 +530,21 @@ and .B "--create" targets. +.TP +.BI "\-\-inputfile " "filename" + +Add extra file to be copied to +.B "/tmp/buildd" +inside the build environment. + +available in +.B "--build" +and +.B "--login" +and +.B "--execute" +targets. + .SH "FILES" .TP .I "/etc/pbuilderrc" -- cgit v1.2.3