Okay I am really out of practice with Perl. I fixed an error in the script. I used the wrong command to escape to the shell. -.-
please find an updated patch. On 11.08.19 19:57, Peter Kovacs wrote: > Ok. I remove it. > > On 11.08.19 19:56, Marcus wrote: >> Am 11.08.19 um 19:40 schrieb Peter Kovacs: >>> I have adjusted the Function DetectRevisionId in >>> main/solenv/bin/modules/SvnRevision.pm to return the short hash when >>> executed in a git repository. >>> >>> If it is not a git repository, it will fallback to the SVN logic. The >>> short hash includes a newline. I am not sure if that will make any >>> trouble. >>> >>> >>> I have attached the patch. Please review. I could not test a complete >>> build I have some building issues. (I will send some separated mails.) >>> >>> Also I have not checked in because of the lacking N2N test, and since I >>> do not know what this newline does. >> thanks for the piece of code. Any sideeffects need to be tested of >> course. >> >> One problem I could image is the About dialog. Showing the Git hash >> with a newline would be not suitable. >> >> Any other problem would be in the build system itself I thin. >> >> So, avoiding the newline would be great. >> >> Marcus >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org >> For additional commands, e-mail: dev-h...@openoffice.apache.org >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org > For additional commands, e-mail: dev-h...@openoffice.apache.org >
diff --git a/main/solenv/bin/build.pl b/main/solenv/bin/build.pl index e997010cfb..f24b5554b2 100755 --- a/main/solenv/bin/build.pl +++ b/main/solenv/bin/build.pl @@ -67,9 +67,9 @@ @modes_array = split('\s' , $ENV{BUILD_TYPE}); }; #### script id ##### - ( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; my $id_str = ' $Revision$ '; + my $script_rev = 0; $id_str =~ /Revision:\s+(\S+)\s+\$/ ? ($script_rev = $1) : ($script_rev = "-"); @@ -2602,7 +2602,7 @@ sub read_ssolar_vars { sub get_solar_vars { my ($solar_vars, $file) = @_; my ($var, $value); - open SOLARTABLE, "<$file" or die "canĀ“t open solarfile $file"; + open SOLARTABLE, "<$file" or die "can not open solarfile $file"; while(<SOLARTABLE>) { s/\r\n//o; next if(!/^\w+\s+(\w+)/o); diff --git a/main/solenv/bin/getrevision.pl b/main/solenv/bin/getrevision.pl old mode 100644 new mode 100755 index ed4959b8a1..5992daf57b --- a/main/solenv/bin/getrevision.pl +++ b/main/solenv/bin/getrevision.pl @@ -1,3 +1,4 @@ +#!/bin/perl #************************************************************** # # Licensed to the Apache Software Foundation (ASF) under one diff --git a/main/solenv/bin/modules/SvnRevision.pm b/main/solenv/bin/modules/SvnRevision.pm index 5c2c1fc950..eab95384df 100644 --- a/main/solenv/bin/modules/SvnRevision.pm +++ b/main/solenv/bin/modules/SvnRevision.pm @@ -21,36 +21,8 @@ package SvnRevision; - -sub DetectRevisionIdFromGit ($) -{ - my $path = shift; - - my $id = undef; - - open my $proc, "cd $path && git show HEAD 2>\&1|"; - while (<$proc>) - { - if (/^fatal: Not a git repository/) - { - # Not in a GIT repository. - last; - } - elsif (/^\s*git-svn-id:.*?@([0-9]+)\s+/) - { - $id = $1; - last; - } - } - close $proc; - - return $id; -} - - - - -sub DetectRevisionId ($) +#old SVN code unchanged +sub DetectRevisionIdFromSVN ($) { my $path = shift; @@ -79,4 +51,25 @@ sub DetectRevisionId ($) return $id; } + +sub DetectRevisionId ($) +{ + my $path = shift; + + my $id = undef; + #test if path points to a git repository. if true return is 0 else positive number. + my $isNotGit= `[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1`; + if ($isNotGit) + { + $id = DetectRevisionIdFromSVN ($path); + } + else + { + #returns directly the hash of the current checkout. + $id = `git log -1 --pretty=format:%h`; + } + + return $id; +} + 1;
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org