diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-02-15 12:34:49 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2021-02-16 11:37:24 +0100 |
commit | bc2d794da8ee7b36bce25d4335cb9f47fa0a9f5d (patch) | |
tree | dbd20c1c55875975646f7934fae0ccbab25aa94f /scripts/common-obs.sh | |
parent | e99cb64e2e75c467b59ade0e9547d7e8a2d1cf41 (diff) |
OBS: nightly: use epoch from debian/changelog
If epoch is used in debian/changelog, prepend it to the version from
git-version-gen. Also set the epoch in the spec file.
For example, the version in debian/changelog may be 1:0.0.1. The epoch
is 1, therefore a 0.0.1.18.b5d18 version from git-version-gen would turn
into 1:0.0.1.18.b5d18.
Setting epoch=1 is needed for osmo-gbproxy, so apt on debian 10 with the
nightly Osmocom repository enabled does not try to install osmo-gbproxy
1.3.0 from the debian repositories instead of 0.0.1 from the Omsocom
repository.
Related: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
Related: OS#4992
Change-Id: I3d63f040058340bdcf9075c03387798c5314be03
Diffstat (limited to 'scripts/common-obs.sh')
-rw-r--r-- | scripts/common-obs.sh | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh index 366d72e..edd48df 100644 --- a/scripts/common-obs.sh +++ b/scripts/common-obs.sh @@ -113,6 +113,7 @@ osmo_obs_add_rpm_spec() { local spec="$oscdir/$name.spec" local tarball local version + local epoch if [ -z "$spec_in" ]; then echo "WARNING: RPM spec missing: $name.spec.in" @@ -123,9 +124,19 @@ osmo_obs_add_rpm_spec() { osmo_obs_add_depend_rpm "$spec" "$name" "$depend" "$dependver" - # Set version - version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2 | xargs)" - sed -i "s/^Version:.*/Version: $version/g" "$spec" + # Set version and epoch from "Version: [EPOCH:]VERSION" in .dsc + version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2- | xargs)" + case $version in + *:*) + epoch=$(echo "$version" | cut -d : -f 1) + version=$(echo "$version" | cut -d : -f 2) + ;; + esac + if [ -n "$epoch" ]; then + sed -i "s/^Version:.*/Version: $version\nEpoch: $epoch/g" "$spec" + else + sed -i "s/^Version:.*/Version: $version/g" "$spec" + fi # Set source file tarball="$(ls -1 "${name}_"*".tar."*)" |