xref: /onnv-gate/usr/src/pkg/README.pkg (revision 12616:17a31b0faaa4)
111838SLiane.Praza@Sun.COM#
211838SLiane.Praza@Sun.COM# CDDL HEADER START
311838SLiane.Praza@Sun.COM#
411838SLiane.Praza@Sun.COM# The contents of this file are subject to the terms of the
511838SLiane.Praza@Sun.COM# Common Development and Distribution License (the "License").
611838SLiane.Praza@Sun.COM# You may not use this file except in compliance with the License.
711838SLiane.Praza@Sun.COM#
811838SLiane.Praza@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
911838SLiane.Praza@Sun.COM# or http://www.opensolaris.org/os/licensing.
1011838SLiane.Praza@Sun.COM# See the License for the specific language governing permissions
1111838SLiane.Praza@Sun.COM# and limitations under the License.
1211838SLiane.Praza@Sun.COM#
1311838SLiane.Praza@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each
1411838SLiane.Praza@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1511838SLiane.Praza@Sun.COM# If applicable, add the following below this CDDL HEADER, with the
1611838SLiane.Praza@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying
1711838SLiane.Praza@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner]
1811838SLiane.Praza@Sun.COM#
1911838SLiane.Praza@Sun.COM# CDDL HEADER END
2011838SLiane.Praza@Sun.COM#
2111838SLiane.Praza@Sun.COM
2211838SLiane.Praza@Sun.COM#
23*12616Sdp@eng.sun.com# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2411838SLiane.Praza@Sun.COM#
2511838SLiane.Praza@Sun.COM
2611838SLiane.Praza@Sun.COMIntroduction
2711838SLiane.Praza@Sun.COM------------
2811838SLiane.Praza@Sun.COM
2911838SLiane.Praza@Sun.COMThis README describes some basics about creating, modifying, and
3011838SLiane.Praza@Sun.COMbuilding packages in ON.  All package creation in ON is done using
3111838SLiane.Praza@Sun.COMtools available to our customers.  If terminology in this document
3211838SLiane.Praza@Sun.COMis confusing, you may wish to review the pkg(5) manpage.
3311838SLiane.Praza@Sun.COM
3411838SLiane.Praza@Sun.COMPackaging Overview
3511838SLiane.Praza@Sun.COM------------------
3611838SLiane.Praza@Sun.COM
3711838SLiane.Praza@Sun.COMusr/src/pkg/ contains the definitions and rules needed to build
3811838SLiane.Praza@Sun.COMa set of IPS repositories which contain the deliverables from an
3911838SLiane.Praza@Sun.COMON build.
4011838SLiane.Praza@Sun.COM
4111838SLiane.Praza@Sun.COMThe manifests directory contains all manifests, and has one file
4211838SLiane.Praza@Sun.COMper package.  For most packaging changes you only need to add or
4311838SLiane.Praza@Sun.COMchange the packaging manifests themselves.
4411838SLiane.Praza@Sun.COM
4511838SLiane.Praza@Sun.COMThe build rules create two repositories.  These are both built
4611838SLiane.Praza@Sun.COMfor DEBUG and non-DEBUG, and are thus available at
4711838SLiane.Praza@Sun.COM    $CODEMGR_WS/packages/$MACH/nightly[-nd]/repo.(extra|redist)
4811838SLiane.Praza@Sun.COM
4911838SLiane.Praza@Sun.COM	repo.redist
5011838SLiane.Praza@Sun.COM	    Contains the bulk of ON, and is what is delivered to the
5111838SLiane.Praza@Sun.COM	    main OpenSolaris 'dev' and 'release' repositories.  All
5211838SLiane.Praza@Sun.COM	    components delivered there must be redistributable.
5311838SLiane.Praza@Sun.COM
5411838SLiane.Praza@Sun.COM	repo.extra
5511838SLiane.Praza@Sun.COM	    Is only built for Closed builds, and contains
5611838SLiane.Praza@Sun.COM	    non-redistributable (without a proper legal agreement) pieces
5711838SLiane.Praza@Sun.COM	    which may or may not be suitable for inclusion in the
5811838SLiane.Praza@Sun.COM	    pkg.sun.com/opensolaris/extra repository, including the
59*12616Sdp@eng.sun.com	    internal crypto bits necessary for working crypto in a Closed
6011838SLiane.Praza@Sun.COM	    build.  Do not distribute any of the bits in repo.extra
6111838SLiane.Praza@Sun.COM	    without prior agreement from the appropriate lawyers.
6211838SLiane.Praza@Sun.COM
6311838SLiane.Praza@Sun.COMBuilding Packages
6411838SLiane.Praza@Sun.COM-----------------
6511838SLiane.Praza@Sun.COM
6611838SLiane.Praza@Sun.COMThe -p option to nightly will build the IPS repositories.
6711838SLiane.Praza@Sun.COM
6811838SLiane.Praza@Sun.COMAlternatively, in usr/src/pkg/Makefile there are make targets for:
6911838SLiane.Praza@Sun.COM
7011838SLiane.Praza@Sun.COM	all
7111838SLiane.Praza@Sun.COM	    Process manifests into their final form with unresolved
7211838SLiane.Praza@Sun.COM	    dependencies before publication.
7311838SLiane.Praza@Sun.COM
7411838SLiane.Praza@Sun.COM	install
7511838SLiane.Praza@Sun.COM	    Publish packages.
7611838SLiane.Praza@Sun.COM
7711838SLiane.Praza@Sun.COM	gendeps
7811838SLiane.Praza@Sun.COM	    Run `pkgdepend resolve`.  See Dependencies section.
7911838SLiane.Praza@Sun.COM
8011838SLiane.Praza@Sun.COM	protocmp
8111838SLiane.Praza@Sun.COM	    Compare the proto area against package definitions for
8211838SLiane.Praza@Sun.COM	    missing or incorrect files.
8311838SLiane.Praza@Sun.COM
8411838SLiane.Praza@Sun.COM	pmodes
8511838SLiane.Praza@Sun.COM	    Check file and directory modes for best practices.
8611838SLiane.Praza@Sun.COM
8711838SLiane.Praza@Sun.COM	check
8811838SLiane.Praza@Sun.COM	    Run protocmp and pmodes.
8911838SLiane.Praza@Sun.COM
9011838SLiane.Praza@Sun.COMThe build behavior may modified by the following variables:
9111838SLiane.Praza@Sun.COM
9211838SLiane.Praza@Sun.COM	CLOSED_IS_PRESENT
9311838SLiane.Praza@Sun.COM	    If CLOSED_IS_PRESENT is set to "yes," repo.extra will be built.
9411838SLiane.Praza@Sun.COM
9511838SLiane.Praza@Sun.COM	ON_CRYPTO_BINS or CODESIGN_USER
9611838SLiane.Praza@Sun.COM	    If ON_CRYPTO_BINS or CODESIGN_USER is set in your build env,
9711838SLiane.Praza@Sun.COM	    no packages will depend on the internal crypto certificates.
98*12616Sdp@eng.sun.com
9911838SLiane.Praza@Sun.COM	    If neither is set, your bits depend on the internal crypto
10011838SLiane.Praza@Sun.COM	    certificates being available and packages will depend on
10111838SLiane.Praza@Sun.COM	    pkg:/driver/crypto/dprov, which is only available in the
10211838SLiane.Praza@Sun.COM	    on-extra repository.
10311838SLiane.Praza@Sun.COM
104*12616Sdp@eng.sun.com	    *** Important *** This means that, if you build using
105*12616Sdp@eng.sun.com	    internal crypto, but you try to do an image-update with
106*12616Sdp@eng.sun.com	    only repo.redist, you will be told that there are no
107*12616Sdp@eng.sun.com	    updates available.
108*12616Sdp@eng.sun.com
10911838SLiane.Praza@Sun.COM	SUPPRESSPKGDEP
11011838SLiane.Praza@Sun.COM	    If SUPPRESSPKGDEP is set to "true" in your environment,
11111838SLiane.Praza@Sun.COM	    package dependencies will not be generated.  This variable
11211838SLiane.Praza@Sun.COM	    should not be set in normal builds as it will mask product
11311838SLiane.Praza@Sun.COM	    bugs.
11411838SLiane.Praza@Sun.COM
11511838SLiane.Praza@Sun.COM	PKGDEBUG
11611838SLiane.Praza@Sun.COM	    If PKGDEBUG is set in your environment, $MAKE will print
11711838SLiane.Praza@Sun.COM	    detailed information about the commands it executes to
11811838SLiane.Praza@Sun.COM	    process and publish packages.
11911838SLiane.Praza@Sun.COM
12011838SLiane.Praza@Sun.COM	ONNV_BUILDNUM
12111838SLiane.Praza@Sun.COM	    If ONNV_BUILDNUM is set to an older ON build number,
12211838SLiane.Praza@Sun.COM	    your packages will be published at that version instead
12311838SLiane.Praza@Sun.COM	    of the one defined in usr/src/Makefile.buildnum, which
12411838SLiane.Praza@Sun.COM	    is managed by the gatekeepers.
12511838SLiane.Praza@Sun.COM
12611838SLiane.Praza@Sun.COMA set of intermediate build products are placed in
12711838SLiane.Praza@Sun.COMusr/src/pkg/packages.$MACH/.  These can be useful during development.
12811838SLiane.Praza@Sun.COM
12911838SLiane.Praza@Sun.COM	.mog
13011838SLiane.Praza@Sun.COM	    The resulting package manifest after running pkgmogrify(1)
13111838SLiane.Praza@Sun.COM	    on the supplied manifest.  See below for details on
13211838SLiane.Praza@Sun.COM	    pkgmogrify(1) use in ON.
13311838SLiane.Praza@Sun.COM
13411838SLiane.Praza@Sun.COM	.dep
13511838SLiane.Praza@Sun.COM	    The resulting manifest after running `pkgdepend generate`
13611838SLiane.Praza@Sun.COM	    on the .mog manifest.
13711838SLiane.Praza@Sun.COM
13811838SLiane.Praza@Sun.COM	.res
13911838SLiane.Praza@Sun.COM	    The resulting manifest after running `pkgdepend resolve`
14011838SLiane.Praza@Sun.COM	    on the .dep manifest.
14111838SLiane.Praza@Sun.COM
14211838SLiane.Praza@Sun.COMIncremental Builds
14311838SLiane.Praza@Sun.COM------------------
14411838SLiane.Praza@Sun.COM
14511838SLiane.Praza@Sun.COM   If you want to process a subset of manifests, simply set PKGS on the
14611838SLiane.Praza@Sun.COM   make command line and specify the "all" target.  If you want to process
14711838SLiane.Praza@Sun.COM   them all, simply specify the "all" target.
14811838SLiane.Praza@Sun.COM
14911838SLiane.Praza@Sun.COM   	% dmake -e PKGS="BRCMbnx BRCMbnxe" all
15011838SLiane.Praza@Sun.COM	% dmake -e all
15111838SLiane.Praza@Sun.COM
15211838SLiane.Praza@Sun.COM   If you want to publish a subset of packages, simply set PKGS on the
15311838SLiane.Praza@Sun.COM   make command line and specify the "install" target.  Overriding PKGS
15411838SLiane.Praza@Sun.COM   will cause dependency resolution to be limited to PKGS from the
15511838SLiane.Praza@Sun.COM   current build, with a fallback to packages installed on the build
15611838SLiane.Praza@Sun.COM   system.  If you want to publish them all, simply specify the
15711838SLiane.Praza@Sun.COM   "install" target.
15811838SLiane.Praza@Sun.COM
15911838SLiane.Praza@Sun.COM   	% dmake -e PKGS="BRCMbnx BRCMbnxe" install
16011838SLiane.Praza@Sun.COM	% dmake -e install
16111838SLiane.Praza@Sun.COM
16211838SLiane.Praza@Sun.COM   You can also use package names, or package names with ".pub"
16311838SLiane.Praza@Sun.COM   extensions, as build targets.  This will cause processing or
16411838SLiane.Praza@Sun.COM   publication of the specified package(s).
16511838SLiane.Praza@Sun.COM
16611838SLiane.Praza@Sun.COM   The on-disk repository will be initialized when it does not exist,
16711838SLiane.Praza@Sun.COM   or when you run nightly -p.  If you build incrementally,
16811838SLiane.Praza@Sun.COM   packages will simply be added to the existing repository.
16911838SLiane.Praza@Sun.COM
17011838SLiane.Praza@Sun.COM   To do cross-platform packaging, prefix your target with (for
17111838SLiane.Praza@Sun.COM   example) "sparc/", as in "dmake sparc/install".  Note that we
17211838SLiane.Praza@Sun.COM   currently pull some license files directly from a built source
17311838SLiane.Praza@Sun.COM   tree, so if you do this in a workspace that had proto area copied
17411838SLiane.Praza@Sun.COM   in via nightly -U, then you'll need to set $SRC to point to the
17511838SLiane.Praza@Sun.COM   workspace that was actually built.
17611838SLiane.Praza@Sun.COM
17711838SLiane.Praza@Sun.COMTesting Packages
17811838SLiane.Praza@Sun.COM----------------
17911838SLiane.Praza@Sun.COM
18011838SLiane.Praza@Sun.COMTo test the generated repositories, you should use the "onu" tool
18111838SLiane.Praza@Sun.COMavailable from /opt/onbld/bin or usr/src/tools/scripts/ to setup and
18211838SLiane.Praza@Sun.COMupgrade your system.  A manpage is available in /opt/onbld/man
18311838SLiane.Praza@Sun.COMor usr/src/tools/scripts/onu.1.
18411838SLiane.Praza@Sun.COM
18511838SLiane.Praza@Sun.COMAlternatively, you can manually start a pkg.depot(1M) server to
18611838SLiane.Praza@Sun.COMserve the generated repositories to multiple test machines.
18711838SLiane.Praza@Sun.COM
18811838SLiane.Praza@Sun.COM	Start up a depot on your build machine.
18911838SLiane.Praza@Sun.COM	    cd $CODEMGR_WS/packages/$MACH/nightly[-nd]
19011838SLiane.Praza@Sun.COM	    /usr/lib/pkg.depotd -d repo.redist -p <port> &
19111838SLiane.Praza@Sun.COM
19211838SLiane.Praza@Sun.COM	    Make SURE you choose an unused port and the depot
19311838SLiane.Praza@Sun.COM	    starts successfully.
19411838SLiane.Praza@Sun.COM
19511838SLiane.Praza@Sun.COM	    The depot can be started across NFS as well if you
19611838SLiane.Praza@Sun.COM	    have a fast pipe.
19711838SLiane.Praza@Sun.COM
198*12616Sdp@eng.sun.com	    If you used internal crypto in your builds, then you must
199*12616Sdp@eng.sun.com	    do this step for both repo.redist and repo.extra, picking
200*12616Sdp@eng.sun.com	    different ports for each.  Otherwise, you will be unable to
201*12616Sdp@eng.sun.com	    image-update.
202*12616Sdp@eng.sun.com
20311838SLiane.Praza@Sun.COM	Configure your test system.
20411838SLiane.Praza@Sun.COM	    pkg set-publisher -P -g http://<your server host>:<port> on-nightly
20511838SLiane.Praza@Sun.COM	    pkg set-publisher --non-sticky opensolaris.org
20611838SLiane.Praza@Sun.COM	    pkg uninstall entire
20711838SLiane.Praza@Sun.COM
208*12616Sdp@eng.sun.com	    If you used internal crypto in your builds, then you must also:
209*12616Sdp@eng.sun.com	        pkg set-publisher -P \
210*12616Sdp@eng.sun.com		    -g http://<your server host>:<extra-port> on-extra
211*12616Sdp@eng.sun.com
21211838SLiane.Praza@Sun.COM	pkg image-update your test system.
21311838SLiane.Praza@Sun.COM	    pkg image-update will upgrade all packages on your test system
21411838SLiane.Praza@Sun.COM
21511838SLiane.Praza@Sun.COMAlways make sure your bits are installed with image-update.
21611838SLiane.Praza@Sun.COM	Check your versions.
21711838SLiane.Praza@Sun.COM	    pkg info osnet-incorporation
21811838SLiane.Praza@Sun.COM
21911838SLiane.Praza@Sun.COM	Multiple packages should be updated.
22011838SLiane.Praza@Sun.COM	    If you did a full build, all ON packages will be updated.
22111838SLiane.Praza@Sun.COM	    When image-update tells you that only one or two packages has
22211838SLiane.Praza@Sun.COM	    been updated, you likely did not get the updates you expected.
22311838SLiane.Praza@Sun.COM
22411838SLiane.Praza@Sun.COMThere are various tactics for troubleshooting a failed upgrade.
22511838SLiane.Praza@Sun.COM	Make sure entire is uninstalled.
22611838SLiane.Praza@Sun.COM
22711838SLiane.Praza@Sun.COM	pkg install -nv osnet-incorporation@<your version>
22811838SLiane.Praza@Sun.COM	    Ask IPS to explicitly check if ON can be installed, and
22911838SLiane.Praza@Sun.COM	    if it can't, tell you why not.
23011838SLiane.Praza@Sun.COM
23111838SLiane.Praza@Sun.COM	Obsolete and renamed packages can cause trouble.
23211838SLiane.Praza@Sun.COM	    pkg search -l ::pkg.renamed:true
23311838SLiane.Praza@Sun.COM	    pkg search -l ::pkg.obsolete:true
23411838SLiane.Praza@Sun.COM
235*12616Sdp@eng.sun.com	Check to see if you used internal crypto, but failed to provide
236*12616Sdp@eng.sun.com	a server for repo.extra.
237*12616Sdp@eng.sun.com	    Use a web browser to view the system/kernel manifest from
238*12616Sdp@eng.sun.com	    your on-nightly publisher and look for a dependency on the
239*12616Sdp@eng.sun.com	    driver/crypto/dprov package.
240*12616Sdp@eng.sun.com
241*12616Sdp@eng.sun.com
24211838SLiane.Praza@Sun.COMMaking Packaging Changes
24311838SLiane.Praza@Sun.COM------------------------
24411838SLiane.Praza@Sun.COM
24511838SLiane.Praza@Sun.COMPackage definitions are in usr/src/pkg/manifests/, and have one
24611838SLiane.Praza@Sun.COMfile per package, including for multi-architecture packages.  For
24711838SLiane.Praza@Sun.COMmost packaging changes you only need to add or change the packaging
24811838SLiane.Praza@Sun.COMmanifests themselves.  No packaging metadata may be kept outside of the
24911838SLiane.Praza@Sun.COMmanifests. If you find yourself needing to modify usr/src/pkg/Makefile,
25011838SLiane.Praza@Sun.COMyou're almost certainly doing something wrong.
25111838SLiane.Praza@Sun.COM
25211838SLiane.Praza@Sun.COMRemember that the "check" target is available to check many of
25311838SLiane.Praza@Sun.COMyour packaging changes.
25411838SLiane.Praza@Sun.COM
25511838SLiane.Praza@Sun.COMWe run pkgmogrify(1) over the manifests before publication.  This
25611838SLiane.Praza@Sun.COMallows us to apply a set of macros and package transformations in
25711838SLiane.Praza@Sun.COMorder to make the manifests themselves easier to maintain.
25811838SLiane.Praza@Sun.COM
25911838SLiane.Praza@Sun.COMWe supply a set of commonly-used macros for use in package manifests.
26011838SLiane.Praza@Sun.COMThese are the PKGMOG_DEFINES in usr/src/pkg/Makefile.
26111838SLiane.Praza@Sun.COM
26211838SLiane.Praza@Sun.COM	$(i386_ONLY)
26311838SLiane.Praza@Sun.COM	$(sparc_ONLY)
26411838SLiane.Praza@Sun.COM	$(ARCH)
26511838SLiane.Praza@Sun.COM	$(ARCH32)
26611838SLiane.Praza@Sun.COM	$(ARCH64)
26711838SLiane.Praza@Sun.COM	$(PKGVERS), which is set to
26811838SLiane.Praza@Sun.COM	   $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-0.$(PKGVERS_BRANCH)
26911838SLiane.Praza@Sun.COM
27011838SLiane.Praza@Sun.COMpkgmogrify(1) also allows us to include a set of default transformations.
27111838SLiane.Praza@Sun.COMThe definitions for these transforms are in usr/src/pkg/transforms/.  An
27211838SLiane.Praza@Sun.COMoverview of their use is supplied here, but for a full accounting, please
27311838SLiane.Praza@Sun.COMread pkmogrify(1) and the files themselves.
27411838SLiane.Praza@Sun.COM
27511838SLiane.Praza@Sun.COM	defaults
27611838SLiane.Praza@Sun.COM	    This transform is applied to all manifests.  It specifies
27711838SLiane.Praza@Sun.COM	    a set of sensible default permissions, a set of
27811838SLiane.Praza@Sun.COM	    directory locations for which the reboot-needed actuator
27911838SLiane.Praza@Sun.COM	    is always applied to files, and some other basic defaults.
28011838SLiane.Praza@Sun.COM
28111838SLiane.Praza@Sun.COM	publish
28211838SLiane.Praza@Sun.COM	    This transform is applied to all manifests.  It ensures
28311838SLiane.Praza@Sun.COM	    that manifest lines which don't apply to the current
28411838SLiane.Praza@Sun.COM	    architecture are stripped.  It also ensures non-redistributable
28511838SLiane.Praza@Sun.COM	    packages aren't included in an open-only build.
28611838SLiane.Praza@Sun.COM
28711838SLiane.Praza@Sun.COM	restart_fmri
28811838SLiane.Praza@Sun.COM	    This transform is applied to all manifests.  It modifies
28911838SLiane.Praza@Sun.COM	    all package manifest lines for SMF manifests in standard
29011838SLiane.Praza@Sun.COM	    locations to include an actuator which runs manifest-import
29111838SLiane.Praza@Sun.COM	    on installation/update/removal, as well as some others.  If
29211838SLiane.Praza@Sun.COM	    you're adding a new class of file that would benefit from
29311838SLiane.Praza@Sun.COM	    a restart or refresh of a specific SMF service, please add
29411838SLiane.Praza@Sun.COM	    it here.
29511838SLiane.Praza@Sun.COM
29611838SLiane.Praza@Sun.COM	extract_metadata
29711838SLiane.Praza@Sun.COM	    This transform is applied to all manifests.  It deals with
29811838SLiane.Praza@Sun.COM	    manipulations required for packaging metadata like
29911838SLiane.Praza@Sun.COM	    org.opensolaris.redist, pkg.renamed, and pkg.obsolete.
30011838SLiane.Praza@Sun.COM
30111838SLiane.Praza@Sun.COM	hollow_zone_pkg
30211838SLiane.Praza@Sun.COM	    This transform is available for explicit inclusion in
30311838SLiane.Praza@Sun.COM	    some manifests.  It ensures that all contents of the
30411838SLiane.Praza@Sun.COM	    package are not installed within a non-global zone, but the
30511838SLiane.Praza@Sun.COM	    package and its metadata are available in order to satisfy
30611838SLiane.Praza@Sun.COM	    packaging dependencies.
30711838SLiane.Praza@Sun.COM
30811838SLiane.Praza@Sun.COMpkgmogrify(1) also allows us to use comments and continuation lines
30911838SLiane.Praza@Sun.COMin our manifests.
31011838SLiane.Praza@Sun.COM
31111838SLiane.Praza@Sun.COMZones and Packages
31211838SLiane.Praza@Sun.COM------------------
31311838SLiane.Praza@Sun.COM
31411838SLiane.Praza@Sun.COMpkg(5) uses variants to implement zones.  If a package is marked
31511838SLiane.Praza@Sun.COMwith both global and non-global zone variants, the package contents will
31611838SLiane.Praza@Sun.COMbe installed in both global and non-global by default.
31711838SLiane.Praza@Sun.COM	set name=variant.opensolaris.zone value=global value=nonglobal
31811838SLiane.Praza@Sun.COM
31911838SLiane.Praza@Sun.COMSpecific actions within a package can be tagged as applying to only
32011838SLiane.Praza@Sun.COMthe global zone or only the non-global zones.
32111838SLiane.Praza@Sun.COM
32211838SLiane.Praza@Sun.COMThe hollow_zone_pkg transform described above is also available to
32311838SLiane.Praza@Sun.COMsimplify a common packaging scenario.
32411838SLiane.Praza@Sun.COM
32511838SLiane.Praza@Sun.COMDependencies
32611838SLiane.Praza@Sun.COM------------
32711838SLiane.Praza@Sun.COM
32811838SLiane.Praza@Sun.COMPackage dependencies are automatically calculated during build time
32911838SLiane.Praza@Sun.COMusing pkgdepend(1).  After you've done a build, you can verify your
33011838SLiane.Praza@Sun.COMdependencies in the <package>.res file described above.  If the
33111838SLiane.Praza@Sun.COMfile is missing a dependency that you believe could be auto-detected,
33211838SLiane.Praza@Sun.COMplease file a bug against pkgdepend(1).
33311838SLiane.Praza@Sun.COM
33411838SLiane.Praza@Sun.COMDependencies can be added manually using the "depend" action.  Please
33511838SLiane.Praza@Sun.COMadd a comment describing why the dependency is required.
33611838SLiane.Praza@Sun.COM
33711838SLiane.Praza@Sun.COMMoving Content Between Packages and Removing Content
33811838SLiane.Praza@Sun.COM----------------------------------------------------
33911838SLiane.Praza@Sun.COM
34011838SLiane.Praza@Sun.COMpkg(5) tracks when content is removed from packages, and automatically
34111838SLiane.Praza@Sun.COMremoves it.
34211838SLiane.Praza@Sun.COM
34311838SLiane.Praza@Sun.COMIf you need to move content between packages, there are two primary
34411838SLiane.Praza@Sun.COMthings to do.
34511838SLiane.Praza@Sun.COM
34611838SLiane.Praza@Sun.COM	"preserve" files must be marked with original_name.
34711838SLiane.Praza@Sun.COM	    The first time a "preserve" file moves between packages,
34811838SLiane.Praza@Sun.COM	    you must set original_name=<original package>:<file>
34911838SLiane.Praza@Sun.COM	    in that file's action.  Subsequent moves do not require
35011838SLiane.Praza@Sun.COM	    modification.
35111838SLiane.Praza@Sun.COM
35211838SLiane.Praza@Sun.COM	Consider adding a dependency on the new package.
35311838SLiane.Praza@Sun.COM	    The only way a system will end up with a new package
35411838SLiane.Praza@Sun.COM	    after upgrade is if an existing package depends on it.
35511838SLiane.Praza@Sun.COM
35611838SLiane.Praza@Sun.COMRenaming a Package
35711838SLiane.Praza@Sun.COM------------------
35811838SLiane.Praza@Sun.COM
35911838SLiane.Praza@Sun.COMTo rename a package, leave the old package manifest in place, but
36011838SLiane.Praza@Sun.COMempty it of all delivered content.  The old package should include:
36111838SLiane.Praza@Sun.COM
36211838SLiane.Praza@Sun.COM	set name=pkg.fmri with the version set explicitly to the
36311838SLiane.Praza@Sun.COM	    build you're integrating into.  For example, if you wanted
36411838SLiane.Praza@Sun.COM	    to rename SUNWrmodu in build 133 you'd change the pkg.fmri
36511838SLiane.Praza@Sun.COM	    line to read
36611838SLiane.Praza@Sun.COM	    set name=pkg.fmri value=pkg:/SUNWrmodu@0.5.11,5.11-0.133
36711838SLiane.Praza@Sun.COM
36811838SLiane.Praza@Sun.COM	set name=pkg.renamed value=true
36911838SLiane.Praza@Sun.COM
37011838SLiane.Praza@Sun.COM	The architectures and variants you're renaming.  These
37111838SLiane.Praza@Sun.COM	    should just be copied from your old package, as you
37211838SLiane.Praza@Sun.COM	    must rename a package on all architectures and
37311838SLiane.Praza@Sun.COM	    variants simultaneously.
37411838SLiane.Praza@Sun.COM
37511838SLiane.Praza@Sun.COM	A dependency on the new package.
37611838SLiane.Praza@Sun.COM
37711838SLiane.Praza@Sun.COMIf there were "preserve" files in the package you're renaming, make
37811838SLiane.Praza@Sun.COMsure to create original_name settings in the new package.
37911838SLiane.Praza@Sun.COM
38011839SMark.J.Nelson@Sun.COMIf there was a org.opensolaris.noincorp property in the package being
38111839SMark.J.Nelson@Sun.COMrenamed, make sure you keep it in both the original and the renamed
38211839SMark.J.Nelson@Sun.COMpackages.
38311839SMark.J.Nelson@Sun.COM
38411838SLiane.Praza@Sun.COMEOFs and Removals
38511838SLiane.Praza@Sun.COM-----------------
38611838SLiane.Praza@Sun.COM
38711838SLiane.Praza@Sun.COMTo remove files, directories, drivers, or anything else within a package,
38811838SLiane.Praza@Sun.COMsimply stop delivering them in the package.  IPS will manage the removal
38911838SLiane.Praza@Sun.COMof no longer delivered content.
39011838SLiane.Praza@Sun.COM
39111838SLiane.Praza@Sun.COMPackage removals have impact on the rest of the system.  Before marking
39211838SLiane.Praza@Sun.COMa package as obsolete, search in the OpenSolaris development
39311838SLiane.Praza@Sun.COMrepository (http://pkg.opensolaris.org/dev or http://ipkg.sfbay/dev)
39411838SLiane.Praza@Sun.COMto find out if any other packages depend on the software you intend
39511838SLiane.Praza@Sun.COMto EOF.  If any packages do, you need to coordinate with those
39611838SLiane.Praza@Sun.COMconsolidations.
39711838SLiane.Praza@Sun.COM
39811838SLiane.Praza@Sun.COMThe "slim_install" package may depend on ON packages.  If it does,
39911838SLiane.Praza@Sun.COMyou must send a FLAG DAY message for ON users and PIT who test
40011838SLiane.Praza@Sun.COMinstall.  You must also file an installation bug to get that package
40111838SLiane.Praza@Sun.COMupdated in the same build or earlier than you intend to integrate.
40211838SLiane.Praza@Sun.COMYou should also test install yourself.  You can do this by replacing
40311838SLiane.Praza@Sun.COMthe "slim_install" in your Distro Constructor manifest with the
40411838SLiane.Praza@Sun.COMexplicit list of packages to install.
40511838SLiane.Praza@Sun.COM
406*12616Sdp@eng.sun.comTo remove a package, you must mark it as obsolete.  You must *also* mark
407*12616Sdp@eng.sun.comas obsolete any packages which are renamed ancestors of this package, and
408*12616Sdp@eng.sun.comremove their rename dependencies.  Here is what you must do.
409*12616Sdp@eng.sun.com
410*12616Sdp@eng.sun.comTo find rename ancestors, select all of the manifests which are renames,
411*12616Sdp@eng.sun.comthen look for the one which was renamed to the package you care about.
412*12616Sdp@eng.sun.comFor example, to find rename ancestors of 'system/zones', do the following:
41311838SLiane.Praza@Sun.COM
414*12616Sdp@eng.sun.com    $ cd usr/src/pkg/manifests
415*12616Sdp@eng.sun.com    $ mypkgname=system/zones
416*12616Sdp@eng.sun.com    $ grep -l "fmri=pkg:/$mypkgname@" `grep -l pkg.renamed *.mf` /dev/null
417*12616Sdp@eng.sun.com    SUNWzone.mf
418*12616Sdp@eng.sun.com
419*12616Sdp@eng.sun.comMake sure to check that the package has not undergone multiple renames!
420*12616Sdp@eng.sun.com
421*12616Sdp@eng.sun.com    $ mypkgname=SUNWzone
422*12616Sdp@eng.sun.com    $ grep -l "fmri=pkg:/$mypkgname@" `grep -l pkg.renamed *.mf` /dev/null
423*12616Sdp@eng.sun.com    $
424*12616Sdp@eng.sun.com
425*12616Sdp@eng.sun.comOnce you have the renamed ancestor list, for *each* of the packages (the
426*12616Sdp@eng.sun.comnewly obsolete package, and its renamed ancestors), edit the package as
427*12616Sdp@eng.sun.comfollows:
428*12616Sdp@eng.sun.com
429*12616Sdp@eng.sun.com	Update 'set name=pkg.fmri' with the version set explicitly to the
43011838SLiane.Praza@Sun.COM	    build you're integrating into.  For example, if you wanted
43111838SLiane.Praza@Sun.COM	    to remove SUNWwbsd in build 133 you'd change the pkg.fmri
432*12616Sdp@eng.sun.com	    line to read:
433*12616Sdp@eng.sun.com	    'set name=pkg.fmri value=pkg:/SUNWwbsd@0.5.11,5.11-0.133'
434*12616Sdp@eng.sun.com
435*12616Sdp@eng.sun.com	Add 'set name=pkg.obsolete value=true'.
43611838SLiane.Praza@Sun.COM
437*12616Sdp@eng.sun.com	Maintain the architecture and variant declarations in the
438*12616Sdp@eng.sun.com	    package you are obsoleting.  Note that you must obsolete a
439*12616Sdp@eng.sun.com	    package on all architectures and variants simultaneously.
440*12616Sdp@eng.sun.com
441*12616Sdp@eng.sun.com	Maintain 'set name=org.opensolaris.redist' actions if present.
442*12616Sdp@eng.sun.com
443*12616Sdp@eng.sun.com	Delete everything else.
444*12616Sdp@eng.sun.com
445*12616Sdp@eng.sun.com	If the package is a renamed ancestor, leave a comment behind as
446*12616Sdp@eng.sun.com        follows:
44711838SLiane.Praza@Sun.COM
448*12616Sdp@eng.sun.com	   # Was renamed to <other-pkg-name>, both now obsolete.
449*12616Sdp@eng.sun.com
450*12616Sdp@eng.sun.comHere is a complete example.  SUNWfoobar was a package which was renamed
451*12616Sdp@eng.sun.comto system/foobar in build 140, and then later obsoleted in build 150.
452*12616Sdp@eng.sun.comNote that in all cases the package FMRI is updated to the obsoletion
453*12616Sdp@eng.sun.combuild, 150.
454*12616Sdp@eng.sun.com
455*12616Sdp@eng.sun.com    SUNWfoobar.mf:
456*12616Sdp@eng.sun.com        # Was renamed to system/foobar, both now obsolete.
457*12616Sdp@eng.sun.com        set name=pkg.fmri value=pkg:/SUNWfoobar@0.5.11,5.11-0.150
458*12616Sdp@eng.sun.com        set name=pkg.obsolete value=true
459*12616Sdp@eng.sun.com        set name=variant.arch value=$(ARCH)
460*12616Sdp@eng.sun.com
461*12616Sdp@eng.sun.com    system-foobar.mf:
462*12616Sdp@eng.sun.com	set name=pkg.fmri value=pkg:/system/foobar@0.5.11,5.11-0.150
463*12616Sdp@eng.sun.com	set name=pkg.obsolete value=true
464*12616Sdp@eng.sun.com	set name=variant.arch value=$(ARCH)
46511838SLiane.Praza@Sun.COM
46611838SLiane.Praza@Sun.COMCreating a Package
46711838SLiane.Praza@Sun.COM------------------
46811838SLiane.Praza@Sun.COM
46911838SLiane.Praza@Sun.COMThe easiest thing is to copy a package similar to the one you're
47011838SLiane.Praza@Sun.COMtrying to create.  Note that packages are no longer split on the
47111838SLiane.Praza@Sun.COM/usr and / boundary.
47211838SLiane.Praza@Sun.COM
47311838SLiane.Praza@Sun.COMThe following actions are required for all packages in ON.
47411838SLiane.Praza@Sun.COM	set name=pkg.fmri
47511838SLiane.Praza@Sun.COM	    Every package must have an FMRI.  That is the package's
47611838SLiane.Praza@Sun.COM	    name.
47711838SLiane.Praza@Sun.COM
47811838SLiane.Praza@Sun.COM	set name=pkg.summary
47911838SLiane.Praza@Sun.COM	    Every package must have a short summary of its purpose.
48011838SLiane.Praza@Sun.COM
48111838SLiane.Praza@Sun.COM	set name=pkg.description
48211838SLiane.Praza@Sun.COM	    Every package must have a one-sentence description of
48311838SLiane.Praza@Sun.COM	    its purpose.
48411838SLiane.Praza@Sun.COM
48511838SLiane.Praza@Sun.COM	set name=variant.arch
48611838SLiane.Praza@Sun.COM	    Every package must specify which architectures it delivers.
48711838SLiane.Praza@Sun.COM
48811838SLiane.Praza@Sun.COM	set name=info.classification
48911838SLiane.Praza@Sun.COM	    Every package must specify a category for the packaging GUI.
49011838SLiane.Praza@Sun.COM	    You must use an existing category, and may not invent new ones.
49111838SLiane.Praza@Sun.COM	    Existing categories and their subcategories are listed
49211838SLiane.Praza@Sun.COM	    in /usr/share/package-manager/data/opensolaris.org.sections.
49311838SLiane.Praza@Sun.COM
49411838SLiane.Praza@Sun.COM	license
49511838SLiane.Praza@Sun.COM	    All packages must specify a set of license actions.  If
49611838SLiane.Praza@Sun.COM	    you're adding items here that are not already included in
49711838SLiane.Praza@Sun.COM	    usr/src/pkg/license_files, then you will also need to modify
49811838SLiane.Praza@Sun.COM	    usr/src/tools/opensolaris/license-list.
49911838SLiane.Praza@Sun.COM
50011838SLiane.Praza@Sun.COMThe following actions are uncommon but specific to ON.
50111838SLiane.Praza@Sun.COM
50211838SLiane.Praza@Sun.COM	set name=org.opensolaris.redist
50311838SLiane.Praza@Sun.COM	    This may be set to nonredist or internal.  If a package
50411838SLiane.Praza@Sun.COM	    is redistributable, do not create this action.  "internal"
50511838SLiane.Praza@Sun.COM	    packages which are legally not allowed to be distributed
50611838SLiane.Praza@Sun.COM	    at all are strongly discouraged.  If you're adding
50711838SLiane.Praza@Sun.COM	    content to a package with this action, you should have
50811838SLiane.Praza@Sun.COM	    modified bindrop.sh, and test open-only builds.
50911838SLiane.Praza@Sun.COM
510*12616Sdp@eng.sun.comYou don't need to set the following.  They're taken care of for all OS/Net
511*12616Sdp@eng.sun.compackages in the transforms/common_actions file.
512*12616Sdp@eng.sun.com
513*12616Sdp@eng.sun.com	set name=variant.opensolaris.zone
514*12616Sdp@eng.sun.com	    Every package must specify whether it can be installed in
515*12616Sdp@eng.sun.com	    global zones, non-global zones, or both.  All ON packages are
516*12616Sdp@eng.sun.com	    delivered in both global and non-global zones.
517*12616Sdp@eng.sun.com
518*12616Sdp@eng.sun.com	set name=org.opensolaris.consolidation value=osnet
519*12616Sdp@eng.sun.com	    All packages from OS/Net come from OS/Net...
520*12616Sdp@eng.sun.com
52111838SLiane.Praza@Sun.COMDrivers and Packages
52211838SLiane.Praza@Sun.COM--------------------
52311838SLiane.Praza@Sun.COM
52411838SLiane.Praza@Sun.COMScripting is no longer required to deal with addition or removal of
52511838SLiane.Praza@Sun.COMdrivers in ON.  A "driver" action should be specified for each driver,
52611838SLiane.Praza@Sun.COMand IPS will handle updates to all the driver files.
527