multilib
Last change
on this file since 18d1f6f was 70bf551, checked in by Xi Ruoyao <xry111@…>, 13 months ago |
kernel: Use new kernel configuration rendering method
Import kernel-config infrastructure from BLFS and use it for kernel
configuration. Note that kernel-config.py is slightly different from
BLFS: we need role="nodump" for <screen> here.
|
-
Property mode
set to
100755
|
File size:
752 bytes
|
Rev | Line | |
---|
[70bf551] | 1 | #!/usr/bin/env python3
|
---|
| 2 |
|
---|
| 3 | def kernel_version(path):
|
---|
| 4 | version = None
|
---|
| 5 | patchlevel = None
|
---|
| 6 | sublevel = None
|
---|
| 7 |
|
---|
| 8 | with open(path + 'Makefile') as f:
|
---|
| 9 | for line in f:
|
---|
| 10 | if line.startswith('VERSION ='):
|
---|
| 11 | version = line[len('VERSION ='):].strip()
|
---|
| 12 | elif line.startswith('PATCHLEVEL ='):
|
---|
| 13 | patchlevel = line[len('PATCHLEVEL ='):].strip()
|
---|
| 14 | elif line.startswith('SUBLEVEL ='):
|
---|
| 15 | sublevel = line[len('SUBLEVEL ='):].strip()
|
---|
| 16 |
|
---|
| 17 | assert(version and patchlevel and sublevel)
|
---|
| 18 | return '.'.join([version, patchlevel, sublevel])
|
---|
| 19 |
|
---|
| 20 | if __name__ == '__main__':
|
---|
| 21 | from sys import argv
|
---|
| 22 |
|
---|
| 23 | path = argv[1]
|
---|
| 24 | if path[:-1] != '/':
|
---|
| 25 | path += '/'
|
---|
| 26 |
|
---|
| 27 | print(kernel_version(path))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.