Package: pbuilder
Version: 0.230.4
Severity: wishlist
Tags: patch

Hi,

it would be nice if pbuilder had an "--extra-depends" (or similar)
option to dynamically modify the build-depends of a package, e.g. for
testing transition rebuilds by requiring a package version from
experimental. The argument should allow anything that is also allowed in
d/control, i.e. comma-separated lists of packages with optional version
constraints in parentheses.
The --extrapackages option is not usable for this purpose, since it
does not allow specifying version constraints.

Attached patch is a proof-of-concept solution (successfully tested on
one package build for a transition test), it lacks documentation and
tests.

One could also look how sbuild does this.

Andreas
>From 478d4374f648d1925d9ffeadcf5f900120d9b3b3 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <[email protected]>
Date: Sat, 28 Mar 2020 00:15:38 +0100
Subject: [PATCH] add --extra-depends option

---
 pbuilder-buildpackage-funcs         | 1 +
 pbuilder-checkparams                | 4 ++++
 pbuilder-satisfydepends-checkparams | 5 +++++
 pbuilder-satisfydepends-funcs       | 3 ++-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 59600908..ae776d1f 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -115,6 +115,7 @@ function checkbuilddep () {
             --control "$control" \
             --chroot "${BUILDPLACE}" \
             --internal-chrootexec "${CHROOTEXEC}" \
+            ${EXTRA_DEPENDS:+--extra-depends "${EXTRA_DEPENDS}"} \
             "${BUILDOPT}" \
             "${PBUILDERSATISFYDEPENDSOPT[@]}"); \
     then
diff --git a/pbuilder-checkparams b/pbuilder-checkparams
index a5ea5c7c..ea976f32 100755
--- a/pbuilder-checkparams
+++ b/pbuilder-checkparams
@@ -173,6 +173,10 @@ while [ -n "$1" ]; do
         EXTRA_CONFIGFILE[${#EXTRA_CONFIGFILE[@]}]="$2";
         shift; shift;
         ;;
+    --extra-depends)
+        EXTRA_DEPENDS="${EXTRA_DEPENDS:+$EXTRA_DEPENDS, }$2";
+        shift; shift;
+        ;;
     --extrapackages)
         EXTRAPACKAGES="${EXTRAPACKAGES:+$EXTRAPACKAGES }$2";
         shift; shift;
diff --git a/pbuilder-satisfydepends-checkparams 
b/pbuilder-satisfydepends-checkparams
index 6f7e3846..f8a28781 100755
--- a/pbuilder-satisfydepends-checkparams
+++ b/pbuilder-satisfydepends-checkparams
@@ -31,6 +31,7 @@ CONTINUE_FAIL="no"
 CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=no
 ALLOWUNTRUSTED=no
 EATMYDATA=no
+EXTRA_DEPENDS=""
 
 while [ -n "$1" ]; do
     case "$1" in
@@ -101,6 +102,10 @@ while [ -n "$1" ]; do
         HOST_ARCH=$2
         shift 2
         ;;
+    --extra-depends)
+        EXTRA_DEPENDS=$2
+        shift 2
+        ;;
        --help|-h|*)
            print_help
            exit 1
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index d64e9a95..c710187e 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -103,7 +103,8 @@ p'
 get_build_deps() {
     local output
 
-    output="$(get_build_depends_field "Build-Depends")"
+    output="${EXTRA_DEPENDS}"
+    output="${output:+$output, }$(get_build_depends_field "Build-Depends")"
     output="${output%, }"
     case "$BINARY_ARCH" in
         any)
-- 
2.20.1

Reply via email to