528 pkg list -u gives confusing output
authorDan Price <dp@eng.sun.com>
Mon, 21 Apr 2008 14:19:31 -0700
changeset 344 4c887185d780
parent 343 3a0cd685acc0
child 345 98b9538bfe3f
528 pkg list -u gives confusing output 1191 Driver chaff on zone install 1239 test suite should clear PKG_IMAGE before running 1343 pkg uninstall <no args> returns a traceback 1348 Add SUNWcnetr by default to zones, remove SUNWnfsckr
src/brand/pkgcreatezone
src/client.py
src/modules/actions/driver.py
src/modules/client/image.py
src/tests/cli/t_commandline.py
src/tests/cli/testutils.py
src/util/distro-import/common/SUNWcsd.79
--- a/src/brand/pkgcreatezone	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/brand/pkgcreatezone	Mon Apr 21 14:19:31 2008 -0700
@@ -129,7 +129,7 @@
 pkg install -q SUNWcsd || fail_incomplete "$f_pkg"
 
 pkglist=""
-pkglist="$pkglist SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip"
+pkglist="$pkglist SUNWcnetr SUNWesu SUNWadmr SUNWadmap SUNWbzip SUNWgzip"
 
 #
 # Workaround: in our test repo, SUNWipkg has no dependencies
@@ -160,7 +160,7 @@
 #
 # Get nfs client and autofs; it's a pain not to have them.
 #
-pkglist="$pkglist SUNWnfsc SUNWnfsckr SUNWatfs"
+pkglist="$pkglist SUNWnfsc SUNWatfs"
 
 
 #
--- a/src/client.py	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/client.py	Mon Apr 21 14:19:31 2008 -0700
@@ -200,7 +200,10 @@
 
                 if not found:
                         if not pargs:
-                                error(_("no matching packages installed"))
+				if upgradable_only:
+					error(_("no installed packages have available updates"))
+                        	else:
+					error(_("no matching packages installed"))
                         return 1
                 return 0
 
@@ -490,6 +493,9 @@
                 elif opt == "-q":
                         quiet = True
 
+	if not pargs:
+                usage(_("uninstall: at least one package name required"))
+
         if verbose and quiet:
                 usage(_("uninstall: -v and -q may not be combined"))
 
--- a/src/modules/actions/driver.py	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/modules/actions/driver.py	Mon Apr 21 14:19:31 2008 -0700
@@ -79,6 +79,10 @@
 
         def install(self, pkgplan, orig):
                 image = pkgplan.image
+
+		if image.is_zone():
+			return
+
                 n2m = os.path.normpath(os.path.sep.join(
                     (image.get_root(), "etc/name_to_major")))
 
@@ -103,7 +107,7 @@
                         orig = None
 
                 if orig:
-                        return self.update_install(image, orig)
+                        return self.__update_install(image, orig)
 
                 args = ( self.add_drv, "-n", "-b", image.get_root() )
 
@@ -150,7 +154,7 @@
                         self.__call(args, "driver (%(name)s) clone permission "
                             "update", {"name": self.attrs["name"]})
 
-        def update_install(self, image, orig):
+        def __update_install(self, image, orig):
                 add_base = ( self.update_drv, "-b", image.get_root(), "-a" )
                 rem_base = ( self.update_drv, "-b", image.get_root(), "-d" )
 
@@ -472,6 +476,9 @@
         def verify(self, img, **args):
                 """Verify that the driver is installed as specified."""
 
+		if img.is_zone():
+			return []
+
                 name = self.attrs["name"]
 
                 onfs, errors = \
@@ -544,10 +551,15 @@
                 return errors
 
         def remove(self, pkgplan):
+		image = pkgplan.image
+
+		if image.is_zone():
+			return
+
                 args = (
                     self.rem_drv,
                     "-b",
-                    pkgplan.image.get_root(),
+                    image.get_root(),
                     self.attrs["name"]
                 )
 
@@ -558,7 +570,7 @@
                         if len(cp.split()) == 3:
                                 cp = self.attrs["name"] + " " + cp
                         args = (
-                            self.update_drv, "-b", pkgplan.image.get_root(),
+                            self.update_drv, "-b", image.get_root(),
                             "-d", "-m", cp, "clone"
                         )
                         self.__call(args, "driver (%(name)s) clone permission "
--- a/src/modules/client/image.py	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/modules/client/image.py	Mon Apr 21 14:19:31 2008 -0700
@@ -225,6 +225,10 @@
         def is_liveroot(self):
                 return self.root == "/"
 
+        def is_zone(self):
+		zone = self.cfg_cache.filters.get("opensolaris.zone", "")
+		return zone == "nonglobal"
+
         def get_root(self):
                 return self.root
 
--- a/src/tests/cli/t_commandline.py	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/tests/cli/t_commandline.py	Mon Apr 21 14:19:31 2008 -0700
@@ -68,6 +68,8 @@
                 durl = self.dc.get_depot_url()
                 self.image_create(durl)
 
+                self.pkg("install", exit=2)
+                self.pkg("uninstall", exit=2)
                 self.pkg("-s status", exit=2)
                 self.pkg("-R status", exit=2)
                 self.pkg("contents -o", exit=2)
@@ -78,6 +80,8 @@
                 self.pkg("set-authority -O", exit=2)
                 self.pkg("unset-authority", exit=2)
                 self.pkg("refresh -F", exit=2)
+                self.pkg("search", exit=2)
+                self.pkg("image-create", exit=2)
 
         def test_pkgsend_bogus_opts(self):
                 """ pkgsend bogus option checks """
--- a/src/tests/cli/testutils.py	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/tests/cli/testutils.py	Mon Apr 21 14:19:31 2008 -0700
@@ -37,7 +37,8 @@
 	""" Set up environment for doing testing.
 
 	    We set PYTHONPATH and PATH so that they reference the proto
-	    area.
+	    area, and clear packaging related environment variables
+	    (every variable prefixed with PKG_).
 
 	    path_to_proto should be a relative path indicating a path
 	    to proto area of the workspace.  So, if your test case is
@@ -100,6 +101,12 @@
 	print "NOTE: Adding '%s' to head of PATH" % bins
 	os.environ["PATH"] = bins + os.pathsep + os.environ["PATH"]
 
+	# Use "keys"; otherwise we'll change dictionary size during iteration.
+	for k in os.environ.keys():
+		if k.startswith("PKG_"):
+			print "NOTE: Clearing '%s' from environment" % k
+			del os.environ[k]
+
 
 
 topdivider = \
--- a/src/util/distro-import/common/SUNWcsd.79	Sun Apr 20 18:47:36 2008 -0700
+++ b/src/util/distro-import/common/SUNWcsd.79	Mon Apr 21 14:19:31 2008 -0700
@@ -6,5 +6,8 @@
 etc/devlink.tab
 etc/driver_aliases
 etc/name_to_major
+chattr etc/devlink.tab opensolaris.zone=global
+chattr etc/driver_aliases opensolaris.zone=global
+chattr etc/name_to_major opensolaris.zone=global
 end import
 end package