def _kexec_tools_version_supported(self): result = False if self.environment[odeploycons.VdsmEnv.OVIRT_VINTAGE_NODE]: # on node check ovirt-node-plugin-vdsm features result = 'kdump' in self.environment[ odeploycons.VdsmEnv.NODE_PLUGIN_VDSM_FEATURES] else: from rpmUtils.miscutils import compareEVR # on standard host use packager min_version = self._get_min_kexec_tools_version() if min_version is not None: pkgs = self.packager.queryPackages( patterns=(self._KEXEC_TOOLS_PKG, ), ) for package in pkgs: cur_version = ( None, package['version'], package['release'], ) if compareEVR(cur_version, min_version) >= 0: result = True break return result
def package_newer(self, pkg1, pkg2): """ Compare if a pkg1 is newer than pkg2 """ listrpm = [] n1 = pkg1['package_name'] n2 = pkg2['package_name'] if n1 != n2: sys.exit("*ERROR* Unable to compare packages with different name %s - %s" % (n1, n2)) # we need to get pkg1 from database as we don't have his package_epoch (not listed in rpm -qa) pkgid = self.rhndb.get_package_id(pkg1['package_name'], pkg1['package_version'], pkg1['package_release'], pkg1['package_arch_label']) if not pkgid: sys.exit("*ERROR* Unable to find package in our DB: %s" % (n1)) pkg1 = self.rhndb.get_package(pkgid[0]['package_id']) e1 = pkg1['package_epoch'] v1 = pkg1['package_version'] r1 = pkg1['package_release'] e2 = pkg2['package_epoch'] v2 = pkg2['package_version'] r2 = pkg2['package_release'] if compareEVR((e1, v1, r1), (e2, v2, r2)) == -1: return True return False
def _kexec_tools_version_supported(self): result = False if self.environment[odeploycons.VdsmEnv.OVIRT_VINTAGE_NODE]: # on node check ovirt-node-plugin-vdsm features result = 'kdump' in self.environment[ odeploycons.VdsmEnv.NODE_PLUGIN_VDSM_FEATURES ] else: from rpmUtils.miscutils import compareEVR # on standard host use packager min_version = self._get_min_kexec_tools_version() if min_version is not None: pkgs = self.packager.queryPackages( patterns=(self._KEXEC_TOOLS_PKG,), ) for package in pkgs: cur_version = ( None, package['version'], package['release'], ) if compareEVR(cur_version, min_version) >= 0: result = True break return result
def _pkgtup_nevr_cmp(x, y): """ Compare two pkgtup's (ignore arch): n, a, e, v, r. """ ret = cmp(x[0], y[0]) if ret: return ret # This is negated so we get higher versions first, in the list. return -compareEVR((x[2], x[3], x[4]), (y[2], y[3], y[4]))
def _compare_evra(one, two): """ Just a quickie sorting helper. Yes, I'm avoiding using lambdas. @param one: tuple of (e,v,r,a) @type one: tuple @param two: tuple of (e,v,r,a) @type two: tuple @return: -1, 0, 1 @rtype: int """ return compareEVR(one[:3], two[:3])
def check_version_inc(self, version, prj, pkg): error, specob = self._get_spec_file(prj, pkg, None) if error: #don't care if we can't get target package spec return None src_hdrs = [pkg for pkg in specob.packages if pkg.header.isSource()][0] spec_version = src_hdrs.header[rpm.RPMTAG_VERSION] version_comparison = compareEVR(('', version.split('-')[0], ''), ('', spec_version, '')) if version_comparison == 1: return None else: return "Incoming version %s is not higher than current version %s" % (version, spec_version)
def sort_pkgs(available_pkgs): # There is an issue that origin-3.6.0-0.0.alpha.0.1 package was wrongly tagged and proper tag # should be origin-3.6.0-0.alpha.0.1. Because of this issue we have to ignore the package for # installation and upgrade considerations. exceptional_pkg = {} for pkg in available_pkgs: if (pkg.name == "origin" and pkg.version == "3.6.0" and pkg.release == "0.0.alpha.0.1") or \ (pkg.name == "atomic-openshift-utils" and pkg.version == "3.6.173.0.7" and pkg.release == "1.git.0.f6f19ed.el7"): available_pkgs.remove(pkg) break available_pkgs.sort(lambda x, y: rpmutils.compareEVR( (x.epoch, x.version, x.release), (y.epoch, y.version, y.release))) return available_pkgs
def check_version_inc(self, version, prj, pkg): error, specob = self._get_spec_file(prj, pkg, None) if error: print error #don't care if we can't get target package spec return None src_hdrs = [pkg for pkg in specob.packages if pkg.header.isSource()][0] spec_version = "%s-%s" % (src_hdrs.header[rpm.RPMTAG_VERSION], src_hdrs.header[rpm.RPMTAG_RELEASE]) version_comparison = compareEVR(stringToVersion(version), stringToVersion(spec_version)) if version_comparison == 1: return None else: return "Incoming version %s is not higher than current version %s" % (version, spec_version)
def koji_get_info(name, report, pkg_evr, tags=["dist-rawhide"]): koji_server = "http://koji.fedoraproject.org/kojihub" koji_session = koji.ClientSession(koji_server, {}) fmt = " %(nvr)-40s %(tag_name)-20s %(owner_name)s" for tag in tags: pkg = koji_session.getLatestBuilds(tag, package=name); if len(pkg) == 0: continue evr = () e = u'0' if pkg[0]['epoch']: e = u'%s' % pkg[0]['epoch'] v = u'%s' % pkg[0]['version'] r = u'%s' % pkg[0]['release'] evr = e, v, r if compareEVR(evr, pkg_evr) > 0: output = [ fmt % x for x in pkg ] for line in output: report.append(line)
def koji_get_info(name, report, pkg_evr, tags=["dist-rawhide"]): koji_server = "http://koji.fedoraproject.org/kojihub" koji_session = koji.ClientSession(koji_server, {}) fmt = " %(nvr)-40s %(tag_name)-20s %(owner_name)s" for tag in tags: pkg = koji_session.getLatestBuilds(tag, package=name) if len(pkg) == 0: continue evr = () e = u'0' if pkg[0]['epoch']: e = u'%s' % pkg[0]['epoch'] v = u'%s' % pkg[0]['version'] r = u'%s' % pkg[0]['release'] evr = e, v, r if compareEVR(evr, pkg_evr) > 0: output = [fmt % x for x in pkg] for line in output: report.append(line)
def versioncompare(versions): arch_list = getArchList() candidate_arch1 = versions[0].split(".")[-1] candidate_arch2 = versions[1].split(".")[-1] # The first version number passed to this method is always a valid nevra (the current version) # If the second version number looks like it does not contain a valid arch # then we'll chop the arch component (assuming it *is* a valid one) from the first version string # so we're only comparing the evr portions. if (candidate_arch2 not in arch_list) and (candidate_arch1 in arch_list): final_version1 = versions[0].replace("." + candidate_arch1, "") else: final_version1 = versions[0] final_version2 = versions[1] (e1, v1, r1) = stringToVersion(final_version1) (e2, v2, r2) = stringToVersion(final_version2) evr_comparison = compareEVR((e1, v1, r1), (e2, v2, r2)) outpipe.write("%(e)s\n" % {'e': evr_comparison}) outpipe.flush()
def versioncompare(versions): arch_list = getArchList() candidate_arch1 = versions[0].split(".")[-1] candidate_arch2 = versions[1].split(".")[-1] # The first version number passed to this method is always a valid nevra (the current version) # If the second version number looks like it does not contain a valid arch # then we'll chop the arch component (assuming it *is* a valid one) from the first version string # so we're only comparing the evr portions. if (candidate_arch2 not in arch_list) and (candidate_arch1 in arch_list): final_version1 = versions[0].replace("." + candidate_arch1,"") else: final_version1 = versions[0] final_version2 = versions[1] (e1, v1, r1) = stringToVersion(final_version1) (e2, v2, r2) = stringToVersion(final_version2) evr_comparison = compareEVR((e1, v1, r1), (e2, v2, r2)) outpipe.write("%(e)s\n" % { 'e': evr_comparison }) outpipe.flush()
def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos): pkgs = [] downgrade_pkgs = [] res = {} res['results'] = [] res['msg'] = '' res['rc'] = 0 res['changed'] = False tempdir = tempfile.mkdtemp() for spec in items: pkg = None downgrade_candidate = False # check if pkgspec is installed (if possible for idempotence) # localpkg if spec.endswith('.rpm') and '://' not in spec: # get the pkg name-v-r.arch if not os.path.exists(spec): res['msg'] += "No RPM file matching '%s' found on system" % spec res['results'].append("No RPM file matching '%s' found on system" % spec) res['rc'] = 127 # Ensure the task fails in with-loop module.fail_json(**res) nvra = local_nvra(module, spec) # look for them in the rpmdb if is_installed(module, repoq, nvra, conf_file, en_repos=en_repos, dis_repos=dis_repos): # if they are there, skip it continue pkg = spec # URL elif '://' in spec: # download package so that we can check if it's already installed package = fetch_rpm_from_url(spec, module=module) nvra = local_nvra(module, package) if is_installed(module, repoq, nvra, conf_file, en_repos=en_repos, dis_repos=dis_repos): # if it's there, skip it continue pkg = package #groups :( elif spec.startswith('@'): # complete wild ass guess b/c it's a group pkg = spec # range requires or file-requires or pkgname :( else: # most common case is the pkg is already installed and done # short circuit all the bs - and search for it as a pkg in is_installed # if you find it then we're done if not set(['*','?']).intersection(set(spec)): installed_pkgs = is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True) if installed_pkgs: res['results'].append('%s providing %s is already installed' % (installed_pkgs[0], spec)) continue # look up what pkgs provide this pkglist = what_provides(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos) if not pkglist: res['msg'] += "No package matching '%s' found available, installed or updated" % spec res['results'].append("No package matching '%s' found available, installed or updated" % spec) res['rc'] = 126 # Ensure the task fails in with-loop module.fail_json(**res) # if any of the packages are involved in a transaction, fail now # so that we don't hang on the yum operation later conflicts = transaction_exists(pkglist) if len(conflicts) > 0: res['msg'] += "The following packages have pending transactions: %s" % ", ".join(conflicts) res['rc'] = 125 # Ensure the task fails in with-loop module.fail_json(**res) # if any of them are installed # then nothing to do found = False for this in pkglist: if is_installed(module, repoq, this, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True): found = True res['results'].append('%s providing %s is already installed' % (this, spec)) break # if the version of the pkg you have installed is not in ANY repo, but there are # other versions in the repos (both higher and lower) then the previous checks won't work. # so we check one more time. This really only works for pkgname - not for file provides or virt provides # but virt provides should be all caught in what_provides on its own. # highly irritating if not found: if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos): found = True res['results'].append('package providing %s is already installed' % (spec)) if found: continue # Downgrade - The yum install command will only install or upgrade to a spec version, it will # not install an older version of an RPM even if specified by the install spec. So we need to # determine if this is a downgrade, and then use the yum downgrade command to install the RPM. for package in pkglist: # Get the NEVRA of the requested package using pkglist instead of spec because pkglist # contains consistently-formatted package names returned by yum, rather than user input # that is often not parsed correctly by splitFilename(). (name, ver, rel, epoch, arch) = splitFilename(package) # Check if any version of the requested package is installed inst_pkgs = is_installed(module, repoq, name, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True) if inst_pkgs: (cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(inst_pkgs[0]) compare = compareEVR((cur_epoch, cur_ver, cur_rel), (epoch, ver, rel)) if compare > 0: downgrade_candidate = True else: downgrade_candidate = False break # If package needs to be installed/upgraded/downgraded, then pass in the spec # we could get here if nothing provides it but that's not # the error we're catching here pkg = spec if downgrade_candidate: downgrade_pkgs.append(pkg) else: pkgs.append(pkg) if downgrade_pkgs: res = exec_install(module, items, 'downgrade', downgrade_pkgs, res, yum_basecmd, tempdir) if pkgs: cmd = yum_basecmd + ['install'] + pkgs if module.check_mode: # Remove rpms downloaded for EL5 via url try: shutil.rmtree(tempdir) except Exception: e = get_exception() module.fail_json(msg="Failure deleting temp directory %s, %s" % (tempdir, e)) module.exit_json(changed=True, results=res['results'], changes=dict(installed=pkgs)) changed = True lang_env = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C') rc, out, err = module.run_command(cmd, environ_update=lang_env) if (rc == 1): for spec in items: # Fail on invalid urls: if ('://' in spec and ('No package %s available.' % spec in out or 'Cannot open: %s. Skipping.' % spec in err)): module.fail_json(msg='Package at %s could not be installed' % spec, rc=1, changed=False) if (rc != 0 and 'Nothing to do' in err) or 'Nothing to do' in out: # avoid failing in the 'Nothing To Do' case # this may happen with an URL spec. # for an already installed group, # we get rc = 0 and 'Nothing to do' in out, not in err. rc = 0 err = '' out = '%s: Nothing to do' % spec changed = False res['rc'] = rc res['results'].append(out) res['msg'] += err # FIXME - if we did an install - go and check the rpmdb to see if it actually installed # look for each pkg in rpmdb # look for each pkg via obsoletes # Record change res['changed'] = changed # Remove rpms downloaded for EL5 via url try: shutil.rmtree(tempdir) except Exception: e = get_exception() module.fail_json(msg="Failure deleting temp directory %s, %s" % (tempdir, e)) return res
for next in pkgdata[i + 1:]: if not next: if opts.missing: # package missing from this dist, skip # TODO: warn about holes in continuum? missing = "%s %s %s not in next repo" % \ (name, evrstr(curr["evr"]), curr["repo"]) missing_report.append(missing) koji_get_info(name, missing_report, pkg_evr=curr["evr"]) missing_report.append("") continue if compareEVR(curr["evr"], next["evr"]) > 0: # candidate for brokenness if not known_good.has_key(name): known_good[name] = () if (curr["repo"], next["repo"]) not in known_good[name]: # yep, it's broken broken_paths.append((curr, next)) if opts.nextonly: break if broken_paths: if owners: owner = owners.GetOwner(name) or \ 'UNKNOWN OWNER (possibly Core package)' else:
if (variant['OSVersion'] == "7" or variant['OSVersion'] == 'any'): [vp_name, vp_version, vp_release, vp_epoch, vp_arch] = splitFilename(variant['packageFilename']) for package in [ pkg for pkg in pkg_list if pkg.startswith(vp_name) ]: try: [p_name, p_version, p_release, p_arch] = package.split() except: continue if vp_name == p_name: check_version = compareEVR( ("1", vp_version, vp_release), ("1", p_version, p_release)) arch_match = vp_arch == p_arch package_version = check_version > 0 if arch_match and package_version: stripped_vuln_package = package vuln_package.append(stripped_vuln_package) stripped_vuln = vuln stripped_vuln['_source'][ 'affectedPackage'] = variant results.append(stripped_vuln) if not results: print('\nNo vulnerabilities found') packet = [ ZabbixMetric(detect_hostname.rstrip(), 'cve.score', '0') ]
# package missing from this dist, skip continue for next in pkgdata[i+1:]: if not next: if opts.missing: # package missing from this dist, skip # TODO: warn about holes in continuum? missing = "%s %s %s not in next repo" % \ (name, evrstr(curr["evr"]), curr["repo"]) missing_report.append(missing) koji_get_info(name, missing_report, pkg_evr = curr["evr"]) missing_report.append("") continue if compareEVR(curr["evr"], next["evr"]) > 0: # candidate for brokenness if not known_good.has_key(name): known_good[name] = () if (curr["repo"], next["repo"]) not in known_good[name]: # yep, it's broken broken_paths.append((curr, next)) if opts.nextonly: break if broken_paths: if owners: owner = owners.GetOwner(name) or \ 'UNKNOWN OWNER (possibly Core package)' else:
major = "1" search_version = '.'.join([major, str(int(minor) - 1)]) return search_version if __name__ == "__main__": if len(sys.argv) != 2: print ("[ERROR] No NEVRA provided!", sys.stderr) sys.exit(3) input_pkg = sys.argv[1] pkg_name, pkg_version, pkg_release, pkg_epoch, pkg_arch = rpmutils.splitFilename(input_pkg) if any(char.isalpha() for char in pkg_version): print ("[ERROR] Incorrect package nevra format: " + input_pkg, sys.stderr) sys.exit(2) yb = yum.YumBase() # Have to redirect redirect the yum configuration to /dev/null cause we dont want to have any additional output # that configuration prints. eg: `Loaded plugins: amazon-id, rhui-lb` old_stdout = sys.stdout sys.stdout = open(os.devnull, 'w') # Need make sure that all the packages are listed, cause if excluders are enabled for some reason, # listing of origin or docker pkgs will be disabled, based on the enabled excluder. yb.conf.disable_excludes = ["all"] sys.stdout = old_stdout available_pkgs = rpmutils.unique(yb.doPackageLists('available', patterns=[pkg_name], showdups=True).available) search_version = determine_search_version(pkg_name, pkg_version) available_pkgs = remove_duplicate_pkgs(available_pkgs) available_pkgs.sort(lambda x, y: rpmutils.compareEVR((x.epoch, x.version, x.release), (y.epoch, y.version, y.release))) matching_pkgs = get_matching_versions(pkg_name, available_pkgs, search_version) install_version = get_install_version(matching_pkgs) print_version_vars(install_version)
def compare_versions(self, ver1, ver2): '''Compare two package versions. Return -1 for ver < ver2, 0 for ver1 == ver2, and 1 for ver1 > ver2.''' # Used by crashdb.py (i.e. the frontends) return compareEVR(stringToVersion(ver1),stringToVersion(ver2))
rpmPkgs = GetRpmListFromRPM() # here we go. sorry y'all reportArray = {} for node in root: if node.tag == 'meta': continue if not IsAppliable(node, 'os_release', os_release): continue if not IsAppliable(node, 'os_arch', os_arch): continue for pkgLine in node.iter('packages'): pkg = splitFilename(pkgLine.text) if pkg[0] in rpmPkgs: insPkg = rpmPkgs[pkg[0]] insPkg = [insPkg['epoch'], insPkg['version'], insPkg['release']] errPkg = [pkg[3], pkg[1], pkg[2]] if compareEVR(errPkg, insPkg) > 0: if not pkg[0] in reportArray: reportArray[pkg[0]] = [] if ValueInDictList(reportArray[pkg[0]], 'err', node.tag): continue reportArray[pkg[0]].append({ 'err': node.tag, 'severity': node.get('severity'), 'type': node.get('type'), 'description': node.get('description'), 'version': errPkg[1],
def _compareAdvisoryAgainstInst(self,advisory_package,installed_package): return compareEVR( ('', advisory_package['version'], advisory_package['release']), ('', installed_package.version, installed_package.release))
def _compareAdvisoryAgainstInst(self, advisory_package, installed_package): return compareEVR( ('', advisory_package['version'], advisory_package['release']), ('', installed_package.version, installed_package.release))
def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, installroot='/', allow_downgrade=False): pkgs = [] downgrade_pkgs = [] res = {} res['results'] = [] res['msg'] = '' res['rc'] = 0 res['changed'] = False for spec in items: pkg = None downgrade_candidate = False # check if pkgspec is installed (if possible for idempotence) # localpkg if spec.endswith('.rpm') and '://' not in spec: # get the pkg name-v-r.arch if not os.path.exists(spec): res['msg'] += "No RPM file matching '%s' found on system" % spec res['results'].append("No RPM file matching '%s' found on system" % spec) res['rc'] = 127 # Ensure the task fails in with-loop module.fail_json(**res) envra = local_envra(spec) # look for them in the rpmdb if is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): # if they are there, skip it continue pkg = spec # URL elif '://' in spec: # download package so that we can check if it's already installed package = fetch_rpm_from_url(spec, module=module) envra = local_envra(package) if is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): # if it's there, skip it continue pkg = package # groups elif spec.startswith('@'): if is_group_installed(spec): continue pkg = spec # range requires or file-requires or pkgname :( else: # most common case is the pkg is already installed and done # short circuit all the bs - and search for it as a pkg in is_installed # if you find it then we're done if not set(['*', '?']).intersection(set(spec)): installed_pkgs = is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True, installroot=installroot) if installed_pkgs: res['results'].append('%s providing %s is already installed' % (installed_pkgs[0], spec)) continue # look up what pkgs provide this pkglist = what_provides(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot) if not pkglist: res['msg'] += "No package matching '%s' found available, installed or updated" % spec res['results'].append("No package matching '%s' found available, installed or updated" % spec) res['rc'] = 126 # Ensure the task fails in with-loop module.fail_json(**res) # if any of the packages are involved in a transaction, fail now # so that we don't hang on the yum operation later conflicts = transaction_exists(pkglist) if conflicts: res['msg'] += "The following packages have pending transactions: %s" % ", ".join(conflicts) res['rc'] = 125 # Ensure the task fails in with-loop module.fail_json(**res) # if any of them are installed # then nothing to do found = False for this in pkglist: if is_installed(module, repoq, this, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True, installroot=installroot): found = True res['results'].append('%s providing %s is already installed' % (this, spec)) break # if the version of the pkg you have installed is not in ANY repo, but there are # other versions in the repos (both higher and lower) then the previous checks won't work. # so we check one more time. This really only works for pkgname - not for file provides or virt provides # but virt provides should be all caught in what_provides on its own. # highly irritating if not found: if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): found = True res['results'].append('package providing %s is already installed' % (spec)) if found: continue # Downgrade - The yum install command will only install or upgrade to a spec version, it will # not install an older version of an RPM even if specified by the install spec. So we need to # determine if this is a downgrade, and then use the yum downgrade command to install the RPM. if allow_downgrade: for package in pkglist: # Get the NEVRA of the requested package using pkglist instead of spec because pkglist # contains consistently-formatted package names returned by yum, rather than user input # that is often not parsed correctly by splitFilename(). (name, ver, rel, epoch, arch) = splitFilename(package) # Check if any version of the requested package is installed inst_pkgs = is_installed(module, repoq, name, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True) if inst_pkgs: (cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(inst_pkgs[0]) compare = compareEVR((cur_epoch, cur_ver, cur_rel), (epoch, ver, rel)) if compare > 0: downgrade_candidate = True else: downgrade_candidate = False break # If package needs to be installed/upgraded/downgraded, then pass in the spec # we could get here if nothing provides it but that's not # the error we're catching here pkg = spec if downgrade_candidate and allow_downgrade: downgrade_pkgs.append(pkg) else: pkgs.append(pkg) if downgrade_pkgs: res = exec_install(module, items, 'downgrade', downgrade_pkgs, res, yum_basecmd) if pkgs: res = exec_install(module, items, 'install', pkgs, res, yum_basecmd) return res
rpmPkgs = GetRpmListFromRPM() # here we go. sorry y'all reportArray = {} for node in root: if node.tag == 'meta': continue if not IsAppliable( node, 'os_release', os_release ): continue if not IsAppliable( node, 'os_arch', os_arch ): continue for pkgLine in node.iter( 'packages' ): pkg = splitFilename( pkgLine.text ) if pkg[0] in rpmPkgs: insPkg = rpmPkgs[ pkg[0] ] insPkg = [ insPkg['epoch'], insPkg['version'], insPkg['release'] ] errPkg = [ pkg[3], pkg[1], pkg[2] ] if compareEVR( errPkg, insPkg ) > 0: if not pkg[0] in reportArray: reportArray[ pkg[0] ] = [] if ValueInDictList( reportArray[ pkg[0] ], 'err', node.tag ): continue reportArray[ pkg[0] ].append({ 'err': node.tag, 'severity': node.get('severity'), 'type': node.get('type'), 'description': node.get('description'), 'version': errPkg[1], 'release': errPkg[2] }) for i in reportArray: print '\n{} ver. {} rel. {}'.format(i, rpmPkgs[i]['version'], rpmPkgs[i]['release']) for a in reportArray[i]:
def compare_po(po1, po2): return compareEVR((po1.epoch, po1.version, po1.release), (po2.epoch, po2.version, po2.release))
def compare_evr(self, other_package): return compareEVR(('', self.version, self.release), ('', other_package.version, other_package.release))
def compare_evr(self, other_package): return compareEVR( ('', self.version, self.release), ('', other_package.version, other_package.release))