summaryrefslogtreecommitdiff
path: root/data/dpkg/lzma.diff
blob: fa749a88ac11bf77ef1135ca214d0a28e0d85cb7 (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 -ru dpkg-1.18.10/dpkg-deb/main.c dpkg-1.18.10+iPhone/dpkg-deb/main.c
--- dpkg-1.18.10/dpkg-deb/main.c	2016-07-05 01:55:13.000000000 +0000
+++ dpkg-1.18.10+iPhone/dpkg-deb/main.c	2016-08-22 22:37:49.000000000 +0000
@@ -212,8 +212,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)
-    warning(_("deprecated compression type '%s'; use xz instead"), value);
   if (compress_params.type == COMPRESSOR_TYPE_BZIP2)
     warning(_("deprecated compression type '%s'; use xz or gzip instead"), value);
 }
diff -ru dpkg-1.18.10/lib/dpkg/compress.c dpkg-1.18.10+iPhone/lib/dpkg/compress.c
--- dpkg-1.18.10/lib/dpkg/compress.c	2016-07-05 02:00:41.000000000 +0000
+++ dpkg-1.18.10+iPhone/lib/dpkg/compress.c	2016-08-22 22:38:01.000000000 +0000
@@ -639,6 +639,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)
@@ -700,10 +710,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
@@ -712,7 +724,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
 
@@ -720,7 +732,7 @@
 	.name = "lzma",
 	.extension = ".lzma",
 	.default_level = 6,
-	.fixup_params = fixup_none_params,
+	.fixup_params = fixup_lzma_params,
 	.compress = compress_lzma,
 	.decompress = decompress_lzma,
 };