While processing the pre/post install/uninstall scripts, in the case of
a one-line script of the form "%post -n <package_name> -p <command>",
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 <kevin.thierry@open.eurogiciel.org>
for section in script_sections:
code = ""
# If %section is a one line script such as: "%post -p /sbin/ldconfig"
for section in script_sections:
code = ""
# If %section is a one line script such as: "%post -p /sbin/ldconfig"
# Remove the package name if present to only keep the command
# 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)
code = " " + section_split[0].strip()
else:
code = self.__create_script_file_section_code(section)
# Set the package name
package_name = "${PN}"
# If the package name is not the project name
# Set the package name
package_name = "${PN}"
# If the package name is not the project name
# Remove the command if any to only keep the package name
# 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)
package_name = section_split[0].strip()
self.__create_script_file_write(file_d, code, script_name, package_name)