diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-15 13:56:05 +0000 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-15 14:13:06 +0000 |
commit | 431a0b2dccdf690c8fee8b16272166a9412e58ad (patch) | |
tree | 3755dfda938a5a85e12dee465ee04a593eee9c27 | |
parent | ef9fd1fa8e4cb6e15a8857b47926236b06d87dd6 (diff) | |
download | pbuilder-431a0b2dccdf690c8fee8b16272166a9412e58ad.tar pbuilder-431a0b2dccdf690c8fee8b16272166a9412e58ad.tar.gz |
modules: style improvments to binNMU()
* use `dpkg-parsechangelog -S $field` to get info from the changelog, instead of
sedding it (dep on dpkg-dev >= 1.7.0)
* use log.[ew] instead of plain echo
* use cat > $tmpcl << EOF instead of that list of echo
* use mktemp to create the temporary changelog, instead of fixing on one filename
* add a lot of quotes
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | pbuilder-modules | 44 |
2 files changed, 23 insertions, 23 deletions
diff --git a/debian/control b/debian/control index 6bb5f65..eba941a 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,7 @@ Package: pbuilder Architecture: all Multi-Arch: foreign Depends: debootstrap | cdebootstrap, - dpkg-dev, + dpkg-dev (>= 1.17.0), wget, ${misc:Depends} Recommends: devscripts, diff --git a/pbuilder-modules b/pbuilder-modules index 51becbb..886aa57 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -701,39 +701,39 @@ function binNMU() { return fi if [ -z "$BINNMU_MESSAGE" ]; then - echo "No changelog message provided for binNMU entry." + log.e "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." + log.w "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." + local cl=$(ls "$BUILDPLACE"/"$BUILDDIR"/*/debian/changelog) + local tmpcl=$(mktemp pbuilder.tmpchangelog.XXXXXXXXXXX) + if [ ! -f "$cl" ]; then + log.e "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') + mv "$cl" "$tmpcl" + local package=$(dpkg-parsechangelog -l "$tmpcl" -c 1 --show-field Source) + local version=$(dpkg-parsechangelog -l "$tmpcl" -c 1 --show-field Version) + local arch=$("$CHROOTEXEC" dpkg-architecture -qDEB_HOST_ARCH) local date=$(date -R) if [ -z "$BINNMU_MAINTAINER" ]; then - echo "No maintainer provided for binNMU entry, fall back to last uploader." - BINNMU_MAINTAINER=$changedby + log.w "No maintainer provided for binNMU entry, fall back to last uploader." + BINNMU_MAINTAINER=$(dpkg-parsechangelog -l $tmpcl -c 1 --show-field Maintainer) 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 + cat > "$cl" << EOF +$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low + * Binary-only non-maintainer upload for $arch; no source changes. + * $BINNMU_MESSAGE + + -- $BINNMU_MAINTAINER $date + +EOF + cat "$tmpcl" >> "$cl" + rm "$tmpcl" } #Setting environmental variables that are really required: |