diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-31 15:15:21 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-11-04 10:58:12 +0100 |
commit | 9796619a1923e01737a5f96c2e3b8fc3e9401156 (patch) | |
tree | 4eb400628e9e154430bee0e4eeef7aa581b33447 /src | |
parent | 626a83f98195cfd5cc787cf0dc47ad6fb3a06ab3 (diff) | |
download | openlmi-providers-9796619a1923e01737a5f96c2e3b8fc3e9401156.tar.gz openlmi-providers-9796619a1923e01737a5f96c2e3b8fc3e9401156.tar.xz openlmi-providers-9796619a1923e01737a5f96c2e3b8fc3e9401156.zip |
software: test improvements
Do not use packages related to openlmi and CIM for testing purposes.
Diffstat (limited to 'src')
-rw-r--r-- | src/software/test/rpmcache.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/software/test/rpmcache.py b/src/software/test/rpmcache.py index c6205d2..bce5778 100644 --- a/src/software/test/rpmcache.py +++ b/src/software/test/rpmcache.py @@ -88,6 +88,17 @@ class MissingRPM(InvalidTestCache): InvalidTestCache.__init__(self, "Missing package '%s' in test cache!"%pkg_name) +def _is_sane_package(pkg_name): + """ + :returns: Whether the given package can be included among tested ones. + :rtype: boolean + """ + if pkg_name.startswith('openlmi'): + return False + if pkg_name in ('sblim-sfcb', 'tog-pegasus', 'sblim-cmpi-base'): + return False + return True + def _match_nevr(match): """ @param match is a regexp match object with parsed rpm package @@ -143,7 +154,8 @@ def _filter_duplicates(installed, avail_str): or ( ( not prev_match or prev_match.group('name') in [m.group('name') for m in cur_package_matches]) - and match.group('arch') not in ('noarch', system_arch))): + and match.group('arch') not in ('noarch', system_arch)) + or not _is_sane_package(match.group('name'))): continue if prev_match and prev_match.group('name') != match.group('name'): if ( len(cur_package_matches) > 1 @@ -440,18 +452,13 @@ def make_dangerous_list(installed, repolist=None): """ This makes a list of instances of Package for dangerous tests. """ - #print "Getting all available packages" avail_str = util.run_yum('list', 'available', '--showduplicates', repolist=repolist) # list of lists of packages with the same name, longer than 2 - #print "Finding duplicates" dups_list = _filter_duplicates(installed, avail_str) - #print "Selecting only those (from %d) with installed dependencies" % \ - #len(dups_list) selected = _check_pkg_dependencies(installed, dups_list, number_of_packages=MAX_PKG_DB_SIZE*5, repolist=repolist) - #print "Selecting the smallest ones" return _sorted_db_by_size(selected, repolist=repolist) def make_safe_list(installed, exclude=None): @@ -469,7 +476,7 @@ def make_safe_list(installed, exclude=None): while len(res) < MAX_PKG_DB_SIZE and i < len(base): name = base[i] i += 1 - if name in exclude: + if name in exclude or not _is_sane_package(name): continue cmd = [ "rpm", "-q", "--qf", "%{EPOCH}:%{NVRA}\n", name ] envra = check_output(cmd).splitlines()[0] |