From: SangYoun Kwak Date: Mon, 17 Mar 2025 08:18:53 +0000 (+0900) Subject: Fix modify_pc.py script to parse symbols in pc file properly X-Git-Tag: accepted/tizen/unified/20250318.072944^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified;p=platform%2Fhal%2Fbackend%2Frootstrap.git Fix modify_pc.py script to parse symbols in pc file properly In the modify_pc.py script, regular expressions are used to parse symbols and values. There are symbols separated from its value by a colon(':') and by a equal sign('='). These two symbols are parsed by regular expression but these regular expressions are incomplete since content like below cannot be parsed properly. Cflags: -DAAAA=1 -DBBBB=... In this case, it should be recognized as a colon symbol, which symbol is "Cflags" and value is "-DAAAA=1 -DBBBB=...". But because of '=' in the value, it was parsed as: symbol is "-DAAAA", value is "1 -DBBBB=...". To resolve this bug issue, two anchors '^' and '$' are added to the regular expression to represent the beginning and end of a string, respectively. Change-Id: I12b9b6eb2eba4142ac72ab7e01b6e428c7ed75d4 Signed-off-by: SangYoun Kwak --- diff --git a/modify_pc.py b/modify_pc.py index c1ea980..c7171d6 100755 --- a/modify_pc.py +++ b/modify_pc.py @@ -21,8 +21,8 @@ class UnknownVariableException(Exception): class PkgConfig: regex_comment = compile_regex("([^#]*)(#.*)?") - regex_assignment = compile_regex("\\s*([-_a-zA-Z0-9]+)\\s*=\\s*([^\\s]*)") - regex_declaration = compile_regex("\\s*([-_a-zA-Z0-9]+)\\s*:\\s*(.*)\\s*") + regex_assignment = compile_regex("^\\s*([-_a-zA-Z0-9]+)\\s*=\\s*([^\\s]*)$") + regex_declaration = compile_regex("^\\s*([-_a-zA-Z0-9]+)\\s*:\\s*(.*)\\s*$") regex_substitution = compile_regex("\\${([-_a-zA-Z0-9]+)}") regex_root_substitution = compile_regex("^-([a-zA-Z])/(.*)$")