Changeset 1417643
- Timestamp:
- 07/31/2023 01:44:37 PM (11 months ago)
- Branches:
- 12.0, 12.1, ken/TL2024, ken/tuningfonts, lazarus, plabs/newcss, python3.11, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/llvm18
- Children:
- 2fbed80
- Parents:
- 08c3c25
- git-author:
- Xi Ruoyao <xry111@…> (07/31/2023 10:49:37 AM)
- git-committer:
- Xi Ruoyao <xry111@…> (07/31/2023 01:44:37 PM)
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel-config/kernel-config.py
r08c3c25 r1417643 25 25 26 26 expand_var_mp = { 'SRCARCH': 'x86' } 27 main_dep = {} 27 28 28 29 def expand_var(s): … … 40 41 41 42 def pop_stack_while(cond): 42 while len(stack)and cond(stack[-1][0]):43 while stack and cond(stack[-1][0]): 43 44 pop_stack(cond) 44 45 45 46 def cur_menu(): 46 47 global stack 47 return stack[-1][3] if len(stack)else 048 return stack[-1][3] if stack else 0 48 49 49 50 def cur_if(): 50 51 global if_stack 51 return if_stack[-1] if len(if_stack)else []52 return if_stack[-1][:] if if_stack else [] 52 53 53 54 def clean_dep(d): … … 62 63 global ind0, ind1, stack, menu_id 63 64 is_menu = buf[0].startswith('menu') 64 key = buf[0].split()[1].strip() 65 65 is_nonconfig_menu = buf[0].startswith('menu ') 66 key = None if is_nonconfig_menu else buf[0].split()[1].strip() 67 title = buf[0][len('menu '):] if is_nonconfig_menu else None 66 68 deps = ['menu'] + cur_if() 67 title = None68 69 klass = None 70 69 71 for line in buf[1:]: 70 72 line = line.strip() … … 72 74 new_deps = line[len('depends on '):].split('&&') 73 75 deps += [clean_dep(x) for x in new_deps] 76 elif line.startswith('prompt'): 77 title = line[len('prompt '):] 74 78 else: 75 79 for prefix in ['tristate', 'bool', 'string']: … … 77 81 title = line[len(prefix) + 1:] 78 82 klass = prefix 83 elif line == prefix: 84 klass = prefix 79 85 elif line.startswith('def_' + prefix + ' '): 80 86 klass = prefix 81 elif line.startswith('prompt '): 82 title = line[len('prompt '):] 87 else: 88 continue 89 90 if '"' in line: 91 tail = line[line.rfind('"') + 1:].strip() 92 if tail[:3] == 'if ': 93 deps += [clean_dep(x) for x in tail[3:].split('&&')] 83 94 84 95 pop_stack_while(lambda x: x not in deps) 85 96 86 if key not in known_config: 87 return [] 88 val = known_config[key] 97 menu_id += is_menu 98 internal_key = key or menu_id 99 if stack: 100 fa = stack[-1][0] 101 if fa == 'menu': 102 fa = cur_menu() & ~choice_bit 103 main_dep[internal_key] = fa 104 105 val = known_config.get(key) 89 106 comment = None 90 107 forced = None … … 95 112 val = val['value'] 96 113 97 assert(title and klass) 98 title = title.strip().lstrip('"') 99 title = title[:title.find('"')] 100 101 if klass == 'string': 114 klass = klass or 'string' 115 if title: 116 title = title.strip().lstrip('"') 117 title = title[:title.find('"')] 118 119 if not val: 120 pass 121 elif klass == 'string': 102 122 val = '(' + val + ')' 103 123 else: … … 120 140 121 141 arrow = ' --->' if is_menu else '' 122 r = [(ind0, val, ind1, title, arrow, key, cur_menu(), comment)] 123 menu_id += is_menu 124 stack_ent = (key, 2, 0, menu_id) if is_menu else (key, 0, 2, cur_menu()) 142 r = [ind0, val, ind1, title, arrow, internal_key, cur_menu(), comment] 143 144 # Don't indent for untitled (internal) entries 145 x = 2 if title else 0 146 147 key = key or 'menu' 148 stack_ent = (key, 2, 0, menu_id) if is_menu else (key, 0, x, cur_menu()) 125 149 ind0 += stack_ent[1] 126 150 ind1 += stack_ent[2] … … 136 160 if line.startswith('prompt '): 137 161 title = line[len('prompt '):].strip().strip('"') 138 r = [(ind0, "", ind1, title, ' --->', '', cur_menu(), None)] 162 139 163 menu_id += 1 164 165 if stack: 166 fa = stack[-1][0] 167 if fa == 'menu': 168 fa = cur_menu() & ~choice_bit 169 main_dep[menu_id] = fa 170 171 r = [ind0, None, ind1, title, ' --->', menu_id, cur_menu(), None] 140 172 stack += [('menu', 2, 0, menu_id | choice_bit)] 141 173 ind0 += 2 … … 148 180 with open(path + file) as f: 149 181 for line in f: 150 if len(config_buf):182 if config_buf: 151 183 if not (line.startswith('\t') or line.startswith(' ')): 152 184 if config_buf[0] == 'choice\n': 153 r += parse_choice(config_buf)185 r += [parse_choice(config_buf)] 154 186 else: 155 r += parse_config(config_buf)187 r += [parse_config(config_buf)] 156 188 config_buf = [] 157 189 else: … … 161 193 sub = expand_var(line.strip().split()[1].strip('"')) 162 194 r += load_kconfig(sub) 163 elif line.startswith('config') or line.startswith('menu config'):195 elif line.startswith('config') or line.startswith('menu'): 164 196 config_buf = [line] 165 197 elif line.startswith('choice'): 166 198 config_buf = [line] 167 elif line.startswith("menu"):168 title = expand_var(line[4:].strip().strip('"'))169 r += [(ind0, "", ind1, title, ' --->', '', cur_menu(), None)]170 menu_id += 1171 stack += [('menu', 2, 0, menu_id)]172 ind0 += 2173 199 elif line.startswith('endmenu') or line.startswith('endchoice'): 174 200 pop_stack_while(lambda x: x != 'menu') 175 201 pop_stack(lambda x: x == 'menu') 176 if r[-1][1] == "":177 # prune empty menu178 r = r[:-1]179 202 elif line.startswith('if '): 180 203 line = line[3:] … … 197 220 known_config = tomllib.load(f) 198 221 199 r = load_kconfig("Kconfig") 222 r = load_kconfig('Kconfig') 223 224 # Refcount all menus 225 226 index_ikey = {} 227 for i in reversed(range(len(r))): 228 index_ikey[r[i][5]] = i 229 230 for i in reversed(range(len(r))): 231 if r[i][1] is not None: 232 key = r[i][5] 233 fa = main_dep.get(key) 234 if not fa: 235 continue 236 j = index_ikey[fa] 237 if type(fa) == int: 238 # The main dependency is a menu, just mark it used 239 r[j][1] = '' 240 if (r[j][1] is None) and r[j][3]: 241 raise Exception('[%s] needs unselected [%s]' % (key, fa)) 242 243 r = [i for i in r if i[1] is not None] 200 244 201 245 # Now we are going to pretty-print r … … 204 248 max_val_len = {} 205 249 for _, val, _, _, _, _, menu, _ in r: 206 x = max_val_len [menu] if menu in max_val_len else0250 x = max_val_len.get(menu) or 0 207 251 max_val_len[menu] = max(x, len(val)) 208 252 … … 212 256 buf = [] 213 257 214 done = [x[5] for x in r] 258 done = [x[5] for x in r] + ['revision'] 215 259 for i in known_config: 216 260 if i not in done: … … 230 274 rem = max_line - len(line) 231 275 232 if key: 233 key = ' [' + key + ']' 276 key = ' [' + key + ']' if type(key) == str else '' 234 277 235 278 if len(key) <= rem: … … 238 281 key = '... ' + key 239 282 line += '\n' + ' ' * (max_line - len(key)) + key 283 if type(comment) == str: 284 comment = [comment] 240 285 if comment: 241 line = ' ' * i0 + '# ' + comment + ':\n' + line 286 comment = '\n'.join([' ' * i0 + '# ' + line for line in comment]) 287 line = comment + ':\n' + line 242 288 buf += [line.replace('<', '<').replace('>', '>').rstrip()] 243 289 … … 245 291 kver = kernel_version.kernel_version(path) 246 292 247 print('''<?xml version="1.0" encoding="ISO-8859-1"?> 293 from jinja2 import Template 294 295 t = Template('''<?xml version="1.0" encoding="ISO-8859-1"?> 248 296 <!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 249 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">''') 250 print('<!-- Automatically generated by kernel-config.py') 251 print(' DO NOT EDIT! -->') 252 print('<screen><literal>' + '\n'.join(buf) + '</literal></screen>') 297 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> 298 <!-- Automatically generated by kernel-config.py 299 DO NOT EDIT! --> 300 <screen{{ rev }}><literal>{{ '\n'.join(buf) }}</literal></screen>''') 301 302 rev = known_config.get('revision') 303 rev = ' revision="%s"' % rev if rev else '' 304 print(t.render(rev = rev, buf = buf)) -
kernel-config/postlfs/filesystems/btrfs-progs-test.toml
r08c3c25 r1417643 1 BTRFS_FS='*M' 1 2 BTRFS_FS_POSIX_ACL='*' 2 3 REISERFS_FS='*M' -
kernel-config/postlfs/filesystems/lvm2.toml
r08c3c25 r1417643 1 1 MD='*' 2 BLK_DEV='*' 2 3 BLK_DEV_DM='*M' 3 4 DM_CRYPT='*M' -
kernel-config/postlfs/filesystems/uefi-bootloaders/grub-setup.toml
r08c3c25 r1417643 1 # forced by !EXPERT 2 BLOCK = { value = '*', forced = true } 1 3 EFI='*' 2 4 PARTITION_ADVANCED='* ' -
kernel-config/postlfs/virtualization/qemu-bridge.toml
r08c3c25 r1417643 2 2 BRIDGE='*M' 3 3 NETDEVICES='*' 4 NET_CORE='*' 4 5 TUN='*M' -
kernel-config/x/installing/libevdev-test.toml
r08c3c25 r1417643 1 1 INPUT_MISC="*" 2 2 INPUT_UINPUT="*M" 3 INPUT = { value = '*', forced = '*' } -
postlfs/filesystems/btrfs-progs-test-kernel.xml
r08c3c25 r1417643 8 8 [*] ReiserFS extended attributes [REISERFS_FS_XATTR] 9 9 [*] ReiserFS POSIX Access Control Lists [REISERFS_FS_POSIX_ACL] 10 [*] Btrfs POSIX Access Control Lists [BTRFS_FS_POSIX_ACL]</literal></screen> 10 <*/M> Btrfs filesystem support [BTRFS_FS] 11 [*] Btrfs POSIX Access Control Lists [BTRFS_FS_POSIX_ACL]</literal></screen> -
postlfs/filesystems/lvm2-kernel.xml
r08c3c25 r1417643 5 5 DO NOT EDIT! --> 6 6 <screen><literal>Device Drivers ---> 7 <*/M> RAM block device support [BLK_DEV_RAM] 8 [*] Multiple devices driver support (RAID and LVM) ---> [MD] 7 [*] Block devices ---> [BLK_DEV] 8 <*/M> RAM block device support [BLK_DEV_RAM] 9 [*] Multiple devices driver support (RAID and LVM) ---> [MD] 9 10 <*/M> Device mapper support [BLK_DEV_DM] 10 <*/M> Crypt target support[DM_CRYPT]11 <*/M> Snapshot target[DM_SNAPSHOT]12 <*/M> Thin provisioning target[DM_THIN_PROVISIONING]13 <*/M> Cache target (EXPERIMENTAL)[DM_CACHE]14 <*/M> Mirror target[DM_MIRROR]15 <*/M> Zero target[DM_ZERO]16 <*/M> I/O delaying target[DM_DELAY]11 <*/M> Crypt target support [DM_CRYPT] 12 <*/M> Snapshot target [DM_SNAPSHOT] 13 <*/M> Thin provisioning target [DM_THIN_PROVISIONING] 14 <*/M> Cache target (EXPERIMENTAL) [DM_CACHE] 15 <*/M> Mirror target [DM_MIRROR] 16 <*/M> Zero target [DM_ZERO] 17 <*/M> I/O delaying target [DM_DELAY] 17 18 Kernel hacking ---> 18 19 Generic Kernel Debugging Instruments ---> -
postlfs/filesystems/parted.xml
r08c3c25 r1417643 106 106 107 107 <indexterm zone="parted parted-kernel"> 108 <primary sortas="d-parted">parted </primary>108 <primary sortas="d-parted">parted (testing)</primary> 109 109 </indexterm> 110 110 </sect2> -
postlfs/filesystems/uefi-bootloaders/grub-setup-kernel.xml
r08c3c25 r1417643 6 6 <screen><literal>Processor type and features ---> 7 7 [*] EFI runtime service support [EFI] 8 Partition Types ---> 9 [ /*] Advanced partition selection [PARTITION_ADVANCED] 10 [*] EFI GUID Partition support [EFI_PARTITION] 8 -*- Enable the block layer ---> [BLOCK] 9 Partition Types ---> 10 [ /*] Advanced partition selection [PARTITION_ADVANCED] 11 [*] EFI GUID Partition support [EFI_PARTITION] 11 12 Device Drivers ---> 12 13 Firmware Drivers ---> -
postlfs/security/cryptsetup-kernel.xml
r08c3c25 r1417643 7 7 [*] Multiple devices driver support (RAID and LVM) ---> [MD] 8 8 <*/M> Device mapper support [BLK_DEV_DM] 9 <*/M> Crypt target support[DM_CRYPT]9 <*/M> Crypt target support [DM_CRYPT] 10 10 -*- Cryptographic API ---> [CRYPTO] 11 11 Block ciphers ---> -
postlfs/security/iptables-kernel.xml
r08c3c25 r1417643 8 8 [*] Network packet filtering framework (Netfilter) ---> [NETFILTER] 9 9 [*] Advanced netfilter configuration [NETFILTER_ADVANCED] 10 11 <*/M> Netfilter connection tracking support[NF_CONNTRACK]12 <*/M> 10 Core Netfilter Configuration ---> 11 <*/M> Netfilter connection tracking support [NF_CONNTRACK] 12 <*/M> Netfilter Xtables support (required for ip_tables) 13 13 ... [NETFILTER_XTABLES] 14 <*/M> LOG target support[NETFILTER_XT_TARGET_LOG]14 <*/M> LOG target support [NETFILTER_XT_TARGET_LOG] 15 15 IP: Netfilter Configuration ---> 16 16 <*/M> IP tables support (required for filtering/masq/NAT) -
postlfs/virtualization/qemu-bridge-kernel.xml
r08c3c25 r1417643 7 7 Networking options ---> 8 8 <*/M> 802.1d Ethernet Bridging [BRIDGE] 9 Device Drivers ---> 10 [*] Network device support ---> [NETDEVICES] 11 <*/M> Universal TUN/TAP device driver support [TUN]</literal></screen> 9 Device Drivers ---> 10 [*] Network device support ---> [NETDEVICES] 11 [*] Network core driver support [NET_CORE] 12 <*/M> Universal TUN/TAP device driver support [TUN]</literal></screen> -
x/installing/libevdev-test-kernel.xml
r08c3c25 r1417643 6 6 <screen><literal>Device Drivers ---> 7 7 Input device support ---> 8 [*] Miscellaneous devices ---> [INPUT_MISC] 9 <*/M> User level driver support [INPUT_UINPUT]</literal></screen> 8 -*- Generic input layer (needed for keyboard, mouse, ...) [INPUT] 9 [*] Miscellaneous devices ---> [INPUT_MISC] 10 <*/M> User level driver support [INPUT_UINPUT]</literal></screen> -
x/installing/x7driver-wacom-kernel.xml
r08c3c25 r1417643 9 9 Special HID drivers ---> 10 10 <*/M> Wacom Intuos/Graphire tablet support (USB) [HID_WACOM] 11 12 <*/M> USB HID transport layer[USB_HID]11 USB HID support ---> 12 <*/M> USB HID transport layer [USB_HID] 13 13 [*] USB support ---> [USB_SUPPORT] 14 14 <*/M> Support for Host-side USB [USB]</literal></screen>
Note:
See TracChangeset
for help on using the changeset viewer.