[csw-devel] SF.net SVN: gar:[11251] csw/mgar/pkg/cswclassutils/trunk/Makefile
bdwalton at users.sourceforge.net
bdwalton at users.sourceforge.net
Mon Oct 11 17:49:44 CEST 2010
Revision: 11251
http://gar.svn.sourceforge.net/gar/?rev=11251&view=rev
Author: bdwalton
Date: 2010-10-11 15:49:44 +0000 (Mon, 11 Oct 2010)
Log Message:
-----------
cswclassutils: automatically generate subpackages for each CAS in filedir; top package depends on all of them.
Modified Paths:
--------------
csw/mgar/pkg/cswclassutils/trunk/Makefile
Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile 2010-10-11 15:45:32 UTC (rev 11250)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile 2010-10-11 15:49:44 UTC (rev 11251)
@@ -4,6 +4,51 @@
GARVERSION = 1.42
CATEGORIES = utils
+# a few handy functions for defining 'generic' things dynmaically
+set = $(eval $1 := $2)
+
+define cas_shortname
+$(subst csw,,$(1))
+endef
+
+define csw_pkgname
+CSWcas-$(call cas_shortname,$(1))
+endef
+
+define var_name
+$(1)_$(call csw_pkgname,$(2))
+endef
+
+define spkg_desc_val
+Class action script $(call cas_shortname,$(1))
+endef
+
+define pkgfiles_val
+/usr/sadm/install/scripts/.*$(1)
+endef
+
+define catname_val
+cas_$(call cas_shortname,$(1))
+endef
+
+define spkg_desc
+$(call set,$(call var_name,SPKG_DESC,$(1)),$(call spkg_desc_val,$(1)))
+endef
+
+define pkg_files
+$(call set,$(call var_name,PKGFILES,$(1)),$(call pkgfiles_val,$(1)))
+endef
+
+define catname
+$(call set,$(call var_name,CATALOGNAME,$(1)),$(call catname_val,$(1)))
+endef
+
+define surplus_dep
+$(eval CHECKPKG_OVERRIDES_CSWcswclassutils += surplus-dependency|$(call csw_pkgname,$(1)))
+endef
+
+# end of handy functions
+
DESCRIPTION = CSW class action utilities
MASTER_SITES =
@@ -18,10 +63,21 @@
SPKG_SOURCEURL = http://www.opencsw.org
+FILEDIR = files
+
CASFILES = $(wildcard $(FILEDIR)/CSW$(GARNAME).[ir].*)
CASLIST = $(foreach F,$(CASFILES), $(subst $(FILEDIR)/CSW$(GARNAME).,,$(F)))
+CSWCLASSES = $(subst .,,$(sort $(suffix $(CASLIST))))
+
DISTFILES += $(subst $(FILEDIR)/,,$(CASFILES))
+CASPACKAGES += $(foreach C,$(CSWCLASSES),CSWcas-$(call cas_shortname,$(C)))
+
+PACKAGES = CSWcswclassutils
+PACKAGES += $(CASPACKAGES)
+
+RUNTIME_DEP_PKGS_CSWcswclassutils = $(CASPACKAGES)
+
PROTOTYPE_MODIFIERS = cas
PROTOTYPE_FILES_cas = /usr/sadm/install/scripts/.*
PROTOTYPE_USER_cas = bin
@@ -31,6 +87,18 @@
CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-wrong-location
CHECKPKG_OVERRIDES_CSWcswclassutils += init-file-wrong-location|/opt/csw/etc/init.d/csw.smf.sample
+# set a unique description for each CAS
+$(foreach C,$(CSWCLASSES),$(call spkg_desc,$(C)))
+SPKG_DESC_CSWcswclassutils = $(DESCRIPTION)
+
+# and add the base set of files belonging to the CAS
+$(foreach C,$(CSWCLASSES),$(call pkg_files,$(C)))
+# and the catalog names
+$(foreach C,$(CSWCLASSES),$(call catname,$(C)))
+
+# tell checkpkg to ignore the surplus dep on the subpkgs
+$(foreach C,$(CSWCLASSES),$(call surplus_dep,$(C)))
+
include gar/category.mk
install-custom:
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