def cmpNEVR(nevr1, nevr2): '''Compare two RPM version identifiers in NEVR format. :param str nevr1: RPM identifier in N(E)VR format :param str nevr2: RPM identifier in N(E)VR format :return: ``-1``/``0``/``1`` if ``nevr1 < nevr2`` / ``nevr1 == nevr2`` / ``nevr1 > nevr2`` :rtype: int :raise CheckbValueError: if name in ``nevr1`` doesn't match name in ``nevr2`` ''' rpmver1 = hawkey.split_nevra(nevr1 + '.noarch') rpmver2 = hawkey.split_nevra(nevr2 + '.noarch') if rpmver1.name != rpmver2.name: raise exc.CheckbValueError("Name in nevr1 doesn't match name in " "nevr2: %s, %s" % (nevr1, nevr2)) # sack is needed for the comparison, because it can be influence the # comparison (for example epoch can be set to be ignored). A default empty # sack should match Fedora customs sack = hawkey.Sack() # we need evr_cmp to return int so we can use it as comparison function # in python's sorted return int(rpmver1.evr_cmp(rpmver2, sack))
def test_evr_cmp(self): sack = hawkey.Sack() n1 = hawkey.split_nevra("jay-3:3.10-4.fc3.x86_64") n2 = hawkey.split_nevra("jay-4.10-4.fc3.x86_64") self.assertGreater(n1.evr_cmp(n2, sack), 0) self.assertLess(n2.evr_cmp(n1, sack), 0) n1 = hawkey.split_nevra("jay-3.10-4.fc3.x86_64") n2 = hawkey.split_nevra("jay-3.10-5.fc3.x86_64") self.assertLess(n1.evr_cmp(n2, sack), 0)
def sack_has_nevra_greater_or_equal(base, nevra): nevra = hawkey.split_nevra(nevra) pkgs = base.sack.query().filterm(name=nevra.name).latest().run() if len(pkgs) == 0: # Odd... the only way I can imagine this happen is if we fast-track a # brand new package from Koji which hasn't hit the updates repo yet. # Corner-case, but let's be nice. print(f"couldn't find package {nevra.name}; assuming not graduated") return False nevra_latest = hawkey.split_nevra(str(pkgs[0])) return nevra_latest >= nevra
def read_dump_file(filename): if filename.endswith(".gz"): fobj = gzip.GzipFile(filename) else: fobj = open(filename) if ucd(fobj.readline()) != DEBUG_VERSION: logger.error(_("Bad dnf debug file: %s"), filename) raise dnf.exceptions.Error skip = True pkgs = {} for line in fobj: line = ucd(line) if skip: if line == "%%%%RPMDB\n": skip = False continue if not line or line[0] != " ": break pkg_spec = line.strip() nevra = hawkey.split_nevra(pkg_spec) pkgs[(nevra.name, nevra.arch)] = [ "install", ucd(nevra.name), ucd(nevra.arch), ucd(nevra.epoch), ucd(nevra.version), ucd(nevra.release) ] return pkgs
def read_dump_file(filename): if filename.endswith(".gz"): fobj = gzip.GzipFile(filename) else: fobj = open(filename) if ucd(fobj.readline()) != DEBUG_VERSION: dnfpluginsextras.logger.error(_("Bad dnf debug file: %s"), filename) raise dnf.exceptions.Error skip = True pkgs = {} for line in fobj: line = ucd(line) if skip: if line == "%%%%RPMDB\n": skip = False continue if not line or line[0] != " ": break pkg_spec = line.strip() nevra = hawkey.split_nevra(pkg_spec) pkgs[(nevra.name, nevra.arch)] = ["install", ucd(nevra.name), ucd(nevra.arch), ucd(nevra.epoch), ucd(nevra.version), ucd(nevra.release)] return pkgs
def _create_package_matcher(self, nevra_str): """Create a new instance of dnf.package.Package matcher.""" nevra = split_nevra(nevra_str) attrs = {'name': nevra.name, 'epoch': nevra.epoch, 'version': nevra.version, 'release': nevra.release, 'arch': nevra.arch} return ObjectMatcher(Package, attrs)
def __init__(self, nevra, repo=None): self.header = None self.location = "%s.rpm" % nevra self.baseurl = None self.repo = repo self.reponame = None if repo is None else repo.id self.str = nevra (self.name, self.epoch, self.version, self.release, self.arch) = hawkey.split_nevra(nevra) self.evr = "%(epoch)d:%(version)s-%(release)s" % vars(self) self.pkgtup = (self.name, self.arch, str(self.epoch), self.version, self.release)
def test_split_nevra(self): self.assertRaises(hawkey.ValueException, hawkey.split_nevra, "no.go") self.assertRaises(hawkey.ValueException, hawkey.split_nevra, "") nevra = hawkey.split_nevra("eyes-8:1.2.3-4.fc18.x86_64") self.assertEqual(nevra.name, "eyes") self.assertEqual(nevra.epoch, 8) self.assertEqual(nevra.version, "1.2.3") self.assertEqual(nevra.release, "4.fc18") self.assertEqual(nevra.arch, "x86_64")
def _get_query_source(self, pkg_spec): """"Return a query to match a source rpm file name.""" pkg_spec = pkg_spec[:-4] # skip the .rpm nevra = hawkey.split_nevra(pkg_spec) q = self.base.sack.query() q = q.available() q = q.latest() q = q.filter(name=nevra.name, version=nevra.version, release=nevra.release, arch=nevra.arch) return q
def test_cmp(self): pkg2 = base.by_name_repo(self.sack, "fool", "main") # if nevra matches the packages are equal: self.assertEqual(self.pkg1, pkg2) # if the name doesn't match they are not equal: pkg2 = base.by_name_repo(self.sack, "hello", "main") self.assertNotEqual(self.pkg1, pkg2) # if nevr matches, but not arch, they are not equal: pkg1 = hawkey.split_nevra("semolina-2-0.x86_64").to_query(self.sack)[0] pkg2 = hawkey.split_nevra("semolina-2-0.i686").to_query(self.sack)[0] self.assertNotEqual(pkg1, pkg2) # however evr_cmp compares only the evr part: self.assertEqual(pkg1.evr_cmp(pkg2), 0) pkg1 = hawkey.split_nevra("jay-6.0-0.x86_64").to_query(self.sack)[0] pkg2 = hawkey.split_nevra("jay-5.0-0.x86_64").to_query(self.sack)[0] self.assertLess(pkg2, pkg1) self.assertGreater(pkg1.evr_cmp(pkg2), 0)
def nevra(self, *args): args_len = len(args) if args_len == 3: return self.filter(name=args[0], evr=args[1], arch=args[2]) if args_len == 1: nevra = hawkey.split_nevra(args[0]) elif args_len == 5: nevra = args else: raise TypeError("nevra() takes 1, 3 or 5 str params") return self.filter( name=nevra.name, epoch=nevra.epoch, version=nevra.version, release=nevra.release, arch=nevra.arch)
def _get_query_source(self, pkg_spec): """Return a query to match a source rpm file name.""" pkg_spec = pkg_spec[:-4] # skip the .rpm nevra = hawkey.split_nevra(pkg_spec) q = self.base.sack.query() q = q.available() q = q.latest() q = q.filter(name=nevra.name, version=nevra.version, release=nevra.release, arch=nevra.arch) if len(q.run()) == 0: msg = _("No package " + pkg_spec + " available.") raise dnf.exceptions.PackageNotFoundError(msg) return q
def nevra(self, *args): args_len = len(args) if args_len == 3: return self.filter(name=args[0], evr=args[1], arch=args[2]) if args_len == 1: nevra = hawkey.split_nevra(args[0]) elif args_len == 5: nevra = args else: raise TypeError("nevra() takes 1, 3 or 5 str params") return self.filter( name=nevra.name, epoch=nevra.epoch, version=nevra.version, release=nevra.release, arch=nevra.arch )
def __init__(self, nevra, repo=None): self.baseurl = None self.chksum = (None, None) self.downloadsize = None self.header = None self.location = '%s.rpm' % nevra self.repo = repo self.reponame = None if repo is None else repo.id self.str = nevra (self.name, self.epoch, self.version, self.release, self.arch) = \ hawkey.split_nevra(nevra) self.evr = '%(epoch)d:%(version)s-%(release)s' % vars(self) self.pkgtup = (self.name, self.arch, str(self.epoch), self.version, self.release)
def _get_query_source(self, pkg_spec): """Return a query to match a source rpm file name.""" pkg_spec = pkg_spec[:-4] # skip the .rpm nevra = hawkey.split_nevra(pkg_spec) q = self.base.sack.query() q = q.available() q = q.latest() q = q.filter(name=nevra.name, version=nevra.version, release=nevra.release, arch=nevra.arch) if len(q.run()) == 0: msg = _("No package %s available.") % (pkg_spec) raise dnf.exceptions.PackageNotFoundError(msg) return q
def _match(ent, patterns): try: n = hawkey.split_nevra(ent) except hawkey.ValueException: return False for name in ( '%s' % n.name, '%s.%s' % (n.name, n.arch), '%s-%s' % (n.name, n.version), '%s-%s-%s' % (n.name, n.version, n.release), '%s-%s-%s.%s' % (n.name, n.version, n.release, n.arch), '%s:%s-%s-%s.%s' % (n.epoch, n.name, n.version, n.release, n.arch), '%s-%s:%s-%s.%s' % (n.name, n.epoch, n.version, n.release, n.arch), ): for pat in patterns: if fnmatch.fnmatch(name, pat): return True return False
def map_installed_rpms_to_modules(): """ Map installed modular packages to the module streams they come from. """ modules = get_modules() # empty on RHEL 7 because of no modules if not modules: return {} # create a reverse mapping from the RPMS to module streams # key: tuple of 4 strings representing a NVRA (name, version, release, arch) of an RPM # value: tuple of 2 strings representing a module and its stream rpm_streams = {} for module in modules: for rpm in module.getArtifacts(): nevra = hawkey.split_nevra(rpm) rpm_key = (nevra.name, nevra.version, nevra.release, nevra.arch) rpm_streams[rpm_key] = (module.getName(), module.getStream()) return rpm_streams
def _match(ent, patterns): try: n = hawkey.split_nevra(ent.lstrip('!')) except hawkey.ValueException: return False for name in ( '%s' % n.name, '%s.%s' % (n.name, n.arch), '%s-%s' % (n.name, n.version), '%s-%s-%s' % (n.name, n.version, n.release), '%s-%s-%s.%s' % (n.name, n.version, n.release, n.arch), '%s:%s-%s-%s.%s' % (n.epoch, n.name, n.version, n.release, n.arch), '%s-%s:%s-%s.%s' % (n.name, n.epoch, n.version, n.release, n.arch), ): for pat in patterns: if fnmatch.fnmatch(name, pat): return True return False
def test_evr_cmp(self): sack = hawkey.Sack() n1 = hawkey.split_nevra("jay-3:3.10-4.fc3.x86_64") n2 = hawkey.split_nevra("jay-4.10-4.fc3.x86_64") self.assertGreater(n1.evr_cmp(n2, sack), 0) self.assertLess(n2.evr_cmp(n1, sack), 0) n1 = hawkey.split_nevra("jay-3.10-4.fc3.x86_64") n2 = hawkey.split_nevra("jay-3.10-5.fc3.x86_64") self.assertLess(n1.evr_cmp(n2, sack), 0) n1 = hawkey.split_nevra('pungi-4.0.14-3.fc24.src') n2 = hawkey.split_nevra('pungi-4.0.7-1.fc24.src') self.assertFalse(n1 < n2)
def run(self, args): if self.opts.help_cmd: print(self.parser.format_help()) return reponame = self.opts.py3query_repo self.base_query = self.base.sack.query() self.pkg_query = self.base_query.filter(reponame=reponame) self.src_query = self.base_query.filter(reponame=reponame + '-source').filter(arch=['src']) # python_versions: {package: set of Python versions} python_versions = collections.defaultdict(set) # rpm_pydeps: {package: set of dep names} rpm_pydeps = collections.defaultdict(set) # dep_versions: {dep name: Python version} dep_versions = collections.defaultdict(set) for n, seeds in SEED_PACKAGES.items(): provides = sorted(self.all_provides(reponame, seeds), key=str) # This effectively includes packages that still need # Python 3.4 while Rawhide only provides Python 3.5 provides += sorted(seeds) for dep in progressbar(provides, 'Getting py{} requires'.format(n)): dep_versions[str(dep)] = n for pkg in self.whatrequires(dep): python_versions[pkg].add(n) rpm_pydeps[pkg].add(str(dep)) # srpm_names: {package: srpm name} # by_srpm_name: {srpm name: set of packages} srpm_names = {} by_srpm_name = collections.defaultdict(set) for pkg in progressbar(python_versions.keys(), 'Getting SRPMs'): srpm_name = hawkey.split_nevra(pkg.sourcerpm).name srpm_names[pkg] = srpm_name by_srpm_name[srpm_name].add(pkg) # deps_of_pkg: {package: set of packages} deps_of_pkg = collections.defaultdict(set) all_provides = {str(r): r for p in python_versions for r in p.provides if not str(r).startswith(PROVIDES_BLACKLIST)} for pkg in progressbar(sorted(python_versions.keys()), 'Getting requirements'): reqs = set() for provide in pkg.provides: reqs.update(self.whatrequires(provide)) for req in reqs: if req in python_versions.keys(): deps_of_pkg[req].add(pkg) # deps_of_pkg: {srpm name: info} json_output = dict() for name in progressbar(by_srpm_name, 'Generating output'): pkgs = sorted(by_srpm_name[name]) r = json_output[name] = {} set_status(r, pkgs, python_versions) r['rpms'] = {format_rpm_name(p): {str(d): dep_versions[d] for d in rpm_pydeps[p]} for p in pkgs} r['deps'] = sorted(set(srpm_names[d] for p in pkgs for d in deps_of_pkg.get(p, '') if srpm_names[d] != name)) # add Bugzilla links if self.opts.fetch_bugzilla: bar = iter(progressbar(['connecting', 'tracker', 'individual'], 'Getting bugs')) next(bar) bz = bugzilla.RHBugzilla(BUGZILLA_URL) next(bar) include_fields = ['id', 'depends_on', 'blocks', 'component', 'status', 'resolution'] trackers = bz.getbugs(TRACKER_BUG_IDS, include_fields=include_fields) all_ids = [b for t in trackers for b in t.depends_on] next(bar) bugs = bz.getbugs(all_ids, include_fields=include_fields) bar.close() def bug_namegetter(bug): return '{bug.id} {bug.status} {bug.component}'.format(bug=bug) for bug in progressbar(bugs, 'Merging bugs', namegetter=bug_namegetter): r = json_output.get(bug.component, {}) url = '{bug.weburl}#{bug.status}'.format(bug=bug) status = bug.status if bug.resolution: status += ' ' + bug.resolution r.setdefault('links', {})['bug'] = [bug.weburl, status] inprogress_statuses = ('ASSIGNED', 'POST', 'MODIFIED', 'ON_QA') inprogress_resolutions = ('CURRENTRELEASE', 'RAWHIDE', 'ERRATA', 'NEXTRELEASE') if r.get('status') == 'idle' and bug.status != 'NEW': r['status'] = 'in-progress' elif r.get('status') == 'idle' and bug.status == 'NEW' and \ any(tb in bug.blocks for tb in MISPACKAGED_TRACKER_BUG_IDS): r['status'] = "mispackaged" r['note'] = ('There is a problem in Fedora packaging, ' + 'not necessarily with the software itself. ' + 'See the linked Fedora bug.') # Print out output if self.opts.output: with open(self.opts.output, 'w') as f: json.dump(json_output, f, indent=2, sort_keys=True) else: json.dump(json_output, sys.stdout, indent=2, sort_keys=True) sys.stdout.flush()
def test_nevra_to_query(self): nevra = hawkey.split_nevra("baby-6:5.0-11.x86_64") q = nevra.to_query(self.sack) self.assertLength(q, 1) pkg = str(q[0]) self.assertEqual(pkg, "baby-6:5.0-11.x86_64")
def run(self, args): if self.opts.help_cmd: print(self.parser.format_help()) return self.base_query = self.base.sack.query() self.pkg_query = self.base_query.filter(reponame='rawhide') self.src_query = self.base_query.filter(reponame='rawhide-source').filter(arch=['src']) # python_versions: {package: set of Python versions} python_versions = collections.defaultdict(set) # rpm_pydeps: {package: set of dep names} rpm_pydeps = collections.defaultdict(set) # dep_versions: {dep name: Python version} dep_versions = collections.defaultdict(set) for n, seeds in SEED_PACKAGES.items(): provides = sorted(self.all_provides(seeds), key=str) # This effectively includes packages that still need # Python 3.4 while Rawhide only provides Python 3.5 provides += sorted(seeds) for dep in progressbar(provides, 'Getting py{} requires'.format(n)): dep_versions[str(dep)] = n for pkg in self.whatrequires(dep): python_versions[pkg].add(n) rpm_pydeps[pkg].add(str(dep)) # srpm_names: {package: srpm name} # by_srpm_name: {srpm name: set of packages} srpm_names = {} by_srpm_name = collections.defaultdict(set) for pkg in progressbar(python_versions.keys(), 'Getting SRPMs'): srpm_name = hawkey.split_nevra(pkg.sourcerpm).name srpm_names[pkg] = srpm_name by_srpm_name[srpm_name].add(pkg) # deps_of_pkg: {package: set of packages} deps_of_pkg = collections.defaultdict(set) all_provides = {str(r): r for p in python_versions for r in p.provides if not str(r).startswith(PROVIDES_BLACKLIST)} for pkg in progressbar(sorted(python_versions.keys()), 'Getting requirements'): reqs = set() for provide in pkg.provides: reqs.update(self.whatrequires(provide)) for req in reqs: if req in python_versions.keys(): deps_of_pkg[req].add(pkg) # deps_of_pkg: {srpm name: info} json_output = dict() for name in progressbar(by_srpm_name, 'Generating output'): pkgs = sorted(by_srpm_name[name]) r = json_output[name] = {} if is_ported(pkgs, python_versions): r['status'] = 'released' else: r['status'] = 'idle' r['rpms'] = {format_rpm_name(p): {str(d): dep_versions[d] for d in rpm_pydeps[p]} for p in pkgs} r['deps'] = sorted(set(srpm_names[d] for p in pkgs for d in deps_of_pkg.get(p, '') if srpm_names[d] != name)) if self.opts.output: with open(self.opts.output, 'w') as f: json.dump(json_output, f, indent=2, sort_keys=True) else: json.dump(json_output, sys.stdout, indent=2, sort_keys=True) sys.stdout.flush()
def is_nevra(pattern): try: hawkey.split_nevra(pattern) except hawkey.ValueException: return False return True
def available_by_nevra(sack, pattern): try: installed = hawkey.split_nevra(pattern).to_query(sack) except hawkey.ValueException: return sack.query().filter(empty=True) return installed.filter(reponame__neq=hawkey.SYSTEM_REPO_NAME)
def rpmformat(rpmstr, fmt='nvr', end_arch=False): ''' Parse and convert an RPM package version string into a different format. String identifiers: N - name, E - epoch, V - version, R - release, A - architecture. :param str rpmstr: string to be manipulated in a format of N(E)VR (``foo-1.2-3.fc20`` or ``bar-4:1.2-3.fc20``) or N(E)VRA (``foo-1.2-3.fc20.x86_64`` or ``bar-4:1.2-3.fc20.i686``) :param str fmt: desired format of the string to be returned. Allowed options are: ``nvr``, ``nevr``, ``nvra``, ``nevra``, ``n``, ``e``, ``v``, ``r``, ``a``. If arch is not present in ``rpmstr`` but requested in ``fmt``, ``noarch`` is used. Epoch is provided only when specifically requested (e.g. ``fmt='nevr'``) **and** being non-zero; otherwise it's supressed (the only exception is ``fmt='e'``, where you receive ``0`` for zero epoch). :param bool end_arch: set this to ``True`` if ``rpmstr`` ends with an architecture identifier (``foo-1.2-3.fc20.x86_64``). It's not possible to reliably distinguish that case automatically. :return: string based on the specified format, or integer if ``fmt='e'`` :raise CheckbValueError: if ``fmt`` value is not supported ''' fmt = fmt.lower() supported_formats = [ 'nvr', 'nevr', 'nvra', 'nevra', 'n', 'e', 'v', 'r', 'a' ] if fmt not in supported_formats: raise exc.CheckbValueError("Format '%s' not in supported formats " "(%s)" % (fmt, ', '.join(supported_formats))) # add arch if not present if not end_arch: rpmstr += '.noarch' # split rpmstr nevra = hawkey.split_nevra(rpmstr) # return simple fmt if len(fmt) == 1: return { 'n': nevra.name, 'e': nevra.epoch, 'v': nevra.version, 'r': nevra.release, 'a': nevra.arch }[fmt] # return complex fmt evr = nevra.evr() # supress epoch if appropriate if 'e' not in fmt or nevra.epoch == 0: evr = evr[evr.find(':') + 1:] # remove 'epoch:' from the beginning result = '%s-%s' % (nevra.name, evr) # append arch if requested if 'a' in fmt: result += '.' + nevra.arch return result
def run(self, args): if self.opts.help_cmd: print(self.parser.format_help()) return reponame = self.opts.py3query_repo self.base_query = self.base.sack.query() self.pkg_query = self.base_query.filter(reponame=reponame) self.src_query = self.base_query.filter(reponame=reponame + '-source').filter(arch=['src']) # python_versions: {package: set of Python versions} python_versions = collections.defaultdict(set) # rpm_pydeps: {package: set of dep names} rpm_pydeps = collections.defaultdict(set) # dep_versions: {dep name: Python version} dep_versions = collections.defaultdict(set) for n, seeds in SEED_PACKAGES.items(): provides = sorted(self.all_provides(reponame, seeds), key=str) # This effectively includes packages that still need # Python 3.4 while Rawhide only provides Python 3.5 provides += sorted(seeds) for dep in progressbar(provides, 'Getting py{} requires'.format(n)): dep_versions[str(dep)] = n for pkg in self.whatrequires(dep): python_versions[pkg].add(n) rpm_pydeps[pkg].add(str(dep)) # srpm_names: {package: srpm name} # by_srpm_name: {srpm name: set of packages} srpm_names = {} by_srpm_name = collections.defaultdict(set) for pkg in progressbar(python_versions.keys(), 'Getting SRPMs'): srpm_name = hawkey.split_nevra(pkg.sourcerpm).name srpm_names[pkg] = srpm_name by_srpm_name[srpm_name].add(pkg) # deps_of_pkg: {package: set of packages} deps_of_pkg = collections.defaultdict(set) all_provides = { str(r): r for p in python_versions for r in p.provides if not str(r).startswith(PROVIDES_BLACKLIST) } for pkg in progressbar(sorted(python_versions.keys()), 'Getting requirements'): reqs = set() for provide in pkg.provides: reqs.update(self.whatrequires(provide)) for req in reqs: if req in python_versions.keys(): deps_of_pkg[req].add(pkg) # deps_of_pkg: {srpm name: info} json_output = dict() for name in progressbar(by_srpm_name, 'Generating output'): pkgs = sorted(by_srpm_name[name]) r = json_output[name] = {} set_status(r, pkgs, python_versions) r['rpms'] = { format_rpm_name(p): {str(d): dep_versions[d] for d in rpm_pydeps[p]} for p in pkgs } r['deps'] = sorted( set(srpm_names[d] for p in pkgs for d in deps_of_pkg.get(p, '') if srpm_names[d] != name)) # add Bugzilla links if self.opts.fetch_bugzilla: bar = iter( progressbar(['connecting', 'tracker', 'individual'], 'Getting bugs')) next(bar) bz = bugzilla.RHBugzilla(BUGZILLA_URL) next(bar) include_fields = [ 'id', 'depends_on', 'blocks', 'component', 'status', 'resolution' ] trackers = bz.getbugs(TRACKER_BUG_IDS, include_fields=include_fields) all_ids = [b for t in trackers for b in t.depends_on] next(bar) bugs = bz.getbugs(all_ids, include_fields=include_fields) bar.close() def bug_namegetter(bug): return '{bug.id} {bug.status} {bug.component}'.format(bug=bug) for bug in progressbar(bugs, 'Merging bugs', namegetter=bug_namegetter): r = json_output.get(bug.component, {}) url = '{bug.weburl}#{bug.status}'.format(bug=bug) status = bug.status if bug.resolution: status += ' ' + bug.resolution r.setdefault('links', {})['bug'] = [bug.weburl, status] inprogress_statuses = ('ASSIGNED', 'POST', 'MODIFIED', 'ON_QA') inprogress_resolutions = ('CURRENTRELEASE', 'RAWHIDE', 'ERRATA', 'NEXTRELEASE') if r.get('status') == 'idle' and bug.status != 'NEW': r['status'] = 'in-progress' elif r.get('status') == 'idle' and bug.status == 'NEW' and \ any(tb in bug.blocks for tb in MISPACKAGED_TRACKER_BUG_IDS): r['status'] = "mispackaged" r['note'] = ('There is a problem in Fedora packaging, ' + 'not necessarily with the software itself. ' + 'See the linked Fedora bug.') # Print out output if self.opts.output: with open(self.opts.output, 'w') as f: json.dump(json_output, f, indent=2, sort_keys=True) else: json.dump(json_output, sys.stdout, indent=2, sort_keys=True) sys.stdout.flush()
def get_srpm_name(pkg): return hawkey.split_nevra(pkg.sourcerpm).name if pkg.sourcerpm else pkg.name