code_junkie

Given an rpm package name, query the yum database for updates

Nov 13th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import os, sys
  2. import yum
  3.  
  4. yb = yum.YumBase()
  5. yb.conf.cache = os.geteuid() != 1
  6. pl = yb.doPackageLists(patterns=sys.argv[1:])
  7. if pl.installed:
  8. print "Installed Packages"
  9. for pkg in sorted(pl.installed):
  10. print pkg
  11. if pl.available:
  12. print "Available Packages"
  13. for pkg in sorted(pl.available):
  14. print pkg, pkg.repo
  15. if pl.reinstall_available:
  16. print "Re-install Available Packages"
  17. for pkg in sorted(pl.reinstall_available):
  18. print pkg, pkg.repo
Add Comment
Please, Sign In to add comment