mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
configdump: better logging; insert (still unsupported) array/dict raw value and 2do markers into produced dump JSON
This commit is contained in:
committed by
Igor Pečovnik
parent
f12015954a
commit
7d90b10f79
@@ -14,6 +14,8 @@ log: logging.Logger = logging.getLogger("bash_declare_parser")
|
||||
|
||||
REGEX_BASH_DECLARE_DOUBLE_QUOTE = r"declare (-[-xr]) (.*?)=\"(.*)\""
|
||||
REGEX_BASH_DECLARE_SINGLE_QUOTE = r"declare (-[-xr]) (.*?)=\$'(.*)'"
|
||||
REGEX_BASH_DECLARE_ASSOCIATIVE_ARRAY = r"declare (-[A]) (.*?)=\((.*)\)"
|
||||
REGEX_BASH_DECLARE_SIMPLE_ARRAY = r"declare (-[a]) (.*?)=\((.*)\)"
|
||||
|
||||
|
||||
class BashDeclareParser:
|
||||
@@ -37,6 +39,18 @@ class BashDeclareParser:
|
||||
value = self.parse_dequoted_value(match.group(2), self.armbian_value_parse_single_quoted(match.group(3)))
|
||||
all_keys[match.group(2)] = value
|
||||
|
||||
if count_matches == 0:
|
||||
# try for the (A)ssociative Array version
|
||||
for matchNum, match in enumerate(re.finditer(REGEX_BASH_DECLARE_ASSOCIATIVE_ARRAY, one_declare, re.DOTALL), start=1):
|
||||
count_matches += 1
|
||||
all_keys[match.group(2)] = ["@TODO", "bash associative arrays aka dictionaries are not supported yet", match.group(3)]
|
||||
|
||||
if count_matches == 0:
|
||||
# try for the simple (a)rray version
|
||||
for matchNum, match in enumerate(re.finditer(REGEX_BASH_DECLARE_SIMPLE_ARRAY, one_declare, re.DOTALL), start=1):
|
||||
count_matches += 1
|
||||
all_keys[match.group(2)] = ["@TODO", "bash simple-arrays are not supported yet", match.group(3)]
|
||||
|
||||
if count_matches == 0:
|
||||
log.error(f"** No matches found for Bash declare regex (origin: {self.origin}), line ==>{one_declare}<==")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user