From ef9fd1fa8e4cb6e15a8857b47926236b06d87dd6 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Tue, 27 Nov 2012 16:58:53 +0100 Subject: add binNMU support Closes: #683848 --- pbuilder-checkparams | 17 +++++++++++++++++ pbuilder-modules | 40 ++++++++++++++++++++++++++++++++++++++++ pbuilder.8 | 15 +++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/pbuilder-checkparams b/pbuilder-checkparams index f711665..688da07 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 @@ -199,6 +200,22 @@ while [ -n "$1" ]; do DEBBUILDOPTS="${DEBBUILDOPTS} -B" shift; ;; + --bin-nmu) + BIN_NMU="yes" + BINARY_ARCH="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 2a5a1fe..51becbb 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -696,6 +696,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 7c3da1e..90b21f3 100644 --- a/pbuilder.8 +++ b/pbuilder.8 @@ -378,6 +378,21 @@ after this option will re-set some parts of the effect. 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. -- cgit v1.2.3