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

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Sun Nov 18 13:22:29 CET 2012


Revision: 19709
          http://gar.svn.sourceforge.net/gar/?rev=19709&view=rev
Author:   dmichelsen
Date:     2012-11-18 12:22:28 +0000 (Sun, 18 Nov 2012)
Log Message:
-----------
mGAR v2: Allow multiple license files

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

Added Paths:
-----------
    csw/mgar/gar/v2/bin/catlicense

Added: csw/mgar/gar/v2/bin/catlicense
===================================================================
--- csw/mgar/gar/v2/bin/catlicense	                        (rev 0)
+++ csw/mgar/gar/v2/bin/catlicense	2012-11-18 12:22:28 UTC (rev 19709)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ -f "$1" ]; then
+  cat "$1"
+  shift
+fi
+
+while [ $# -ge 1 ]; do
+  if [ -f "$1" ]; then
+    echo "\n---\n"
+    cat "$1"
+  fi
+  shift
+done


Property changes on: csw/mgar/gar/v2/bin/catlicense
___________________________________________________________________
Added: svn:executable
   + *

Modified: csw/mgar/gar/v2/gar.pkg.mk
===================================================================
--- csw/mgar/gar/v2/gar.pkg.mk	2012-11-16 15:47:11 UTC (rev 19708)
+++ csw/mgar/gar/v2/gar.pkg.mk	2012-11-18 12:22:28 UTC (rev 19709)
@@ -488,7 +488,7 @@
 
 # Pulled in from pkglib/csw_prototype.gspec
 $(PROTOTYPE): $(WORKDIR) merge
-	$(_DBG)cswproto -c $(GARDIR)/etc/commondirs-$(GARCH) -r $(PKGROOT) $(PKGROOT)=$(if $(ALLOW_RELOCATE),,'/') >$@ 
+	$(_DBG)cswproto $(if $(INCLUDE_COMMONDIRS),,-c $(GARDIR)/etc/commondirs-$(GARCH)) -r $(PKGROOT) $(PKGROOT)=$(if $(ALLOW_RELOCATE),,'/') >$@ 
 
 # pathfilter lives in bin/pathfilter and takes care of including/excluding paths from
 # a prototype (see "perldoc bin/pathfilter"). We employ it here to:
@@ -708,8 +708,9 @@
 	$(if $(ALLOW_RELOCATE),echo "BASEDIR=$(RELOCATE_PREFIX)" >>$@)
 
 
-# findlicensefile - Find an existing file for a given license name
-#
+# findlicensefile - Find an existing file for a given relative license file name
+# Arguments:
+#  $(1)  A filename to be used for licenses
 define findlicensefile
 $(strip 
   $(if $(1),$(firstword $(realpath 
@@ -719,33 +720,31 @@
 )
 endef
 
-define licensefile
-$(strip 
-  $(or 
-    $(call findlicensefile,$(or $(LICENSE_$(1)),$(LICENSE_FULL_$(1)))),
-    $(call findlicensefile,$(or $(LICENSE),$(LICENSE_FULL))),
-  ) 
+# licensefile - Find an existing license file for a given package name
+define licensefiles
+$(foreach L,$(or $(LICENSE_$(1)),$(LICENSE_FULL_$(1)),$(LICENSE),$(LICENSE_FULL)),\
+  $(or $(call findlicensefile,$L),$(if $(_LICENSE_IS_DEFAULT),,$(error Cannot find license file $L for package $(1))))\
 )
 endef
 
 merge-license-%: $(WORKDIR)
 	$(_DBG)$(if $(and $(LICENSE_$*),$(LICENSE_FULL_$*)),$(error Both LICENSE_$* and LICENSE_FULL_$* have been specified where only one is allowed)) \
 		$(if $(and $(filter $*,$(_PKG_SPECS)),$(or $(LICENSE),$(LICENSE_FULL),$(LICENSE_$*),$(LICENSE_FULL_$*))), \
-		LICENSEFILE=$(or $(call licensefile,$*),$(if $(_LICENSE_IS_DEFAULT),,$(error Cannot find license file for package $*))); \
+		LICENSEFILES="$(call licensefiles,$*)"; \
 		LICENSEDIR=$(call licensedir,$*); \
-		$(if $(LICENSE_TEXT_$*)$(LICENSE_TEXT),\
+		$(if $(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT)),\
 		  umask 022 && mkdir -p $(PKGROOT)$$LICENSEDIR && \
 		  echo "$(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT))" > $(PKGROOT)$$LICENSEDIR/license;\
 		  echo "$(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT))" > $(WORKDIR)/$*.copyright;\
 		,\
-		  if [ -n "$$LICENSEFILE" ]; then \
+		  if [ -n "$$LICENSEFILES" ]; then \
 		    $(if $(or $(LICENSE_FULL),$(LICENSE_FULL_$*)), \
-		      if [ -f "$$LICENSEFILE" ]; then cp $$LICENSEFILE $(WORKDIR)/$*.copyright; fi;, \
+		      catlicense $LICENSEFILES > $(WORKDIR)/$*.copyright;, \
 		      echo "Please see $$LICENSEDIR/license for license information." > $(WORKDIR)/$*.copyright; \
 		    ) \
 		    umask 022 && mkdir -p $(PKGROOT)$$LICENSEDIR && \
 		    rm -f $(PKGROOT)$$LICENSEDIR/license && \
-		    cp $$LICENSEFILE $(PKGROOT)$$LICENSEDIR/license; \
+		    catlicense $$LICENSEFILES > $(PKGROOT)$$LICENSEDIR/license; \
 		  fi \
 		) \
 	)

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