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