[python-virtinst/f16] Fix installation of translation files Handle libvirt getVersion failing (bz 726617)
Cole Robinson
crobinso at fedoraproject.org
Mon Aug 1 20:38:49 UTC 2011
commit d02c32e607a21bcf009d77f9becefeed04fbe06b
Author: Cole Robinson <crobinso at redhat.com>
Date: Mon Aug 1 16:38:29 2011 -0400
Fix installation of translation files
Handle libvirt getVersion failing (bz 726617)
python-virtinst.spec | 12 ++++-
virtinst-catch-version-errs.patch | 28 +++++++++
virtinst-fix-po-install.patch | 110 +++++++++++++++++++++++++++++++++++++
3 files changed, 149 insertions(+), 1 deletions(-)
---
diff --git a/python-virtinst.spec b/python-virtinst.spec
index 077dea7..5456624 100644
--- a/python-virtinst.spec
+++ b/python-virtinst.spec
@@ -1,7 +1,7 @@
# -*- rpm-spec -*-
%define _version 0.600.0
-%define _release 1
+%define _release 2
%define with_rhel6_defaults 0
%define with_selinux 1
@@ -32,6 +32,10 @@ Name: python-%{appname}
Version: %{_version}
Release: %{_release}%{_extra_release}.1
Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
+# Fix installation of translation files
+Patch1: %{appname}-fix-po-install.patch
+# Handle libvirt getVersion failing (bz 726617)
+Patch2: %{appname}-catch-version-errs.patch
License: GPLv2+
Group: Development/Libraries
@@ -58,6 +62,8 @@ and install new VMs) and virt-clone (clone an existing virtual machine).
%prep
%setup -q -n %{appname}-%{version}
+%patch1 -p1
+%patch2 -p1
%build
%if %{with_rhel6_defaults}
@@ -94,6 +100,10 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/virt-convert
%changelog
+* Mon Aug 01 2011 Cole Robinson <crobinso at redhat.com> - 0.600.0-2
+- Fix installation of translation files
+- Handle libvirt getVersion failing (bz 726617)
+
* Tue Jul 26 2011 Cole Robinson <crobinso at redhat.com> - 0.600.0-1.fc16
- Rebased to version 0.600.0
- virt-install: Various improvements to enable LXC/container guests:
diff --git a/virtinst-catch-version-errs.patch b/virtinst-catch-version-errs.patch
new file mode 100644
index 0000000..7276e71
--- /dev/null
+++ b/virtinst-catch-version-errs.patch
@@ -0,0 +1,28 @@
+commit c11616761952697dadb2b9a88b761d9816060c54
+Author: Cole Robinson <crobinso at redhat.com>
+Date: Mon Aug 1 16:16:01 2011 -0400
+
+ support: If getting HV version fails, just use 0
+
+ If libvirt has issues building qemu caps, version can fail.
+
+diff --git a/virtinst/support.py b/virtinst/support.py
+index 1fb3e28..b1db501 100644
+--- a/virtinst/support.py
++++ b/virtinst/support.py
+@@ -373,9 +373,12 @@ def _hv_ver(conn, uri):
+ if not _try_command(cmd, args):
+ return 0
+
+- ret = cmd(*args)
+- if type(ret) == tuple:
+- ret = ret[1]
++ try:
++ ret = cmd(*args)
++ if type(ret) == tuple:
++ ret = ret[1]
++ except libvirt.libvirtError:
++ ret = 0
+
+ return ret
+
diff --git a/virtinst-fix-po-install.patch b/virtinst-fix-po-install.patch
new file mode 100644
index 0000000..d41e42a
--- /dev/null
+++ b/virtinst-fix-po-install.patch
@@ -0,0 +1,110 @@
+diff --git a/setup.py b/setup.py
+index 52f1ea8..27a1c5a 100755
+--- a/setup.py
++++ b/setup.py
+@@ -23,17 +23,29 @@ from distutils.command.sdist import sdist
+ from distutils.command.build import build
+ from unittest import TextTestRunner, TestLoader
+
+-scripts = ["virt-install", "virt-clone", "virt-image", "virt-convert"]
+-packages = ['virtinst', 'virtconv', 'virtconv.parsers']
+-config_files = ["virtinst/_config.py", "virtconv/_config.py"]
+-datafiles = [('share/man/man1', ['man/en/virt-install.1',
+- 'man/en/virt-clone.1',
+- 'man/en/virt-image.1',
+- 'man/en/virt-convert.1']),
+- ('share/man/man5', ['man/en/virt-image.5'])]
+-
+ VERSION = "0.600.0"
+
++# translation installing
++def _build_po_list():
++ ret = {}
++ for filename in glob.glob(os.path.join(os.getcwd(), 'po', '*.po')):
++ filename = os.path.basename(filename)
++ lang = os.path.basename(filename)[0:len(filename) - 3]
++ langdir = os.path.join("build", "mo", lang, "LC_MESSAGES")
++
++ newname = os.path.join(langdir, "virtinst.mo")
++ ret[lang] = (filename, newname)
++ return ret
++
++def _build_lang_data():
++ ret = []
++ for lang, (ignore, newname) in _build_po_list().items():
++ targetpath = os.path.join("share", "locale", lang, "LC_MESSAGES")
++ ret.append((targetpath, [newname]))
++ return ret
++
++# Config file building
++config_files = ["virtinst/_config.py", "virtconv/_config.py"]
+ config_template = """
+ __version__ = "%(VERSION)s"
+ __version_info__ = tuple([ int(num) for num in __version__.split('.')])
+@@ -312,30 +324,30 @@ class mybuild(build):
+ "VERSION" : VERSION,
+ "RHEL6DEFAULTS" : self.rhel6defaults,
+ }
++
+ config_data = config_template % config_opts
+ print "Version : %s" % VERSION
+ print "RHEL6 defaults : %s" % bool(self.rhel6defaults)
+
+ for f in config_files:
++ if os.path.exists(f):
++ origconfig = file(f).read()
++ if origconfig == config_data:
++ continue
++
+ print "Generating %s" % f
+ fd = open(f, "w")
+ fd.write(config_data)
+ fd.close()
+
+- for filename in glob.glob(os.path.join(os.getcwd(), 'po', '*.po')):
+- filename = os.path.basename(filename)
+- lang = os.path.basename(filename)[0:len(filename) - 3]
+- langdir = os.path.join("build", "mo", lang, "LC_MESSAGES")
++ for filename, newname in _build_po_list().values():
++ langdir = os.path.dirname(newname)
+ if not os.path.exists(langdir):
+ os.makedirs(langdir)
+
+- newname = os.path.join(langdir, "virtinst.mo")
+ print "Formatting %s to %s" % (filename, newname)
+ os.system("msgfmt po/%s -o %s" % (filename, newname))
+
+- targetpath = os.path.join("share", "locale", lang, "LC_MESSAGES")
+- self.distribution.data_files.append((targetpath, (newname,)))
+-
+ build.run(self)
+
+ setup(
+@@ -348,8 +360,18 @@ setup(
+ url='http://virt-manager.org',
+ package_dir={'virtinst': 'virtinst'},
+ scripts=["virt-install", "virt-clone", "virt-image", "virt-convert"],
+- packages=packages,
+- data_files=datafiles,
++ packages=['virtinst', 'virtconv', 'virtconv.parsers'],
++
++ data_files=[
++ ('share/man/man1', [
++ 'man/en/virt-install.1',
++ 'man/en/virt-clone.1',
++ 'man/en/virt-image.1',
++ 'man/en/virt-convert.1']),
++ ('share/man/man5', [
++ 'man/en/virt-image.5']),
++ ] + _build_lang_data(),
++
+ cmdclass={
+ 'test': TestCommand,
+ 'test_urls' : TestURLFetch,
+@@ -361,5 +383,5 @@ setup(
+ 'refresh_translations': refresh_translations,
+
+ 'build': mybuild,
+- }
++ },
+ )
More information about the scm-commits
mailing list