diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-25 23:44:57 +0000 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-25 23:54:21 +0000 |
commit | a3aa1dd2177a0d349cfdf8cbc2642617e955143f (patch) | |
tree | 7b91544d88963881901e5f670b2caf668a67fc03 /pbuilder-buildpackage-funcs | |
parent | 1777fdaa90bc28b75a3685fd7de789e2dec97b87 (diff) | |
download | pbuilder-a3aa1dd2177a0d349cfdf8cbc2642617e955143f.tar pbuilder-a3aa1dd2177a0d349cfdf8cbc2642617e955143f.tar.gz |
buildpackage: move the binNMU() function from modules to buildpackage-funcs, where it fits better
Diffstat (limited to 'pbuilder-buildpackage-funcs')
-rw-r--r-- | pbuilder-buildpackage-funcs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs index e80555b..f93d7ee 100644 --- a/pbuilder-buildpackage-funcs +++ b/pbuilder-buildpackage-funcs @@ -123,3 +123,48 @@ function setup_ccache() { unset CCACHE_DIR fi } + +function binNMU() { + if [ "$BIN_NMU" == "no" ]; then + return + fi + if [ -z "$BINNMU_MESSAGE" ]; then + log.e "No changelog message provided for binNMU entry." + exit 1 + fi + if [ -z "$BINNMU_VERSION" ]; then + log.w "No version provided for binNMU entry, fall back to 1." + BINNMU_VERSION=1 + fi + log.i "Doing a binNMU, version $BINNMU_VERSION to '$BINNMU_MESSAGE'" + 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=$(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 + 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 + if [ -z "$DISTRIBUTION" ]; then + log.w "No distribution provided, using the field from the last upload" + DISTRIBUTION=$(dpkg-parsechangelog -l "$tmpcl" -c 1 --show-field Distribution) + fi + DEBBUILDOPTS="${DEBBUILDOPTS} -e\"$BINNMU_MAINTAINER\"" + cat > "$cl" << EOF +$package ($version+b$BINNMU_VERSION) $DISTRIBUTION; urgency=low, binary-only=yes + * Binary-only non-maintainer upload for $arch; no source changes. + * $BINNMU_MESSAGE + + -- $BINNMU_MAINTAINER $date + +EOF + cat "$tmpcl" >> "$cl" + rm "$tmpcl" +} |