unpisi < tar.lzma.pisi
This commit is contained in:
+17
-3
@@ -11,9 +11,13 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
from pisi.archive import ArchiveZip
|
import pisi
|
||||||
|
from pisi.archive import ArchiveZip, ArchiveTar
|
||||||
from pisi.zipfileext import BadZipfile
|
from pisi.zipfileext import BadZipfile
|
||||||
|
import pisi.context as ctx
|
||||||
|
import pisi.util as util
|
||||||
|
|
||||||
def usage(errmsg):
|
def usage(errmsg):
|
||||||
print """
|
print """
|
||||||
@@ -30,6 +34,8 @@ def main():
|
|||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
usage("PiSi package required..")
|
usage("PiSi package required..")
|
||||||
|
|
||||||
|
pisi.api.init(database=False, options='')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
arc = ArchiveZip(sys.argv[1], 'zip', 'r')
|
arc = ArchiveZip(sys.argv[1], 'zip', 'r')
|
||||||
except BadZipfile, e:
|
except BadZipfile, e:
|
||||||
@@ -37,9 +43,17 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
arc.unpack_files(['files.xml', 'metadata.xml'], '.')
|
arc.unpack_files(['files.xml', 'metadata.xml'], '.')
|
||||||
|
arc.unpack_files("install.tar.lzma", ctx.config.tmp_dir())
|
||||||
arc.unpack_dir_flat('comar','comar')
|
arc.unpack_dir_flat('comar','comar')
|
||||||
arc.unpack_dir_flat('install','.')
|
|
||||||
|
tar_file = util.join_path(ctx.config.tmp_dir(), "install.tar.lzma")
|
||||||
|
tar = ArchiveTar(tar_file, 'tarlzma')
|
||||||
|
tar.unpack_dir('.')
|
||||||
|
|
||||||
|
os.unlink(tar_file)
|
||||||
|
os.unlink(tar_file.rstrip('.lzma'))
|
||||||
|
|
||||||
|
pisi.api.finalize()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user