← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/fix-read-version-on-branch into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:bug/fix-read-version-on-branch into cloud-init:master.

Requested reviews:
  Paul Meyer (paul-meyer)
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/315227
-- 
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/fix-read-version-on-branch into cloud-init:master.
diff --git a/Makefile b/Makefile
index ed631cf..18ec568 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,8 @@ ifeq ($(distro),)
   distro = redhat
 endif
 
-READ_VERSION=$(shell $(PYVER) $(CWD)/tools/read-version)
+READ_VERSION=$(shell $(PYVER) $(CWD)/tools/read-version || \
+  echo read-version-failed)
 CODE_VERSION=$(shell $(PYVER) -c "from cloudinit import version; print(version.version_string())")
 
 
@@ -62,8 +63,8 @@ test: $(unittests)
 
 check_version:
 	@if [ "$(READ_VERSION)" != "$(CODE_VERSION)" ]; then \
-	    echo "Error: read-version version $(READ_VERSION)" \
-	    "not equal to code version $(CODE_VERSION)"; exit 2; \
+	    echo "Error: read-version version '$(READ_VERSION)'" \
+	    "not equal to code version '$(CODE_VERSION)'"; exit 2; \
 	    else true; fi
 
 clean_pyc:
diff --git a/tools/read-version b/tools/read-version
index 3b30b49..ddb2838 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -56,7 +56,7 @@ if os.path.isdir(os.path.join(_tdir, ".git")) and which("git"):
     flags = []
     if use_tags:
         flags = ['--tags']
-    cmd = ['git', 'describe'] + flags
+    cmd = ['git', 'describe', '--match=[0-9]*'] + flags
 
     version = tiny_p(cmd).strip()