Fix rzip archive handling.

This commit is contained in:
Bastian Kleineidam 2013-02-23 09:01:15 +01:00
parent 7006c51d53
commit 165411a54a
5 changed files with 8 additions and 10 deletions

View File

@ -2,7 +2,7 @@
* Add support for grepping in archive contents. * Add support for grepping in archive contents.
* Fixed Python lzma archive handling. * Fixed Python lzma archive handling.
* Fixed lzop and lrzip archive handling. * Fixed lzop, lrzip and rzip archive handling.
0.19 "The Kids Are All Right" (released 21.2.2013) 0.19 "The Kids Are All Right" (released 21.2.2013)

View File

@ -13,23 +13,21 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the lrzip program.""" """Archive commands for the rzip program."""
import os import os
from .. import util from .. import util
def extract_rzip (archive, compression, cmd, **kwargs): def extract_rzip (archive, compression, cmd, **kwargs):
"""Extract a RZIP archive.""" """Extract an RZIP archive."""
# Since extracted files will be placed in the current directory,
# the cwd argument has to be the output directory.
cmdlist = [cmd, '-d', '-k'] cmdlist = [cmd, '-d', '-k']
if kwargs['verbose']: if kwargs['verbose']:
cmdlist.append('-v') cmdlist.append('-v')
outfile = util.get_single_outfile(kwargs['outdir'], archive) outfile = util.get_single_outfile(kwargs['outdir'], archive)
cmdlist.extend(["-o", outfile, os.path.abspath(archive)]) cmdlist.extend(["-o", outfile, archive])
return (cmdlist, {'cwd': kwargs['outdir']}) return cmdlist
def create_rzip (archive, compression, cmd, *args, **kwargs): def create_rzip (archive, compression, cmd, *args, **kwargs):
"""Create a RZIP archive.""" """Create an RZIP archive."""
cmdlist = [cmd, '-k', '-o', archive] cmdlist = [cmd, '-k', '-o', archive]
if kwargs['verbose']: if kwargs['verbose']:
cmdlist.append('-v') cmdlist.append('-v')

View File

@ -22,10 +22,10 @@ class TestRzip (ArchiveTest):
@needs_program(program) @needs_program(program)
def test_rzip(self): def test_rzip(self):
self.archive_extract('t.txt.rz') self.archive_extract('t.txt.rz', check=Content.Singlefile)
self.archive_create('t.txt.rz', check=Content.Singlefile) self.archive_create('t.txt.rz', check=Content.Singlefile)
@needs_program(program) @needs_program(program)
def test_rzip_file(self): def test_rzip_file(self):
self.archive_extract('t.txt.rz.foo') self.archive_extract('t.txt.rz.foo', check=Content.Singlefile)

Binary file not shown.

Binary file not shown.