debian/0000755000000000000000000000000012033534216007165 5ustar debian/copyright0000644000000000000000000000404311630517116011123 0ustar This package was debianized by Mohammed Adnène Trojette on Fri May 5 18:01:06 CEST 2006. The current Debian maintainer is Mohammed Adnène Trojette . It was downloaded from . LZMA SDK is Copyright (C) 1999-2011 Igor Pavlov. LZMA SDK is placed in the public domain. The current Debian packaging is (C) 2006-2011, Mohammed Adnène Trojette and is placed under the BSD license, see below: Copyright (c) The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/lzma.install0000644000000000000000000000004611630517116011522 0ustar CPP/7zip/Bundles/LzmaCon/lzmp usr/bin debian/NEWS.Debian0000644000000000000000000000227311630517116011053 0ustar lzma (4.43-13) unstable; urgency=low * Split lzma binary package into: + lzma-alone: with /usr/bin/lzma_alone. (Closes: #475111) + lzma (recommending lzma-alone): with the rest. * No need for a quilt patch to add a manpage... * Move development documentation to lzma-dev. (Closes: #475110) -- Mohammed Adnène Trojette Wed, 04 Jun 2008 22:30:33 +0200 lzma (4.43-2) unstable; urgency=low * Change debian/copyright to utf-8. * Build-Depends on quilt. * Correct typo on description spotted by Andrey Kiselev. (Closes: #378218) * Add a NEWS.Debian. * Add some patches with the help of Alexander Sack and Lasse Collin to integrate Tukaani's lzma-utils: + 01_large_files.diff: make large files work. + 02_lzmp.diff: use a wrapper to lzma to have a gzip-like interface. (Closes: #379398) + 03_lzma_manpage.diff: manual page for the "new" lzma. * Changes introduced by the "Tukaani patch": + the old /usr/bin/lzma becomes /usr/bin/lzma_alone. + it is superseded by a gzip-like command line tool. + manpages are updated accordingly. -- Mohammed Adnène Trojette Tue, 8 Aug 2006 23:26:37 +0200 debian/lzma-dev.dirs0000644000000000000000000000002111630517116011562 0ustar usr/include/lzma debian/source/0000755000000000000000000000000011702322413010461 5ustar debian/source/format0000644000000000000000000000001411630517116011675 0ustar 3.0 (quilt) debian/changelog0000644000000000000000000001744112033534216011046 0ustar lzma (9.22-2ubuntu2) quantal; urgency=low * Rebuild for new armel compiler default of ARMv5t. -- Colin Watson Fri, 05 Oct 2012 11:38:06 +0100 lzma (9.22-2ubuntu1) precise; urgency=low * Merge from debian unstable (LP: #924044). Remaining changes: - make lzma Priority: required and Section: base since dpkg Pre-Depends on it. -- Leo Iannacone Tue, 31 Jan 2012 01:32:49 +0100 lzma (9.22-2) unstable; urgency=low * Upload to unstable. * Previous upload removed lzma-source. (Closes: #651796) * Prevent /dev/null removal while testing a file. (Closes: #550543) -- Mohammed Adnène Trojette Sun, 08 Jan 2012 15:15:18 +0100 lzma (9.22-1) experimental; urgency=low [ Mohammed Adnène Trojette ] * New upstream release (Closes: #460501, #518365) + LZMA SDK is placed in the public domain since 4.62. * Update debian/patches/02_lzmp.diff. * Switch packaging under the terms of the BSD license. * Switch to dpkg-source 3.0 (quilt) format + debian/control: Build-Depends - drop quilt. - bump debhelper dependency to 8.0.0. * Bump Standards-Version to 3.9.2 * Drop lzma-source package. It doesn't work with current kernels and SquashFS XZ is part of the standard kernel now. Patch courtesy of Jonathan Nieder. (Closes: #470893, #553707, #466582) * Update file list in lzma-dev. (Closes: #614417) * Fix and improve descriptions. (Closes: #535776, #540469) * Add deb-lzma script to convert a deb package to LZMA format. Script courtesy of Roger Millan. (Closes: #536275) * Add Jonathan Nieder as comaintainer. [ Jonathan Nieder ] * Bump debhelper compatibility to 7. * Manage lzma, unlzma, and lzcat through the alternatives system. Conflicts: xz-lzma (<< 5.1.1alpha+20110809-2). (Closes: #547802) -- Mohammed Adnène Trojette Sat, 03 Sep 2011 23:27:39 +0200 lzma (4.43-14ubuntu2) lucid; urgency=low * rebuild rest of main for armel armv7/thumb2 optimization; UbuntuSpec:mobile-lucid-arm-gcc-v7-thumb2 -- Alexander Sack Sun, 07 Mar 2010 00:56:46 +0100 lzma (4.43-14ubuntu1) intrepid; urgency=low * Merge from debian unstable, remaining changes: - make lzma Priority: required and Section: base since dpkg Pre-Depends on it. -- Michael Vogt Fri, 20 Jun 2008 18:07:57 +0200 lzma (4.43-14) unstable; urgency=low * Bump Standards-Version to 3.8.0. * Drop lzma-alone from Recommends. * Don't build lzma-source when binary-indep target is not called. (Closes: #486419) -- Mohammed Adnène Trojette Mon, 16 Jun 2008 01:09:56 +0200 lzma (4.43-13) unstable; urgency=low * Split lzma binary package into: + lzma-alone: with /usr/bin/lzma_alone. (Closes: #475111) + lzma (recommending lzma-alone): with the rest. * No need for a quilt patch to add a manpage... * Move development documentation to lzma-dev. (Closes: #475110) -- Mohammed Adnène Trojette Wed, 04 Jun 2008 22:30:33 +0200 lzma (4.43-12ubuntu1) hardy; urgency=low * Make lzma Priority: required and Section: base since dpkg Pre-Depends on it. -- Chris Cheney Thu, 13 Dec 2007 17:15:24 -0600 lzma (4.43-12) unstable; urgency=low * Update sqlzma patch (needed for squashfs): + Backport sqlzma patch to LZMA SDK 4.43. + Update 04_sqlzma_h.diff. -- Arnaud Fontaine Sat, 08 Dec 2007 21:03:51 +0000 lzma (4.43-11) unstable; urgency=low * Upload to unstable. [ Arnaud Fontaine ] * lzma-dev should be part of the Build-Depends only and not a dependency inside the resulting kernel modules package. Thanks to Michael Prokop. (Closes: #452868) * Support cross building. Thanks to Neil Williams for the patch. (Closes: #451598) * debian/control*: + Add Homepage field (dpkg supports it now). + Add Vcs-Git and Vcs-Browser field (dpkg support them now). + Update my email address to arnau@debian.org. + Update Standards-Version to 3.7.3. No changes needed. [ Mohammed Adnène Trojette ] * Don't ship /usr/share/doc/lzma/LGPL.txt.gz. (Closes: #453922) * debian/copyright: + Include a copy of the CPL license. (Closes: #453924) -- Mohammed Adnène Trojette Fri, 07 Dec 2007 01:59:40 +0100 lzma (4.43-10) experimental; urgency=low * debian/control: + Add myself as Uploaders. * debian/docs: + Remove useless LGPL.txt file because it is already provided by Debian. * Install history.txt as the changelog in /usr/share/doc/. * Add support for squashfs. (Closes: #443844). + Add lzma-dev which contains headers and static libraries. + Add lzma-source which contains kernel modules needed for squashfs. + Add patch from sqlzma project. -- Arnaud Fontaine Thu, 18 Oct 2007 12:15:12 +0100 lzma (4.43-9) unstable; urgency=low * Remove reference to missing chapter in manpage. (Closes: #424612) * Remove redundancies in manpage. (Closes: #435612) -- Mohammed Adnène Trojette Sat, 04 Aug 2007 21:32:07 +0200 lzma (4.43-8) unstable; urgency=low * Update lzmp.cpp patch to allow symlinks decompression to stdout. * Correct watch file. -- Mohammed Adnène Trojette Tue, 24 Jul 2007 00:33:43 +0200 lzma (4.43-7) unstable; urgency=low * Upload to unstable. * Bump debhelper compatibility to 5. -- Mohammed Adnène Trojette Fri, 13 Apr 2007 01:07:02 +0200 lzma (4.43-6) experimental; urgency=low * 02_lzmp.diff: + include to be able to build with GCC 4.3. (Closes: #417379) Thanks Martin Michlmayr for the patch. + use hc4 for -1 option, as hc3 is no more built in the SDK. (Closes: #417304) Thanks Lasse Collin for the help. -- Mohammed Adnène Trojette Mon, 02 Apr 2007 19:59:52 +0200 lzma (4.43-5) unstable; urgency=low * Tighten license issues in debian/copyright: (Closes: #406968) + LZMA SDK is released under - LGPL - CPL - simplified license + LZMA SDK is free, of course! (under the LGPL terms) + Files released by Tukaani are released under GPL. + Packaging is released under LGPL. -- Mohammed Adnène Trojette Mon, 15 Jan 2007 12:37:50 +0100 lzma (4.43-4) unstable; urgency=low * Fix in manual page: + typos spotted by thanks A. Costa. (Closes: #405652) + reference to non existing lzmainfo(1). (Closes: #404903) -- Mohammed Adnène Trojette Mon, 8 Jan 2007 03:46:37 +0100 lzma (4.43-3) unstable; urgency=low * Add a debian/watch file. -- Mohammed Adnène Trojette Tue, 19 Sep 2006 02:27:29 +0200 lzma (4.43-2) unstable; urgency=low * Change debian/copyright to utf-8. * Build-Depends on quilt. * Correct typo on description spotted by Andrey Kiselev. (Closes: #378218) * Add a NEWS.Debian. * Add some patches with the help of Alexander Sack and Lasse Collin to integrate Tukaani's lzma-utils: + 01_large_files.diff: make large files work. + 02_lzmp.diff: use a wrapper to lzma to have a gzip-like interface. (Closes: #379398) + 03_lzma_manpage.diff: manual page for the "new" lzma. * Changes introduced by the "Tukaani patch": + the old /usr/bin/lzma becomes /usr/bin/lzma_alone. + it is superseded by a gzip-like command line tool. + manpages are updated accordingly. -- Mohammed Adnène Trojette Tue, 8 Aug 2006 23:26:37 +0200 lzma (4.43-1) unstable; urgency=low * New upstream version. -- Mohammed Adnène Trojette Sun, 4 Jun 2006 13:58:58 +0200 lzma (4.39-1) unstable; urgency=low * Initial release (Closes: #364258) -- Mohammed Adnène Trojette Mon, 1 May 2006 02:01:42 +0200 debian/watch0000644000000000000000000000036111630517116010220 0ustar # format version number, currently 3; this line is compulsory! version=3 # Line continuations are performed with \ opts="uversionmangle=s/\(.\)\(..\)/$1.$2/" \ http://qa.debian.org/watch/sf.php/sevenzip/lzma(.)(..).tar.bz2 debian uupdate debian/lzma-dev.install0000644000000000000000000000040211630517116012272 0ustar C/Types.h usr/include/lzma C/LzmaEnc.h usr/include/lzma C/LzmaEnc.c usr/include/lzma C/LzmaDec.h usr/include/lzma C/LzmaDec.c usr/include/lzma C/LzHash.h usr/include/lzma C/LzFind.h usr/include/lzma C/LzFind.c usr/include/lzma C/7zVersion.h usr/include/lzma debian/lzma.prerm0000644000000000000000000000031211630517116011175 0ustar #!/bin/sh set -e if test "$1" != upgrade || # downgrading to a pre-alternatives version dpkg --compare-versions "$2" lt-nl 9.22-1 then update-alternatives --remove lzma /usr/bin/lzmp fi #DEBHELPER# debian/lzma_alone.10000644000000000000000000000240711630517116011375 0ustar .TH LZMA 1 "May 5 2006" "Mohammed Adnene Trojette" .SH NAME LZMA - a compression algorithm, based on Lempel Ziv's compression method. .SH SYNOPSIS .B lzma .BR .BR inputFile .BR outputFile .BR [switches...] .SH DESCRIPTION LZMA provides high compression ratio and very fast decompression, so it is very suitable for embedded applications. For example, it can be used for ROM (firmware) compression. .TP lzma is the default and general compression method of 7z format in 7-Zip program. .PP .SH FUNCTION LETTERS .TP .B e Encode file .TP .B d Decode file .TP .B b Benchmark .SH SWITCHES .TP .B -a{N} Set compression mode - [0, 1], default: 1 (max) .TP .B -d{N} Set dictionary - [0,30], default: 23 (8MB) .TP .B -fb{N} Set number of fast bytes - [5, 273], default: 128 .TP .B -mc{N} Set number of cycles for match finder .TP .B -lc{N} Set number of literal context bits - [0, 8], default: 3 .TP .B -lp{N} Set number of literal pos bits - [0, 4], default: 0 .TP .B -pb{N} Set number of pos bits - [0, 4], default: 2 .TP .B -mf{MF_ID} Set Match Finder: [bt2, bt3, bt4, hc4], default: bt4 .TP .B -eos Write End Of Stream marker .TP .B -si Read data from stdin .TP .B -so Write data to stdout .SH "SEE ALSO" .BR 7z(1), 7za(1) .SH AUTHOR .TP Written for Debian by Mohammed Adnene Trojette. debian/patches/0000755000000000000000000000000011702332502010610 5ustar debian/patches/series0000644000000000000000000000001511702331054012022 0ustar 02_lzmp.diff debian/patches/02_lzmp.diff0000644000000000000000000006636111702332454012747 0ustar Index: lzma-9.22/CPP/7zip/Bundles/LzmaCon/lzmp.cpp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ lzma-9.22/CPP/7zip/Bundles/LzmaCon/lzmp.cpp 2012-01-08 16:24:26.000000000 +0100 @@ -0,0 +1,896 @@ +/* + * LZMA command line tool similar to gzip to encode and decode LZMA files. + * + * Copyright (C) 2005 Ville Koskinen + * + * 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 + * of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +#include "../../../Common/MyWindows.h" +#include "../../../Common/MyInitGuid.h" + +#include +using std::cout; +using std::cerr; +using std::endl; + +#include +#include +#include + +#include +using std::string; +#include +using std::vector; +typedef vector stringVector; + +#include +#include +#include + +#include +#include +#include +#include // futimes() + +// For Solaris +#ifndef HAVE_FUTIMES +//#define futimes(fd, tv) futimesat(fd, NULL, tv) +#endif + +#if defined(_WIN32) || defined(OS2) || defined(MSDOS) +#include +#include +#define MY_SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) +#else +#define MY_SET_BINARY_MODE(file) +#endif + +#include "../../../7zip/Common/FileStreams.h" + +#include "../../../Common/Types.h" + +#include "../../../7zip/Compress/LzmaDecoder.h" +#include "../../../7zip/Compress/LzmaEncoder.h" + +#include "Exception.h" + +#include "lzma_version.h" + +namespace lzma { + +const char *PROGRAM_VERSION = PACKAGE_VERSION; +const char *PROGRAM_COPYRIGHT = "Copyright (C) 2006 Ville Koskinen"; + +/* LZMA_Alone switches: + -a{N}: set compression mode - [0, 2], default: 2 (max) + -d{N}: set dictionary - [0,28], default: 23 (8MB) + -fb{N}: set number of fast bytes - [5, 255], default: 128 + -lc{N}: set number of literal context bits - [0, 8], default: 3 + -lp{N}: set number of literal pos bits - [0, 4], default: 0 + -pb{N}: set number of pos bits - [0, 4], default: 2 + -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2, + pat2h, pat3h, pat4h, hc3, hc4], default: bt4 +*/ + +struct lzma_option { + short compression_mode; // -a + short dictionary; // -d + short fast_bytes; // -fb + const wchar_t *match_finder; // -mf + short literal_context_bits; // -lc + short literal_pos_bits; // -lp + short pos_bits; // -pb +}; + +/* The following is a mapping from gzip/bzip2 style -1 .. -9 compression modes + * to the corresponding LZMA compression modes. Thanks, Larhzu, for coining + * these. */ +const lzma_option option_mapping[] = { + { 0, 0, 0, NULL, 0, 0, 0}, // -0 (needed for indexing) + { 0, 16, 64, L"hc4", 3, 0, 2}, // -1 + { 0, 20, 64, L"hc4", 3, 0, 2}, // -2 + { 1, 19, 64, L"bt4", 3, 0, 2}, // -3 + { 2, 20, 64, L"bt4", 3, 0, 2}, // -4 + { 2, 21, 128, L"bt4", 3, 0, 2}, // -5 + { 2, 22, 128, L"bt4", 3, 0, 2}, // -6 + { 2, 23, 128, L"bt4", 3, 0, 2}, // -7 + { 2, 24, 255, L"bt4", 3, 0, 2}, // -8 + { 2, 25, 255, L"bt4", 3, 0, 2}, // -9 +}; + +struct extension_pair { + const char *from; + const char *to; +}; + +const extension_pair known_extensions[] = { + { ".lzma", "" }, + { ".tlz", ".tar" }, + { NULL, NULL } +}; + +/* Sorry, I just happen to like enumerations. */ +enum PROGRAM_MODE { + PM_COMPRESS = 0, + PM_DECOMPRESS, + PM_TEST, + PM_HELP, + PM_LICENSE, + PM_VERSION +}; + +enum { + STATUS_OK = 0, + STATUS_ERROR = 1, + STATUS_WARNING = 2 +}; + +/* getopt options. */ +/* struct option { name, has_arg, flag, val } */ +const struct option long_options[] = { + { "stdout", 0, 0, 'c' }, + { "decompress", 0, 0, 'd' }, + { "compress", 0, 0, 'z' }, + { "keep", 0, 0, 'k' }, + { "force", 0, 0, 'f' }, + { "test", 0, 0, 't' }, + { "suffix", 1, 0, 'S' }, + { "quiet", 0, 0, 'q' }, + { "verbose", 0, 0, 'v' }, + { "help", 0, 0, 'h' }, + { "license", 0, 0, 'L' }, + { "version", 0, 0, 'V' }, + { "fast", 0, 0, '1' }, + { "best", 0, 0, '9' }, + { 0, 0, 0, 0 } +}; + +/* getopt option string (for the above options). */ +const char option_string[] = "cdzkftS:qvhLV123456789A:D:F:"; + +/* Defaults. */ +PROGRAM_MODE program_mode = PM_COMPRESS; +int verbosity = 0; +bool stdinput = false; +bool stdoutput = false; +bool keep = false; +bool force = false; +int compression_mode = 7; +//char *suffix = strdup(".lzma"); +char *suffix = strdup(known_extensions[0].from); +lzma_option advanced_options = { -1, -1, -1, NULL, -1, -1, -1 }; + +void print_help(const char *const argv0) +{ + // Help goes to stdout while other messages go to stderr. + cout << "\nlzma " << PROGRAM_VERSION + << " " << PROGRAM_COPYRIGHT << "\n" + "Based on LZMA SDK " << LZMA_SDK_VERSION_STRING << " " + << LZMA_SDK_COPYRIGHT_STRING + << "\n\nUsage: " << argv0 + << " [flags and input files in any order]\n" +" -c --stdout output to standard output\n" +" -d --decompress force decompression\n" +" -z --compress force compression\n" +" -k --keep keep (don't delete) input files\n" +" -f --force force overwrite of output file and compress links\n" +" -t --test test compressed file integrity\n" +" -S .suf --suffix .suf use suffix .suf on compressed files\n" +" -q --quiet suppress error messages\n" +" -v --verbose be verbose\n" +" -h --help print this message\n" +" -L --license display the license information\n" +" -V --version display version numbers of LZMA SDK and lzma\n" +" -1 .. -2 fast compression\n" +" -3 .. -9 good to excellent compression. -7 is the default.\n" +" --fast alias for -1\n" +" --best alias for -9 (usually *not* what you want)\n\n" +" Memory usage depends a lot on the chosen compression mode -1 .. -9.\n" +" See the man page lzma(1) for details.\n\n"; +} + +void print_license(void) +{ + cout << "\n LZMA command line tool " << PROGRAM_VERSION << " - " + << PROGRAM_COPYRIGHT + << "\n LZMA SDK " << LZMA_SDK_VERSION_STRING << " - " + << LZMA_SDK_COPYRIGHT_STRING + << "\n This program is a part of the LZMA utils package.\n" + " http://tukaani.org/lzma/\n\n" +" This program is free software; you can redistribute it and/or\n" +" modify it under the terms of the GNU General Public License\n" +" as published by the Free Software Foundation; either version 2\n" +" of the License, or (at your option) any later version.\n" +"\n" +" This program is distributed in the hope that it will be useful,\n" +" but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +" GNU General Public License for more details.\n" +"\n"; +} + +void print_version(void) +{ + cout << "LZMA command line tool " << PROGRAM_VERSION << "\n" + << "LZMA SDK " << LZMA_SDK_VERSION_STRING << "\n"; +} + +short str2int (const char *str, const int &min, const int &max) +{ + int value = -1; + char *endptr = NULL; + if (str == NULL || str[0] == '\0') + throw ArgumentException("Invalid integer option"); + value = strtol (str, &endptr, 10); + if (*endptr != '\0' || value < min || value > max) + throw ArgumentException("Invalid integer option"); + return value; +} + +void parse_options(int argc, char **argv, stringVector &filenames) +{ + /* Snatched from getopt(3). */ + int c; + + /* Check how we were called */ + { + char *p = strrchr (argv[0], '/'); // Remove path prefix, if any + if (p++ == NULL) + p = argv[0]; + if (strstr (p, "un") != NULL) { + program_mode = PM_DECOMPRESS; + } else if (strstr (p, "cat") != NULL) { + program_mode = PM_DECOMPRESS; + stdoutput = true; + } + } + + while (-1 != (c = getopt_long(argc, argv, option_string, + long_options, NULL))) { + switch (c) { + // stdout + case 'c': + stdoutput = true; + break; + + // decompress + case 'd': + program_mode = PM_DECOMPRESS; + break; + + // compress + case 'z': + program_mode = PM_COMPRESS; + break; + + // keep + case 'k': + keep = true; + break; + + // force + case 'f': + force = true; + break; + + // test + case 't': + program_mode = PM_TEST; + break; + + // suffix + case 'S': + if (optarg) { + free(suffix); + suffix = strdup(optarg); + } + break; + + // quiet + case 'q': + verbosity = 0; + break; + + // verbose + case 'v': + verbosity++; + break; + + // help + case 'h': + program_mode = PM_HELP; + break; + + // license + case 'L': + program_mode = PM_LICENSE; + break; + + // version + case 'V': + program_mode = PM_VERSION; + break; + + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + compression_mode = c - '0'; + break; + + // Advanced options // + // Compression mode + case 'A': + advanced_options.compression_mode = + str2int (optarg, 0, 2); + break; + + // Dictionary size + case 'D': + advanced_options.dictionary = + str2int (optarg, 0, 28); + break; + + // Fast bytes + case 'F': + advanced_options.fast_bytes = + str2int (optarg, 0, 273); + break; + + default: + throw ArgumentException(""); + break; + } // switch(c) + } // while(1) + + for (int i = optind; i < argc; i++) { + if (strcmp("-", argv[i]) == 0) + continue; + filenames.push_back(argv[i]); + } +} // parse_options + +void set_encoder_properties(NCompress::NLzma::CEncoder *encoder, + lzma_option &opt) +{ + /* Almost verbatim from LzmaAlone.cpp. */ + PROPID propIDs[] = + { + NCoderPropID::kDictionarySize, + NCoderPropID::kPosStateBits, + NCoderPropID::kLitContextBits, + NCoderPropID::kLitPosBits, + NCoderPropID::kAlgorithm, + NCoderPropID::kNumFastBytes, + NCoderPropID::kMatchFinder, + NCoderPropID::kEndMarker + }; + const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]); +#define VALUE(x) (advanced_options.x >= 0 ? advanced_options.x : opt.x) + PROPVARIANT properties[kNumProps]; + for (int p = 0; p < 6; p++) + properties[p].vt = VT_UI4; + properties[0].ulVal = UInt32(1 << VALUE (dictionary)); + properties[1].ulVal = UInt32(VALUE (pos_bits)); + properties[2].ulVal = UInt32(VALUE (literal_context_bits)); + properties[3].ulVal = UInt32(VALUE (literal_pos_bits)); + properties[4].ulVal = UInt32(VALUE (compression_mode)); + properties[5].ulVal = UInt32(VALUE (fast_bytes)); +#undef VALUE + + properties[6].vt = VT_BSTR; + properties[6].bstrVal = (BSTR)opt.match_finder; + + properties[7].vt = VT_BOOL; + properties[7].boolVal = stdinput ? VARIANT_TRUE : VARIANT_FALSE; + + if (encoder->SetCoderProperties(propIDs, properties, kNumProps) != S_OK) + throw Exception("SetCoderProperties() error"); +} + +void encode(NCompress::NLzma::CEncoder *encoderSpec, + CMyComPtr inStream, + CMyComPtr outStream, + lzma_option encoder_options, + UInt64 fileSize) +{ + set_encoder_properties(encoderSpec, encoder_options); + + encoderSpec->WriteCoderProperties(outStream); + + for (int i = 0; i < 8; i++) + { + Byte b = Byte(fileSize >> (8 * i)); + if (outStream->Write(&b, sizeof(b), 0) != S_OK) + throw Exception("Write error while encoding"); + } + + HRESULT result = encoderSpec->Code(inStream, outStream, 0, 0, 0); + + if (result == E_OUTOFMEMORY) + throw Exception("Cannot allocate memory"); + else if (result != S_OK) { + char buffer[33]; + snprintf(buffer, 33, "%d", (unsigned int)result); + throw Exception(string("Encoder error: ") + buffer); + } +} + +void decode(NCompress::NLzma::CDecoder *decoderSpec, + CMyComPtr inStream, + CMyComPtr outStream) +{ + const UInt32 kPropertiesSize = 5; + Byte properties[kPropertiesSize]; + UInt32 processedSize; + UInt64 fileSize = 0; + + if (inStream->Read(properties, kPropertiesSize, &processedSize) != S_OK) + throw Exception("Read error"); + if (processedSize != kPropertiesSize) + throw Exception("Read error"); + if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK) + throw Exception("SetDecoderProperties() error"); + + for (int i = 0; i < 8; i++) + { + Byte b; + + if (inStream->Read(&b, sizeof(b), &processedSize) != S_OK) + throw Exception("Read error"); + if (processedSize != 1) + throw Exception("Read error"); + + fileSize |= ((UInt64)b) << (8 * i); + } + + if (decoderSpec->Code(inStream, outStream, 0, &fileSize, 0) != S_OK) + throw Exception("Decoder error"); +} + +int open_instream(const string infile, + CMyComPtr &inStream, + UInt64 &fileSize) +{ + CInFileStream *inStreamSpec = new CInFileStream; + inStream = inStreamSpec; + if (!inStreamSpec->Open(infile.c_str())) + throw Exception("Cannot open input file " + infile); + + inStreamSpec->File.GetLength(fileSize); + + return inStreamSpec->File.GetHandle(); +} + +int open_outstream(const string outfile, + CMyComPtr &outStream) +{ + COutFileStream *outStreamSpec = new COutFileStream; + outStream = outStreamSpec; + + bool open_by_force = (program_mode == PM_TEST) | force; + + if (!outStreamSpec->Create(outfile.c_str(), open_by_force)) + throw Exception("Cannot open output file " + outfile); + + return outStreamSpec->File.GetHandle(); +} + +double get_ratio(int inhandle, int outhandle) +{ + struct stat in_stats, out_stats; + fstat(inhandle, &in_stats); + fstat(outhandle, &out_stats); + + return (double)out_stats.st_size / (double)in_stats.st_size; +} + +mode_t get_file_mode(string filename) +{ + struct stat in_stat; + lstat(filename.c_str(), &in_stat); + + return in_stat.st_mode; +} + +bool string_ends_with(string str, string ending) +{ + return equal(ending.rbegin(), ending.rend(), str.rbegin()); +} + +bool extension_is_known(string filename) +{ + bool known_format = false; + extension_pair extension; int i = 1; + + extension = known_extensions[0]; + while (extension.from != NULL) { + if (string_ends_with(filename, extension.from)) { + known_format = true; + break; + } + extension = known_extensions[i]; + i++; + } + + if (!known_format) { + if (!string_ends_with(filename, suffix)) { + return false; + } + } + + return true; +} + +string replace_extension(string filename) +{ + int suffix_starts_at = filename.length() - strlen (suffix); + string from_suffix = filename.substr(suffix_starts_at, strlen (suffix)); + string ret = filename.substr(0, suffix_starts_at); + extension_pair extension; int i = 1; + + bool found_replacement = false; + extension = known_extensions[0]; + while (extension.from != NULL) { + if (from_suffix.compare(extension.from) == 0) { + ret += extension.to; + found_replacement = true; + break; + } + + extension = known_extensions[i]; + i++; + } + + return ret; +} + +string pretty_print_status(string filename, string output_filename, + string ratio) +{ + string ret = ""; + + ret += filename; + ret += ":\t "; + + if (program_mode == PM_TEST) { + ret += "decoded succesfully"; + + return ret; + } + + if (!stdinput && !stdoutput) { + ret += ratio; + ret += " -- "; + } + + if (program_mode == PM_COMPRESS) { + if (keep) { + ret += "encoded succesfully"; + + return ret; + } + + ret += "replaced with "; + ret += output_filename; + + return ret; + } + + if (program_mode == PM_DECOMPRESS) { + if (keep) { + ret += "decoded succesfully"; + + return ret; + } + + ret += "replaced with "; + ret += output_filename; + + return ret; + } + + return ret; +} + +static string archive_name; // I know, it is crude, but I haven't found any other + // way then making a global variable to transfer filename to handler + +void signal_handler (int signum) +{ + unlink (archive_name.c_str()); // deleting + signal (signum, SIG_DFL); // we return the default function to used signal + kill (getpid(), signum); // and then send this signal to the process again +} + +} // namespace lzma + + +int main(int argc, char **argv) +{ + using namespace lzma; + using std::cerr; + + stringVector filenames; + + signal (SIGTERM,signal_handler); + signal (SIGHUP,signal_handler); + signal (SIGINT,signal_handler); + + try { + parse_options(argc, argv, filenames); + } + catch (...) { + return STATUS_ERROR; + } + + if (program_mode == PM_HELP) { + print_help(argv[0]); + return STATUS_OK; + } + else if (program_mode == PM_LICENSE) { + print_license(); + return STATUS_OK; + } + else if (program_mode == PM_VERSION) { + print_version(); + return STATUS_OK; + } + + if (filenames.empty()) { + stdinput = true; + stdoutput = true; + + /* FIXME: get rid of this */ + filenames.push_back("-"); + } + + /* Protection: always create new files with 0600 in order to prevent + * outsiders from reading incomplete data. */ + umask(0077); + + bool warning = false; + + for (unsigned int i = 0; i < filenames.size(); i++) { + CMyComPtr inStream; + CMyComPtr outStream; + UInt64 fileSize = 0; + int inhandle = 0, outhandle = 0; + string output_filename; + + if (stdinput) { + inStream = new CStdInFileStream; + MY_SET_BINARY_MODE(stdin); + fileSize = (UInt64)(Int64)-1; + + inhandle = STDIN_FILENO; + + outStream = new CStdOutFileStream; + MY_SET_BINARY_MODE(stdout); + + outhandle = STDOUT_FILENO; + } + else { + mode_t infile_mode = get_file_mode(filenames[i]); + if (!S_ISREG(infile_mode)) { + if (S_ISDIR(infile_mode)) { + warning = true; + cerr << argv[0] << ": " << filenames[i] << ": " + << "cowardly refusing to work on directory" + << endl; + + continue; + } + else if (S_ISLNK(infile_mode)) { + if (!stdoutput && !force) { + warning = true; + + cerr << argv[0] << ": " << filenames[i] << ": " + << "cowardly refusing to work on symbolic link " + << "(use --force to force encoding or decoding)" + << endl; + + continue; + } + } + else { + warning = true; + + cerr << argv[0] << ": " << filenames[i] << ": " + << "doesn't exist or is not a regular file" + << endl; + + continue; + } + } + + // Test if the file already ends with *suffix. + if (program_mode == PM_COMPRESS && !force + && string_ends_with(filenames[i], + suffix)) { + warning = true; + + cerr << filenames[i] << " already has " + << suffix << " suffix -- unchanged\n"; + + continue; + } + + // Test if the file extension is known. + if (program_mode == PM_DECOMPRESS + && !extension_is_known(filenames[i])) { + warning = true; + + cerr << filenames[i] << ": " + << " unknown suffix -- unchanged" + << endl; + + continue; + } + + try { + inhandle = open_instream(filenames[i], inStream, fileSize); + } + catch (Exception e) { + cerr << argv[0] << ": " << e.what() << endl; + return STATUS_ERROR; + } + + if (stdoutput) { + outStream = new CStdOutFileStream; + MY_SET_BINARY_MODE(stdout); + + outhandle = STDOUT_FILENO; + } + else { + /* Testing mode is nothing else but decoding + * and throwing away the result. */ + if (program_mode == PM_TEST) + output_filename = "/dev/null"; + else if (program_mode == PM_DECOMPRESS) + output_filename = replace_extension(filenames[i]); + else + output_filename = filenames[i] + + suffix; + archive_name = output_filename; + + try { + outhandle = open_outstream(output_filename, outStream); + } + catch (Exception e) { + cerr << argv[0] << ": " << e.what() << endl; + return STATUS_ERROR; + } + } + + } + + // Unless --force is specified, do not read/write compressed + // data from/to a terminal. + if (!force) { + if (program_mode == PM_COMPRESS && isatty(outhandle)) { + cerr << argv[0] << ": compressed data not " + "written to a terminal. Use " + "-f to force compression.\n" + << argv[0] << ": For help, type: " + << argv[0] << " -h\n"; + return STATUS_ERROR; + } else if (program_mode == PM_DECOMPRESS + && isatty(inhandle)) { + cerr << argv[0] << ": compressed data not " + "read from a terminal. Use " + "-f to force decompression.\n" + << argv[0] << ": For help, type: " + << argv[0] << " -h\n"; + return STATUS_ERROR; + } + } + + if (program_mode == PM_COMPRESS) { + NCompress::NLzma::CEncoder *encoderSpec = + new NCompress::NLzma::CEncoder; + + lzma_option options = option_mapping[compression_mode]; + + try { + encode(encoderSpec, inStream, outStream, options, fileSize); + } + catch (Exception e) { + cerr << argv[0] << ": " << e.what() << endl; + unlink(output_filename.c_str()); + delete(encoderSpec); + + return STATUS_ERROR; + } + + delete(encoderSpec); + } + else { // PM_DECOMPRESS | PM_TEST + NCompress::NLzma::CDecoder *decoderSpec = + new NCompress::NLzma::CDecoder; + + try { + decode(decoderSpec, inStream, outStream); + } + catch (Exception e) { + cerr << argv[0] << ": " << e.what() << endl; + if (program_mode != PM_TEST) unlink(output_filename.c_str()); + delete(decoderSpec); + + return STATUS_ERROR; + } + + delete(decoderSpec); + } + + /* Set permissions and owners. */ + if ( (program_mode == PM_COMPRESS || program_mode == PM_DECOMPRESS ) + && (!stdinput && !stdoutput) ) { + + int ret = 0; + struct stat file_stats; + ret = fstat(inhandle, &file_stats); + + ret = fchmod(outhandle, file_stats.st_mode); + ret = fchown(outhandle, file_stats.st_uid, file_stats.st_gid); + // We need to call fchmod() again, since otherwise the SUID bits + // are lost. + ret = fchmod(outhandle, file_stats.st_mode); + + struct timeval file_times[2]; + // Access time + file_times[0].tv_sec = file_stats.st_atime; + file_times[0].tv_usec = 0; + // Modification time + file_times[1].tv_sec = file_stats.st_mtime; + file_times[1].tv_usec = 0; + + ret = futimes(outhandle, file_times); + + if (!keep) + unlink(filenames[i].c_str()); + } + + if (verbosity > 0) { + if (stdoutput) { + cerr << filenames[i] << ":\t "; + cerr << "decoded succesfully" + << endl; + } + + else { + char buf[10] = { 0 }; + + if (program_mode == PM_DECOMPRESS) + snprintf(buf, 10, "%.2f%%", + (1 - get_ratio(outhandle, inhandle)) * 100); + if (program_mode == PM_COMPRESS) + snprintf(buf, 10, "%.2f%%", + (1 - get_ratio(inhandle, outhandle)) * 100); + + string ratio = buf; + cerr << pretty_print_status(filenames[i], output_filename, + ratio) + << endl; + } + } + } + + if (warning) + return STATUS_WARNING; + + return STATUS_OK; +} + Index: lzma-9.22/CPP/7zip/Bundles/LzmaCon/Exception.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ lzma-9.22/CPP/7zip/Bundles/LzmaCon/Exception.h 2012-01-08 16:23:18.000000000 +0100 @@ -0,0 +1,45 @@ +/* A couple of exceptions for lzmp. + * + * Copyright (C) 2005 Ville Koskinen + * + * 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 + * of the License, 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. + */ + +#ifndef _EXCEPTION_H_ +#define _EXCEPTION_H_ + +#include +using std::string; + +class Exception +{ +private: + string message; +public: + Exception(char *what): message(what) { } + Exception(string what): message(what) { } + + ~Exception() { } + + string what(void) { return message; } +}; + +class ArgumentException: public Exception +{ +public: + ArgumentException(char *what): Exception(what) { } + ArgumentException(string what): Exception(what) { } + + ~ArgumentException() { } +}; + +#endif + Index: lzma-9.22/CPP/7zip/Bundles/LzmaCon/makefile.gcc =================================================================== --- lzma-9.22.orig/CPP/7zip/Bundles/LzmaCon/makefile.gcc 2012-01-08 16:23:14.000000000 +0100 +++ lzma-9.22/CPP/7zip/Bundles/LzmaCon/makefile.gcc 2012-01-08 16:23:18.000000000 +0100 @@ -1,9 +1,10 @@ -PROG = lzma +PROG = lzma_alone +PROG2 = lzmp CXX = g++ -O2 -Wall CXX_C = gcc -O2 -Wall LIB = -lm RM = rm -f -CFLAGS = -c -D_7ZIP_ST +CFLAGS = -c -D_7ZIP_ST -DPACKAGE_VERSION="\"9.22\"" ifdef SystemDrive IS_MINGW = 1 @@ -51,14 +52,38 @@ LzmaDec.o \ LzmaEnc.o \ Lzma86Dec.o \ - Lzma86Enc.o \ + Lzma86Enc.o +OBJS2 = \ + 7zCrc.o \ + 7zCrcOpt.o \ + Alloc.o \ + CpuArch.o \ + CRC.o \ + CWrappers.o \ + $(FILE_IO).o \ + FileStreams.o \ + LzFind.o \ + LzmaDec.o \ + LzmaDecoder.o \ + LzmaEnc.o \ + LzmaEncoder.o \ + StreamUtils.o \ + StringConvert.o \ + StringToInt.o \ + lzmp.o -all: $(PROG) +all: $(PROG) $(PROG2) $(PROG): $(OBJS) $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2) +$(PROG2): $(OBJS2) + $(CXX) -o $(PROG2) $(LDFLAGS) $(OBJS2) $(LIB) $(LIB2) + +lzmp.o: lzmp.cpp + $(CXX) $(CFLAGS) lzmp.cpp + LzmaAlone.o: LzmaAlone.cpp $(CXX) $(CFLAGS) LzmaAlone.cpp @@ -160,5 +185,5 @@ $(CXX_C) $(CFLAGS) ../../../../C/Lzma86Enc.c clean: - -$(RM) $(PROG) $(OBJS) + -$(RM) $(PROG) $(OBJS) $(PROG2) $(OBJS2) Index: lzma-9.22/CPP/7zip/Bundles/LzmaCon/lzma_version.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ lzma-9.22/CPP/7zip/Bundles/LzmaCon/lzma_version.h 2012-01-08 16:23:18.000000000 +0100 @@ -0,0 +1,31 @@ +#ifndef LZMA_VERSION_H +#define LZMA_VERSION_H + +/* + Version and copyright information used by LZMA utils. +*/ + +static const char *LZMA_SDK_VERSION_STRING = "9.22"; + +static const char *LZMA_SDK_COPYRIGHT_STRING = + "Copyright (C) 1999-2011 Igor Pavlov"; + +static const char *LZMA_SDK_COPYRIGHT_INFO = + " See http://7-zip.org/sdk.html or the documentation of LZMA SDK for\n" + " the license. For reference, the version 9.22 is free software\n" + " licensed placed under the public domain."; + + +static const char *LZMA_UTILS_VERSION_STRING = PACKAGE_VERSION; + +static const char *LZMA_UTILS_COPYRIGHT_STRING = + "Copyright (C) 2006 Lasse Collin"; + +static const char *LZMA_UTILS_COPYRIGHT_INFO = + "This program comes with ABSOLUTELY NO WARRANTY.\n" + "You may redistribute copies of this program\n" + "under the terms of the GNU General Public License.\n" + "For more information about these matters, see the file " + "named COPYING.\n"; + +#endif /* ifndef LZMA_VERSION_H */ Index: lzma-9.22/CPP/Common/C_FileIO.h =================================================================== --- lzma-9.22.orig/CPP/Common/C_FileIO.h 2012-01-08 16:23:14.000000000 +0100 +++ lzma-9.22/CPP/Common/C_FileIO.h 2012-01-08 16:23:18.000000000 +0100 @@ -28,6 +28,7 @@ bool Close(); bool GetLength(UInt64 &length) const; off_t Seek(off_t distanceToMove, int moveMethod) const; + int GetHandle() const { return _handle; } }; class CInFile: public CFileBase debian/lzma-alone.install0000644000000000000000000000005411630517116012615 0ustar CPP/7zip/Bundles/LzmaCon/lzma_alone usr/bin debian/lzma-dev.docs0000644000000000000000000000005211630517116011555 0ustar 7zC.txt 7zFormat.txt lzma.txt Methods.txt debian/control0000644000000000000000000000512711714343332010577 0ustar Source: lzma Section: utils Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Mohammed Adnène Trojette Uploaders: Arnaud Fontaine , Jonathan Nieder Build-Depends: debhelper (>= 8.0.0), zlib1g-dev Homepage: http://www.7-zip.org/sdk.html Vcs-Git: git://git.debian.org/git/collab-maint/lzma.git Vcs-Browser: http://git.debian.org/?p=collab-maint/lzma.git;a=summary Standards-Version: 3.9.2 Package: lzma Architecture: any Priority: required Section: base Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: xz-lzma (<< 5.1.1alpha+20110809-2) Description: Compression and decompression in the LZMA format - command line utility The Lempel-Ziv Markov-chain Algorithm is a compression method based on the famous LZ77 algorithm, and was first introduced by 7-Zip for use in 7z archives. . Its main characteristics are a very high compression ratio, with high RAM usage, and fast decompression, with low RAM usage. These properties make it well suited to embedded uses, such as for ROM (firmware) compression. . This package provides the lzma command line utility, which has a familiar gzip-like interface. Package: lzma-alone Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: lzma (<< 4.43-13) Replaces: lzma (<< 4.43-13) Description: Compression and decompression in the LZMA format - legacy utility The Lempel-Ziv Markov-chain Algorithm is a compression method based on the famous LZ77 algorithm, and was first introduced by 7-Zip for use in 7z archives. . Its main characteristics are a very high compression ratio, with high RAM usage, and fast decompression, with low RAM usage. These properties make it well suited to embedded uses, such as for ROM (firmware) compression. . This package provides only the old lzma_alone compression utility, which has an interface more like that of zip. Package: lzma-dev Architecture: all Depends: zlib1g-dev, ${misc:Depends} Description: Compression and decompression in the LZMA format - development files The Lempel-Ziv Markov-chain Algorithm is a compression method based on the famous LZ77 algorithm, and was first introduced by 7-Zip for use in 7z archives. . Its main characteristics are a very high compression ratio, with high RAM usage, and fast decompression, with low RAM usage. These properties make it well suited to embedded uses, such as for ROM (firmware) compression. . This package contains the headers and libraries of lzma. It is experimental and will be replaced by the library as soon as it is available. debian/lzmp.10000644000000000000000000001257011630517116010240 0ustar .TH LZMA 1 "23 Dec 2005" "LZMA utils" .SH NAME lzma, unlzma, lzcat \- LZMA compression and decompression tool .SH SYNOPSIS .B lzma .RB [ \-123456789cdefhkLqtvV "] [" \-S .IR suffix "] [" "filenames ..." ] .br .B unlzma .RB [ \-cfhkLqtvV "] [" \-S .IR suffix "] [" "filenames ..." ] .br .B lzcat .RB [ \-fhLqV ] .RI [ "filenames ..." ] .SH DESCRIPTION LZMA (Lempel-Ziv-Markov chain-Algorithm) is an improved version of famous LZ77 compression algorithm. It was improved in way of maximum increasing of compression ratio, keeping high decompression speed and low memory requirements for decompressing. .PP .B lzma command line tool has a similar interface to .BR gzip (1) and .BR bzip2 (1) and is intended to make use of LZMA compression easy for the users who are already familiar with gzip and bzip2. .PP In this manual .B lzma is compared mostly to bzip2 because that is currently one of the most widely used free software to compress tar files made for distribution. Comparing lzma to gzip is not practical because neither lzma nor bzip2 can compete with gzip in compression speed. On the other hand the compression ratio of gzip is worse than of lzma and bzip2. .PP .B lzma provides notably better compression ratio than bzip2 especially with files having other than plain text content. The other advantage of .B lzma is fast decompression which is many times quicker than bzip2. The major disadvantage is that achieving the highest compression ratios requires extensive amount of system resources, both CPU time and RAM. Also software to handle LZMA compressed files is not installed by default on most distributions. .PP When compressing or decompressing with .BR lzma , the new file will have the same ownership information, permissions and timestamps as the original file. However the this information is not stored into the compressed file like gzip does. .SH STREAMED VS. NON-STREAMED LZMA files can be either streamed or non-streamed. Non-streamed files are created only when the size of the file being compressed is known. In practice this means that the source file must be a regular file. In other words, if compressing from the standard input or from a named pipe (fifo) the compressed file will always be streamed. .PP Both streamed and non-streamed files are compressed identically; the only differences are found from the beginnings and ends of LZMA compressed files: Non-streamed files contain the uncompressed size of the file in the LZMA file header; streamed files have uncompressed size marked as unknown. To know where to stop decoding, streamed files have a special End Of Stream marker at the end of the LZMA file. The EOS marker makes streamed files five or six bytes bigger than non-streamed. .PP So in practice creating non-streamed files has two advantages: 1) the compressed file is a few bytes smaller and 2) the uncompressed size of the file can be checked without decompressing the file. .SH OPTIONS Short options can be grouped like .BR \-cd. .TP .B \-c \-\-stdout \-\-to\-stdout The output is written to the standard output. The original files are kept unchanged. When compressing to the standard output there can be only one input file. This option is implied when input is read from the standard input or the script is invoked as .BR lzcat . .TP .B \-d \-\-decompress \-\-uncompress Force decompression regardless of the invocation name. This the default when called as .B unlzma or .BR lzcat . .TP .B \-f \-\-force Force compression or decompression even if source file is a symlink, target exists, or target is a terminal. In contrast to gzip and bzip2, if input data is not in LZMA format, \-\-force does not make lzma behave like .BR cat . .B lzma never prompts if target file should be overwritten; existing files are skipped or, in case of .BR \-\-force , overwritten. .TP .B \-h \-\-help Show a summary of supported options and quit. .TP .B \-k \-\-keep Do not delete the input files after compression or decompression. .TP .B \-L \-\-license Show licensing information of .BR lzma . .TP .B \-q \-\-quiet Suppress all warnings. You can still check the exit status to detect if a warning had been shown. .TP .BI "\-S \-\-suffix " .suf Use .I .suf instead of the default .BR .lzma . A null suffix forces unlzma to decompress all the given files regardless of the filename suffix. .TP .B \-t \-\-test Check the integrity of the compressed file(s). Without .B \-\-verbose no output is produced if no errors are found. .TP .B \-v \-\-verbose Show the filename and percentage reduction of each processes file. .TP .B \-V \-\-version Show the version number of .BR lzma . .TP .B \-z \-\-compress Force compression regardless of the invocation name. .TP .BR \-1 " .. " \-9 Set the compression ratio. These options have no effect when decompressing. .TP .B \-\-fast Alias to .BR \-1 . .TP .B \-\-best Alias to .BR \-9 . .SH DIAGNOSTICS Exit status: .br .B 0 \- Everything OK. .br .B 1 \- An error occurred. .br .B 2 \- Something worth a warning happened but no errors. It can be especially useful with .BR tar (1) patched to support LZMA compression. .SH AUTHORS The LZMA algorithm and the implementation used in LZMA utils was developed by Igor Pavlov. The original code is available in LZMA SDK which can be found from http://7-zip.org/sdk.html . .PP .B lzma command line tool was written by Ville Koskinen. http://tukaani.org/lzma/ .PP This manual page is inspired by manual pages of .B gzip and .BR bzip2 . .SH SEE ALSO .BR gzip (1), .BR bzip2 (1) debian/lzma.manpages0000644000000000000000000000001611630517116011644 0ustar debian/lzmp.1 debian/examples/0000755000000000000000000000000011630517116011005 5ustar debian/examples/deb-lzma0000644000000000000000000000354311630517116012430 0ustar #!/bin/bash -e # # Copyright (C) 2009 Robert Millan # # 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 3 of the License, 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, see . usage () { cat << EOF >&2 Usage: $0 file1.deb [file2.deb ...] EOF } fix_control () { local dir=$(mktemp -d) trap "rm -rf ${dir}" 0 files=$(tar -C ${dir} -xzvf $1) if grep -q "^Pre-Depends:" ${dir}/control ; then sed -i ${dir}/control -e "s/^Pre-Depends: /&dpkg (>= 1.14.21), /" else echo "Pre-Depends: dpkg (>= 1.14.21)" >> ${dir}/control fi tar -C ${dir} -czf - ${files} > $1 rm -rf ${dir} } compress_deb () { local dir=$(mktemp -d) trap "rm -rf ${dir}" 0 deb="$(readlink -f $1)" (cd ${dir} && ar -x "${deb}") if test -e ${dir}/data.tar.lzma ; then echo "${deb}: Already LZMA compressed." >&2 elif test -e ${dir}/data.tar.gz ; then gzip -d < ${dir}/data.tar.gz | lzma -9 > ${dir}/data.tar.lzma rm -f ${dir}/data.tar.gz fix_control ${dir}/control.tar.gz rm -f "${deb}" (cd ${dir} && ar -r "${deb}" debian-binary control.tar.gz data.tar.lzma 2> /dev/null) else echo "${deb}: Only gzipped debs are supported." >&2 fi rm -rf ${dir} } if [ "$1" = "" ] ; then usage exit 1 fi case "$1" in -h|--help) usage exit 0 ;; -*) usage exit 0 ;; esac for i in $@ ; do compress_deb "$i" done exit 0 debian/rules0000755000000000000000000000202511630517116010246 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # # Modified to make a template file for a multi-binary package with separated # build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 SRC_DIR_C = C/Util/Lzma SRC_DIR_CPP = CPP/7zip/Bundles/LzmaCon # This has to be exported to make some magic below work. export DH_OPTIONS override_dh_auto_build: $(MAKE) all -C $(SRC_DIR_C) -f makefile.gcc $(MAKE) all -C $(SRC_DIR_CPP) -f makefile.gcc override_dh_auto_clean: $(MAKE) clean -C $(SRC_DIR_C) -f makefile.gcc $(MAKE) clean -C $(SRC_DIR_CPP) -f makefile.gcc rm -f $(SRC_DIR_C)/*.o $(SRC_DIR_C)/*.a \ $(SRC_DIR_CPP)/*.o $(SRC_DIR_CPP)/*.a %: dh $@ debian/compat0000644000000000000000000000000211630517116010365 0ustar 7 debian/lzma-alone.manpages0000644000000000000000000000002411630517116012737 0ustar debian/lzma_alone.1 debian/lzma.docs0000644000000000000000000000002011630522061010767 0ustar debian/examples debian/lzma.postinst0000644000000000000000000000070511630517116011741 0ustar #!/bin/sh set -e update-alternatives \ --install /usr/bin/lzma lzma /usr/bin/lzmp 30 \ --slave /usr/bin/unlzma unlzma /usr/bin/lzmp \ --slave /usr/bin/lzcat lzcat /usr/bin/lzmp \ --slave /usr/share/man/man1/lzma.1.gz lzma.1.gz \ /usr/share/man/man1/lzmp.1.gz \ --slave /usr/share/man/man1/unlzma.1.gz unlzma.1.gz \ /usr/share/man/man1/lzmp.1.gz \ --slave /usr/share/man/man1/lzcat.1.gz lzcat.1.gz \ /usr/share/man/man1/lzmp.1.gz #DEBHELPER# debian/lzma.dirs0000644000000000000000000000001011630517116011004 0ustar usr/bin