[PATCH] New Query Option

Michael Jennings mej at kainx.org
Thu Jun 12 19:54:43 PDT 2008


I often used "yum list available" to display packages I could install
but hadn't.  It was particularly helpful in narrowing down searches
for buildreqs for unpackaged software.  There doesn't seem to be an
equivalent in smart, so I added one:  smart query --available

Please be gentle; I'm still familiarizing myself with Smart (and
trying to forgive the use of Python).  ;-)

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej at kainx.org>
Linux Server/Cluster Admin, LBL.gov       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "If everything is coming your way, you're in the wrong lane."
                                                            -- fortune
-------------- next part --------------
diff -Nur -x '*.orig' -x '*.rej' smart-0.52/smart/commands/query.py mezzanine_patched_smart-0.52/smart/commands/query.py
--- smart-0.52/smart/commands/query.py	2007-08-07 09:56:16 -0700
+++ mezzanine_patched_smart-0.52/smart/commands/query.py	2008-06-11 19:02:07 -0700
@@ -56,6 +56,8 @@
                               examples=EXAMPLES)
     parser.add_option("--installed", action="store_true",
                       help=_("consider only installed packages"))
+    parser.add_option("--available", action="store_true",
+                      help=_("consider only available (not installed) packages"))
     parser.add_option("--provides", action="append", default=[], metavar="DEP",
                       help=_("show only packages providing the given "
                              "dependency"))
@@ -158,6 +160,9 @@
 
     if opts.installed:
         packages = [pkg for pkg in packages if pkg.installed]
+    else:
+        if opts.available:
+            packages = [pkg for pkg in packages if not pkg.installed]
 
     whoprovides = []
     for name in opts.provides:


More information about the Smart mailing list