aboutsummaryrefslogtreecommitdiffstats
path: root/make-version.pl
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-10-31 23:16:00 +0100
committerDario Lombardo <lomato@gmail.com>2016-11-03 08:55:31 +0000
commit9490f5e98db1c18aa527464373ac149ed3ac285b (patch)
treeb392bb22aeecc1d87cdfcefd879bb21c93e8af24 /make-version.pl
parent4863d813e90b220dc3800829472b3615f47f1428 (diff)
autotools: propagate git version info to distribution tarball
Store the git describe output in the distribution tarball (make dist) and ensure that this version is always used for builds from this tarball. This will prevent the useless "Git Rev Unknown from unknown" output in tar-based builds. It will also prevent git from being invoked in tarball builds. Remove the git branch name since the commit ID (and git tag) in the git describe output is sufficient to identify the source tree. (In SVN, a revision ID had to be paired with a branch name to identify the source tree, in git this is no longer the case.) Change-Id: Iffe142b6efd81e857802eb604d6310cfd301d207 Reviewed-on: https://code.wireshark.org/review/18415 Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'make-version.pl')
-rwxr-xr-xmake-version.pl29
1 files changed, 21 insertions, 8 deletions
diff --git a/make-version.pl b/make-version.pl
index 8ce0c3fa4f..facae0157b 100755
--- a/make-version.pl
+++ b/make-version.pl
@@ -130,17 +130,16 @@ sub read_repo_info {
my $is_git_repo = 0;
my $git_cdir;
- # Make sure git is available.
- if (!`$git_executable --version`) {
- print STDERR "Git unavailable. Git revision will be missing from version string.\n";
- return;
- }
if ($version_pref{"pkg_enable"} > 0) {
$package_format = $version_pref{"pkg_format"};
}
- if (-e "$srcdir/.git" && ! -d "$srcdir/.git/svn") {
+ # For tarball releases, do not invoke git at all and instead rely on
+ # versioning information that was provided at tarball creation time.
+ if ($version_pref{"git_description"}) {
+ $info_source = "version.conf file";
+ } elsif (-e "$srcdir/.git" && ! -d "$srcdir/.git/svn") {
$info_source = "Command line (git)";
$version_pref{"git_client"} = 1;
$is_git_repo = 1;
@@ -154,6 +153,12 @@ sub read_repo_info {
$is_git_repo = 1;
}
+ # Make sure git is available.
+ if ($is_git_repo && !`$git_executable --version`) {
+ print STDERR "Git unavailable. Git revision will be missing from version string.\n";
+ return;
+ }
+
# Check whether to include VCS version information in version.h
if ($is_git_repo) {
chomp($git_cdir = qx{git --git-dir="$srcdir/.git" rev-parse --git-common-dir 2> $devnull});
@@ -186,7 +191,12 @@ sub read_repo_info {
# Refs: git ls-remote code.wireshark.org:wireshark
# ea19c7f952ce9fc53fe4c223f1d9d6797346258b (r48972, changed version to 1.11.0)
- if ($version_pref{"git_client"}) {
+ if ($version_pref{"git_description"}) {
+ $git_description = $version_pref{"git_description"};
+ $do_hack = 0;
+ # Assume format like v2.3.0rc0-1342-g7bdcf75
+ $commit_id = ($git_description =~ /([0-9a-f]+)$/)[0];
+ } elsif ($version_pref{"git_client"}) {
eval {
use warnings "all";
no warnings "all";
@@ -606,7 +616,10 @@ sub new_version_h
}
if ($git_description) {
- return "#define VCSVERSION \"$git_description from $repo_branch\"\n";
+ # Do not bother adding the git branch, the git describe output
+ # normally contains the base tag and commit ID which is more
+ # than sufficient to determine the actual source tree.
+ return "#define VCSVERSION \"$git_description\"\n";
}
if ($last_change && $num_commits) {