r4004 - in people/waldi/kernel/linux-2.6/debian: . bin lib/python
Bastian Blank
waldi at costa.debian.org
Sun Aug 21 16:24:09 UTC 2005
Author: waldi
Date: 2005-08-21 16:24:08 +0000 (Sun, 21 Aug 2005)
New Revision: 4004
Added:
people/waldi/kernel/linux-2.6/debian/bin/genconfig.py
Modified:
people/waldi/kernel/linux-2.6/debian/bin/gencontrol.py
people/waldi/kernel/linux-2.6/debian/lib/python/
people/waldi/kernel/linux-2.6/debian/lib/python/debian_linux.py
people/waldi/kernel/linux-2.6/debian/rules.real
Log:
* debian/bin/genconfig.py: Add.
* debian/bin/gencontrol.py: Small fix.
* debian/lib/python: Set svn:ignore property.
* debian/lib/python/debian_linux.py: Add kernel_config.
* debian/rules.real: Use genconfig.py.
Added: people/waldi/kernel/linux-2.6/debian/bin/genconfig.py
===================================================================
--- people/waldi/kernel/linux-2.6/debian/bin/genconfig.py 2005-08-21 15:29:03 UTC (rev 4003)
+++ people/waldi/kernel/linux-2.6/debian/bin/genconfig.py 2005-08-21 16:24:08 UTC (rev 4004)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+import os, sys
+sys.path.append("debian/lib/python")
+from debian_linux import *
+
+def main():
+ arch = os.getenv("ARCH")
+ subarch = os.getenv("SUBARCH")
+ flavour = os.getenv("FLAVOUR")
+
+ kconfig = kernel_config()
+ kconfig.read("debian/arch/config")
+ kconfig.read("debian/arch/%s/config" % arch)
+ if subarch != 'none':
+ kconfig.read("debian/arch/%s/%s/config" % (arch, subarch))
+ kconfig.read("debian/arch/%s/%s/config.%s" % (arch, subarch, flavour))
+ else:
+ kconfig.read("debian/arch/%s/config.%s" % (arch, flavour))
+
+ kconfig.dump()
+
+if __name__ == '__main__':
+ main()
Property changes on: people/waldi/kernel/linux-2.6/debian/bin/genconfig.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/script
Modified: people/waldi/kernel/linux-2.6/debian/bin/gencontrol.py
===================================================================
--- people/waldi/kernel/linux-2.6/debian/bin/gencontrol.py 2005-08-21 15:29:03 UTC (rev 4003)
+++ people/waldi/kernel/linux-2.6/debian/bin/gencontrol.py 2005-08-21 16:24:08 UTC (rev 4004)
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-import os, os.path, re, sys, textwrap, ConfigParser
+import os, os.path, re, sys
sys.path.append("debian/lib/python")
from debian_linux import *
@@ -120,7 +120,7 @@
desc_short, desc_long = desc.split ("\n", 1)
desc_pars = [substitute(i, vars) for i in desc_long.split ("\n.\n")]
desc_pars_wrapped = []
- w = wrap(width = 74, fix_sentence_endings = True)
+ w = textwrap(width = 74, fix_sentence_endings = True)
for i in desc_pars:
desc_pars_wrapped.append(w.fill(i))
e['Description'] = "%s\n%s" % (substitute(desc_short, vars), '\n.\n'.join(desc_pars_wrapped))
Property changes on: people/waldi/kernel/linux-2.6/debian/lib/python
___________________________________________________________________
Name: svn:ignore
+ *.pyc
Modified: people/waldi/kernel/linux-2.6/debian/lib/python/debian_linux.py
===================================================================
--- people/waldi/kernel/linux-2.6/debian/lib/python/debian_linux.py 2005-08-21 15:29:03 UTC (rev 4003)
+++ people/waldi/kernel/linux-2.6/debian/lib/python/debian_linux.py 2005-08-21 16:24:08 UTC (rev 4004)
@@ -1,7 +1,14 @@
import os, os.path, re, sys, textwrap, ConfigParser
-config_name = "defines"
+__all__ = [
+ 'config',
+ 'kernel_config',
+ 'entry',
+ 'textwrap',
+]
+config_filename = "defines"
+
class schema_item_boolean(object):
def __call__(self, i):
i = i.strip().lower()
@@ -42,7 +49,7 @@
self._read_base()
def _read_arch(self, arch, base):
- file = "debian/arch/%s/%s" % (arch, config_name)
+ file = "debian/arch/%s/%s" % (arch, config_filename)
c = config_parser(self.schema)
c.read(file)
t = c.items_convert('base')
@@ -59,7 +66,7 @@
t['subarches'] = subarches
def _read_base(self):
- file = "debian/arch/%s" % config_name
+ file = "debian/arch/%s" % config_filename
c = config_parser(self.schema)
c.read(file)
t1 = c.items_convert('base')
@@ -129,7 +136,78 @@
for i in self._list:
yield (i, self[i])
-class wrap(textwrap.TextWrapper):
+class kernel_config(dict):
+ entry_re = ur"""
+ ^
+ (?:
+ (?P<any>
+ (?:
+ if\s+
+ (?P<condition_not>not\s+)?
+ CONFIG_(?P<condition>[A-Z0-9_]+)
+ \s+
+ )?
+ (?:
+ CONFIG_(?P<option>[A-Z0-9_]+)=(?P<value>y|m|n|\d+|"\S*")
+ |
+ include\s+(?P<include>\S+)
+ )
+ )
+ |
+ \#\s*CONFIG_(?P<option_disabled>[A-Z0-9_]+).*
+ |
+ \#.*
+ )
+ $
+ """
+ entry_match = re.compile(entry_re, re.VERBOSE)
+
+ def __init__(self):
+ self._parts = []
+
+ def dump(self, f = sys.stdout):
+ for key, value in self.iteritems():
+ if value == 'n':
+ f.write("# CONFIG_%s is not set\n" % key)
+ else:
+ f.write("CONFIG_%s=%s\n" % (key, value))
+
+ def read(self, config):
+ f = file(config)
+ c = {}
+ includes = []
+ for line in f.readlines():
+ line = line.strip()
+ match = self.entry_match.match(line)
+ if match:
+ if match.group('any'):
+ condition = match.group('condition')
+ if condition:
+ t = False
+ if c.has_key(condition) and c[condition] != 'n':
+ t = True
+ elif self.has_key(condition) and self[condition] != 'n':
+ t = True
+ if match.group('condition_not'):
+ t = not t
+ if not t:
+ continue
+ include = match.group('include')
+ if include:
+ includes.append(include)
+ else:
+ c[match.group('option')] = match.group('value')
+ elif match.group('option_disabled'):
+ c[match.group('option_disabled')] = 'n'
+ else:
+ continue
+ else:
+ raise RuntimeError("Can't parse \"%s\"" % line)
+ self._parts.append(c)
+ self.update(c)
+ [self.read(os.path.join(os.path.dirname(config), i)) for i in includes]
+
+class textwrap(textwrap.TextWrapper):
wordsep_re = re.compile(
r'(\s+|' # any whitespace
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
Modified: people/waldi/kernel/linux-2.6/debian/rules.real
===================================================================
--- people/waldi/kernel/linux-2.6/debian/rules.real 2005-08-21 15:29:03 UTC (rev 4003)
+++ people/waldi/kernel/linux-2.6/debian/rules.real 2005-08-21 16:24:08 UTC (rev 4004)
@@ -22,12 +22,6 @@
append := $(SUBARCH)-
endif
-configs := $(notdir $(wildcard $(basedir)/config.*))
-configs := $(filter-out config, $(configs))
-ifndef flavours
- flavours := $(patsubst config.%,%,$(configs))
-endif
-
-include $(basedir)/Makefile.inc
include debian/rules.defs
@@ -113,16 +107,7 @@
# arch/$(karch)/Makefile.inc.
#
$(BUILD_DIR)/config.$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(basedir)/config.$(FLAVOUR)
- @echo "configs=$(configs)"
- @echo "Generating configuration file $@:"
- rm -f $@
- for i in $(ccommon); do \
- if [ -f $${i} ]; then \
- cat $${i} >> $@; \
- fi; \
- done
-# Flavour config file must be present
- cat $(basedir)/config.$(FLAVOUR) >> $@
+ python debian/bin/genconfig.py > $@
$(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source
$(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(VERSION)
More information about the Kernel-svn-changes
mailing list