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

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Tue Feb 10 20:33:15 CET 2009


Revision: 3054
          http://gar.svn.sourceforge.net/gar/?rev=3054&view=rev
Author:   dmichelsen
Date:     2009-02-10 19:33:15 +0000 (Tue, 10 Feb 2009)

Log Message:
-----------
mGAR v2: Add dynamic adm scripts

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

Modified: csw/mgar/gar/v2/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2/gar.lib.mk	2009-02-10 16:19:01 UTC (rev 3053)
+++ csw/mgar/gar/v2/gar.lib.mk	2009-02-10 19:33:15 UTC (rev 3054)
@@ -19,8 +19,18 @@
 
 #################### FETCH RULES ####################
 
+DYNSCRIPTS = $(foreach PKG,$(SPKG_SPECS),\
+		$(foreach SCR,$(ADMSCRIPTS),\
+			$(if $(value $(PKG)_$(SCR)), $(PKG).$(SCR))))
+
+NOCHECKSUM += $(DYNSCRIPTS)
+
 URLS = $(subst ://,//,$(foreach SITE,$(FILE_SITES) $(MASTER_SITES),$(addprefix $(SITE),$(DISTFILES))) $(foreach SITE,$(FILE_SITES) $(PATCH_SITES) $(MASTER_SITES),$(addprefix $(SITE),$(PATCHFILES))))
 
+# if the caller has defined _postinstall, etc targets for a package, add
+# these 'dynamic script' targets to our fetch list
+URLS += $(foreach DYN,$(DYNSCRIPTS),dynscr//$(DYN))
+
 # Download the file if and only if it doesn't have a preexisting
 # checksum file.  Loop through available URLs and stop when you
 # get one that doesn't return an error code.
@@ -39,6 +49,15 @@
 		fi; \
 	fi
 
+# create ADMSCRIPTS 'on the fly' from variables defined by the caller
+# This version is private and should only be called from the non-private
+# version directly below
+_dynscr//%:
+	$($(subst .,_,$*))
+
+dynscr//%:
+	$(MAKE) -n _$@ > $(PARTIALDIR)/$*
+
 # download an http URL (colons omitted)
 http//%: 
 	@wget $(WGET_OPTS) -T 10 -c -P $(PARTIALDIR) http://$*

Modified: csw/mgar/gar/v2/gar.mk
===================================================================
--- csw/mgar/gar/v2/gar.mk	2009-02-10 16:19:01 UTC (rev 3053)
+++ csw/mgar/gar/v2/gar.mk	2009-02-10 19:33:15 UTC (rev 3054)
@@ -34,7 +34,7 @@
 
 DISTNAME ?= $(GARNAME)-$(GARVERSION)
 
-ALLFILES ?= $(DISTFILES) $(PATCHFILES)
+ALLFILES ?= $(DISTFILES) $(PATCHFILES) $(DYNSCRIPTS)
 
 ifeq ($(MAKE_INSTALL_DIRS),1)
 INSTALL_DIRS = $(addprefix $(DESTDIR),$(prefix) $(exec_prefix) $(bindir) $(sbindir) $(libexecdir) $(datadir) $(sysconfdir) $(sharedstatedir) $(localstatedir) $(libdir) $(infodir) $(lispdir) $(includedir) $(mandir) $(foreach NUM,1 2 3 4 5 6 7 8, $(mandir)/man$(NUM)) $(sourcedir))
@@ -230,9 +230,11 @@
 # NOTE: DOES NOT RUN pre-everything!
 fetch-list:
 	@echo "Distribution files: "
-	@for i in $(DISTFILES); do echo "	$$i"; done
+	@$(foreach F,$(DISTFILES),echo "	$F";)
 	@echo "Patch files: "
-	@for i in $(PATCHFILES); do echo "	$$i"; done
+	@$(foreach P,$(PATCHFILES),echo "	$P";)
+	@echo "Dynamically generated scripts: "
+	@$(foreach D,$(DYNSCRIPTS),echo "	$D";)
 
 # fetch			- Retrieves $(DISTFILES) (and $(PATCHFILES) if defined)
 #				  into $(DOWNLOADDIR) as necessary.
@@ -284,8 +286,8 @@
 garchive: checksum $(GARCHIVE_TARGETS) ;
 
 # extract		- Unpacks $(DISTFILES) into $(EXTRACTDIR) (patches are "zcatted" into the patch program)
-EXTRACT_TARGETS-global ?= $(foreach SPEC,$(SPKG_SPECS),$(filter $(SPEC).%,$(DISTFILES)))
-EXTRACT_TARGETS = $(addprefix extract-archive-,$(filter-out $(NOEXTRACT),$(if $(EXTRACT_TARGETS-$(MODULATION)),$(EXTRACT_TARGETS-$(MODULATION)),$(DISTFILES))))
+EXTRACT_TARGETS-global ?= $(foreach SPEC,$(SPKG_SPECS),$(filter $(SPEC).%,$(DISTFILES) $(DYNSCRIPTS)))
+EXTRACT_TARGETS = $(addprefix extract-archive-,$(filter-out $(NOEXTRACT),$(if $(EXTRACT_TARGETS-$(MODULATION)),$(EXTRACT_TARGETS-$(MODULATION)),$(DISTFILES) $(DYNSCRIPTS))))
 
 # We call an additional extract-modulated without resetting any variables so
 # a complete unpacked set goes to the global dir for packaging (like gspec)


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