diff options
-rwxr-xr-x | jenkinstool | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/jenkinstool b/jenkinstool index e34e0f7..e7f1533 100755 --- a/jenkinstool +++ b/jenkinstool @@ -40,7 +40,14 @@ if %(global.pretend)s; then exit 0; fi url_exists() { wget -q -O /dev/null "$1" -} +} + +get_debian_changelog_version() +{ + # Can't use dpkg-parsechangelog, since the Jenins master node does not + # have it (installing it would drag in a lot of extra stuff). + head -n 1 debian/changelog | sed -e 's/^[^(]*(//' -e 's/).*//' +} upstream_version() { @@ -51,7 +58,7 @@ upstream_version() if [ -e debian/changelog ] then - dpkg-parsechangelog | sed -n '/^Version: /s///p' | sed 's/-[^-]*$//' + get_debian_changelog_version | sed 's/-[^-]*$//' return fi @@ -120,25 +127,39 @@ then cd "$vcsworkspace" fi - # Split into two so that if getting the upstream version fails, the - # script fails. version="$(upstream_version)" - if is_release "$project" "$version" + if ! is_release "$project" "$version" then - echo "It is a release build -- not appending .vcsFOO" - else version="$version.vcs$(commit_date)" fi - debianversion="${version}-1.%(host.debian-dist)s" - debianurl="%(global.artifacts-url)s/debian" - tarball="${project}-${version}.tar.gz" tarball_url="${project_url}/$tarball" if [ -d debian ] then - sourcepkg="$(dpkg-parsechangelog | awk '/^Source:/ { print $2 }')" + if is_release "$project" "$version" + then + debianversion="$(get_debian_changelog_version)" + case "$debianversion" in + $version-*) + echo "Upstream version $version and " \ + "debian/changelog version $debianversion" \ + "match, good" + ;; + *) + echo "Upstream version $version and " \ + "debian/changelog version $debianversion" \ + "do NOT match, bad" 1>&2 + exit 1 + ;; + esac + else + debianversion="${version}-1.%(host.debian-dist)s" + fi + + debianurl="%(global.artifacts-url)s/debian" + sourcepkg="$(head -n1 debian/control | awk '/^Source:/ { print $2 }')" case "$sourcepkg" in lib*) subdir=$(echo "$sourcepkg" | cut -c1-4) ;; *) subdir=$(echo "$sourcepkg" | cut -c1) ;; @@ -524,8 +545,11 @@ then exit 0 else wget -O "../$origtgz" "$project_url/$tarball" - dch -v "$debianversion" --distribution "%(host.debian-dist)s" "CI build" - dch -r '' + if ! is_release "$project" "$version" + then + dch -v "$debianversion" --distribution "%(host.debian-dist)s" "CI build" + dch -r '' + fi debuild -S -us -uc -i dput -f jenkins "../$changes" fi |