aboutsummaryrefslogtreecommitdiff
path: root/archival/rpm.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-10 10:35:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-10 10:36:37 +0200
commit0cf64c8b5d86d603903397bfce87dea5a862caec (patch)
tree66ee79e6c9c2ff17c84b776b4ce36439cf9f94e0 /archival/rpm.c
parent3c9b8fe25233dc52bbeec2ab29e49b8f62e4739b (diff)
downloadbusybox-w32-0cf64c8b5d86d603903397bfce87dea5a862caec.tar.gz
busybox-w32-0cf64c8b5d86d603903397bfce87dea5a862caec.tar.bz2
busybox-w32-0cf64c8b5d86d603903397bfce87dea5a862caec.zip
rpm2cpio: handle LZMA compressed rpms. closes 10166
function old new delta rpm2cpio_main 78 120 +42 setup_lzma_on_fd - 29 +29 fork_transformer_and_free - 28 +28 ... setup_unzip_on_fd 56 32 -24 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/5 up/down: 104/-67) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/rpm.c')
-rw-r--r--archival/rpm.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/archival/rpm.c b/archival/rpm.c
index f46d88b92..cca17da33 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -56,6 +56,8 @@
56#define TAG_DIRINDEXES 1116 56#define TAG_DIRINDEXES 1116
57#define TAG_BASENAMES 1117 57#define TAG_BASENAMES 1117
58#define TAG_DIRNAMES 1118 58#define TAG_DIRNAMES 1118
59#define TAG_PAYLOADCOMPRESSOR 1125
60
59 61
60#define RPMFILE_CONFIG (1 << 0) 62#define RPMFILE_CONFIG (1 << 0)
61#define RPMFILE_DOC (1 << 1) 63#define RPMFILE_DOC (1 << 1)
@@ -510,6 +512,7 @@ int rpm_main(int argc, char **argv)
510int rpm2cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 512int rpm2cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
511int rpm2cpio_main(int argc UNUSED_PARAM, char **argv) 513int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
512{ 514{
515 const char *str;
513 int rpm_fd; 516 int rpm_fd;
514 517
515 G.pagesize = getpagesize(); 518 G.pagesize = getpagesize();
@@ -520,11 +523,17 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
520 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 523 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
521 // signal(SIGCHLD, check_errors_in_children); 524 // signal(SIGCHLD, check_errors_in_children);
522 525
523//TODO: look for rpm tag RPMTAG_PAYLOADCOMPRESSOR (dec 1125, hex 0x465), 526 if (ENABLE_FEATURE_SEAMLESS_LZMA
524// if the value is "lzma", set up decompressor without detection 527 && (str = rpm_getstr0(TAG_PAYLOADCOMPRESSOR)) != NULL
525// (lzma can't be detected). 528 && strcmp(str, "lzma") == 0
529 ) {
530 // lzma compression can't be detected
531 // set up decompressor without detection
532 setup_lzma_on_fd(rpm_fd);
533 } else {
534 setup_unzip_on_fd(rpm_fd, /*fail_if_not_compressed:*/ 1);
535 }
526 536
527 setup_unzip_on_fd(rpm_fd, /*fail_if_not_compressed:*/ 1);
528 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) 537 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)
529 bb_error_msg_and_die("error unpacking"); 538 bb_error_msg_and_die("error unpacking");
530 539