Followup-For: Bug #683848

Hi,

I attach revised and rebased patches for adding binNMU support that
should apply cleanly with git am.


Andreas
>From 4afc96060564ed860c652179deaaa17a0eeabe3a Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Wed, 22 Jul 2015 14:26:06 +0200
Subject: [PATCH 3/3] only set Changed-By to --binnmu-maintainer in .changes

do not override Maintainer
---
 pbuilder-modules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 081fa18..6b7f852 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -666,7 +666,7 @@ function binNMU() {
 	echo "No maintainer provided for binNMU entry, fall back to last uploader."
 	BINNMU_MAINTAINER=$changedby
     fi
-    DEBBUILDOPTS="${DEBBUILDOPTS} -m\"$BINNMU_MAINTAINER\" -e\"$BINNMU_MAINTAINER\""
+    DEBBUILDOPTS="${DEBBUILDOPTS} -e\"$BINNMU_MAINTAINER\""
     echo "$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low, binary-only=yes" > $cl
     echo >> $cl
     echo "  * Binary-only non-maintainer upload for $arch; no source changes." >> $cl
-- 
2.1.4

>From 7c6f238a42423736a02c7abdc9fb2d1018cbeb10 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Wed, 15 Oct 2014 13:04:11 +0200
Subject: [PATCH 2/3] add "binary-only=yes" mark to the binNMU changelog

---
 pbuilder-modules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 57191d4..081fa18 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -667,7 +667,7 @@ function binNMU() {
 	BINNMU_MAINTAINER=$changedby
     fi
     DEBBUILDOPTS="${DEBBUILDOPTS} -m\"$BINNMU_MAINTAINER\" -e\"$BINNMU_MAINTAINER\""
-    echo "$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low" > $cl
+    echo "$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low, binary-only=yes" > $cl
     echo >> $cl
     echo "  * Binary-only non-maintainer upload for $arch; no source changes." >> $cl
     echo "  * $BINNMU_MESSAGE" >> $cl
-- 
2.1.4

>From e8708b5897518c1064086ae595a03c1b2a1d2f68 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Wed, 22 Jul 2015 14:33:16 +0200
Subject: [PATCH] use pbuilder.maintscript for /etc/bash_completion.d/pbuilder
 removal

---
 debian/pbuilder.maintscript | 1 +
 debian/pbuilder.postinst    | 3 ---
 debian/pbuilder.postrm      | 3 ---
 debian/pbuilder.preinst     | 7 -------
 4 files changed, 1 insertion(+), 13 deletions(-)
 create mode 100644 debian/pbuilder.maintscript
 delete mode 100644 debian/pbuilder.preinst

diff --git a/debian/pbuilder.maintscript b/debian/pbuilder.maintscript
new file mode 100644
index 0000000..afb71fb
--- /dev/null
+++ b/debian/pbuilder.maintscript
@@ -0,0 +1 @@
+rm_conffile /etc/bash_completion.d/pbuilder 0.215+nmu4~
diff --git a/debian/pbuilder.postinst b/debian/pbuilder.postinst
index f42d99b..4af446d 100644
--- a/debian/pbuilder.postinst
+++ b/debian/pbuilder.postinst
@@ -2,8 +2,5 @@
 set -e
 . /usr/share/debconf/confmodule
 
-dpkg-maintscript-helper rm_conffile \
-	/etc/bash_completion.d/pbuilder 0.215+nmu4~ pbuilder -- "$@"
-
 #DEBHELPER#
 exit 0
diff --git a/debian/pbuilder.postrm b/debian/pbuilder.postrm
index a0496cf..fca2ba1 100644
--- a/debian/pbuilder.postrm
+++ b/debian/pbuilder.postrm
@@ -9,8 +9,5 @@ if [ "$1" = purge ]; then
 	fi
 fi
 
-dpkg-maintscript-helper rm_conffile \
-	/etc/bash_completion.d/pbuilder 0.215+nmu4~ pbuilder -- "$@"
-
 #DEBHELPER#
 exit 0
diff --git a/debian/pbuilder.preinst b/debian/pbuilder.preinst
deleted file mode 100644
index ba191a4..0000000
--- a/debian/pbuilder.preinst
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-set -e
-
-dpkg-maintscript-helper rm_conffile \
-	/etc/bash_completion.d/pbuilder 0.215+nmu4~ pbuilder -- "$@"
-
-#DEBHELPER#
-- 
2.1.4

>From cd74415d526b9d597866d435bab52ad81d84501f Mon Sep 17 00:00:00 2001
From: Luca Falavigna <dktrkr...@debian.org>
Date: Tue, 27 Nov 2012 16:58:53 +0100
Subject: [PATCH 1/3] add binNMU support

---
 pbuilder-buildpackage |  2 ++
 pbuilder-checkparams  | 16 ++++++++++++++++
 pbuilder-modules      | 43 +++++++++++++++++++++++++++++++++++++++++++
 pbuilder.8            | 15 +++++++++++++++
 4 files changed, 76 insertions(+)

diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 606e2ff..5809710 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -142,6 +142,8 @@ else
     exit 1;
 fi
 
+binNMU
+
 log "I: Building the package"
 
 executehooks "A"
diff --git a/pbuilder-checkparams b/pbuilder-checkparams
index 07534ba..9351ca3 100755
--- a/pbuilder-checkparams
+++ b/pbuilder-checkparams
@@ -33,6 +33,7 @@ CHROOTEXEC=""
 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
@@ -195,6 +196,21 @@ while [ -n "$1" ]; do
 	    DEBBUILDOPTS="${DEBBUILDOPTS} -B"
 	    shift;
 	    ;;
+	--bin-nmu)
+	    BIN_NMU="yes"
+	    # XXX this might be overwriten by --debbuildopts ""
+	    DEBBUILDOPTS="${DEBBUILDOPTS} -B"
+	    BINNMU_MESSAGE="$2"
+	    shift; shift;
+	    ;;
+	--bin-nmu-maintainer)
+	    BINNMU_MAINTAINER="$2"
+	    shift; shift;
+	    ;;
+	--bin-nmu-version)
+	    BINNMU_VERSION="$2"
+	    shift; shift;
+	    ;;
 	--preserve-buildplace)
 	    PRESERVE_BUILDPLACE="yes"
 	    shift;
diff --git a/pbuilder-modules b/pbuilder-modules
index f28b2db..57191d4 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -70,6 +70,9 @@ pbuilder-options:
  --timeout [timeout time]
  --override-config 
  --binary-arch
+ --bin-nmu [changelog message]
+ --bin-nmu-maintainer [maintainer name]
+ --bin-nmu-version [version number]
  --preserve-buildplace
  --bindmounts [bind-mount-point]
  --debug
@@ -635,6 +638,46 @@ function add_additional_aptkeyrings() {
     done
 }
 
+function binNMU() {
+    if [ "$BIN_NMU" == "no" ]; then
+	return
+    fi
+    if [ -z "$BINNMU_MESSAGE" ]; then
+	echo "No changelog message provided for binNMU entry."
+	exit 1
+    fi
+    if [ -z "$BINNMU_VERSION" ]; then
+	echo "No version provided for binNMU entry, fall back to 1."
+	BINNMU_VERSION=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
+    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 changedby=$(cat $tmpcl | sed -n '0,/ -- /s/ -- \(.* <.*>\).*/\1/p')
+    local date=$(date -R)
+    if [ -z "$BINNMU_MAINTAINER" ]; then
+	echo "No maintainer provided for binNMU entry, fall back to last uploader."
+	BINNMU_MAINTAINER=$changedby
+    fi
+    DEBBUILDOPTS="${DEBBUILDOPTS} -m\"$BINNMU_MAINTAINER\" -e\"$BINNMU_MAINTAINER\""
+    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 " -- $BINNMU_MAINTAINER  $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
diff --git a/pbuilder.8 b/pbuilder.8
index 4dc079e..ad84a46 100644
--- a/pbuilder.8
+++ b/pbuilder.8
@@ -353,6 +353,21 @@ Use this option rather than using
 .B "\-\-debbuildopts -B"
 
 .TP
+.BI "\-\-bin\-nmu [" "changelog message" "]"
+Specify to build a binary-NMU instead of a standard package.
+This option takes the changelog message to pass to the binary-NMU package as parameter.
+
+.TP
+.BI "\-\-bin\-nmu\-maintainer [" "maintainer" "]"
+Specify the maintainer name and email address to be displayed in the changes file.
+If no maintainer is provided, it defaults to the last uploader.
+
+.TP
+.BI "\-\-bin\-nmu\-version [" "version number" "]"
+Specify the number to append to the version in the binary-NMU package.
+If no number is provided, it defaults to 1.
+
+.TP
 .BI "\-\-bindmounts " "bind-mount-points"
 Bind-mount the specified directories to inside the chroot.
 .I "bind-mount-points"
-- 
2.1.4

Reply via email to