Re: RPM C API (and other fun acronyms)

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

 



On Tuesday, 19 September 2006, at 14:21:17 (-0500),
R. Tyler Ballance wrote:

> The headerDump would be perfect to dump the entirety of the header
> structure's contents.

Sure, if you're trying to debug it. :-)

> Really all I need in the end is something in terms of the package,
> and version information to compare it to a list of packages that
> need to be upgraded for vulnerability reasons.
> 
> Suggestions would be great as I feel like I'm just stabbing in the
> dark right now.

Are you talking about package files or installed packages from the
local RPMDB?  The procedure is different for each one, but once you
have a "Header" object for the package in question, use something like
this to get the name, version, etc.:

    char *N, *E, *V, *R, *A;

    E = NULL;
    headerNEVRA(hdr, (const char **) &N, (const char **) &E, (const char **) &V, (const char **) &R,
                (const char **) &A);
    printf("Package:  %s (%s:%s-%s) for %s\n", N, ((E)?(E):("0")), V, R, A);
    headerFreeData(N, RPM_STRING_TYPE);
    headerFreeData(E, RPM_STRING_TYPE);
    headerFreeData(V, RPM_STRING_TYPE);
    headerFreeData(R, RPM_STRING_TYPE);
    headerFreeData(A, RPM_STRING_TYPE);

"hdr" is, of course, the Header.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej@xxxxxxxxx>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "Love?!  What does *love* have to do with *marriage*?!"
           -- Peter Jurasik (Ambassador Londo Mollari), "Babylon Five"

_______________________________________________
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