improve --version output
now showing a value like 1.4.20161008, the same as the DEB package
This commit is contained in:
parent
70e6aaa9a7
commit
136bb53a89
@ -32,7 +32,7 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "ruby | ruby-interpreter")
|
||||
INCLUDE(CPack)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
COMMAND git rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_REV
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
@ -48,7 +48,11 @@ message(STATUS "GIT_DATE = '${GIT_DATE}'")
|
||||
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ./replace_strings.pl "GIT_REV_STRING=${GIT_REV}" "GIT_DATE_STRING=${GIT_DATE}" bin/cmdtest.rb bin/cmdtest.rb.generated
|
||||
COMMAND ./replace_strings.pl
|
||||
"GIT_REV_STRING=${GIT_REV}"
|
||||
"GIT_DATE_STRING=${GIT_DATE}"
|
||||
"VERSION=${CPACK_PACKAGE_VERSION}"
|
||||
bin/cmdtest.rb bin/cmdtest.rb.generated
|
||||
)
|
||||
|
||||
|
||||
|
@ -49,10 +49,11 @@ module Cmdtest
|
||||
|
||||
ORIG_CWD = Dir.pwd
|
||||
|
||||
GIT_REV = 'GIT_REV_STRING'
|
||||
GIT_DATE = 'GIT_DATE_STRING'
|
||||
GIT_REV = '$GIT_REV_STRING$'
|
||||
GIT_DATE = '$GIT_DATE_STRING$'
|
||||
VERSION = '$VERSION$'
|
||||
|
||||
VERSION = '1.4'
|
||||
SHORT_VERSION = '1.4'
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@ -605,10 +606,10 @@ module Cmdtest
|
||||
opts = _parse_options
|
||||
|
||||
if opts.shortversion
|
||||
puts VERSION
|
||||
puts SHORT_VERSION
|
||||
exit(0)
|
||||
elsif opts.version
|
||||
puts "Version: " + VERSION
|
||||
puts "Version: " + (VERSION =~ /^\$/ ? SHORT_VERSION : VERSION)
|
||||
if File.directory?(File.join(TOP_DIR, ".git"))
|
||||
Dir.chdir(TOP_DIR) do
|
||||
git_rev = `git rev-parse HEAD`
|
||||
|
@ -21,7 +21,7 @@ open(my $g, '>', $outfile) || die "open($outfile)";
|
||||
while (my $line = <$f>) {
|
||||
for my $entry (@replace) {
|
||||
my ($old, $new) = @$entry;
|
||||
$line =~ s/$old/$new/g;
|
||||
$line =~ s/\$$old\$/$new/g;
|
||||
}
|
||||
print {$g} $line;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user