Use the pkgdepend(1) command to automatically generate dependencies for the package. The generated depend actions are defined in Depend Actions and discussed further in Chapter 4, Specifying Package Dependencies.
Dependency generation is composed of two separate steps:
Dependency generation. Determine the files on which the software depends. Use the pkgdepend generate command.
Dependency resolution. Determine the packages that contain those files on which the software depends. Use the pkgdepend resolve command.
Some manually declared dependencies might be necessary if pkgdepend is unable to determine dependencies completely. In such a case, you should add explanatory comments to the manifest.
In the following command, the -m option causes pkgdepend to include the entire manifest in its output. The -d option passes the proto directory to the command.
$ pkgdepend generate -md proto mypkg.p5m.2 | pkgfmt > mypkg.p5m.3
The output mypkg.p5m.3 file has the following content. The pkgdepend utility added notations about a dependency on libc.so.1 by both mylib.so.1 and mycmd. The internal dependency between mycmd and mylib.so.1 is silently omitted.
set name=pkg.fmri [email protected],5.11-0 set name=pkg.summary value="This is an example package" set name=pkg.description \ value="This is a full description of all the interesting attributes of this example package." set name=info.classification \ value=org.opensolaris.category.2008:Applications/Accessories set name=variant.arch value=i386 dir path=opt/mysoftware owner=root group=bin mode=0755 dir path=opt/mysoftware/bin owner=root group=bin mode=0755 file opt/mysoftware/bin/mycmd path=opt/mysoftware/bin/mycmd owner=root \ group=bin mode=0644 dir path=opt/mysoftware/lib owner=root group=bin mode=0755 file opt/mysoftware/lib/mylib.so.1 path=opt/mysoftware/lib/mylib.so.1 \ owner=root group=bin mode=0644 dir path=opt/mysoftware/man owner=root group=bin mode=0755 dir path=opt/mysoftware/man/man1 owner=root group=bin mode=0755 file opt/mysoftware/man/man1/mycmd.1 path=opt/mysoftware/man/man1/mycmd.1 \ owner=root group=bin mode=0644 link path=usr/share/man/index.d/mysoftware target=/opt/mysoftware/man depend fmri=__TBD pkg.debug.depend.file=libc.so.1 \ pkg.debug.depend.reason=opt/mysoftware/bin/mycmd \ pkg.debug.depend.type=elf type=require pkg.debug.depend.path=lib \ pkg.debug.depend.path=opt/mysoftware/lib pkg.debug.depend.path=usr/lib depend fmri=__TBD pkg.debug.depend.file=libc.so.1 \ pkg.debug.depend.reason=opt/mysoftware/lib/mylib.so.1 \ pkg.debug.depend.type=elf type=require pkg.debug.depend.path=lib \ pkg.debug.depend.path=usr/lib
To resolve dependencies, pkgdepend examines the packages currently installed in the image used for building the software. By default, pkgdepend puts its output in mypkg.p5m.3.res. This step takes a while to run since it loads a large amount of information about the system on which it is running. The pkgdepend utility can resolve many packages at once if you want to amortize this time over all packages. Running pkgdepend on one package at a time is not time efficient.
$ pkgdepend resolve -m mypkg.p5m.3
When this completes, the output mypkg.p5m.3.res file contains the following content. The pkgdepend utility has converted the notation about the file dependency on libc.so.1 to a package dependency on pkg:/system/library, which delivers that file.
set name=pkg.fmri [email protected],5.11-0 set name=pkg.summary value="This is an example package" set name=pkg.description \ value="This is a full description of all the interesting attributes of this example package." set name=info.classification \ value=org.opensolaris.category.2008:Applications/Accessories set name=variant.arch value=i386 dir path=opt/mysoftware owner=root group=bin mode=0755 dir path=opt/mysoftware/bin owner=root group=bin mode=0755 file opt/mysoftware/bin/mycmd path=opt/mysoftware/bin/mycmd owner=root \ group=bin mode=0644 dir path=opt/mysoftware/lib owner=root group=bin mode=0755 file opt/mysoftware/lib/mylib.so.1 path=opt/mysoftware/lib/mylib.so.1 \ owner=root group=bin mode=0644 dir path=opt/mysoftware/man owner=root group=bin mode=0755 dir path=opt/mysoftware/man/man1 owner=root group=bin mode=0755 file opt/mysoftware/man/man1/mycmd.1 path=opt/mysoftware/man/man1/mycmd.1 \ owner=root group=bin mode=0644 link path=usr/share/man/index.d/mysoftware target=/opt/mysoftware/man depend fmri=pkg:/system/[email protected] type=require