diff options
-rw-r--r-- | portato/backend/package.py | 6 | ||||
-rw-r--r-- | portato/backend/portage/package.py | 22 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 12 | ||||
-rw-r--r-- | portato/gui/gtk/windows.py | 24 |
4 files changed, 38 insertions, 26 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py index 4d84e90..8df7dae 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -95,7 +95,7 @@ class Package (_Package): @return: list of flags @rtype: string[]""" - i_flags = self.get_global_settings("USE").split() + i_flags = self.get_global_settings("USE", installed = False).split() for f in self.get_new_use_flags(): if f[0] == '-': @@ -311,11 +311,13 @@ class Package (_Package): raise NotImplementedError - def get_global_settings(self, key): + def get_global_settings(self, key, installed = True): """Returns the value of a global setting, i.e. ARCH, USE, ROOT, DISTDIR etc. @param key: the setting to return @type key: string + @param installed: get the installed settings or the ebuild settings + @type installed: boolean @returns: the value of this setting @rtype: string""" diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index bc157cf..0c8e5f1 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -35,13 +35,14 @@ class PortagePackage (Package): Package.__init__(self, cpv) self._settings = system.settings self._settingslock = system.settings.settingslock + self._settings_installed = None self._trees = system.settings.trees self.forced_flags = set() with self._settingslock: - self._settings.settings.setcpv(self._cpv) + self._init_settings(True) self.forced_flags.update(self._settings.settings.usemask) self.forced_flags.update(self._settings.settings.useforce) @@ -52,6 +53,21 @@ class PortagePackage (Package): if self._status and len(self._status) == 1 and self._status[0] == "corrupted": self._status = None + + def _init_settings (self, installed): + inst = installed and self.is_installed() + + if self._settings_installed is not None and self._settings_installed != inst: + self._settings.settings.reset() + + self._settings_installed = inst + + if inst: + dbapi = self._settings.vartree.dbapi + else: + dbapi = self._settings.porttree.dbapi + + self._settings.settings.setcpv(self.get_cpv(), mydb = dbapi) def is_installed(self): return self._settings.vartree.dbapi.cpv_exists(self._cpv) @@ -237,9 +253,9 @@ class PortagePackage (Package): return dep_pkgs - def get_global_settings(self, key): + def get_global_settings(self, key, installed = True): with self._settingslock: - self._settings.settings.setcpv(self._cpv) + self._init_settings(installed) v = self._settings.settings[key] return v diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index d4f4aef..77004a7 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -368,14 +368,14 @@ class PortageSystem (SystemInterface): # append system packages packages.extend(unique_array([p.get_cp() for p in self.find_all_system_packages()])) - states = [(["RDEPEND","PDEPEND"],True), (["DEPEND"], False)] + states = [(["RDEPEND","PDEPEND"],True)]#, (["DEPEND"], False)] if self.with_bdeps(): states[1] = (["DEPEND"], True) checked = [] updating = [] raw_checked = {} - def check (p, add_not_installed = True): + def check (p, add_not_installed = True, prev_appended = False): """Checks whether a package is updated or not.""" if p.get_slot_cp() in checked: @@ -426,7 +426,11 @@ class PortageSystem (SystemInterface): appended = True if deep or tempDeep: - for state in states: + if (appended or prev_appended) and len(states) < 2: + real_states = states + [("DEPEND", False)] + else: + real_states = states + for state in real_states: for i in p.get_matched_dep_packages(state[0]): if i not in raw_checked or raw_checked[i] == False: raw_checked.update({i : state[1]}) @@ -436,7 +440,7 @@ class PortageSystem (SystemInterface): else: for pkg in bm: if not pkg: continue - check(pkg, state[1]) + check(pkg, state[1], appended) for p in self.get_new_packages(packages): if not p: continue # if a masked package is installed we have "None" here diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index 7ab564c..485f123 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -472,7 +472,8 @@ class PackageTable: def fill_use_list(self): pkg = self.actual_package() - pkg_flags = flags.sort_use_flag_list(pkg.get_iuse_flags(keep = True)) + pkg_flags = pkg.get_iuse_flags() + pkg_flags.sort() actual_exp = None actual_exp_it = None @@ -483,12 +484,6 @@ class PackageTable: store = self.useList.get_model() for use in pkg_flags: - if use.startswith(("+","-")): - forced = (use[0] == "+") - use = use[1:] - else: - forced = None - exp = pkg.use_expanded(use, suggest = actual_exp) if exp is not None: if exp != actual_exp: @@ -498,7 +493,7 @@ class PackageTable: actual_exp_it = None actual_exp = None - enabled = forced or use in euse + enabled = use in euse installed = use in instuse store.append(actual_exp_it, [enabled, installed, use, system.get_use_desc(use, self.cp)]) @@ -1152,7 +1147,8 @@ class MainWindow (Window): disabled = [] expanded = set() - pkg_flags = flags.sort_use_flag_list(pkg.get_iuse_flags(keep = True)) + pkg_flags = pkg.get_iuse_flags() + pkg_flags.sort() if not pkg_flags: # no flags - stop here return None @@ -1168,21 +1164,15 @@ class MainWindow (Window): installed = [] for use in pkg_flags: - if use.startswith(("+","-")): - forced = (use[0] == "+") - use = use[1:] - else: - forced = None - exp = pkg.use_expanded(use) if exp: expanded.add(exp) else: useStr = use - if installed and ((use in actual) != (use in installed)) and not (forced == (use in installed)): + if installed and ((use in actual) != (use in installed)): useStr += " %" - if use in actual or forced: + if use in actual: enabled.append(useStr) else: disabled.append(useStr) |