Support bsdtar.

This commit is contained in:
Bastian Kleineidam 2012-05-23 18:22:16 +02:00
parent 84dfa58d2e
commit df8f0841f3
5 changed files with 33 additions and 17 deletions

View File

@ -168,10 +168,10 @@ ArchivePrograms = {
'test': ('7z',),
},
'cpio': {
'extract': ('cpio', '7z'),
'list': ('cpio', '7z'),
'test': ('7z',),
'create': ('cpio',),
'extract': ('cpio', 'bsdcpio', '7z'),
'list': ('cpio', 'bsdcpio', '7z'),
'test': ('cpio', 'bsdcpio', '7z',),
'create': ('cpio', 'bsdcpio'),
},
'rpm': {
'extract': ('rpm2cpio', '7z'),

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Bastian Kleineidam
#
# 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 <http://www.gnu.org/licenses/>.
"""Archive commands for the bsdcpio program."""
from .cpio import extract_cpio, list_cpio, test_cpio, create_cpio

View File

@ -22,7 +22,7 @@ def extract_cpio (archive, compression, cmd, **kwargs):
"""Extract a CPIO archive."""
cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories',
'--preserve-modification-time']
if sys.platform != 'darwin':
if sys.platform.startswith('linux') and not cmd.endswith('bsdcpio'):
cmdlist.extend(['--no-absolute-filenames',
'--force-local', '--nonmatching', r'"*\.\.*"'])
if kwargs['verbose']:

View File

@ -314,13 +314,12 @@ class TestArchives (ArchiveTest):
@needs_program('cpio')
def test_cpio (self):
self.program = 'cpio'
self.archive_list('t.cpio')
self.archive_extract('t.cpio')
self.archive_commands('t.cpio')
@needs_program('cpio')
@needs_program('7z')
def test_cpio_create (self):
self.archive_create('t.cpio')
@needs_program('bsdcpio')
def test_bsdcpio (self):
self.program = 'bsdcpio'
self.archive_commands('t.cpio')
@needs_program('unace')
def test_unace (self):

View File

@ -346,14 +346,13 @@ class TestArchives (ArchiveTest):
@needs_program('cpio')
def test_cpio (self):
self.program = 'cpio'
self.archive_list('t.cpio.foo')
self.archive_extract('t.cpio.foo')
self.archive_commands('t.cpio.foo', format="cpio")
@needs_program('file')
@needs_program('cpio')
@needs_program('7z')
def test_cpio (self):
self.archive_create('t.cpio.foo', format="cpio")
@needs_program('bsdcpio')
def test_bsdcpio (self):
self.program = 'bsdcpio'
self.archive_commands('t.cpio.foo', format="cpio")
@needs_program('file')
@needs_program('unace')