seth vidal wrote:
Something we talked about before. This is a simple fs-as-a-db backended
additional database. It fits in around the rpmsack and the
YumInstalledPackage objects to let you have fairly seamless access to
this information from any given installed package object

Things I'm thinking about storing there:
   - repoid (from which the package was installed)
   - installedreason (user, dep, update, etc)
   - group it was installed with (if any)
   - notes? I dunno - other random data

now this is obviously just a simple file system as a db mechanism but I
think the idea is reasonable. It works well if the db is not there or
not readable so people w/o this data don't lose out.

Here's the patch:
http://skvidal.fedorapeople.org/patches/rpm-additional-db.patch


Here's an example of how to use it:
as root:
import yum
my = yum.YumBase()
po = my.rpmdb.searchNevra(name='yum')[0]
po.set_additional('repoid', 'yourmom')
po.set_additional('notes', 'This is a crappy package!')

exit the session and come back as a user or as root again:
import yum
my = yum.YumBase()
po = my.rpmdb.searchNevra(name='yum')[0]
print po.repoid
print po.repo.id
print po.notes

to get rid of an item just run:
po.del_additional('name_of_item')


Let me know if this is crack and I should be beaten. I just wanted to
think about it.

-sv


_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

looks cool, but there is some issues.

po.repoid is overwritten, so you can't do 'if po.repoid=='installed':' anymore, this will break some code. (yumex, PackageKit, others i don't know about), i can fix yumex & PackageKit, but there might be others out there. I'm cool about it, but maybe it is not the right thing to do i a "Stable" branch :).

Storing attributes in a flat file, wouldn't it be better to use an sqlite db, i know it make it a little harder to do, but i is more clean IMHO.

Tim

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to