changeset 2679:953d306b203e jdk-9.0.4+8

8191940: OpenJDK bundle contains closed repository information in release file Reviewed-by: ihse
author erikj
date Wed, 29 Nov 2017 23:00:43 +0100
parents 59e4fea3c13a
children 730dbb653c13
files make/SourceRevision.gmk make/common/MakeBase.gmk
diffstat 2 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/make/SourceRevision.gmk	Wed Nov 29 14:19:55 2017 -0800
+++ b/make/SourceRevision.gmk	Wed Nov 29 23:00:43 2017 +0100
@@ -39,8 +39,6 @@
 # revisions of all repos will be stored in a file in the top dir, which is then
 # used when creating the tracker file.
 
-STORED_SOURCE_REVISION := $(TOPDIR)/.src-rev
-
 # Are we using mercurial?
 ifneq ($(and $(HG), $(wildcard $(TOPDIR)/.hg)), )
 
@@ -108,7 +106,15 @@
 	$(call LogInfo, No mercurial configuration present$(COMMA) not updating .src-rev)
 
     $(SOURCE_REVISION_TRACKER): $(STORED_SOURCE_REVISION)
-	$(install-file)
+	$(call MakeDir, $(@D))
+	$(RM) $@
+        # Only include revisions for repos that are included in the current
+        # source set.
+	for r in `cat $<`; do \
+	  if [ -d "$(TOPDIR)/`$(ECHO) $$r | $(CUT) -d':' -f1`" ]; then \
+	    $(PRINTF) "$$r " >> $@; \
+	  fi; \
+	done
 
     create-source-revision-tracker: $(SOURCE_REVISION_TRACKER)
   else
--- a/make/common/MakeBase.gmk	Wed Nov 29 14:19:55 2017 -0800
+++ b/make/common/MakeBase.gmk	Wed Nov 29 23:00:43 2017 +0100
@@ -342,11 +342,25 @@
 # the build was created from
 SOURCE_REVISION_TRACKER := $(SUPPORT_OUTPUTDIR)/src-rev/source-revision-tracker
 
-# Locate all hg repositories included in the forest, as absolute paths
+# A cache of the mercurial information which can be dropped in the top of the
+# source tree for inclusion in a source bundle.
+STORED_SOURCE_REVISION := $(TOPDIR)/.src-rev
+
+# Locate all hg repositories included in the forest, as absolute paths. Use .hg
+# dirs if present, otherwise parse the .src-rev file and match dirs.
 FindAllReposAbs = \
-    $(strip $(sort $(dir $(filter-out $(SRC_ROOT)/build/%, $(wildcard \
-        $(addprefix $(SRC_ROOT)/, .hg */.hg */*/.hg */*/*/.hg) \
-    )))))
+    $(if $(and $(HG), $(wildcard $(TOPDIR)/.hg)), \
+      $(strip $(sort $(dir $(filter-out $(SRC_ROOT)/build/%, $(wildcard \
+      $(addprefix $(SRC_ROOT)/, .hg */.hg */*/.hg */*/*/.hg)))))) \
+      , \
+      $(if $(wildcard $(STORED_SOURCE_REVISION)), \
+        $(strip $(foreach r, $(call ReadFile, $(STORED_SOURCE_REVISION)), \
+          $(wildcard $(TOPDIR)/$(firstword $(subst :,$(SPACE),$r))/) \
+        )) \
+      , \
+        $(error No mercurial or .src-rev available, cannot list repositories) \
+      ) \
+    )
 
 # Locate all hg repositories included in the forest, as relative paths
 FindAllReposRel = \