Re: RPM C API (and other fun acronyms)

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Sep 27, 2006, at 5:17 PM, Jeff Johnson wrote:


On Sep 27, 2006, at 3:15 PM, R. Tyler Ballance wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry for prolonging this thread, but I wanted to tack on one more question ;)

Is there a sort of wildcard for the rpm db functions to where I can essentially query similar to an `rpm -qa` and list all the installed packages.

Am I naive in thinking that "*" would work? :)


Well, its a database, and so has records and record boundaries which need to be taken into account.

Meanwhile, there's some logic to filter on tag values. Try the following
	rpm -qa a\*
	rpm -qa 'arch=noarch'
	rpm -qa '!arch=i*'
etc, etc ("arch" is a tag name, substitute any tag name displayed by rpm --querytags, multiple items
are implicitly &&)

Note that the search is sequential through all headers and so dirt slow. Adding --nodigest and --nosignature
will recover some of the speed back.

Note also that there are "optional" tags as well, that may or may not exist, and so matching a value
that is not present is undefined and may not be to your expectations.

The matching "works" within the above caveats.

See <rpm/rpmdb.h> for the method to set from C after rpmdbInitIterator() call, look for MIRE as in
Match Iterator Regular Expression.


I apologize for being dense, but after staring at the rpmdb.h header, as well as the header documentation (via doxygen) and I'm still not seeing a solution

I'm assuming you're referring to
int rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern);

So I'm wondering, do I just not use rpmdbInitIterator() (since I've got to set the key string there) and will rpmdbSetIteratorRE() create the proper iterator for dumping all the packages on the machine?

Again, I apologize if I'm coming across dense, I've been working on code marshalling between C and C#, I'm just trying to find something to dump the contents of the rpm db (i.e. the installed packages) in such a manner that I can basically fill out an array of Header structures.

Cheers,

- -R. Tyler Ballance

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFHENhqO6nEJfroRsRAlDUAJ94Y+fry48qXaeu4t0QMCkv2PTrQgCdEdDh
jLdOm+sNrd3OvjAVoG9bZWY=
=CM3w
-----END PGP SIGNATURE-----

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux