Querying IPS Package Contents
By Gregg Sporar on Aug 12, 2008
$ pkg search -r gcc INDEX ACTION VALUE PACKAGE basename hardlink usr/sfw/bin/gcc pkg:/SUNWgcc@3.4.3-0.79 basename hardlink usr/sfw/bin/gcc pkg:/SUNWgcc@3.4.3-0.86 basename hardlink usr/sfw/bin/gcc pkg:/SUNWgcc@3.4.3-0.89 basename hardlink usr/sfw/bin/gcc pkg:/SUNWgcc@3.4.3-0.90 ...The pkg search command found one package: SUNWgcc.
If you look at the man page for pkg, you will notice that in the description of the search subcommand it says: "Search for the token 'token', and display the FMRIs in which the token was found. Which tokens are indexed are action-dependent, but may include content hashes and pathnames."
Kuldip Oberoi pointed out to me that because not all tokens are searched by pkg search, the results might not always list all packages of interest. And with the token "gcc" that is in fact the case. Kuldip suggested:
pkg list -a | grep gccBut in the end, I modified that a bit to be:
$ pkg list -sa | grep gcc | uniq SUNWgcc gcc - The GNU C compiler SUNWgccruntime GCC Runtime libraries gcc-dev GNU Tools Development clusterIt took longer to run the command, but notice that additional packages were found: SUNWgccruntime and gcc-dev.
The descriptions for SUNWgcc and SUNWgccruntime give me a good sense of what those packages contain, but I was not sure what the term "GNU Tools Development cluster" really encompasses. In my first attempt to find out, I used:
$ pkg contents -r gcc-dev PATH
Hmmm... not very helpful. That is because by default, the contents subcommand just displays the PATH attribute values from a package; for example:
$ pkg contents SUNWgccruntime PATH usr usr/sfw usr/sfw/lib usr/sfw/lib/amd64 usr/sfw/lib/amd64/libfrtbegin.a usr/sfw/lib/amd64/libg2c.a usr/sfw/lib/amd64/libg2c.la usr/sfw/lib/amd64/libg2c.so ...
Unlike the SUNWgccruntime package, the gcc-dev package does not contain any files so that is why there are no PATH entries. To find out what gcc-dev does contain, I add the -m flag so that I can see the complete contents of the package:
$ pkg contents -rm gcc-dev set name=fmri value=pkg:/email@example.com,5.11-0.86:20080504T074641Z set name=authority value=opensolaris.org set name=description value="GNU Tools Development cluster" depend fmri=pkg:/SUNWgcc@3.4.3-0.86 type=require depend fmri=pkg:/SUNWmercurial@0.9.5-0.86 type=require depend fmri=pkg:/SUNWsvn@1.4.3-0.86 type=require depend fmri=pkg:/SUNWgnufirstname.lastname@example.org type=require depend fmri=pkg:/SUNWaconf@2.61-0.86 type=require depend fmri=pkg:/SUNWcvs@1.12.13-0.86 type=require depend fmri=pkg:/SUNWlibtool@1.5.22-0.86 type=require depend fmri=pkg:/SUNWgnuemail@example.com type=require depend fmri=pkg:/SUNWgmake@3.81-0.86 type=require depend fmri=pkg:/SUNWsprot@0.5.11-0.86 type=require depend fmri=pkg:/SUNWbison@2.3-0.86 type=require depend fmri=pkg:/SUNWflexlex@2.5.33-0.86 type=require depend fmri=pkg:/SUNWgdb@6.3-0.86 type=require
So gcc-dev contains no files of its own - just dependencies on other packages. It provides a convenient way to install all of those dependent packages via a single command:
pfexec pkg install gcc-dev