diff options
Diffstat (limited to 'src/software/test/util.py')
-rw-r--r-- | src/software/test/util.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/software/test/util.py b/src/software/test/util.py index be82c6e..3999a09 100644 --- a/src/software/test/util.py +++ b/src/software/test/util.py @@ -18,6 +18,7 @@ # # Authors: Radek Novacek <rnovacek@redhat.com> # Authors: Michal Minar <miminar@redhat.com> +# Authors: Jan Grec <jgrec@redhat.com> """ Common test utilities. @@ -141,3 +142,19 @@ def get_target_operating_system(): if platform.uname()[4].lower() == 'x86_64': target_operating_system = 80 # RHEL 64bit return pywbem.Uint16(target_operating_system) + +def get_installed_packages(): + """ + :returns: list of packages in format: ``NAME-EPOCH:VERSION-RELEASE.ARCH`` + """ + output = check_output( + [ "/usr/bin/rpm", "-qa", "--qf" + , "%{NAME}-%{EPOCH}:%{VERSION}-%{RELEASE}.%{ARCH}\n"], + stderr=DEV_NULL).split() + package_list = [] + for package in output: + # Skip all gpg public keys returned by rpm -qa + if "gpg-pubkey" not in package: + package_list.append(package.replace("(none)", "0")) + return package_list + |