summaryrefslogtreecommitdiffstats
path: root/tools/xz
diff options
context:
space:
mode:
authoracoul <acoul@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-03-10 18:41:33 +0000
committeracoul <acoul@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-03-10 18:41:33 +0000
commita42e50cceaf2cc8997cfb6870ae1ab70f3f1abe1 (patch)
tree1d1eaff2abe1537ab418cea021c2c3c9b2adfd3c /tools/xz
parent445c52e220add079ec8a5936e6e95639b3a5345e (diff)
tools/xz: add some upstream patches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26018 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/xz')
-rw-r--r--tools/xz/patches/000-upstream-001-check_compress.patch32
-rw-r--r--tools/xz/patches/000-upstream-002-clean_suffix.patch105
2 files changed, 137 insertions, 0 deletions
diff --git a/tools/xz/patches/000-upstream-001-check_compress.patch b/tools/xz/patches/000-upstream-001-check_compress.patch
new file mode 100644
index 000000000..1b918a4f3
--- /dev/null
+++ b/tools/xz/patches/000-upstream-001-check_compress.patch
@@ -0,0 +1,32 @@
+From: Lasse Collin <lasse.collin@tukaani.org>
+Date: Fri, 4 Feb 2011 09:29:47 +0000 (+0200)
+Subject: xz: Check if the file already has custom suffix when compressing.
+X-Git-Url: http://repo.or.cz/w/xz.git/commitdiff_plain/8930c7ae3f82bdae15aa129f01de08be23d7e8d7
+
+xz: Check if the file already has custom suffix when compressing.
+
+Now "xz -S .test foo.test" refuses to compress the
+file because it already has the suffix .test. The man
+page had it documented this way already.
+---
+
+diff --git a/src/xz/suffix.c b/src/xz/suffix.c
+index ea86c1a..f795e2a 100644
+--- a/src/xz/suffix.c
++++ b/src/xz/suffix.c
+@@ -183,6 +183,15 @@ compressed_name(const char *src_name, const size_t src_len)
+ }
+ }
+
++ if (custom_suffix != NULL) {
++ if (test_suffix(custom_suffix, src_name, src_len) != 0) {
++ message_warning(_("%s: File already has `%s' "
++ "suffix, skipping"), src_name,
++ custom_suffix);
++ return NULL;
++ }
++ }
++
+ // TODO: Hmm, maybe it would be better to validate this in args.c,
+ // since the suffix handling when decoding is weird now.
+ if (opt_format == FORMAT_RAW && custom_suffix == NULL) {
diff --git a/tools/xz/patches/000-upstream-002-clean_suffix.patch b/tools/xz/patches/000-upstream-002-clean_suffix.patch
new file mode 100644
index 000000000..e4e2c79c6
--- /dev/null
+++ b/tools/xz/patches/000-upstream-002-clean_suffix.patch
@@ -0,0 +1,105 @@
+From: Lasse Collin <lasse.collin@tukaani.org>
+Date: Fri, 4 Feb 2011 20:49:31 +0000 (+0200)
+Subject: xz: Clean up suffix.c.
+X-Git-Url: http://repo.or.cz/w/xz.git/commitdiff_plain/96f94bc925d579a700147fa5d7793b64d69cfc18
+
+xz: Clean up suffix.c.
+
+struct suffix_pair isn't needed in compresed_name()
+so get rid of it there.
+---
+
+diff --git a/src/xz/suffix.c b/src/xz/suffix.c
+index f795e2a..c89f67f 100644
+--- a/src/xz/suffix.c
++++ b/src/xz/suffix.c
+@@ -21,12 +21,6 @@
+ static char *custom_suffix = NULL;
+
+
+-struct suffix_pair {
+- const char *compressed;
+- const char *uncompressed;
+-};
+-
+-
+ /// \brief Test if the char is a directory separator
+ static bool
+ is_dir_sep(char c)
+@@ -86,7 +80,10 @@ test_suffix(const char *suffix, const char *src_name, size_t src_len)
+ static char *
+ uncompressed_name(const char *src_name, const size_t src_len)
+ {
+- static const struct suffix_pair suffixes[] = {
++ static const struct {
++ const char *compressed;
++ const char *uncompressed;
++ } suffixes[] = {
+ { ".xz", "" },
+ { ".txz", ".tar" }, // .txz abbreviation for .txt.gz is rare.
+ { ".lzma", "" },
+@@ -145,25 +142,25 @@ static char *
+ compressed_name(const char *src_name, const size_t src_len)
+ {
+ // The order of these must match the order in args.h.
+- static const struct suffix_pair all_suffixes[][3] = {
++ static const char *const all_suffixes[][3] = {
+ {
+- { ".xz", "" },
+- { ".txz", ".tar" },
+- { NULL, NULL }
++ ".xz",
++ ".txz",
++ NULL
+ }, {
+- { ".lzma", "" },
+- { ".tlz", ".tar" },
+- { NULL, NULL }
++ ".lzma",
++ ".tlz",
++ NULL
+ /*
+ }, {
+- { ".gz", "" },
+- { ".tgz", ".tar" },
+- { NULL, NULL }
++ ".gz",
++ ".tgz",
++ NULL
+ */
+ }, {
+ // --format=raw requires specifying the suffix
+ // manually or using stdout.
+- { NULL, NULL }
++ NULL
+ }
+ };
+
+@@ -171,14 +168,13 @@ compressed_name(const char *src_name, const size_t src_len)
+ assert(opt_format != FORMAT_AUTO);
+
+ const size_t format = opt_format - 1;
+- const struct suffix_pair *const suffixes = all_suffixes[format];
++ const char *const *suffixes = all_suffixes[format];
+
+- for (size_t i = 0; suffixes[i].compressed != NULL; ++i) {
+- if (test_suffix(suffixes[i].compressed, src_name, src_len)
+- != 0) {
++ for (size_t i = 0; suffixes[i] != NULL; ++i) {
++ if (test_suffix(suffixes[i], src_name, src_len) != 0) {
+ message_warning(_("%s: File already has `%s' "
+ "suffix, skipping"), src_name,
+- suffixes[i].compressed);
++ suffixes[i]);
+ return NULL;
+ }
+ }
+@@ -202,7 +198,7 @@ compressed_name(const char *src_name, const size_t src_len)
+ }
+
+ const char *suffix = custom_suffix != NULL
+- ? custom_suffix : suffixes[0].compressed;
++ ? custom_suffix : suffixes[0];
+ const size_t suffix_len = strlen(suffix);
+
+ char *dest_name = xmalloc(src_len + suffix_len + 1);