107 |
107 |
108 publish: install $(COMPONENT_SRC)/.published |
108 publish: install $(COMPONENT_SRC)/.published |
109 |
109 |
110 sample-manifest: $(GENERATED).p5m |
110 sample-manifest: $(GENERATED).p5m |
111 |
111 |
112 # |
112 $(GENERATED).p5m: install |
113 # Rules for generating a manifest automatically. Generated manifests will |
113 $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \ |
114 # contain the following: |
114 $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \ |
115 # copyright - template copyright information |
|
116 # metadata - mogrified template metadata |
|
117 # actions - "normalized" actions for the paths to be installed. |
|
118 # depends - automatically generated dependencies |
|
119 # |
|
120 |
|
121 # transform template metadata into slightly more package specific metadata. |
|
122 $(GENERATED).metadata: $(METADATA_TEMPLATE) install |
|
123 $(PKGMOGRIFY) -D IPS_PKG_NAME=$(IPS_PKG_NAME) $< | \ |
|
124 sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@ |
115 sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@ |
125 |
116 |
126 # generate actions from the proto dir |
117 # copy the canonical manifest(s) to the build tree |
127 $(GENERATED).generate: install |
118 $(MANIFEST_BASE)-%.generate: %.p5m canonical-manifests |
128 $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) >$@ |
119 cat $(METADATA_TEMPLATE) $< >$@ |
129 |
120 |
130 # convert actions to a "normalized" format |
121 # mogrify the manifest |
131 $(GENERATED).actions: $(GENERATED).generate |
122 $(MANIFEST_BASE)-%.mogrified: %.p5m $(METADATA_TEMPLATE) canonical-manifests |
132 $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(GENERATE_TRANSFORMS) | \ |
123 $(PKGMOGRIFY) $(PKG_OPTIONS) $(METADATA_TEMPLATE) $< \ |
133 sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@ |
124 $(PUBLISH_TRANSFORMS) | \ |
|
125 sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ |
134 |
126 |
135 # generate dependencies |
127 # generate dependencies, drop variant.arch in set and depend actions because |
136 $(MANIFEST_BASE)-%.fdeps: $(MANIFEST_BASE)-%.generate |
128 # "pkgdepend resolve" fails when it's present. |
137 $(PKGDEPEND) generate $(PKG_OPTIONS) $< $(PROTO_DIR) >$@ |
129 $(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.mogrified |
|
130 $(PKGDEPEND) generate -m $< $(PROTO_DIR) | \ |
|
131 $(PKGMOGRIFY) /dev/fd/0 $(WS_TOP)/transforms/drop-variant.arch >$@ |
138 |
132 |
139 $(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.fdeps |
133 # resolve dependencies, prepend the mogrified manifest, less the unresolved |
140 $(PKGDEPEND) resolve -o $< | sed -e '1d' >$@ |
134 # dependencies to the result. |
|
135 $(MANIFEST_BASE)-%.resolved: $(MANIFEST_BASE)-%.depend |
|
136 $(PKGMOGRIFY) $(@:%.resolved=%.mogrified) \ |
|
137 $(WS_TOP)/transforms/drop-unresolved-dependencies | \ |
|
138 sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ |
|
139 $(PKGDEPEND) resolve -o $< | sed -e '1d' >>$@ |
141 |
140 |
142 # generate a complete manifest from the pieces |
141 # lint the manifest before we publish with it. |
143 $(GENERATED).p5m: $(GENERATED).metadata $(GENERATED).actions \ |
142 $(MANIFEST_BASE)-%.linted: $(MANIFEST_BASE)-%.resolved |
144 $(GENERATED).depend |
143 @echo "VALIDATING MANIFEST CONTENT: $<" |
145 cat $(COPYRIGHT_TEMPLATE) $(GENERATED).metadata $(GENERATED).actions \ |
144 PYTHONPATH=$(WS_TOP)/tools/python $(PKGLINT) -f $(WS_TOP)/tools/pkglintrc $< |
146 $(GENERATED).depend >$@ |
145 $(PKGFMT) <$< >$@ |
147 |
146 |
148 # |
147 # published |
149 # Rules to generate a combined manifest from the canonical manifest(s) checked |
148 $(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.linted |
150 # into the workspace. |
|
151 # |
|
152 |
|
153 # Combine the canonical manifest(s) for this component and "normalize" them |
|
154 # for comparison. |
|
155 $(COMBINED).p5m: canonical-manifests |
|
156 cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \ |
|
157 sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >$@ |
|
158 |
|
159 $(MANIFEST_BASE)-%.compare: $(MANIFEST_BASE)-%.p5m canonical-manifests |
|
160 $(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >$@ |
|
161 |
|
162 manifest-compare: $(COMBINED).compare $(GENERATED).compare |
|
163 @echo "Manifest comparison" |
|
164 @pkgdiff $(GENERATED).compare $(COMBINED).compare |
|
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 |
|
173 # mogrify the canonical manifest(s) |
|
174 # |
|
175 $(MANIFEST_BASE)-%.resolved: %.p5m canonical-manifests |
|
176 $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >$@ |
|
177 |
|
178 $(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.resolved manifest-checks |
|
179 $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \ |
149 $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \ |
180 -d $(PROTO_DIR) -d . $< |
150 -d $(PROTO_DIR) -d . $< |
181 $(TOUCH) $@ |
151 $(PKGFMT) <$< >$@ |
182 |
152 |
183 $(COMPONENT_SRC)/.published: $(PUBLISHED) |
153 $(COMPONENT_SRC)/.published: $(PUBLISHED) |
184 $(TOUCH) $@ |
154 $(TOUCH) $@ |
185 |
155 |
186 print-package-names: canonical-manifests |
156 print-package-names: canonical-manifests |