From 0da88acbdacb92f22f95631efcb0341ddd0551f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Wed, 4 Jun 2014 15:26:34 +0200 Subject: [PATCH] Add post install scripts to recipes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Note that only the first "%post" section found in spec files is treated, the other ones are ignored. This issue should be taken care of. Signed-off-by: Kévin THIERRY --- tools/spec2yocto.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/spec2yocto.py b/tools/spec2yocto.py index 9543312..a871291 100755 --- a/tools/spec2yocto.py +++ b/tools/spec2yocto.py @@ -1660,10 +1660,21 @@ class MetaSpec: ''' #pkg_preinst, pkg_postinst, pkg_prerm, and pkg_postrm - #print "pre", self.__spec_parser.get_script_section_key("%pre") - #print "post", self.__spec_parser.get_script_section_key("%post") - #print "preun", self.__spec_parser.get_script_section_key("%preun") - #print "postun", self.__spec_parser.get_script_section_key("%postun") + code = self.__spec_parser.get_script_section_key("%post") + command_list = code.split("\n") + formated_code = "" + for line in command_list: + if line != "": + formated_code += " " + line + "\n" + formated_code = formated_code.replace(" /usr", " ${D}/usr") + formated_code = formated_code.replace(" /bin", " ${D}/bin") + formated_code = formated_code.replace(" /lib", " ${D}/lib") + formated_code = formated_code.replace(" /sbin", " ${D}/sbin") + + file_d.write("pkg_postinst_${PN}() {\n") + file_d.write("%s\n" % formated_code) + file_d.write("}\n") + file_d.write("\n") def __create_provides_file( self ,file_d): ''' -- 2.7.4