diff --git a/pisi/archive.py b/pisi/archive.py index 4642486b..75e7720f 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -57,14 +57,17 @@ class ArchiveZip(ArchiveBase): def __init__(self, filepath, type="zip"): super(ArchiveZip, self).__init__(filepath, type) - def unpack_file_cond(self, pred, targetDir): + def unpack_file_cond(self, pred, targetDir, extractRoot=''): """ unpack file according to predicate function filename -> bool""" super(ArchiveTarFile, self).unpack(targetDir) zip = zipfile.ZipFile(self.filePath, 'r') for file in zip.namelist(): - if pred(file): # search for path - opath = os.path.join(targetDir, file) + if pred(file): # check if condition holds + if extractRoot=='': + ofile = os.path.join(targetDir, file) + else: + raise ArchiveError("changing extraction root not implemented yet") if os.path.isdir(ofile): continue util.check_dir(os.path.dirname(ofile)) diff --git a/pisi/package.py b/pisi/package.py index 0182b03d..b3886381 100644 --- a/pisi/package.py +++ b/pisi/package.py @@ -19,15 +19,18 @@ class Package: def extract_file(self, path, outdir): """extract file with path to outdir""" + impl.unpack_file(path, outdir) def extract_dir(self, dir, outdir): """extract directory recursively, this function copies the directory archiveroot/dir to outdir""" + impl.unpack_dir(path, outdir) def extract_dir_flat(self, dir, outdir): """extract directory recursively, this function unpacks the *contents* of directory archiveroot/dir inside outdir this is the function used by the installer""" + impl.unpack_dir_flat(dir, outdir) def extract_PISI_files(self, outdir): """extract PISI control files: metadata.xml, files.xml,