commit 8c75e9d5e81ac9d332f24a8f12517ba9cc177d27c61e75daafddaee5d03def21 Author: Sascha Peilicke Date: Thu Jun 23 11:24:20 2011 +0000 Accepting request 74353 from Base:System add for factory OBS-URL: https://build.opensuse.org/request/show/74353 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/pigz?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/pigz-2.1.6.tar.bz2 b/pigz-2.1.6.tar.bz2 new file mode 100644 index 0000000..cf5c366 --- /dev/null +++ b/pigz-2.1.6.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:110fcf143c92074a2bf691746530473a029e5d9bb3f0a06948e90ceb2abadc34 +size 46806 diff --git a/pigz-always-thread.patch b/pigz-always-thread.patch new file mode 100644 index 0000000..d2b28d0 --- /dev/null +++ b/pigz-always-thread.patch @@ -0,0 +1,16 @@ +Dictzip only really works in the threaded code paths. So let's force +use them and ignore the non-parallel case (bnc#597756). + +Index: pigz-2.1.5/pigz.c +=================================================================== +--- pigz-2.1.5.orig/pigz.c ++++ pigz-2.1.5/pigz.c +@@ -2820,7 +2820,7 @@ local void process(char *path) + unlzw(); + } + #ifndef NOTHREAD +- else if (procs > 1) ++ else if (1) + parallel_compress(); + #endif + else diff --git a/pigz-dictzip.patch b/pigz-dictzip.patch new file mode 100644 index 0000000..55f3ac0 --- /dev/null +++ b/pigz-dictzip.patch @@ -0,0 +1,238 @@ +diff -u -r pigz-2.1.6.orig/pigz.c pigz-2.1.6/pigz.c +--- pigz-2.1.6.orig/pigz.c 2010-01-17 21:09:37.000000000 +0100 ++++ pigz-2.1.6/pigz.c 2011-06-02 12:29:12.245689087 +0200 +@@ -304,6 +304,8 @@ + } \ + } while (0) + ++#define DZIP_HEADER_LEN 24 ++ + /* globals (modified by main thread only when it's the only thread) */ + local int ind; /* input file descriptor */ + local int outd; /* output file descriptor */ +@@ -322,11 +324,12 @@ + local int list; /* true to list files instead of compress */ + local int first = 1; /* true if we need to print listing header */ + local int decode; /* 0 to compress, 1 to decompress, 2 to test */ ++local int dictzip; /* true to write random access dictionary */ + local int level; /* compression level */ + local int rsync; /* true for rsync blocking */ + local int procs; /* maximum number of compression threads (>= 1) */ + local int dict; /* true to initialize dictionary in each thread */ +-local size_t size; /* uncompressed input size per thread (>= 32K) */ ++size_t size; /* uncompressed input size per thread (>= 32K) */ + + /* saved gzip/zip header data for decompression, testing, and listing */ + local time_t stamp; /* time stamp from gzip header */ +@@ -560,6 +563,17 @@ + return dos; + } + ++long long get_file_size(int fd) ++{ ++ long long old_pos = lseek(fd, 0, SEEK_CUR); ++ long long retval; ++ ++ retval = lseek(fd, 0, SEEK_END); ++ lseek(fd, old_pos, SEEK_SET); ++ ++ return retval; ++} ++ + /* put a 4-byte integer into a byte array in LSB order or MSB order */ + #define PUT2L(a,b) (*(a)=(b)&0xff,(a)[1]=(b)>>8) + #define PUT4L(a,b) (PUT2L(a,(b)&0xffff),PUT2L((a)+2,(b)>>16)) +@@ -613,12 +627,27 @@ + head[0] = 31; + head[1] = 139; + head[2] = 8; /* deflate */ +- head[3] = name != NULL ? 8 : 0; ++ head[3] = 0; ++ if (dictzip) ++ head[3] |= 4; ++ if (name != NULL) ++ head[3] |= 8; + PUT4L(head + 4, mtime); + head[8] = level == 9 ? 2 : (level == 1 ? 4 : 0); + head[9] = 3; /* unix */ + writen(outd, head, 10); + len = 10; ++ if (dictzip) { ++ long long file_len = get_file_size(ind); ++ int extra_len = DZIP_HEADER_LEN + ((file_len / size) + 2) * sizeof(int); ++ ++ char *extra = (char*)malloc(extra_len); ++ ++ memset(extra, 0, extra_len); ++ writen(outd, extra, extra_len); ++ free(extra); ++ len += extra_len; ++ } + if (name != NULL) + writen(outd, (unsigned char *)name, strlen(name) + 1); + if (name != NULL) +@@ -1165,6 +1194,10 @@ + unsigned long ulen; /* total uncompressed size (overflow ok) */ + unsigned long clen; /* total compressed size (overflow ok) */ + unsigned long check; /* check value of uncompressed data */ ++ char *extra = NULL; /* dictzip extra header field */ ++ int dz_cur; /* dictzip current pointer to header */ ++ long long file_len = get_file_size(ind); ++ int extra_len = DZIP_HEADER_LEN + ((file_len / size) + 2) * sizeof(int); + + (void)dummy; + +@@ -1172,6 +1205,25 @@ + Trace(("-- write thread running")); + head = put_header(); + ++ if (dictzip) { ++ extra = (char*)malloc(extra_len + 32); ++ memset(extra, 0, extra_len); ++ ++ if (extra_len >= ((1ULL << 16) - 1)) ++ bail("file too long for dictzip\n", ""); ++ /* extra length */ ++ PUT2L(extra, extra_len - 2); ++ /* Random Access ID */ ++ extra[2] = 'R'; ++ extra[3] = 'A'; ++ /* RA version 99 */ ++ /* XXX need to standardize! */ ++ PUT2L(extra + 6, 99); ++ // PUT2L(extra + 6, 1); ++ ++ dz_cur = 0; ++ } ++ + /* process output of compress threads until end of input */ + ulen = clen = 0; + check = CHECK(0L, Z_NULL, 0); +@@ -1191,6 +1243,15 @@ + ulen += (unsigned long)len; + clen += (unsigned long)(job->out->len); + ++ if (dictzip) { ++ if (((dz_cur * 4) + DZIP_HEADER_LEN + sizeof(int)) > extra_len) { ++ printf(" %d > %d\n", dz_cur, file_len / size); ++ bail ("input file too large\n", ""); ++ } ++ PUT4L(extra + (dz_cur * 4) + DZIP_HEADER_LEN, job->out->len); ++ dz_cur++; ++ } ++ + /* write the compressed data and drop the output buffer */ + Trace(("-- writing #%ld", seq)); + writen(outd, job->out->buf, job->out->len); +@@ -1215,6 +1276,22 @@ + /* write trailer */ + put_trailer(ulen, clen, check, head); + ++ if (dictzip) { ++ /* chunk length */ ++ PUT4L(extra + 8, size); ++ /* chunk count */ ++ PUT4L(extra + 12, dz_cur); ++// PUT4L(extra + 12, (file_len / size) + 1); ++ /* Target file size (64 bit) */ ++ PUT4L(extra + 16, file_len); ++ PUT4L(extra + 20, file_len >> 32); ++ /* write extra header */ ++ if (lseek(outd, 10, SEEK_SET) != 10) ++ bail("couldn't seek in output file\n", ""); ++ writen(outd, extra, extra_len); ++ free(extra); ++ } ++ + /* verify no more jobs, prepare for next use */ + possess(compress_have); + assert(compress_head == NULL && peek_lock(compress_have) == 0); +@@ -2625,6 +2702,18 @@ + /* prepare gzip header information for compression */ + name = headis & 1 ? justname(in) : NULL; + mtime = headis & 2 ? st.st_mtime : 0; ++ ++ /* Find a sane chunk size */ ++ if (dictzip) { ++ long long file_len = get_file_size(ind); ++ int extra_len; ++ ++ extra_len = DZIP_HEADER_LEN + ((file_len / size) + 2) * sizeof(int); ++ while (extra_len >= ((1 << 16) - 1)) { ++ size += (1 << 10ULL); ++ extra_len = DZIP_HEADER_LEN + ((file_len / size) + 2) * sizeof(int); ++ } ++ } + } + SET_BINARY_MODE(ind); + +@@ -2678,6 +2767,8 @@ + out = malloc(strlen("") + 1); + if (out == NULL) + bail("not enough memory", ""); ++ if (dictzip) ++ bail("need to have a seekable output for dictzip\n", ""); + strcpy(out, ""); + outd = 1; + if (!decode && !force && isatty(outd)) +@@ -2796,6 +2887,7 @@ + " -i, --independent Compress blocks independently for damage recovery", + " -R, --rsyncable Input-determined block locations for rsync", + " -d, --decompress Decompress the compressed input", ++" -e, --dictzip Write dictzip random seek information in gzip header", + " -t, --test Test the integrity of the compressed input", + " -l, --list List the contents of the compressed input", + " -f, --force Force overwrite, compress .gz, links, and to terminal", +@@ -2868,17 +2960,18 @@ + force = 0; /* don't overwrite, don't compress links */ + recurse = 0; /* don't go into directories */ + form = 0; /* use gzip format */ ++ dictzip = 0; /* don't write dictzip information */ + } + + /* long options conversion to short options */ + local char *longopts[][2] = { + {"LZW", "Z"}, {"ascii", "a"}, {"best", "9"}, {"bits", "Z"}, +- {"blocksize", "b"}, {"decompress", "d"}, {"fast", "1"}, {"force", "f"}, +- {"help", "h"}, {"independent", "i"}, {"keep", "k"}, {"license", "L"}, +- {"list", "l"}, {"name", "N"}, {"no-name", "n"}, {"no-time", "T"}, +- {"processes", "p"}, {"quiet", "q"}, {"recursive", "r"}, {"rsyncable", "R"}, +- {"silent", "q"}, {"stdout", "c"}, {"suffix", "S"}, {"test", "t"}, +- {"to-stdout", "c"}, {"uncompress", "d"}, {"verbose", "v"}, ++ {"blocksize", "b"}, {"decompress", "d"}, {"dictzip", "e"}, {"fast", "1"}, ++ {"force", "f"}, {"help", "h"}, {"independent", "i"}, {"keep", "k"}, ++ {"license", "L"}, {"list", "l"}, {"name", "N"}, {"no-name", "n"}, ++ {"no-time", "T"}, {"processes", "p"}, {"quiet", "q"}, {"recursive", "r"}, ++ {"rsyncable", "R"}, {"silent", "q"}, {"stdout", "c"}, {"suffix", "S"}, ++ {"test", "t"}, {"to-stdout", "c"}, {"uncompress", "d"}, {"verbose", "v"}, + {"version", "V"}, {"zip", "K"}, {"zlib", "z"}}; + #define NLOPTS (sizeof(longopts) / (sizeof(char *) << 1)) + +@@ -2984,6 +3077,7 @@ + case 'b': get = 1; break; + case 'c': pipeout = 1; break; + case 'd': decode = 1; headis = 0; break; ++ case 'e': dictzip = 1; dict = 0; break; + case 'f': force = 1; break; + case 'h': help(); break; + case 'i': dict = 0; break; +@@ -3112,6 +3206,19 @@ + fprintf(stderr, "warning: output is concatenated zip files "); + fprintf(stderr, "-- pigz will not be able to extract\n"); + } ++ ++ /* dictzip sanity checks */ ++ if (dictzip && (form > 1)) { ++ fprintf(stderr, "warning: dictzip only works on gzip files\n"); ++ } ++ ++#if 0 ++ if (dictzip && (size >= (64 << 10))) { ++ fprintf(stderr, "warning: dictzip needs chunks < 64k.\n"); ++ size = (63 << 10); ++ } ++#endif ++ + process(strcmp(argv[n], "-") ? argv[n] : NULL); + done++; + } diff --git a/pigz-do-symlinks.patch b/pigz-do-symlinks.patch new file mode 100644 index 0000000..4f67128 --- /dev/null +++ b/pigz-do-symlinks.patch @@ -0,0 +1,16 @@ +--- pigz-2.1.6/pigz.c.orig 2011-06-02 12:36:40.043909605 +0200 ++++ pigz-2.1.6/pigz.c 2011-06-02 12:39:32.148763023 +0200 +@@ -2596,11 +2596,13 @@ + in); + return; + } ++#if 0 + if ((st.st_mode & S_IFMT) == S_IFLNK && !force && !pipeout) { + if (verbosity > 0) + fprintf(stderr, "%s is a symbolic link -- skipping\n", in); + return; + } ++#endif + if ((st.st_mode & S_IFMT) == S_IFDIR && !recurse) { + if (verbosity > 0) + fprintf(stderr, "%s is a directory -- skipping\n", in); diff --git a/pigz-spl.patch b/pigz-spl.patch new file mode 100644 index 0000000..a751a76 --- /dev/null +++ b/pigz-spl.patch @@ -0,0 +1,11 @@ +--- pigz-2.1.6/pigz.c.orig 2011-06-02 12:36:25.000000000 +0200 ++++ pigz-2.1.6/pigz.c 2011-06-02 12:36:40.043909605 +0200 +@@ -1861,7 +1861,7 @@ + nm += len - 4; + len = 4; + if (strcmp(nm, ".zip") == 0 || strcmp(nm, ".ZIP") == 0 || +- strcmp(nm, ".tgz") == 0) ++ strcmp(nm, ".tgz") == 0 || strcmp(nm, ".spl") == 0) + return 4; + } + if (len > 3) { diff --git a/pigz.changes b/pigz.changes new file mode 100644 index 0000000..410351c --- /dev/null +++ b/pigz.changes @@ -0,0 +1,23 @@ +------------------------------------------------------------------- +Thu Jun 2 12:20:22 CEST 2011 - visnov@suse.cz + +- update to 2.1.6 +- package unpigz +- create debug packages +- package manpage + +------------------------------------------------------------------- +Tue Apr 20 00:44:25 CEST 2010 - agraf@suse.de + +- fix dictzip with #CPU == 1 (bnc#597756) + +------------------------------------------------------------------- +Wed Mar 3 16:12:37 CET 2010 - visnov@suse.de + +- include symlinks patch + +------------------------------------------------------------------- +Tue Oct 20 16:32:03 CEST 2009 - jmatejek@suse.de + +- initial package + diff --git a/pigz.spec b/pigz.spec new file mode 100644 index 0000000..bc00fee --- /dev/null +++ b/pigz.spec @@ -0,0 +1,76 @@ +# +# spec file for package pigz +# +# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + + +Name: pigz +Version: 2.1.6 +Release: 0. +License: zlib/libpng License +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: binutils filesystem glibc-devel zlib-devel +Requires: glibc zlib +Group: Productivity/Archiving/Compression +Source: %name-%version.tar.bz2 +Patch1: pigz-dictzip.patch +Patch2: pigz-spl.patch +Patch3: pigz-do-symlinks.patch +Patch4: pigz-always-thread.patch +Url: http://www.zlib.net/pigz/ +Summary: Multi-core gzip version + +%description +A parallel implementation of gzip for modern multi-processor, +multi-core machines + + + +%prep +%setup +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +%build +export MYCFLAGS="${RPM_OPT_FLAGS}" +%{__make} CFLAGS="$MYCFLAGS" PREFIX=%{_prefix} LIBDIR=%{_libdir} + +%install +mkdir -p $RPM_BUILD_ROOT/usr/bin +cp -v pigz $RPM_BUILD_ROOT/usr/bin/ +cp -v unpigz $RPM_BUILD_ROOT/usr/bin/ + +#man page +mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ +cp -v pigz.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ +cp -v pigz.1 $RPM_BUILD_ROOT/%{_mandir}/man1/unpigz.1 +gzip $RPM_BUILD_ROOT/%{_mandir}/man1/pigz.1 +gzip $RPM_BUILD_ROOT/%{_mandir}/man1/unpigz.1 + +%clean +%{__rm} -rf "$RPM_BUILD_ROOT" + +%files +%defattr(-,root,root) +%doc README +%doc %{_mandir}/man1/pigz.1.gz +%doc %{_mandir}/man1/unpigz.1.gz +/usr/bin/pigz +/usr/bin/unpigz + +%changelog