1341 pkg(1) - pkg contents example#3 doesn't work and "pkg verify" synopsis does not match subcommand description os200805 os200805_rc3
authorDanek Duvall <danek.duvall@sun.com>
Sat, 26 Apr 2008 11:08:10 -0700
changeset 362 d974bb176266
parent 361 5aca6ca29a5d
child 363 85ff73a8d556
1341 pkg(1) - pkg contents example#3 doesn't work and "pkg verify" synopsis does not match subcommand description 1476 "pkg help" should display a usage statement and not complain 1635 want an easy way of displaying the version of IPS
src/client.py
src/man/pkg.1.txt
--- a/src/client.py	Sat Apr 26 10:16:20 2008 -0700
+++ b/src/client.py	Sat Apr 26 11:08:10 2008 -0700
@@ -62,6 +62,7 @@
 import pkg.fmri as fmri
 import pkg.misc as misc
 import pkg.version
+import pkg
 
 def usage(usage_error = None):
         """ Emit a usage message and optionally prefix it with a more
@@ -81,6 +82,8 @@
         pkg list [-aHsuv] [package...]
         pkg image-update [-nvq]
         pkg refresh [--full]
+        pkg version
+        pkg help
 
 Advanced subcommands:
         pkg info [-lr] [--license] [pkg_fmri_pattern ...]
@@ -97,11 +100,9 @@
         pkg authority [-H] [authname]
 
 Options:
-        --server, -s
-        --image, -R
+        -R dir
 
 Environment:
-        PKG_SERVER
         PKG_IMAGE""")
         sys.exit(2)
 
@@ -1347,7 +1348,7 @@
         gettext.install("pkg", "/usr/lib/locale")
 
         try:
-                opts, pargs = getopt.getopt(sys.argv[1:], "s:R:")
+                opts, pargs = getopt.getopt(sys.argv[1:], "R:")
         except getopt.GetoptError, e:
                 usage(_("illegal global option -- %s") % e.opt)
 
@@ -1360,8 +1361,6 @@
         socket.setdefaulttimeout(
             int(os.environ.get("PKG_CLIENT_TIMEOUT", "30"))) # in seconds
 
-        # XXX Handle PKG_SERVER environment variable.
-
         if subcommand == "image-create":
                 try:
                         ret = image_create(img, pargs)
@@ -1369,6 +1368,14 @@
                         usage(_("illegal %s option -- %s") % \
                             (subcommand, e.opt))
                 return ret
+        elif subcommand == "version":
+                print pkg.VERSION
+                return 0
+        elif subcommand == "help":
+                try:
+                        usage()
+                except SystemExit:
+                        return 0
 
         for opt, arg in opts:
                 if opt == "-R":
--- a/src/man/pkg.1.txt	Sat Apr 26 10:16:20 2008 -0700
+++ b/src/man/pkg.1.txt	Sat Apr 26 11:08:10 2008 -0700
@@ -28,6 +28,9 @@
      /usr/bin/pkg unset-authority authority ...
      /usr/bin/pkg authority [-H] [authname ...]
 
+     /usr/bin/pkg version
+     /usr/bin/pkg help
+
 DESCRIPTION
      pkg is the retrieval client for the image packaging system.  With a
      valid configuration, pkg can be invoked to create images, target
@@ -48,6 +51,13 @@
      what image it has been invoked.  If no image metadata can be found
      in the parent directories, the invocation will fail.
 
+OPTIONS
+     The following option is supported:
+
+     -R dir
+          Operate on the image rooted at dir, rather than the one discovered
+          automatically.
+
 SUBCOMMANDS
      The following subcommands are supported:
 
@@ -186,11 +196,13 @@
           with newer versions available.  With -v, report full package
           FMRIs.
 
-     verify [-fv] [pkg_fmri_pattern ...]
+     verify [-fHqv] [pkg_fmri_pattern ...]
           Validate the installation of packages in the current image.
-          With -v, do more verbose reporting. With -f, fully validate the
-          contents of files against the hash values in the package
-          manifests, as well as checking for file and directory presence.
+          With -v, do more verbose reporting.  With -q, print nothing, but
+          return failure if there are any verification problems.  With -f,
+          fully validate the contents of files against the hash values in
+          the package manifests, as well as checking for file and directory
+          presence.
 
           The -H option causes the headers to be omitted.
 
@@ -212,6 +224,14 @@
           values associated with that authority.  With -H, omit the
           headers from the listing.
 
+     version
+          Display a unique string identifying the version of pkg(1).  This
+          string is not guaranteed to be comparable in any fashion between
+          versions.
+
+     help
+          Display a usage message.
+
 EXAMPLES
      Example 1:  Create a new, full image, with authority example.com,
      stored at /aux0/example_root
@@ -224,14 +244,14 @@
 
      $ pkg install application/widget
 
-     Example 3:  List the contents of the zfs package.  Display the action
-     name, the mode of the file (if defined), the size (if defined), the
-     path, and the target (if a link).  Limit the action to types dir,
-     file, link, and hardlink, since specifying the :name attribute, which
-     is available for all actions, will display a line for all actions,
-     which is not desired here.
+     Example 3:  List the contents of the SUNWzfs package.  Display the
+     action name, the mode of the file (if defined), the size (if defined),
+     the path, and the target (if a link).  Limit the action to types dir,
+     file, link, and hardlink, since specifying the action.name attribute,
+     which is available for all actions, will display a line for all
+     actions, which is not desired here.
 
-     $ pkg contents -t dir,file,link,hardlink -o action.name,mode,pkg.size,path,target zfs
+     $ pkg contents -t dir,file,link,hardlink -o action.name,mode,pkg.size,path,target SUNWzfs
      NAME  MODE   SIZE PATH                                TARGET
      dir   0755        etc
      dir   0755        etc/fs
@@ -250,11 +270,12 @@
      Example 4:  Search the package database for the token "bge".
 
      $ pkg search bge
-     basename pkg:/driver/bge/0.5.11,5.11-0.72:20071001T101343Z
-     driver_name pkg:/driver/bge/0.5.11,5.11-0.72:20071001T101343Z
+     INDEX          ACTION    VALUE             PACKAGE
+     basename       file      kernel/drv/bge    pkg:/[email protected]
+     driver_name    driver    bge               pkg:/[email protected]
 
-     The token shows up both as a basename and as a driver name in the
-     package driver/bge.
+     The token shows up in the package SUNWbge both as the basename for the
+     file action representing /kernel/drv/bge and as a driver name.
 
 EXIT STATUS
      The following exit values are returned: