更新时间:2023-11-26 21:44:16
import sys
import rpm
ts = rpm.TransactionSet()
mi = ts.dbMatch( 'name', sys.argv[1] )
try :
h = mi.next()
print "%s-%s-%s" % (h['name'], h['version'], h['release'])
except StopIteration:
print "Package not found"
dbMatch也可以用于查询特定的包,您需要传递名称标签的名称,以及您要查找的标签的值:
dbMatch can also be used to query specific packages, you need to pass the name of a tag, as well as the value for that tag that you are looking for:
dbMatch('name','mysql')