Author: peroyvind
Date: Mon Feb 12 11:48:38 2007
New Revision: 118891
Added:
packages/cooker/mc/current/SOURCES/mc-4.6.1.lzma.patch
Modified:
packages/cooker/mc/current/SPECS/mc.spec
Log:
add lzma support (P114)
Added: packages/cooker/mc/current/SOURCES/mc-4.6.1.lzma.patch
==============================================================================
--- (empty file)
+++ packages/cooker/mc/current/SOURCES/mc-4.6.1.lzma.patch Mon Feb 12
11:48:38 2007
@@ -0,0 +1,222 @@
+# LZMA support for Midnight Commander
+# 2006-03-17
+#
+# This patch adds basic support for LZMA compressed files to
+# Midnight Commander 4.6.1. You should have LZMA utils 4.32.x
+# or later. Older versions of LZMA utils will *not* work.
+#
+# Copyright (C) 2006 Lasse Collin <[EMAIL PROTECTED]>
+#
+# This patch 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.
+
+diff -Naru mc-4.6.1.orig/edit/edit.c mc-4.6.1/edit/edit.c
+--- mc-4.6.1.orig/edit/edit.c 2005-05-27 17:19:18.000000000 +0300
++++ mc-4.6.1/edit/edit.c 2006-03-17 17:39:49.000000000 +0200
+@@ -179,6 +179,9 @@
+ } all_filters[] = {
+
+ {
++ "lzma -cd %s 2>&1", "lzma > %s", ".lzma"
++ },
++ {
+ "bzip2 -cd %s 2>&1", "bzip2 > %s", ".bz2"
+ },
+ {
+diff -Naru mc-4.6.1.orig/lib/mc.ext.in mc-4.6.1/lib/mc.ext.in
+--- mc-4.6.1.orig/lib/mc.ext.in 2005-07-23 19:51:15.000000000 +0300
++++ mc-4.6.1/lib/mc.ext.in 2006-03-17 19:05:08.000000000 +0200
+@@ -119,6 +119,11 @@
+ Open=%cd %p#utar
+ View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
+
++# .tar.lzma, .tlz
++regex/\.t(ar\.lzma|lz)$
++ Open=%cd %p#utar
++ View=%view{ascii} lzma -dc %f 2>/dev/null | tar tvvf -
++
+ # .tar.F - used in QNX
+ regex/\.tar\.F$
+ # Open=%cd %p#utar
+@@ -283,6 +288,10 @@
+ Open=case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f |
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
+ View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;;
*) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
+
++regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
++ Open=case %d/%f in */log/*|*/logs/*) lzma -dc %f ;; *) lzma -dc %f |
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
++ View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) lzma -dc %f ;;
*) lzma -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
++
+
+ ### Images ###
+
+@@ -527,6 +536,11 @@
+ Open=gzip -dc %f | %var{PAGER:more}
+ View=%view{ascii} gzip -dc %f 2>/dev/null
+
++# lzma
++regex/\.lzma$
++ Open=lzma -dc %f | %var{PAGER:more}
++ View=%view{ascii} lzma -dc %f 2>/dev/null
++
+
+ ### Default ###
+
+diff -Naru mc-4.6.1.orig/src/util.c mc-4.6.1/src/util.c
+--- mc-4.6.1.orig/src/util.c 2005-05-27 17:19:18.000000000 +0300
++++ mc-4.6.1/src/util.c 2006-03-17 18:20:50.000000000 +0200
+@@ -900,7 +900,7 @@
+ * Warning: this function moves the current file pointer */
+ int get_compression_type (int fd)
+ {
+- unsigned char magic[4];
++ unsigned char magic[16];
+
+ /* Read the magic signature */
+ if (mc_read (fd, (char *) magic, 4) != 4)
+@@ -944,6 +944,31 @@
+ return COMPRESSION_BZIP2;
+ }
+ }
++
++ /* LZMA files; both LZMA_Alone and LZMA utils formats. The LZMA_Alone
++ * format is used by the LZMA_Alone tool from LZMA SDK. The LZMA utils
++ * format is the default format of LZMA utils 4.32.1 and later. */
++ if (magic[0] < 0xE1 || (magic[0] == 0xFF && magic[1] == 'L' &&
++ magic[2] == 'Z' && magic[3] == 'M')) {
++ if (mc_read (fd, (char *) magic + 4, 9) == 9) {
++ /* LZMA utils format */
++ if (magic[0] == 0xFF && magic[4] == 'A' && magic[5] == 0x00)
++ return COMPRESSION_LZMA;
++ /* The LZMA_Alone format has no magic bytes, thus we
++ * need to play a wizard. This can give false positives,
++ * thus the detection below should be removed when
++ * the newer LZMA utils format has got popular. */
++ if (magic[0] < 0xE1 && magic[4] < 0x20 &&
++ ((magic[10] == 0x00 && magic[11] == 0x00 &&
++ magic[12] == 0x00) ||
++ (magic[5] == 0xFF && magic[6] == 0xFF &&
++ magic[7] == 0xFF && magic[8] == 0xFF &&
++ magic[9] == 0xFF && magic[10] == 0xFF &&
++ magic[11] == 0xFF && magic[12] == 0xFF)))
++ return COMPRESSION_LZMA;
++ }
++ }
++
+ return 0;
+ }
+
+@@ -954,6 +979,7 @@
+ case COMPRESSION_GZIP: return "#ugz";
+ case COMPRESSION_BZIP: return "#ubz";
+ case COMPRESSION_BZIP2: return "#ubz2";
++ case COMPRESSION_LZMA: return "#ulzma";
+ }
+ /* Should never reach this place */
+ fprintf (stderr, "Fatal: decompress_extension called with an unknown
argument\n");
+diff -Naru mc-4.6.1.orig/src/util.h mc-4.6.1/src/util.h
+--- mc-4.6.1.orig/src/util.h 2005-01-13 21:20:47.000000000 +0200
++++ mc-4.6.1/src/util.h 2006-03-17 17:34:34.000000000 +0200
+@@ -169,7 +169,8 @@
+ COMPRESSION_NONE,
+ COMPRESSION_GZIP,
+ COMPRESSION_BZIP,
+- COMPRESSION_BZIP2
++ COMPRESSION_BZIP2,
++ COMPRESSION_LZMA
+ };
+
+ int get_compression_type (int fd);
+diff -Naru mc-4.6.1.orig/vfs/extfs/iso9660.in mc-4.6.1/vfs/extfs/iso9660.in
+--- mc-4.6.1.orig/vfs/extfs/iso9660.in 2004-10-29 12:14:38.000000000 +0300
++++ mc-4.6.1/vfs/extfs/iso9660.in 2006-03-17 17:45:28.000000000 +0200
+@@ -25,6 +25,7 @@
+ mcisofs_list () {
+ # left as a reminder to implement compressed image support =)
+ case "$1" in
++ *.lzma) MYCAT="lzma -dc";;
+ *.bz2) MYCAT="bzip2 -dc";;
+ *.gz) MYCAT="gzip -dc";;
+ *.z) MYCAT="gzip -dc";;
+diff -Naru mc-4.6.1.orig/vfs/extfs/lslR.in mc-4.6.1/vfs/extfs/lslR.in
+--- mc-4.6.1.orig/vfs/extfs/lslR.in 2003-06-22 12:54:21.000000000 +0300
++++ mc-4.6.1/vfs/extfs/lslR.in 2006-03-17 17:45:08.000000000 +0200
+@@ -12,6 +12,7 @@
+
+ mclslRfs_list () {
+ case "$1" in
++ *.lzma) MYCAT="lzma -dc";;
+ *.bz2) MYCAT="bzip2 -dc";;
+ *.gz) MYCAT="gzip -dc";;
+ *.z) MYCAT="gzip -dc";;
+diff -Naru mc-4.6.1.orig/vfs/extfs/mailfs.in mc-4.6.1/vfs/extfs/mailfs.in
+--- mc-4.6.1.orig/vfs/extfs/mailfs.in 2002-12-24 08:56:17.000000000 +0200
++++ mc-4.6.1/vfs/extfs/mailfs.in 2006-03-17 17:53:47.000000000 +0200
+@@ -7,6 +7,7 @@
+
+ $zcat="zcat"; # gunzip to stdout
+ $bzcat="bzip2 -dc"; # bunzip2 to stdout
++$lzcat="lzma -dc"; # unlzma to stdout
+ $file="file"; # "file" command
+ $TZ='GMT'; # default timezone (for Date module)
+
+@@ -132,6 +133,8 @@
+ exit 1 unless (open IN, "$zcat $mbox_qname|");
+ } elsif (/bzip/) {
+ exit 1 unless (open IN, "$bzcat $mbox_qname|");
++} elsif (/lzma/) {
++ exit 1 unless (open IN, "$lzcat $mbox_qname|");
+ } else {
+ exit 1 unless (open IN, "<$mbox_name");
+ }
+diff -Naru mc-4.6.1.orig/vfs/extfs/patchfs.in mc-4.6.1/vfs/extfs/patchfs.in
+--- mc-4.6.1.orig/vfs/extfs/patchfs.in 2004-11-17 01:00:40.000000000 +0200
++++ mc-4.6.1/vfs/extfs/patchfs.in 2006-03-17 17:52:47.000000000 +0200
+@@ -12,6 +12,7 @@
+ use File::Temp 'tempfile';
+
+ # standard binaries
++my $lzma = 'lzma';
+ my $bzip = 'bzip2';
+ my $gzip = 'gzip';
+ my $fileutil = 'file';
+@@ -70,7 +71,9 @@
+ my ($qfname)=(quotemeta $_[0]);
+
+ $_=`$fileutil $qfname`;
+- if (/bzip/) {
++ if (/lzma/) {
++ return "$lzma -dc $qfname";
++ } elsif (/bzip/) {
+ return "$bzip -dc $qfname";
+ } elsif (/gzip/) {
+ return "$gzip -dc $qfname";
+@@ -86,7 +89,9 @@
+ my ($sep) = $append ? '>>' : '>';
+
+ $_=`$fileutil $qfname`;
+- if (/bzip/) {
++ if (/lzma/) {
++ return "$lzma -c $sep $qfname";
++ } elsif (/bzip/) {
+ return "$bzip -c $sep $qfname";
+ } elsif (/gzip/) {
+ return "$gzip -c $sep $qfname";
+diff -Naru mc-4.6.1.orig/vfs/extfs/sfs.ini mc-4.6.1/vfs/extfs/sfs.ini
+--- mc-4.6.1.orig/vfs/extfs/sfs.ini 1998-12-15 17:57:43.000000000 +0200
++++ mc-4.6.1/vfs/extfs/sfs.ini 2006-03-17 17:44:01.000000000 +0200
+@@ -10,6 +10,8 @@
+ ubz/1 bzip -d < %1 > %3
+ bz2/1 bzip2 < %1 > %3
+ ubz2/1 bzip2 -d < %1 > %3
++lzma/1 lzma < %1 > %3
++ulzma/1 lzma -d < %1 > %3
+ tar/1 tar cf %3 %1
+ tgz/1 tar czf %3 %1
+ uhtml/1 lynx -force_html -dump %1 > %3
Modified: packages/cooker/mc/current/SPECS/mc.spec
==============================================================================
--- packages/cooker/mc/current/SPECS/mc.spec (original)
+++ packages/cooker/mc/current/SPECS/mc.spec Mon Feb 12 11:48:38 2007
@@ -4,7 +4,7 @@
Summary: A user-friendly file manager and visual shell
Name: mc
Version: 4.6.1
-Release: %mkrel 5
+Release: %mkrel 6
License: GPL
Group: File tools
URL: http://www.ibiblio.org/mc/
@@ -46,6 +46,7 @@
Patch111: mc-ftpcrash.patch
Patch112: mc-symcrash.patch
Patch113: mc-userhost.patch
+Patch114: mc-4.6.1.lzma.patch
Requires: groff
Requires: slang > 1.4.9-5mdk
BuildRequires: libext2fs-devel
@@ -96,6 +97,7 @@
%patch111 -p1
%patch112 -p1
%patch113 -p1
+%patch114 -p1 -b .lzma
sed -i 's:|hxx|:|hh|hpp|hxx|:' syntax/Syntax