Archive for the ‘Release 0.9’ Category

Func Verification Method – Release 0.9

April 18, 2009

Release 0.9 is done, now with glob integration !!!!

The new code is available at:

http://func.pastebin.com/f75c77458

—————————-

def verify(self, pattern=”, flatten=True):
“””
Returns information on the verified package(s).
“””
import rpm
import yum
from re import split
ts = rpm.TransactionSet()
mi = (ts.dbMatch() if pattern == ” else self.glob(pattern))
results = []
for hdr in mi:
name = hdr[‘name’] if pattern == ” else split(“\s”,hdr)[0]
if flatten:
yb = yum.YumBase()
pkgs = yb.rpmdb.searchNevra(name)
for pkg in pkgs:
errors = pkg.verify()
for fn in errors.keys():
for prob in errors[fn]:
results.append(‘%s %s %s’ % (name, fn, prob.message))
else:
results.append(“%s-%s-%s.%s” % (name, version, release, arch))
return results

—————————-

Now is possible in my method to verify all the packages on the system or even only one !

func-logo-small1

Func Verification Method – Release 0.9 Beta

April 7, 2009

Release 0.9 Beta of the Verification Method is done, the support for glob queries in the code has been added.

http://zenit.senecac.on.ca/wiki/index.php/Func/Rpms_Module_-_Function_Verify

http://func.pastebin.com/f59ccf2f7

def verify(self, pattern=”, flatten=True):
“””
Returns information of the verification of all installed packages.
“””
print “”
# For some reason, if this print is removed, the previous one does not happen until the lines after this have been evaluated. – Greg.
ts = rpm.TransactionSet()
mi = (ts.dbMatch() if pattern == ” else self.glob(pattern))
results = []
for hdr in mi:
name = hdr[‘name’] if pattern == ” else split(“\s”,hdr)[0]
if flatten:
yb = yum.YumBase()
pkgs = yb.rpmdb.searchNevra(name)
for pkg in pkgs:
errors = pkg.verify()
for fn in errors.keys():
for prob in errors[fn]:
results.append(‘%s %s %s’ % (name, fn, prob.message))
else:
results.append(“%s-%s-%s.%s” % (name, version, release, arch))
return results

I would like to thank Greg for his help.

func-logo-small1