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

pbuilder does not allow to build binary-NMUs.
Attached patch implements this feature.



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

Kernel: Linux 3.2.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=it_IT.utf8, LC_CTYPE=it_IT.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pbuilder depends on:
ii  coreutils              8.13-3.2
ii  debconf [debconf-2.0]  1.5.45
ii  debianutils            4.3.3
ii  debootstrap            1.0.42
ii  wget                   1.13.4-3

Versions of packages pbuilder recommends:
ii  devscripts  2.12.1
ii  fakeroot    1.18.4-2
ii  sudo        1.8.5p2-1

Versions of packages pbuilder suggests:
pn  cowdancer     <none>
ii  gdebi-core    0.8.5
pn  pbuilder-uml  <none>
diff -Nru pbuilder-0.211/pbuilder.8 pbuilder-0.212/pbuilder.8
--- pbuilder-0.211/pbuilder.8	2012-03-08 23:54:41.000000000 +0100
+++ pbuilder-0.212/pbuilder.8	2012-08-04 20:48:02.000000000 +0200
@@ -353,6 +353,14 @@
 .B "\-\-debbuildopts -B"
 
 .TP
+.BI "\-\-bin\-nmu [" "version" "/" "message" "]"
+
+Specify to build a binary NMU instead of a standard package.
+You must pass two parameters, the first one is a numeric value indicating
+the progressive binNMU version, the second one is a message that will
+appear in the changelog entry.
+
+.TP
 .BI "\-\-bindmounts " "bind-mount-points"
 Bind-mount the specified directories to inside the chroot.
 .I "bind-mount-points"
diff -Nru pbuilder-0.211/pbuilder-checkparams pbuilder-0.212/pbuilder-checkparams
--- pbuilder-0.211/pbuilder-checkparams	2012-03-08 23:54:41.000000000 +0100
+++ pbuilder-0.212/pbuilder-checkparams	2012-08-04 20:34:57.000000000 +0200
@@ -33,6 +33,7 @@
 OVERRIDE_APTLINES="no"
 OVERRIDE_APTLINES_WARN="" # set this if --override-config option should be set.
 BINARY_ARCH="no"
+BIN_NMU="no"
 PBUILDER_BUILD_LOGFILE=
 PRESERVE_BUILDPLACE="no"
 unset EXTRA_CONFIGFILE || true
@@ -189,6 +190,14 @@
 	    DEBBUILDOPTS="${DEBBUILDOPTS} -B"
 	    shift;
 	    ;;
+	--bin-nmu)
+	    BIN_NMU="yes"
+	    # XXX this might be overwriten by --debbuildopts ""
+	    DEBBUILDOPTS="${DEBBUILDOPTS} -B"
+	    BINNMU_VERSION="$2"
+	    BINNMU_MESSAGE="$3"
+	    shift; shift; shift;
+	    ;;
 	--preserve-buildplace)
 	    PRESERVE_BUILDPLACE="yes"
 	    shift;
diff -Nru pbuilder-0.211/pbuilder-modules pbuilder-0.212/pbuilder-modules
--- pbuilder-0.211/pbuilder-modules	2012-03-31 06:50:46.000000000 +0200
+++ pbuilder-0.212/pbuilder-modules	2012-08-04 20:37:28.000000000 +0200
@@ -70,6 +70,7 @@
  --timeout [timeout time]
  --override-config 
  --binary-arch
+ --bin-nmu [version number | description]
  --preserve-buildplace
  --bindmounts [bind-mount-point]
  --debug
@@ -595,6 +596,44 @@
     done
 }
 
+function binNMU() {
+    if [ "$BIN_NMU" == "no" ]; then
+	return
+    fi
+    if [ -z $BINNMU_VERSION ]; then
+	echo "No version provided for binNMU entry."
+	exit 1
+    fi
+    if [ -z $BINNMU_MESSAGE ]; then
+	echo "No changelog message provided for binNMU entry."
+	exit 1
+    fi
+    local cl=$(ls $BUILDPLACE/tmp/buildd/*/debian/changelog)
+    local tmpcl=$cl.pbuildertmp
+    if [ ! -f $cl ]; then
+	echo "Cannot open debian/changelog for binNMU version handling."
+	exit 1
+    fi
+    if [ -z $DEBEMAIL ]; then
+	echo "No maintainer addres provided, use --debemail option."
+	exit 1
+    fi
+    mv $cl $tmpcl
+    local package=$(head -n1 $tmpcl | cut -d" " -f1)
+    local version=$(head -n1 $tmpcl | sed 's/.*(\(.*\)).*/\1/')
+    local arch=$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)
+    local date=$(date -R)
+    echo "$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low" > $cl
+    echo >> $cl
+    echo "  * Binary-only non-maintainer upload for $arch; no source changes." >> $cl
+    echo "  * $BINNMU_MESSAGE" >> $cl
+    echo >> $cl
+    echo " -- $DEBEMAIL  $date" >> $cl
+    echo >> $cl
+    cat $tmpcl >> $cl
+    rm $tmpcl
+}
+
 #Setting environmental variables that are really required:
 #required for some packages to install...
 export LANG=C

Reply via email to