Update 1.4 patch

(Portage version: 2.2.0_alpha123/git/Linux x86_64, RepoMan options: --force, unsigned Manifest commit)
This commit is contained in:
Mario Fetka
2012-10-17 15:21:53 +02:00
parent 2137457196
commit 6c37d6e57e
3 changed files with 71 additions and 47 deletions

View File

@@ -1,6 +1,11 @@
diff -u -r ../gzip-1.3.12.orig/deflate.c ./deflate.c
--- ../gzip-1.3.12.orig/deflate.c 2006-12-07 17:53:00.000000000 -0600
+++ ./deflate.c 2008-09-01 20:49:37.000000000 -0500
NOTE: this patch is for _gzip_!
This is pending for actual inclusion in gzip. It is currently being
tried out in the default gzip for Debian Sarge, and may go into the
upstream gzip at somepoint in the not-too-distant future.
--- gzip-1.3.6/deflate.c.orig 2006-11-30 00:13:22.863409500 +0100
+++ gzip-1.3.6/deflate.c 2006-11-30 00:14:14.346627000 +0100
@@ -135,6 +135,14 @@
#endif
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
@@ -114,14 +119,14 @@ diff -u -r ../gzip-1.3.12.orig/deflate.c ./deflate.c
/* No match, output a literal byte */
Tracevv((stderr,"%c",window[strstart]));
flush = ct_tally (0, window[strstart]);
+ RSYNC_ROLL(strstart, 1);
+ RSYNC_ROLL(strstart, 1);
lookahead--;
strstart++;
}
+ if (rsync && strstart > rsync_chunk_end) {
+ rsync_chunk_end = 0xFFFFFFFFUL;
+ flush = 2;
+ }
+ if (rsync && strstart > rsync_chunk_end) {
+ rsync_chunk_end = 0xFFFFFFFFUL;
+ flush = 2;
+ }
if (flush) FLUSH_BLOCK(0), block_start = strstart;
/* Make sure that we always have enough lookahead, except
@@ -177,28 +182,9 @@ diff -u -r ../gzip-1.3.12.orig/deflate.c ./deflate.c
strstart++;
lookahead--;
}
diff -u -r ../gzip-1.3.12.orig/doc/gzip.texi ./doc/gzip.texi
--- ../gzip-1.3.12.orig/doc/gzip.texi 2007-02-05 17:29:04.000000000 -0600
+++ ./doc/gzip.texi 2008-09-01 20:55:58.000000000 -0500
@@ -350,6 +350,14 @@
into the directory and compress all the files it finds there (or
decompress them in the case of @command{gunzip}).
+@item --rsyncable
+While compressing, synchronize the output occasionally based on the
+input. This reduces compression by about 1 percent most cases, but
+means that the @command{rsync} program can take advantage of similarities
+in the uncompressed input when syncronizing two files compressed with
+this flag. @command{gunzip} cannot tell the difference between a
+compressed file created with this option, and one created without it.
+
@item --suffix @var{suf}
@itemx -S @var{suf}
Use suffix @var{suf} instead of @samp{.gz}. Any suffix can be
diff -u -r ../gzip-1.3.12.orig/gzip.c ./gzip.c
--- ../gzip-1.3.12.orig/gzip.c 2007-03-20 00:09:51.000000000 -0500
+++ ./gzip.c 2008-09-01 20:45:28.000000000 -0500
@@ -231,6 +231,7 @@
--- gzip-1.3.6/gzip.c.orig 2006-11-20 09:40:33.000000000 +0100
+++ gzip-1.3.6/gzip.c 2006-11-30 00:15:31.387441750 +0100
@@ -218,6 +218,7 @@
unsigned insize; /* valid bytes in inbuf */
unsigned inptr; /* index of next byte to be processed in inbuf */
unsigned outcnt; /* bytes in output buffer */
@@ -206,7 +192,7 @@ diff -u -r ../gzip-1.3.12.orig/gzip.c ./gzip.c
struct option longopts[] =
{
@@ -260,6 +261,7 @@
@@ -247,6 +248,7 @@
{"best", 0, 0, '9'}, /* compress better */
{"lzw", 0, 0, 'Z'}, /* make output compatible with old compress */
{"bits", 1, 0, 'b'}, /* max number of bits per code (implies -Z) */
@@ -214,27 +200,27 @@ diff -u -r ../gzip-1.3.12.orig/gzip.c ./gzip.c
{ 0, 0, 0, 0 }
};
@@ -341,6 +343,7 @@
@@ -329,6 +331,7 @@
" -Z, --lzw produce output compatible with old compress",
" -b, --bits=BITS max number of bits per code (implies -Z)",
#endif
+ " --rsyncable Make rsync-friendly archive",
+ " --rsyncable make rsync-friendly archive",
"",
"With no FILE, or when FILE is -, read standard input.",
"",
@@ -469,6 +472,8 @@
@@ -469,6 +472,9 @@
recursive = 1;
#endif
break;
+ case 'R':
+ rsync = 1; break;
+ rsync = 1;
+ break;
case 'S':
#ifdef NO_MULTIPLE_DOTS
if (*optarg == '.') optarg++;
diff -u -r ../gzip-1.3.12.orig/gzip.h ./gzip.h
--- ../gzip-1.3.12.orig/gzip.h 2007-03-20 00:09:51.000000000 -0500
+++ ./gzip.h 2008-09-01 20:43:35.000000000 -0500
@@ -158,6 +158,7 @@
--- gzip-1.3.5/gzip.h 2001-09-30 23:53:41 -0700
+++ rsyncable/gzip.h 2005-02-05 09:40:33 -0800
@@ -133,6 +133,7 @@
extern unsigned insize; /* valid bytes in inbuf */
extern unsigned inptr; /* index of next byte to be processed in inbuf */
extern unsigned outcnt; /* bytes in output buffer */
@@ -242,7 +228,7 @@ diff -u -r ../gzip-1.3.12.orig/gzip.h ./gzip.h
extern off_t bytes_in; /* number of input bytes */
extern off_t bytes_out; /* number of output bytes */
@@ -306,7 +307,7 @@
@@ -281,7 +282,7 @@
/* in trees.c */
void ct_init OF((ush *attr, int *method));
int ct_tally OF((int dist, int lc));
@@ -251,10 +237,44 @@ diff -u -r ../gzip-1.3.12.orig/gzip.h ./gzip.h
/* in bits.c */
void bi_init OF((file_t zipfile));
diff -u -r ../gzip-1.3.12.orig/trees.c ./trees.c
--- ../gzip-1.3.12.orig/trees.c 2006-11-20 02:40:33.000000000 -0600
+++ ./trees.c 2008-09-01 20:53:37.000000000 -0500
@@ -860,9 +860,10 @@
--- gzip-1.3.6/doc/gzip.texi 2002-09-29 23:57:29 -0700
+++ rsyncable/doc/gzip.texi 2005-02-05 09:40:33 -0800
@@ -334,6 +334,14 @@
into the directory and compress all the files it finds there (or
decompress them in the case of @code{gunzip}).
+@item --rsyncable
+While compressing, synchronize the output occasionally based on the
+input. This increases size by less than 1 percent most cases, but
+means that the @code{rsync} program can take advantage of similarities
+in the uncompressed input when syncronizing two files compressed with
+this flag. @code{gunzip} cannot tell the difference between a
+compressed file created with this option, and one created without it.
+
@item --suffix @var{suf}
@itemx -S @var{suf}
Use suffix @samp{@var{suf}} instead of @samp{.gz}. Any suffix can be
--- gzip-1.3.5/trees.c 1999-10-05 22:00:00 -0700
+++ rsyncable/trees.c 2005-02-05 09:40:33 -0800
@@ -46,12 +46,13 @@
* void ct_tally (int dist, int lc);
* Save the match info and tally the frequency counts.
*
- * off_t flush_block (char *buf, ulg stored_len, int eof)
+ * off_t flush_block (char *buf, ulg stored_len, int pad, int eof)
* Determine the best encoding for the current block: dynamic trees,
* static trees or store, and output the encoded block to the zip
- * file. Returns the total compressed length for the file so far.
- *
- */
+ * file. If pad is set, pads the block to the next
+ * byte. Returns the total compressed length for the file so
+ * far.
+ * */
#include <config.h>
#include <ctype.h>
@@ -847,9 +848,10 @@
* trees or store, and output the encoded block to the zip file. This function
* returns the total compressed length for the file so far.
*/
@@ -266,7 +286,7 @@ diff -u -r ../gzip-1.3.12.orig/trees.c ./trees.c
int eof; /* true if this is the last block for a file */
{
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
@@ -955,6 +956,10 @@
@@ -941,6 +943,10 @@
Assert (input_len == bytes_in, "bad input size");
bi_windup();
compressed_len += 7; /* align on byte boundary */