Skip to contentSkip to conversation

Add bzr revno to the version if in a bzr repository

PATCH New Raphaël Beamonte 2 participants 2 messages Jun 3, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): edd264d153b5ab8dbb2cad9bbc63d05d1ae0cc09.1401817136.git.raphael.beamonte@gmail.com

#1 lore raw

PATCH 1/1 Add bzr revno to the version if in a bzr repository

Sorry, forgot the "lttng-tools" tag.

#2 lore raw
In reply to a message not in the archive

Just to give some context, we had a problem with the Ubuntu PPA packages, where the version in version.h would not get set to anything, and the resulting binary wouldn't report a version number when doing lttng --version.

Turned out it's because Launchpad imports everything to bzr branches, which scrubs the .git directory, and builds the package from that. So the .git directory was not available when building. Which caused the empty version.h (it's easy to reproduce locally, just delete the .git directory then build).

I tested this patch, and it works well when building from the bzr branch. Nice work!

However, should we also handle the case where there is neither a .git or .bzr directory, and only use the version from configure.ac?

Cheers,
Alexandre

Quoted 14 lines · Raphaël Beamonte
---
  include/Makefile.am | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
include/Makefile.am +0 -1
index 386c5ba..a677331 100644
@@ -18,7 +18,13 @@ version.h:
  		##
  		git_branch="$$(git describe --all 2>/dev/null)"; \
  		if [ -z "$${git_branch}" ]; then \
-			git_version=""; \

include/Makefile.am version.h: · line 30

Quoted 10 lines
include/Makefile.am +7 -0
+			## If we are not in a git repository, we can try bzr
+			bzr_version="$$(bzr log -S -l1 2>/dev/null | head -n1 | cut -d' ' -f2)"; \
+			if [ -n "$${bzr_version}" ]; then \
+				git_version="\" VERSION \"-bzr$${bzr_version}"; \
+			else \
+				git_version=""; \
+			fi; \
  		else \
  			git_describe="$$(git describe)"; \
  			if [ "$${git_branch}" == "$${git_describe}" ] || \

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev