/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 [-EmoSv] [-d output_dir] [-e external_package_file]... [-s suffix ] manifest_file ...
The pkgdepend command generates and resolves dependencies for packages. A package might depend on files from other packages. The pkgdepend command 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 and the Oracle Solaris 11.2 Linkers 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 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:
Display a usage message.
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.
The following subcommands are supported:
Produce the dependencies on files of the manifest specified by manifest_file.
Show the dependencies that are satisfied within manifest_file . Do not use the result of –I with pkgdepend resolve.
Display a list of file types that could not be analyzed.
Repeat the original manifest with any discovered dependencies added after.
Add dir to a list of directories to search for the manifest's files.
Add the value as a way to expand the token name in run paths for ELF file dependencies.
Add the path to the list of run paths to search for kernel modules. Using the –k option 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. Setting any pkg.depend.runpath attributes in the manifest or action overrides paths specified with the –k option.
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 http://docs.python.org/dev/howto/regex.html.
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.
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.
Only resolve against packages from the system whose names match a pattern in external_package_file. This option can be specified multiple times. The –e option cannot be used with the –S option.
If –e is specified, show the packages that were expected to be external dependencies but were not external dependencies. Packages that were expected to be external dependencies are packages from the system whose names match a pattern in external_package_file.
If –e is not specified, show the external dependencies of the resolved packages. External dependencies of the resolved packages are packages not named on the command line that are targets of dependencies in the resolved packages.
Repeat the manifest, with any dependencies produced by the generate step removed, before adding the resolved dependencies.
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 pipeline for manifest processing.
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.
For each output file, append suffix to the base name of the file that was the source of the resolved dependencies. If suffix is not .suffix, a period (.) is prepended to suffix.
Only resolve against the manifests given on the command line and not against the manifests installed on the system.
Include additional package dependency debugging metadata.
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.fdepsExample 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.resExample 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 barExample 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' fooExample 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 fooExample 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/file.py .
Avoid generating dependencies against any file delivered in usr/lib/python2.6/vendor-packages/xdg .
$ cat manifest.py set name=pkg.fmri value=pkg:/firstname.lastname@example.org,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 path=opt/python/__init__.py mode=0644 group=sys owner=root file path=opt/python/foo/__init__.py mode=0644 group=sys owner=root # # Add runpath and bypass-generate attributes: # file path=opt/python/foo/file.py mode=0644 group=sys owner=root \ pkg.depend.bypass-generate=.*/test.py.* \ pkg.depend.bypass-generate=.*/testmodule.so \ pkg.depend.bypass-generate=.*/test.so \ pkg.depend.bypass-generate=usr/lib/python2.6/vendor-packages/xdg/.* \ pkg.depend.runpath=$PKGDEPEND_RUNPATH:/opt/python $ pkgdepend generate -d proto manifest.py
Specifies the directory that contains the image to use for package operations. This value is ignored if –R is specified.
The following exit values are returned:
An error occurred.
Invalid command line options were specified.
An unanticipated exception occurred.
See attributes(5) for descriptions of the following attributes: