summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-05-21 20:19:41 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-05-21 20:19:41 +0200
commitadb8acd0b90992a8281494c76d30a529bde45fea (patch)
tree568be900b3d4eab14422147f099536cc2ede9c57 /portato/backend
parent6337bce4fd5ca7a7e7c16602fe7136bd6fdf4786 (diff)
downloadportato-adb8acd0b90992a8281494c76d30a529bde45fea.tar.gz
portato-adb8acd0b90992a8281494c76d30a529bde45fea.tar.bz2
portato-adb8acd0b90992a8281494c76d30a529bde45fea.zip
Ported package
Diffstat (limited to '')
-rw-r--r--portato/backend/flags.py2
-rw-r--r--portato/backend/package.py10
-rw-r--r--portato/backend/portage/package.py39
3 files changed, 20 insertions, 31 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index d388e08..018e804 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -677,7 +677,7 @@ def set_testing (pkg, enable):
if (enable and line != "-1") or (not enable and line == "-1"):
newTesting[cpv].remove((file, line))
- if (enable and not pkg.is_testing(use_keywords=True)) or (not enable and pkg.is_testing(use_keywords=True)):
+ if (enable and not pkg.is_testing()) or (not enable and pkg.is_testing()):
return
if not enable:
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 4dc439a..6d73a42 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -88,13 +88,15 @@ class Package (_Package):
if f[0] == "~":
f = f[1:]
removed = True
+
+ invf = flags.invert_use_flag(f)
if f[0] == '-':
- if flags.invert_use_flag(f) in i_flags and not (removed and flags.invert_use_flag(f) in m_flags):
- i_flags.remove(flags.invert_use_flag(f))
+ if invf in i_flags and not (removed and invf in m_flags):
+ i_flags.remove(invf)
elif f not in i_flags:
- if not (removed and flags.invert_use_flag(f) in m_flags):
+ if not (removed and invf in m_flags):
i_flags.append(f)
return i_flags
@@ -270,7 +272,7 @@ class Package (_Package):
raise NotImplementedError
- def is_testing(self, use_keywords = False):
+ def is_testing(self, use_keywords = True):
"""Checks whether a package is marked as testing.
@param use_keywords: Controls whether possible keywords are taken into account or not.
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 37fa230..0452641 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -89,7 +89,7 @@ class PortagePackage (Package):
return self._settings.vartree.dbapi.cpv_exists(self._cpv)
def is_in_overlay(self):
- dir,ovl = self._settings.porttree.dbapi.findname2(self._cpv)
+ ovl = self.get_overlay_path()
return ovl != self._settings.settings["PORTDIR"] and str(ovl) != "0"
def get_overlay_path (self):
@@ -100,23 +100,17 @@ class PortagePackage (Package):
return (self._status != None)
def is_missing_keyword(self):
- if self._status and "missing keyword" in self._status:
- return True
- return False
+ return self._status and "missing keyword" in self._status
- def is_testing(self, use_keywords = False):
+ def is_testing(self, use_keywords = True):
testArch = "~" + self.get_global_settings("ARCH")
if not use_keywords: # keywords are NOT taken into account
- if testArch in self.get_package_settings("KEYWORDS").split():
- return True
- return False
+ return testArch in self.get_package_settings("KEYWORDS").split()
else: # keywords are taken into account
status = flags.new_testing_status(self.get_cpv())
if status is None: # we haven't changed it in any way
- if self._status and testArch+" keyword" in self._status:
- return True
- return False
+ return self._status and testArch+" keyword" in self._status
else:
return status
@@ -130,15 +124,13 @@ class PortagePackage (Package):
else:
error(_("BUG in flags.new_masking_status. It returns \'%s\'"), status)
else: # we have not touched the status
- if self._status and ("profile" in self._status or "package.mask" in self._status):
- return True
- return False
+ return self._status and ("profile" in self._status or "package.mask" in self._status)
+
else: # we want the original portage value XXX: bug if masked by user AND by system
# get the normal masked ones
if self._status and ("profile" in self._status or "package.mask" in self._status):
- if not flags.is_locally_masked(self, changes = False): # assume that if it is locally masked, it is not masked by the system
- return True
+ return flags.is_locally_masked(self, changes = False) # assume that if it is locally masked, it is not masked by the system
else: # more difficult: get the ones we unmasked, but are masked by the system
try:
masked = self._settings.settings.pmaskdict[self.get_cp()]
@@ -147,10 +139,7 @@ class PortagePackage (Package):
for cpv in masked:
if self.matches(cpv):
- if not flags.is_locally_masked(self, changes = False): # assume that if it is locally masked, it is not masked by the system
- return True
- else:
- return False
+ return not flags.is_locally_masked(self, changes = False) # assume that if it is locally masked, it is not masked by the system
return False
@@ -158,7 +147,7 @@ class PortagePackage (Package):
reason = portage.getmaskingreason(self.get_cpv(), settings = self._settings.settings)
if reason:
- return reason[:-1] # strip of last \n
+ return reason.strip()
else:
return reason
@@ -234,9 +223,9 @@ class PortagePackage (Package):
if dep[0] == '!': # blocking sth
dep = dep[1:]
if dep != self.get_cp(): # not cpv, because a version might explicitly block another one
- blocked = system.find_installed_packages(dep)
+ blocked = system.find_packages(dep, "installed", only_cpv = True)
if blocked != []:
- raise BlockedException, (self.get_cpv(), blocked[0].get_cpv())
+ raise BlockedException, (self.get_cpv(), blocked[0])
continue # finished with the blocking one -> next
pkg = system.find_best_match(dep)
@@ -246,10 +235,8 @@ class PortagePackage (Package):
raise PackageNotFoundException, dep
list = system.sort_package_list(list)
- list.reverse()
done = False
- for i in range(len(list)):
- p = list[i]
+ for p in reversed(list):
if not p.is_masked():
dep_pkgs.append(create_dep_pkgs_data(dep, p))
done = True