[pbuilder] 01/02: buildpackage-funcs: turn getdscfiles() into deb822files() to support retriving file list from .changes files as well
Mattia Rizzolo
mattia at debian.org
Sat Jul 23 11:02:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch 822
in repository pbuilder.
commit 80bcfc6e911bea6ad165e467e288f70be0c02825
Author: Mattia Rizzolo <mattia at debian.org>
Date: Sat Jul 23 10:55:47 2016 +0000
buildpackage-funcs: turn getdscfiles() into deb822files() to support retriving file list from .changes files as well
---
pbuilder-buildpackage-funcs | 23 +++++++++++++++--------
t/test_pbuilder-buildpackage-funcs | 11 +++++++----
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index ed9587d..f05515c 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -20,23 +20,30 @@
# functions local to pbuilder-buildpackage
-getdscfiles () {
- local DSCFILE="$1"
- local DSCFILES=()
- DSCFILES+=("$DSCFILE")
- DSCFILES+=("$(cat "$DSCFILE" |
+get822files () {
+ # get list of files listed in the Files field of a .changes or .dsc (to
+ # be specified in the first parameter)
+ local type="$1"
+ local input="$2"
+ local files=("$2")
+ case $type in
+ changes) local field=5 ;;
+ dsc) local field=3 ;;
+ *) log.error "unexpected error in get822files()" ; exit 1 ;;
+ esac
+ files+=("$(cat "$input" |
awk 'BEGIN{p=0}
! /^[ \t]/ {p=0}
/^Files:/ {p=1}
! /^[ \t]*/ {p=0}
- /^ / {if (p){print "'$(dirname "$DSCFILE")'/" $3}}' |
+ /^ / {if (p){print "'$(dirname "$input")'/" $'${field}'}}' |
tr '\n' ' ' | sed -e 's/[[:space:]]*$//')")
# ↑↑↑ because we are really picky (and we have picky tests...)
- echo "${DSCFILES[@]}"
+ echo "${files[@]}"
}
function copydsc () {
- local DSCFILE=$(getdscfiles "$1")
+ local DSCFILE=$(get822files "dsc" "$1")
local TARGET="$2"
for FILE in ${DSCFILE[@]} ; do
log.i "copying [$FILE]"
diff --git a/t/test_pbuilder-buildpackage-funcs b/t/test_pbuilder-buildpackage-funcs
index 8707247..a49ad62 100755
--- a/t/test_pbuilder-buildpackage-funcs
+++ b/t/test_pbuilder-buildpackage-funcs
@@ -41,16 +41,18 @@ cleanup() {
}
test_getdscfilesNormal () {
-
cat "$TESTDATA_DIR/dsc1" > "$DEBIAN_CONTROL"
- getdscfiles "$DEBIAN_CONTROL"
+ get822files dsc "$DEBIAN_CONTROL"
}
test_getdscfilesWithoutNL () {
-
cat "$TESTDATA_DIR/dsc2_withoutNL" > "$DEBIAN_CONTROL"
- getdscfiles "$DEBIAN_CONTROL"
+ get822files dsc "$DEBIAN_CONTROL"
+}
+test_getchangesfilesNormal () {
+ cat "$TESTDATA_DIR/changes1" > "$DEBIAN_CONTROL"
+ get822files changes "$DEBIAN_CONTROL"
}
trap cleanup sigpipe sighup exit
@@ -60,5 +62,6 @@ DEBIAN_CONTROL="$(mktemp)"
expect_output "$DEBIAN_CONTROL /tmp/haskell-concrete-typerep_0.1.0.2.orig.tar.gz /tmp/haskell-concrete-typerep_0.1.0.2-2.debian.tar.gz" test_getdscfilesNormal
expect_output "$DEBIAN_CONTROL /tmp/golang-xmpp-dev_0.0~git20140304.orig.tar.gz /tmp/golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz" test_getdscfilesWithoutNL
+expect_output "$DEBIAN_CONTROL /tmp/pbuilder_0.225.2~bpo8+1.dsc /tmp/pbuilder_0.225.2~bpo8+1.tar.xz /tmp/pbuilder_0.225.2~bpo8+1_all.deb" test_getchangesfilesNormal
testlib_summary
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git
More information about the Pbuilder-maint
mailing list