[virt-tools-list] [PATCH 5/5] v5.1: virt-manager version changes

Gene Czarcinski gene at czarc.net
Mon Apr 8 18:58:28 UTC 2013


The current situation where a fixed value only is used
for the version of the virt-manager tarball is not
acceptable if for no other reason than it does not
reflect just what is in the tarball.

This update changes the virt-manager version id and
introduces an *external* version id used for the sdist tarball
and an *internal* version id which is displayed by
./virt-manager --version

The external version id is based on either cliconfig.__version__
or the result of git-describe--tags.  If the version
includes the prefix "RELEASE-", it it deleted.  If the version
includes any suffix it is deleted but noted that it is
present.  If there is a suffix or git-describe returns values for the number of
commits and current commit id, then the external version id
includes '.gityyyymmdd' as a suffix (e.g., git20130403).

The internal version id adds information from git-describe
to the external version id.

Optionally, either the fixed version id of gconfig.__version__
or a version id based on the tag portion of git-describe
is used.  This is specified as 'tag' or 'fixed' for
__vertype__ in virtcli/version.py.

get_version_1() returns the external-version-id and
get_version_2() returns the internal-version-id.

If the versioning code is run in the git-clone repository,
the the version ids are initializated.  If not, then
version.__version_1__ [external] and version__version_2__
[internal] are used.  These were created the last time
sdist was run and are stored in virtcli/version.py.

There are provisions for autobuild so that when autobuild.sh
is run, AUTOBUILD_OVERRIDE_VERSION=y causes the suffix to
be ignored so that the autobuild naming is in effect.

Note: Providsions to support autobuild.sh are included but
autobuild.sh is not updated.  This is/should/be addressed
by a separate patch.

Note: sdist calls cliconfig.check_git() to verify that
there are no uncommitted changes.  If, and only if running
this is a git repository, a check is made for uncommitted
changes and execution is aborted such changes exist.

An alternate implementation would allow execution to continue
but add ".dirty" to the version-id as an indicator
that uncommitted changes existed.

The virt-manager.spec file has been deleted and a
virt-manager.spec.in file added so that @VERSION@ can be
replaced with the external-version-id.

Update .gitignore for new, non-managed files virtcli/version.pl
and virt-manager.spec
.
Signed-off-by: Gene Czarcinski <gene at czarc.net>
---
 .gitignore           |   3 +
 setup.py             |  21 +-
 virt-manager         |   6 +-
 virt-manager-tui     |   2 +-
 virt-manager.spec    | 612 ---------------------------------------------------
 virt-manager.spec.in | 612 +++++++++++++++++++++++++++++++++++++++++++++++++++
 virtcli/cliconfig.py | 120 +++++++++-
 virtinst/cli.py      |   2 +-
 8 files changed, 757 insertions(+), 621 deletions(-)
 delete mode 100644 virt-manager.spec
 create mode 100644 virt-manager.spec.in

diff --git a/.gitignore b/.gitignore
index e65afd5..8900707 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 *.gmo
 
 /.coverage
+/dist
 /MANIFEST
 
 /man/virt-manager.1
@@ -12,4 +13,6 @@
 /man/virt-convert.1
 /man/virt-image.5
 
+/virt-manager.spec
 /virtcli/cli.cfg
+/virtcli/version.py
diff --git a/setup.py b/setup.py
index 3a51e22..8b17d3b 100644
--- a/setup.py
+++ b/setup.py
@@ -7,6 +7,7 @@ import sys
 import unittest
 
 from distutils.core import Command, setup
+from distutils.command.sdist import sdist
 from distutils.command.install_egg_info import install_egg_info
 
 from DistUtilsExtra.auto import sdist_auto
@@ -171,6 +172,20 @@ class my_egg_info(install_egg_info):
 # Custom commands #
 ###################
 
+class my_sdist(sdist_auto, sdist):
+    user_option = []
+
+    def run(self):
+        ver = cliconfig.get_version_1()
+        cliconfig.check_git()
+        f1 = open('virt-manager.spec.in', 'r')
+        f2 = open('virt-manager.spec', 'w')
+        for line in f1:
+            f2.write(line.replace('@VERSION@', ver))
+        f1.close()
+        f2.close()
+        sdist.run(self)
+
 class my_rpm(Command):
     user_options = []
     description = "Build a non-binary rpm."
@@ -186,7 +201,7 @@ class my_rpm(Command):
         """
         self.run_command('sdist')
         os.system('rpmbuild -ta dist/virt-manager-%s.tar.gz' %
-                  cliconfig.__version__)
+                  cliconfig.get_version_1())
 
 
 class configure(Command):
@@ -380,7 +395,7 @@ class TestURLFetch(TestBaseCommand):
 
 setup(
     name = "virt-manager",
-    version = cliconfig.__version__,
+    version = cliconfig.get_version_1(),
     author = "Cole Robinson",
     author_email = "virt-tools-list at redhat.com",
     url = "http://virt-manager.org",
@@ -428,7 +443,7 @@ setup(
         'build': my_build,
         'build_i18n': my_build_i18n,
         'build_icons': my_build_icons,
-        'sdist': sdist_auto,
+        'sdist': my_sdist,
         'install_egg_info': my_egg_info,
 
         'configure': configure,
diff --git a/virt-manager b/virt-manager
index 0b8d58b..bff59fd 100755
--- a/virt-manager
+++ b/virt-manager
@@ -84,7 +84,7 @@ def drop_stdio():
     os.dup2(0, 2)
 
 def parse_commandline():
-    optParser = optparse.OptionParser(version=cliconfig.__version__,
+    optParser = optparse.OptionParser(version=cliconfig.get_version_2(),
                                       usage="virt-manager [options]")
     optParser.set_defaults(uuid=None)
     optParser.epilog = ("Also accepts standard GTK arguments like "
@@ -256,7 +256,7 @@ def main():
                   Gtk.get_major_version(),
                   Gtk.get_minor_version(),
                   Gtk.get_micro_version())
-    logging.debug("virt-manager version: %s", cliconfig.__version__)
+    logging.debug("virt-manager version: %s", cliconfig.get_version_2())
     logging.debug("virtManager import: %s", str(virtManager))
 
     if options.tracelibvirt:
@@ -276,7 +276,7 @@ def main():
     import virtManager.config
     import virtManager.util
     config = virtManager.config.vmmConfig("virt-manager",
-                                    cliconfig.__version__,
+                                    cliconfig.get_version_2(),
                                     os.path.join(cliconfig.asset_dir, "ui"),
                                     options.testfirstrun)
     virtManager.util.running_config = config
diff --git a/virt-manager-tui b/virt-manager-tui
index c2b321c..958552d 100755
--- a/virt-manager-tui
+++ b/virt-manager-tui
@@ -31,7 +31,7 @@ from virtcli import cliutils, cliconfig
 
 
 def parse_commandline():
-    optParser = optparse.OptionParser(version=cliconfig.__version__)
+    optParser = optparse.OptionParser(version=cliconfig.get_version_2())
 
     optParser.add_option("-c", "--connect", dest="uri",
         help="Connect to hypervisor at URI", metavar="URI")
diff --git a/virt-manager.spec b/virt-manager.spec
deleted file mode 100644
index 841172c..0000000
--- a/virt-manager.spec
+++ /dev/null
@@ -1,612 +0,0 @@
-# -*- rpm-spec -*-
-
-%define _version 0.9.4
-%define _release 1
-
-%define qemu_user                  ""
-%define preferred_distros          ""
-%define kvm_packages               ""
-%define libvirt_packages           ""
-%define askpass_package            ""
-%define disable_unsupported_rhel   0
-
-%define with_guestfs               0
-%define with_tui                   1
-
-%define with_spice                 0
-
-# End local config
-# Default option handling
-
-%if %{with_spice}
-%define default_graphics "spice"
-%endif
-
-
-# Compat for use of spec in multiple distros
-
-%if 0%{?gconf_schema_prepare} == 0
-%define gconf_schema_prepare() \
-if [ "$1" -gt 1 ]; then \
-    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
-    gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
-fi \
-%{nil}
-%endif
-
-%if 0%{?gconf_schema_upgrade} == 0
-%define gconf_schema_upgrade() \
-export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
-gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
-%{nil}
-%endif
-
-%if 0%{?gconf_schema_remove} == 0
-%define gconf_schema_remove() \
-if [ "$1" -eq 0 ]; then \
-    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
-    gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
-fi \
-%{nil}
-%endif
-
-
-# This macro is used for the continuous automated builds. It just
-# allows an extra fragment based on the timestamp to be appended
-# to the release. This distinguishes automated builds, from formal
-# Fedora RPM builds
-%define _extra_release %{?dist:%{dist}}%{?extra_release:%{extra_release}}
-
-Name: virt-manager
-Version: %{_version}
-Release: %{_release}%{_extra_release}
-%define verrel %{version}-%{release}
-
-Summary: Virtual Machine Manager
-Group: Applications/Emulators
-License: GPLv2+
-URL: http://virt-manager.org/
-Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-
-Requires: pygobject3
-Requires: gtk3
-Requires: cairo-gobject
-Requires: libvirt-glib
-Requires: gnome-python2-gconf >= 1.99.11-7
-# 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
-# Definitely does not work with earlier due to python API changes
-Requires: dbus-python >= 0.61
-Requires: dbus-x11
-%if 0%{?rhel} > 6
-# Might work with earlier, but this is what we've tested
-Requires: gnome-keyring >= 0.4.9
-%else
-Requires: libgnome-keyring
-%endif
-# Minimum we've tested with
-# Although if you don't have this, comment it out and the app
-# will work just fine - keyring functionality will simply be
-# disabled
-Requires: gnome-python2-gnomekeyring >= 2.15.4
-# Minimum we've tested with
-Requires: libxml2-python >= 2.6.23
-# Earlier vte had broken python binding module
-Requires: vte >= 0.12.2
-# For console widget
-Requires: gtk-vnc2
-%if %{with_spice}
-Requires: spice-gtk3
-%endif
-%if %{with_guestfs}
-Requires: python-libguestfs
-%endif
-Requires: python-ipaddr
-
-%if %{with_tui} == 0
-Obsoletes: virt-manager-common <= %{verrel}
-Conflicts: virt-manager-common > %{verrel}
-%else
-Requires: virt-manager-common = %{verrel}
-%endif
-
-BuildRequires: gettext
-BuildRequires: python
-BuildRequires: python-distutils-extra
-BuildRequires: intltool
-BuildRequires: GConf2
-BuildRequires: /usr/bin/pod2man
-
-Requires(pre): GConf2
-Requires(post): GConf2
-Requires(preun): GConf2
-Requires(post): desktop-file-utils
-Requires(postun): desktop-file-utils
-
-%description
-Virtual Machine Manager provides a graphical tool for administering virtual
-machines for KVM, Xen, and QEmu. Start, stop, add or remove virtual devices,
-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.
-
-
-%package common
-Summary: Common files used by the different Virtual Machine Manager interfaces
-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: libxml2-python
-Requires: python-urlgrabber
-
-%description common
-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-ipaddr
-
-%description tui
-An interactive text user interface for Virtual Machine Manager.
-%endif
-
-
-
-%prep
-%setup -q
-
-%build
-%if %{qemu_user}
-%define _qemu_user --qemu-user=%{qemu_user}
-%endif
-
-%if %{kvm_packages}
-%define _kvm_packages --kvm-package-names=%{kvm_packages}
-%endif
-
-%if %{preferred_distros}
-%define _preferred_distros --preferred-distros=%{preferred_distros}
-%endif
-
-%if %{libvirt_packages}
-%define _libvirt_packages --libvirt-package-names=%{libvirt_packages}
-%endif
-
-%if %{askpass_package}
-%define _askpass_package --askpass-package-names=%{askpass_package}
-%endif
-
-%if %{disable_unsupported_rhel}
-%define _disable_unsupported_rhel --hide-unsupported-rhel-options
-%endif
-
-%if 0%{?default_graphics:1}
-%define _default_graphics --default-graphics=%{default_graphics}
-%endif
-
-%if ! %{with_tui}
-%define _tui_opt --without-tui
-%endif
-
-
-python setup.py configure \
-    %{?_tui_opt} \
-    %{?_qemu_user} \
-    %{?_kvm_packages} \
-    %{?_libvirt_packages} \
-    %{?_askpass_package} \
-    %{?_preferred_distros} \
-    %{?_disable_unsupported_rhel} \
-    %{?_default_graphics}
-
-
-%install
-rm -rf $RPM_BUILD_ROOT
-python setup.py install -O1 --root=$RPM_BUILD_ROOT
-
-%find_lang %{name}
-
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
-%pre
-%gconf_schema_prepare %{name}
-
-
-%post
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-update-desktop-database -q %{_datadir}/applications
-%gconf_schema_upgrade %{name}
-
-
-%postun
-if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-fi
-update-desktop-database -q %{_datadir}/applications
-
-
-%preun
-%gconf_schema_remove %{name}
-
-
-%posttrans
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-
-
-%files
-%defattr(-,root,root,-)
-%doc README COPYING AUTHORS NEWS
-%{_sysconfdir}/gconf/schemas/%{name}.schemas
-%{_bindir}/%{name}
-
-%{_mandir}/man1/%{name}.1*
-
-%{_datadir}/%{name}/ui/*.ui
-%{_datadir}/%{name}/virtcli/*
-%{_datadir}/%{name}/%{name}
-
-%{_datadir}/%{name}/icons
-%{_datadir}/icons/hicolor/*/apps/*
-
-%{_datadir}/applications/%{name}.desktop
-
-
-%files common -f %{name}.lang
-%defattr(-,root,root,-)
-%dir %{_datadir}/%{name}
-
-%{_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
-
-%{_datadir}/%{name}/virtManagerTui
-%endif
-
-
-%changelog
-* Mon Apr 01 2013 Cole Robinson <crobinso at redhat.com> - 0.9.5-1
-- virt-manager release 0.9.5
-- Enable adding virtio-scsi disks (Chen Hanxiao)
-- Support security auto-relabel setting (Martin Kletzander)
-- Support disk iotune settings (David Shane Holden)
-- Support 'reset' as a reboot option (John Doyle)
-- Bug fixes and minor improvements
-
-* Sun Jul 29 2012 Cole Robinson <crobinso at redhat.com> - 0.9.4-1
-- virt-manager release 0.9.4
-- Fix VNC keygrab issues
-
-* Mon Jul 09 2012 Cole Robinson <crobinso at redhat.com> - 0.9.3-1
-- virt-manager release 0.9.3
-- Fix broken release tar.gz of version 0.9.2
-
-* Mon Jul 09 2012 Cole Robinson <crobinso at redhat.com> - 0.9.2-1
-- virt-manager release 0.9.2
-- Convert to gtkbuilder: UI can now be editted with modern glade tool
-- virt-manager no longer runs on RHEL5, but can manage a remote RHEL5
-  host
-- Option to configure spapr net and disk devices for pseries (Li Zhang)
-- Many bug fixes and improvements
-
-* Tue Jan 31 2012 Cole Robinson <crobinso at redhat.com> - 0.9.1-1
-- Support for adding usb redirection devices (Marc-André Lureau)
-- Option to switch usb controller to support usb2.0 (Marc-André Lureau)
-- Option to specify machine type for non-x86 guests (Li Zhang)
-- Support for filesystem device type and write policy (Deepak C Shetty)
-- Many bug fixes!
-
-* Tue Jul 26 2011 Cole Robinson <crobinso at redhat.com> - 0.9.0-1
-- Use a hiding toolbar for fullscreen mode
-- Use libguestfs to show guest packagelist and more (Richard W.M. Jones)
-- Basic 'New VM' wizard support for LXC guests
-- Remote serial console access (with latest libvirt)
-- Remote URL guest installs (with latest libvirt)
-- Add Hardware: Support <filesystem> devices
-- Add Hardware: Support <smartcard> devices (Marc-André Lureau)
-- Enable direct interface selection for qemu/kvm (Gerhard Stenzel)
-- Allow viewing and changing disk serial number
-
-* Thu Mar 24 2011 Cole Robinson <crobinso at redhat.com> - 0.8.7-1
-- Allow renaming an offline VM
-- Spice password support (Marc-André Lureau)
-- Allow editting NIC <virtualport> settings (Gerhard Stenzel)
-- Allow enabling/disabling individual CPU features
-- Allow easily changing graphics type between VNC and SPICE for existing
-  VM
-- Allow easily changing network source device for existing VM
-
-* Fri Jan 14 2011 Cole Robinson <crobinso at redhat.com> - 0.8.6-1
-- SPICE support (requires spice-gtk) (Marc-André Lureau)
-- Option to configure CPU model
-- Option to configure CPU topology
-- Save and migration cancellation (Wen Congyang)
-- Save and migration progress reporting
-- Option to enable bios boot menu
-- Option to configure direct kernel/initrd boot
-
-* Tue Aug 24 2010 Cole Robinson <crobinso at redhat.com> - 0.8.5-1
-- Improved save/restore support
-- Option to view and change disk cache mode
-- Configurable VNC keygrab sequence (Michal Novotny)
-
-* Wed Mar 24 2010 Cole Robinson <crobinso at redhat.com> - 0.8.4-1
-- 'Import' install option, to create a VM around an existing OS image
-- Support multiple boot devices and boot order
-- Watchdog device support
-- Enable setting a human readable VM description.
-- Option to manually specifying a bridge name, if bridge isn't detected
-
-* Mon Feb  8 2010 Cole Robinson <crobinso at redhat.com> - 0.8.3-1
-- Manage network interfaces: start, stop, view, provision bridges, bonds, etc.
-- Option to 'customize VM before install'.
-
-* Mon Dec 14 2009 Cole Robinson <crobinso at redhat.com> - 0.8.2-1
-- Fix right click in the manager window to operate on the clicked row
-- Running on a new machine / user account no longer produces a traceback.
-- Allow ejecting and connecting floppy media
-
-* Thu Dec  3 2009 Cole Robinson <crobinso at redhat.com> - 0.8.1-1
-- VM Migration wizard, exposing various migration options
-- Enumerate CDROM and bridge devices on remote connections
-- Support storage pool source enumeration for LVM, NFS, and SCSI
-
-* Tue Jul 28 2009 Cole Robinson <crobinso at redhat.com> - 0.8.0-1
-- New 'Clone VM' Wizard
-- Improved UI, including an overhaul of the main 'manager' view
-- System tray icon for easy VM access (start, stop, view console/details)
-- Wizard for adding serial, parallel, and video devices to existing VMs.
-
-* Mon Mar  9 2009 Cole Robinson <crobinso at redhat.com> - 0.7.0-1
-- Redesigned 'New Virtual Machine' wizard (Jeremy Perry, Cole Robinson)
-- Option to remove storage when deleting a virtual machine.
-- File browser for libvirt storage pools and volumes
-- Physical device assignment (PCI, USB) for existing virtual machines.
-
-* Mon Jan 26 2009 Cole Robinson <crobinso at redhat.com> - 0.6.1-1
-- VM disk and network stats reporting (Guido Gunther)
-- VM Migration support (Shigeki Sakamoto)
-- Support for adding sound devices to an existing VM
-- Enumerate host devices attached to an existing VM
-
-* Wed Sep 10 2008 Cole Robinson <crobinso at redhat.com> - 0.6.0-1
-- Add libvirt storage management support
-- Basic support for remote guest installation
-- Merge VM console and details windows
-- Poll avahi for libvirtd advertisement
-- Hypervisor autoconnect option
-- Add sound emulation when creating new guests
-
-* Mon Mar 10 2008 Daniel P Berrange <berrange at redhat.com> - 0.5.4-1
-- Use capabilities XML when creating guests
-- Allow scaling of VNC window
-
-* Thu Jan 10 2008 Daniel P Berrange <berrange at redhat.com> - 0.5.3-1
-- Reintroduce 'new' button
-- Make restore work again
-- Add menu for sending special keys
-- Fix license headers on all source
-- Lots of misc bug fixes
-
-* Thu Oct  4 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.2-1
-- No scrollbars for high res guest in low res host (rhbz 273181)
-- Unable to remove network device (rhbz 242900)
-- Fixed broken menu items (rhbz 307551)
-- Allow adding of graphics console (rhbz 215524)
-
-* Tue Sep 25 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.1-1
-- Open connections in background
-- Make VNC connection retries more robust
-- Allow changing of CDROM media on the fly
-- Add PXE boot installation of HVM guests
-- Allow tunnelling VNC over SSH
-
-* Wed Aug 29 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.0-1
-- Support for managing remote hosts
-- Switch to use GTK-VNC for the guest console
-
-* Mon Apr 16 2007 Daniel P. Berrange <berrange at redhat.com> - 0.4.0-1
-- Support for managing virtual networks
-- Ability to attach guest to virtual networks
-- Automatically set VNC keymap based on local keymap
-- Support for disk & network device addition/removal
-
-* Tue Mar 20 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.2-1
-- Added online help to all windows
-- Bug fixes to virtual console popup, key grab & accelerator override
-
-* Tue Feb 20 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.1-1
-- Added support for managing QEMU domains
-- Automatically grab mouse pointer to workaround dual-cursor crazyness
-
-* Mon Jan 22 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.0-1
-- Added support for managing inactive domains
-- Require virt-inst >= 0.100.0 and libvirt >= 0.1.11 for ianctive
-  domain management capabilities
-- Add progress bars during VM creation stage
-- Improved reliability of VNC console
-- Updated translations again
-- Added destroy option to menu bar to forceably kill a guest
-- Visually differentiate allocated memory, from actual used memory on host
-- Validate file magic when restoring a guest from a savd file
-- Performance work on domain listing
-- Allow creation of non-sparse files
-- Fix backspace key in serial console
-
-* Thu Nov  9 2006 Daniel P. Berrange <berrange at redhat.com> - 0.2.6-1
-- Imported translations from Fedora i18n repository
-- Make (most) scrollbar policies automatic
-- Set busy cursor while creating new VMs
-- Preference for controlling keygrab policy
-- Preference for when to automatically open console (bz 211385)
-- Re-try VNC connection attempt periodically in case VNC daemon
-  hasn't finished starting up
-- Added activation of URLs for about dialog (bz 210782)
-- Improved error reporting when connecting to HV (bz 211229)
-- Add command line args to open specific windows
-- Don't skip para/full virt wizard step - instead gray out full
-  virt option & tell user why
-- Change 'physical' to 'logical' when refering to host CPUs
-- Include hostname in titlebar
-- Disable wizard sensitivity while creating VM
-
-* Thu Oct 19 2006 Daniel P. Berrange <berrange at redhat.com> - 0.2.5-1
-- Switch to use python-virtinst instead of python-xeninst due to
-  renaming of original package
-- Disable keyboard accelerators when grabbing mouse to avoid things like
-  Ctrl-W closing the local window, instead of remote window bz 210364
-- Fix host memory reporting bz 211281
-- Remove duplicate application menu entry bz 211230
-
-* Thu Oct 12 2006 Daniel Berrange <berrange at redhat.com> - 0.2.4-1
-- Fix duplicated mnemonics (bz 208408)
-- Use blktap backed disks if available
-- Use a drop down list to remember past URLs (bz 209479)
-- Remove unused help button from preferences dialog (bz 209251)
-- Fix exception when no VNC graphics is defined
-- Force immediate refresh of VMs after creating a new one
-- Improve error reporting if run on a kernel without Xen (bz 209122)
-- Clamp CPU utilization between 0 & 100 pcent (bz 208185)
-- Fix array underflow SEGV when no data points available (bz 208185)
-- More fixes to avoid stuck modifier keys on focus-out (bz 207949)
-
-* Tue Sep 26 2006 Daniel Berrange <berrange at redhat.com> - 0.2.3-1
-- Require xeninst >= 0.93.0 to fix block backed devices
-- Skip para/fully-virt step when going back in wizard if not HVM host (bz 207409)
-- Fix handling of modifier keys in VNC console so Alt key doesn't get stuck (bz 207949)
-- Allow sticky modifier keys by pressing same key 3 times in row (enables Ctrl-Alt-F1
-  by doing Ctrl Ctrl Ctrl  Alt-F1)
-- Improved error handling during guest creation
-- Log errors with python logging, instead of to stdout
-- Remove unused buttons from main domain list window
-- Switch out of full screen & release key grab when closing console
-- Trim sparkline CPU history graph to 40 samples max
-- Constraint VCPU adjuster to only allow upto guest's max VCPU count
-- Show guest's max & current VCPU count in details page
-- Fix rounding of disk sizes to avoid a 1.9 GB disk being rounded down to 1 GB
-- Use raw block device path to CDROM not mount point for HVM guest (bz 206965)
-- Fix visibility of file size spin box (bz 206186 part 2)
-- Check for GTK failing to open X11 display (bz 205938)
-
-* Fri Sep 15 2006 Daniel Berrange <berrange at redhat.com> - 0.2.2-1
-- Fix event handling in create VM wizard (bz 206660 & 206186)
-- Fix close button in about dialog (bz 205943)
-- Refresh .pot files
-- Turn on VNC scrollbars fulltime to avoid GTK window sizing issue
-  which consistently resize too small.
-
-* Mon Sep 11 2006 Daniel Berrange <berrange at redhat.com> - 0.2.1-3
-- Added requires on pygtk2-libglade & librsvg2 (bz 205941 & 205942)
-- Re-arrange to use console-helper to launch app
-- Added 'dist' component to release number
-
-* Wed Sep  6 2006 Jeremy Katz <katzj at redhat.com> - 0.2.1-2
-- don't ghost pyo files (#205448)
-
-* Mon Sep  4 2006 Daniel Berrange <berrange at redhat.com> - 0.2.1-1
-- Updated to 0.2.1 tar.gz
-- Added rules to install/uninstall gconf schemas in preun,post,pre
-  scriptlets
-
-* Thu Aug 24 2006 Jeremy Katz <katzj at redhat.com> - 0.2.0-3
-- BR gettext
-
-* Thu Aug 24 2006 Jeremy Katz <katzj at redhat.com> - 0.2.0-2
-- only build on arches with virt
-
-* Tue Aug 22 2006 Daniel Berrange <berrange at redhat.com> - 0.2.0-1
-- Added wizard for creating virtual machines
-- Added embedded serial console
-- Added ability to take screenshots
-
-* Mon Jul 24 2006 Daniel Berrange <berrange at redhat.com> - 0.1.5-2
-- Prefix *.pyo files with 'ghost' macro
-- Use fully qualified URL in Source  tag
-
-* Thu Jul 20 2006 Daniel Berrange <berrange at redhat.com> - 0.1.5-1
-- Update to new 0.1.5 release snapshot
-
-* Thu Jul 20 2006 Daniel Berrange <berrange at redhat.com> - 0.1.4-1
-- Update to new 0.1.4 release snapshot
-
-* Mon Jul 17 2006 Daniel Berrange <berrange at redhat.com> - 0.1.3-1
-- Fix License tag
-- Updated for new release
-
-* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-3
-- Added missing copyright headers on all .py files
-
-* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-2
-- Added python-devel to BuildRequires
-
-* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-1
-- Change URL to public location
-
-* Fri Jun 16 2006 Daniel Berrange <berrange at redhat.com> - 0.1.0-1
-- Added initial support for using VNC console
-
-* Thu Apr 20 2006 Daniel Berrange <berrange at redhat.com> - 0.0.2-1
-- Added DBus remote control service
-
-* Wed Mar 29 2006 Daniel Berrange <berrange at redhat.com> - 0.0.1-1
-- Initial RPM build
diff --git a/virt-manager.spec.in b/virt-manager.spec.in
new file mode 100644
index 0000000..b0322a7
--- /dev/null
+++ b/virt-manager.spec.in
@@ -0,0 +1,612 @@
+# -*- rpm-spec -*-
+
+%define _version @VERSION@
+%define _release 1
+
+%define qemu_user                  ""
+%define preferred_distros          ""
+%define kvm_packages               ""
+%define libvirt_packages           ""
+%define askpass_package            ""
+%define disable_unsupported_rhel   0
+
+%define with_guestfs               0
+%define with_tui                   1
+
+%define with_spice                 0
+
+# End local config
+# Default option handling
+
+%if %{with_spice}
+%define default_graphics "spice"
+%endif
+
+
+# Compat for use of spec in multiple distros
+
+%if 0%{?gconf_schema_prepare} == 0
+%define gconf_schema_prepare() \
+if [ "$1" -gt 1 ]; then \
+    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
+    gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
+fi \
+%{nil}
+%endif
+
+%if 0%{?gconf_schema_upgrade} == 0
+%define gconf_schema_upgrade() \
+export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
+gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
+%{nil}
+%endif
+
+%if 0%{?gconf_schema_remove} == 0
+%define gconf_schema_remove() \
+if [ "$1" -eq 0 ]; then \
+    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
+    gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/%1.schemas > /dev/null || : \
+fi \
+%{nil}
+%endif
+
+
+# This macro is used for the continuous automated builds. It just
+# allows an extra fragment based on the timestamp to be appended
+# to the release. This distinguishes automated builds, from formal
+# Fedora RPM builds
+%define _extra_release %{?dist:%{dist}}%{?extra_release:%{extra_release}}
+
+Name: virt-manager
+Version: %{_version}
+Release: %{_release}%{_extra_release}
+%define verrel %{version}-%{release}
+
+Summary: Virtual Machine Manager
+Group: Applications/Emulators
+License: GPLv2+
+URL: http://virt-manager.org/
+Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+
+Requires: pygobject3
+Requires: gtk3
+Requires: cairo-gobject
+Requires: libvirt-glib
+Requires: gnome-python2-gconf >= 1.99.11-7
+# 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
+# Definitely does not work with earlier due to python API changes
+Requires: dbus-python >= 0.61
+Requires: dbus-x11
+%if 0%{?rhel} > 6
+# Might work with earlier, but this is what we've tested
+Requires: gnome-keyring >= 0.4.9
+%else
+Requires: libgnome-keyring
+%endif
+# Minimum we've tested with
+# Although if you don't have this, comment it out and the app
+# will work just fine - keyring functionality will simply be
+# disabled
+Requires: gnome-python2-gnomekeyring >= 2.15.4
+# Minimum we've tested with
+Requires: libxml2-python >= 2.6.23
+# Earlier vte had broken python binding module
+Requires: vte >= 0.12.2
+# For console widget
+Requires: gtk-vnc2
+%if %{with_spice}
+Requires: spice-gtk3
+%endif
+%if %{with_guestfs}
+Requires: python-libguestfs
+%endif
+Requires: python-ipaddr
+
+%if %{with_tui} == 0
+Obsoletes: virt-manager-common <= %{verrel}
+Conflicts: virt-manager-common > %{verrel}
+%else
+Requires: virt-manager-common = %{verrel}
+%endif
+
+BuildRequires: gettext
+BuildRequires: python
+BuildRequires: python-distutils-extra
+BuildRequires: intltool
+BuildRequires: GConf2
+BuildRequires: /usr/bin/pod2man
+
+Requires(pre): GConf2
+Requires(post): GConf2
+Requires(preun): GConf2
+Requires(post): desktop-file-utils
+Requires(postun): desktop-file-utils
+
+%description
+Virtual Machine Manager provides a graphical tool for administering virtual
+machines for KVM, Xen, and QEmu. Start, stop, add or remove virtual devices,
+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.
+
+
+%package common
+Summary: Common files used by the different Virtual Machine Manager interfaces
+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: libxml2-python
+Requires: python-urlgrabber
+
+%description common
+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-ipaddr
+
+%description tui
+An interactive text user interface for Virtual Machine Manager.
+%endif
+
+
+
+%prep
+%setup -q
+
+%build
+%if %{qemu_user}
+%define _qemu_user --qemu-user=%{qemu_user}
+%endif
+
+%if %{kvm_packages}
+%define _kvm_packages --kvm-package-names=%{kvm_packages}
+%endif
+
+%if %{preferred_distros}
+%define _preferred_distros --preferred-distros=%{preferred_distros}
+%endif
+
+%if %{libvirt_packages}
+%define _libvirt_packages --libvirt-package-names=%{libvirt_packages}
+%endif
+
+%if %{askpass_package}
+%define _askpass_package --askpass-package-names=%{askpass_package}
+%endif
+
+%if %{disable_unsupported_rhel}
+%define _disable_unsupported_rhel --hide-unsupported-rhel-options
+%endif
+
+%if 0%{?default_graphics:1}
+%define _default_graphics --default-graphics=%{default_graphics}
+%endif
+
+%if ! %{with_tui}
+%define _tui_opt --without-tui
+%endif
+
+
+python setup.py configure \
+    %{?_tui_opt} \
+    %{?_qemu_user} \
+    %{?_kvm_packages} \
+    %{?_libvirt_packages} \
+    %{?_askpass_package} \
+    %{?_preferred_distros} \
+    %{?_disable_unsupported_rhel} \
+    %{?_default_graphics}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+python setup.py install -O1 --root=$RPM_BUILD_ROOT
+
+%find_lang %{name}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%pre
+%gconf_schema_prepare %{name}
+
+
+%post
+/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
+update-desktop-database -q %{_datadir}/applications
+%gconf_schema_upgrade %{name}
+
+
+%postun
+if [ $1 -eq 0 ] ; then
+    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
+    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+fi
+update-desktop-database -q %{_datadir}/applications
+
+
+%preun
+%gconf_schema_remove %{name}
+
+
+%posttrans
+/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+
+
+%files
+%defattr(-,root,root,-)
+%doc README COPYING AUTHORS NEWS
+%{_sysconfdir}/gconf/schemas/%{name}.schemas
+%{_bindir}/%{name}
+
+%{_mandir}/man1/%{name}.1*
+
+%{_datadir}/%{name}/ui/*.ui
+%{_datadir}/%{name}/virtcli/*
+%{_datadir}/%{name}/%{name}
+
+%{_datadir}/%{name}/icons
+%{_datadir}/icons/hicolor/*/apps/*
+
+%{_datadir}/applications/%{name}.desktop
+
+
+%files common -f %{name}.lang
+%defattr(-,root,root,-)
+%dir %{_datadir}/%{name}
+
+%{_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
+
+%{_datadir}/%{name}/virtManagerTui
+%endif
+
+
+%changelog
+* Mon Apr 01 2013 Cole Robinson <crobinso at redhat.com> - 0.9.5-1
+- virt-manager release 0.9.5
+- Enable adding virtio-scsi disks (Chen Hanxiao)
+- Support security auto-relabel setting (Martin Kletzander)
+- Support disk iotune settings (David Shane Holden)
+- Support 'reset' as a reboot option (John Doyle)
+- Bug fixes and minor improvements
+
+* Sun Jul 29 2012 Cole Robinson <crobinso at redhat.com> - 0.9.4-1
+- virt-manager release 0.9.4
+- Fix VNC keygrab issues
+
+* Mon Jul 09 2012 Cole Robinson <crobinso at redhat.com> - 0.9.3-1
+- virt-manager release 0.9.3
+- Fix broken release tar.gz of version 0.9.2
+
+* Mon Jul 09 2012 Cole Robinson <crobinso at redhat.com> - 0.9.2-1
+- virt-manager release 0.9.2
+- Convert to gtkbuilder: UI can now be editted with modern glade tool
+- virt-manager no longer runs on RHEL5, but can manage a remote RHEL5
+  host
+- Option to configure spapr net and disk devices for pseries (Li Zhang)
+- Many bug fixes and improvements
+
+* Tue Jan 31 2012 Cole Robinson <crobinso at redhat.com> - 0.9.1-1
+- Support for adding usb redirection devices (Marc-André Lureau)
+- Option to switch usb controller to support usb2.0 (Marc-André Lureau)
+- Option to specify machine type for non-x86 guests (Li Zhang)
+- Support for filesystem device type and write policy (Deepak C Shetty)
+- Many bug fixes!
+
+* Tue Jul 26 2011 Cole Robinson <crobinso at redhat.com> - 0.9.0-1
+- Use a hiding toolbar for fullscreen mode
+- Use libguestfs to show guest packagelist and more (Richard W.M. Jones)
+- Basic 'New VM' wizard support for LXC guests
+- Remote serial console access (with latest libvirt)
+- Remote URL guest installs (with latest libvirt)
+- Add Hardware: Support <filesystem> devices
+- Add Hardware: Support <smartcard> devices (Marc-André Lureau)
+- Enable direct interface selection for qemu/kvm (Gerhard Stenzel)
+- Allow viewing and changing disk serial number
+
+* Thu Mar 24 2011 Cole Robinson <crobinso at redhat.com> - 0.8.7-1
+- Allow renaming an offline VM
+- Spice password support (Marc-André Lureau)
+- Allow editting NIC <virtualport> settings (Gerhard Stenzel)
+- Allow enabling/disabling individual CPU features
+- Allow easily changing graphics type between VNC and SPICE for existing
+  VM
+- Allow easily changing network source device for existing VM
+
+* Fri Jan 14 2011 Cole Robinson <crobinso at redhat.com> - 0.8.6-1
+- SPICE support (requires spice-gtk) (Marc-André Lureau)
+- Option to configure CPU model
+- Option to configure CPU topology
+- Save and migration cancellation (Wen Congyang)
+- Save and migration progress reporting
+- Option to enable bios boot menu
+- Option to configure direct kernel/initrd boot
+
+* Tue Aug 24 2010 Cole Robinson <crobinso at redhat.com> - 0.8.5-1
+- Improved save/restore support
+- Option to view and change disk cache mode
+- Configurable VNC keygrab sequence (Michal Novotny)
+
+* Wed Mar 24 2010 Cole Robinson <crobinso at redhat.com> - 0.8.4-1
+- 'Import' install option, to create a VM around an existing OS image
+- Support multiple boot devices and boot order
+- Watchdog device support
+- Enable setting a human readable VM description.
+- Option to manually specifying a bridge name, if bridge isn't detected
+
+* Mon Feb  8 2010 Cole Robinson <crobinso at redhat.com> - 0.8.3-1
+- Manage network interfaces: start, stop, view, provision bridges, bonds, etc.
+- Option to 'customize VM before install'.
+
+* Mon Dec 14 2009 Cole Robinson <crobinso at redhat.com> - 0.8.2-1
+- Fix right click in the manager window to operate on the clicked row
+- Running on a new machine / user account no longer produces a traceback.
+- Allow ejecting and connecting floppy media
+
+* Thu Dec  3 2009 Cole Robinson <crobinso at redhat.com> - 0.8.1-1
+- VM Migration wizard, exposing various migration options
+- Enumerate CDROM and bridge devices on remote connections
+- Support storage pool source enumeration for LVM, NFS, and SCSI
+
+* Tue Jul 28 2009 Cole Robinson <crobinso at redhat.com> - 0.8.0-1
+- New 'Clone VM' Wizard
+- Improved UI, including an overhaul of the main 'manager' view
+- System tray icon for easy VM access (start, stop, view console/details)
+- Wizard for adding serial, parallel, and video devices to existing VMs.
+
+* Mon Mar  9 2009 Cole Robinson <crobinso at redhat.com> - 0.7.0-1
+- Redesigned 'New Virtual Machine' wizard (Jeremy Perry, Cole Robinson)
+- Option to remove storage when deleting a virtual machine.
+- File browser for libvirt storage pools and volumes
+- Physical device assignment (PCI, USB) for existing virtual machines.
+
+* Mon Jan 26 2009 Cole Robinson <crobinso at redhat.com> - 0.6.1-1
+- VM disk and network stats reporting (Guido Gunther)
+- VM Migration support (Shigeki Sakamoto)
+- Support for adding sound devices to an existing VM
+- Enumerate host devices attached to an existing VM
+
+* Wed Sep 10 2008 Cole Robinson <crobinso at redhat.com> - 0.6.0-1
+- Add libvirt storage management support
+- Basic support for remote guest installation
+- Merge VM console and details windows
+- Poll avahi for libvirtd advertisement
+- Hypervisor autoconnect option
+- Add sound emulation when creating new guests
+
+* Mon Mar 10 2008 Daniel P Berrange <berrange at redhat.com> - 0.5.4-1
+- Use capabilities XML when creating guests
+- Allow scaling of VNC window
+
+* Thu Jan 10 2008 Daniel P Berrange <berrange at redhat.com> - 0.5.3-1
+- Reintroduce 'new' button
+- Make restore work again
+- Add menu for sending special keys
+- Fix license headers on all source
+- Lots of misc bug fixes
+
+* Thu Oct  4 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.2-1
+- No scrollbars for high res guest in low res host (rhbz 273181)
+- Unable to remove network device (rhbz 242900)
+- Fixed broken menu items (rhbz 307551)
+- Allow adding of graphics console (rhbz 215524)
+
+* Tue Sep 25 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.1-1
+- Open connections in background
+- Make VNC connection retries more robust
+- Allow changing of CDROM media on the fly
+- Add PXE boot installation of HVM guests
+- Allow tunnelling VNC over SSH
+
+* Wed Aug 29 2007 Daniel P. Berrange <berrange at redhat.com> - 0.5.0-1
+- Support for managing remote hosts
+- Switch to use GTK-VNC for the guest console
+
+* Mon Apr 16 2007 Daniel P. Berrange <berrange at redhat.com> - 0.4.0-1
+- Support for managing virtual networks
+- Ability to attach guest to virtual networks
+- Automatically set VNC keymap based on local keymap
+- Support for disk & network device addition/removal
+
+* Tue Mar 20 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.2-1
+- Added online help to all windows
+- Bug fixes to virtual console popup, key grab & accelerator override
+
+* Tue Feb 20 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.1-1
+- Added support for managing QEMU domains
+- Automatically grab mouse pointer to workaround dual-cursor crazyness
+
+* Mon Jan 22 2007 Daniel P. Berrange <berrange at redhat.com> - 0.3.0-1
+- Added support for managing inactive domains
+- Require virt-inst >= 0.100.0 and libvirt >= 0.1.11 for ianctive
+  domain management capabilities
+- Add progress bars during VM creation stage
+- Improved reliability of VNC console
+- Updated translations again
+- Added destroy option to menu bar to forceably kill a guest
+- Visually differentiate allocated memory, from actual used memory on host
+- Validate file magic when restoring a guest from a savd file
+- Performance work on domain listing
+- Allow creation of non-sparse files
+- Fix backspace key in serial console
+
+* Thu Nov  9 2006 Daniel P. Berrange <berrange at redhat.com> - 0.2.6-1
+- Imported translations from Fedora i18n repository
+- Make (most) scrollbar policies automatic
+- Set busy cursor while creating new VMs
+- Preference for controlling keygrab policy
+- Preference for when to automatically open console (bz 211385)
+- Re-try VNC connection attempt periodically in case VNC daemon
+  hasn't finished starting up
+- Added activation of URLs for about dialog (bz 210782)
+- Improved error reporting when connecting to HV (bz 211229)
+- Add command line args to open specific windows
+- Don't skip para/full virt wizard step - instead gray out full
+  virt option & tell user why
+- Change 'physical' to 'logical' when refering to host CPUs
+- Include hostname in titlebar
+- Disable wizard sensitivity while creating VM
+
+* Thu Oct 19 2006 Daniel P. Berrange <berrange at redhat.com> - 0.2.5-1
+- Switch to use python-virtinst instead of python-xeninst due to
+  renaming of original package
+- Disable keyboard accelerators when grabbing mouse to avoid things like
+  Ctrl-W closing the local window, instead of remote window bz 210364
+- Fix host memory reporting bz 211281
+- Remove duplicate application menu entry bz 211230
+
+* Thu Oct 12 2006 Daniel Berrange <berrange at redhat.com> - 0.2.4-1
+- Fix duplicated mnemonics (bz 208408)
+- Use blktap backed disks if available
+- Use a drop down list to remember past URLs (bz 209479)
+- Remove unused help button from preferences dialog (bz 209251)
+- Fix exception when no VNC graphics is defined
+- Force immediate refresh of VMs after creating a new one
+- Improve error reporting if run on a kernel without Xen (bz 209122)
+- Clamp CPU utilization between 0 & 100 pcent (bz 208185)
+- Fix array underflow SEGV when no data points available (bz 208185)
+- More fixes to avoid stuck modifier keys on focus-out (bz 207949)
+
+* Tue Sep 26 2006 Daniel Berrange <berrange at redhat.com> - 0.2.3-1
+- Require xeninst >= 0.93.0 to fix block backed devices
+- Skip para/fully-virt step when going back in wizard if not HVM host (bz 207409)
+- Fix handling of modifier keys in VNC console so Alt key doesn't get stuck (bz 207949)
+- Allow sticky modifier keys by pressing same key 3 times in row (enables Ctrl-Alt-F1
+  by doing Ctrl Ctrl Ctrl  Alt-F1)
+- Improved error handling during guest creation
+- Log errors with python logging, instead of to stdout
+- Remove unused buttons from main domain list window
+- Switch out of full screen & release key grab when closing console
+- Trim sparkline CPU history graph to 40 samples max
+- Constraint VCPU adjuster to only allow upto guest's max VCPU count
+- Show guest's max & current VCPU count in details page
+- Fix rounding of disk sizes to avoid a 1.9 GB disk being rounded down to 1 GB
+- Use raw block device path to CDROM not mount point for HVM guest (bz 206965)
+- Fix visibility of file size spin box (bz 206186 part 2)
+- Check for GTK failing to open X11 display (bz 205938)
+
+* Fri Sep 15 2006 Daniel Berrange <berrange at redhat.com> - 0.2.2-1
+- Fix event handling in create VM wizard (bz 206660 & 206186)
+- Fix close button in about dialog (bz 205943)
+- Refresh .pot files
+- Turn on VNC scrollbars fulltime to avoid GTK window sizing issue
+  which consistently resize too small.
+
+* Mon Sep 11 2006 Daniel Berrange <berrange at redhat.com> - 0.2.1-3
+- Added requires on pygtk2-libglade & librsvg2 (bz 205941 & 205942)
+- Re-arrange to use console-helper to launch app
+- Added 'dist' component to release number
+
+* Wed Sep  6 2006 Jeremy Katz <katzj at redhat.com> - 0.2.1-2
+- don't ghost pyo files (#205448)
+
+* Mon Sep  4 2006 Daniel Berrange <berrange at redhat.com> - 0.2.1-1
+- Updated to 0.2.1 tar.gz
+- Added rules to install/uninstall gconf schemas in preun,post,pre
+  scriptlets
+
+* Thu Aug 24 2006 Jeremy Katz <katzj at redhat.com> - 0.2.0-3
+- BR gettext
+
+* Thu Aug 24 2006 Jeremy Katz <katzj at redhat.com> - 0.2.0-2
+- only build on arches with virt
+
+* Tue Aug 22 2006 Daniel Berrange <berrange at redhat.com> - 0.2.0-1
+- Added wizard for creating virtual machines
+- Added embedded serial console
+- Added ability to take screenshots
+
+* Mon Jul 24 2006 Daniel Berrange <berrange at redhat.com> - 0.1.5-2
+- Prefix *.pyo files with 'ghost' macro
+- Use fully qualified URL in Source  tag
+
+* Thu Jul 20 2006 Daniel Berrange <berrange at redhat.com> - 0.1.5-1
+- Update to new 0.1.5 release snapshot
+
+* Thu Jul 20 2006 Daniel Berrange <berrange at redhat.com> - 0.1.4-1
+- Update to new 0.1.4 release snapshot
+
+* Mon Jul 17 2006 Daniel Berrange <berrange at redhat.com> - 0.1.3-1
+- Fix License tag
+- Updated for new release
+
+* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-3
+- Added missing copyright headers on all .py files
+
+* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-2
+- Added python-devel to BuildRequires
+
+* Wed Jun 28 2006 Daniel Berrange <berrange at redhat.com> - 0.1.2-1
+- Change URL to public location
+
+* Fri Jun 16 2006 Daniel Berrange <berrange at redhat.com> - 0.1.0-1
+- Added initial support for using VNC console
+
+* Thu Apr 20 2006 Daniel Berrange <berrange at redhat.com> - 0.0.2-1
+- Added DBus remote control service
+
+* Wed Mar 29 2006 Daniel Berrange <berrange at redhat.com> - 0.0.1-1
+- Initial RPM build
diff --git a/virtcli/cliconfig.py b/virtcli/cliconfig.py
index d4613ae..953c4eb 100644
--- a/virtcli/cliconfig.py
+++ b/virtcli/cliconfig.py
@@ -22,7 +22,9 @@ Configuration variables that can be set at build time
 """
 
 import ConfigParser
-import os
+import os, commands
+from datetime import date
+import time
 
 
 cfg = ConfigParser.ConfigParser()
@@ -41,7 +43,123 @@ def get_param(name, default):
     return cfg.get("config", name)
 
 __version__ = "0.9.4"
+__vertype__ = "tag"
 
+verpath = os.path.join(os.path.dirname(_filepath), "version.py")
+if not os.path.exists(verpath):
+    # create template if file does not exist
+    sav_version = "# template\n"
+    sav_version += '__version_init_flag__ = False\n'
+    sav_version += '__version_1__ = "%s"\n' % __version__
+    sav_version += '__version_2__ = "%s"\n' % __version__
+    sav_version += '# the following has the value of either "fixed" or "tag"\n'
+    sav_version += '__vertype__ = "%s"\n' % __vertype__
+    file(verpath, "w").write(sav_version)
+
+def _check_override():
+    try:
+        xx = os.environ['AUTOBUILD_OVERRIDE_VERSION']
+    except KeyError:
+        return False
+    if xx == 'y':
+        return True
+    return False
+
+def _check_for_git():
+    rc, gitcmd = commands.getstatusoutput('which git')
+    if rc != 0:
+        return False
+    if not os.path.exists(gitcmd) or not os.path.exists('.git'):
+        return False
+    return True
+
+def _create_snapshot_id():
+    id = date.today().isoformat().replace('-', '')
+    # alternatively, id could be based on epoch time
+    #import time
+    #id = str(int(time.time()))
+    return ".git" + id
+
+def _init_version():
+    from virtcli import version
+    rc, gitcmd = commands.getstatusoutput('which git')
+    if rc == 0:
+        if not os.path.exists(gitcmd) or not os.path.exists('.git'):
+            rc = 1
+    if rc == 1:
+        if not version.__version_init_flag__:
+            version.__version_1__ = __version__
+            version.__version_2__ = __version__
+            version.__version_init_flag__ = True
+        return
+    mrc, merged = commands.getstatusoutput(gitcmd + ' update-index --refresh --unmerged')
+    rc, v2 = commands.getstatusoutput(gitcmd + ' describe --tags')
+    vlist = v2.rsplit('-', 2)
+    vtag = vlist[0]
+    otag = ''
+    ltag = vtag.split('-',1)
+    if len(ltag) > 1 and ltag[0] == 'RELEASE':
+        vtag = vtag.replace('RELEASE-', '')
+    ltag = vtag.split('-',1)
+    if len(ltag) > 1:
+        vtag = ltag[0]
+        otag = ltag[1]
+    if len(vlist) == 3:
+        vcommits = '.' + str(vlist[1])
+        vcommit_id = '.' + str(vlist[2])
+    else:
+        vcommits = ''
+        vcommit_id = ''
+    vtype = version.__vertype__
+    if vtype == 'fixed':
+        v1 = __version__
+    elif vtype == 'tag':
+        v1 = vtag
+    else:
+        raise RuntimeError('version.__vertype__ is %s and not "fixed" or "tag"') % vtype
+    if not _check_override():
+        if len(vlist) > 1 or otag != '':
+            v1 = v1 + _create_snapshot_id()
+    v2 = v1 + vcommits + vcommit_id
+    if mrc != 0:
+        # this should not happen except in testing
+        v2 += '.dirty'
+    version.__version_1__ = v1
+    version.__version_2__ = v2
+    version.__version_init_flag__ = True
+    sav_version = "# last updated %s\n" % time.asctime()
+    sav_version += '__version_init_flag__ = False\n'
+    sav_version += '__version_1__ = "%s"\n' % v1
+    sav_version += '__version_2__ = "%s"\n' % v2
+    sav_version += '# the following has the value of either "fixed" or "tag"\n'
+    sav_version += '__vertype__ = "%s"\n' % vtype
+    file(verpath, "w").write(sav_version)
+
+def get_version_1():
+    from virtcli import version
+    if _check_for_git():
+        if not version.__version_init_flag__:
+            _init_version()
+    return version.__version_1__
+
+def get_version_2():
+    from virtcli import version
+    if _check_for_git():
+        if not version.__version_init_flag__:
+            _init_version()
+    return version.__version_2__
+
+# If (and only if) running under git, make sure there are no uncommitted changes.
+def check_git():
+    rc, gitcmd = commands.getstatusoutput('which git')
+    if rc != 0:
+        return
+    if not os.path.exists('.git'):
+        return
+    rc, merged = commands.getstatusoutput(gitcmd + ' update-index --refresh --unmerged')
+    if rc != 0:
+        raise RuntimeError("Unmerged updates")
+    return
 
 # We should map this into the config somehow but I question if anyone cares
 prefix = "/usr"
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 51ef015..0bda968 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -143,7 +143,7 @@ def setupParser(usage=None):
 
     parser = parse_class(usage=usage,
                          formatter=VirtHelpFormatter(),
-                         version=cliconfig.__version__)
+                         version=cliconfig.get_version_2())
     return parser
 
 def earlyLogging():
-- 
1.8.1.4




More information about the virt-tools-list mailing list