#self.__preun_flag = "%preun"
#self.__postun_flag = "%postun"
#self.__pre_flag = "%pre"
- def get_post_section_key( self ):
- '''
- return the list of file section of the spec file.
- '''
- res_file_list = []
- for section_key in self.__spect_dico.keys():
- # should use re.
- if section_key.startswith( "%post " ):
- res_file_list.append( section_key )
- return res_file_list
-
- def get_preun_section_key( self ):
- '''
- return the list of file section of the spec file.
- '''
- res_file_list = []
- for section_key in self.__spect_dico.keys():
- # should use re.
- if section_key.startswith( "%preun " ):
- res_file_list.append( section_key )
- return res_file_list
-
- def get_postun_section_key( self ):
- '''
- return the list of file section of the spec file.
- '''
- res_file_list = []
- for section_key in self.__spect_dico.keys():
- # should use re.
- if section_key.startswith( "%postun " ):
- res_file_list.append( section_key )
- return res_file_list
- def get_pre_section_key( self ):
+ def get_script_section_key( self, __flag ):
'''
return the list of file section of the spec file.
'''
- res_file_list = []
- for section_key in self.__spect_dico.keys():
- # should use re.
- if section_key.startswith( "%pre " ):
- res_file_list.append( section_key )
- return res_file_list
+ res_script_section = ""
+ if __flag in self.__spect_dico.keys():
+ for line in self.__spect_dico[__flag][1:]:
+ res_script_section += line + "\n"
+ return res_script_section
def get_files_list_from_section( self, package_section_name ):
'''
generate script file.
'''
#pkg_preinst, pkg_postinst, pkg_prerm, and pkg_postrm
- #self.__post_flag = "%post"
- #self.__preun_flag = "%preun"
- #self.__postun_flag = "%postun"
- #self.__pre_flag = "%pre"
- #print "post",self.__spec_parser.get_post_section_key( )
- #print "preun",self.__spec_parser.get_preun_section_key( )
- #print "postun",self.__spec_parser.get_postun_section_key( )
- #print "pre",self.__spec_parser.get_pre_section_key( )
+
+ #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")
def __create_provides_file( self ,file_d):
'''