[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: RPM C API (and other fun acronyms)
- From: Michael Jennings <mej kainx org>
- To: rpm-list redhat com
- Subject: Re: RPM C API (and other fun acronyms)
- Date: Tue, 19 Sep 2006 15:59:35 -0400
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 kainx org>
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"
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]