[yum-commits] 3 commits - package-cleanup.py repoquery.py

James Antill james at osuosl.org
Fri Oct 10 13:08:02 UTC 2008


 package-cleanup.py |   20 +++++++++++---------
 repoquery.py       |    1 +
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 41703ab029dbacfd89077dc8a5f8e92f58a0a198
Author: James Antill <james at and.org>
Date:   Fri Oct 10 09:05:20 2008 -0400

    Speedup package-cleanup --orphans, as yum list extras is

diff --git a/package-cleanup.py b/package-cleanup.py
index af2f3b4..92e7a41 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -236,15 +236,15 @@ def listLeaves(my, all_nodes, leaf_regex, exclude_devel, exclude_bin):
             print "%s-%s-%s.%s" % (pkg[0],pkg[3],pkg[4],pkg[1])
 
 def listOrphans(my):
-    installed = my.rpmdb.simplePkgList()
-    for pkgtup in installed:
-        (n,a,e,v,r) = pkgtup
-        if n == "gpg-pubkey":
+    """ This is "yum list extras". """
+    avail = my.pkgSack.simplePkgList()
+    avail = set(avail)
+    for po in sorted(my.rpmdb.returnPackages()):
+        (n,a,e,v,r) = po.pkgtup
+        if n == "gpg-pubkey": # Not needed as of at least 3.2.19, but meh
             continue
 
-        try:
-            po = my.getPackageObject(pkgtup)
-        except Errors.DepError:
+        if po.pkgtup not in avail:
             print "%s-%s-%s.%s" % (n, v, r, a)
 
 def getKernels(my):
commit accfc7069e1a97db61c1da29c99960bdab6d0e87
Author: James Antill <james at and.org>
Date:   Fri Oct 10 08:56:57 2008 -0400

    Turn plugins on in package-cleanup, and add an option to turn them off

diff --git a/package-cleanup.py b/package-cleanup.py
index aadfb4e..af2f3b4 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -35,7 +35,7 @@ from yum.misc import getCacheDir
 
 def initYum(opts):
     my = yum.YumBase()
-    my.doConfigSetup(opts.conffile,init_plugins=False)
+    my.doConfigSetup(opts.conffile,init_plugins=not opts.noplugins)
     if opts.orphans:
         # make it work as non root user.
         if my.conf.uid != 0:
@@ -379,7 +379,9 @@ def parseArgs():
       help='When listing leaf nodes do not list packages with files in bin dirs')
 
     parser.add_option("--orphans", default=False, dest="orphans",action="store_true",
-      help='List installed packages which are not available from currenly configured repositories.')
+      help='List installed packages which are not available from currenly configured repositories')
+    parser.add_option("--noplugins", default=False, dest="noplugins",action="store_true",
+      help='Turn plugin support off')
     parser.add_option("-q", "--quiet", default=False, dest="quiet",action="store_true",
       help='Print out nothing unecessary')
     parser.add_option("-y", default=False, dest="confirmed",action="store_true",
commit f31ec94973954dd97e703246b90bee90f8b2e947
Author: James Antill <james at and.org>
Date:   Fri Oct 10 08:56:36 2008 -0400

    Always refresh the cache for a manual repo. For repoquery;createrepo;repoquery

diff --git a/repoquery.py b/repoquery.py
index 0bfd61c..a3652ba 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -765,6 +765,7 @@ def main(args):
             newrepo.name = repopath
             newrepo.baseurl = baseurl
             newrepo.basecachedir = repoq.conf.cachedir
+            newrepo.metadata_expire = 0
             repoq.repos.add(newrepo)
             repoq.repos.enableRepo(newrepo.id)
             repoq.logger.info( "Added %s repo from %s" % (repoid,repopath))


More information about the Yum-commits mailing list