commit a497ae13812c8718dcd0e665ce3ba049af8ed883 Author: Rosa Date: Wed Feb 1 14:22:54 2012 +0400 Automatic import for version 5.0.3 diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..020f2e9 --- /dev/null +++ b/.abf.yml @@ -0,0 +1,2 @@ +sources: + "xz-5.0.3.tar.xz": 2be9c77ef4a44c9f8eb296cff2ff687e6444a299 diff --git a/xz-5.0.0-text-tune.patch b/xz-5.0.0-text-tune.patch new file mode 100644 index 0000000..23b48f9 --- /dev/null +++ b/xz-5.0.0-text-tune.patch @@ -0,0 +1,134 @@ +--- xz-5.0.0/src/liblzma/api/lzma/container.h.text~ 2010-10-23 16:47:33.000000000 +0200 ++++ xz-5.0.0/src/liblzma/api/lzma/container.h 2010-12-14 23:57:08.628431579 +0100 +@@ -43,7 +43,7 @@ + /* + * Preset flags + * +- * Currently only one flag is defined. ++ * Currently only two flags are defined. + */ + + /** +@@ -59,6 +59,13 @@ + */ + #define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) + ++/** ++ * \brief Text compression preset ++ * ++ * TODO ++ */ ++#define LZMA_PRESET_TEXT (UINT32_C(1) << 18) ++ + + /** + * \brief Calculate approximate memory usage of easy encoder +--- xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c.text~ 2010-10-23 16:47:33.000000000 +0200 ++++ xz-5.0.0/src/liblzma/lzma/lzma_encoder_presets.c 2010-12-15 01:01:27.610442970 +0100 +@@ -18,7 +18,7 @@ lzma_lzma_preset(lzma_options_lzma *opti + { + const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; + const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; +- const uint32_t supported_flags = LZMA_PRESET_EXTREME; ++ const uint32_t supported_flags = LZMA_PRESET_EXTREME | LZMA_PRESET_TEXT; + + if (level > 9 || (flags & ~supported_flags)) + return true; +@@ -57,5 +57,18 @@ lzma_lzma_preset(lzma_options_lzma *opti + } + } + ++ if (flags & LZMA_PRESET_TEXT) { ++ if (level == 0) ++ options->lc = 3; ++ else ++ options->lc = 4; ++ options->lp = 0; ++ options->pb = 0; ++ options->mode = LZMA_MODE_NORMAL; ++ options->nice_len = 273; ++ options->mf = LZMA_MF_BT4; ++ options->depth = 512; ++ } ++ + return false; + } +--- xz-5.0.0/src/xz/args.c.text~ 2010-10-23 16:47:33.000000000 +0200 ++++ xz-5.0.0/src/xz/args.c 2010-12-14 23:57:08.639432696 +0100 +@@ -76,6 +76,7 @@ parse_real(args_info *args, int argc, ch + OPT_NO_ADJUST, + OPT_INFO_MEMORY, + OPT_ROBOT, ++ OPT_TEXT, + }; + + static const char short_opts[] +@@ -113,6 +114,8 @@ parse_real(args_info *args, int argc, ch + { "extreme", no_argument, NULL, 'e' }, + { "fast", no_argument, NULL, '0' }, + { "best", no_argument, NULL, '9' }, ++ { "text", no_argument, NULL, OPT_TEXT }, ++ + + // Filters + { "lzma1", optional_argument, NULL, OPT_LZMA1 }, +@@ -401,6 +404,10 @@ parse_real(args_info *args, int argc, ch + opt_auto_adjust = false; + break; + ++ case OPT_TEXT: ++ coder_set_text(); ++ break; ++ + default: + message_try_help(); + tuklib_exit(E_ERROR, E_ERROR, false); +--- xz-5.0.0/src/xz/coder.c.text~ 2010-10-23 16:47:33.000000000 +0200 ++++ xz-5.0.0/src/xz/coder.c 2010-12-14 23:57:08.640432976 +0100 +@@ -47,6 +47,9 @@ static size_t preset_number = 6; + /// compression ratio. + static bool preset_extreme = false; + ++/// TODO: Description.. ++static bool preset_text = false; ++ + /// Integrity check type + static lzma_check check; + +@@ -89,6 +92,14 @@ coder_set_extreme(void) + + + extern void ++coder_set_text(void) ++{ ++ preset_text = true; ++ return; ++} ++ ++ ++extern void + coder_add_filter(lzma_vli id, void *options) + { + if (filters_count == LZMA_FILTERS_MAX) +@@ -137,6 +148,9 @@ coder_set_compression_settings(void) + if (preset_extreme) + preset_number |= LZMA_PRESET_EXTREME; + ++ if (preset_text) ++ preset_number |= LZMA_PRESET_TEXT; ++ + if (lzma_lzma_preset(&opt_lzma, preset_number)) + message_bug(); + +--- xz-5.0.0/src/xz/coder.h.text~ 2010-10-23 16:47:33.000000000 +0200 ++++ xz-5.0.0/src/xz/coder.h 2010-12-14 23:57:08.649682731 +0100 +@@ -51,6 +51,9 @@ extern void coder_set_preset(size_t new_ + /// Enable extreme mode + extern void coder_set_extreme(void); + ++/// Enable text mode ++extern void coder_set_text(void); ++ + /// Add a filter to the custom filter chain + extern void coder_add_filter(lzma_vli id, void *options); + diff --git a/xz.spec b/xz.spec new file mode 100644 index 0000000..ecad28f --- /dev/null +++ b/xz.spec @@ -0,0 +1,281 @@ +%define major 5 +%define lname lzma +%define libname %mklibname %{lname} %{major} +%define libdev %mklibname -d %{lname} + +%bcond_without uclibc +%bcond_without dietlibc + +Summary: XZ utils +Name: xz +Version: 5.0.3 +Release: 2 +License: Public Domain +Group: Archiving/Compression +Source0: http://tukaani.org/xz/%{name}-%{version}.tar.xz +Source1: xzme +Patch0: xz-5.0.0-text-tune.patch +%rename lzma +%rename lzma-utils +# needed by check suite +BuildRequires: diffutils +%if %{with uclibc} +BuildRequires: uClibc-devel +%endif +%if %{with diet} +BuildRequires: dietlibc-devel +%endif +URL: http://tukaani.org/xz/ + +%description +XZ provides very high compression ratio and fast decompression. The +core of the XZ utils is Igor Pavlov's LZMA SDK containing the actual +LZMA encoder/decoder. LZMA utils add a few scripts which provide +gzip-like command line interface and a couple of other XZ related +tools. Also provides: + +- Average compression ratio 30% better than that of gzip and 15% + better than that of bzip2. + +- Decompression speed is only little slower than that of gzip, being + two to five times faster than bzip2. + +- In fast mode, compresses faster than bzip2 with a comparable + compression ratio. + +- Achieving the best compression ratios takes four to even twelve + times longer than with bzip2. However. this doesn't affect + decompressing speed. + +- Very similar command line interface than what gzip and bzip2 have. + +%package -n %{libname} +Summary: Libraries for decoding XZ/LZMA compression +Group: System/Libraries + +%description -n %{libname} +Libraries for decoding LZMA compression. + +%package -n %{libdev} +Summary: Devel libraries & headers for liblzma +Group: Development/C +Provides: %{lname}-devel = %{version}-%{release} +Provides: lib%{lname}-devel = %{version}-%{release} +Requires: %{libname} = %{version} + +%description -n %{libdev} +Devel libraries & headers for liblzma. + +%prep +%setup -q +%patch0 -p1 -b .text~ + +%build +export CONFIGURE_TOP=`pwd` +mkdir objs +pushd objs +CFLAGS="%{optflags} -O3 -funroll-loops" \ +%configure2_5x +%make +popd + +%if %{with dietlibc} +mkdir objsdietlibc +pushd objsdietlibc +CFLAGS="-Os" CC="diet gcc" \ +%configure2_5x --disable-shared \ + --enable-static \ + --disable-xz \ + --disable-xzdec \ + --disable-lzmadec \ + --disable-lzmainfo \ + --disable-lzma-links \ + --disable-scripts +%make +popd +%endif + +%if %{with uclibc} +mkdir objsuclibc +pushd objsuclibc +CFLAGS="%{uclibc_cflags}" LDFLAGS="%{?ldflags}" CC="%{uclibc_cc}" \ +%configure2_5x --disable-shared \ + --enable-static \ + --disable-xz \ + --disable-xzdec \ + --disable-lzmadec \ + --disable-lzmainfo \ + --disable-lzma-links \ + --disable-scripts + +%make +popd +%endif + +%install +%makeinstall_std -C objs + +install -d %{buildroot}/%{_lib} +mv %{buildroot}%{_libdir}/*.so.* %{buildroot}/%{_lib}/ +ln -sf ../../%{_lib}/liblzma.so.%{version} %{buildroot}%{_libdir}/liblzma.so + +%if %{with uclibc} +install -D objsuclibc/src/liblzma/.libs/liblzma.a -D %{buildroot}%{uclibc_root}%{_libdir}/liblzma.a +%endif +%if %{with dietlibc} +install -D objsdietlibc/src/liblzma/.libs/liblzma.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/liblzma.a +%endif + +install -m755 %{SOURCE1} -D %{buildroot}%{_bindir}/xzme + +%find_lang %{name} + +%check +make check -C objs + +%files -f %{name}.lang +%doc README THANKS +%{_bindir}/* +%{_mandir}/man1/* + +%files -n %{libname} +/%{_lib}/lib*.so.%{major}* + +%files -n %{libdev} +%{_includedir}/%{lname}.h +%dir %{_includedir}/%{lname} +%{_includedir}/%{lname}/*.h +%{_libdir}/*.so +%{_libdir}/*.a +%{_libdir}/*.la +%if %{with dietlibc} +%{_prefix}/lib/dietlibc/lib-%{_arch}/liblzma.a +%endif +%if %{with uclibc} +%{uclibc_root}%{_libdir}/liblzma.a +%endif +%{_libdir}/pkgconfig/lib%{lname}.pc + + +%changelog +* Fri Jun 10 2011 Per Øyvind Karlsen 5.0.3-2 ++ Revision: 684196 +- move shared library to /%%{_lib}/ (thx to Shlomi Fish for reporting) +- don't remove libtool library file + +* Sun May 22 2011 Funda Wang 5.0.3-1 ++ Revision: 676969 +- new version 5.0.3 + + + Per Øyvind Karlsen + - build uClibc & diet versions of liblzma + +* Wed Apr 06 2011 Funda Wang 5.0.2-2 ++ Revision: 651010 +- rebuild for lost packages + +* Wed Apr 06 2011 Per Øyvind Karlsen 5.0.2-1 ++ Revision: 650921 +- add missing mode to open(2) +- strip redundant buildroot cleaning +- fix leak (P1) +- new version + +* Wed Mar 23 2011 Per Øyvind Karlsen 5.0.1-1 ++ Revision: 648164 +- remove unneeded %%defattr & buildroot definition +- use %%rename macro +- drop unneeded zlib-devel buildrequires, document diffutils buildrequires +- new version: 5.0.1 +- update url + +* Wed Dec 15 2010 Per Øyvind Karlsen 5.0.0-2mdv2011.0 ++ Revision: 621846 +- update license +- resurrect --text option patch + +* Wed Nov 17 2010 Olivier Faurax 5.0.0-1mdv2011.0 ++ Revision: 598139 +- Bump version to 5.0.0 + +* Wed Mar 17 2010 Oden Eriksson 4.999.9beta-2mdv2010.1 ++ Revision: 524476 +- rebuilt for 2010.1 + + + Per Øyvind Karlsen + - update summary & description due to lzma -> xz name change + +* Thu Sep 03 2009 Per Øyvind Karlsen 4.999.9beta-1mdv2010.0 ++ Revision: 428978 +- update to 4.999.9beta + +* Mon Mar 09 2009 Per Øyvind Karlsen 4.999.8beta-0.2mdv2009.1 ++ Revision: 353301 +- add back recompression tool (xzme, renamed from lzme, now using xz format, fixes #48231) + +* Sun Jan 25 2009 Per Øyvind Karlsen 4.999.8beta-0.1mdv2009.1 ++ Revision: 333378 +- update to latest code from git (contains some fixes required by pyliblzma 0.5.0) + +* Thu Jan 08 2009 Funda Wang 4.999.7-0.beta.2mdv2009.1 ++ Revision: 327157 +- rebuild + +* Mon Jan 05 2009 Per Øyvind Karlsen 4.999.7-0.beta.1mdv2009.1 ++ Revision: 325129 +- update to 4.999.7beta + +* Tue Dec 30 2008 Per Øyvind Karlsen 4.999.6-0.alpha.6mdv2009.1 ++ Revision: 321391 +- add lzme util from older lzma package (should become xzme eventually..) + +* Mon Dec 29 2008 Per Øyvind Karlsen 4.999.6-0.alpha.5mdv2009.1 ++ Revision: 321121 +- rename to 'xz' +- add text tune patch (P1) which provides same --text option as we introduced for + old tool.. +- update source, new tool and format has now been renamed to 'xz' +- rename + +* Mon Dec 22 2008 Oden Eriksson 4.999.6-0.alpha.4mdv2009.1 ++ Revision: 317511 +- fix major, he he he, funny! + +* Sun Dec 21 2008 Oden Eriksson 4.999.6-0.alpha.3mdv2009.1 ++ Revision: 317047 +- rebuild + +* Sun Oct 19 2008 Per Øyvind Karlsen 4.999.6-0.alpha.2mdv2009.1 ++ Revision: 295258 +- d'oh, bump major again due to lzmalib conflicts + +* Fri Oct 17 2008 Per Øyvind Karlsen 4.999.6-0.alpha.1mdv2009.1 ++ Revision: 294620 +- * new release + * ditch lzma-4.999.3alpha-use-lzma_alone-format-by-default.patch, this is now the + default + * bump major (P1) + +* Fri Jul 18 2008 Per Øyvind Karlsen 4.999.3-0.alpha.3mdv2009.0 ++ Revision: 238248 +- new git snapshot +- drop P1 (fixed upstream) +- drop ldconfig scriptlets since package is new and doesn't exist in older releases + + + Pixel + - do not call ldconfig in %%post/%%postun, it is now handled by filetriggers + +* Mon May 12 2008 Per Øyvind Karlsen 4.999.3-0.alpha.2mdv2009.0 ++ Revision: 206503 +- remove help text about options not available for LZMA_Alone (updates P0) +- handle broken pipe (P1) +- build with -O3 & -funroll-loops + +* Sun May 04 2008 Per Øyvind Karlsen 4.999.3-0.alpha.1mdv2009.0 ++ Revision: 201109 +- provide liblzma-devel +- import lzma-utils + + +* Thu Apr 30 2008 Per Øyvind Karlsen 4.99.3alpha-1 +- initial Mandriva release. diff --git a/xzme b/xzme new file mode 100755 index 0000000..42b4f58 --- /dev/null +++ b/xzme @@ -0,0 +1,218 @@ +#!/bin/bash +# lzme re-compress gzip, zip, bzip2 ... files into xz +#============================================================================== +# Copyright (C) 1999-2002 MandrakeSoft (tvignaud@mandrakesoft.com) +# By Thierry Vignaud +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The GNU General Public License can be read at +# http://www.fsf.org/copyleft/gpl.html +#============================================================================== +# +# Know bugs: +# ---------- +# - bash getopt isn't gnu style aware, ie cmd opt1 file1 file2 opt2 +# will result in ignoring opt2 option +# +#============================================================================== +# +# Changelog: +# ---------- +# v1.0: original release +# v1.1: fix space usage (use pipe rather than temp file) +# v1.2: keep source file, not bz2 one if eof while decompressing +# v1.3: reduce used cpu time (decompressing only one time; +# source crc error 're detected through PIPESTATUS) +# v1.4: add zip support on popular^h^h^h^h^hGwenole request +# v1.5: +# - make zip method acting as z one (remove original file, +# keeping only smallest file, displaying size gain, ...) +# thus giving occasion to factorize some common code +# - check that the source file does exists +# - handle corrupted zip source file +# - comment the script and verbos-ize() some old changes +# - use cheaper shell tests +# - add GPL reference +# - update online help to reflect optional options and newer +# supported formats +# - remove dependency on sed by using ${1%old}new_extension +# v1.6: +# - print error message on stderr rather than on stdin +# - factorize/simplify zip method (fix erase temp files on bzip2ing +# error) +# - typo fixes +# - simplify for_each(file) loop +# - add "Know bugs" and TODO sections +# - add -h and -k options +# - if -k (keep) option is used, keep all files +# v1.7: handle file names with spaces +# +# v1.7a: added support for lzmash (Giuseppe Ghibò, ) +# +# v1.7b: updated to use new lzma command line tool which replaces old lzmash wrapper +# (Per Øyvind Karlsen ) +# +# v1.7c: use default compression level as -9 will take too much time and use too much +# memory for decompression to make it worthwhile (Per Øyvind Karlsen +# +# v1.7d: us new xz format rather than old lzma_alone format (Per Øyvind Karlsen +# +# TODO: +# - retrieve my patch for solaris file utils +# - add trap for zip method (is it really useful?) +# - add a man page +# - move bzme in its own package that requires tar too + + +# Defaults +force= +keep= + +# Corrupted source error message +src_err_msg () +{ if [ "$2" != 0 ]; then + echo "Corrupted source file ($1) !" 1>&2 + rm -f "$TARGET" + STATUS=1 + fi +} + +gz_compr () +{ zcat "$1" | xz > "$TARGET" + # Keep PIPESTATUS + MY_STATUS=( ${PIPESTATUS[*]} ) + src_err_msg "$1" ${MY_STATUS[0]} + if [[ "${MY_STATUS[1]}" != "0" ]]; then + echo "error while xz'ing !" 1>&2 + STATUS=1 + fi +} + +bzip2_compr () +{ bzcat "$1" | xz > "$TARGET" + # Keep PIPESTATUS + MY_STATUS=( ${PIPESTATUS[*]} ) + src_err_msg "$1" ${MY_STATUS[0]} + if [[ "${MY_STATUS[1]}" != "0" ]]; then + echo "error while xz'ing !" 1>&2 + STATUS=1 + fi +} + +lzma_compr () +{ xzcat "$1" | xz > "$TARGET" + # Keep PIPESTATUS + MY_STATUS=( ${PIPESTATUS[*]} ) + src_err_msg "$1" ${MY_STATUS[0]} + if [[ "${MY_STATUS[1]}" != "0" ]]; then + echo "error while xz'ing !" 1>&2 + STATUS=1 + fi +} + +zip_compr () +{ + [[ -z "$TMPDIR" ]] && TMPDIR=$TMP + MY_TMP=$(mktemp -d $TMPDIR/xzme.XXXXXX) + unzip -qd $MY_TMP "$1" + src_err_msg "$1" $? + tar cfj "$TARGET" -C $MY_TMP . + if [[ $? != 0 ]]; then + echo "error while taring !" 1>&2 + STATUS=1 + fi + # Removing temporary files + rm -fr $MY_TMP +} + +compress () +{ echo -n "Compressing $1 ... " + if [[ ! -f "$1" ]]; then + echo "Source file doesn't exist" 1>&2 + return + fi + STATUS=0 + SIZE=$(du -k "$1"|cut -f 1 -d " ") + if [[ -f "$TARGET" ]]; then + if [[ -n $force ]];then + rm -f "$TARGET" + else + echo "$TARGET already exists !!" 1>&2 + echo "Use -f to force it" + return + fi + fi + # Do the real compression job + $METHOD "$1" + # if there was an error + if [[ $STATUS = 1 ]]; then + [[ -z $keep ]] && rm -f "$TARGET" + return + fi + # Compare size in order to only keep the smallest file + SIZE2=$(du -k "$TARGET"|cut -f 1 -d " ") + if [[ $SIZE -lt $SIZE2 && -z $force_compress ]] + then + echo "=> $TARGET is bigger than $1 ($SIZE"kb" => $SIZE2"kb") !!!" + echo "Use -F to force the recompression" + [[ -z $keep ]] && rm -f "$TARGET" + else + echo "=> $TARGET ($SIZE"kb" => $SIZE2"kb")" + + [[ -z $keep ]] && rm -f "$1" + fi +} + +while getopts Ffhk opt; do + case "$opt" in + F) force_compress="yes";; + f) force="yes";; + k) keep="yes";; + h) + echo "Usage: xzme [-Ffhk] file.*.({,t}gz|bz2|lzma|Z|zip)" + exit 1;; + *) + echo "See xzme -h for usage" + exit 1;; + esac +done +shift $((OPTIND - 1)) + +echo keeping: $keep + +while [[ "$1" != "" ]] +do + #default method is .lzma,.bz2,.gz,.Z,.z,.. + METHOD=gz_compr + case "$1" in + *.xz) echo "$1: already compressed!"; shift;continue;; + *.lzma) METHOD=lzma_compr + TARGET=${1%.lzma}.xz;; + *.bz2) METHOD=bzip2_compr + TARGET=${1%.tar.bz2}.tar.xz + ;; + *.tgz) TARGET=${1%.tgz}.txz;; + *.Z) TARGET=${1%.Z}.xz;; + *.gz) TARGET=${1%.gz}.xz;; + *.zip) + METHOD=zip_compr + TARGET=${1%.zip}.tar.xz + ;; + *) echo "$1: unknown file extension => ignored"; shift; continue;; + esac + compress "$1" + shift +done