From 16a4488c01b9094fb0d0bf8d98d21effae71b571 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Mon, 15 Jun 2015 16:39:51 +0000 Subject: [PATCH] - bnc#934270 - virt-convert cannot handle .ova files virtinst-replace-unar-with-other-archivers.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=239 --- virt-manager.changes | 6 ++ virt-manager.spec | 2 + ...st-replace-unar-with-other-archivers.patch | 66 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 virtinst-replace-unar-with-other-archivers.patch diff --git a/virt-manager.changes b/virt-manager.changes index 0733bcd9..57a5817e 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jun 15 14:17:50 UTC 2015 - lma@suse.com + +- bnc#934270 - virt-convert cannot handle .ova files + virtinst-replace-unar-with-other-archivers.patch + ------------------------------------------------------------------- Mon Jun 8 06:07:48 MDT 2015 - carnold@suse.com diff --git a/virt-manager.spec b/virt-manager.spec index 3434c49c..703718d8 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -76,6 +76,7 @@ Patch155: virtman-allow-creating-i686-vm.patch Patch160: virtinst-xen-drive-type.patch Patch161: virtinst-xenbus-disk-index-fix.patch Patch162: virtinst-refresh_before_fetch_pool.patch +Patch163: virtinst-replace-unar-with-other-archivers.patch BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -195,6 +196,7 @@ machine). %patch160 -p1 %patch161 -p1 %patch162 -p1 +%patch163 -p1 %build %if %{qemu_user} diff --git a/virtinst-replace-unar-with-other-archivers.patch b/virtinst-replace-unar-with-other-archivers.patch new file mode 100644 index 00000000..22764c3b --- /dev/null +++ b/virtinst-replace-unar-with-other-archivers.patch @@ -0,0 +1,66 @@ +References: bnc#934270 +We don't ship unar with any suse distro (not even in Factory). +Until we do, keep this patch to execute the correct archiver +program. + +Index: virt-manager-1.2.1/virtconv/formats.py +=================================================================== +--- virt-manager-1.2.1.orig/virtconv/formats.py ++++ virt-manager-1.2.1/virtconv/formats.py +@@ -118,6 +118,8 @@ def _find_input(input_file, parser, prin + try: + ext = os.path.splitext(input_file)[1] + tempdir = None ++ binname = None ++ pkg = None + if ext and ext[1:] in ["zip", "gz", "ova", + "tar", "bz2", "bzip2", "7z", "xz"]: + basedir = "/var/tmp" +@@ -129,19 +131,40 @@ def _find_input(input_file, parser, prin + + base = os.path.basename(input_file) + +- # check if 'unar' command existed. +- if not find_executable("unar"): ++ if (ext[1:] == "zip"): ++ binname = "unzip" ++ pkg = "unzip" ++ cmd = ["unzip", "-o", "-d", tempdir, input_file] ++ elif (ext[1:] == "7z"): ++ binname = "7z" ++ pkg = "p7zip" ++ cmd = ["7z", "-o" + tempdir, "e", input_file] ++ elif (ext[1:] == "ova" or ext[1:] == "tar"): ++ binname = "tar" ++ pkg = "tar" ++ cmd = ["tar", "xf", input_file, "-C", tempdir] ++ elif (ext[1:] == "gz"): ++ binname = "gzip" ++ pkg = "gzip" ++ cmd = ["tar", "zxf", input_file, "-C", tempdir] ++ elif (ext[1:] == "bz2" or ext[1:] == "bzip2"): ++ binname = "bzip2" ++ pkg = "bzip2" ++ cmd = ["tar", "jxf", input_file, "-C", tempdir] ++ elif (ext[1:] == "xz"): ++ binname = "xz" ++ pkg = "xz" ++ cmd = ["tar", "Jxf", input_file, "-C", tempdir] ++ if not find_executable(binname): + raise RuntimeError(_("%s appears to be an archive, " +- "but 'unar' is not installed. " +- "Please either install 'unar', or extract the archive " ++ "but '%s' is not installed. " ++ "Please either install '%s', or extract the archive " + "yourself and point virt-convert at " +- "the extracted directory.") % base) ++ "the extracted directory.") % (base, pkg, pkg)) + +- cmd = ["unar", "-o", tempdir, base] + print_cb(_("%s appears to be an archive, running: %s") % + (base, " ".join(cmd))) + +- cmd[-1] = input_file + _run_cmd(cmd) + force_clean.append(tempdir) + input_file = tempdir