[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Managing multiple simultaneously installed "package instances "

On Thu, Mar 13, 2003 at 09:38:29AM -0700, Shortland, Anthony wrote:
> Having read the rpmlib section of Maximum RPM and taken a look at the 4.1
> source, am I right in saying that the "primary retrieval key" that is our
> candidate to represent the "package instance" is the "record number" used as
> an offset to retrieve records from the RPM database by rpmdbGetRecord()?

Conceptually correct, but you're looking at doco for rpm-3.0.x, where a
file offset into a homebrew first-fit pile of headers was used as 
package instance.

In rpm-4.0 the "file offset ... pile of headers" was abandoned in favor
of a simple monotonically increasing package instance key used on top
of a Berkeley DB hash. The largest/current monotonically increasing
package instance is stashed as instance #0.

> So the job at hand is to implement a command line argument like "--instance
> #" or "--record #" to restrict selection to a single record from the
> database (via the RPM Library API, of course).

Adding an option with integer instance# argument is easy (and boring ;-).

Harder to do is devising a way to associate a given package upgrade with
one of multiple instances of co-locacted re-located packages that can
be conveyed to users in words of two syllables. :-)

> In searches of the RPM database, the record number is returned as the
> recOffset field of the dbIndexRecord structure ... is that correct? So a
> user supplied record number could be used to filter the result set of a call
> to rpmdbFindPackage ... resulting in a single package instance, or none if
> the supplied record number and package name do not match up.

> It seems that the balance of API calls that manipulate installed packages
> either take a record offset directly (like rpmRemovePackage()) or a Header
> pointer (like rpmVerifyFile()) which I imagine is acquired via
> rpmdbGetRecord ... is this correct?

Again, basically correct, but the entire dbIndexRecord API has been
ripped out of rpm-4.0, replaced with rpmdbMatchIterators for header

But all that's really needed is the instance # and a call to rpmdbRemove()
will do the rest (ignoring --repackage/--rollback complexities).

73 de Jeff

Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []