Skip to content

Commit

Permalink
make-version.pl: no need for git-ls-remote
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Lekensteyn authored and geraldcombs committed Oct 19, 2015
1 parent 2bde913 commit 1868dce
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions make-version.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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\}});
Expand All @@ -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";
Expand 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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1868dce

Please sign in to comment.