Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 937440 Details for
Bug 1141634
dnf.Base.query.filter() segfaults
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
minimal dnf base class
base.py (text/plain), 4.46 KB, created by
Tim Lauridsen
on 2014-09-15 05:22:00 UTC
(
hide
)
Description:
minimal dnf base class
Filename:
MIME Type:
Creator:
Tim Lauridsen
Created:
2014-09-15 05:22:00 UTC
Size:
4.46 KB
patch
obsolete
>from __future__ import print_function >from __future__ import absolute_import > >from time import time > >import dnf >import dnf.yum >import dnf.const >import dnf.conf >import dnf.subject > > >class Packages: > ''' > Get access to packages in the dnf (hawkey) sack in an easy way > ''' > > def __init__(self, base): > self._base = base > self._sack = base.sack > self._inst_na = self._sack.query().installed().na_dict() > > def _filter_packages(self, pkg_list, replace=True): > ''' > Filter a list of package objects and replace > the installed ones with the installed object, instead > of the available object > ''' > pkgs = [] > for pkg in pkg_list: > key = (pkg.name, pkg.arch) > inst_pkg = self._inst_na.get(key, [None])[0] > if inst_pkg and inst_pkg.evr == pkg.evr: > if replace: > pkgs.append(inst_pkg) > else: > pkgs.append(pkg) > return pkgs > > > @property > def query(self): > ''' > Get the query object from the current sack > ''' > return self._sack.query() > > @property > def installed(self): > ''' > get installed packages > ''' > return self.query.installed().run() > > @property > def updates(self): > ''' > get available updates > ''' > return self.query.upgrades().run() > > > @property > def all(self,showdups = False): > ''' > all packages in the repositories > installed ones are replace with the install package objects > ''' > if showdups: > return self._filter_packages(self.query.available().run()) > else: > return self._filter_packages(self.query.latest().run()) > > @property > def available(self, showdups = False): > ''' > available packages there is not installed yet > ''' > if showdups: > return self._filter_packages(self.query.available().run(), replace=False) > else: > return self._filter_packages(self.query.latest().run(), replace=False) > > @property > def extras(self): > ''' > installed packages, not in current repos > ''' > # anything installed but not in a repo is an extra > avail_dict = self.query.available().pkgtup_dict() > inst_dict = self.query.installed().pkgtup_dict() > pkgs = [] > for pkgtup in inst_dict: > if pkgtup not in avail_dict: > pkgs.extend(inst_dict[pkgtup]) > return pkgs > > @property > def obsoletes(self): > ''' > packages there is obsoleting some installed packages > ''' > inst = self.query.installed() > return self.query.filter(obsoletes=inst) > > @property > def recent(self, showdups=False): > ''' > Get the recent packages > ''' > recent = [] > now = time() > recentlimit = now-(self._base.conf.recent*86400) > if showdups: > avail = self.query.available() > else: > avail = self.query.latest() > for po in avail: > if int(po.buildtime) > recentlimit: > recent.append(po) > return recent > > >class DnfBase(dnf.Base): > ''' > class to encapsulate and extend the dnf.Base API > ''' > > def __init__(self, setup_sack=True): > dnf.Base.__init__(self) > # setup the dnf cache > self.setup_cache() > # read the repository infomation > self.read_all_repos() > if setup_sack: > # populate the dnf sack > self.fill_sack() > self._packages = Packages(self) # Define a Packages object > > def setup_base(self): > self.fill_sack() > self._packages = Packages(self) # Define a Packages object > > @property > def packages(self): > ''' property to get easy acceess to packages''' > return self._packages > > def cachedir_fit(self): > conf = self.conf > subst = conf.substitutions > # this is not public API, same procedure as dnf cli > suffix = dnf.conf.parser.substitute(dnf.const.CACHEDIR_SUFFIX, subst) > cli_cache = dnf.conf.CliCache(conf.cachedir, suffix) > return cli_cache.cachedir, cli_cache.system_cachedir > > def setup_cache(self): > """Setup the dnf cache, same as dnf cli""" > conf = self.conf > conf.substitutions['releasever'] = dnf.rpm.detect_releasever('/') > conf.cachedir, self._system_cachedir = self.cachedir_fit() > print("cachedir: %s", conf.cachedir)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1141634
:
937429
|
937430
|
937431
|
937432
|
937433
|
937434
|
937435
|
937436
|
937437
|
937438
|
937439
|
937440
|
937441
|
937445