]> git.pld-linux.org Git - packages/xen.git/blob - pygrubfix2.patch
Build fixes
[packages/xen.git] / pygrubfix2.patch
1 --- xen-4.1.2/tools/pygrub/src/pygrub.orig      2011-10-13 18:56:41.000000000 +0100
2 +++ xen-4.1.2/tools/pygrub/src/pygrub   2011-10-13 20:46:58.000000000 +0100
3 @@ -78,9 +78,17 @@
4  def get_fs_offset_gpt(file):
5      fd = os.open(file, os.O_RDONLY)
6      # assume the first partition is an EFI system partition.
7 -    os.lseek(fd, SECTOR_SIZE * 2, 0)
8 +    os.lseek(fd, SECTOR_SIZE, 0)
9      buf = os.read(fd, 512)
10 -    return struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE
11 +    partcount = struct.unpack("<L", buf[80:84])[0]
12 +    partsize = struct.unpack("<L", buf[84:88])[0]
13 +    i = partcount
14 +    offsets = []
15 +    while i>0:
16 +        buf = os.read(fd, partsize)
17 +        offsets.append(struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE)
18 +        i -= 1
19 +    return offsets
20  
21  FDISK_PART_SOLARIS=0xbf
22  FDISK_PART_SOLARIS_OLD=0x82
23 @@ -116,7 +124,9 @@
24                  continue # no solaris magic at that offset, ignore partition
25  
26          if type == FDISK_PART_GPT:
27 -            offset = get_fs_offset_gpt(file)
28 +            for offset in get_fs_offset_gpt(file):
29 +                part_offs.append(offset)
30 +            break
31  
32          # Active partition has 0x80 as the first byte.
33          # If active, prepend to front of list, otherwise append to back.
34 @@ -394,7 +404,8 @@
35                             ["/boot/grub/menu.lst", "/boot/grub/grub.conf",
36                              "/grub/menu.lst", "/grub/grub.conf"]) + \
37                         map(lambda x: (x,grub.GrubConf.Grub2ConfigFile),
38 -                           ["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \
39 +                           ["/boot/grub/grub.cfg", "/grub/grub.cfg",
40 +                            "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \
41                         map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile),
42                             ["/boot/isolinux/isolinux.cfg",
43                              "/boot/extlinux.conf"])
44 --- xen-4.1.2/tools/pygrub/src/GrubConf.py.orig 2011-10-08 19:42:10.000000000 +0100
45 +++ xen-4.1.2/tools/pygrub/src/GrubConf.py      2011-10-14 21:08:44.000000000 +0100
46 @@ -79,6 +79,8 @@
47          val = val.replace("(", "").replace(")", "")
48          if val[:5] == "msdos":
49              val = val[5:]
50 +        if val[:3] == "gpt":
51 +            val = val[3:]
52          self._part = int(val)
53      part = property(get_part, set_part)
54  
55 @@ -368,6 +370,7 @@
56          in_function = False
57          img = None
58          title = ""
59 +        menu_level=0
60          for l in lines:
61              l = l.strip()
62              # skip blank lines
63 @@ -394,10 +397,18 @@
64                  img = []
65                  title = title_match.group(1)
66                  continue
67 -            
68 +
69 +            if l.startswith("submenu"):
70 +                menu_level += 1
71 +                continue
72 +
73              if l.startswith("}"):
74                  if img is None:
75 -                    raise RuntimeError, "syntax error: closing brace without menuentry"
76 +                    if menu_level > 0:
77 +                        menu_level -= 1
78 +                        continue
79 +                    else:
80 +                        raise RuntimeError, "syntax error: closing brace without menuentry"
81  
82                  self.add_image(Grub2Image(title, img))
83                  img = None
84 @@ -414,6 +425,8 @@
85                  
86              if self.commands.has_key(com):
87                  if self.commands[com] is not None:
88 +                    if arg.strip() == "${saved_entry}":
89 +                        arg = "0"
90                      setattr(self, self.commands[com], arg.strip())
91                  else:
92                      logging.info("Ignored directive %s" %(com,))
This page took 0.040641 seconds and 3 git commands to generate.