Print this page
pkg: If the adjunct proto is a package image, use it for dependency resolution
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/pkg/Makefile
+++ new/usr/src/pkg/Makefile
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 24 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
25 25 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
26 26 #
27 27
28 28 include $(SRC)/Makefile.master
29 29 include $(SRC)/Makefile.buildnum
30 30
31 31 #
32 32 # Make sure we're getting a consistent execution environment for the
33 33 # embedded scripts.
34 34 #
35 35 SHELL= /usr/bin/ksh93
36 36
37 37 #
38 38 # To suppress package dependency generation on any system, regardless
39 39 # of how it was installed, set SUPPRESSPKGDEP=true in the build
40 40 # environment.
41 41 #
42 42 SUPPRESSPKGDEP= false
43 43
44 44 #
45 45 # Comment this line out or set "PKGDEBUG=" in your build environment
46 46 # to get more verbose output from the make processes in usr/src/pkg
47 47 #
48 48 PKGDEBUG= @
49 49
50 50 #
51 51 # Cross platform packaging notes
52 52 #
53 53 # By default, we package the proto area from the same architecture as
54 54 # the packaging build. In other words, if you're running nightly or
55 55 # bldenv on an x86 platform, it will take objects from the x86 proto
56 56 # area and use them to create x86 repositories.
57 57 #
58 58 # If you want to create repositories for an architecture that's
59 59 # different from $(uname -p), you do so by setting PKGMACH in your
60 60 # build environment.
61 61 #
62 62 # For this to work correctly, the following must all happen:
63 63 #
64 64 # 1. You need the desired proto area, which you can get either by
65 65 # doing a gatekeeper-style build with the -U option to
66 66 # nightly(1), or by using rsync. If you don't do this, you will
67 67 # get packaging failures building all packages, because pkgsend
68 68 # is unable to find the required binaries.
69 69 # 2. You need the desired tools proto area, which you can get in the
70 70 # same ways as the normal proto area. If you don't do this, you
71 71 # will get packaging failures building onbld, because pkgsend is
72 72 # unable to find the tools binaries.
73 73 # 3. The remainder of this Makefile should never refer directly to
74 74 # $(MACH). Instead, $(PKGMACH) should be used whenever an
75 75 # architecture-specific path or token is needed. If this is done
76 76 # incorrectly, then packaging will fail, and you will see the
77 77 # value of $(uname -p) instead of the value of $(PKGMACH) in the
78 78 # commands that fail.
79 79 # 4. Each time a rule in this Makefile invokes $(MAKE), it should
80 80 # pass PKGMACH=$(PKGMACH) explicitly on the command line. If
81 81 # this is done incorrectly, then packaging will fail, and you
82 82 # will see the value of $(uname -p) instead of the value of
83 83 # $(PKGMACH) in the commands that fail.
84 84 #
85 85 # Refer also to the convenience targets defined later in this
86 86 # Makefile.
87 87 #
88 88 PKGMACH= $(MACH)
89 89
90 90 #
91 91 # ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
92 92 # bldenv. These macros translate them into terms of $PKGMACH, instead
93 93 # of $ARCH.
94 94 #
95 95 PKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
96 96 PKGROOT= $(PKGROOT.cmd:sh)
97 97 TOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
98 98 TOOLSROOT= $(TOOLSROOT.cmd:sh)
99 99 PKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
100 100 PKGDEST= $(PKGDEST.cmd:sh)
101 101
102 102 EXCEPTIONS= packaging
103 103
104 104 PKGMOGRIFY= pkgmogrify
105 105
106 106 #
107 107 # Always build the redistributable repository, but only build the
108 108 # nonredistributable bits if we have access to closed source.
109 109 #
110 110 # Some objects that result from the closed build are still
111 111 # redistributable, and should be packaged as part of an open-only
112 112 # build. Access to those objects is provided via the closed-bins
113 113 # tarball. See usr/src/tools/scripts/bindrop.sh for details.
114 114 #
115 115 REPOS= redist
116 116
117 117 #
118 118 # The packages directory will contain the processed manifests as
119 119 # direct build targets and subdirectories for package metadata extracted
120 120 # incidentally during manifest processing.
121 121 #
122 122 # Nothing underneath $(PDIR) should ever be managed by SCM.
123 123 #
124 124 PDIR= packages.$(PKGMACH)
125 125
126 126 #
127 127 # The tools proto must be specified for dependency generation.
128 128 # Publication from the tools proto area is managed in the
129 129 # publication rule.
130 130 #
131 131 $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT)
132 132
133 133 PKGPUBLISHER= $(PKGPUBLISHER_REDIST)
134 134
135 135 #
136 136 # To get these defaults, manifests should simply refer to $(PKGVERS).
137 137 #
138 138 PKGVERS_COMPONENT= 0.$(RELEASE)
139 139 PKGVERS_BUILTON= $(RELEASE)
140 140 PKGVERS_BRANCH= 0.$(ONNV_BUILDNUM)
141 141 PKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
142 142
143 143 #
144 144 # The ARCH32 and ARCH64 macros are used in the manifests to express
145 145 # architecture-specific subdirectories in the installation paths
146 146 # for isaexec'd commands.
147 147 #
148 148 # We can't simply use $(MACH32) and $(MACH64) here, because they're
149 149 # only defined for the build architecture. To do cross-platform
150 150 # packaging, we need both values.
151 151 #
152 152 i386_ARCH32= i86
153 153 sparc_ARCH32= sparcv7
154 154 i386_ARCH64= amd64
155 155 sparc_ARCH64= sparcv9
156 156
157 157 #
158 158 # macros and transforms needed by pkgmogrify
159 159 #
160 160 # If you append to this list using target-specific assignments (:=),
161 161 # be very careful that the targets are of the form $(PDIR)/pkgname. If
162 162 # you use a higher level target, or a package list, you'll trigger a
163 163 # complete reprocessing of all manifests because they'll fail command
164 164 # dependency checking.
165 165 #
166 166 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
167 167 extract_metadata
168 168 PM_INC= transforms manifests
169 169
170 170 PKGMOG_DEFINES= \
171 171 i386_ONLY=$(POUND_SIGN) \
172 172 sparc_ONLY=$(POUND_SIGN) \
173 173 $(PKGMACH)_ONLY= \
174 174 ARCH=$(PKGMACH) \
175 175 ARCH32=$($(PKGMACH)_ARCH32) \
176 176 ARCH64=$($(PKGMACH)_ARCH64) \
177 177 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
178 178 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
179 179 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
180 180 PKGVERS=$(PKGVERS) \
181 181 PERL_ARCH=$(PERL_ARCH) \
182 182 PERL_VERSION=$(PERL_VERSION) \
183 183 PERL_PKGVERS=$(PERL_PKGVERS)
184 184
185 185 PKGDEP_TOKENS_i386= \
186 186 'PLATFORM=i86hvm' \
187 187 'PLATFORM=i86pc' \
188 188 'PLATFORM=i86xpv' \
189 189 'ISALIST=amd64' \
190 190 'ISALIST=i386'
191 191 PKGDEP_TOKENS_sparc= \
192 192 'PLATFORM=sun4u' \
193 193 'PLATFORM=sun4v' \
194 194 'ISALIST=sparcv9' \
195 195 'ISALIST=sparc'
196 196 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
197 197
198 198 #
199 199 # The package lists are generated with $(PKGDEP_TYPE) as their
200 200 # dependency types, so that they can be included by either an
201 201 # incorporation or a group package.
202 202 #
203 203 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
204 204 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
205 205
206 206 PKGDEP_INCORP= \
207 207 depend fmri=consolidation/osnet/osnet-incorporation type=require
208 208
209 209 #
210 210 # All packaging build products should go into $(PDIR), so they don't
211 211 # need to be included separately in CLOBBERFILES.
212 212 #
213 213 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) install-$(PKGMACH).out \
214 214 license-list
215 215
216 216 #
217 217 # By default, PKGS will list all manifests. To build and/or publish a
218 218 # subset of packages, override this on the command line or in the
219 219 # build environment and then reference (implicitly or explicitly) the all
220 220 # or install targets. Using ls -1 (that's a one) or print or echo to
221 221 # get the list of manifests is a little hackish, but avoids having a
222 222 # 900+ line file to explicitly list them all.
223 223 #
224 224 # We want some manifests to optionally built based on environment
225 225 # options, so those are excluded and optionally added back in.
226 226 # We also want a relatively easy way to add files to the list of
227 227 # manifests given special treatment. Add any other special ones
228 228 # to the SPECIAL_MANIFESTS vaiable. It can contain wildcards in
229 229 # regexp form, i.e. SUNW.* as one useful example.
230 230 #
231 231 SPECIAL_MANIFESTS = print-lp-ipp-ipp-listener.mf
232 232 LIST_MANIFESTS_CMD = (cd manifests ; /usr/bin/ls -1 *.mf |\
233 233 $(SED) $(SPECIAL_MANIFESTS:%=-e '/^%$$/d') )
234 234 MANIFESTS = $(LIST_MANIFESTS_CMD:sh)
235 235
236 236 # Conditionally add back lp-ipp
237 237 $(ENABLE_IPP_PRINTING) MANIFESTS += print-lp-ipp-ipp-listener.mf
238 238
239 239 PKGS= $(MANIFESTS:%.mf=%)
240 240 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
241 241 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
242 242
↓ open down ↓ |
242 lines elided |
↑ open up ↑ |
243 243 #
244 244 # Track the synthetic manifests separately so we can properly express
245 245 # build rules and dependencies. The synthetic and real packages use
246 246 # different sets of transforms and macros for pkgmogrify.
247 247 #
248 248 SYNTH_PKGS= osnet-incorporation osnet-redist
249 249 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
250 250 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
251 251
252 252 #
253 -# Root of pkg image to use for dependency resolution
254 -# Normally / on the machine used to build the binaries
253 +# Root of pkg image to use for dependency resolution Normally / on the machine
254 +# used to build the binaries, or the ADJUNCT_PROTO
255 255 #
256 -PKGDEP_RESOLVE_IMAGE = /
256 +PKG_ADJUNCT.cmd= if [[ -d $${ADJUNCT_PROTO}/var/pkg ]]; then \
257 + echo $$ADJUNCT_PROTO; \
258 + else \
259 + echo /; \
260 + fi
261 +
262 +PKGDEP_RESOLVE_IMAGE = $(PKG_ADJUNCT.cmd:sh)
257 263
258 264 #
259 265 # For each package, we determine the target repository based on
260 266 # manifest-embedded metadata. Because we make that determination on
261 267 # the fly, the publication target cannot be expressed as a
262 268 # subdirectory inside the unknown-by-the-makefile target repository.
263 269 #
264 270 # In order to limit the target set to real files in known locations,
265 271 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless
266 272 # of content or target repository.
267 273 #
268 274 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
269 275
270 276 #
271 277 # Any given repository- and status-specific package list may be empty,
272 278 # but we can only determine that dynamically, so we always generate all
273 279 # lists for each repository we're building.
274 280 #
275 281 # The meanings of each package status are as follows:
276 282 #
277 283 # PKGSTAT meaning
278 284 # ---------- ----------------------------------------------------
279 285 # noincorp Do not include in incorporation or group package
280 286 # obsolete Include in incorporation, but not group package
281 287 # renamed Include in incorporation, but not group package
282 288 # current Include in incorporation and group package
283 289 #
284 290 # Since the semantics of the "noincorp" package status dictate that
285 291 # such packages are not included in the incorporation or group packages,
286 292 # there is no need to build noincorp package lists.
287 293 #
288 294 PKGLISTS= \
289 295 $(REPOS:%=$(PDIR)/packages.%.current) \
290 296 $(REPOS:%=$(PDIR)/packages.%.renamed) \
291 297 $(REPOS:%=$(PDIR)/packages.%.obsolete)
292 298
293 299 .KEEP_STATE:
294 300
295 301 .PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
296 302 $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
297 303
298 304 #
299 305 # For a single manifest, the dependency chain looks like this:
300 306 #
301 307 # raw manifest (mypkg.mf)
302 308 # |
303 309 # | use pkgmogrify to process raw manifest
304 310 # |
305 311 # processed manifest (mypkg.mog)
306 312 # |
307 313 # * | use pkgdepend generate to generate dependencies
308 314 # |
309 315 # manifest with TBD dependencies (mypkg.dep)
310 316 # |
311 317 # % | use pkgdepend resolve to resolve dependencies
312 318 # |
313 319 # manifest with dependencies resolved (mypkg.res)
314 320 # |
315 321 # | use pkgsend to publish the package
316 322 # |
317 323 # placeholder to indicate successful publication (mypkg.pub)
318 324 #
319 325 # * This may be suppressed via SUPPRESSPKGDEP. The resulting
320 326 # packages will install correctly, but care must be taken to
321 327 # install all dependencies, because pkg will not have the input
322 328 # it needs to determine this automatically.
323 329 #
324 330 # % This is included in this diagram to make the picture complete, but
325 331 # this is a point of synchronization in the build process.
326 332 # Dependency resolution is actually done once on the entire set of
327 333 # manifests, not on a per-package basis.
328 334 #
329 335 # The full dependency chain for generating everything that needs to be
330 336 # published, without actually publishing it, looks like this:
331 337 #
332 338 # processed synthetic packages
333 339 # | |
334 340 # package lists synthetic package manifests
335 341 # |
336 342 # processed real packages
337 343 # | |
338 344 # package dir real package manifests
339 345 #
340 346 # Here, each item is a set of real or synthetic packages. For this
341 347 # portion of the build, no reference is made to the proto area. It is
342 348 # therefore suitable for the "all" target, as opposed to "install."
343 349 #
344 350 # Since each of these steps is expressed explicitly, "all" need only
345 351 # depend on the head of the chain.
346 352 #
347 353 # From the end of manifest processing, the publication dependency
348 354 # chain looks like this:
349 355 #
350 356 # repository metadata (catalogs and search indices)
351 357 # |
352 358 # | pkgrepo refresh
353 359 # |
354 360 # published packages
355 361 # | |
356 362 # | | pkgsend publish
357 363 # | |
358 364 # repositories resolved dependencies
359 365 # | |
360 366 # pkgsend | | pkgdepend resolve
361 367 # create-repository |
362 368 # | generated dependencies
363 369 # repo directories |
364 370 # | pkgdepend
365 371 # |
366 372 # processed manifests
367 373 #
368 374
369 375 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
370 376
371 377 all: $(ALL_TARGETS)
372 378
373 379 #
374 380 # This will build the directory to contain the processed manifests
375 381 # and the metadata symlinks.
376 382 #
377 383 $(PDIR):
378 384 @print "Creating $(@)"
379 385 $(PKGDEBUG)$(INS.dir)
380 386
381 387 #
382 388 # This rule resolves dependencies across all published manifests.
383 389 #
384 390 # We shouldn't have to ignore the error from pkgdepend, but until
385 391 # 16012 and its dependencies are resolved, pkgdepend will always exit
386 392 # with an error.
387 393 #
388 394 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
389 395 -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
390 396 print "Suppressing dependency resolution"; \
391 397 for p in $(DEP_PKGS:%.dep=%); do \
392 398 $(CP) $$p.dep $$p.res; \
393 399 done; \
394 400 else \
395 401 print "Resolving dependencies"; \
396 402 pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
397 403 -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
398 404 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
399 405 if [ "$$(print $$p.metadata.*)" = \
400 406 "$$(print $$p.metadata.noincorp.*)" ]; \
401 407 then \
402 408 print "Removing dependency versions from $$p"; \
403 409 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
404 410 -O $$p.res -I transforms \
405 411 strip_versions $$p.dep.res; \
406 412 $(RM) $$p.dep.res; \
407 413 else \
408 414 $(MV) $$p.dep.res $$p.res; \
409 415 fi; \
410 416 done; \
411 417 fi
412 418 $(PKGDEBUG)$(TOUCH) $(@)
413 419
414 420 install: $(ALL_TARGETS) repository-metadata
415 421
416 422 repository-metadata: publish_pkgs
417 423 $(PKGDEBUG)for r in $(REPOS); do \
418 424 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
419 425 done
420 426
421 427 #
422 428 # Since we create zero-length processed manifests for a graceful abort
423 429 # from pkgmogrify, we need to detect that here and make no effort to
424 430 # publish the package.
425 431 #
426 432 # For all other packages, we publish them regardless of status. We
427 433 # derive the target repository as a component of the metadata-derived
428 434 # symlink for each package.
429 435 #
430 436 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
431 437
432 438 #
433 439 # Before publishing, we want to pull the license files from $CODEMGR_WS
434 440 # into the proto area. This allows us to NOT pass $SRC (or
435 441 # $CODEMGR_WS) as a basedir for publication.
436 442 #
437 443 $(PUB_PKGS): stage-licenses
438 444
439 445 #
440 446 # Initialize the empty on-disk repositories
441 447 #
442 448 $(REPOS:%=$(PKGDEST)/repo.%):
443 449 @print "Initializing $(@F)"
444 450 $(PKGDEBUG)$(INS.dir)
445 451 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
446 452 --set-property publisher.prefix=$(PKGPUBLISHER)
447 453
448 454 #
449 455 # rule to process real manifests
450 456 #
451 457 # To allow redistributability and package status to change, we must
452 458 # remove not only the actual build target (the processed manifest), but
453 459 # also the incidental ones (the metadata-derived symlinks).
454 460 #
455 461 # If pkgmogrify exits cleanly but fails to create the specified output
456 462 # file, it means that it encountered an abort directive. That means
457 463 # that this package should not be published for this particular build
458 464 # environment. Since we can't prune such packages from $(PKGS)
459 465 # retroactively, we need to create an empty target file to keep make
460 466 # from trying to rebuild it every time. For these empty targets, we
461 467 # do not create metadata symlinks.
462 468 #
463 469 # Automatic dependency resolution to files is also done at this phase of
464 470 # processing. The skipped packages are skipped due to existing bugs
465 471 # in pkgdepend.
466 472 #
467 473 # The incorporation dependency is tricky: it needs to go into all
468 474 # current and renamed manifests (ie all incorporated packages), but we
469 475 # don't know which those are until after we run pkgmogrify. So
470 476 # instead of expressing it as a transform, we tack it on ex post facto.
471 477 #
472 478 # Implementation notes:
473 479 #
474 480 # - The first $(RM) must not match other manifests, or we'll run into
475 481 # race conditions with parallel manifest processing.
476 482 #
477 483 # - The make macros [ie $(MACRO)] are evaluated when the makefile is
478 484 # read in, and will result in a fixed, macro-expanded rule for each
479 485 # target enumerated in $(PROC_PKGS).
480 486 #
481 487 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule
482 488 # is executed. The results may only be referenced in the shell in
483 489 # which they are assigned, so from the perspective of make, all code
484 490 # that needs these variables needs to be part of the same line of
485 491 # code. Hence the use of command separators and line continuation
486 492 # characters.
487 493 #
488 494 # - The extract_metadata transforms are designed to spit out shell
489 495 # variable assignments to stdout. Those are published to the
490 496 # .vars temporary files, and then used as input to the eval
491 497 # statement. This is done in stages specifically so that pkgmogrify
492 498 # can signal failure if the manifest has a syntactic or other error.
493 499 # The eval statement should begin with the default values, and the
494 500 # output from pkgmogrify (if any) should be in the form of a
495 501 # variable assignment to override those defaults.
496 502 #
497 503 # - When this rule completes execution, it must leave an updated
498 504 # target file ($@) in place, or make will reprocess the package
499 505 # every time it encounters it as a dependency. Hence the "touch"
500 506 # statement to ensure that the target is created, even when
501 507 # pkgmogrify encounters an abort in the publish transforms.
502 508 #
503 509
504 510 .SUFFIXES: .mf .mog .dep .res .pub
505 511
506 512 $(PDIR)/%.mog: manifests/%.mf
507 513 @print "Processing manifest $(<F)"
508 514 @env PKGFMT_OUTPUT=v1 pkgfmt -c $<
509 515 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
510 516 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
511 517 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
512 518 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
513 519 $(<) $(PM_TRANSFORMS)
514 520 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
515 521 `$(CAT) -s $(@).vars`; \
516 522 if [ -f $(@) ]; then \
517 523 if [ "$$NODEPEND" != "false" ]; then \
518 524 $(TOUCH) $(@:%.mog=%.nodepend); \
519 525 fi; \
520 526 $(LN) -s $(@F) \
521 527 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
522 528 if [ \( "$$PKGSTAT" = "current" \) -o \
523 529 \( "$$PKGSTAT" = "renamed" \) ]; \
524 530 then print $(PKGDEP_INCORP) >> $(@); \
525 531 fi; \
526 532 print $$LICS > $(@:%.mog=%.lics); \
527 533 else \
528 534 $(TOUCH) $(@) $(@:%.mog=%.lics); \
529 535 fi
530 536 $(PKGDEBUG)$(RM) $(@).vars
531 537
532 538 $(PDIR)/%.dep: $(PDIR)/%.mog
533 539 @print "Generating dependencies for $(<F)"
534 540 $(PKGDEBUG)$(RM) $(@)
535 541 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
536 542 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
537 543 $(PKGROOT) > $(@); \
538 544 else \
539 545 $(CP) $(<) $(@); \
540 546 fi
541 547
542 548 #
543 549 # The full chain implies that there should be a .dep.res suffix rule,
544 550 # but dependency generation is done on a set of manifests, rather than
545 551 # on a per-manifest basis. Instead, see the gendeps rule above.
546 552 #
547 553
548 554 $(PDIR)/%.pub: $(PDIR)/%.res
549 555 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
550 556 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
551 557 if [ -s $(<) ]; then \
552 558 print "Publishing $(@F:%.pub=%) to $$r repository"; \
553 559 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
554 560 -d $(PKGROOT) -d $(TOOLSROOT) \
555 561 -d license_files -d $(PKGROOT)/licenses \
556 562 --fmri-in-manifest --no-index --no-catalog $(<) \
557 563 > /dev/null; \
558 564 fi; \
559 565 $(TOUCH) $(@);
560 566
561 567 #
562 568 # rule to build the synthetic manifests
563 569 #
564 570 # This rule necessarily has PKGDEP_TYPE that changes according to
565 571 # the specific synthetic manifest. Rather than escape command
566 572 # dependency checking for the real manifest processing, or failing to
567 573 # express the (indirect) dependency of synthetic manifests on real
568 574 # manifests, we simply split this rule out from the one above.
569 575 #
570 576 # The implementation notes from the previous rule are applicable
571 577 # here, too.
572 578 #
573 579 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
574 580 @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
575 581 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
576 582 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
577 583 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
578 584 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
579 585 $(PM_TRANSFORMS) synthetic
580 586 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
581 587 if [ -f $(@) ]; then \
582 588 $(LN) -s $(@F) \
583 589 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
584 590 else \
585 591 $(TOUCH) $(@); \
586 592 fi
587 593 $(PKGDEBUG)$(RM) $(@).vars
588 594
589 595 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
590 596 @print "Skipping dependency generation for $(@F:%.dep=%)"
591 597 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
592 598
593 599 clean:
594 600
595 601 clobber: clean
596 602 $(RM) -r $(CLOBBERFILES)
597 603
598 604 #
599 605 # This rule assumes that all links in the $PKGSTAT directories
600 606 # point to valid manifests, and will fail the make run if one
601 607 # does not contain an fmri.
602 608 #
603 609 # We do this in the BEGIN action instead of using pattern matching
604 610 # because we expect the fmri to be at or near the first line of each input
605 611 # file, and this way lets us avoid reading the rest of the file after we
606 612 # find what we need.
607 613 #
608 614 # We keep track of a failure to locate an fmri, so we can fail the
609 615 # make run, but we still attempt to process each package in the
610 616 # repo/pkgstat-specific subdir, in hopes of maybe giving some
611 617 # additional useful info.
612 618 #
613 619 # The protolist is used for bfu archive creation, which may be invoked
614 620 # interactively by the user. Both protolist and PKGLISTS targets
615 621 # depend on $(PROC_PKGS), but protolist builds them recursively.
616 622 # To avoid collisions, we insert protolist into the dependency chain
617 623 # here. This has two somewhat subtle benefits: it allows bfu archive
618 624 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
619 625 # and it ensures that a protolist file here will always correspond to the
620 626 # contents of the processed manifests, which can vary depending on build
621 627 # environment.
622 628 #
623 629 $(PKGLISTS): $(PROC_PKGS)
624 630 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \
625 631 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
626 632 print "Generating $$r $$s package list"; \
627 633 $(RM) $(@); $(TOUCH) $(@); \
628 634 $(AWK) 'BEGIN { \
629 635 if (ARGC < 2) { \
630 636 exit; \
631 637 } \
632 638 retcode = 0; \
633 639 for (i = 1; i < ARGC; i++) { \
634 640 do { \
635 641 e = getline f < ARGV[i]; \
636 642 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \
637 643 close(ARGV[i]); \
638 644 if (e == 1) { \
639 645 l = split(f, a, "="); \
640 646 print "depend fmri=" a[l], \
641 647 "type=$$(PKGDEP_TYPE)"; \
642 648 } else { \
643 649 print "no fmri in " ARGV[i] >> "/dev/stderr"; \
644 650 retcode = 2; \
645 651 } \
646 652 } \
647 653 exit retcode; \
648 654 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
649 655 -name NOSUCHFILE \)` >> $(@)
650 656
651 657 #
652 658 # rules to validate proto area against manifests, check for safe
653 659 # file permission modes, and generate a faux proto list
654 660 #
655 661 # For the check targets, the dependencies on $(PROC_PKGS) is specified
656 662 # as a subordinate make process in order to suppress output.
657 663 #
658 664 makesilent:
659 665 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
660 666 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
661 667
662 668 #
663 669 # The .lics files were created during pkgmogrification, and list the
664 670 # set of licenses to pull from $SRC for each package. Because
665 671 # licenses may be duplicated between packages, we uniquify them as
666 672 # well as aggregating them here.
667 673 #
668 674 license-list: makesilent
669 675 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
670 676 do print $$l; done ) | sort -u > $@
671 677
672 678 #
673 679 # Staging the license and description files in the proto area allows
674 680 # us to do proper unreferenced file checking of both license and
675 681 # description files without blanket exceptions, and to pull license
676 682 # content without reference to $CODEMGR_WS during publication.
677 683 #
678 684 stage-licenses: license-list FRC
679 685 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
680 686 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
681 687 `$(AWK) '{ \
682 688 print "$(PKGROOT)/licenses/" $$0; \
683 689 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
684 690 }' license-list` > /dev/null;
685 691
686 692 protocmp: makesilent
687 693 @validate_pkg -a $(PKGMACH) -v \
688 694 $(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \
689 695 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
690 696
691 697 pmodes: makesilent
692 698 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
693 699 -e $(CODEMGR_WS)/exception_lists/pmodes
694 700
695 701 check: protocmp pmodes
696 702
697 703 protolist: proto_list_$(PKGMACH)
698 704
699 705 proto_list_$(PKGMACH): $(PROC_PKGS)
700 706 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
701 707
702 708 $(PROC_PKGS): $(PDIR)
703 709
704 710 #
705 711 # This is a convenience target to allow package names to function as
706 712 # build targets. Generally, using it is only useful when iterating on
707 713 # development of a manifest.
708 714 #
709 715 # When processing a manifest, use the basename (without extension) of
710 716 # the package. When publishing, use the basename with a ".pub"
711 717 # extension.
712 718 #
713 719 # Other than during manifest development, the preferred usage is to
714 720 # avoid these targets and override PKGS on the make command line and
715 721 # use the provided all and install targets.
716 722 #
717 723 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
718 724
719 725 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
720 726
721 727 #
722 728 # This is a convenience target to resolve dependencies without publishing
723 729 # packages.
724 730 #
725 731 gendeps: $(PDIR)/gendeps
726 732
727 733 #
728 734 # These are convenience targets for cross-platform packaging. If you
729 735 # want to build any of "the normal" targets for a different
730 736 # architecture, simply use "arch/target" as your build target.
731 737 #
732 738 # Since the most common use case for this is "install," the architecture
733 739 # specific install targets have been further abbreviated to elide "/install."
734 740 #
735 741 i386/% sparc/%:
736 742 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
737 743
738 744 i386 sparc: $$(@)/install
739 745
740 746 FRC:
↓ open down ↓ |
474 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX