[entropy.db] remove EntropyRepository.searchSlottedPackages(), uniform search methods, add searchSlotted()

This commit is contained in:
Fabio Erculiani
2010-02-01 17:23:04 +01:00
parent 547e3edef1
commit 5b6a67f5b1
2 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -1260,10 +1260,10 @@ def search_slotted_packages(slots, Equo = None):
dbconn = Equo.open_repository(repo)
for slot in slots:
results = dbconn.searchSlottedPackages(slot, atoms = True)
for result in results:
results = dbconn.searchSlotted(slot, just_id = True)
for idpackage in results:
found = True
print_package_info(result[1], dbconn, Equo = Equo,
print_package_info(idpackage, dbconn, Equo = Equo,
extended = etpUi['verbose'], strictOutput = etpUi['quiet'])
if not etpUi['quiet']:
+11 -11
View File
@@ -5406,27 +5406,27 @@ class EntropyRepository(EntropyRepositoryPluginStore, TextInterface):
""", ("%"+keyword+"%".lower(),))
return cur.fetchall()
def searchSlottedPackages(self, slot, atoms = False):
def searchSlotted(self, keyword, just_id = False):
"""
Search packages with given slot string.
@param slot: slot to search
@type slot: string
@keyword atoms: return list of atoms instead of package identifiers
@type atoms: bool
@param keyword: slot to search
@type keyword: string
@keyword just_id: just return package identifiers (returning set())
@type just_id: bool
@return: list of packages using given slot
@rtype: set or list
"""
if atoms:
if just_id:
cur = self._cursor().execute("""
SELECT idpackage FROM baseinfo WHERE slot = (?)""", (keyword,))
return self._cur2set(cur)
else:
cur = self._cursor().execute("""
SELECT atom,idpackage FROM baseinfo WHERE slot = (?)
""", (slot,))
""", (keyword,))
return cur.fetchall()
cur = self._cursor().execute("""
SELECT idpackage FROM baseinfo WHERE slot = (?)""", (slot,))
return self._cur2set(cur)
def searchKeySlot(self, key, slot):
"""
Search package with given key and slot