[pbuilder] 03/03: satisfydepends-funcs: split get_build_depends_field() out of get_source_control_field()
Mattia Rizzolo
mattia at debian.org
Fri Jan 13 19:04:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository pbuilder.
commit ecb1c85f58f23a9ac9f9a325a639b44f1e9b5500
Author: James Clarke <jrtc27 at jrtc27.com>
Date: Fri Jan 6 16:15:56 2017 +0000
satisfydepends-funcs: split get_build_depends_field() out of get_source_control_field()
get_source_control_field() now only wraps the new get822field(), whilst
the logic to clean up and normalize the package list is moved into
get_build_depends_field().
Change get_build_deps() and get_build_conflicts() to use this new
function.
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
pbuilder-satisfydepends-apt | 1 -
pbuilder-satisfydepends-funcs | 71 ++++++++++++++-----------------------------
2 files changed, 22 insertions(+), 50 deletions(-)
diff --git a/pbuilder-satisfydepends-apt b/pbuilder-satisfydepends-apt
index 21652b6..91c3ac7 100755
--- a/pbuilder-satisfydepends-apt
+++ b/pbuilder-satisfydepends-apt
@@ -23,7 +23,6 @@ set -e
export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
-. "$PBUILDER_PKGLIBDIR"/pbuilder-modules
. "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-funcs
function checkbuilddep_internal () {
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index de7233e..4095f09 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -21,6 +21,7 @@
# module to satisfy build dependencies; common functions
+. "${BASH_SOURCE%/*}/pbuilder-modules"
package_versions() {
local PACKAGE="$1"
@@ -53,47 +54,22 @@ checkbuilddep_versiondeps() {
}
get_source_control_field() {
- local field="$1"
-
- sed -n '
-# Skip PGP header
-/^-----BEGIN PGP SIGNED MESSAGE-----$/ {
- : pgploop
- n
- /^$/ b leadloop
- b pgploop
-}
-
-# Skip empty lines/comments
-: leadloop
-/^[ \t]*$/ {
- n
- b leadloop
-}
-/^#/ {
- n
- b leadloop
+ get822field "$1" "$DEBIAN_CONTROL"
}
-# First line of source paragraph
-: sourceloop
-# Strip field name from line if present
-s/^'"$field"'://i
-# If field present, print normalised contents
-t store
-# Otherwise, check for end of paragraph or ignore
-/^[ \t]*$/q
-n
-b sourceloop
-
+get_build_depends_field() {
+ get_source_control_field "$1" | sed -n '
+# Note the h; b loop; here so that there is no leading
+# newline in the hold space
+h
+b loop
: store
H
: loop
-$ b skip
+$ b done
n
-/^#/ b loop
-/^[ \t]/ b store
-: skip
+b store
+: done
x
# output on single line
s/\n//g
@@ -116,30 +92,27 @@ s/(\(>>\|>=\|>\|==\|=\|<=\|<<\|<\|!=\) *\([^)]*\))/(\1 \2)/g
# normalize space at beginning and end of line
s/^ *//
s/ *$//
-p
-n
-b sourceloop' \
- "$DEBIAN_CONTROL"
+p'
}
get_build_deps() {
local output
- output="$(get_source_control_field "Build-Depends")"
+ output="$(get_build_depends_field "Build-Depends")"
output="${output%, }"
case "$BINARY_ARCH" in
any)
- output="${output:+$output, }$(get_source_control_field "Build-Depends-Indep")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Depends-Indep")"
output="${output%, }"
- output="${output:+$output, }$(get_source_control_field "Build-Depends-Arch")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Depends-Arch")"
output="${output%, }"
;;
binary)
- output="${output:+$output, }$(get_source_control_field "Build-Depends-Arch")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Depends-Arch")"
output="${output%, }"
;;
all)
- output="${output:+$output, }$(get_source_control_field "Build-Depends-Indep")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Depends-Indep")"
output="${output%, }"
;;
esac
@@ -149,21 +122,21 @@ get_build_deps() {
get_build_conflicts() {
local output
- output="$(get_source_control_field "Build-Conflicts")"
+ output="$(get_build_depends_field "Build-Conflicts")"
output="${output%, }"
case "$BINARY_ARCH" in
any)
- output="${output:+$output, }$(get_source_control_field "Build-Conflicts-Indep")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Conflicts-Indep")"
output="${output%, }"
- output="${output:+$output, }$(get_source_control_field "Build-Conflicts-Arch")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Conflicts-Arch")"
output="${output%, }"
;;
binary)
- output="${output:+$output, }$(get_source_control_field "Build-Conflicts-Arch")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Conflicts-Arch")"
output="${output%, }"
;;
all)
- output="${output:+$output, }$(get_source_control_field "Build-Conflicts-Indep")"
+ output="${output:+$output, }$(get_build_depends_field "Build-Conflicts-Indep")"
output="${output%, }"
;;
esac
--
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