--- a/src/client.py Mon Jan 11 16:41:45 2010 -0600
+++ b/src/client.py Mon Jan 11 17:07:36 2010 -0600
@@ -238,19 +238,15 @@
display_headers = False
elif opt == "-a":
ltypes.add(opt)
- pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST
elif opt == "-f":
ltypes.add(opt)
- pkg_list = api.ImageInterface.LIST_ALL
variants = True
elif opt == "-n":
ltypes.add(opt)
- pkg_list = api.ImageInterface.LIST_NEWEST
elif opt == "-s":
summary = True
elif opt == "-u":
ltypes.add(opt)
- pkg_list = api.ImageInterface.LIST_UPGRADABLE
elif opt == "-v":
verbose = True
elif opt == "--no-refresh":
@@ -266,6 +262,15 @@
usage(_("-f may only be used in combination with -a"),
cmd="list")
+ if "-f" in ltypes:
+ pkg_list = api.ImageInterface.LIST_ALL
+ elif "-a" in ltypes:
+ pkg_list = api.ImageInterface.LIST_INSTALLED_NEWEST
+ elif "-n" in ltypes:
+ pkg_list = api.ImageInterface.LIST_NEWEST
+ elif "-u" in ltypes:
+ pkg_list = api.ImageInterface.LIST_UPGRADABLE
+
for ltype, permitted in allowed:
if ltype in ltypes:
ltypes.discard(ltype)
--- a/src/tests/cli/t_pkg_list.py Mon Jan 11 16:41:45 2010 -0600
+++ b/src/tests/cli/t_pkg_list.py Mon Jan 11 17:07:36 2010 -0600
@@ -150,6 +150,11 @@
output = self.reduceSpaces(self.output)
self.assertEqualDiff(expected, output)
+ # Put options in different order to ensure output still matches.
+ self.pkg("list -faH")
+ output = self.reduceSpaces(self.output)
+ self.assertEqualDiff(expected, output)
+
def test_list_01(self):
"""List all "[email protected]" from auth "test1"."""
self.pkg("list -afH pkg://test1/[email protected],5.11-0")
@@ -157,7 +162,7 @@
"foo 1.0-0 known u----\n"
output = self.reduceSpaces(self.output)
self.assertEqualDiff(expected, output)
-
+
def test_list_02(self):
"""List all "[email protected]", regardless of publisher, with "pkg:/"
prefix."""
@@ -200,12 +205,12 @@
self.pkg("list -aH foo")
expected = \
"foo 1.2.1-0 known -----\n" \
- "foo (test2) 1.2.1-0 known -----\n"
+ "foo (test2) 1.2.1-0 known -----\n"
output = self.reduceSpaces(self.output)
expected = self.reduceSpaces(expected)
self.assertEqualDiff(expected, output)
-
+
def test_list_05(self):
"""Show [email protected] from both depots, but 1.1 only from test2."""
self.pkg("list -aHf [email protected] pkg://test2/[email protected]")
@@ -225,7 +230,7 @@
output = self.reduceSpaces(self.output)
expected = self.reduceSpaces(expected)
self.assertEqualDiff(expected, output)
-
+
def test_list_06(self):
"""Show versions 1.0 and 1.1 of foo only from publisher test2."""
self.pkg("list -aHf pkg://test2/foo")