Exemplo n.º 1
0
    def unpack(self, target_dir, clean_dir=True):

        # check archive file's integrity
        if not util.check_file_hash(self.archiveFile, self.archive.sha1sum):
            raise Error(_("unpack: check_file_hash failed"))

        try:
            archive = pisi.archive.Archive(self.archiveFile, self.archive.type)
        except pisi.archive.UnknownArchiveType:
            raise Error(_("Unknown archive type '%s' is given for '%s'.")
                        % (self.archive.type, self.url.filename()))
        except pisi.archive.ArchiveHandlerNotInstalled:
            raise Error(_("Pisi needs %s to unpack this archive but it is not installed.")
                        % self.archive.type)

        target_dir = os.path.join(target_dir, self.archive.target or "")
        archive.unpack(target_dir, clean_dir)
Exemplo n.º 2
0
 def unpack(self, target_dir, clean_dir=True):
     self.sourceArchives[0].unpack(target_dir, clean_dir)
     for archive in self.sourceArchives[1:]:
         archive.unpack(target_dir, clean_dir=False)