mirror of https://gerrit.osmocom.org/osmo-ci
osmocom-nightly-packages: replace version string with by git-version-gen
E.g. old version 0.10.2.20180501 (0.10.2 last deb version, 20180501 was the date) The new version will look like 0.10.2.279.178b - 0.10.2 is the last tag - .279 is 279 commits since the tag - 178b is the actual short git rev The direct output of ./git-version-gen couldn't be used because debian forbids using a minus (-) in upstream versions. Change-Id: I2da90ada90adf8ef8f8cfee3d26f86fbd3cec181
This commit is contained in:
parent
6da3fe8e8b
commit
f82c367858
|
@ -37,6 +37,25 @@ prepare() {
|
|||
osc co "$PROJ"
|
||||
}
|
||||
|
||||
get_commit_version() {
|
||||
# return a version based on the commit
|
||||
local version
|
||||
local date
|
||||
|
||||
# git version
|
||||
version=$(test -x ./git-version-gen && ./git-version-gen . 2>/dev/null)
|
||||
# debian doesn't allow '-' in version.
|
||||
version=$(echo "$version" | sed 's/-/./g' )
|
||||
|
||||
# deb version
|
||||
if [ -z "$version" ] ; then
|
||||
version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,' | sed 's,),,')
|
||||
version="$version.$DT"
|
||||
fi
|
||||
|
||||
echo -n "$version"
|
||||
}
|
||||
|
||||
build() {
|
||||
local name=$1
|
||||
local changelog=$2
|
||||
|
@ -62,9 +81,9 @@ build() {
|
|||
cd "$repodir"
|
||||
|
||||
if [ "$changelog" = "commit" ] ; then
|
||||
VER=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,' | sed 's,),,')
|
||||
dch -v "$VER.$DT" -m "Snapshot build"
|
||||
git commit -m "$DT snapshot" debian/
|
||||
VER=$(get_commit_version)
|
||||
dch -b -v "$VER" -m "Snapshot build"
|
||||
git commit -m "$VER snapshot" debian/
|
||||
fi
|
||||
|
||||
mkdir -p "$DATA/$name"
|
||||
|
|
Loading…
Reference in New Issue