diff options
author | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-01-08 10:36:28 +0000 |
---|---|---|
committer | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-01-08 10:36:28 +0000 |
commit | 0355e6add3b3368a58fb23cde5da59f8337b834e (patch) | |
tree | 56fe13ff82cf81d6c012dec7708e616b6717b595 /make-version.pl | |
parent | 601f8900674e5d9abae01cb0c76522f363d319ff (diff) |
Adapt the svn info hack to work out of the box for people who
are using svn 1.4 or newer to automatically switch to svn info.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20343 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'make-version.pl')
-rwxr-xr-x | make-version.pl | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/make-version.pl b/make-version.pl index 668f0e1009..dc2a7d9ffa 100755 --- a/make-version.pl +++ b/make-version.pl @@ -28,11 +28,11 @@ # Possible values are: # # enable - Enable or disable versioning. Zero (0) disables, nonzero -# enables. +# enables. # svn_client - Use svn client i.s.o. ugly internal SVN file hack # format - A strftime() formatted string to use as a template for -# the version string. The sequence "%#" will substitute -# the SVN revision number. +# the version string. The sequence "%#" will substitute +# the SVN revision number. # pkg_enable - Enable or disable package versioning. # pkg_format - Like "format", but used for the package version. # @@ -84,12 +84,32 @@ sub read_svn_info { my $package_format = ""; my $in_entries = 0; my $svn_name; + my $repo_version; if ($version_pref{"pkg_enable"}) { $package_format = $version_pref{"pkg_format"}; } - if ($version_pref{"svn_client"}) { + if (!$version_pref{"svn_client"}) { + # Start of ugly internal SVN file hack + if (! open (ENTRIES, "< $srcdir/.svn/entries")) { + print ("Unable to open $srcdir/.svn/entries, trying 'svn info'\n"); + # Fall back to "svn info" + $version_pref{"svn_client"} = 1; + } + + # We need to find out whether our parser can handle the entries file + $line = <ENTRIES>; + chomp $line; + if ($line eq '<?xml version="1.0" encoding="utf-8"?>') { + $repo_version = "pre1.4"; + } elsif ($line =~ /^8$/) { + $repo_version = "1.4"; + } else { + $repo_version = "unknown"; + } + } + if ($version_pref{"svn_client"} || ($repo_version ne "pre1.4")) { $line = qx{svn info}; if ($line =~ /Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) { $last = timegm($6, $5, $4, $3, $2 - 1, $1); @@ -98,12 +118,6 @@ sub read_svn_info { return; } - # Start of ugly internal SVN file hack - if (! open (ENTRIES, "< $srcdir/.svn/entries")) { - print ("Unable to get SVN info.\n"); - return; - } - # The entries schema is flat, so we can use regexes to parse its contents. while ($line = <ENTRIES>) { if ($line =~ /<entry$/ || $line =~ /<entry\s/) { |