diff options
author | Ron Yorston <rmy@pobox.com> | 2015-05-27 15:23:31 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-05-27 15:30:36 +0100 |
commit | 316ecf214a051121516730f794721f5e7b3036ac (patch) | |
tree | 3002051097aebc579cfe3a2e008ff43fe100c1c9 /archival/libarchive | |
parent | 8a61b67d502ed4fbd5f480ca9458884b55ce7a95 (diff) | |
download | busybox-w32-316ecf214a051121516730f794721f5e7b3036ac.tar.gz busybox-w32-316ecf214a051121516730f794721f5e7b3036ac.tar.bz2 busybox-w32-316ecf214a051121516730f794721f5e7b3036ac.zip |
Enable seamless compression for WIN32
In the archival code we pretend that WIN32 is a no-MMU platform and
use the new mingw_popen_fd routine to pipe data to/from commands
to compress/decompress.
The pretence is maintained by redefining MMU macros in bb_archive.h.
This is mostly used in the archival code but there are a handful
of places where it's used to access public interfaces. The symbol
BB_ARCHIVE_PUBLIC is defined in these places.
With these changes:
tar supports seamless compression/decompression
rpm2cpio and dpkg-deb can be enabled
Diffstat (limited to 'archival/libarchive')
-rw-r--r-- | archival/libarchive/init_handle.c | 5 | ||||
-rw-r--r-- | archival/libarchive/open_transformer.c | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/archival/libarchive/init_handle.c b/archival/libarchive/init_handle.c index cbae06ac3..b1166d577 100644 --- a/archival/libarchive/init_handle.c +++ b/archival/libarchive/init_handle.c | |||
@@ -16,7 +16,12 @@ archive_handle_t* FAST_FUNC init_handle(void) | |||
16 | archive_handle->action_header = header_skip; | 16 | archive_handle->action_header = header_skip; |
17 | archive_handle->action_data = data_skip; | 17 | archive_handle->action_data = data_skip; |
18 | archive_handle->filter = filter_accept_all; | 18 | archive_handle->filter = filter_accept_all; |
19 | #if !ENABLE_PLATFORM_MINGW32 | ||
19 | archive_handle->seek = seek_by_jump; | 20 | archive_handle->seek = seek_by_jump; |
21 | #else | ||
22 | /* can't reliably detect pipes on WIN32: default to seek_by_read */ | ||
23 | archive_handle->seek = seek_by_read; | ||
24 | #endif | ||
20 | 25 | ||
21 | return archive_handle; | 26 | return archive_handle; |
22 | } | 27 | } |
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index 1c5c185d0..24524f6ee 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
@@ -69,6 +69,7 @@ ssize_t FAST_FUNC xtransformer_write(transformer_state_t *xstate, const void *bu | |||
69 | } | 69 | } |
70 | 70 | ||
71 | #if SEAMLESS_COMPRESSION | 71 | #if SEAMLESS_COMPRESSION |
72 | #if !ENABLE_PLATFORM_MINGW32 | ||
72 | void check_errors_in_children(int signo) | 73 | void check_errors_in_children(int signo) |
73 | { | 74 | { |
74 | int status; | 75 | int status; |
@@ -155,6 +156,25 @@ void FAST_FUNC fork_transformer(int fd, const char *transform_prog) | |||
155 | close(fd_pipe.wr); /* don't want to write to the child */ | 156 | close(fd_pipe.wr); /* don't want to write to the child */ |
156 | xmove_fd(fd_pipe.rd, fd); | 157 | xmove_fd(fd_pipe.rd, fd); |
157 | } | 158 | } |
159 | #else | ||
160 | void FAST_FUNC fork_transformer(int fd, const char *transform_prog) | ||
161 | { | ||
162 | char *cmd; | ||
163 | int fd1; | ||
164 | |||
165 | if (find_applet_by_name(transform_prog) >= 0) { | ||
166 | cmd = xasprintf("%s %s -cf -", bb_busybox_exec_path, transform_prog); | ||
167 | } | ||
168 | else { | ||
169 | cmd = xasprintf("%s -cf -", transform_prog); | ||
170 | } | ||
171 | if ( (fd1=mingw_popen_fd(cmd, "r", fd, NULL)) == -1 ) { | ||
172 | bb_perror_msg_and_die("can't execute '%s'", transform_prog); | ||
173 | } | ||
174 | free(cmd); | ||
175 | xmove_fd(fd1, fd); | ||
176 | } | ||
177 | #endif | ||
158 | 178 | ||
159 | /* Used by e.g. rpm which gives us a fd without filename, | 179 | /* Used by e.g. rpm which gives us a fd without filename, |
160 | * thus we can't guess the format from filename's extension. | 180 | * thus we can't guess the format from filename's extension. |