IPS Search and Actions

When searching for an IPS package, I usually type something quick and simple like:

bleonard@opensolaris:~$ pkg search netbeans
INDEX      ACTION    VALUE                     PACKAGE
description set       NetBeans                  pkg:/libnb-php@6.5.1-0.111
description set       NetBeans                  pkg:/libnb-groovy@6.5-0.86
description set       NetBeans                  pkg:/netbeans-java@6.5.1-0.111
..

And scroll through the result list hoping to find what I'm looking for. However, in my example above, that's 437 lines!

bleonard@opensolaris:~$ pkg search netbeans | wc -l
437

Often times I'll shorten the list by grepping for my build:

bleonard@opensolaris:~$ pkg search netbeans | grep 111
description set       NetBeans                  pkg:/libnb-php@6.5.1-0.111
description set       NetBeans                  pkg:/netbeans-java@6.5.1-0.111
description set       NetBeans                  pkg:/libnb-visualweb@6.5.1-0.111
...

Which reduces the list down to 134 for this example:

bleonard@opensolaris:~$ pkg search netbeans | grep 111 | wc -l
134

However, I generally tend to ignore the first two columns, INDEX and ACTION. Actions, in the case of IPS, are actually nouns and not verbs as the name would lead you to expect. Actions are the things that get installed (files, directories, links, drivers, licenses, users, groups, etc). Here's a nice description of the Actions in IPS.

When you perform a search, the search string is checked against all of these actions types, which as seen above, can produce a lot of results. For example, 5 of the 134 results above all refer to the same package, pkg:/sunstudioexpress@0.2009.3.1:

bleonard@opensolaris:~$ pkg search netbeans | grep 111 | grep pkg:/sunstudioexpress@0.2009.3.1
basename   dir       opt/SunStudioExpress/prod/nb-dbxtool/ide10/docs/org/netbeans pkg:/sunstudioexpress@0.2009.3.1-0.111
basename   dir       opt/netbeans-6.5ss/ide10/docs/org/netbeans pkg:/sunstudioexpress@0.2009.3.1-0.111
basename   file      opt/SunStudioExpress/prod/nb-dbxtool/bin/netbeans pkg:/sunstudioexpress@0.2009.3.1-0.111
basename   file      opt/netbeans-6.5ss/bin/netbeans pkg:/sunstudioexpress@0.2009.3.1-0.111
basename   link      opt/SunStudioExpress/netbeans pkg:/sunstudioexpress@0.2009.3.1-0.111

That's because the search results are returning 3 directories, 2 files and 1 link, all in the same package, that contain the search string "netbeans".

If you just want to see a list packages that match the search string, use the -p option.

bleonard@opensolaris:~$ pkg search -p netbeans | grep 111 
pkg:/amp-dev@0.5.11-0.111 (opensolaris.org)
pkg:/developer/netbeans/plugin/nb-dtrace@1.0-0.111 (opensolaris.org)
pkg:/developer/sunstudio12u1@12.1.1-0.111 (opensolaris.org)
...

This returns a much more reasonable 60 results with just the package names, making the result list much more easier to read through. I wish -p was the default option, rather than the -a (which shows the matching actions).

Comments:

All you've really demonstrated is how awful 'pkg search' is.

Posted by guest on October 06, 2010 at 10:28 AM GMT #

Thanks for the tip.

The default results are quite overwhelming, I would like to have '-p' behavior as the default too. I might file an enhancement with the pkg team.

Posted by Aidan on October 07, 2010 at 02:14 PM GMT #

too bad greedy oracle let the OpenSolaris product rot... glad I am migrating away from Solaris in all my environments.

Posted by Alex on October 14, 2010 at 11:51 AM GMT #

Alex, it's only the brand "OpenSolaris" that we've let "rot". OpenSolaris the product continues forward as Solaris 11 Express - http://www.oracle.com/us/corporate/press/173478 . You can expect a release before the end of the year.

Posted by W Brian Leonard on October 14, 2010 at 12:29 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today