Gentoo Archives: gentoo-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] unpacker.eclass extensions
Date: Mon, 17 Jun 2013 21:41:25
Message-Id: 1371505260.28535.131.camel@big_daddy.dol-sen.ca
In Reply to: Re: [gentoo-dev] [RFC] unpacker.eclass extensions by "Rick \\\"Zero_Chaos\\\" Farina"
1 On Mon, 2013-06-17 at 16:37 -0400, Rick "Zero_Chaos" Farina wrote:
2 > On 06/17/2013 04:19 PM, Diego Elio Pettenò wrote:
3 > > On 17/06/2013 17:54, Rick "Zero_Chaos" Farina wrote:
4 > >> I make all my files with "tar cJf"
5 > >>
6 > >> zero@ozzie ~ % file /usr/portage/distfiles/gr-osmosdr-0.0.2.tar.xz
7 > >> /usr/portage/distfiles/gr-osmosdr-0.0.2.tar.xz: XZ compressed data
8 > >
9 > > cJ with _current_ tar will generate XZ
10 > > cJ with _past_ tar could generate lzma
11 > > xJ with _current_ tar will extract both XZ and lzma
12 > > zJ with _past_ tar will only extract lzma
13 > >
14 > >
15 > tar for the last several years properly and automatically detects the
16 > format of the input using just 'x'. This is true for gnu and bsd tar
17 > which should cover all of gentoo. We should be passing "tar xf" to
18 > extract things unless we want to hijack the decompression command like
19 > is possible in portage with BZIP2_COMMAND=lbzip2 in which case we want
20 > to pass "tar -I $BZIP2_COMMAND -xf" or (not yet in portage) "tar -I pixz
21 > -xf". Some good examples of how this are handled are in catalyst but
22 > I'll let dolson talk about his own work as he is much more qualified
23 > than I am.
24 >
25 > -Zero
26
27 Well, I don't code bash, but...
28
29 In catalyst, I had a request to add more types of
30 compression/decompression capabilities. Plus I am also trying to clean
31 up the messy, poorly structured code. What I have come up with is a
32 separate class that can be loaded with either compression or
33 decompression commands that can be configured, overridden, added to,...
34 It will provide a python interface to perform the actions requested,
35 keeping the detailed coding central and internal. It will provide
36 automatic detection of the command to use via it's extension as a
37 combination of a pre-determined configured preference (if it is
38 compatible) or a suitable command determined by that extension. There
39 can also be several predefined ways to do the same action, in which case
40 the pre-configured preference will take priority.
41
42 I hadn't gotten into reading this thread much, but did note the
43 similarity of what I was currently doing and what it was discussing.
44
45 What is directly relevant to the tar commands is listed in the
46 compression_definitions and decompression_definitions at the top of the
47 file attached.
48
49 This python lib can easily be made into a standalone pkg with a cli
50 interface to perform many common actions without the need of additional
51 coding in eclasses, package managers, etc.. It could provide gentoo
52 with a common, central, easily extended and updated method of performing
53 normal compression/decompression.
54
55 It is a work in progress, with only preliminary testing done inside my
56 catalyst rewrite. I have not yet added configuration options and
57 override preferences.
58
59 It is available in my catalyst git repo in my dev space. It is in the
60 compress branch. Note there is no master branch there, so a basic clone
61 will error when it tries to checkout a master working copy on completion
62 of the clone. Just "git checkout compress" after.
63
64 http://dev.gentoo.org/~dolsen/catalyst/
65
66 I've attached the current compress.py file so you can peruse and decide
67 if making this a standalone gentoo project is desired. If not, it will
68 get merged into catalyst code base.
69 --
70 Brian Dolbec <dolsen@g.o>

Attachments

File name MIME type
compress.py text/x-python