[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Migrating external sources using rpmlib from 4.0 -> 4.1+
- From: Nicholas Wourms <nwourms myrealbox com>
- To: rpm-list <rpm-list redhat com>
- Subject: Migrating external sources using rpmlib from 4.0 -> 4.1+
- Date: Thu, 04 Sep 2003 11:54:04 -0400
Hi,
For awhile now, I've been using a neat little program from slackware[1],
called getrpmtype, in a few of my shell scripts. The program itself
determines the package type and what version (Major & Minor) of rpm was
used to make it. I've had problems with "file" in the past returning
inaccurate results, so I really do prefer to use this little utility
instead. The problem is that it uses the function rpmReadPackageHeader
to obtain the attributes of the rpm, which seems to have gone missing in
newer versions of rpm >= 4.1. I'm not quite sure what provides
equivalent functionality in rpm >= 4.1 and maximum rpm has not yet been
updated to reflect the changes in the ABI. I guess my question is:
What is the new way to obtain src/bin type and major/minor information
for a package? Anyhow, if anyone has any suggestions, here's a snippet
of routine used to open and parse the header of the rpm (note that I
left out the command line parsing stuff, so argv[i] is just the name of
the rpm(s) passed at the command line):
...
int c;
int i, e, src, major, minor;
Header h;
FD_t fd;
...
/* open */
if( (fd=fdOpen(argv[i], O_RDONLY, 0644)) == NULL ) {
fprintf( stderr, "ERROR: Cannot open %s\n", argv[i] );
continue;
}
...
/* parse header */
if( (e = rpmReadPackageHeader(fd, &h, &src, &major, &minor)) ) {
fprintf( stderr, "rpmReadPackageHeader Error: %d\n%s\n",
e, strerror(errno) );
}
...
/* print type */
if ( src ) {
printf( "RPM v%d.%d source package.\n", major, minor );
} else {
printf( "RPM v%d.%d binary package.\n", major, minor );
}
...
As a side note, why not provide compatibility wrapper functions so that
the new rpm won't break existing source compatibility?
Cheers,
Nicholas
[1]:
http://distro.ibiblio.org/pub/Linux/distributions/slackware/slackware-current/source/a/bin/getrpmtype.tar.gz
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]