Don't stop gbs command if gbs conf has duplicate section/option. 58/299158/4
authorwanchao-xu <wanchao.xu@samsung.com>
Thu, 21 Sep 2023 02:51:57 +0000 (10:51 +0800)
committerwanchao-xu <wanchao.xu@samsung.com>
Thu, 21 Sep 2023 05:46:31 +0000 (13:46 +0800)
 * SafeConfigParser has been renamed to ConfigParser in Python 3.2
 * ConfigParser of python3 provides duplicate section/option error

Change-Id: I8a26c61a0d7a7bb14577d8940b4b712afefa3d4c
Signed-off-by: wanchao-xu <wanchao.xu@samsung.com>
gitbuildsys/conf.py

index 01eeb925fabb70d5af03ac66e73af531558688db..54073d73bc32bb6fd196b1e055210d9ddf67a08d 100644 (file)
@@ -27,7 +27,7 @@ import binascii
 import codecs
 import shutil
 from collections import namedtuple
-from configparser import SafeConfigParser,  \
+from configparser import ConfigParser,  \
                          MissingSectionHeaderError, Error
 
 from gitbuildsys import errors
@@ -45,14 +45,14 @@ def encode_passwd(passwd):
     return base64.b64encode(codecs.encode(passwd.encode(), 'bz2')).decode()
 
 
-class BrainConfigParser(SafeConfigParser):
+class BrainConfigParser(ConfigParser):
     """Standard ConfigParser derived class which can reserve most of the
     comments, indents, and other user customized stuff inside the ini file.
     """
 
     def read_one(self, filename):
         """only support one input file"""
-        return SafeConfigParser.read(self, filename)
+        return ConfigParser.read(self, filename)
 
     def _read(self, fptr, fname):
         """Parse a sectioned setup file.
@@ -67,7 +67,7 @@ class BrainConfigParser(SafeConfigParser):
         self._flines = fptr.readlines()
         fptr.seek(0)
 
-        return SafeConfigParser._read(self, fptr, fname)
+        return ConfigParser._read(self, fptr, fname)
 
     def _set_into_file(self, section, option, value, replace_opt=None):
         """Set the value in the file contents
@@ -147,9 +147,9 @@ class BrainConfigParser(SafeConfigParser):
         """
         if not self.has_section(section):
             self.add_section(section)
-        SafeConfigParser.set(self, section, option, value)
+        ConfigParser.set(self, section, option, value)
         if replace_opt:
-            SafeConfigParser.remove_option(self, section, replace_opt)
+            ConfigParser.remove_option(self, section, replace_opt)
 
         # If the code reach here, it means the section and key are ok
         try:
@@ -270,7 +270,7 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
 
         self._cfgparsers = []
         for fpath in self._cfgfiles:
-            cfgparser = BrainConfigParser()
+            cfgparser = BrainConfigParser(strict=False)
             try:
                 cfgparser.read_one(fpath)
                 if cfgparser.has_section('general') and \
@@ -812,9 +812,9 @@ class BizConfigManager(ConfigMgr):
 
         return profile
 
-class MappingConfigParser(SafeConfigParser):
+class MappingConfigParser(ConfigParser):
     def __init__(self, file, defaults=None):
-        SafeConfigParser.__init__(self, defaults=None)
+        ConfigParser.__init__(self, defaults=None)
         self._obs_meta = {}
         self._prefix_meta = {}
         self._repo_meta = {}