[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.1-testing] pygrub: cope with configurations with submenus



# HG changeset patch
# User Michael Young <m.a.young@xxxxxxxxxxxx>
# Date 1326215302 0
# Node ID c404dbf9b3c62cadb1c621c5313531264c964dee
# Parent  feb23d232cd92227694ad0e4696a420e1ef74b64
pygrub: cope with configurations with submenus

The grub2 configuration file in Fedora 16 can have one or more
menuentrys in a submenu, with configuration of the form
    submenu "Xen 4.1" {
    menuentry ... {
    ...
    }
    }
(this example occurs when the xen hypervisor is installed on the
guest)

Ignore the submenu line and the corresponding }

Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

xen-unstable changeset: 24001:152049468175
Backport-requested-by: Pasi Karkkainen <pasik@xxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r feb23d232cd9 -r c404dbf9b3c6 tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py      Tue Jan 10 17:08:17 2012 +0000
+++ b/tools/pygrub/src/GrubConf.py      Tue Jan 10 17:08:22 2012 +0000
@@ -370,6 +370,7 @@
         in_function = False
         img = None
         title = ""
+        menu_level=0
         for l in lines:
             l = l.strip()
             # skip blank lines
@@ -396,10 +397,18 @@
                 img = []
                 title = title_match.group(1)
                 continue
-            
+
+            if l.startswith("submenu"):
+                menu_level += 1
+                continue
+
             if l.startswith("}"):
                 if img is None:
-                    raise RuntimeError, "syntax error: closing brace without 
menuentry"
+                    if menu_level > 0:
+                        menu_level -= 1
+                        continue
+                    else:
+                        raise RuntimeError, "syntax error: closing brace 
without menuentry"
 
                 self.add_image(Grub2Image(title, img))
                 img = None

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.