From 77ce60d0f6baac66c6cec5d840363309d59f71e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Wed, 11 Jun 2014 09:09:39 +0200 Subject: [PATCH] Correct parsing error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- tools/spec2yocto.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) -- 2.7.4