support/scripts: prepare expanding the packages lists
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 8 Jun 2014 14:15:10 +0000 (16:15 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 8 Jun 2014 15:08:01 +0000 (17:08 +0200)
Move to a function the code generating the package name from a
symbol's name, to avoid code duplication.

This is not used currently, but will be in a subsequent patch.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Samuel Martin <s.martin49@gmail.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/scripts/gen-manual-lists.py

index 94f403e0c2b87b9efac59bea423a92f8c41c4d9a..aee2299c925526ff8e6041b52cfe37a3d2431e84 100644 (file)
@@ -245,7 +245,7 @@ class Buildroot:
         """
         if not self.re_pkg_prefix.match(symbol.get_name()):
             return False
-        pkg_name = re.sub("BR2_PACKAGE_(HOST_)?(.*)", r"\2", symbol.get_name())
+        pkg_name = self._get_pkg_name(symbol)
 
         pattern = "^(HOST_)?" + pkg_name + "$"
         pattern = re.sub("_", ".", pattern)
@@ -278,6 +278,15 @@ class Buildroot:
                 return True
         return False
 
+    def _get_pkg_name(self, symbol):
+        """ Return the package name of the specified symbol.
+
+        :param symbol:      The symbol to get the package name of
+
+        """
+
+        return re.sub("BR2_PACKAGE_(HOST_)?(.*)", r"\2", symbol.get_name())
+
     def _get_symbol_label(self, symbol, mark_deprecated=True):
         """ Return the label (a.k.a. prompt text) of the symbol.