make-rules/ips.mk
changeset 38 cd00ea74156e
parent 32 280a7444e782
child 46 d4d60962c33f
equal deleted inserted replaced
37:988ea0021850 38:cd00ea74156e
    37 
    37 
    38 PKGDEPEND =	/usr/bin/pkgdepend
    38 PKGDEPEND =	/usr/bin/pkgdepend
    39 PKGFMT =	/usr/bin/pkgfmt
    39 PKGFMT =	/usr/bin/pkgfmt
    40 PKGMOGRIFY =	/usr/bin/pkgmogrify
    40 PKGMOGRIFY =	/usr/bin/pkgmogrify
    41 PKGSEND =	/usr/bin/pkgsend
    41 PKGSEND =	/usr/bin/pkgsend
       
    42 PKGLINT =	/usr/bin/pkglint
    42 
    43 
    43 # Package headers should all pretty much follow the same format
    44 # Package headers should all pretty much follow the same format
    44 METADATA_TEMPLATE =		$(WS_TOP)/transforms/manifest-metadata-template
    45 METADATA_TEMPLATE =		$(WS_TOP)/transforms/manifest-metadata-template
    45 COPYRIGHT_TEMPLATE =		$(WS_TOP)/transforms/copyright-template
    46 COPYRIGHT_TEMPLATE =		$(WS_TOP)/transforms/copyright-template
    46 
    47 
    93 
    94 
    94 COPYRIGHT_FILE =	$(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
    95 COPYRIGHT_FILE =	$(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
    95 ifeq	($(IPS_PKG_NAME),)
    96 ifeq	($(IPS_PKG_NAME),)
    96 	IPS_PKG_NAME =	$(COMPONENT_NAME)
    97 	IPS_PKG_NAME =	$(COMPONENT_NAME)
    97 endif
    98 endif
       
    99 ifeq	($(COMPONENT_SUMMARY),)
       
   100 	COMPONENT_SUMMARY =	$(COMPONENT_DESCRIPTION)
       
   101 endif
    98 IPS_COMPONENT_VERSION =	$(COMPONENT_VERSION)
   102 IPS_COMPONENT_VERSION =	$(COMPONENT_VERSION)
    99 
   103 
   100 .DEFAULT:		publish
   104 .DEFAULT:		publish
   101 
   105 
   102 .SECONDARY:		$(GENERATED).fdeps
   106 .SECONDARY:
   103 
   107 
   104 publish:		install $(COMPONENT_SRC)/.published
   108 publish:		install $(COMPONENT_SRC)/.published
   105 
   109 
   106 sample-manifest:	$(GENERATED).p5m
   110 sample-manifest:	$(GENERATED).p5m
   107 
   111 
   150 # for comparison.
   154 # for comparison.
   151 $(COMBINED).p5m:	canonical-manifests
   155 $(COMBINED).p5m:	canonical-manifests
   152 	cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   156 	cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   153  		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >$@
   157  		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >$@
   154 
   158 
   155 $(MANIFEST_BASE)-%.compare:		$(MANIFEST_BASE)-%.p5m
   159 $(MANIFEST_BASE)-%.compare:		$(MANIFEST_BASE)-%.p5m canonical-manifests
   156 	$(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >$@
   160 	$(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >$@
   157 
   161 
   158 manifest-compare:	$(COMBINED).compare $(GENERATED).compare
   162 manifest-compare:	$(COMBINED).compare $(GENERATED).compare
   159 	@echo "Manifest comparison"
   163 	@echo "Manifest comparison"
   160 	@pkgdiff $(GENERATED).compare $(COMBINED).compare
   164 	@pkgdiff $(GENERATED).compare $(COMBINED).compare
   161 
   165 
       
   166 $(MANIFEST_BASE)-%.linted:	$(MANIFEST_BASE)-%.resolved
       
   167 	@echo "Linting $(@:$(MANIFEST_BASE)-%.linted=%) manifest"
       
   168 	$(PKGLINT) $<
       
   169 	$(TOUCH) $@
       
   170 
       
   171 manifest-checks:	manifest-compare $(PUBLISHED:%.published=%.linted)
       
   172 
   162 # mogrify the canonical manifest(s) 
   173 # mogrify the canonical manifest(s) 
   163 #
   174 #
   164 $(MANIFEST_BASE)-%.resolved:	%.p5m manifest-compare
   175 $(MANIFEST_BASE)-%.resolved:	%.p5m canonical-manifests
   165 	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >$@
   176 	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >$@
   166 
   177 
   167 $(MANIFEST_BASE)-%.published:	$(MANIFEST_BASE)-%.resolved
   178 $(MANIFEST_BASE)-%.published:	$(MANIFEST_BASE)-%.resolved manifest-checks
   168 	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
   179 	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
   169 		-d $(PROTO_DIR) -d . $<
   180 		-d $(PROTO_DIR) -d . $<
   170 	$(TOUCH) $@
   181 	$(TOUCH) $@
   171 
   182 
   172 $(COMPONENT_SRC)/.published:	manifest-compare $(PUBLISHED)
   183 $(COMPONENT_SRC)/.published:	$(PUBLISHED)
   173 	$(TOUCH) $@
   184 	$(TOUCH) $@
   174 
   185 
   175 print-package-names:	canonical-manifests
   186 print-package-names:	canonical-manifests
   176 	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
   187 	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
   177 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   188 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   180 print-package-paths:	canonical-manifests
   191 print-package-paths:	canonical-manifests
   181 	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
   192 	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
   182 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   193 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
   183  		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
   194  		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
   184 
   195 
   185 canonical-manifests:	$(CANONICAL_MANIFESTS)
   196 install-packages:	publish
       
   197 	@if [ $(IS_GLOBAL_ZONE) = 0 -o x$(ROOT) != x ]; then \
       
   198 	    cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
       
   199 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
       
   200  		sed -e '/^$$/d' -e '/^#.*$$/d' -e 's;/;;' | sort -u | \
       
   201 		(cd $(PROTO_DIR) ; pfexec /bin/cpio -dump $(ROOT)) ; \
       
   202 	else ; \
       
   203 	    echo "unsafe to install package(s) automatically" ; \
       
   204         fi
       
   205 
       
   206 $(MOGRIFIED):	install
       
   207 
       
   208 canonical-manifests:	$(CANONICAL_MANIFESTS) Makefile $(PATCHES)
   186 ifeq	($(strip $(CANONICAL_MANIFESTS)),)
   209 ifeq	($(strip $(CANONICAL_MANIFESTS)),)
   187 	# If there were no canonical manifests in the workspace, nothing will
   210 	# If there were no canonical manifests in the workspace, nothing will
   188 	# be published and we should fail.  A sample manifest can be generated
   211 	# be published and we should fail.  A sample manifest can be generated
   189 	# with
   212 	# with
   190 	#   $ gmake sample-manifest
   213 	#   $ gmake sample-manifest
   198 required-pkgs.mk:	Makefile
   221 required-pkgs.mk:	Makefile
   199 	@echo "generating $@ from Makefile REQUIRED_* data"
   222 	@echo "generating $@ from Makefile REQUIRED_* data"
   200 	@pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \
   223 	@pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \
   201 		| sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@
   224 		| sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@
   202 
   225 
       
   226 pre-prep:	required-pkgs.mk
       
   227 
       
   228 
   203 CLEAN_PATHS +=	required-pkgs.mk
   229 CLEAN_PATHS +=	required-pkgs.mk