> The format of /var/lib/rpm/Packages is private to rpm and yum has no
> business poking into it directly. That aside, the exact underlying
> format of BDB databases is private to BDB and can and does change every
> now and then so it depends on the version rpm was linked against.

Didn't want to hash the whole header, but hashing 512 bytes or so
is probably not that much slower than reading specific 4 bytes,
so guessing the offset is not necessary.

> Also h_nelem does not represent the number of entries in the database,
> its the *estimated* size of the *hash table*:
> 
> http://docs.oracle.com/cd/E17076_03/html/api_reference/C/dbget_h_nelem.html

Interesting.. in reality it's equal to number of records
(#pkgs + #gpg-pubkey + 1), and changes after each single 
package install/erase.

> This is probably a huge overkill for what you need, but just as
> an example:
> 
> ts = rpm.ts()
> h = hashlib.sha1()
> ii = ts.dbIndex('sha1header')
> for s in ii:
>      h.update(s)
>      for (dboffset, dbfileno) in ii.instances():
>          h.update('%s' % dboffset)
> print h.hexdigest() # profit!

This is probably killing the whole point of the cache.
(amount of data needed to validate the cache is not much
smaller than what we actually cache)

TRT is to make the rpmdb API fast enough so any caching
is unnecessary.
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to