1 #
   2 # This file and its contents are supplied under the terms of the
   3 # Common Development and Distribution License ("CDDL"), version 1.0.
   4 # You may only use this file in accordance with the terms of version
   5 # 1.0 of the CDDL.
   6 #
   7 # A full copy of the text of the CDDL should have accompanied this
   8 # source.  A copy of the CDDL is also available via the Internet at
   9 # http://www.illumos.org/license/CDDL.
  10 #
  11 
  12 #
  13 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  14 # Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  15 #
  16 
  17 PKGDEP_FLAGS= -R $(PKGDEP_RESOLVE_IMAGE)
  18 PKGRES_FLAGS= -m
  19 
  20 install: $(ALL_TARGETS) repository-metadata
  21 
  22 repository-metadata: publish_pkgs
  23         $(PKGDEBUG)for r in $(REPOS); do \
  24                 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
  25         done
  26 
  27 #
  28 # Since we create zero-length processed manifests for a graceful abort
  29 # from pkgmogrify, we need to detect that here and make no effort to
  30 # publish the package.
  31 #
  32 # For all other packages, we publish them regardless of status.  We
  33 # derive the target repository as a component of the metadata-derived
  34 # symlink for each package.
  35 #
  36 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
  37 
  38 #
  39 # Before publishing, we want to pull the license files from $CODEMGR_WS
  40 # into the proto area.  This allows us to NOT pass $SRC (or
  41 # $CODEMGR_WS) as a basedir for publication.
  42 #
  43 $(PUB_PKGS): stage-licenses
  44 
  45 #
  46 # Initialize the empty on-disk repositories
  47 #
  48 $(REPOS:%=$(PKGDEST)/repo.%):
  49         @print "Initializing $(@F)"
  50         $(PKGDEBUG)$(INS.dir)
  51         $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
  52                 --set-property publisher.prefix=$(PKGPUBLISHER)
  53 
  54 #
  55 # The full chain implies that there should be a .dep.res suffix rule,
  56 # but dependency generation is done on a set of manifests, rather than
  57 # on a per-manifest basis.  Instead, see the gendeps rule above.
  58 #
  59 
  60 $(PDIR)/%.pub: $(PDIR)/%.res
  61         $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
  62         r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
  63         if [ -s $(<) ]; then \
  64                 print "Publishing $(@F:%.pub=%) to $$r repository"; \
  65                 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
  66                     -d $(PKGROOT) -d $(TOOLSROOT) \
  67                     -d license_files -d $(PKGROOT)/licenses \
  68                     --fmri-in-manifest --no-index --no-catalog $(<) \
  69                     > /dev/null; \
  70         fi; \
  71         $(TOUCH) $(@);
  72 
  73 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)