Factorize some code 21/24121/2
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 8 Jul 2014 15:11:48 +0000 (17:11 +0200)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Wed, 9 Jul 2014 08:19:23 +0000 (10:19 +0200)
Change-Id: Ie94f919ccddd4520b05b22ab88902f79b447174f
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
tools/spec2yocto.py

index 97b3d2b..f8330ae 100755 (executable)
@@ -273,23 +273,11 @@ class Spec2yoctoConfig( object ):
         '''
         return self.__get_list( 'depends', 'inherit_gettext', [] )
 
-    def get_inherit_perl( self ):
-        '''
-        some buildRequire mean inherit_perl package not depends runtime.
-        '''
-        return ["perl"]
-
-    def get_inherit_python( self ):
-        '''
-        some buildRequire mean inherit_perl package not depends runtime.
-        '''
-        return ["python"]
-
-    def get_inherit_tizen_cmake( self ):
+    def get_inherit(self, package):
         '''
         some buildRequire mean inherit_cmake package not depends runtime.
         '''
-        return ["cmake"]
+        return [package]
 
     def get_group_uri( self, project ):
 
@@ -1934,9 +1922,9 @@ class MetaSpec:
 
                     if res is None:
                         if pp_provide not in SPEC2YOCTO_CONFIG.get_inherit_gettext() and \
-                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit_python() and \
-                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit_tizen_cmake() and \
-                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit_perl() and \
+                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit("python") and \
+                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit("cmake") and \
+                          pp_provide not in SPEC2YOCTO_CONFIG.get_inherit("perl") and \
                           pp_provide not in ignore_depend_list and \
                           pp_provide not in native_depend_list and \
                           pp_provide not in cross_depend_list:
@@ -1969,9 +1957,9 @@ class MetaSpec:
                     pass
                 elif pkg_yocto_name in SPEC2YOCTO_CONFIG.get_libtool_cross():
                     file_d.write( "DEPENDS += \"libtool-cross\"\n" )
-                elif pkg_yocto_name in SPEC2YOCTO_CONFIG.get_inherit_perl():
+                elif pkg_yocto_name in SPEC2YOCTO_CONFIG.get_inherit("perl"):
                     file_d.write( "inherit perlnative\n"  )
-                elif pkg_yocto_name in SPEC2YOCTO_CONFIG.get_inherit_python():
+                elif pkg_yocto_name in SPEC2YOCTO_CONFIG.get_inherit("python"):
                     file_d.write( "inherit pythonnative\n"  )
                 else:
                     file_d.write( "DEPENDS += \"%s\"\n" % pkg_yocto_name )