← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:version-info-outside-git into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:version-info-outside-git into launchpad:master.

Commit message:
Cope with running outside a git tree

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/412679

It would be useful to be able to produce Launchpad deployment artifacts that have their version information pregenerated and don't require a git working tree.  This only requires a small number of tweaks: the main one is that we need to ensure that `talisker.config` has a usable strategy for discovering the current revision, which is just a matter of writing a `version-info.txt` file to go alongside `version-info.py`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:version-info-outside-git into launchpad:master.
diff --git a/.gitignore b/.gitignore
index 3b2e7d2..fe700ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 *.pyc
 .tags
 version-info.py
+version-info.txt
 logs/*
 +*
 /botmaster
diff --git a/Makefile b/Makefile
index b2daade..75214c4 100644
--- a/Makefile
+++ b/Makefile
@@ -295,7 +295,7 @@ compile: $(VENV_PYTHON)
 	$(PYTHON) utilities/link-system-packages.py \
 		"$(SITE_PACKAGES)" system-packages.txt
 	${SHHH} bin/build-twisted-plugin-cache
-	scripts/update-version-info.sh
+	[ ! -d .git ] || scripts/update-version-info.sh
 
 test_build: build
 	bin/test $(TESTFLAGS) $(TESTOPTS)
diff --git a/scripts/update-version-info.sh b/scripts/update-version-info.sh
index f76b927..46c5d7c 100755
--- a/scripts/update-version-info.sh
+++ b/scripts/update-version-info.sh
@@ -47,3 +47,8 @@ else
         mv ${newfile} version-info.py
     fi
 fi
+
+# talisker.config uses version-info.txt instead, so update that too.  We
+# don't need to be particularly careful about file modification times here,
+# since there are no Makefile dependencies on this.
+echo "$revision_id" >version-info.txt