wok-6.x view busybox/stuff/busybox-1.23-dpkgxz.u @ rev 18378

Up: nginx (1.9.4)
author Nathan Neulinger <nneul@neulinger.org>
date Thu Sep 17 16:02:23 2015 +0000 (2015-09-17)
parents
children
line source
1 Description: Add support for latest .deb format members
2 This adds support for control.tar, control.tar.xz, data.tar, data.tar.xz
3 and data.tar.lzma in the dpkg and dpkg-deb applet. It also removes support
4 for control.tar.bz2 which has never been supported.
5 .
6 This should make these applets conform to deb(5).
7 Author: Guillem Jover <guillem@debian.org>
8 Origin: vendor
9 Forwarded: no
10 Last-Update: 2014-07-30
11 Bug-Debian: http://bugs.debian.org/756462
12 ---
13 archival/dpkg.c | 12 ++++++++++--
14 archival/dpkg_deb.c | 6 ++++++
15 archival/libarchive/Kbuild.src | 1 +
16 archival/libarchive/filter_accept_list_reassign.c | 11 +++++++++++
17 archival/libarchive/get_header_tar_xz.c | 21 +++++++++++++++++++++
18 include/bb_archive.h | 1 +
19 6 files changed, 50 insertions(+), 2 deletions(-)
20 create mode 100644 archival/libarchive/get_header_tar_xz.c
22 diff --git a/archival/dpkg.c b/archival/dpkg.c
23 index 2893cfc..71eae66 100644
24 --- a/archival/dpkg.c
25 +++ b/archival/dpkg.c
26 @@ -1472,11 +1472,12 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
27 tar_handle->src_fd = ar_handle->src_fd;
29 /* We don't care about data.tar.* or debian-binary, just control.tar.* */
30 + llist_add_to(&(ar_handle->accept), (char*)"control.tar");
31 #if ENABLE_FEATURE_SEAMLESS_GZ
32 llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
33 #endif
34 -#if ENABLE_FEATURE_SEAMLESS_BZ2
35 - llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
36 +#if ENABLE_FEATURE_SEAMLESS_XZ
37 + llist_add_to(&(ar_handle->accept), (char*)"control.tar.xz");
38 #endif
40 /* Assign the tar handle as a subarchive of the ar handle */
41 @@ -1492,12 +1493,19 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
42 tar_handle->src_fd = ar_handle->src_fd;
44 /* We don't care about control.tar.* or debian-binary, just data.tar.* */
45 + llist_add_to(&(ar_handle->accept), (char*)"data.tar");
46 #if ENABLE_FEATURE_SEAMLESS_GZ
47 llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
48 #endif
49 +#if ENABLE_FEATURE_SEAMLESS_XZ
50 + llist_add_to(&(ar_handle->accept), (char*)"data.tar.xz");
51 +#endif
52 #if ENABLE_FEATURE_SEAMLESS_BZ2
53 llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
54 #endif
55 +#if ENABLE_FEATURE_SEAMLESS_LZMA
56 + llist_add_to(&(ar_handle->accept), (char*)"data.tar.lzma");
57 +#endif
59 /* Assign the tar handle as a subarchive of the ar handle */
60 ar_handle->dpkg__sub_archive = tar_handle;
61 diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
62 index 13f9db9..48920f6 100644
63 --- a/archival/dpkg_deb.c
64 +++ b/archival/dpkg_deb.c
65 @@ -70,10 +70,16 @@ int dpkg_deb_main(int argc, char **argv)
66 ar_archive->dpkg__sub_archive = tar_archive;
67 ar_archive->filter = filter_accept_list_reassign;
69 + llist_add_to(&ar_archive->accept, (char*)"data.tar");
70 + llist_add_to(&control_tar_llist, (char*)"control.tar");
71 #if ENABLE_FEATURE_SEAMLESS_GZ
72 llist_add_to(&ar_archive->accept, (char*)"data.tar.gz");
73 llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
74 #endif
75 +#if ENABLE_FEATURE_SEAMLESS_XZ
76 + llist_add_to(&ar_archive->accept, (char*)"data.tar.xz");
77 + llist_add_to(&control_tar_llist, (char*)"control.tar.xz");
78 +#endif
79 #if ENABLE_FEATURE_SEAMLESS_BZ2
80 llist_add_to(&ar_archive->accept, (char*)"data.tar.bz2");
81 llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
82 diff --git a/archival/libarchive/Kbuild.src b/archival/libarchive/Kbuild.src
83 index 968fdf8..fda05d8 100644
84 --- a/archival/libarchive/Kbuild.src
85 +++ b/archival/libarchive/Kbuild.src
86 @@ -33,6 +33,7 @@ DPKG_FILES:= \
87 get_header_ar.o \
88 get_header_tar.o \
89 get_header_tar_gz.o \
90 + get_header_tar_xz.o \
91 get_header_tar_bz2.o \
92 get_header_tar_lzma.o \
94 diff --git a/archival/libarchive/filter_accept_list_reassign.c b/archival/libarchive/filter_accept_list_reassign.c
95 index 3d19abe..bcfeb96 100644
96 --- a/archival/libarchive/filter_accept_list_reassign.c
97 +++ b/archival/libarchive/filter_accept_list_reassign.c
98 @@ -28,12 +28,23 @@ char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle)
99 name_ptr++;
101 /* Modify the subarchive handler based on the extension */
102 + if (strcmp(name_ptr, "tar") == 0
103 + ) {
104 + archive_handle->dpkg__action_data_subarchive = get_header_tar;
105 + return EXIT_SUCCESS;
106 + }
107 if (ENABLE_FEATURE_SEAMLESS_GZ
108 && strcmp(name_ptr, "gz") == 0
109 ) {
110 archive_handle->dpkg__action_data_subarchive = get_header_tar_gz;
111 return EXIT_SUCCESS;
112 }
113 + if (ENABLE_FEATURE_SEAMLESS_XZ
114 + && strcmp(name_ptr, "xz") == 0
115 + ) {
116 + archive_handle->dpkg__action_data_subarchive = get_header_tar_xz;
117 + return EXIT_SUCCESS;
118 + }
119 if (ENABLE_FEATURE_SEAMLESS_BZ2
120 && strcmp(name_ptr, "bz2") == 0
121 ) {
122 diff --git a/archival/libarchive/get_header_tar_xz.c b/archival/libarchive/get_header_tar_xz.c
123 new file mode 100644
124 index 0000000..30ac522
125 --- /dev/null
126 +++ b/archival/libarchive/get_header_tar_xz.c
127 @@ -0,0 +1,21 @@
128 +/* vi: set sw=4 ts=4: */
129 +/*
130 + * Licensed under GPLv2 or later, see file LICENSE in this source tree.
131 + */
132 +
133 +#include "libbb.h"
134 +#include "bb_archive.h"
135 +
136 +char FAST_FUNC get_header_tar_xz(archive_handle_t *archive_handle)
137 +{
138 + /* Can't lseek over pipes */
139 + archive_handle->seek = seek_by_read;
140 +
141 + fork_transformer_with_sig(archive_handle->src_fd, unpack_xz_stream, "unxz");
142 + archive_handle->offset = 0;
143 + while (get_header_tar(archive_handle) == EXIT_SUCCESS)
144 + continue;
145 +
146 + /* Can only do one file at a time */
147 + return EXIT_FAILURE;
148 +}
149 diff --git a/include/bb_archive.h b/include/bb_archive.h
150 index b82cfd8..a356f70 100644
151 --- a/include/bb_archive.h
152 +++ b/include/bb_archive.h
153 @@ -182,6 +182,7 @@ char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC;
154 char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC;
155 char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC;
156 char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC;
157 +char get_header_tar_xz(archive_handle_t *archive_handle) FAST_FUNC;
158 char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC;
159 char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC;
161 --
162 1.7.10.4