Archive for the ‘Projects’ Category

Func Verification Method – Release 1.0

April 24, 2009

Release 1.0 is done

  • Submitted to the mailing list
  • Accept and pushed in to the Func Project

At now, preparing for the tomorrow’s presentation  🙂

Thanks Professor Chris Tyler for the supervision and all the help in the whole process.

In my opinion this project was good and very challenging, but it was not as big as I would like it to be :-(.    I will try to think this was the first step in the open source world and the first steps are always the hardest ones. Its like a baby, that first learn how to crawl and later on how to walk. At this point I am taking my first steps.

Project Page

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

func-logo-small1

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

Func Verification Method – Release 0.8

April 4, 2009

Lot of work has been done for this release, but now I have the 0.8 working smoothly. I also participated in the effort to created a new module called “packages” that will substitute the rpm module and the yum module.

The Code is available at: http://matrix.senecac.on.ca/~mpaivaneto/packages.py or http://func.pastebin.com/f215bec3b

func-logo-small1

Func Verification Method – Release 0.7

March 19, 2009

I am working in a method to verify the installed packages for the rpms module.

I checked python api and there isn’t any buildin method I could use, but I checked yum api and I found something interesting,

The output with the external command was:

S.?…..    /usr/sbin/groupmod
prelink: /usr/sbin/useradd: at least one of file’s dependencies has changed since prelinking
S.?…..    /usr/sbin/useradd
prelink: /usr/sbin/userdel: at least one of file’s dependencies has changed since prelinking
S.?…..    /usr/sbin/userdel
prelink: /usr/sbin/usermod: at least one of file’s dependencies has changed since prelinking
S.?…..    /usr/sbin/usermod

While the output with the yum api is:

/usr/sbin/userdel – checksum does not match
/usr/sbin/userdel – size does not match
/usr/sbin/groupdel – checksum does not match
/usr/sbin/groupdel – size does not match
/etc/login.defs – mtime does not match
/etc/login.defs – checksum does not match
/etc/login.defs – size does not match
/usr/bin/newgrp – checksum does not match

I intend to work now to allow the verification for only one package each time adding support for rpms.glob(). When its done the plan is to merge the yum module with the rpm module and create a new module called “packages”.

The current code  is:
http://func.pastebin.com/m523b93ac

def verify(self, flatten=True):
“””
Returns information of the verification of all installed packages.
“””
import yum
ts = rpm.TransactionSet()
mi = ts.dbMatch()
results = []
for hdr in mi:
name = hdr[‘name’]
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

Feel free to give me some ideas or comments, thanks.

func-logo-small1

Func Verification Method – Release 0.5

February 14, 2009

Release 0.5 is available in the wiki page of my project:

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

func-logo-small6

Func Verification Method – Release 0.4

February 2, 2009

This is the release 0.4 of my project.
http://zenit.senecac.on.ca/wiki/index.php/Func/Rpms_Module_-_Function_Verify#To_do_List

The file is available at:
http://matrix.senecac.on.ca/~mpaivaneto/rpms.py

This is the method I am creating will verify the integrity of all the installed packages on a given system

———
def verify(self, flatten=True):
“””
Returns information of the verification of all installed packages.
“””
import subprocess
ts = rpm.TransactionSet()
mi = ts.dbMatch()
results = []
for hdr in mi:
name = hdr[‘name’]
if flatten:
results.append(“%s” % (name))
proc = subprocess.Popen([‘/bin/rpm -V ‘ + name], shell=True, stdout=subprocess.PIPE)
stdout_value = proc.communicate()[0]
results.append(“%s” % (stdout_value))
else:
results.append([name])
return results

———

func-logo-small1Func Project
https://fedorahosted.org/func/

Func RPM Verification Project – Release 0.3

December 4, 2008

The 0.3 release was officially presented in class this week at Seneca College, because blogs are not very nice to handle with code, I posted the link of my project in the Zenit Wiki. To try to make easier to read the python code.

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

func-logo-small1

Func RPM Verification Project – Release 0.3 – Beta

November 26, 2008

After a iteration with the community I changed the way to invoke the method, instead of using a asynchronous call, now I can use a synchronous call. The results now came very fast, and it begins to appear on the screen the time they are processed.

This is the code to be released in the 0.3 version of the project.

def verify(self, flatten=True):

import commands, os, subprocess
ts = rpm.TransactionSet()
mi = ts.dbMatch()
results = []
for hdr in mi:
name = hdr[‘name’]
if flatten:
subprocess.call([“/bin/rpm”, “-V”, name], shell=False)
results.append(“%s” % (name))
else:
results.append([name])
return results

func-logo-small6

Working on Release 0.3 of the Project

November 21, 2008

After getting some feedback of the Func community is time to polish the release 0.2 and work on the release 0.3

func-logo-small5