File ova-unpack.patch of Package open-ovf
Index: open-ovf-0.1/py/ovf/OvfSet.py
===================================================================
--- open-ovf-0.1.orig/py/ovf/OvfSet.py
+++ open-ovf-0.1/py/ovf/OvfSet.py
@@ -298,6 +298,23 @@ class OvfSet(object):
except IOError, (errno, strerror):
raise IOError("I/O error(%s): %s" % (errno, strerror))
+ def copyArchive(self, path):
+ """
+ Copy contents of archivePath to given path.
+ @type path: String
+ @param path: path to destination directory
+ @raise IOError: file or directory does not exist
+ """
+ try:
+ if self.archivePath == None:
+ raise IOError("source archive does not exist")
+
+ for curFile in os.listdir(self.archivePath):
+ shutil.move(os.path.join(self.archivePath, curFile), path)
+
+ except IOError, (errno, strerror):
+ raise IOError("I/O error(%s): %s" % (errno, strerror))
+
def getOvfFile(self):
"""
This function will return the object instance of the L{OvfFile}
Index: open-ovf-0.1/py/scripts/ova
===================================================================
--- open-ovf-0.1.orig/py/scripts/ova
+++ open-ovf-0.1/py/scripts/ova
@@ -144,7 +144,7 @@ def unpackOva(options, args):
ovaSet = OvfSet(options.ovfFile, "r", FORMAT_TAR)
if not os.path.isdir(options.targetDir):
os.mkdir(options.targetDir)
- ovaSet.writeAsDir(options.targetDir)
+ ovaSet.copyArchive(options.targetDir)
else:
raise IOError("Specified appliance archive " + options.ovfFile + \
" does not exist")