Last active
August 29, 2015 14:03
-
-
Save elleryq/99993cf7f09deaf70e9a to your computer and use it in GitHub Desktop.
rpmqa.py from Fedora RPM guide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-rpm-programming-python.html | |
| # Acts like rpm -qa and lists the names of all the installed packages. | |
| # Usage: | |
| # python rpmqa.py | |
| import rpm | |
| ts = rpm.TransactionSet() | |
| mi = ts.dbMatch() | |
| #for p in mi: | |
| # print "%s-%s-%s" % (p['name'], p['version'], p['release']). | |
| for p in sorted([h['name'] for h in mi]): | |
| print(p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment