make-version.pl: no need for git-ls-remote

In subversion, the URL was needed to find the branch. This is not needed
for git where a 'git branch' command suffices.

Remove the unused URL handling from git, this fixes a warning during
cmake on RHEL6 and avoids a fallback to SVN:

    Version configuration file version.conf not found.  Using defaults.
    usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
    Unable to open ./.svn/entries
    #define VCSVERSION "v2.1.0rc0-69-g2eb7e87"
    #define VCSBRANCH "master"

Print the SVN warning to stderr, this avoids a compilation failure due
to a syntax error in version.h.

Change-Id: Idb28e74b7a9bf592686b45349cf5e81f85f6c358
Reviewed-on: https://code.wireshark.org/review/11041
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Peter Wu 2015-10-14 19:13:08 +02:00 committed by Gerald Combs
parent 2bde91330a
commit 1868dce4de
1 changed files with 8 additions and 13 deletions

View File

@ -116,8 +116,6 @@ sub read_repo_info {
my $in_entries = 0;
my $svn_name;
my $repo_version;
my $repo_root = undef;
my $repo_url = undef;
my $do_hack = 1;
my $info_source = "Unknown";
@ -179,11 +177,6 @@ sub read_repo_info {
$commit_id = $parts[-1];
}
chomp($line = qx{git --git-dir=$srcdir/.git ls-remote --get-url origin});
if (defined($line)) {
$repo_url = $line;
}
# This will break in some cases. Hopefully not during
# official package builds.
chomp($line = qx{git --git-dir=$srcdir/.git rev-parse --abbrev-ref --symbolic-full-name \@\{upstream\}});
@ -194,10 +187,12 @@ sub read_repo_info {
1;
};
if ($last_change && $num_commits && $repo_url && $repo_branch) {
if ($last_change && $num_commits && $repo_branch) {
$do_hack = 0;
}
} elsif ($version_pref{"svn_client"}) {
my $repo_root = undef;
my $repo_url = undef;
eval {
use warnings "all";
no warnings "all";
@ -220,6 +215,10 @@ sub read_repo_info {
1;
};
if ($repo_url && $repo_root && index($repo_url, $repo_root) == 0) {
$repo_branch = substr($repo_url, length($repo_root));
}
if ($last_change && $num_commits && $repo_url && $repo_root) {
$do_hack = 0;
}
@ -316,7 +315,7 @@ sub read_repo_info {
if ($do_hack) {
# Start of ugly internal SVN file hack
if (! open (ENTRIES, "< $srcdir/.svn/entries")) {
print ("Unable to open $srcdir/.svn/entries\n");
print STDERR "Unable to open $srcdir/.svn/entries\n";
} else {
$info_source = "Prodding .svn";
# We need to find out whether our parser can handle the entries file
@ -366,10 +365,6 @@ sub read_repo_info {
$package_string = strftime($package_format, gmtime($last_change));
}
if ($repo_url && $repo_root && index($repo_url, $repo_root) == 0) {
$repo_branch = substr($repo_url, length($repo_root));
}
if ($get_vcs) {
print <<"Fin";
Commit distance : $num_commits