Here is the proposed (working for me for '--update' and '--build'
functionality) patch.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages pbuilder depends on:
ii  coreutils                     7.5-6      GNU core utilities
ii  debconf [debconf-2.0]         1.5.27     Debian configuration management sy
ii  debianutils                   3.2.1      Miscellaneous utilities specific t
ii  debootstrap                   1.0.16     Bootstrap a basic Debian system
ii  wget                          1.11.4-4   retrieves files from the web

Versions of packages pbuilder recommends:
ii  devscripts                    2.10.55    scripts to make the life of a Debi
ii  fakeroot                      1.13       Gives a fake root environment
ii  sudo                          1.7.2p1-1  Provide limited super user privile

Versions of packages pbuilder suggests:
pn  cowdancer                     <none>     (no description available)
pn  gdebi                         <none>     (no description available)
pn  pbuilder-uml                  <none>     (no description available)

-- debconf information excluded
diff -urN pbuilder-0.189/debian/changelog pbuilder-0.189+jackyf1/debian/changelog
--- pbuilder-0.189/debian/changelog	2009-07-13 14:57:22.000000000 +0300
+++ pbuilder-0.189+jackyf1/debian/changelog	2009-09-27 14:39:19.802945756 +0300
@@ -1,3 +1,9 @@
+pbuilder (0.189+jackyf1) unstable; urgency=low
+
+  * Support '--cupt' option.
+
+ -- Eugene V. Lyubimkin <jac...@debian.org>  Sun, 27 Sep 2009 14:38:36 +0300
+
 pbuilder (0.189) unstable; urgency=low
 
   [ Junichi Uekawa ]
diff -urN pbuilder-0.189/Makefile pbuilder-0.189+jackyf1/Makefile
--- pbuilder-0.189/Makefile	2009-06-23 02:43:13.000000000 +0300
+++ pbuilder-0.189+jackyf1/Makefile	2009-09-27 19:48:57.943519414 +0300
@@ -92,6 +92,7 @@
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-gdebi $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-aptitude $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-experimental $(DESTDIR)/usr/lib/pbuilder/
+	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-cupt $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-checkparams $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-funcs $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pdebuild-internal $(DESTDIR)/usr/lib/pbuilder/
diff -urN pbuilder-0.189/pbuilder-buildpackage pbuilder-0.189+jackyf1/pbuilder-buildpackage
--- pbuilder-0.189/pbuilder-buildpackage	2009-05-31 04:41:04.000000000 +0300
+++ pbuilder-0.189+jackyf1/pbuilder-buildpackage	2009-09-27 22:02:57.288519614 +0300
@@ -21,11 +21,13 @@
 export LC_ALL=C
 set -e
 
+PACKAGENAME=$1
+shift
+
 . /usr/lib/pbuilder/pbuilder-checkparams
 . /usr/lib/pbuilder/pbuilder-runhooks
 . /usr/lib/pbuilder/pbuilder-buildpackage-funcs
 
-PACKAGENAME="$1"
 if [ ! -f "$PACKAGENAME" ]; then
     log "E: Command line parameter [$PACKAGENAME] is not a valid .dsc file name"
     exit 1;
diff -urN pbuilder-0.189/pbuilder-buildpackage-funcs pbuilder-0.189+jackyf1/pbuilder-buildpackage-funcs
--- pbuilder-0.189/pbuilder-buildpackage-funcs	2009-02-26 07:33:11.000000000 +0200
+++ pbuilder-0.189+jackyf1/pbuilder-buildpackage-funcs	2009-09-27 22:37:20.494949826 +0300
@@ -37,6 +37,11 @@
 	yes) BUILDOPT="--binary-arch";;
 	*) ;;
     esac
+
+	if [ -n "$USE_CUPT" ]; then
+		PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-cupt
+	fi
+
     if "$PBUILDERSATISFYDEPENDSCMD" --control "$1" --chroot "${BUILDPLACE}" --internal-chrootexec "${CHROOTEXEC}" "${BUILDOPT}" ; then
 	:
     else
@@ -50,7 +55,12 @@
     fi
     # install extra packages to the chroot
     if [ -n "$EXTRAPACKAGES" ]; then 
-	$CHROOTEXEC usr/bin/apt-get -y --force-yes install ${EXTRAPACKAGES}
+		if [ -n "$USE_CUPT" ]; then
+			PACKAGE_MANAGER_COMMAND="echo 'y' | /usr/bin/cupt --no-auto-remove"
+		else
+			PACKAGE_MANAGER_COMMAND="/usr/bin/apt-get -y --force-yes"
+		fi
+		$CHROOTEXEC sh -c "$PACKAGE_MANAGER_COMMAND install ${EXTRAPACKAGES}"
     fi
 }
 
diff -urN pbuilder-0.189/pbuilder-checkparams pbuilder-0.189+jackyf1/pbuilder-checkparams
--- pbuilder-0.189/pbuilder-checkparams	2009-03-07 03:07:51.000000000 +0200
+++ pbuilder-0.189+jackyf1/pbuilder-checkparams	2009-09-27 21:47:54.529461681 +0300
@@ -210,6 +210,12 @@
 	    outputfile[${#outputfi...@]}]="$2";
 	    shift; shift; 
 	    ;;
+	--cupt)
+	    log "I: Using cupt as package manager"
+	    USE_CUPT=yes
+	    EXTRAPACKAGES="$EXTRAPACKAGES cupt"
+	    shift;
+	    ;;
 
 	## internal options.
 	--internal-chrootexec)
diff -urN pbuilder-0.189/pbuilder-satisfydepends-cupt pbuilder-0.189+jackyf1/pbuilder-satisfydepends-cupt
--- pbuilder-0.189/pbuilder-satisfydepends-cupt	1970-01-01 03:00:00.000000000 +0300
+++ pbuilder-0.189+jackyf1/pbuilder-satisfydepends-cupt	2009-09-27 22:28:50.046948975 +0300
@@ -0,0 +1,50 @@
+#!/bin/bash
+#   pbuilder -- personal Debian package builder
+#   Copyright (C) 2001,2002,2003,2005-2007 Junichi Uekawa
+#   Copyright (C) 2009 Eugene V. Lyubimkin
+#
+#   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; cupt flavor
+
+set -e
+
+. /usr/lib/pbuilder/pbuilder-satisfydepends-funcs
+
+function checkbuilddep_internal () {
+	local FLAGS="-o apt::install-recommends=0 -o cupt::downloader::max-simultaneous-downloads=1"
+    echo " -> Attempting to parse the build-deps "
+	BUILD_DEPENDS=$(get_control_re "$DEBIAN_CONTROL" "$BD_REGEXP")
+	BUILD_CONFLICTS=$(get_control_re "$DEBIAN_CONTROL" "$BC_REGEXP")
+
+	# trim them
+	BUILD_DEPENDS=$(echo $BUILD_DEPENDS | sed 's/^ +//')
+	BUILD_CONFLICTS=$(echo $BUILD_CONFLICTS | sed 's/^ +//')
+
+	COMMAND_LINE="\"$BUILD_DEPENDS\""
+	if [ -n "$BUILD_CONFLICTS" ]; then
+		COMMAND_LINE="$COMMAND_LINE \"$BUILD_CONFLICTS\"-"
+	fi
+	echo "Command line for cupt: $COMMAND_LINE"
+
+	if $CHROOTEXEC sh -c "echo 'y' | /usr/bin/cupt $FLAGS satisfy $COMMAND_LINE"; then
+	  echo " -> Finished parsing the build-deps"
+	else
+	  echo "E: Could not satisfy build-dependency." >&2
+	fi
+}
+
+. /usr/lib/pbuilder/pbuilder-satisfydepends-checkparams
+
diff -urN pbuilder-0.189/pbuilder-updatebuildenv pbuilder-0.189+jackyf1/pbuilder-updatebuildenv
--- pbuilder-0.189/pbuilder-updatebuildenv	2009-06-19 17:24:13.000000000 +0300
+++ pbuilder-0.189+jackyf1/pbuilder-updatebuildenv	2009-09-27 22:00:41.283468835 +0300
@@ -34,28 +34,46 @@
 extractbuildplace
 $TRAP umountproc_cleanbuildplace_trap exit sighup
 
+recover_aptcache
+
+if [ -n "$USE_CUPT" ]; then
+	if ! $CHROOTEXEC /usr/bin/dpkg -l | grep "^ii" | grep cupt; then
+		log "I: installing cupt package manager";
+		$CHROOTEXEC apt-get update
+		$CHROOTEXEC apt-get -y install cupt
+	fi
+	PACKAGE_MANAGER=/usr/bin/cupt
+	PACKAGE_MANAGER_COMMAND="echo 'y' | /usr/bin/cupt -o apt::get::allowunauthenticated=1"
+else
+	PACKAGE_MANAGER=/usr/bin/apt-get
+	PACKAGE_MANAGER_COMMAND="/usr/bin/apt-get -y --force-yes"
+fi
+
 loadhooks
 log "I: Refreshing the base.tgz "
 log "I: upgrading packages"
-$CHROOTEXEC /usr/bin/apt-get update
+$CHROOTEXEC $PACKAGE_MANAGER update
 if [ -n "$REMOVEPACKAGES" ]; then
     $CHROOTEXEC /usr/bin/dpkg --purge $REMOVEPACKAGES
 fi
-recover_aptcache
 
 $TRAP saveaptcache_umountproc_cleanbuildplace_trap exit sighup
-$CHROOTEXEC /usr/bin/apt-get -y --force-yes "${force_confn...@]}" dist-upgrade
+$CHROOTEXEC sh -c "$PACKAGE_MANAGER_COMMAND -o DPkg::Options::=--force-confnew dist-upgrade"
 # autoremove: Ignore error in case of etch because apt in etch doesn't
 # support autoremove. TODO: Do not ignore error when etch is no longer
 # supported.
-$CHROOTEXEC /usr/bin/apt-get -y --force-yes autoremove || true
-$CHROOTEXEC /usr/bin/apt-get -y --force-yes install build-essential dpkg-dev apt aptitude $EXTRAPACKAGES
+if [ -z "$USE_CUPT" ]; then
+	$CHROOTEXEC /usr/bin/apt-get -y --force-yes autoremove || true
+fi
+
+FULL_COMMAND="$PACKAGE_MANAGER_COMMAND install build-essential dpkg-dev apt aptitude $EXTRAPACKAGES"
+$CHROOTEXEC sh -c "$FULL_COMMAND"
 save_aptcache
 
 # optionally auto-clean apt-cache
 if [ "${AUTOCLEANAPTCACHE}" = "yes" -a -n "$APTCACHE" ]; then
     log "I: Cleaning the cached apt archive"
-    $CHROOTEXEC /usr/bin/apt-get autoclean || true
+    $CHROOTEXEC $PACKAGE_MANAGER autoclean || true
     find "$APTCACHE/" -maxdepth 1 -name \*.deb | \
 	while read A; do
 	    if [ ! -f "$BUILDPLACE/var/cache/apt/archives/"$(basename "$A") -a \
@@ -71,7 +89,7 @@
 unloadhooks
 
 umountproc
-$CHROOTEXEC /usr/bin/apt-get clean || true
+$CHROOTEXEC $PACKAGE_MANAGER clean || true
 
 $TRAP cleanbuildplace_trap exit sighup
 if [ ! "${INTERNAL_BUILD_UML}" = "yes" ]; then

Reply via email to