summaryrefslogtreecommitdiff
path: root/data/_dpkg/lzma.diff
blob: 9ce2d4aefd21a07010d087eb4a69f6b92bac2bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
diff -ur dpkg-1.18.25/dpkg-deb/main.c dpkg-1.18.25+iPhone/dpkg-deb/main.c
--- dpkg-1.18.25/dpkg-deb/main.c	2018-06-25 16:48:17.000000000 -1000
+++ dpkg-1.18.25+iPhone/dpkg-deb/main.c	2018-09-14 10:15:39.000000000 -1000
@@ -192,8 +192,6 @@
   compress_params.type = compressor_find_by_name(value);
   if (compress_params.type == COMPRESSOR_TYPE_UNKNOWN)
     badusage(_("unknown compression type '%s'!"), value);
-  if (compress_params.type == COMPRESSOR_TYPE_LZMA)
-    badusage(_("obsolete compression type '%s'; use xz instead"), value);
   if (compress_params.type == COMPRESSOR_TYPE_BZIP2)
     badusage(_("obsolete compression type '%s'; use xz or gzip instead"), value);
 }
diff -ur dpkg-1.18.25/lib/dpkg/compress.c dpkg-1.18.25+iPhone/lib/dpkg/compress.c
--- dpkg-1.18.25/lib/dpkg/compress.c	2018-06-17 05:49:22.000000000 -1000
+++ dpkg-1.18.25+iPhone/lib/dpkg/compress.c	2018-09-14 10:14:50.000000000 -1000
@@ -664,6 +664,16 @@
  * Lzma compressor.
  */
 
+#define LZMA		"lzma"
+
+static void
+fixup_lzma_params(struct compress_params *params)
+{
+	/* Normalize compression level. */
+	if (params->level == 0)
+		params->level = 1;
+}
+
 #ifdef WITH_LIBLZMA
 static void
 filter_unlzma_init(struct io_lzma *io, lzma_stream *s)
@@ -725,10 +735,12 @@
 	filter_lzma(&io, fd_in, fd_out);
 }
 #else
+static const char *env_lzma[] = { "LZMA", NULL };
+
 static void
 decompress_lzma(int fd_in, int fd_out, const char *desc)
 {
-	fd_fd_filter(fd_in, fd_out, desc, env_xz, XZ, "-dc", "--format=lzma", NULL);
+	fd_fd_filter(fd_in, fd_out, desc, env_lzma, LZMA, "-dc", NULL);
 }
 
 static void
@@ -737,7 +749,7 @@
 	char combuf[6];
 
 	snprintf(combuf, sizeof(combuf), "-c%d", params->level);
-	fd_fd_filter(fd_in, fd_out, desc, env_xz, XZ, combuf, "--format=lzma", NULL);
+	fd_fd_filter(fd_in, fd_out, desc, env_lzma, LZMA, combuf, NULL);
 }
 #endif
 
@@ -745,7 +757,7 @@
 	.name = "lzma",
 	.extension = ".lzma",
 	.default_level = 6,
-	.fixup_params = fixup_none_params,
+	.fixup_params = fixup_lzma_params,
 	.compress = compress_lzma,
 	.decompress = decompress_lzma,
 };