Rework generate-git-snapshot to make sure quilt can't break the build

When using the dpkg 3.0 (quilt) format (see debian/source/format)
there might be quilt patches still applied in the source tree,
either because of a broken build or under certain - though not yet
clearly identified - situations which seem to end with a
"diff: standard output: Broken pipe" message in the build log.

This then might end up in a build failure like:

| + cd /var/lib/jenkins/workspace/glusterfs-source
| + dpkg-source -i -I -b source
| dpkg-source: info: using source format `3.0 (quilt)'
| diff: standard output: Broken pipe
| diff: standard output: Broken pipe
| dpkg-source: info: building glusterfs using existing ./glusterfs_3.2.7.orig.tar.gz
| dpkg-source: info: local changes detected, the modified files are:
|  source/ChangeLog
|  source/doc/gluster.8
|  source/doc/glusterfs.8
|  source/libglusterfs/src/common-utils.c
|  source/rpc/rpc-lib/src/rpcsvc.c
|  source/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
| dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/glusterfs_3.2.7-2~bpo60+1.diff.3Wkisr
| dpkg-source: info: you can integrate the local changes with dpkg-source --commit

While everything has been cleanly integrated in debian/patches/
the build process fails because it looks like there have been
modifications to upstream sources whereas it's just wrong
information about patches applied.

So instead make sure we enter a clean git repository before doing
any changes (this can be skipped via SKIP_GIT_CLEANUP=true) and
also unapply all present quilt patches (this can be skipped via
SKIP_QUILT_CLEANUP=true). Finally replace the dpkg-source call
with dpkg-buildpackage and its --source-option=--unapply-patches
feature. While the combination of the git cleanup, quilt cleanup
and dpkg-source->dpkg-buildpackage is more than explicitely
necessary this provides more flexibility if needed.

Thanks: Raphael Hertzog <hertzog@debian.org> for his dpkg related feedback
remotes/origin/mika/use_dsc_instead_of_tar
Michael Prokop 12 years ago
parent 8d10e82c56
commit 63d6c47ce5

1
debian/control vendored

@ -14,6 +14,7 @@ Architecture: all
Depends: cowbuilder,
devscripts,
dpkg-dev,
quilt,
reprepro,
sudo | sudo-ldap,
${misc:Depends}

@ -227,6 +227,30 @@ changelog_generation() {
fi
}
git_cleanup() {
if [ -n "${SKIP_GIT_CLEANUP:-}" ] ; then
echo "*** Skipping git_cleanup as requested via SKIP_QUILT_CLEANUP ***"
return 0
fi
echo "*** Cleaning git repository to make sure there are no modified files ***"
echo "*** Note: You can skip this step by setting SKIP_GIT_CLEANUP=true ***"
git clean -fxd
git reset --hard HEAD
}
quilt_cleanup() {
if [ -n "${SKIP_QUILT_CLEANUP:-}" ] ; then
echo "*** Skipping quilt_cleanup as requested via SKIP_QUILT_CLEANUP ***"
return 0
fi
echo "*** Unapplying all possibly applied quilt patches and removing quilt directory ***"
echo "*** Note: You can skip this step by setting SKIP_QUILT_CLEANUP=true ***"
quilt pop -a || true
rm -rf .pc
}
# main execution
echo "*** source package build phase ***"
rm -f ./* || true
@ -238,6 +262,8 @@ fi
cd "$SOURCE_DIRECTORY"
git_cleanup
# make sure common branches are available for git-buildpackage
create_local_branch upstream
create_local_branch debian
@ -264,9 +290,11 @@ else
git-buildpackage ${GBP_OPTS}
fi
quilt_cleanup
# build source package, run before switching back to previous branch
# to get the actual requested version
( cd "$WORKSPACE" ; dpkg-source -i -I -b "$SOURCE_DIRECTORY" )
dpkg-buildpackage -uc -us -nc -d -S -i -I --source-option=--unapply-patches
# revert to original debian/changelog to avoid merge conflicts
git checkout -- $(readlink -f debian/changelog)

Loading…
Cancel
Save