[MERGED] osmo-ci[master]: osmocom-nightly-packages: replace version string with by git...

2018-05-03 Thread lynxis lazus
lynxis lazus has submitted this change and it was merged.

Change subject: osmocom-nightly-packages: replace version string with by 
git-version-gen
..


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
---
M scripts/osmocom-nightly-packages.sh
1 file changed, 22 insertions(+), 3 deletions(-)

Approvals:
  lynxis lazus: Verified
  Harald Welte: Looks good to me, approved



diff --git a/scripts/osmocom-nightly-packages.sh 
b/scripts/osmocom-nightly-packages.sh
index c9eb2e0..a200f36 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -37,6 +37,25 @@
   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 @@
   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"

-- 
To view, visit https://gerrit.osmocom.org/7976
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2da90ada90adf8ef8f8cfee3d26f86fbd3cec181
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 


osmo-ci[master]: osmocom-nightly-packages: replace version string with by git...

2018-05-03 Thread lynxis lazus

Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.osmocom.org/7976
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2da90ada90adf8ef8f8cfee3d26f86fbd3cec181
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-ci[master]: osmocom-nightly-packages: replace version string with by git...

2018-05-02 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/7976
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2da90ada90adf8ef8f8cfee3d26f86fbd3cec181
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ci[master]: osmocom-nightly-packages: replace version string with by git...

2018-05-02 Thread lynxis lazus

Review at  https://gerrit.osmocom.org/7976

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
---
M scripts/osmocom-nightly-packages.sh
1 file changed, 22 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/76/7976/1

diff --git a/scripts/osmocom-nightly-packages.sh 
b/scripts/osmocom-nightly-packages.sh
index c9eb2e0..a200f36 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -37,6 +37,25 @@
   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 @@
   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"

-- 
To view, visit https://gerrit.osmocom.org/7976
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2da90ada90adf8ef8f8cfee3d26f86fbd3cec181
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus