- added 'equo match' tool, it is more or less the same of 'equo search' except it uses EquoInterface.atomMatch()


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1478 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2008-03-15 05:25:47 +00:00
parent 4a8ab7d596
commit b7b6e4dc0d
3 changed files with 81 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
TODO list:
- create a meta-packages list ... I hate Joost
- during "equo remove" show disk size for each package
- add "equo match" tool
- NEEDED + ldconfig -p ?
- make an ETP_DIR switching function
- lilo.conf trigger?
+31 -1
View File
@@ -39,7 +39,11 @@ def print_help():
print_info(" \t"+blue("repoinfo")+brown("\t show enabled repositories"))
print_info(" \t"+blue("status")+brown("\t\t show respositories status"))
print_info(" \t"+blue("search")+brown("\t\t search a package trough repositories"))
print_info(" \t"+blue("search")+brown("\t\t search a package in repositories"))
print_info(" \t"+blue("match")+brown("\t\t match a package in repositories"))
print_info(" \t\t"+red("--multimatch")+"\t\t return all the possible matches")
print_info(" \t\t"+red("--multirepo")+"\t\t return matches from every repository")
print_info(" \t\t"+red("--showrepo")+"\t\t print repository information")
print_info(" \t"+blue("world")+brown("\t\t update system with the latest available packages"))
print_info(" \t\t"+red("--ask")+"\t\t\t ask before making any changes")
@@ -309,6 +313,32 @@ try:
else:
rc = -10
elif (options[0] == "match"):
rc = -10
multiMatch = False
multiRepo = False
showRepo = False
myoptions = []
for opt in options:
if opt == "--multimatch":
multiMatch = True
elif opt == "--multirepo":
multiRepo = True
elif opt == "--showrepo":
showRepo = True
else:
myoptions.append(opt)
if len(myoptions) > 1:
import text_query
# repoMatch can be made using @repository
rc = text_query.matchPackage(myoptions[1:],
multiMatch = multiMatch,
multiRepo = multiRepo,
showRepo = showRepo
)
else:
rc = -10
elif (options[0] == "database"):
entropyTools.applicationLockCheck("database")
import text_rescue
+49 -2
View File
@@ -693,6 +693,50 @@ def searchPackage(packages, idreturn = False):
return dataInfo
return 0
def matchPackage(packages, idreturn = False, multiMatch = False, multiRepo = False, showRepo = False):
global Equo
if Equo == None:
Equo = EquoInterface()
dataInfo = set() # when idreturn is True
if (not idreturn) and (not etpUi['quiet']):
print_info(darkred(" @@ ")+darkgreen("Matching..."), back = True)
found = False
for package in packages:
if (not idreturn) and (not etpUi['quiet']):
print_info(blue(" # ")+bold(package))
match = Equo.atomMatch(package, multiMatch = multiMatch, multiRepo = multiRepo)
if match[1] != 1:
if not multiMatch:
if multiRepo:
matches = match[0]
else:
matches = [match]
else:
matches = match[0]
for match in matches:
if (idreturn):
dataInfo.add(tuple(match))
else:
dbconn = Equo.openRepositoryDatabase(match[1])
printPackageInfo(match[0],dbconn, showRepoOnQuiet = showRepo)
found = True
if (not idreturn) and (not etpUi['quiet']):
print_info(blue(" Keyword: ")+bold("\t"+package))
print_info(blue(" Found: ")+bold("\t"+str(len(matches)))+red(" entries"))
if (not idreturn) and (not etpUi['quiet']) and (not found):
print_info(darkred(" @@ ")+darkgreen("No match."))
if (idreturn):
return dataInfo
return 0
def searchSlottedPackages(slots, datareturn = False, dbconn = None):
global Equo
@@ -874,7 +918,7 @@ def __searchDescriptions(descriptions, dbconn, idreturn = False, EquoConnection
print_info(blue(" Found: ")+bold("\t"+str(len(mydescdata[desc])))+red(" entries"))
return dataInfo,mydescdata
def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = False, extended = False, EquoConnection = None):
def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = False, extended = False, EquoConnection = None, showRepoOnQuiet = False):
if EquoConnection != None:
Equo = EquoConnection
@@ -888,7 +932,10 @@ def printPackageInfo(idpackage, dbconn, clientSearch = False, strictOutput = Fal
# now fetch essential info
pkgatom = dbconn.retrieveAtom(idpackage)
if (etpUi['quiet']):
print pkgatom
if showRepoOnQuiet:
print "[%s] %s" % (dbconn.dbname, pkgatom)
else:
print pkgatom
return
if (not strictOutput):