summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-09-19 15:51:23 (GMT)
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-09-30 10:07:05 (GMT)
commit4670c1e2caddf8c0a7d499eb9697c928ad6fd318 (patch)
tree119774d15bfdb58e94bd6b22ceccf69d41f3d7aa
parenta32de7934cce79dda2b8dc20be1c5ec94109869e (diff)
downloadmorph-baserock/pedroalvarez/morph-version-fix.tar.gz
Fix behaviour of `morph --version`baserock/pedroalvarez/morph-version-fix
Currently, if morph is installed in the system, `morph --version` prints the sha1 of the version installed. $ morph --version e8adedb8f3f27d9212caf277b8e8f7c6792a20c2 If you run morph from git, the output will be something similar to the following. $ morph --version baserock-14.26-124-g7b73af4 This patch changes the behaviour of the latter to match the former.
-rw-r--r--morphlib/gitversion.py6
-rwxr-xr-xtests.as-root/metadata-includes-morph-version.script5
2 files changed, 7 insertions, 4 deletions
diff --git a/morphlib/gitversion.py b/morphlib/gitversion.py
index b1f82da..c593c33 100644
--- a/morphlib/gitversion.py
+++ b/morphlib/gitversion.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013 - 2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,9 @@ except IOError, e:
return o[0].strip()
try:
- version = run_git('describe', '--always', '--dirty=-unreproducible')
+ version = run_git('describe', '--abbrev=40', '--always',
+ '--dirty=-unreproducible',
+ '--match=DO-NOT-MATCH-ANY-TAGS')
commit = run_git('rev-parse', 'HEAD^{commit}')
tree = run_git('rev-parse', 'HEAD^{tree}')
ref = run_git('rev-parse', '--symbolic-full-name', 'HEAD')
diff --git a/tests.as-root/metadata-includes-morph-version.script b/tests.as-root/metadata-includes-morph-version.script
index f83712a..772d7d5 100755
--- a/tests.as-root/metadata-includes-morph-version.script
+++ b/tests.as-root/metadata-includes-morph-version.script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013 - 2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ set -eu
# get git version info
cd "$SRCDIR"
-description="$(git describe --always --dirty=-unreproducible)"
+description="$(git describe --abbrev=40 --always \
+ --dirty=-unreproducible --match=DO-NOT-MATCH-ANY-TAGS)"
commit="$(git rev-parse 'HEAD^{commit}')"
tree="$(git rev-parse 'HEAD^{tree}')"
ref="$(git rev-parse --symbolic-full-name 'HEAD')"