Created
November 10, 2014 12:19
-
-
Save gm3dmo/2b536d7a211225088431 to your computer and use it in GitHub Desktop.
Interact with yum in python and see if a list of rpm/packages are installed
This file contains 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
#!/bin/env python | |
import yum | |
import sys | |
import platform | |
print(platform.dist()[0]) | |
def main(): | |
print(platform.dist()[0]) | |
pkg_list = get_pkg_list() | |
a='x86_64' | |
a='i686' | |
yb = yum.YumBase() | |
for pkg in pkg_list: | |
if yb.rpmdb.searchNevra(name=pkg, arch=a): | |
print 'RPM installed: {0} architecture: {1}'.format(pkg, a) | |
else: | |
print 'RPM not installed: {0} architecture: {1}'.format(pkg, a) | |
def get_pkg_list(): | |
return ['glibc'] | |
def get_test(): | |
pass | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment