summaryrefslogtreecommitdiff
path: root/rpm2cpio.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-06-23 01:19:45 +0000
committerjbj <devnull@localhost>2000-06-23 01:19:45 +0000
commit5df134128b2c4cd6549b7e4c978ae0e88c0651ad (patch)
tree7b0073526bd704aee82c1616dc03ad68d646f884 /rpm2cpio.c
parent4d888092960c6160f86dff474b2bf9e89f106d5e (diff)
downloadlibrpm-tizen-5df134128b2c4cd6549b7e4c978ae0e88c0651ad.tar.gz
librpm-tizen-5df134128b2c4cd6549b7e4c978ae0e88c0651ad.tar.bz2
librpm-tizen-5df134128b2c4cd6549b7e4c978ae0e88c0651ad.zip
- support for separate source/binary compression policy.
- support for bzip payloads. CVS patchset: 3908 CVS date: 2000/06/23 01:19:45
Diffstat (limited to 'rpm2cpio.c')
-rw-r--r--rpm2cpio.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/rpm2cpio.c b/rpm2cpio.c
index 7bf8ca7be..ee1e9ce07 100644
--- a/rpm2cpio.c
+++ b/rpm2cpio.c
@@ -8,6 +8,7 @@ int main(int argc, char **argv)
{
FD_t fdi, fdo;
Header h;
+ char * rpmio_flags;
int rc, isSource;
FD_t gzdi;
@@ -38,7 +39,22 @@ int main(int argc, char **argv)
break;
}
- gzdi = Fdopen(fdi, "r.gzdio"); /* XXX gzdi == fdi */
+ /* Retrieve type of payload compression. */
+ { const char * payload_compressor = NULL;
+ char * t;
+
+ if (!headerGetEntry(h, RPMTAG_PAYLOADCOMPRESSOR, NULL,
+ (void **) &payload_compressor, NULL))
+ payload_compressor = "gzip";
+ rpmio_flags = t = alloca(sizeof("r.gzdio"));
+ *t++ = 'r';
+ if (!strcmp(payload_compressor, "gzip"))
+ t = stpcpy(t, ".gzdio");
+ if (!strcmp(payload_compressor, "bzip2"))
+ t = stpcpy(t, ".bzdio");
+ }
+
+ gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */
if (gzdi == NULL || Ferror(gzdi)) {
fprintf(stderr, _("cannot re-open payload: %s\n"), Fstrerror(gzdi));
exit(EXIT_FAILURE);