2573N/A.. CDDL HEADER START
2525N/A
2573N/A.. The contents of this file are subject to the terms of the
2573N/A Common Development and Distribution License (the "License").
2573N/A You may not use this file except in compliance with the License.
2573N/A
2573N/A.. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2573N/A or http://www.opensolaris.org/os/licensing.
2573N/A See the License for the specific language governing permissions
2573N/A and limitations under the License.
2573N/A
2573N/A.. When distributing Covered Code, include this CDDL HEADER in each
2573N/A file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2573N/A If applicable, add the following below this CDDL HEADER, with the
2573N/A fields enclosed by brackets "[]" replaced with your own identifying
2573N/A information: Portions Copyright [yyyy] [name of copyright owner]
2573N/A
2573N/A.. CDDL HEADER END
2573N/A
2573N/A.. Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2573N/A
2573N/AChapter 7
2573N/A---------
2573N/A
2585N/AAllowing Variations
2573N/A...................
2525N/A
2585N/AIn this chapter we explore how variants and facets are used in
2585N/AIPS to provide different installation options to the end user.
2525N/A
2525N/AVariants
2573N/A~~~~~~~~
2525N/A
2585N/ASince Oracle Solaris supports multiple architectures, one common error
2585N/Amade with the SVR4 packaging system was the accidental installation
2585N/Aof packages for an incorrect architecture. With the introduction of
2585N/Asoftware repositories, the prospect of maintaining a separate
2585N/Arepository for each supported architecture seemed unappealing
2585N/Ato ISVs and error prone for customers. As a result, IPS supports
2585N/Ainstallation of a single package on multiple architectures.
2525N/A
2585N/AThe mechanism that implements this feature is called a
2585N/A*variant*. A variant enables the properties of the target image
2585N/Ato determine which software components are actually installed.
2525N/A
2525N/AA variant has two parts: its name, and the list of possible values.
2585N/AThe variants defined in Oracle Solaris 11 are:
2525N/A
2573N/A ======================== =================
2573N/A Name Values
2573N/A ======================== =================
2573N/A variant.arch sparc, i386
2573N/A variant.opensolaris.zone global, nonglobal
2573N/A variant.debug.* true, false
2573N/A ======================== =================
2525N/A
2585N/AVariants appear in two places in a package:
2585N/A
2585N/A * A ``set`` action names the variant and defines the values that
2585N/A apply to this package.
2585N/A
2585N/A * Any action that can only be installed for a subset of the
2585N/A variant values has a tag that specifies the name of the
2585N/A variant and the value on which it is installed.
2585N/A
2585N/AFor example, a package that delivers the symbolic link ``/var/ld/64``
2585N/Amight include::
2525N/A
2573N/A set name=variant.arch value=sparc value=i386
2573N/A dir group=bin mode=0755 owner=root path=var/ld
2573N/A dir group=bin mode=0755 owner=root path=var/ld/amd64 \
2573N/A variant.arch=i386
2573N/A dir group=bin mode=0755 owner=root path=var/ld/sparcv9 \
2573N/A variant.arch=sparc
2573N/A link path=var/ld/32 target=.
2573N/A link path=var/ld/64 target=sparcv9 variant.arch=sparc
2573N/A link path=var/ld/64 target=amd64 variant.arch=i386
2525N/A
2525N/ANote that components that are delivered on both sparc and i386 receive
2525N/Ano variant tag, but those delivered to one architecture or the other
2525N/Areceive the appropriate tag. It is perfectly reasonable for actions
2525N/Ato contain multiple tags for different variant names; there might be
2525N/Adebug and nondebug binaries for both sparc and i386.
2525N/A
2585N/AIn Oracle Solaris, kernel components are commonly elided from packages
2525N/Ainstalled in zones, as they serve no useful purpose. Thus, they are
2585N/Amarked with the ``opensolaris.zone`` variant set to ``global`` so that they
2525N/Aare not installed in non-global zones. This is typically done in the
2585N/Amanifest during publication with a |pkgmogrify| rule. Thus the packages
2525N/Afrom the i386 and sparc builds are already marked for zones. We then
2585N/Ause the |pkgmerge| command to take the packages from the sparc and i386
2585N/Abuilds and merge them together. This is far more reliable and faster
2585N/Athan attempting to construct such packages manually.
2525N/A
3363N/AThe ``variant.debug.*`` portion of the variant namespace is explicitly
3363N/Apredefined to have a default version of ``false``; thus, developers
3363N/Acan provide debug versions of their components, tagged with the
3363N/Aappropriate variant, and users can select that variant if problems
3363N/Aarise. Remember that variants are set per image, so selecting a
3363N/Asuitable name that is unique at the appropriate resolution for that
3363N/Apiece of software is important.
2585N/A
3363N/AIn addition, any variant tags not described here are assumed to
3363N/Ahave a default value of ``false`` in the image. This allows
3363N/Athe definition of custom variants not explicitly set in the
3363N/Aimage for use in packages.
2525N/A
2585N/ANote that variant tags are applied to any actions that differ between
2585N/Aarchitectures during merging; this includes dependencies, ``set`` actions,
2585N/Aetc. Packages that are marked as not supporting one of the variant values
2585N/Aof the current image are not considered for installation.
2525N/A
2585N/AThe |pkgmerge| man page provides several examples of merging packages. Note
2585N/Athat it will merge across multiple different variants at the same time if
2585N/Aneeded.
2525N/A
2525N/AFacets
2573N/A~~~~~~
2525N/A
2525N/AOften, package developers have optional portions of their software
2585N/Athat actually belong with the main body, but some people might not
2585N/Awant to install. Some examples are localization files for different
2525N/Alocales, man pages and other documentation, header files needed
2585N/Aonly by developers or DTrace users.
2525N/A
2525N/ATraditionally, such optional content has been placed in separate
2585N/Apackages with an arbitrarily selected naming convention (such as
2585N/Aappending ``-dev`` or ``-devel`` to the package name) enabling administrators
2525N/Ato select the optional content.
2525N/A
2525N/AThis has led to various problems, such as adding a new locale
2525N/Afor all the software on a system being a rather irritating task,
2525N/Aas the admin has to discover all the necessary packages by examining
2525N/Athe lists of available packages.
2525N/A
2585N/AIPS has implemented a mechanism similar to variants called *facets*
2525N/Ato deal with this problem. Like variants, facets have a name and
2585N/Aa value. The value is either set to ``true`` or ``false`` in the
2585N/Aimage. The default value is ``true``. The facet namespace is hierarchal,
2585N/Awith matching rules such that the longest match wins.
2585N/A
2585N/AFor example, the default value for all facets is ``true``; the |pkg| client
2585N/Aimplicitly sets ``facet.*`` to ``true``.
2585N/ADocumentation in Oracle Solaris packages is tagged with the type of
2585N/Adocumentation. For example, man pages are tagged with
2585N/A``facet.doc.man=true`` in the package manifests.
2525N/A
2585N/AThe following commands include man pages but exclude all other documentation
2585N/Afrom being installed in this image::
2525N/A
2585N/A # pkg change-facet facet.doc.*=false
2585N/A # pkg change-facet facet.doc.man=true
2525N/A
2585N/ASimilarly, the following commands install only the German localization in this
2585N/Aimage::
2525N/A
2585N/A # pkg change-facet facet.locale.*=false
2585N/A # pkg change-facet facet.locale.de=true
2525N/A
2585N/AIf an action contains multiple facet tags, the action is installed if the value
2585N/Aof any of the facet tags is ``true``.
2585N/A
2585N/AThe ``pkg facet`` command is useful in determining which facets are
2525N/Aset in the image.
2525N/A
2585N/AThe package developer can use |pkgmogrify| to quickly tag his
2525N/Aman pages, localizations, etc. using regular expressions to
2585N/Amatch the different types of files. This is described in detail
2573N/Ain *Chapter 8*.
2573N/A
2585N/AFacets can also be used to manage dependencies, essentially turning
2585N/Adependencies on and off, depending on whether the facet is set. See
2585N/A*Chapter 6* for a discussion of ``facet.version-lock.*``.
2573N/A
2525N/A
2585N/AOracle Solaris facets that might be of use for software developers include:
2525N/A
2573N/A
2573N/A======================== ================== ==================
2585N/Afacet.devel facet.locale.es_BO facet.locale.lt_LT
2585N/Afacet.doc facet.locale.es_CL facet.locale.lv
2585N/Afacet.doc.man facet.locale.es_CO facet.locale.lv_LV
2585N/Afacet.doc.pdf facet.locale.es_CR facet.locale.mk
2585N/Afacet.doc.info facet.locale.es_DO facet.locale.mk_MK
2585N/Afacet.doc.html facet.locale.es_EC facet.locale.ml
2585N/Afacet.locale facet.locale.es_ES facet.locale.ml_IN
2585N/Afacet.locale.af facet.locale.es_GT facet.locale.mr
2585N/Afacet.locale.af_ZA facet.locale.es_HN facet.locale.mr_IN
2585N/Afacet.locale.ar facet.locale.es_MX facet.locale.ms
2585N/Afacet.locale.ar_AE facet.locale.es_NI facet.locale.ms_MY
2585N/Afacet.locale.ar_BH facet.locale.es_PA facet.locale.mt
2585N/Afacet.locale.ar_DZ facet.locale.es_PE facet.locale.mt_MT
2585N/Afacet.locale.ar_EG facet.locale.es_PR facet.locale.nb
2585N/Afacet.locale.ar_IQ facet.locale.es_PY facet.locale.nb_NO
2585N/Afacet.locale.ar_JO facet.locale.es_SV facet.locale.nl
2585N/Afacet.locale.ar_KW facet.locale.es_US facet.locale.nl_BE
2585N/Afacet.locale.ar_LY facet.locale.es_UY facet.locale.nl_NL
2585N/Afacet.locale.ar_MA facet.locale.es_VE facet.locale.nn
2585N/Afacet.locale.ar_OM facet.locale.et facet.locale.nn_NO
2585N/Afacet.locale.ar_QA facet.locale.et_EE facet.locale.no
2585N/Afacet.locale.ar_SA facet.locale.eu facet.locale.or
2585N/Afacet.locale.ar_TN facet.locale.fi facet.locale.or_IN
2585N/Afacet.locale.ar_YE facet.locale.fi_FI facet.locale.pa
2585N/Afacet.locale.as facet.locale.fr facet.locale.pa_IN
2585N/Afacet.locale.as_IN facet.locale.fr_BE facet.locale.pl
2585N/Afacet.locale.az facet.locale.fr_CA facet.locale.pl_PL
2585N/Afacet.locale.az_AZ facet.locale.fr_CH facet.locale.pt
2585N/Afacet.locale.be facet.locale.fr_FR facet.locale.pt_BR
2585N/Afacet.locale.be_BY facet.locale.fr_LU facet.locale.pt_PT
2585N/Afacet.locale.bg facet.locale.ga facet.locale.ro
2585N/Afacet.locale.bg_BG facet.locale.gl facet.locale.ro_RO
2585N/Afacet.locale.bn facet.locale.gu facet.locale.ru
2585N/Afacet.locale.bn_IN facet.locale.gu_IN facet.locale.ru_RU
2585N/Afacet.locale.bs facet.locale.he facet.locale.ru_UA
2585N/Afacet.locale.bs_BA facet.locale.he_IL facet.locale.rw
2585N/Afacet.locale.ca facet.locale.hi facet.locale.sa
2585N/Afacet.locale.ca_ES facet.locale.hi_IN facet.locale.sa_IN
2585N/Afacet.locale.cs facet.locale.hr facet.locale.sk
2585N/Afacet.locale.cs_CZ facet.locale.hr_HR facet.locale.sk_SK
2585N/Afacet.locale.da facet.locale.hu facet.locale.sl
2585N/Afacet.locale.da_DK facet.locale.hu_HU facet.locale.sl_SI
2585N/Afacet.locale.de facet.locale.hy facet.locale.sq
2585N/Afacet.locale.de_AT facet.locale.hy_AM facet.locale.sq_AL
2585N/Afacet.locale.de_BE facet.locale.id facet.locale.sr
2585N/Afacet.locale.de_CH facet.locale.id_ID facet.locale.sr_ME
2585N/Afacet.locale.de_DE facet.locale.is facet.locale.sr_RS
2585N/Afacet.locale.de_LI facet.locale.is_IS facet.locale.sv
2585N/Afacet.locale.de_LU facet.locale.it facet.locale.sv_SE
2585N/Afacet.locale.el facet.locale.it_CH facet.locale.ta
2585N/Afacet.locale.el_CY facet.locale.it_IT facet.locale.ta_IN
2585N/Afacet.locale.el_GR facet.locale.ja facet.locale.te
2585N/Afacet.locale.en facet.locale.ja_JP facet.locale.te_IN
2585N/Afacet.locale.en_AU facet.locale.ka facet.locale.th
2585N/Afacet.locale.en_BW facet.locale.ka_GE facet.locale.th_TH
2585N/Afacet.locale.en_CA facet.locale.kk facet.locale.tr
2585N/Afacet.locale.en_GB facet.locale.kk_KZ facet.locale.tr_TR
2585N/Afacet.locale.en_HK facet.locale.kn facet.locale.uk
2585N/Afacet.locale.en_IE facet.locale.kn_IN facet.locale.uk_UA
2585N/Afacet.locale.en_IN facet.locale.ko facet.locale.vi
2585N/Afacet.locale.en_MT facet.locale.ko_KR facet.locale.vi_VN
2585N/Afacet.locale.en_NZ facet.locale.ks facet.locale.zh
2585N/Afacet.locale.en_PH facet.locale.ks_IN facet.locale.zh_CN
2585N/Afacet.locale.en_SG facet.locale.ku facet.locale.zh_HK
2585N/Afacet.locale.en_US facet.locale.ku_TR facet.locale.zh_HK
2585N/Afacet.locale.en_ZW facet.locale.ky facet.locale.zh_SG
2585N/Afacet.locale.eo facet.locale.ky_KG facet.locale.zh_TW
2585N/Afacet.locale.es_AR facet.locale.lg
2573N/A======================== ================== ==================
2525N/A
2525N/A
2525N/A