[Pkg-libvirt-commits] [SCM] Virt Installer packaging branch, master, updated. debian/0.400.0-6-3-g1b30602

Guido Guenther agx at sigxcpu.org
Mon Dec 1 18:42:36 UTC 2008


The following commit has been merged in the master branch:
commit 4b691af8d2e3cf9fc88434bfa6f8891c3fa5a7d9
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sat Nov 29 19:08:35 2008 +0100

    Look for the current keymap in xorg.conf
    
    Debian has no /etc/sysconfig/keyboard.

diff --git a/debian/patches/0010-look-for-keymap-in-xorg.conf-too.patch b/debian/patches/0010-look-for-keymap-in-xorg.conf-too.patch
new file mode 100644
index 0000000..22e4e8e
--- /dev/null
+++ b/debian/patches/0010-look-for-keymap-in-xorg.conf-too.patch
@@ -0,0 +1,84 @@
+From e7893efa29e65b0a4b66351f376798994f2b750f Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Sat, 29 Nov 2008 12:53:32 +0100
+Subject: [PATCH] look for keymap in xorg.conf too
+
+---
+ virtinst/util.py |   36 +++++++++++++++++++++++++++++++-----
+ 1 files changed, 31 insertions(+), 5 deletions(-)
+
+diff --git a/virtinst/util.py b/virtinst/util.py
+index e7742db..8e144ee 100644
+--- a/virtinst/util.py
++++ b/virtinst/util.py
+@@ -33,6 +33,7 @@ from virtinst import CapabilitiesParser
+ 
+ 
+ KEYBOARD_DIR = "/etc/sysconfig/keyboard"
++XORG_CONF = "/etc/X11/xorg.conf"
+ 
+ def default_route():
+     route_file = "/proc/net/route"
+@@ -273,6 +274,27 @@ def compareMAC(p, q):
+             return -1
+     return 0
+ 
++def xorg_keymap():
++    """Look in /etc/X11/xorg.conf for the host machine's keymap, and attempt to
++       map it to a keymap supported by qemu"""
++
++    import keytable
++    kt = None
++    try:
++        f = open(XORG_CONF, "r")
++    except IOError, e:
++        logging.debug('Could not open "%s": %s ' % (XORG_CONF, str(e)))
++    else:
++        keymap_re = re.compile(r'\s*Option\s+"XkbLayout"\s+"(?P<kt>[a-z-]+)"')
++        for line in f:
++            m = keymap_re.match(line)
++            if m:
++                kt = m.group('kt')
++        else:
++            logging.debug("Didn't find keymap '%s' in keytable!" % kt)
++        f.close()
++    return kt
++
+ def default_keymap():
+     """Look in /etc/sysconfig for the host machine's keymap, and attempt to
+        map it to a keymap supported by qemu"""
+@@ -280,10 +302,13 @@ def default_keymap():
+     # Set keymap to same as hosts
+     import keytable
+     keymap = "en-us"
++    kt = None
++
+     try:
+         f = open(KEYBOARD_DIR, "r")
+     except IOError, e:
+-        logging.debug('Could not open "/etc/sysconfig/keyboard" ' + str(e))
++        logging.debug('Could not open "%s": %s' % (KEYBOARD_DIR, str(e)))
++        kt = xorg_keymap()
+     else:
+         while 1:
+             s = f.readline()
+@@ -291,11 +316,12 @@ def default_keymap():
+                 break
+             if re.search("KEYTABLE", s) != None:
+                 kt = s.split('"')[1]
+-                if keytable.keytable.has_key(kt.lower()):
+-                    keymap = keytable.keytable[kt]
+-                else:
+-                    logging.debug("Didn't find keymap '%s' in keytable!" % kt)
+         f.close()
++
++    if kt and keytable.keytable.has_key(kt.lower()):
++        keymap = keytable.keytable[kt]
++    else:
++        logging.debug("Didn't find keymap '%s' in keytable!" % kt)
+     return keymap
+ 
+ def pygrub_path(conn=None):
+-- 
+1.6.0.3
+
diff --git a/debian/patches/series b/debian/patches/series
index f2778c6..513b5b2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
 0007-create-scratchdir-if-it-doesn-t-exist.patch
 0008-use-virtio-for-Lenny-guests.patch
 0009-Add-support-for-Debian-Xen-paravirt-installs.patch
+0010-look-for-keymap-in-xorg.conf-too.patch

-- 
Virt Installer packaging



More information about the Pkg-libvirt-commits mailing list