On Mon, 2013-06-17 at 16:37 -0400, Rick "Zero_Chaos" Farina wrote: > On 06/17/2013 04:19 PM, Diego Elio Pettenò wrote: > > On 17/06/2013 17:54, Rick "Zero_Chaos" Farina wrote: > >> I make all my files with "tar cJf" > >> > >> zero@ozzie ~ % file /usr/portage/distfiles/gr-osmosdr-0.0.2.tar.xz > >> /usr/portage/distfiles/gr-osmosdr-0.0.2.tar.xz: XZ compressed data > > > > cJ with _current_ tar will generate XZ > > cJ with _past_ tar could generate lzma > > xJ with _current_ tar will extract both XZ and lzma > > zJ with _past_ tar will only extract lzma > > > > > tar for the last several years properly and automatically detects the > format of the input using just 'x'. This is true for gnu and bsd tar > which should cover all of gentoo. We should be passing "tar xf" to > extract things unless we want to hijack the decompression command like > is possible in portage with BZIP2_COMMAND=lbzip2 in which case we want > to pass "tar -I $BZIP2_COMMAND -xf" or (not yet in portage) "tar -I pixz > -xf". Some good examples of how this are handled are in catalyst but > I'll let dolson talk about his own work as he is much more qualified > than I am. > > -Zero Well, I don't code bash, but... In catalyst, I had a request to add more types of compression/decompression capabilities. Plus I am also trying to clean up the messy, poorly structured code. What I have come up with is a separate class that can be loaded with either compression or decompression commands that can be configured, overridden, added to,... It will provide a python interface to perform the actions requested, keeping the detailed coding central and internal. It will provide automatic detection of the command to use via it's extension as a combination of a pre-determined configured preference (if it is compatible) or a suitable command determined by that extension. There can also be several predefined ways to do the same action, in which case the pre-configured preference will take priority. I hadn't gotten into reading this thread much, but did note the similarity of what I was currently doing and what it was discussing. What is directly relevant to the tar commands is listed in the compression_definitions and decompression_definitions at the top of the file attached. This python lib can easily be made into a standalone pkg with a cli interface to perform many common actions without the need of additional coding in eclasses, package managers, etc.. It could provide gentoo with a common, central, easily extended and updated method of performing normal compression/decompression. It is a work in progress, with only preliminary testing done inside my catalyst rewrite. I have not yet added configuration options and override preferences. It is available in my catalyst git repo in my dev space. It is in the compress branch. Note there is no master branch there, so a basic clone will error when it tries to checkout a master working copy on completion of the clone. Just "git checkout compress" after. http://dev.gentoo.org/~dolsen/catalyst/ I've attached the current compress.py file so you can peruse and decide if making this a standalone gentoo project is desired. If not, it will get merged into catalyst code base. -- Brian Dolbec