Re: [virt-manager PATCH] formats: make sure 'unar' is existed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 04, 2014 at 04:16:58PM +0800, Chen Hanxiao wrote:
> Commit 0b4a72fd77f74e5a9f6885179febe601156df617
> needs unar command to do some tests.
>
> But if we haven't installed it, the error message
> told us nothing valuable as:
> "OSError: [Errno 2] No such file or directory"
>
> This patch will impove the error message.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
> ---

I got to the bottom of this when I first saw the error and after some
time installed it.  But since you're posting this question, shouldn't
we put unar into .spec.in file and check for it while running
setup.py?

Or even better, can't we use something else than unar since on source
distributions this requires objective C compiler and some other not
very usual packages.  It seems a little bit cumbersome for some users;
and yes, I understand it's the minimum, but if there's an easier way
than we may as well be nice.

Martin

>  virtconv/formats.py | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/virtconv/formats.py b/virtconv/formats.py
> index 5eb4356..2602c09 100644
> --- a/virtconv/formats.py
> +++ b/virtconv/formats.py
> @@ -132,6 +132,12 @@ def _find_input(input_file, parser, print_cb):
>                      prefix="virt-convert-tmp", dir=basedir)
>
>              base = os.path.basename(input_file)
> +
> +            # check if 'unar' command existed.
> +            ret = os.system("unar -h > /dev/null")
> +            if ret:
> +                raise RuntimeError("Could not find 'unar' command")
> +
>              cmd = ["unar", "-o", tempdir, base]
>              print_cb(_("%s appears to be an archive, running: %s") %
>                  (base, " ".join(cmd)))
> --
> 1.8.5.3
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: signature.asc
Description: Digital signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux