Permalink
Browse files

FL-348: gzip, add rsyncable path from Fedora, attempt to fix vzdump,

masked for testing
  • Loading branch information...
1 parent 1fd1c60 commit f56b6d0c7c3d2c3b0437f20ad0060f0057cc50fc @angryvincent angryvincent committed Jun 8, 2013
View
2 app-arch/gzip/Manifest
@@ -0,0 +1,2 @@
+DIST gzip-1.4.tar.gz 907411 SHA256 d166cfd3da380da1bd535633e8890bfb5664f9e68870a611d1dc01a3e9f711ee SHA512 9ba6d11f0469b80433a5da25f834f7652db109c235e2a849f4249adae3929fda9ebef98a181cc928a5dfc2b0d35df8b220afba130cd4a596a4dbddbf3fe8d2bc WHIRLPOOL 3d8552d2dc660953714f49674e8af2319eade0fd33c705ee253c2ea215cf4e5c3e6b7088c7087060ea7751508c74769b5b64d9e88bc22ea1d7ad0e8680a616e5
+DIST gzip-1.5.tar.xz 720956 SHA256 9ac20a3841a1246a8bedd800ea1fb93ef76521535d89cb59397d267026b6a173 SHA512 27b1b9c1ab75331b5368abb54541f3f251009a3bc6e49e42cda13bc088673d9f8c89c55caa63da60c1ea70fac2e6de24203b7aeaaaad4bc54302edbe275f46ea WHIRLPOOL c718e5e4e0e6f29de285380c25564997615b7213fa32604922436c3c6221bb9531d01518a6cc4e0a80b4694bb040768654d4bf07bb48290f90e61f13962e96ab
View
11 app-arch/gzip/files/gzip-1.3.8-install-symlinks.patch
@@ -0,0 +1,11 @@
+--- Makefile.in
++++ Makefile.in
+@@ -926,7 +926,7 @@
+ rm -f "$$dest" && \
+ case $@ in \
+ install-exec-hook) \
+- ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
++ $(LN_S) "$$source" "$$dest";; \
+ esac \
+ ) || exit; \
+ done; \
View
52 app-arch/gzip/files/gzip-1.4-assembler.patch
@@ -0,0 +1,52 @@
+http://bugs.gentoo.org/309079
+http://lists.gnu.org/archive/html/bug-gzip/2010-02/msg00032.html
+
+From 61af16213a488af3a8e994399ebd0859d390edb6 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@redhat.com>
+Date: Sat, 20 Mar 2010 13:05:58 +0100
+Subject: [PATCH] use assembly code matcher when possible
+
+* configure.ac (ASCPPPOST): Backslash-escape "#" in AC_SUBST'd
+variable, to keep make from seeing it as a comment-introducer.
+Based on a patch by Petr Pisar.
+* lib/Makefile.am (match.$(OBJEXT)): Use AM_V_GEN and AM_V_at.
+* lib/match.c: Don't include <config.h>.
+It would impede configure-time assembler test.
+* .x-sc_require_config_h: Exempt lib/match.c from syntax-check.
+* .x-sc_require_config_h_first: Likewise.
+---
+ .x-sc_require_config_h | 1 +
+ .x-sc_require_config_h_first | 1 +
+ THANKS | 1 +
+ configure.ac | 2 +-
+ lib/Makefile.am | 12 ++++++------
+ lib/match.c | 2 --
+ 6 files changed, 10 insertions(+), 9 deletions(-)
+ create mode 100644 .x-sc_require_config_h
+ create mode 100644 .x-sc_require_config_h_first
+
+--- a/configure
++++ b/configure
+@@ -22588,5 +22588,5 @@
+
+ # cc -E produces incorrect asm files on SVR4, so postprocess it.
+-ASCPPPOST="sed '/^ *#/d; s,//.*,,; s/% /%/g; s/\\. /./g'"
++ASCPPPOST="sed '/^ *\\#/d; s,//.*,,; s/% /%/g; s/\\. /./g'"
+
+
+diff --git a/lib/match.c b/lib/match.c
+index 4ef6128..5dd8d64 100644
+--- a/lib/match.c
++++ b/lib/match.c
+@@ -28,8 +28,6 @@
+ * David Mosberger-Tang <davidm@hpl.hp.com>.
+ */
+
+-#include <config.h>
+-
+ /* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix
+ * external symbols with an underline character '_'.
+ */
+--
+1.7.1.1
+
View
22 app-arch/gzip/files/gzip-1.4-no-gets.patch
@@ -0,0 +1,22 @@
+hack until gzip pulls a newer gnulib version
+
+From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
+From: Eric Blake <eblake@redhat.com>
+Date: Thu, 29 Mar 2012 13:30:41 -0600
+Subject: [PATCH] stdio: don't assume gets any more
+
+Gnulib intentionally does not have a gets module, and now that C11
+and glibc have dropped it, we should be more proactive about warning
+any user on a platform that still has a declaration of this dangerous
+interface.
+
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -125,7 +125,6 @@
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
+ #undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
View
288 app-arch/gzip/files/gzip-rsync.patch
@@ -0,0 +1,288 @@
+Index: gzip-1.5/deflate.c
+===================================================================
+--- gzip-1.5.orig/deflate.c
++++ gzip-1.5/deflate.c
+@@ -131,6 +131,14 @@
+ #endif
+ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
++#ifndef RSYNC_WIN
++# define RSYNC_WIN 4096
++#endif
++/* Size of rsync window, must be < MAX_DIST */
++
++#define RSYNC_SUM_MATCH(sum) ((sum) % RSYNC_WIN == 0)
++/* Whether window sum matches magic value */
++
+ /* ===========================================================================
+ * Local data used by the "longest match" routines.
+ */
+@@ -212,6 +220,8 @@ local int compr_level;
+ unsigned good_match;
+ /* Use a faster search when the previous match is longer than this */
+
++local ulg rsync_sum; /* rolling sum of rsync window */
++local ulg rsync_chunk_end; /* next rsync sequence point */
+
+ /* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+@@ -314,6 +324,10 @@ void lm_init (pack_level, flags)
+ #endif
+ /* prev will be initialized on the fly */
+
++ /* rsync params */
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ rsync_sum = 0;
++
+ /* Set the default configuration parameters:
+ */
+ max_lazy_match = configuration_table[pack_level].max_lazy;
+@@ -550,6 +564,8 @@ local void fill_window()
+ memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
+ match_start -= WSIZE;
+ strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */
++ if (rsync_chunk_end != 0xFFFFFFFFUL)
++ rsync_chunk_end -= WSIZE;
+
+ block_start -= (long) WSIZE;
+
+@@ -579,13 +595,46 @@ local void fill_window()
+ }
+ }
+
++local void rsync_roll(start, num)
++ unsigned start;
++ unsigned num;
++{
++ unsigned i;
++
++ if (start < RSYNC_WIN) {
++ /* before window fills. */
++ for (i = start; i < RSYNC_WIN; i++) {
++ if (i == start + num) return;
++ rsync_sum += (ulg)window[i];
++ }
++ num -= (RSYNC_WIN - start);
++ start = RSYNC_WIN;
++ }
++
++ /* buffer after window full */
++ for (i = start; i < start+num; i++) {
++ /* New character in */
++ rsync_sum += (ulg)window[i];
++ /* Old character out */
++ rsync_sum -= (ulg)window[i - RSYNC_WIN];
++ if (rsync_chunk_end == 0xFFFFFFFFUL && RSYNC_SUM_MATCH(rsync_sum))
++ rsync_chunk_end = i;
++ }
++}
++
++/* ===========================================================================
++ * Set rsync_chunk_end if window sum matches magic value.
++ */
++#define RSYNC_ROLL(s, n) \
++ do { if (rsync) rsync_roll((s), (n)); } while(0)
++
+ /* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+ #define FLUSH_BLOCK(eof) \
+ flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
+- (char*)NULL, (long)strstart - block_start, (eof))
++ (char*)NULL, (long)strstart - block_start, flush-1, (eof))
+
+ /* ===========================================================================
+ * Processes a new input file and return its compressed length. This
+@@ -596,7 +645,7 @@ local void fill_window()
+ local off_t deflate_fast()
+ {
+ IPos hash_head; /* head of the hash chain */
+- int flush; /* set if current block must be flushed */
++ int flush; /* set if current block must be flushed, 2=>and padded */
+ unsigned match_length = 0; /* length of best match */
+
+ prev_length = MIN_MATCH-1;
+@@ -625,7 +674,8 @@ local off_t deflate_fast()
+ flush = ct_tally(strstart-match_start, match_length - MIN_MATCH);
+
+ lookahead -= match_length;
+-
++
++ RSYNC_ROLL(strstart, match_length);
+ /* Insert new strings in the hash table only if the match length
+ * is not too large. This saves time but degrades compression.
+ */
+@@ -654,9 +704,14 @@ local off_t deflate_fast()
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c",window[strstart]));
+ flush = ct_tally (0, window[strstart]);
++ RSYNC_ROLL(strstart, 1);
+ lookahead--;
+ strstart++;
+ }
++ 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
+@@ -730,6 +785,7 @@ off_t deflate()
+ */
+ lookahead -= prev_length-1;
+ prev_length -= 2;
++ RSYNC_ROLL(strstart, prev_length+1);
+ do {
+ strstart++;
+ INSERT_STRING(strstart, hash_head);
+@@ -742,24 +798,40 @@ off_t deflate()
+ match_available = 0;
+ match_length = MIN_MATCH-1;
+ strstart++;
+- if (flush) FLUSH_BLOCK(0), block_start = strstart;
+
++ if (rsync && strstart > rsync_chunk_end) {
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
++ }
++ if (flush) FLUSH_BLOCK(0), block_start = strstart;
+ } else if (match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr,"%c",window[strstart-1]));
+- if (ct_tally (0, window[strstart-1])) {
+- FLUSH_BLOCK(0), block_start = strstart;
++ flush = ct_tally (0, window[strstart-1]);
++ if (rsync && strstart > rsync_chunk_end) {
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
+ }
++ if (flush) FLUSH_BLOCK(0), block_start = strstart;
++ RSYNC_ROLL(strstart, 1);
+ strstart++;
+ lookahead--;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
++ if (rsync && strstart > rsync_chunk_end) {
++ /* Reset huffman tree */
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
++ FLUSH_BLOCK(0), block_start = strstart;
++ }
++
+ match_available = 1;
++ RSYNC_ROLL(strstart, 1);
+ strstart++;
+ lookahead--;
+ }
+Index: gzip-1.5/doc/gzip.texi
+===================================================================
+--- gzip-1.5.orig/doc/gzip.texi
++++ gzip-1.5/doc/gzip.texi
+@@ -353,6 +353,14 @@ specified on the command line are direct
+ 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 @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 @var{suf} instead of @samp{.gz}. Any suffix can be
+Index: gzip-1.5/gzip.c
+===================================================================
+--- gzip-1.5.orig/gzip.c
++++ gzip-1.5/gzip.c
+@@ -213,6 +213,7 @@ int ofd; /* output fil
+ unsigned insize; /* valid bytes in inbuf */
+ unsigned inptr; /* index of next byte to be processed in inbuf */
+ unsigned outcnt; /* bytes in output buffer */
++int rsync = 0; /* make ryncable chunks */
+
+ static int handled_sig[] =
+ {
+@@ -270,7 +271,7 @@ static const struct option longopts[] =
+ {"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) */
+-
++ {"rsyncable", 0, 0, 'R'}, /* make rsync-friendly archive */
+ { 0, 0, 0, 0 }
+ };
+
+@@ -353,6 +354,7 @@ local void help()
+ " -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",
+ "",
+ "With no FILE, or when FILE is -, read standard input.",
+ "",
+@@ -482,6 +484,9 @@ int main (int argc, char **argv)
+ recursive = 1;
+ #endif
+ break;
++
++ case 'R':
++ rsync = 1; break;
+ case 'S':
+ #ifdef NO_MULTIPLE_DOTS
+ if (*optarg == '.') optarg++;
+Index: gzip-1.5/gzip.h
+===================================================================
+--- gzip-1.5.orig/gzip.h
++++ gzip-1.5/gzip.h
+@@ -140,6 +140,7 @@ EXTERN(uch, window); /* Sliding
+ 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 */
++extern int rsync; /* deflate into rsyncable chunks */
+
+ extern off_t bytes_in; /* number of input bytes */
+ extern off_t bytes_out; /* number of output bytes */
+@@ -287,7 +288,7 @@ extern off_t deflate (void);
+ /* in trees.c */
+ extern void ct_init (ush *attr, int *method);
+ extern int ct_tally (int dist, int lc);
+-extern off_t flush_block (char *buf, ulg stored_len, int eof);
++extern off_t flush_block (char *buf, ulg stored_len, int pad, int eof);
+
+ /* in bits.c */
+ extern void bi_init (file_t zipfile);
+Index: gzip-1.5/trees.c
+===================================================================
+--- gzip-1.5.orig/trees.c
++++ gzip-1.5/trees.c
+@@ -856,9 +856,10 @@ local void send_all_trees(lcodes, dcodes
+ * trees or store, and output the encoded block to the zip file. This function
+ * returns the total compressed length for the file so far.
+ */
+-off_t flush_block(buf, stored_len, eof)
++off_t flush_block(buf, stored_len, pad, eof)
+ char *buf; /* input block, or NULL if too old */
+ ulg stored_len; /* length of input block */
++ int pad; /* pad output to byte boundary */
+ int eof; /* true if this is the last block for a file */
+ {
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+@@ -951,6 +952,10 @@ off_t flush_block(buf, stored_len, eof)
+ Assert (input_len == bytes_in, "bad input size");
+ bi_windup();
+ compressed_len += 7; /* align on byte boundary */
++ } else if (pad && (compressed_len % 8) != 0) {
++ send_bits((STORED_BLOCK<<1)+eof, 3); /* send block type */
++ compressed_len = (compressed_len + 3 + 7) & ~7L;
++ copy_block(buf, 0, 1); /* with header */
+ }
+
+ return compressed_len >> 3;
View
45 app-arch/gzip/gzip-1.5-r1.ebuild
@@ -0,0 +1,45 @@
+# Distributed under the terms of the GNU General Public License v2
+
+inherit eutils flag-o-matic unpacker
+
+DESCRIPTION="Standard GNU compressor"
+HOMEPAGE="http://www.gnu.org/software/gzip/"
+SRC_URI="mirror://gnu-alpha/gzip/${P}.tar.xz
+ mirror://gnu/gzip/${P}.tar.xz
+ mirror://gentoo/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="*"
+IUSE="nls pic static"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+src_unpack() {
+ unpacker
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-rsync.patch
+ epatch "${FILESDIR}"/${PN}-1.3.8-install-symlinks.patch
+}
+
+src_compile() {
+ use static && append-flags -static
+ # avoid text relocation in gzip
+ use pic && export DEFS="NO_ASM"
+ econf || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc ChangeLog NEWS README THANKS TODO
+ docinto txt
+ dodoc algorithm.doc gzip.doc
+
+ # keep most things in /usr, just the fun stuff in /
+ dodir /bin
+ mv "${D}"/usr/bin/{gunzip,gzip,uncompress,zcat} "${D}"/bin/ || die
+ sed -e 's:/usr::' -i "${D}"/bin/gunzip || die
+}
View
44 app-arch/gzip/gzip-1.5.ebuild
@@ -0,0 +1,44 @@
+# Distributed under the terms of the GNU General Public License v2
+
+inherit eutils flag-o-matic unpacker
+
+DESCRIPTION="Standard GNU compressor"
+HOMEPAGE="http://www.gnu.org/software/gzip/"
+SRC_URI="mirror://gnu-alpha/gzip/${P}.tar.xz
+ mirror://gnu/gzip/${P}.tar.xz
+ mirror://gentoo/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="*"
+IUSE="nls pic static"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+src_unpack() {
+ unpacker
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-1.3.8-install-symlinks.patch
+}
+
+src_compile() {
+ use static && append-flags -static
+ # avoid text relocation in gzip
+ use pic && export DEFS="NO_ASM"
+ econf || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc ChangeLog NEWS README THANKS TODO
+ docinto txt
+ dodoc algorithm.doc gzip.doc
+
+ # keep most things in /usr, just the fun stuff in /
+ dodir /bin
+ mv "${D}"/usr/bin/{gunzip,gzip,uncompress,zcat} "${D}"/bin/ || die
+ sed -e 's:/usr::' -i "${D}"/bin/gunzip || die
+}
View
3 profiles/package.mask/funtoo-staging
@@ -1,5 +1,8 @@
# Keep the most recent masks in a reverse chrono order
# newest on top
+# Oleg Vinichenko (8 Jun 2013)
+# rsyncable patch to resolve vzdump issues, required gzip fork, masked for testing
+=app-arch/gzip-1.5-r1
# Daniel Robbins (10 Apr 2013)
# FL-487: staging zenoss, as it is a work in progress.

0 comments on commit f56b6d0

Please sign in to comment.