Changes between Version 2 and Version 3 of YumCodeSnippets

Show
Ignore:
Author:
james (IP: 65.172.155.230)
Timestamp:
01/29/09 16:15:25 (9 years ago)
Comment:

add yum list snippet

Legend:

Unmodified
Added
Removed
Modified
  • YumCodeSnippets

    v2 v3  
    102102}}} 
    103103 
     104A simple version of the "yum list" command: 
     105 
     106{{{ 
     107yb = yum.YumBase() 
     108yb.conf.cache = os.geteuid() != 1 
     109pl = yb.doPackageLists(patterns=sys.argv[1:]) 
     110if pl.installed: 
     111    print "Installed Packages" 
     112    for pkg in sorted(pl.installed): 
     113        print pkg 
     114if pl.available: 
     115    print "Available Packages" 
     116    for pkg in sorted(pl.available): 
     117        print pkg, pkg.repo 
     118if pl.reinstall_available: 
     119    print "Re-install Available Packages" 
     120    for pkg in sorted(pl.reinstall_available): 
     121        print pkg, pkg.repo 
     122}}} 
     123 
     124 
    104125more?