[kernel-team] 05/86: Update.

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Dec 21 00:34:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch benh/kconfigeditor2
in repository kernel-team.

commit d0103c43e29300c4b6623427af6611d6c27a56d4
Author: Bastian Blank <waldi at debian.org>
Date:   Tue Mar 11 15:33:25 2008 +0000

    Update.
    
    svn path=/people/waldi/utils/kconfigeditor2/; revision=10799
---
 .../lib/kconfigeditor/kconfig/menu/all.py          | 40 +++++++++
 .../lib/kconfigeditor/kconfig/menu/file.py         |  2 +-
 .../lib/kconfigeditor/kconfig/package/__init__.py  |  0
 .../lib/kconfigeditor/kconfig/package/files.py     | 97 ++++++++++++++++++++++
 4 files changed, 138 insertions(+), 1 deletion(-)

diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py
new file mode 100644
index 0000000..5fa8ae4
--- /dev/null
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py
@@ -0,0 +1,40 @@
+import os
+
+from file import FileSource, Parser
+
+class All(object):
+    def __init__(self, root, arches):
+        self.files = {}
+        self.files_arch = {}
+        self.filenames_all = []
+        self.filenames_arch = {}
+
+        for arch in arches:
+            work = ["arch/%s/Kconfig" % arch]
+            self.filenames_arch[arch] = []
+
+            while work:
+                filename = work.pop(0)
+                filename_list = filename.split('/')
+                if len(filename_list) > 2 and filename_list[0] == 'arch':
+                    self.filenames_arch[arch].append(filename)
+                else:
+                    self.filenames_all.append(filename)
+
+                if filename in self.files:
+                    f = self.files[filename]
+                else:
+                    f = self.files.setdefault(filename, Parser()(file(os.path.join(root, filename)), filename))
+
+                for i in f:
+                    if isinstance(i, FileSource):
+                        work.append(i.filename)
+
+        for arch in arches:
+            f = {}
+            for i in self.filenames_all:
+                f[i] = self.files[i]
+            for i in self.filenames_arch[arch]:
+                f[i] = self.files[i]
+            self.files_arch[arch] = f
+
diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
index 8bbd169..ed643a9 100644
--- a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
@@ -18,7 +18,7 @@ class FileSource(object):
     def __repr__(self):
         return "<%s(%s)>" % (self.__class__.__name__, self.filename)
 
-class _Parser(object):
+class Parser(object):
     def __call__(self, fd, filename):
         lineno = 0
 
diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/package/__init__.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/package/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/package/files.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/package/files.py
new file mode 100644
index 0000000..ee30e1e
--- /dev/null
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/package/files.py
@@ -0,0 +1,97 @@
+import os
+
+from debian_linux.config import ConfigCoreHierarchy
+
+class Files(dict):
+    def __init__(self, root):
+        self.files = {}
+        self.filenames = {}
+        self.root = os.path.join(root, "debian/config")
+        self.config = ConfigCoreHierarchy([self.root])
+
+        self._read_base()
+
+        for key, files in self.filenames.iteritems():
+            r = self.setdefault(key, FileList())
+            for f in files:
+                if f in self.files:
+                    f = self.files[f]
+                else:
+                    f = self.files.setdefault(f, File(None, f))
+                r.append_file(f)
+
+    def _read_arch(self, arch):
+        kconfig = self.check_config("%s/config" % arch, True, arch)
+        self.filenames[arch,] = kconfig
+
+        for featureset in self.config['base', arch]['featuresets']:
+            self._read_featureset(arch, featureset)
+
+    def _read_base(self):
+        self.filenames[()] = self.check_config('config', True)
+
+        for arch in self.config['base',]['arches']:
+            self._read_arch(arch)
+
+    def _read_featureset(self, arch, featureset):
+        # TODO
+        if featureset != 'none':
+            return
+
+        kconfig = []
+        kconfig.extend(self.check_config("featureset-%s/config" % featureset, False, None, featureset))
+        kconfig.extend(self.check_config("%s/%s/config" % (arch, featureset), False, arch, featureset))
+        self.filenames[arch, featureset] = kconfig
+
+        for flavour in self.config['base', arch, featureset]['flavours']:
+            self._read_flavour(arch, featureset, flavour)
+
+    def _read_flavour(self, arch, featureset, flavour):
+        kconfig = []
+        kconfig.extend(self.check_config("%s/config.%s" % (arch, flavour), False, arch, None, flavour))
+        kconfig.extend(self.check_config("%s/%s/config.%s" % (arch, featureset, flavour), False, arch, featureset, flavour))
+        self.filenames[arch, featureset, flavour] = kconfig
+
+    def _get_config(self, *entry_name):
+        entry_real = ('image',) + entry_name
+        entry = self.config.get(entry_real, None)
+        if entry is None:
+            return None
+        return entry.get('configs', None)
+
+    def check_config_default(self, fail, f):
+        f1 = self.root + '/' + f
+        if os.path.exists(f1):
+            return [f]
+        if fail:
+            raise RuntimeError("%s unavailable" % f)
+        return []
+
+    def check_config_files(self, files):
+        ret = []
+        for f in files:
+            f1 = self.root + '/' + f
+            if os.path.exists(f1):
+                ret.append(f)
+                break
+            else:
+                raise RuntimeError("%s unavailable" % f)
+        return ret
+
+    def check_config(self, default, fail, *entry_name):
+        configs = self._get_config(*entry_name)
+        if configs is None:
+            return self.check_config_default(fail, default)
+        return self.check_config_files(configs)
+
+class FileList(object):
+    def __init__(self):
+        self._files = []
+
+    def append_file(self, item):
+        self._files.append(item)
+
+class File(object):
+    def __init__(self, fd, filename):
+        self.filename = filename
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git



More information about the Kernel-svn-changes mailing list