Browse Source

Allow overriding the source package dist

When DIST is set in a source job, generate-git-snapshot now uses that
dist in the debian/changelog. As this is only useful if one keeps the
built .changes file, this introduces a new setting KEEP_SOURCE_CHANGES
which must be set as well.

In the binary job configuration, one can get to the dist like this:

  export REPOS=$(awk '/^Distribution:/ { gsub("Distribution: ", ""); print $0 }' tmpdir/*_source.changes)

Also, in the binary job one should remove the source changes file, ex:

  rm -f tmpdir/*_source.changes

I'm using this successfully to build per-branch dists, in a development
environment where work happens on multiple repositories with shared
branch names.

With changes from @mika to turn the fatal error into a warning.
tags/v0.10.0
Christian Hofstaedtler 7 years ago
parent
commit
cfdec26252
1 changed files with 22 additions and 5 deletions
  1. +22
    -5
      scripts/generate-git-snapshot

+ 22
- 5
scripts/generate-git-snapshot View File

@@ -34,6 +34,11 @@ if [ -n "${JENKINS_DEBIAN_GLUE_VERSION:-}" ] ; then
echo "*** Running jenkins-debian-glue version $JENKINS_DEBIAN_GLUE_VERSION ***"
fi

if [ -n "${DIST:-}" -a -z "${KEEP_SOURCE_CHANGES:-}" ]; then
echo "*** Warning: DIST is set but KEEP_SOURCE_CHANGES is not, this doesn't make sense. ***"
echo "*** Please consider setting KEEP_SOURCE_CHANGES=true when setting DIST. ***"
fi

gbp_opts() {
# support overriding git-buildpackage options
if [ -n "${GBP_OPTS:-}" ] ; then
@@ -95,6 +100,9 @@ dch_opts() {
echo "Found environment variable DCH_EXTRA_OPTS, set to ${DCH_EXTRA_OPTS}"
else
DCH_EXTRA_OPTS="--new-version=${VERSION_STRING}"
if [ -n "${DIST:-}" ]; then
DCH_EXTRA_OPTS="${DCH_EXTRA_OPTS} --distribution ${DIST} --force-distribution"
fi
echo "Using extra git-dch options (${DCH_EXTRA_OPTS})"
fi
}
@@ -271,8 +279,12 @@ changelog_generation() {

# get rid of "UNRELEASED" distribution header, only
# necessary if the debian/changelog was modified
if [ -z "${tag:-}" ] ; then
debchange --release ""
if [ -z "${tag:-}" ]; then
local debchange_opts
if [ -n "${DIST:-}" ]; then
debchange_opts="--distribution ${DIST} --force-distribution"
fi
debchange --release ${debchange_opts:-} ""
fi
fi
}
@@ -356,9 +368,14 @@ quilt_cleanup
# to get the actual requested version
dpkg-buildpackage -uc -us -nc -d -S -i -I --source-option=--unapply-patches

# get rid of the *_source.changes files generate by dpkg-buildpackage
# to avoid failures in a later stage when copying all files around
rm -f ../*_source.changes
if [ -n "${KEEP_SOURCE_CHANGES:-}" ]; then
echo "*** Not removing ../*_source.changes because KEEP_SOURCE_CHANGES is set ***"
else
echo "*** Removing ../*_source.changes because KEEP_SOURCE_CHANGES is not set ***"
# get rid of the *_source.changes files generated by dpkg-buildpackage,
# to avoid failures in a later stage when copying *all* files around
rm -f ../*_source.changes
fi

# revert to original debian/changelog to avoid merge conflicts
git checkout -- $(readlink -f debian/changelog)


Loading…
Cancel
Save