JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Image Packaging System Man Pages     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information


User Commands














System Administration Commands

Standards, Environments, and Macros


- Image Packaging System dependency analyzer


/usr/bin/pkgdepend [options] command [cmd_options] [operands]
/usr/bin/pkgdepend generate [-IMm] -d dir [-d dir]
    [-D name=value] [-k path] manifest_file
/usr/bin/pkgdepend resolve [-moSv] [-d output_dir]
    [-s suffix] manifest_file ...


pkgdepend is used to generate and resolve dependencies for packages. A package might depend on files from other packages. pkgdepend is typically used in two passes: file dependency generation and file-to-package resolution.

The generate subcommand examines the content of a package and determines what external files the package needs.

The resolve subcommand takes the list of files from the generate step, and searches a reference set of packages to determine the names of the packages that contain those dependent files. The reference set of packages that are searched for the dependent files are the packages that are currently installed on the publisher's system.

Several components of delivered files are used as sources of dependency information:


ELF headers in delivered files are analyzed for dependency information, with the -k and -D options modifying the information obtained. For more details on ELF dependencies, see ldd(1) and the Linker and Libraries Guide.


Shell scripts that contain #! lines referencing an interpreter result in a dependency on the package that delivers that interpreter.


Python scripts are first analyzed as scripts. In addition, any imports the script declares might also serve as sources of dependency information.

Hard links

Hard links in manifests result in a dependency on the package that delivers the link target.


Delivered SMF service manifests that include require_all dependencies result in dependencies on the packages that deliver the SMF manifests that provide those FMRIs.


The following options are supported:

-R dir

Operate on the image rooted at dir. If no directory was specified or determined based on environment, the default is /. See the “Environment Variables” section for more information.

--help or -?

Displays a usage message.


The following subcommands are supported:

generate [-IMm] -d dir [-d dir] [-D name=value] [-k path] manifest_file

Produce the dependencies on files of the manifest specified by manifest_file.

With -I, show the dependencies that are satisfied within manifest_file. Do not use the result of -I with pkgdepend resolve.

With -M, display a list of file types that could not be analyzed.

With -m, repeat the original manifest with any discovered dependencies added after.

With -d, add dir to a list of directories to search for the manifest's files.

For each -D, add the value as a way to expand the token name in run paths for ELF file dependencies.

For each -k, add the path to the list of run paths to search for kernel modules. Using the -k argument removes the default paths, which are /kernel and /usr/kernel.

Run paths such as those specified by the -k option can also be specified per action or per manifest by using the action or manifest attribute pkg.depend.runpath. The value of the pkg.depend.runpath attribute is a colon-separated string of the paths to use.

The use of -k is overridden by any pkg.depend.runpath attributes set in the manifest or action.

The special token $PKGDEPEND_RUNPATH can be used as one component of the pkg.depend.runpath attribute value in order to include the standard system run path for the file being analyzed.

In some cases, you might want to prevent automatic generation of dependencies. For example, if a package delivers a sample Python script that imports a set of modules, those modules imported by the sample script are not dependencies for the package that delivers the sample script. Use the action or manifest attribute pkg.depend.bypass-generate to prevent generating dependencies against the specified files.

The pkg.depend.bypass-generate values are Python regular expressions that match file names. The regular expressions are implicitly anchored at the start and end of the file path. The value given in the following example matches this/that but does not match something/this/that/the/other.


For more information about Python regular expression syntax, use the command pydoc re or see more complete documentation at

When pkgdepend generate input manifests contain SMF manifest files, any SMF services or instances declared by those SMF manifest files are included in the pkgdepend output. These SMF services or instances are included in the form of a set action with the name org.opensolaris.smf.fmri.

resolve [-moSv] [-d output_dir] [-s suffix] manifest_file ...

Transform dependencies on files into dependencies on the packages that deliver those files. Dependencies are first resolved against the manifests given on the command line and then against the packages installed on the system. By default, the dependencies for each manifest are placed in a file named manifest_file.res.

With -m, repeat the manifest, with any dependencies produced by the generate step removed, before adding the resolved dependencies.

With -o, write the results to standard output. This option is intended for human consumption. Appending this output to a file might result in an invalid manifest. The -d or -s options are strongly recommended instead of -o for use in a pipe line for manifest processing.

With -d, write the resolved dependencies for each manifest provided in a separate file in output_dir. By default, each file has the same base name as the manifest that was the source of the dependencies written to that file.

With -s, for each output file, append suffix to the base name of the file that was the source of the resolved dependencies. A “.” is prepended to suffix if it is not provided.

With -S, only resolve against the manifests given on the command line and not against the manifests installed on the system.

With -v, include additional package dependency debugging metadata.


Example 1 Generate Dependencies

Generate the dependencies for the manifest written in foo, whose content directory is in ./bar/baz, and store the results in foo.fdeps.

$ pkgdepend generate -d ./bar/baz foo > foo.fdeps

Example 2 Resolve Dependencies

Resolve the file dependencies in foo.fdeps and bar.fdeps against each other and against the packages currently installed on the system.

$ pkgdepend resolve foo.fdeps bar.fdeps
$ ls *.res
foo.fdeps.res    bar.fdeps.res

Example 3 Generate and Resolve Dependencies For Two Manifests

Generate the file dependencies for two manifests (foo and bar) and retain all the information in the original manifests. Then resolve the file dependencies and place the resulting manifests in ./res. These resulting manifests can be used with pkgsend publish.

$ pkgdepend generate -d /proto/foo -m foo > ./deps/foo
$ pkgdepend generate -d /proto/bar -m bar > ./deps/bar
$ pkgdepend resolve -m -d ./res ./deps/foo ./deps/bar
$ ls ./res
foo    bar

Example 4 Add Values To Tokens For ELF File Dependencies

Replace all PLATFORM tokens in the run paths in ELF files with sun4v and sun4u while generating the dependencies for the manifest written in foo whose content directory is in /.

$ pkgdepend generate -d / -D 'PLATFORM=sun4v' -D 'PLATFORM=sun4u' foo

Example 5 Specify a Kernel Module Directory

Specify /kmod as the directory in which to find kernel modules when generating the dependencies for the manifest written in foo whose content directory is in /.

$ pkgdepend generate -d / -k /kmod foo

Example 6 Bypass Dependency Generation

Append opt/python to the standard Python run path for a given Python script, and bypass dependency generation against all Python modules called test for a file delivered as opt/python/foo/

Avoid generating dependencies against any file delivered in usr/lib/python2.6/vendor-packages/xdg.

$ cat
set name=pkg.fmri value=pkg:/mypackage@1.0,1.0
set name=pkg.summary value="My test package"
dir path=opt mode=0755 group=sys owner=root
dir path=opt/python mode=0755 group=sys owner=root
dir path=opt/python/foo mode=0755 group=sys owner=root
file NOHASH path=opt/python/ mode=0644 group=sys owner=root
file NOHASH path=opt/python/foo/ mode=0644 group=sys owner=root
# Add runpath and bypass-generate attributes:
file NOHASH path=opt/python/foo/ mode=0644 group=sys owner=root \
    pkg.depend.bypass-generate=.*/* \
    pkg.depend.bypass-generate=.*/ \
    pkg.depend.bypass-generate=.*/ \
    pkg.depend.bypass-generate=usr/lib/python2.6/vendor-packages/xdg/.* \

$ pkgdepend generate -d proto

Environment Variables


Specifies the directory that contains the image to use for package operations. This value is ignored if -R is specified.

Exit Status

The following exit values are returned:


Everything worked.


An error occurred.


Invalid command line options were specified.


An unanticipated exception occurred.


See attributes(5) for descriptions of the following attributes:

Interface Stability

See Also