[Rpm-maint] rpm tag query and headerSprintf

Michael Schroeder mls at suse.de
Fri Dec 14 20:03:42 UTC 2007


On Fri, Dec 14, 2007 at 07:27:34PM +0000, Vento Neicapelli wrote:
> 
> the citation disappear...(due to hotmail...) 
> _he said about db opening_:
> 
> "
> You likely do _NOT_ want to open a rpmdb directly.
> 
> Instead see Chapter 15 of "The RedHat RPM Guide" at
> 
>     
> http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-programming-c.html
> 
> (aside) Hmmm, the example code I sent to Eric Foster-Johnson yearsago seems not to have survived editing by Eric or Fedora or ...
> 
> "

Maybe you should use rpmts instead:

    ts = rpmtsCreate();
    rc = rpmtsOpenDB(ts, O_RDONLY);
    mi = rpmtsInitIterator(ts, RPMTAG_NAME, pkgName, 0);
    while((h = rpmdbNextIterator(mi) ) !=NULL) {
      ...
    }
    rpmtsCloseDB(ts);
    ts = rpmtsFree(ts);

Cheers,
  Michael.

-- 
Michael Schroeder                                   mls at suse.de
SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}



More information about the Rpm-maint mailing list