You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2019/10/03 17:08:52 UTC
[openoffice] branch AOO418 updated: Allow for source repo builds to
include repo revision number,
as stored when the tarball/zipfile was created.
This is an automated email from the ASF dual-hosted git repository.
jim pushed a commit to branch AOO418
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO418 by this push:
new 0c6d619 Allow for source repo builds to include repo revision number, as stored when the tarball/zipfile was created.
0c6d619 is described below
commit 0c6d6194a959cb1b87417e9077dc1d8ece630b11
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Thu Oct 3 12:57:05 2019 -0400
Allow for source repo builds to include repo revision number, as stored when the tarball/zipfile was created.
(cherry picked from commit 27a447d8e738b70f74ab05606693d7139127efc4)
---
main/instsetoo_native/util/makefile.mk | 1 +
main/solenv/bin/modules/RepoRevision.pm | 44 ++++++++++++++++++++++++---------
2 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/main/instsetoo_native/util/makefile.mk b/main/instsetoo_native/util/makefile.mk
index 4559b68..d374929 100644
--- a/main/instsetoo_native/util/makefile.mk
+++ b/main/instsetoo_native/util/makefile.mk
@@ -162,6 +162,7 @@ VERBOSESWITCH+=-log
SRC_RELEASE_OUT_DIR=$(shell cd $(OUT) && pwd)$/AOO_SRC_Release
aoo_srcrelease: $(SOLARENV)$/bin$/srcrelease.xml
+ $(PERL) -I$(SOLARENV)/bin/modules -e "use RepoRevision; print RepoRevision::DetectRevisionId(\"$(SRC_ROOT)\")" > $(SOLARENV)$/inc$/reporevision.lst
@-$(MKDIR) $(OUT)$/AOO_SRC_Release
$(ANT) -f $(SOLARENV)$/bin$/srcrelease.xml -q -Dbasedir=$(SOURCE_ROOT_DIR) -Dout.dir=$(SRC_RELEASE_OUT_DIR)
diff --git a/main/solenv/bin/modules/RepoRevision.pm b/main/solenv/bin/modules/RepoRevision.pm
index db04180..580e0cf 100644
--- a/main/solenv/bin/modules/RepoRevision.pm
+++ b/main/solenv/bin/modules/RepoRevision.pm
@@ -23,11 +23,29 @@
package RepoRevision;
-#old SVN code unchanged
-sub DetectRevisionIdFromSVN ($)
+sub DetectRevisionIdFromFile ($)
{
my $path = shift;
+ my $id = undef;
+
+ open( my $fh, '<', $path ) || return undef;
+ $id = <$fh>;
+ close $fh;
+ return $id;
+}
+
+sub DetectRevisionIdFromGit ($)
+{
+ my $path = shift;
+ my $id = undef;
+
+ $id = `git log -1 --pretty=format:%h --abbrev=10`;
+ return $id;
+}
+sub DetectRevisionIdFromSVN ($)
+{
+ my $path = shift;
my $id = undef;
open my $proc, "cd $path && svn info 2>\&1 |";
@@ -36,8 +54,7 @@ sub DetectRevisionIdFromSVN ($)
if (/svn: E155007:/ || /svn: '.' is not a working copy/)
{
# Not in an SVN repository.
- $id = DetectRevisionIdFromGit($path);
- last;
+ return undef;
}
else
{
@@ -49,7 +66,6 @@ sub DetectRevisionIdFromSVN ($)
}
}
close $proc;
-
return $id;
}
@@ -57,20 +73,24 @@ sub DetectRevisionIdFromSVN ($)
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)
+
+ my $NotGit = `cd $path && git rev-parse --git-dir > /dev/null 2>&1`;
+ if (!$NotGit || -d ".git" || -d "$path/.git")
{
- $id = DetectRevisionIdFromSVN ($path);
+ $id = DetectRevisionIdFromGit ($path);
}
else
{
- #returns directly the hash of the current checkout.
- $id = `git log -1 --pretty=format:%h --abbrev=10`;
+ $id = DetectRevisionIdFromSVN ($path);
}
+ if (!$id)
+ {
+ #NOTE: Magic cookie file 'reporevision.lst' created by aoo_srcrelease
+ $id = DetectRevisionIdFromFile ("$ENV{'SOLARENV'}/inc/reporevision.lst");
+ if (!$id) { $id = "unknown-rev" };
+ }
return $id;
}