summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/backend/flags.py2
-rw-r--r--portato/backend/portage/sets.py14
-rw-r--r--portato/db/dict.py2
-rw-r--r--portato/db/sql.py7
-rw-r--r--portato/gui/windows/main.py3
5 files changed, 22 insertions, 6 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index baa1f37..0c3713d 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -411,7 +411,7 @@ def write_use_flags ():
msg += "=%s %s" % (cpv, comb)
else: # add on a per-package-base
list = system.split_cpv(cpv)
- msg += "%s/%s %s" % (list[0], list[1], combine)
+ msg += "%s/%s %s" % (list[0], list[1], comb)
if not file in file_cache:
with open(file, "a") as f:
diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py
index dd8257d..234047b 100644
--- a/portato/backend/portage/sets.py
+++ b/portato/backend/portage/sets.py
@@ -28,7 +28,7 @@ class Set(object):
def find (self, key, masked = False, with_version = True, only_cpv = False):
if key is None: key = ""
- is_regexp = key == "" or ("*" in key and key[0] not in ("*","=","<",">","~","!"))
+ is_regexp = key == "" or ("*" in key[1:] and key[0] not in ("=","<",">","~","!"))
try:
t = self.get_pkgs(key, is_regexp, masked, with_version, only_cpv)
@@ -99,9 +99,12 @@ class InstalledSet (Set):
if key:
t = filter(lambda x: re.search(key, x, re.I), t)
- return set(t)
else:
- return set(system.settings.vartree.dbapi.match(key))
+ t = system.settings.vartree.dbapi.match(key)
+ if not with_version:
+ t = itt.imap(portage.dep.dep_getkey, t)
+
+ return set(t)
class TreeSet (Set):
@@ -115,11 +118,16 @@ class TreeSet (Set):
if key:
t = filter(lambda x: re.search(key, x, re.I), t)
+ return set(t)
+
elif masked:
t = system.settings.porttree.dbapi.xmatch("match-all", key)
else:
t = system.settings.porttree.dbapi.match(key)
+ if not with_version:
+ t = itt.imap(portage.dep.dep_getkey, t)
+
return set(t)
class AllSet (Set):
diff --git a/portato/db/dict.py b/portato/db/dict.py
index f6edea6..4992df6 100644
--- a/portato/db/dict.py
+++ b/portato/db/dict.py
@@ -86,7 +86,7 @@ class DictDatabase (Database):
try:
if self.restrict:
- return (pkg for pkg in get_pkgs() if self.restrict.search(pkg.pkg))#if pkg[1].find(self.restrict) != -1)
+ return (pkg for pkg in get_pkgs() if self.restrict.search(pkg.cat+"/"+pkg.pkg))
else:
return get_pkgs()
diff --git a/portato/db/sql.py b/portato/db/sql.py
index cb252c1..6c95bb3 100644
--- a/portato/db/sql.py
+++ b/portato/db/sql.py
@@ -248,6 +248,11 @@ class SQLDatabase (Database):
self._restrict = ""
else:
restrict = restrict.replace(".*","%").replace(".","_")
- self._restrict = "AND name LIKE '%%%s%%'" % restrict
+
+ if "/" in restrict:
+ cat,pkg = restrict.split("/")
+ self._restrict = "AND name LIKE '%s%%' AND cat LIKE '%s'" % (pkg, cat)
+ else:
+ self._restrict = "AND (name LIKE '%%%(restrict)s%%' OR cat LIKE '%(restrict)s%%')" % {"restrict":restrict}
restrict = property(get_restrict, set_restrict)
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 793d1b6..5b3bf7e 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -1646,6 +1646,9 @@ class MainWindow (Window):
"""Do a search."""
text = entry.get_text()
if text != "":
+ if not "*" in text:
+ text = ".*%s.*" % text
+
packages = system.find_packages(text, with_version = False)
if packages == []: