[csw-devel] SF.net SVN: gar:[6675] csw/mgar/gar/v2-pbuild

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Fri Oct 2 23:35:11 CEST 2009


Revision: 6675
          http://gar.svn.sourceforge.net/gar/?rev=6675&view=rev
Author:   dmichelsen
Date:     2009-10-02 21:35:11 +0000 (Fri, 02 Oct 2009)

Log Message:
-----------
mGAR v2-pbuild: Major upgrade for PLATFORM support

Modified Paths:
--------------
    csw/mgar/gar/v2-pbuild/gar.conf.mk
    csw/mgar/gar/v2-pbuild/gar.lib.mk
    csw/mgar/gar/v2-pbuild/gar.mk
    csw/mgar/gar/v2-pbuild/gar.pkg.mk

Modified: csw/mgar/gar/v2-pbuild/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.conf.mk	2009-10-02 21:05:18 UTC (rev 6674)
+++ csw/mgar/gar/v2-pbuild/gar.conf.mk	2009-10-02 21:35:11 UTC (rev 6675)
@@ -11,16 +11,29 @@
 
 # Pick up user information
 -include $(HOME)/.garrc
+-include /etc/opt/csw/garrc
 -include /opt/csw/etc/garrc
 
-MODULATION ?= global-$(GARCH)
+THISHOST := $(shell uname -n)
+
+# On these platforms packages are built.
+# They will include binaries for all ISAs that are specified for the platform.
+PACKAGING_PLATFORMS ?= solaris8-sparc solaris8-i386
+
+# This is the platform we are currently building. It is either set when
+# invoked from "gmake platforms" or when you build a package on a host
+# that is suitable for the platform.
+# If there are no platform hosts defined the feature is disabled.
+PLATFORM ?= $(firstword $(foreach P,$(PACKAGING_PLATFORMS),$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),$P)))
+
+MODULATION ?= global
 FILEDIR ?= files
-DOWNLOADDIR ?= download
-PARTIALDIR ?= $(DOWNLOADDIR)/partial
-WORKROOTDIR ?= work
+WORKROOTDIR ?= $(if $(PLATFORM),work/$(PLATFORM),work)
 WORKDIR ?= $(WORKROOTDIR)/build-$(MODULATION)
 WORKDIR_FIRSTMOD ?= $(WORKROOTDIR)/build-$(firstword $(MODULATIONS))
-COOKIEROOTDIR ?= cookies
+DOWNLOADDIR ?= $(WORKROOTDIR)/download
+PARTIALDIR ?= $(DOWNLOADDIR)/partial
+COOKIEROOTDIR ?= $(WORKROOTDIR)/cookies
 COOKIEDIR ?= $(COOKIEROOTDIR)/$(MODULATION)
 EXTRACTDIR ?= $(WORKDIR)
 WORKSRC ?= $(WORKDIR)/$(DISTNAME)
@@ -135,7 +148,7 @@
 DESTROOT ?= $(HOME)
 
 # This is the directory from where the package is build from
-PKGROOT ?= $(abspath $(WORKROOTDIR)/pkgroot-$(GARCH))
+PKGROOT ?= $(abspath $(WORKROOTDIR)/pkgroot)
 
 # Each ISA has a separate installation directory inside the
 # working directory for that package. The files are copied
@@ -274,8 +287,6 @@
 # ISALIST_$(GARCOMPILER) contains all ISAs which are compilable with the selected compiler
 $(foreach C,$(GARCOMPILERS),$(eval ISALIST_$(C) ?= $(foreach I,$(ISALIST),$(if $(filter-out ERROR,$(ARCHFLAGS_$C_$I)),$I))))
 
-THISHOST := $(shell uname -n)
-
 # BUILDHOST_isa-$ISA is the name of the host where the compilation should take place
 # It defaults to the corresponding BUILD_(sparc|i386)-(32|64)
 # An empty string means "stay on the current host"

Modified: csw/mgar/gar/v2-pbuild/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.lib.mk	2009-10-02 21:05:18 UTC (rev 6674)
+++ csw/mgar/gar/v2-pbuild/gar.lib.mk	2009-10-02 21:35:11 UTC (rev 6675)
@@ -139,10 +139,12 @@
 
 # check a given file's checksum against $(CHECKSUM_FILE) and
 # error out if it mentions the file without an "OK".
+# The removal of the download prefix is for legacy checksums. For newstyle
+# checksums without path this is not necessary.
 checksum-%: $(CHECKSUM_FILE) 
 	@echo " ==> Running checksum on $*"
-	@if gegrep -- '/$*$$' $(CHECKSUM_FILE); then \
-		if LC_ALL="C" LANG="C" gmd5sum -c $(CHECKSUM_FILE) 2>&1 | \
+	@if gegrep -- '[ /]$*$$' $(CHECKSUM_FILE); then \
+		if cat $(CHECKSUM_FILE) | sed -e 's!download/!!' | (cd $(DOWNLOADDIR); LC_ALL="C" LANG="C" gmd5sum -c 2>&1) | \
 			ggrep -- '$*' | ggrep -v ':[ ]\+OK'; then \
 			echo '(!!!) $* failed checksum test!' 1>&2; \
 			false; \

Modified: csw/mgar/gar/v2-pbuild/gar.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.mk	2009-10-02 21:05:18 UTC (rev 6674)
+++ csw/mgar/gar/v2-pbuild/gar.mk	2009-10-02 21:35:11 UTC (rev 6675)
@@ -165,8 +165,8 @@
 	echo THISHOST="$$(THISHOST)"
 	echo "Building modulation on host '$$(BUILDHOST)'"
 	$$(if $$(and $$(BUILDHOST),$$(filter-out $$(THISHOST),$$(BUILDHOST))),\
-		ssh $$(BUILDHOST) "gmake -C $$(CURDIR) MODULATION=$(2) $(3) merge-modulated",\
-		gmake MODULATION=$(2) $(3) merge-modulated\
+		ssh $$(BUILDHOST) "PATH=$$(PATH) $(MAKE) -C $$(CURDIR) $(if $(PLATFORM),PLATFORM=$(PLATFORM)) MODULATION=$(2) $(3) merge-modulated",\
+		gmake $(if $(PLATFORM),PLATFORM=$(PLATFORM)) MODULATION=$(2) $(3) merge-modulated\
 	)
 	@# The next line has intentionally been left blank to explicitly terminate this make rule
 
@@ -294,12 +294,15 @@
 checksum: fetch $(COOKIEDIR) pre-checksum $(CHECKSUM_TARGETS) post-checksum
 	@$(DONADA)
 
+checksum-global:
+	@$(MAKE) -s ISA=global checksum
+	@$(MAKECOOKIE)
+
 # The next rule handles the dependency from the modulated context to
 # the contextless checksumming. The rule is called when the cookie
 # to the global checksum is requested. If the global checksum has not run,
 # then run it. Otherwise it is silently accepted.
-checksum-modulated: $(COOKIEDIR)
-	@$(MAKE) -s ISA=global checksum
+checksum-modulated: $(if $(test ! -e $(COOKIEDIR)/build-global/checksum),checksum-global)
 	@$(DONADA)
 
 # returns true if checksum has completed successfully, false
@@ -308,11 +311,11 @@
 	@$(foreach COOKIEFILE,$(CHECKSUM_TARGETS), test -e $(COOKIEDIR)/$(COOKIEFILE) ;)
 
 # makesum		- Generate distinfo (only do this for your own ports!).
-MAKESUM_TARGETS =  $(addprefix $(DOWNLOADDIR)/,$(filter-out $(_NOCHECKSUM) $(NOCHECKSUM),$(ALLFILES))) 
+MAKESUM_TARGETS =  $(filter-out $(_NOCHECKSUM) $(NOCHECKSUM),$(ALLFILES))
 
-makesum: fetch $(MAKESUM_TARGETS)
+makesum: fetch $(addprefix $(DOWNLOADDIR)/,$(MAKESUM_TARGETS))
 	@if test "x$(MAKESUM_TARGETS)" != "x "; then \
-		gmd5sum $(MAKESUM_TARGETS) > $(CHECKSUM_FILE) ; \
+		(cd $(DOWNLOADDIR) && gmd5sum $(MAKESUM_TARGETS)) > $(CHECKSUM_FILE) ; \
 		echo "Checksums made for $(MAKESUM_TARGETS)" ; \
 		cat $(CHECKSUM_FILE) ; \
 	fi
@@ -618,6 +621,25 @@
 
 _PAX_ARGS = $(_INC_EXT_RULE) $(EXTRA_PAX_ARGS)
 
+define killprocandparent
+cpids() { \
+  P=$1 \
+  PPIDS=$P \
+  PP=`ps -eo pid,ppid | awk "BEGIN { ORS=\" \" } \\$2 == $P { print \\$1 }\"` \
+  while [ -n "$PP" ]; do \
+    PQ=$PP \
+    PP= \
+    for q in $PQ; do \
+      PPIDS="$PPIDS $q" \
+      PP=$PP\ `ps -eo pid,ppid | awk "BEGIN { ORS=\" \" } \\$2 == $q { print \\$1 }\"` \
+    done \
+  done \
+ \
+  echo $PPIDS \
+}
+endef
+
+
 # The basic merge merges the compiles for all ISAs on the current architecture
 merge: checksum pre-merge merge-do merge-license $(if $(NOSOURCEPACKAGE),,merge-src) post-merge
 	@$(DONADA)
@@ -626,7 +648,7 @@
 
 merge-sequential: $(foreach M,$(MODULATIONS),merge-$M)
 
-merge-parallel: _PIDFILE=$(WORKROOTDIR)/build-global-$(GARCH)/multitail.pid
+merge-parallel: _PIDFILE=$(WORKROOTDIR)/build-global/multitail.pid
 merge-parallel: merge-watch
 	$(_DBG_MERGE)trap "kill -9 `cat $(_PIDFILE) $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.pid) 2>/dev/null`;stty sane" INT;\
 		$(foreach M,$(MODULATIONS),($(MAKE) merge-$M >$(WORKROOTDIR)/build-$M/build.log 2>&1; echo $$? >$(WORKROOTDIR)/build-$M/build.ret) & echo $$! >$(WORKROOTDIR)/build-$M/build.pid; ) wait
@@ -643,7 +665,7 @@
 merge-watch: _USEMULTITAIL=$(shell test -x $(MULTITAIL) && test -x $(TTY) && $(TTY) >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo yes; fi)
 merge-watch:
 	$(_DBG_MERGE)$(if $(_USEMULTITAIL),\
-		$(MULTITAIL) --retry-all $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.log) -j & echo $$! > $(WORKROOTDIR)/build-global-$(GARCH)/multitail.pid,\
+		$(MULTITAIL) --retry-all $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.log) -j & echo $$! > $(WORKROOTDIR)/build-global/multitail.pid,\
 		echo "Building all ISAs in parallel. Please see the individual logfiles for details:";$(foreach M,$(MODULATIONS),echo "- $(WORKROOTDIR)/build-$M/build.log";)\
 	)
 
@@ -709,7 +731,7 @@
 # cookie, but that would be lame and unportable).
 
 clean: $(addprefix clean-,$(MODULATIONS))
-	@rm -rf $(WORKROOTDIR) $(COOKIEROOTDIR) $(DOWNLOADDIR)
+	rm -rf $(WORKROOTDIR) $(COOKIEROOTDIR) $(DOWNLOADDIR)
 
 clean-modulated:
 	$(call _pmod,Cleaning )
@@ -742,7 +764,7 @@
 
 spotless: imageclean
 	@echo " ==> Removing $(DESTDIR)"
-	@-rm -rf $(DESTDIR)
+	@-rm -rf work
 
 # Print package dependencies
 PKGDEP_LIST = $(filter-out $(BUILDDEPS),$(DEPEND_LIST))

Modified: csw/mgar/gar/v2-pbuild/gar.pkg.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.pkg.mk	2009-10-02 21:05:18 UTC (rev 6674)
+++ csw/mgar/gar/v2-pbuild/gar.pkg.mk	2009-10-02 21:35:11 UTC (rev 6675)
@@ -533,12 +533,11 @@
 # On a normal packaging workflow this is not used.
 prototypes: extract merge $(SPKG_DESTDIRS) pre-package $(foreach SPEC,$(_PKG_SPECS),$(WORKDIR)/$(SPEC).prototype-$(GARCH))
 
-# On these platforms packages are built.
-# They will include binaries for all ISAs that are specified for the platform.
-PACKAGING_PLATFORMS ?= solaris8-sparc solaris8-i386
-
+# Verify that the host on we are currently packaging is one of the platform
+# hosts. If there are no platform hosts defined the test is skipped.
 validateplatform:
-	$(if $(filter $(THISHOST),$(foreach P,$(PACKAGING_PLATFORMS),$(PACKAGING_HOST_$P))),,\
+	$(if $(strip $(foreach P,$(PACKAGING_PLATFORMS),$(PACKAGING_HOST_$P))),\
+	  $(if $(filter $(THISHOST),$(foreach P,$(PACKAGING_PLATFORMS),$(PACKAGING_HOST_$P))),,\
 		$(warning ***)\
 		$(warning *** You are building this package on a non-requested platform host '$(THISHOST)'. The follow platforms were requested:)\
 		$(foreach P,$(PACKAGING_PLATFORMS),\
@@ -546,13 +545,14 @@
 		)\
 		$(warning *** You can execute '$(MAKE) platforms' to automatically build on all necessary platforms.)\
 		$(warning ***)\
-	)
+	))
+	@$(MAKECOOKIE)
 
 # We depend on extract as the additional package files (like .gspec) must be
 # unpacked to global/ for packaging. E. g. 'merge' depends only on the specific
 # modulations and does not fill global/.
-package: validateplatform extract merge $(SPKG_DESTDIRS) pre-package $(PACKAGE_TARGETS) post-package
-	$(DONADA)
+package: validateplatform checksum merge $(SPKG_DESTDIRS) pre-package $(PACKAGE_TARGETS) post-package
+	@$(DONADA)
 
 # The dynamic pkginfo is only generated for dynamic gspec-files
 package-%: $(WORKDIR)/%.gspec $(if $(filter %.gspec,$(DISTFILES)),,$(WORKDIR)/%.pkginfo) $(WORKDIR)/%.prototype-$(GARCH) $(WORKDIR)/%.depend
@@ -606,13 +606,26 @@
 	$(foreach P,$(PACKAGING_PLATFORMS),\
 		$(if $(PACKAGING_HOST_$P),\
 			$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\
-				$(MAKE) package;,\
-				ssh $(PACKAGING_HOST_$P) "$(MAKE) -C $(CURDIR) package";\
+				$(MAKE) PLATFORM=$P package;,\
+				ssh $(PACKAGING_HOST_$P) "$(MAKE) -C $(CURDIR) PLATFORM=$P package";\
 			),\
 			$(error *** No host has been defined for platform $P)\
 		)\
 	)
 
+# Print relecant informations about the platform
+platformenv:
+	@$(foreach P,$(PACKAGING_PLATFORMS),\
+		echo "* Platform '$P'";\
+		$(if $(PACKAGING_HOST_$P),\
+			$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\
+				echo "  - Package built on this host";,\
+				echo "  - Package built on host '$(PACKAGING_HOST_$P)'";\
+			),\
+			echo "Package can not be built for this platform as there is no host defined";\
+		)\
+	)
+
 # dependb - update the dependency database
 #
 dependb:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list