Package Prototype Format

The prototype format used by the pkg(5) toolkit to describe a pkg(5) package is a Python (.py) file that contains one Python dictionary variable named pkg.

The sections allowed in the pkg Dictionary are:

  1. name
  2. version
  3. attributes
  4. defaults
  5. depends
  6. dirs
  7. dirtrees
  8. files
  9. excludefiles
  10. excludedirs
  11. licenses

These sections are explained in detail after the following example.

Example

Note: The names of sections and keys within sections are case sensitive. They must be specified exactly as shown; for example, "name", not "Name" or "NAME".

set name=pkg.description value="The Image Packaging System, also known as pkg(5), is a network-centric packaging system. This package provides an evolving set of tools intended to ease the process of creating and maintaining packages and pre-installed pkg(5) images.  As these tools mature and evolve, they will likely be integrated in some form into the core pkg(5) package."
set name=info.classification value=":System Tools"
set name=description value="pkg(5) Extra Tools"
set name=pkg.summary value="pkg(5) Extra Tools"
depend fmri=pkg:/pkg@1.0.9 type=optional
dir  mode=0755 owner=nobody group=bin path=pkg\bin
file pkg\bin\archivepkgs  mode=0755 owner=nobody group=bin path=pkg\bin\archivepkgs
file pkg\bin\archivepkgs.bat  mode=0755 owner=nobody group=bin path=pkg\bin\archivepkgs.bat
file pkg\bin\archivepkgs.py  mode=0755 owner=nobody group=bin path=pkg\bin\archivepkgs.py
file pkg\bin\builder.py  mode=0755 owner=nobody group=bin path=pkg\bin\builder.py
file pkg\bin\client.py  mode=0755 owner=nobody group=bin path=pkg\bin\client.py
file pkg\bin\copypkgs  mode=0755 owner=nobody group=bin path=pkg\bin\copypkgs
file pkg\bin\copypkgs.bat  mode=0755 owner=nobody group=bin path=pkg\bin\copypkgs.bat
file pkg\bin\copypkgs.py  mode=0755 owner=nobody group=bin path=pkg\bin\copypkgs.py
file pkg\bin\depot.py  mode=0755 owner=nobody group=bin path=pkg\bin\depot.py
file pkg\bin\depotthread.py  mode=0755 owner=nobody group=bin path=pkg\bin\depotthread.py
file pkg\bin\makeimage  mode=0755 owner=nobody group=bin path=pkg\bin\makeimage
file pkg\bin\makeimage.bat  mode=0755 owner=nobody group=bin path=pkg\bin\makeimage.bat
file pkg\bin\makeimage.py  mode=0755 owner=nobody group=bin path=pkg\bin\makeimage.py
file pkg\bin\makemanifest  mode=0755 owner=nobody group=bin path=pkg\bin\makemanifest
file pkg\bin\makemanifest.bat  mode=0755 owner=nobody group=bin path=pkg\bin\makemanifest.bat
file pkg\bin\makemanifest.py  mode=0755 owner=nobody group=bin path=pkg\bin\makemanifest.py
file pkg\bin\makepkgs  mode=0755 owner=nobody group=bin path=pkg\bin\makepkgs
file pkg\bin\makepkgs.bat  mode=0755 owner=nobody group=bin path=pkg\bin\makepkgs.bat
file pkg\bin\makepkgs.py  mode=0755 owner=nobody group=bin path=pkg\bin\makepkgs.py
file pkg\bin\pkg.bat  mode=0755 owner=nobody group=bin path=pkg\bin\pkg.bat
file pkg\bin\pkg.depotd.bat  mode=0755 owner=nobody group=bin path=pkg\bin\pkg.depotd.bat
file pkg\bin\pkgrecv.bat  mode=0755 owner=nobody group=bin path=pkg\bin\pkgrecv.bat
file pkg\bin\pkgsend.bat  mode=0755 owner=nobody group=bin path=pkg\bin\pkgsend.bat
file pkg\bin\publish.py  mode=0755 owner=nobody group=bin path=pkg\bin\publish.py
file pkg\bin\pull.py  mode=0755 owner=nobody group=bin path=pkg\bin\pull.py
file pkg\bin\tarpkgs.py  mode=0755 owner=nobody group=bin path=pkg\bin\tarpkgs.py


pkg = {

    "name" : "pkg",

    "version" : "1.0.7,0-@{version}",

    "attributes" : {
        "pkg.summary" : "pkg(5) Image Packaging System",
        "pkg.description" : "The descrption for Image Packaging System, \
            also known as pkg(5), Multi-line description is suppoted. For more \
            information, about pkg(5) see http://ipshowto.org and http://OpenSolaris.org",
        "info.classification" : "System Tools"
    },

    "defaults" : { "file" : {"mode" : "0755", "group" : "bin", "owner" : "root",},
                   "dir"  : {"mode" : "0644", "group" : "bin", "owner" : "root",},
    },

    "depends" : {
        "pkg:/python2.6-minimal@2" : {"type" : "require" }
    },

    "dirs" : {
        "bin"     : {"mode" : "0755"},
        "pkg"     : {"mode" : "0755"},
        "pkg/bin" : {"mode" : "0755"},
    },

    "dirtrees" : {
        
        "pkg/vendor-packages"          : {"owner" : "root", "group" : "bin"},
        "pkg/vendor-packages/cherrypy" : {"preserve" : "renamenew"},
        "pkg/man"                      : {},
    },

    "files" : {
        "bin/pkg.bat"                   : {"mode" : "0755", "os" : "windows"},
        "bin/pkg"                       : {"mode" : "0755", "os" : "unix"},
        "pkg/bin/client.py"             : {},
        "pkg/OPENSOLARIS.LICENSE"       : {},
        "pkg/PKG-3RD-PARTY-LICENSE.txt" : {},
        "pkg/python2.6-minimal/lib/python2.4/site-packages/pkg.pth" : { "os" : "unix"},
        "pkg/python2.6-minimal/Lib/site-packages/pkg.pth" : { "os" : "windows"},
    },

    "excludefiles" : [
        "pkg/man/pkg-ant-tasks.1",
    ],

    "excludedirs" : [
        "pkg/man/cat1",
    ],

    "licenses" : {
        "pkg/OPENSOLARIS.LICENSE"       : {"license" : "CDDLv1.0" },
        "pkg/PKG-3RD-PARTY-LICENSE.txt" : {"license" : "PKG-3RD-PARTY" },
    },
}

name

The name of the package. You can write this as a key:value pair. The "name" is the key and "pkg" is the value in the above example.

version

The version of the package. The value of the version can be a simple string as in the example above or a dictionary as shown below. You can specify the version to be used in different operating systems as shown in the example below. The @{version} in the version string will be replaced by the version supplied by the Makepkgs task or the makepkgs script.

    "version" : {
        "1.0.7,0-@{version}" :{"os" : "windows"},
        "1.0.7,5.11-@{version}" :{"os" : "solaris"},
    }

attributes

Attributes of the package. The attributes section corresponds to the set action of pkg(5). See the opensolaris documentation for pkg(5) to learn more about the set action in pkg(5). The value for attribute is a dictionary of key:value pairs denoting the name and the value for each set action.

defaults

The default attributes for file and dir action of pkg(5). The attributes supported are

The example above declares a sample defaults with both file and dir action attributes.For information about mode, owner and group see the opensolaris documentation for pkg(5).

depends

Dependencies this package has on other packages. The depends section is a dictionary that corresponds to the depends action of pkg(5). For each dependency, the depends section supports the attribute type as a nested dictionary as shown in the example above. The values allowed for type are:

For more details about these values, see the opensolaris documentation for pkg(5).

dirs

Directories to be included in the package. The dirs section is a dictionary that corresponds to the directory action of pkg(5). Within the dirs dictionary, specify each directory as a key: value pair, with the path of the directory as the key and a dictionary as the value.

The path provided for each directory is relative to the base directory provided by the Makepkgs task or the makepkgs script.

The dictionary value for each directory is a set of key:value pairs. The supported keys are:

The mode, owner, and group keys specify the permissions for the directory. For information about them, see the opensolaris documentation for pkg(5).

The os key specifies the operating system to which the directory applies. If you omit the os key, the directory applies to all operating systems.

You can specify any value for the os key, but values used in the os key must match values used in the os element of the Makepkgs task and the -os argument of the makepkgs script in order to create platform-specific packages successfully.

Note: In the dirs section, only the directories listed are included in the package. The contents of the directories are not included. To include a directory and its contents, use the dirtrees section.

dirtrees

Directories, including directory content, to be included in the package. The dirtrees section is a dictionary that has the same format as the dirs section. The dirtrees section differs from the dirs section because dirtrees includes both the directory and the directory's content.

The innermost directory specified will be added before adding the parent directory if both are specified in the dirtrees. For example the "pkg/vendor-packages/cherrypy" directory with "preserve" attribute will be added before processing the "pkg/vendor-packages" directory with "owner" and "group" attribute.

Note: To maintain backward compatiblity, the value for dirtrees can be specified as a list instead of as a dictionary.

files

Individual files to be included in the package. The files section is a dictionary that corresponds to the file action of pkg(5). It has the same format as the dirs and dirtrees section. The files section differs from these two sections because it specifies individual files to be included in the package.

excludefiles

Individual files to be excluded from the package. The excludefiles section is a Python list of files that would normally be included in the package as the result of entries in the dirtrees section, but which instead are to be excluded.

excludedirs

Individual directories to be excluded from the package. The excludedirs section is a Python list of directories that would normally be included in the package as the result of entries in the dirtrees section, but which instead are to be excluded.

licenses

The license files in the package. The licenses section is a dictionary that corresponds to the license action of pkg(5). Within the licenses dictionary, specify each license file as a key: value pair, with the path of the license file as the key and a dictionary as the value.

The dictionary value for each license file contains a single key:value pair whose key is "license" and whose value is a text string. For information about license files, see the opensolaris documentation for pkg(5).

Note: Files in the licenses section are not automatically included in the package. They must be included by direct reference in the files sections or implicit reference in the dirtrees section.