Make RPM build work

And wire up man page creation
This commit is contained in:
Cole Robinson 2013-03-17 19:32:19 -04:00
parent 7d29a4b18a
commit 3c251d3d8b
8 changed files with 150 additions and 88 deletions

9
.gitignore vendored
View File

@ -2,11 +2,14 @@
*.pyc
*.gmo
/.coverage
/MANIFEST
/virt-manager
/virt-manager-tui
/man/virt-manager.1
/man/virt-install.1
/man/virt-clone.1
/man/virt-image.1
/man/virt-convert.1
/man/virt-image.5
/virtcli/cli.cfg

View File

@ -1,5 +1,5 @@
virt-manager.py
virt-manager-tui.py
virt-manager
virt-manager-tui
data/virt-manager.desktop.in

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-03 18:14-0400\n"
"POT-Creation-Date: 2013-04-03 18:16-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../virt-manager.py:53
#: ../virt-manager:53
msgid "Error starting Virtual Machine Manager"
msgstr ""

View File

@ -33,20 +33,55 @@ class my_build(build_extra):
Compile .pod file
"""
def run(self):
cmds = ["virt-manager"]
def _make_bin_wrappers(self):
cmds = ["virt-manager", "virt-install", "virt-clone",
"virt-image", "virt-convert"]
if cliconfig.with_tui:
cmds += ["virt-manager-tui"]
if not os.path.exists("build"):
os.mkdir("build")
for app in cmds:
sharepath = os.path.join(cliconfig.asset_dir, app + ".py")
sharepath = os.path.join(cliconfig.asset_dir, app)
wrapper = "#!/bin/sh\n\n"
wrapper += "exec python \"%s\" \"$@\"" % (sharepath)
file(app, "w").write(wrapper)
wrapper += "exec \"%s\" \"$@\"" % (sharepath)
newpath = os.path.abspath(os.path.join("build", app))
print "Generating %s" % newpath
file(newpath, "w").write(wrapper)
def _make_man_pages(self):
for path in glob.glob("man/*.pod"):
base = os.path.basename(path)
mantype = "1"
newbase = base
if base == "virt-image-xml.pod":
mantype = "5"
newbase = "virt-image.pod"
newpath = os.path.join(os.path.dirname(path),
os.path.splitext(newbase)[0] + "." + mantype)
print "Generating %s" % newpath
ret = os.system('pod2man --release="" '
'--center "Virtual Machine Manager" '
'< %s > %s' % (path, newpath))
if ret != 0:
raise RuntimeError("Generating '%s' failed." % newpath)
if os.system("grep -IRq 'Hey!' man/") == 0:
raise RuntimeError("man pages have errors in them! "
"(grep for 'Hey!')")
def run(self):
self._make_bin_wrappers()
self._make_man_pages()
os.system('pod2man --release="" --center="Virtual Machine Manager" '
'< ./man/virt-manager.pod > ./man/virt-manager.1')
build_extra.run(self)
@ -161,7 +196,7 @@ class configure(Command):
tui_files = [
("share/virt-manager/", ["virt-manager-tui.py"]),
("share/virt-manager/", ["virt-manager-tui"]),
("share/virt-manager/virtManagerTui",
glob.glob("virtManagerTui/*.py")),
@ -299,21 +334,46 @@ class TestURLFetch(TestBaseCommand):
setup(
name = "virt-manager",
version = cliconfig.__version__,
# XXX: proper version, description, long_description, author, author_email
author = "Cole Robinson",
author_email = "virt-tools-list@redhat.com",
url = "http://virt-manager.org",
license = "GPLv2+",
scripts = (["virt-manager"] +
(cliconfig.with_tui and ["virt-manager-tui"] or [])),
# These wrappers are generated in our custom build command
scripts = ([
"build/virt-manager",
"build/virt-clone",
"build/virt-install",
"build/virt-image",
"build/virt-convert"] +
(cliconfig.with_tui and ["build/virt-manager-tui"] or [])),
data_files = [
("share/virt-manager/", ["virt-manager.py"]),
("share/virt-manager/", [
"virt-manager",
"virt-install",
"virt-clone",
"virt-image",
"virt-convert",
]),
("/etc/gconf/schemas", ["data/virt-manager.schemas"]),
("share/virt-manager/ui", glob.glob("ui/*.ui")),
("share/man/man1", ["man/virt-manager.1"]),
("share/man/man1", [
"man/virt-manager.1",
"man/virt-install.1",
"man/virt-clone.1",
"man/virt-image.1",
"man/virt-convert.1"
]),
("share/man/man5", ["man/virt-image.5"]),
("share/virt-manager/virtManager", glob.glob("virtManager/*.py")),
("share/virt-manager/virtinst", glob.glob("virtinst/*.py")),
("share/virt-manager/virtconv", glob.glob("virtconv/*.py")),
("share/virt-manager/virtconv/parsers",
glob.glob("virtconv/parsers/*.py")),
] + tui_files,
cmdclass = {

View File

@ -259,8 +259,6 @@ def main():
logging.debug("virt-manager version: %s", cliconfig.__version__)
logging.debug("virtManager import: %s", str(virtManager))
cliutils.check_virtinst_version()
if options.tracelibvirt:
logging.debug("Libvirt tracing requested")
import virtManager.module_trace

View File

@ -55,8 +55,6 @@ def main():
import virtManager
logging.debug("Launched as: %s", " ".join(sys.argv[:]))
cliutils.check_virtinst_version()
import virtManager.guidiff
virtManager.guidiff.is_gui(False)

View File

@ -2,7 +2,6 @@
%define _version 0.9.4
%define _release 1
%define virtinst_version 0.600.4
%define qemu_user ""
%define preferred_distros ""
@ -12,7 +11,7 @@
%define disable_unsupported_rhel 0
%define with_guestfs 0
%define with_tui 0
%define with_tui 1
%define with_spice 0
@ -71,6 +70,7 @@ Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: pygobject3
Requires: gtk3
Requires: cairo-gobject
@ -95,8 +95,6 @@ Requires: libgnome-keyring
Requires: gnome-python2-gnomekeyring >= 2.15.4
# Minimum we've tested with
Requires: libxml2-python >= 2.6.23
# Absolutely require this version or later
Requires: python-virtinst >= %{virtinst_version}
# Earlier vte had broken python binding module
Requires: vte >= 0.12.2
# For console widget
@ -117,6 +115,8 @@ Requires: virt-manager-common = %{verrel}
%endif
BuildRequires: gettext
BuildRequires: python
BuildRequires: python-distutils-extra
BuildRequires: intltool
BuildRequires: GConf2
BuildRequires: /usr/bin/pod2man
@ -134,18 +134,6 @@ connect to a graphical or serial console, and see resource usage statistics
for existing VMs on local or remote machines. Uses libvirt as the backend
management API.
# TUI package setup
%if %{with_tui}
%package tui
Summary: Virtual Machine Manager text user interface
Group: Applications/Emulators
Requires: virt-manager-common = %{verrel}
Requires: python-newt_syrup >= 0.1.2
Requires: libuser-python
%description tui
An interactive text user interface for Virtual Machine Manager.
%package common
Summary: Common files used by the different Virtual Machine Manager interfaces
@ -154,17 +142,47 @@ Group: Applications/Emulators
# This version not strictly required: virt-manager should work with older,
# however varying amounts of functionality will not be enabled.
Requires: libvirt-python >= 0.7.0
Requires: dbus-python
# Minimum we've tested with
Requires: libxml2-python >= 2.6.23
# Absolutely require this version or later
Requires: python-virtinst >= %{virtinst_version}
Requires: python-IPy
Requires: libxml2-python
Requires: python-urlgrabber
%description common
Common files used by the different Virtual Machine Manager interfaces.
Common files used by the different virt-manager interfaces, as well as
virt-install related tools.
%package -n virt-install
Summary: Utilities for installing virtual machines
Requires: virt-manager-common = %{verrel}
Provides: virt-install
Provides: virt-clone
Provides: virt-image
Provides: virt-convert
Obsoletes: python-virtinst
%description -n virt-install
Package includes several command line utilities, including virt-install
(build and install new VMs) and virt-clone (clone an existing virtual
machine).
%if %{with_tui}
%package tui
Summary: Virtual Machine Manager text user interface
Group: Applications/Emulators
Requires: virt-manager-common = %{verrel}
Requires: python-newt_syrup >= 0.1.2
Requires: libuser-python
Requires: python-IPy
%description tui
An interactive text user interface for Virtual Machine Manager.
%endif
%prep
%setup -q
@ -250,11 +268,7 @@ update-desktop-database -q %{_datadir}/applications
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%if %{with_tui}
%files
%else
%files -f %{name}.lang
%endif
%defattr(-,root,root,-)
%doc README COPYING AUTHORS NEWS
%{_sysconfdir}/gconf/schemas/%{name}.schemas
@ -262,14 +276,8 @@ update-desktop-database -q %{_datadir}/applications
%{_mandir}/man1/%{name}.1*
%if %{with_tui} == 0
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/virtManager/
%{_datadir}/%{name}/virtManager/*.py*
%endif
%{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/%{name}.py*
%{_datadir}/%{name}/%{name}
%{_datadir}/%{name}/icons
%{_datadir}/icons/hicolor/*/apps/*
@ -277,23 +285,44 @@ update-desktop-database -q %{_datadir}/applications
%{_datadir}/applications/%{name}.desktop
%if %{with_tui}
%files common -f %{name}.lang
%defattr(-,root,root,-)
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/virtManager/
%{_datadir}/%{name}/virtManager/*.py*
%{_datadir}/%{name}/virtconv
%{_datadir}/%{name}/virtinst
%{_datadir}/%{name}/virtManager
%files -n virt-install
%{_mandir}/man1/virt-install.1*
%{_mandir}/man1/virt-clone.1*
%{_mandir}/man1/virt-convert.1*
%{_mandir}/man1/virt-image.1*
%{_mandir}/man5/virt-image.5*
%{_datadir}/%{name}/virt-install
%{_datadir}/%{name}/virt-clone
%{_datadir}/%{name}/virt-image
%{_datadir}/%{name}/virt-convert
%{_bindir}/virt-install
%{_bindir}/virt-clone
%{_bindir}/virt-image
%{_bindir}/virt-convert
%if %{with_tui}
%files tui
%defattr(-,root,root,-)
%{_bindir}/%{name}-tui
%{_datadir}/%{name}/%{name}-tui.py*
%{_datadir}/%{name}/%{name}-tui
%{_datadir}/%{name}/virtManagerTui
%endif
%changelog
* Mon Apr 01 2013 Cole Robinson <crobinso@redhat.com> - 0.9.5-1
- virt-manager release 0.9.5

View File

@ -97,29 +97,3 @@ def setup_i18n():
gettext.install("virt-manager", cliconfig.gettext_dir)
gettext.bindtextdomain("virt-manager", cliconfig.gettext_dir)
def check_virtinst_version():
# Make sure we have a sufficiently new virtinst version, since we are
# very closely tied to the lib
virtinst_str = "0.600.3"
virtinst_version = tuple([int(num) for num in virtinst_str.split('.')])
msg = ("virt-manager requires the python-virtinst library version " +
virtinst_str + " or greater. This can be downloaded at:"
"\n\nhttp://virt-manager.org/download.html")
try:
import virtinst
ignore = virtinst.__version__
ignore = virtinst.__version_info__
except Exception, e:
logging.exception("Error import virtinst")
raise RuntimeError(str(e) + "\n\n" + msg)
if virtinst.__version_info__ < virtinst_version:
raise RuntimeError("virtinst version %s is too old." %
(virtinst.__version__) +
"\n\n" + msg)
logging.debug("virtinst version: %s", str(virtinst_str))
logging.debug("virtinst import: %s", str(virtinst))