From: Kévin THIERRY Date: Wed, 11 Jun 2014 07:09:39 +0000 (+0200) Subject: Correct parsing error X-Git-Tag: rev_0.4~74^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77ce60d0f6baac66c6cec5d840363309d59f71e2;p=scm%2Fbb%2Ftizen.git Correct parsing error While processing the pre/post install/uninstall scripts, in the case of a one-line script of the form "%post -n -p ", if the package name or the command contains "-p" or "-n", parsing is wrong. Usig " -p " and " -n " corrects this error in our cases. The only package found with this error is pkmgr-info-parser. If a command would happen to have a "-p" or "-n" option, parsing would fail, even with this patch. Another solution would need to be found. Signed-off-by: Kévin THIERRY --- diff --git a/tools/spec2yocto.py b/tools/spec2yocto.py index 17ff3a2..92632ee 100755 --- a/tools/spec2yocto.py +++ b/tools/spec2yocto.py @@ -1705,9 +1705,9 @@ class MetaSpec: for section in script_sections: code = "" # If %section is a one line script such as: "%post -p /sbin/ldconfig" - if "-p" in section: + if " -p " in section: # Remove the package name if present to only keep the command - section_split = section.split("-p")[1].split("-n") + section_split = section.split(" -p ")[1].split(" -n ") code = " " + section_split[0].strip() else: code = self.__create_script_file_section_code(section) @@ -1715,9 +1715,9 @@ class MetaSpec: # Set the package name package_name = "${PN}" # If the package name is not the project name - if "-n" in section: + if " -n " in section: # Remove the command if any to only keep the package name - section_split = section.split("-n")[1].split("-p") + section_split = section.split(" -n ")[1].split(" -p ") package_name = section_split[0].strip() self.__create_script_file_write(file_d, code, script_name, package_name)