make-rules/ips.mk
changeset 46 d4d60962c33f
parent 38 cd00ea74156e
child 48 1bb7f3eccdd6
--- a/make-rules/ips.mk	Tue Nov 09 10:32:06 2010 -0600
+++ b/make-rules/ips.mk	Tue Nov 09 10:33:32 2010 -0600
@@ -109,76 +109,46 @@
 
 sample-manifest:	$(GENERATED).p5m
 
-#
-# Rules for generating a manifest automatically.  Generated manifests will
-# contain the following:
-#    copyright - template copyright information
-#    metadata  - mogrified template metadata
-#    actions   - "normalized" actions for the paths to be installed.
-#    depends   - automatically generated dependencies
-#
-
-# transform template metadata into slightly more package specific metadata.
-$(GENERATED).metadata:	$(METADATA_TEMPLATE) install
-	$(PKGMOGRIFY) -D IPS_PKG_NAME=$(IPS_PKG_NAME) $< | \
-		sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >[email protected]
-
-# generate actions from the proto dir
-$(GENERATED).generate:	install
-	$(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) >[email protected]
-
-# convert actions to a "normalized" format
-$(GENERATED).actions:	$(GENERATED).generate
-	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(GENERATE_TRANSFORMS) | \
+$(GENERATED).p5m:	install
+	$(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \
+	$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \
 		sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >[email protected]
 
-# generate dependencies
-$(MANIFEST_BASE)-%.fdeps:	$(MANIFEST_BASE)-%.generate
-	$(PKGDEPEND) generate $(PKG_OPTIONS) $< $(PROTO_DIR) >[email protected]
-
-$(MANIFEST_BASE)-%.depend:	$(MANIFEST_BASE)-%.fdeps
-	$(PKGDEPEND) resolve -o $< | sed -e '1d' >[email protected]
+# copy the canonical manifest(s) to the build tree
+$(MANIFEST_BASE)-%.generate:	%.p5m canonical-manifests
+	cat $(METADATA_TEMPLATE) $< >[email protected]
 
-# generate a complete manifest from the pieces
-$(GENERATED).p5m:	$(GENERATED).metadata $(GENERATED).actions \
-			$(GENERATED).depend
-	cat $(COPYRIGHT_TEMPLATE) $(GENERATED).metadata $(GENERATED).actions \
-	    $(GENERATED).depend >[email protected]
+# mogrify the manifest
+$(MANIFEST_BASE)-%.mogrified:	%.p5m $(METADATA_TEMPLATE) canonical-manifests
+	$(PKGMOGRIFY) $(PKG_OPTIONS) $(METADATA_TEMPLATE) $< \
+		$(PUBLISH_TRANSFORMS) | \
+		sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >[email protected]
 
-#
-# Rules to generate a combined manifest from the canonical manifest(s) checked
-# into the workspace.
-#
+# generate dependencies, drop variant.arch in set and depend actions because
+# "pkgdepend resolve" fails when it's present.
+$(MANIFEST_BASE)-%.depend:	$(MANIFEST_BASE)-%.mogrified
+	$(PKGDEPEND) generate -m $< $(PROTO_DIR) | \
+	$(PKGMOGRIFY) /dev/fd/0 $(WS_TOP)/transforms/drop-variant.arch >[email protected]
 
-# Combine the canonical manifest(s) for this component and "normalize" them
-# for comparison.
-$(COMBINED).p5m:	canonical-manifests
-	cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
- 		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >[email protected]
-
-$(MANIFEST_BASE)-%.compare:		$(MANIFEST_BASE)-%.p5m canonical-manifests
-	$(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >[email protected]
-
-manifest-compare:	$(COMBINED).compare $(GENERATED).compare
-	@echo "Manifest comparison"
-	@pkgdiff $(GENERATED).compare $(COMBINED).compare
+# resolve dependencies, prepend the mogrified manifest, less the unresolved
+# dependencies to the result.
+$(MANIFEST_BASE)-%.resolved:	$(MANIFEST_BASE)-%.depend
+	$(PKGMOGRIFY) $(@:%.resolved=%.mogrified) \
+		$(WS_TOP)/transforms/drop-unresolved-dependencies | \
+		sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >[email protected]
+	$(PKGDEPEND) resolve -o $< | sed -e '1d' >>[email protected]
 
+# lint the manifest before we publish with it.
 $(MANIFEST_BASE)-%.linted:	$(MANIFEST_BASE)-%.resolved
-	@echo "Linting $(@:$(MANIFEST_BASE)-%.linted=%) manifest"
-	$(PKGLINT) $<
-	$(TOUCH) [email protected]
-
-manifest-checks:	manifest-compare $(PUBLISHED:%.published=%.linted)
+	@echo "VALIDATING MANIFEST CONTENT: $<"
+	PYTHONPATH=$(WS_TOP)/tools/python $(PKGLINT) -f $(WS_TOP)/tools/pkglintrc $<
+	$(PKGFMT) <$< >[email protected]
 
-# mogrify the canonical manifest(s) 
-#
-$(MANIFEST_BASE)-%.resolved:	%.p5m canonical-manifests
-	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >[email protected]
-
-$(MANIFEST_BASE)-%.published:	$(MANIFEST_BASE)-%.resolved manifest-checks
+# published
+$(MANIFEST_BASE)-%.published:	$(MANIFEST_BASE)-%.linted
 	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
 		-d $(PROTO_DIR) -d . $<
-	$(TOUCH) [email protected]
+	$(PKGFMT) <$< >[email protected]
 
 $(COMPONENT_SRC)/.published:	$(PUBLISHED)
 	$(TOUCH) [email protected]