diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-02-10 22:20:31 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-02-10 22:20:31 +0000 |
commit | f8002de6a47771b4202133bf6747ed8fd4863812 (patch) | |
tree | 31a9e1e4c63dfb7c40ca1bbc40b7a4e3f2608e13 /make-version.pl | |
parent | eb769ce13e236bfac7aaa785b16d84aa6f63eef7 (diff) | |
download | wireshark-f8002de6a47771b4202133bf6747ed8fd4863812.tar.gz wireshark-f8002de6a47771b4202133bf6747ed8fd4863812.tar.bz2 wireshark-f8002de6a47771b4202133bf6747ed8fd4863812.zip |
If we're using git, try pulling the SVN revision out of the commit body.
svn path=/trunk/; revision=47619
Diffstat (limited to 'make-version.pl')
-rwxr-xr-x | make-version.pl | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/make-version.pl b/make-version.pl index 5de69de5f4..660583b2b6 100755 --- a/make-version.pl +++ b/make-version.pl @@ -93,7 +93,7 @@ my %version_pref = ( #"pkg_format" => "", ); my $srcdir = "."; -my $svn_info_cmd = ""; +my $info_cmd = ""; # Ensure we run with correct locale $ENV{LANG} = "C"; @@ -119,17 +119,17 @@ sub read_svn_info { if (-d "$srcdir/.svn") { $info_source = "Command line (svn info)"; - $svn_info_cmd = "svn info $srcdir"; + $info_cmd = "svn info $srcdir"; } elsif (-d "$srcdir/.git/svn") { $info_source = "Command line (git-svn)"; - $svn_info_cmd = "(cd $srcdir; git svn info)"; + $info_cmd = "(cd $srcdir; git svn info)"; } if ($version_pref{"svn_client"}) { eval { use warnings "all"; no warnings "all"; - $line = qx{$svn_info_cmd}; + $line = qx{$info_cmd}; if (defined($line)) { if ($line =~ /Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) { $last_change = timegm($6, $5, $4, $3, $2 - 1, $1); @@ -158,8 +158,8 @@ sub read_svn_info { close(TORTOISE); $info_source = "Command line (SubWCRev)"; - $svn_info_cmd = "SubWCRev $srcdir $tortoise_file $version_file"; - my $tortoise = system($svn_info_cmd); + $info_cmd = "SubWCRev $srcdir $tortoise_file $version_file"; + my $tortoise = system($info_cmd); if ($tortoise == 0) { $do_hack = 0; } @@ -188,18 +188,25 @@ sub read_svn_info { eval { use warnings "all"; no warnings "all"; - $svn_info_cmd = "(cd $srcdir; git log --format='commit: %h%ndate: %ad' -n 1 --date=iso)"; - $line = qx{$svn_info_cmd}; + # If someone had properly tagged 1.9.0 we could also use + # "git describe --abbrev=1 --tags HEAD" + + $info_cmd = "(cd $srcdir; git log --format='%b' -n 1)"; + $line = qx{$info_cmd}; if (defined($line)) { - if ($line =~ /date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) { - $last_change = timegm($6, $5, $4, $3, $2 - 1, $1); - } - if ($line =~ /commit: (\S+)/) { + if ($line =~ /svn path=.*; revision=(\d+)/) { $revision = $1; } } - $svn_info_cmd = "(cd $srcdir; git branch)"; - $line = qx{$svn_info_cmd}; + $info_cmd = "(cd $srcdir; git log --format='%ad' -n 1 --date=iso)"; + $line = qx{$info_cmd}; + if (defined($line)) { + if ($line =~ /(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) { + $last_change = timegm($6, $5, $4, $3, $2 - 1, $1); + } + } + $info_cmd = "(cd $srcdir; git branch)"; + $line = qx{$info_cmd}; if (defined($line)) { if ($line =~ /\* (\S+)/) { $repo_path = $1; @@ -214,8 +221,8 @@ sub read_svn_info { eval { use warnings "all"; no warnings "all"; - $svn_info_cmd = "(cd $srcdir; bzr log -l 1)"; - $line = qx{$svn_info_cmd}; + $info_cmd = "(cd $srcdir; bzr log -l 1)"; + $line = qx{$info_cmd}; if (defined($line)) { if ($line =~ /timestamp: \S+ (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) { $last_change = timegm($6, $5, $4, $3, $2 - 1, $1); |