WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEND] Add some sort of rudimentary versi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Add some sort of rudimentary version embedding into the source
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:08:54 +0000
Delivery-date: Thu, 02 Nov 2006 21:42:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 397cc120ae18e18204c8b2c72d9dd7580c15b081
# Parent  2ea55aa1dd46839927c4be17b988e01b42951f74
[XEND] Add some sort of rudimentary version embedding into the source
so we can report the Xend version number as opposed to Xen's version
number.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/setup.py                     |   37 +++++++++++++++++++++++++++++-
 tools/python/xen/__init__.py              |    3 +-
 tools/python/xen/xend/XendNode.py         |    4 ++-
 tools/python/xen/xend/server/SrvDaemon.py |    6 ++++
 4 files changed, 47 insertions(+), 3 deletions(-)

diff -r 2ea55aa1dd46 -r 397cc120ae18 tools/python/setup.py
--- a/tools/python/setup.py     Sat Oct 07 18:22:48 2006 +0100
+++ b/tools/python/setup.py     Thu Oct 12 12:27:56 2006 +0100
@@ -1,6 +1,38 @@
+#!/usr/bin/python
 
 from distutils.core import setup, Extension
 import os
+
+XEN_TOOLS_VERSION = '3.0.4'
+
+def embed_version():
+    """ Embed Mercurial Changeset Version in xen/__init__.py. """
+    try:
+        import commands
+        import re
+        output = commands.getoutput('hg tip')
+        version = XEN_TOOLS_VERSION
+        changeset = ''
+        date = ''
+        if output:
+            for line in output.split('\n'):
+                is_changeset = re.search(r'^changeset:\s*(.*)$', line)
+                if is_changeset:
+                    changeset = is_changeset.group(1)
+                is_date = re.search(r'^date:\s*(.*)$', line)
+                if is_date:
+                    date = is_date.group(1)
+
+        xen_init = open('xen/__init__.py', 'w')
+        xen_init.write('# Warning, this file is autogenerated by setup.py\n')
+        if version and changeset and date:
+            xen_init.write('VERSION = "%s-%s (%s)"\n' %
+                           (version, changeset, date))
+        else:
+            xen_init.write('VERSION = "%s"\n' % version)
+        xen_init.close()
+    except:
+        print 'Warning: Unable to extract version.'
 
 XEN_ROOT = "../.."
 
@@ -38,8 +70,11 @@ acm = Extension("acm",
                libraries          = libraries,
                sources            = [ "xen/lowlevel/acm/acm.c" ])
 
+
+embed_version()
+
 setup(name            = 'xen',
-      version         = '3.0',
+      version         = XEN_TOOLS_VERSION,
       description     = 'Xen',
       packages        = ['xen',
                          'xen.lowlevel',
diff -r 2ea55aa1dd46 -r 397cc120ae18 tools/python/xen/__init__.py
--- a/tools/python/xen/__init__.py      Sat Oct 07 18:22:48 2006 +0100
+++ b/tools/python/xen/__init__.py      Thu Oct 12 12:27:56 2006 +0100
@@ -1,1 +1,2 @@
- 
+# Warning, this file is autogenerated by setup.py
+VERSION = "3.0.4-50:fa1d6b491cc5 (Fri Oct 06 22:50:29 2006 +0100)"
diff -r 2ea55aa1dd46 -r 397cc120ae18 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Sat Oct 07 18:22:48 2006 +0100
+++ b/tools/python/xen/xend/XendNode.py Thu Oct 12 12:27:56 2006 +0100
@@ -71,7 +71,9 @@ class XendNode:
 
     def xen_version(self):
         info = self.xc.xeninfo()
-        return {'Xen': '%(xen_major)d.%(xen_minor)d' % info}
+        from xen import VERSION
+        return {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
+                'Xend': VERSION}
 
     def get_name(self):
         return self.name
diff -r 2ea55aa1dd46 -r 397cc120ae18 tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py Sat Oct 07 18:22:48 2006 +0100
+++ b/tools/python/xen/xend/server/SrvDaemon.py Thu Oct 12 12:27:56 2006 +0100
@@ -289,6 +289,12 @@ class Daemon:
             log.info("Xend changeset: %s.", xinfo['xen_changeset'])
             del xc
 
+            try:
+                from xen import VERSION
+                log.info("Xend version: %s", VERSION)
+            except ImportError:
+                log.info("Xend version: Unknown.")
+
             relocate.listenRelocation()
             servers = SrvServer.create()
             servers.start(status)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEND] Add some sort of rudimentary version embedding into the source, Xen patchbot-unstable <=