[pbuilder] 01/01: Add an APT based resolver

Mattia Rizzolo mattia at debian.org
Sat Oct 8 22:16:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository pbuilder.

commit 4687207bea1f944b872e1d61cdfda5d4aab0aef1
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Sat Oct 1 22:13:43 2016 +0000

    Add an APT based resolver
    
    this resolver doesn't try to mangle anything of the source package, nor to even
    parse it.  It just calls apt-get with the appropriate flags.
    
    All bugs are apt fault!
    
    Closes: #707825
    Gbp-Dch: Short
---
 Makefile                    |  1 +
 pbuilder-buildpackage-funcs |  6 +++-
 pbuilder-satisfydepends-apt | 85 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 335521e..2e4d158 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,7 @@ PKGLIB_SCRIPTS += \
 	pbuilder-loadconfig \
 	pbuilder-modules \
 	pbuilder-runhooks \
+	pbuilder-satisfydepends-apt \
 	pbuilder-satisfydepends-aptitude \
 	pbuilder-satisfydepends-checkparams \
 	pbuilder-satisfydepends-classic \
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 3a7b9cc..4f55ec9 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -60,9 +60,13 @@ function checkbuilddep () {
         all) BUILDOPT="--binary-indep";;
         *) ;;
     esac
+    case "$(readlink -e "$PBUILDERSATISFYDEPENDSCMD")" in
+        *-apt) local control="$BUILDDIR/$(basename "$1")" ;;
+        *) local control="$1" ;;
+    esac
     if \
         ("$PBUILDERSATISFYDEPENDSCMD" \
-            --control "$1" \
+            --control "$control" \
             --chroot "${BUILDPLACE}" \
             --internal-chrootexec "${CHROOTEXEC}" \
             "${BUILDOPT}" \
diff --git a/pbuilder-satisfydepends-apt b/pbuilder-satisfydepends-apt
new file mode 100755
index 0000000..dfcae6f
--- /dev/null
+++ b/pbuilder-satisfydepends-apt
@@ -0,0 +1,85 @@
+#!/bin/bash
+#   Copyright © 2015-2016 Mattia Rizzolo <mattia at debian.org>
+#
+#   pbuilder -- personal Debian package builder
+#
+#   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
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+#
+# module to satisfy build dependencies; apt flavor
+
+set -e
+
+export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
+
+. "$PBUILDER_PKGLIBDIR"/pbuilder-modules
+. "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-funcs
+
+function checkbuilddep_internal () {
+
+    # check whether apt is new enough
+    if dpkg --compare-versions $($CHROOTEXEC dpkg-query -W -f '${Version}' apt) lt 1.2.2 ; then
+        log.e "APT is not new enough to be used within this dependency resolver."
+        log.e "Please switch to a different resolver."
+        exit 1
+    fi
+    log.i "-> Attempting to satisfy build-dependencies"
+    if [[ "$DEBIAN_CONTROL" = *.dsc ]]; then
+        local DIR="$DEBIAN_CONTROL"
+    elif [[ "$DEBIAN_CONTROL" = *control ]]; then
+        local DIR="${DEBIAN_CONTROL%/control}/../"
+    else
+        log.e "Format of \$DEBIAN_CONTROL not recognized ('$DEBIAN_CONTROL')"
+        exit 1
+    fi
+
+    case "$BINARY_ARCH" in
+        "binary")
+            APTGETOPT[${#APTGETOPT[@]}]='--arch-only'
+            ;;
+        "all")
+            ;;
+        "any")
+            ;;
+        *)
+            log.e "\$BINARY_ARCH contains a weird value [$BINARY_ARCH].  Giving up"
+            exit 1
+            ;;
+    esac
+
+    $CHROOTEXEC apt-get \
+        -y \
+        "${APTGETOPT[@]}" \
+        build-dep \
+        "$DIR"
+}
+
+
+function print_help () {
+    # print out help message
+    cat <<EOF
+pbuilder-satisfydepends -- satisfy dependencies
+
+--help:             give help
+--control <file>:   specify control file (debian/control, *.dsc) _inside the chroot_
+--chroot <chroot>:  operate inside this chroot
+--binary-all:       include binary-all
+--binary-arch:      include binary-arch only
+--echo:             echo mode, do nothing.
+
+EOF
+}
+
+. "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-checkparams
+

-- 
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