Skip to content

Commit

Permalink
Merge pull request #123 from hollie/autoversion
Browse files Browse the repository at this point in the history
Using VERSION to determine the MisterHouse program version.
  • Loading branch information
hollie committed Mar 18, 2013
2 parents cee8267 + cdcb40e commit 30eae68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unstable
36 changes: 10 additions & 26 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,18 @@ BEGIN {
}
chdir $Pgm_Path; # Base everything from the mh dir.

# Are we running from within a subversion repository?
my $entries='../.svn/entries';
my $revision=undef;
if (-r $entries) {
open (ENTRIES, $entries);
my $line1=<ENTRIES>;
# $entries can be either XML (svn < 1.4) or just text (svn >= 1.4)
if ($line1 =~ /xml/) {
while (<ENTRIES>) {
next unless /revision="(\d+)"/;
$revision=$1;
last;
}
} else {
# the revision number is the 11th line. We have already read 1 line
for (1..10) {
$revision=<ENTRIES>;
}
chomp $revision;
}
close (ENTRIES);
# Determine the VERSION
my $autover;

if (-e '../VERSION') {
open (VERSION, '../VERSION');
$autover = <VERSION>;
chomp $autover;
close (VERSION);
}

$Version = "mh 2.105";
if ($revision) {
$Version.=" R${revision}";
}
$Version .= " (compiler: $Info{Perl_compiled})" if $Info{Perl_compiled};
$Version = $autover || 'unknown';
$Version .= " (compiler: $Info{Perl_compiled})" if $Info{Perl_compiled};

# $Pgm_Path = '.';

Expand Down

0 comments on commit 30eae68

Please sign in to comment.