@author: ronan@fridu.net
'''
import os
+import shutil
+
import errno
RECIPES_SOURCE_DIR = os.path.dirname( os.path.realpath( __file__ ) )
package_spec_dir = os.path.expanduser( package_spec_dir )
package_spec_dir = os.path.expandvars( package_spec_dir )
-
specFileList = get_packaging_files( package_path )
specFile = None
spec_full_path = os.path.join( package_spec_dir, specFile )
return spec_full_path
+def findSpecPatchFiles( patch_dir_path, package_name_list ):
+ """
+ Find the name of the patch for the spec file which matches best with `package_name`
+ """
+ patch_list = []
+
+ patch_dir_path = os.path.expanduser( patch_dir_path )
+ patch_dir_path = os.path.expandvars( patch_dir_path )
+
+ for patch_name in set( package_name_list ):
+
+ patch_file = patch_name + ".spec.patch"
+ patch_path = os.path.join( patch_dir_path, patch_file )
+ if os.path.isfile( patch_path ):
+ patch_list.append( patch_path )
+
+
+ return patch_list
+
+
+
class SubprocessCrt( object ):
'''
usefull class to control subprocess
rpmspec_command += " --define='setup #setup' "
rpmspec_command += " --define='setup0 #setup0' "
-
package_dir = os.path.dirname( self.__package_spec_path )
rpmspec_command += " --define='SOURCES %s' " % package_dir
return 1
for line in self.__spect_dico[self.__build_flag][1:]:
- if ( "mkdir" in line ) and ( not "-p" in line ):
- line = line.replace( "mkdir", "mkdir -p" )
res_build_section += line + "\n"
return res_build_section
file_d.write( "DEPENDS += \"%s\"\n" % res )
-class PackagesCollection:
- '''
- class for all package in a distro.
- '''
- def __init__( self ):
- '''
- init PackagesCollection.
- '''
- self.__recipes_source_dir = RECIPES_SOURCE_DIR
- self.__recipes_list = SPEC2YOCTO_CONFIG.get_recipes_sources_directory()
- self.__init_package_provide_dico()
- self.__recipes_dir_dest = os.path.join( RECIPES_DIR_DEST, "recipes-tizen" )
- if not os.path.isdir( self.__recipes_dir_dest ):
- os.makedirs( self.__recipes_dir_dest )
-
- self.__meta_spec_dico = {}
- self.__meta_spec_boot_strap_dico = {}
- self.__init_package()
- self.__init_depends()
-
- def save_package_provided_file( self ):
- '''
- save all provided file.
- '''
- package_provided_path = os.path.join( self.__recipes_source_dir, "package-provided" )
- # init package_provided_file
- with open( package_provided_path, "w" ) as package_provided_file:
- for k in MetaSpec.mProvidesDico.keys():
- provided_val = "%s::::%s\n" % ( k, " ".join( MetaSpec.mProvidesDico[k] ) )
- package_provided_file.write( provided_val )
-
- pkg_extra_rprovided_path = os.path.join( self.__recipes_source_dir,
- "package-Extra-rprovided" )
- # init package_provided_file
- with open( pkg_extra_rprovided_path, "w" ) as package_extra_rprovided_file:
- for k in MetaSpec.mExtraRProvidesDico.keys():
- extra_rprovides_text = "%s::::%s\n"
- extra_rprovides_value = ( k, " ".join( MetaSpec.mExtraRProvidesDico[k] ) )
- package_extra_rprovided_file.write( extra_rprovides_text % extra_rprovides_value )
-
-
- def __init_package_provide_dico( self ):
- '''
- init package_provide_dico
- '''
- for recipes_dir in self.__recipes_list:
- pkgconfig_provider_path = os.path.join( RECIPES_SOURCE_DIR,
- recipes_dir,
- "pkgconfigProvider" )
- with open( pkgconfig_provider_path, "r" ) as package_provide_file:
- for line in package_provide_file:
- pkgline = line.replace( "\n", "" ).split( "::::" )
-
- SpecParser.mPkgConfigDico[pkgline[0]] = pkgline[1].split()
-
- def __init_package( self ):
- '''
- init package
- '''
- for recipe_dir in self.__recipes_list:
- self.__init_meta_spec_dico( recipe_dir )
-
- def __init_meta_spec_dico( self, recipe_dir ):
- '''
- init meta_spec_dico.
- '''
- if not os.path.isdir( os.path.join( self.__recipes_source_dir, recipe_dir ) ):
- return
- spec_file_dir = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "specfile-initial" )
- package_git_sources = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "package-git-config" )
-# packageConfigBootstrap=os.path.join(self.__recipes_source_dir,
-# recipe_dir,
-# "package-config-initial-bootstrap")
-
- package_yocto_cross_path = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "package-yocto-cross" )
- self.__add_cross_package_blacklist( package_yocto_cross_path )
-
- package_yocto_initial_path = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "package-yocto-initial" )
- self.__add_initial_package_blacklist( package_yocto_initial_path )
-
- package_yocto_native_path = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "package-yocto-native" )
- self.__add_native_package_blacklist( package_yocto_native_path )
-
- package_yocto_oe_path = os.path.join( self.__recipes_source_dir,
- recipe_dir,
- "package-yocto-oe" )
- self.__add_oe_package_blacklist( package_yocto_oe_path )
-
- self.__list_package( self.__recipes_dir_dest,
- spec_file_dir,
- package_git_sources,
- self.__meta_spec_dico )
-
- def __list_package( self, recipes_dir_dest, specfile_dir, package_config, meta_spec_dico ):
- '''
- create a dico for all package.
- '''
- with open( package_config, "r" ) as file_d:
- for line in file_d:
- line = line.replace( "\n", "" )
- pkg_name, pkg_spec_initial, pkg_git_command, pkg_git_tag = line.split()
- package_spec_path = os.path.join( specfile_dir, pkg_spec_initial )
- if os.path.isfile( package_spec_path ):
- package_recipes_dir = os.path.join( recipes_dir_dest, pkg_name )
-
- meta_spec_dico[pkg_name] = MetaSpec( package_recipes_dir,
- pkg_name,
- package_spec_path,
- pkg_git_command,
- pkg_git_tag )
- else:
- print "package_spec_path :\"%s\" not exist" % package_spec_path
-
-
-
-
-
- def __add_cross_package_blacklist( self, package_yocto_cross_path ):
- '''
- load package cross
- '''
- list_package_cross = self.__load_list_from_file( package_yocto_cross_path )
- MetaSpec.mCrossPackageBlacklist.extend( list_package_cross )
-
- def __add_initial_package_blacklist( self, package_yocto_initial_path ):
- '''
- load package blacklist
- '''
- list_package = self.__load_list_from_file( package_yocto_initial_path )
- MetaSpec.mInitialPackageBlacklist.extend( list_package )
-
- def __add_native_package_blacklist( self, package_yocto_native_path ):
- '''
- load native_package_blacklist
- '''
- list_package = self.__load_list_from_file( package_yocto_native_path )
- MetaSpec.mNativePackageBlacklist.extend( list_package )
-
- def __add_oe_package_blacklist( self, package_yocto_oe_path ):
- '''
- load oe_package_blacklist
- '''
- list_package = self.__load_list_from_file( package_yocto_oe_path )
- MetaSpec.mOePackageBlacklist.extend( list_package )
-
-
- def __load_list_from_file( self, path ):
- '''
- should be remove
- '''
- res = []
- with open( path, "r" ) as file_d:
- for line in file_d:
- line = line.replace( "\n", "" ).replace( " ", "" )
- if not line.startswith( "#" ) and line != "":
- res.append( line )
- return res
-
- def __init_depends( self ):
- '''
- init depends
- '''
- self.__load_package_provided_extra()
- for meta_spec in self.__meta_spec_dico.values():
- meta_spec.create_all_depends()
-
- def __load_package_provided_extra( self ):
- '''
- load_package_provided_extra
- '''
- for recipes_dir in self.__recipes_list:
- package_provided_extra_file = os.path.join( RECIPES_SOURCE_DIR, recipes_dir,
- "package-provided-extra" )
-
- if os.path.isfile( package_provided_extra_file ):
- with open( package_provided_extra_file, "r" ) as file_d:
- for line in file_d:
- line = line.replace( "\n", "" )
- if "::::" in line:
- k_package, raw_list = line.split( "::::" )
- if k_package in MetaSpec.mProvidesDico.keys():
- MetaSpec.mProvidesDico[k_package].extend( raw_list.split( " " ) )
- else:
- MetaSpec.mProvidesDico[k_package] = raw_list.split( " " )
- if k_package in MetaSpec.mExtraRProvidesDico.keys():
- list_split = raw_list.split( " " )
- MetaSpec.mExtraRProvidesDico[k_package].extend( list_split )
- else:
- MetaSpec.mExtraRProvidesDico[k_package] = raw_list.split( " " )
+# class PackagesCollection:
+# '''
+# class for all package in a distro.
+# '''
+# def __init__( self ):
+# '''
+# init PackagesCollection.
+# '''
+# self.__recipes_source_dir = RECIPES_SOURCE_DIR
+# self.__recipes_list = SPEC2YOCTO_CONFIG.get_recipes_sources_directory()
+# self.__init_package_provide_dico()
+# self.__recipes_dir_dest = os.path.join( RECIPES_DIR_DEST, "recipes-tizen" )
+# if not os.path.isdir( self.__recipes_dir_dest ):
+# os.makedirs( self.__recipes_dir_dest )
+#
+# self.__meta_spec_dico = {}
+# self.__meta_spec_boot_strap_dico = {}
+# self.__init_package()
+# self.__init_depends()
+#
+# def save_package_provided_file( self ):
+# '''
+# save all provided file.
+# '''
+# package_provided_path = os.path.join( self.__recipes_source_dir, "package-provided" )
+# # init package_provided_file
+# with open( package_provided_path, "w" ) as package_provided_file:
+# for k in MetaSpec.mProvidesDico.keys():
+# provided_val = "%s::::%s\n" % ( k, " ".join( MetaSpec.mProvidesDico[k] ) )
+# package_provided_file.write( provided_val )
+#
+# pkg_extra_rprovided_path = os.path.join( self.__recipes_source_dir,
+# "package-Extra-rprovided" )
+# # init package_provided_file
+# with open( pkg_extra_rprovided_path, "w" ) as package_extra_rprovided_file:
+# for k in MetaSpec.mExtraRProvidesDico.keys():
+# extra_rprovides_text = "%s::::%s\n"
+# extra_rprovides_value = ( k, " ".join( MetaSpec.mExtraRProvidesDico[k] ) )
+# package_extra_rprovided_file.write( extra_rprovides_text % extra_rprovides_value )
+#
+#
+# def __init_package_provide_dico( self ):
+# '''
+# init package_provide_dico
+# '''
+# for recipes_dir in self.__recipes_list:
+# pkgconfig_provider_path = os.path.join( RECIPES_SOURCE_DIR,
+# recipes_dir,
+# "pkgconfigProvider" )
+# with open( pkgconfig_provider_path, "r" ) as package_provide_file:
+# for line in package_provide_file:
+# pkgline = line.replace( "\n", "" ).split( "::::" )
+#
+# SpecParser.mPkgConfigDico[pkgline[0]] = pkgline[1].split()
+#
+# def __init_package( self ):
+# '''
+# init package
+# '''
+# for recipe_dir in self.__recipes_list:
+# self.__init_meta_spec_dico( recipe_dir )
+#
+# def __init_meta_spec_dico( self, recipe_dir ):
+# '''
+# init meta_spec_dico.
+# '''
+# if not os.path.isdir( os.path.join( self.__recipes_source_dir, recipe_dir ) ):
+# return
+# spec_file_dir = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "specfile-initial" )
+# package_git_sources = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "package-git-config" )
+# # packageConfigBootstrap=os.path.join(self.__recipes_source_dir,
+# # recipe_dir,
+# # "package-config-initial-bootstrap")
+#
+# package_yocto_cross_path = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "package-yocto-cross" )
+# self.__add_cross_package_blacklist( package_yocto_cross_path )
+#
+# package_yocto_initial_path = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "package-yocto-initial" )
+# self.__add_initial_package_blacklist( package_yocto_initial_path )
+#
+# package_yocto_native_path = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "package-yocto-native" )
+# self.__add_native_package_blacklist( package_yocto_native_path )
+#
+# package_yocto_oe_path = os.path.join( self.__recipes_source_dir,
+# recipe_dir,
+# "package-yocto-oe" )
+# self.__add_oe_package_blacklist( package_yocto_oe_path )
+#
+# self.__list_package( self.__recipes_dir_dest,
+# spec_file_dir,
+# package_git_sources,
+# self.__meta_spec_dico )
+#
+# def __list_package( self, recipes_dir_dest, specfile_dir, package_config, meta_spec_dico ):
+# '''
+# create a dico for all package.
+# '''
+# with open( package_config, "r" ) as file_d:
+# for line in file_d:
+# line = line.replace( "\n", "" )
+# pkg_name, pkg_spec_initial, pkg_git_command, pkg_git_tag = line.split()
+# package_spec_path = os.path.join( specfile_dir, pkg_spec_initial )
+# if os.path.isfile( package_spec_path ):
+# package_recipes_dir = os.path.join( recipes_dir_dest, pkg_name )
+#
+# meta_spec_dico[pkg_name] = MetaSpec( package_recipes_dir,
+# pkg_name,
+# package_spec_path,
+# pkg_git_command,
+# pkg_git_tag )
+# else:
+# print "package_spec_path :\"%s\" not exist" % package_spec_path
+#
+#
+#
+#
+#
+# def __add_cross_package_blacklist( self, package_yocto_cross_path ):
+# '''
+# load package cross
+# '''
+# list_package_cross = self.__load_list_from_file( package_yocto_cross_path )
+# MetaSpec.mCrossPackageBlacklist.extend( list_package_cross )
+#
+# def __add_initial_package_blacklist( self, package_yocto_initial_path ):
+# '''
+# load package blacklist
+# '''
+# list_package = self.__load_list_from_file( package_yocto_initial_path )
+# MetaSpec.mInitialPackageBlacklist.extend( list_package )
+#
+# def __add_native_package_blacklist( self, package_yocto_native_path ):
+# '''
+# load native_package_blacklist
+# '''
+# list_package = self.__load_list_from_file( package_yocto_native_path )
+# MetaSpec.mNativePackageBlacklist.extend( list_package )
+#
+# def __add_oe_package_blacklist( self, package_yocto_oe_path ):
+# '''
+# load oe_package_blacklist
+# '''
+# list_package = self.__load_list_from_file( package_yocto_oe_path )
+# MetaSpec.mOePackageBlacklist.extend( list_package )
+#
+#
+# def __load_list_from_file( self, path ):
+# '''
+# should be remove
+# '''
+# res = []
+# with open( path, "r" ) as file_d:
+# for line in file_d:
+# line = line.replace( "\n", "" ).replace( " ", "" )
+# if not line.startswith( "#" ) and line != "":
+# res.append( line )
+# return res
+#
+# def __init_depends( self ):
+# '''
+# init depends
+# '''
+# self.__load_package_provided_extra()
+# for meta_spec in self.__meta_spec_dico.values():
+# meta_spec.create_all_depends()
+#
+# def __load_package_provided_extra( self ):
+# '''
+# load_package_provided_extra
+# '''
+# for recipes_dir in self.__recipes_list:
+# package_provided_extra_file = os.path.join( RECIPES_SOURCE_DIR, recipes_dir,
+# "package-provided-extra" )
+#
+# if os.path.isfile( package_provided_extra_file ):
+# with open( package_provided_extra_file, "r" ) as file_d:
+# for line in file_d:
+# line = line.replace( "\n", "" )
+# if "::::" in line:
+# k_package, raw_list = line.split( "::::" )
+# if k_package in MetaSpec.mProvidesDico.keys():
+# MetaSpec.mProvidesDico[k_package].extend( raw_list.split( " " ) )
+# else:
+# MetaSpec.mProvidesDico[k_package] = raw_list.split( " " )
+# if k_package in MetaSpec.mExtraRProvidesDico.keys():
+# list_split = raw_list.split( " " )
+# MetaSpec.mExtraRProvidesDico[k_package].extend( list_split )
+# else:
+# MetaSpec.mExtraRProvidesDico[k_package] = raw_list.split( " " )
def parse_manifest_xml( src ):
def clean_name( raw_name ):
+ if "_" in raw_name:
+ raw_name = raw_name.replace( "_", "-" )
+
if "/" in raw_name:
return raw_name.split( "/" )[-1]
else:
else:
return raw_name
+def patch_the_spec_file( package_spec_path,
+ patch_path,
+ dest_spec_dir,
+ dest_spec_path ):
+
+ if not package_spec_path == dest_spec_path:
+ shutil.copy2( package_spec_path, dest_spec_path )
+
+ if dest_spec_dir.endswith( "/packaging" ):
+ dest_spec_dir = dest_spec_dir[:-len( "/packaging" )]
+
+ patch_command = "patch -s -p1 --fuzz=2 -d %s -i %s" % ( dest_spec_dir, patch_path )
+
+ a_sub_command = SubprocessCrt()
+ res = a_sub_command.exec_subprocess( patch_command )
+
+ if res == 1:
+ msg = "The patch \"%s\" can't be apply in directory \"%s\"."
+ msg = msg % ( patch_path, dest_spec_dir )
+ print >> sys.stderr, colorize( msg, "red" )
+ print >> sys.stderr, colorize( "command: \"%s\"" % patch_command, "red" )
+ sys.exit( 1 )
+
+ return dest_spec_path
+
+
+def specfile_patcher( package_spec_path, project, package_name_list , dest_spec_path ):
+ working_dir = SPEC2YOCTO_CONFIG.get_working_dir( project )
+ source_spec_patch_dir = os.path.join( working_dir, "specfile-patch" )
+
+ patch_path_list = findSpecPatchFiles( source_spec_patch_dir, package_name_list )
+
+ if len( patch_path_list ) > 0:
+
+ dest_spec_dir = os.path.dirname( dest_spec_path )
+ if not os.path.isdir( dest_spec_dir ):
+ os.makedirs( dest_spec_dir )
+
+ for patch_path in patch_path_list:
+ package_spec_path = patch_the_spec_file( package_spec_path,
+ patch_path,
+ dest_spec_dir,
+ dest_spec_path )
+
+ return package_spec_path
+
class package_def:
- def __init__( self, name, path, revision, git_src ):
+ def __init__( self, project, name, path, revision, git_src ):
+ self.__project = project
self.name = name
self.git_path = path
self.git_revision = revision
print "%s %s %s %s" % ( self.name , self.git_path, self.git_revision, self.git_src )
def create_MetaSpec( self , package_recipes_dir, source_spec_dir ):
- package_spec_path = findBestSpecFile( os.path.join( source_spec_dir , self.name , "packaging" ), self.name )
+ source_path = os.path.join( source_spec_dir , self.name , "packaging" )
+ package_spec_path = findBestSpecFile( source_path, self.name )
+
+ if package_spec_path == -1:
+ msg = "no initial spec file for package \"%s\" in directory \"%s\"."
+ msg = msg % ( self.name, source_path )
+ print >> sys.stderr, colorize( msg, "red" )
+ sys.exit( 1 )
+
+ working_dir = SPEC2YOCTO_CONFIG.get_working_dir( self.__project )
+ specfile_patched_dir = os.path.join( working_dir, "specfile-patched" )
+ dest_spec_dir = os.path.join( specfile_patched_dir , self.name )
+ dest_spec_packaging_dir = os.path.join( dest_spec_dir , "packaging" )
+ dest_spec_path = os.path.join( dest_spec_packaging_dir ,
+ os.path.basename( package_spec_path ) )
+
+ package_spec_path = specfile_patcher( package_spec_path,
+ self.__project,
+ [self.name, self.name + "-initial"],
+ dest_spec_path )
+
self.__my_meta_spec = MetaSpec( os.path.join( package_recipes_dir, self.name ),
self.name,
package_spec_path,
def create_all_depends( self ):
self.__my_meta_spec.create_all_depends()
-def make_alias_package( packages_dico ):
+def make_alias_package( project, packages_dico ):
alias_package = {}
alias_package["python-rpm"] = "rpm"
alias_package["python-libxml2"] = "libxml2"
alias_to = alias_package[alias]
if alias_to in packages_dico.keys() and alias not in packages_dico.keys():
a_package_def = packages_dico[alias_to]
- packages_dico[alias] = package_def( alias,
+ packages_dico[alias] = package_def( project,
+ alias,
a_package_def.git_path,
a_package_def.git_revision,
a_package_def.git_src )
self.__my_package_dico = {}
self.__generate_package()
- self.__my_package_dico = make_alias_package( self.__my_package_dico )
+ self.__my_package_dico = make_alias_package( self.__my_project, self.__my_package_dico )
def parse_manifest_xml( self, src ):
print >> sys.stderr, colorize( msg, "red" )
sys.exit( 1 )
- self.__my_package_dico[package] = package_def( package, path, revision, remote )
+ self.__my_package_dico[package] = package_def( self.__my_project,
+ package,
+ path,
+ revision,
+ remote )
def __update_meta_manifests( self ):
'''
self.__my_manifest_file_list[ meta_manifest ] = meta_manifest_path
-
def createRecipes( self ):
'''
generate recipises.
'''
self.__recipes_dir_dest = SPEC2YOCTO_CONFIG.get_recipes_sources_directory( self.__my_project )
+
if self.__recipes_dir_dest is None:
msg = "In the project \"%s\" recipes_dir_sources is not define."
msg = msg % ( self.__my_project )
self.__my_package_dico[package].create_MetaSpec( self.__recipes_dir_dest,
source_spec_dir )
-
def __init_depends( self ):
'''
init depends
MetaSpec.mExtraRProvidesDico[k_package].extend( raw_list )
-def main2():
- '''
- main fonction of spec2yocto
- '''
- command_list = ["prep", "compile", "install", "createRecipes", "generatePseudoSpecfile"]
-
- if len( sys.argv ) < 2 :
- print "%s take on parameter \"%s\"." % ( sys.argv[0], ", ".join( command_list ) )
- sys.exit( 1 )
-
- exec_command = sys.argv[1]
- if len( sys.argv ) > 2:
- spec_path = sys.argv[2]
- spec_path = spec_path.replace( "\n", "" )
-
- if len( sys.argv ) > 3:
- package_pn = sys.argv[3]
- else:
- package_pn = None
-
- if exec_command == "prep":
- print SpecParser( spec_path, package_pn = package_pn ).get_prep_section()
- res = 0
-
- elif exec_command == "compile":
- res = SpecParser( spec_path, package_pn = package_pn ).get_build_section()
- if res != 1:
- print res
- res = 0
-
- elif exec_command == "install":
- res = SpecParser( spec_path, package_pn = package_pn ).get_install_section()
- print res
-
- elif exec_command == "generatePseudoSpecfile" :
- a_spec_parser = SpecParser( spec_path )
- a_spec_parser.parse_raw_spec_file()
- res = a_spec_parser.get_clean_raw()
- if res != 1:
- print res
- res = 0
-
- elif exec_command == "have_macro_configure":
- a_spec_parser = SpecParser( spec_path )
- a_spec_parser.parse_raw_spec_file()
- print a_spec_parser.have_macro_configure()
- res = 0
-
- elif exec_command == "have_macro_reconfigure":
- a_spec_parser = SpecParser( spec_path )
- a_spec_parser.parse_raw_spec_file()
- print a_spec_parser.have_macro_reconfigure()
- res = 0
-
- elif exec_command == "createRecipes":
- pkg_co = PackagesCollection()
- pkg_co.save_package_provided_file()
-
- elif exec_command == "manifestToList":
- pkg_co = manifestCollection()
- pkg_co.print_list()
-
- else:
- print exec_command, " is not a valid exec_command. \"", " ".join( command_list ), "\""
-
- sys.exit( 0 )
+# def main2():
+# '''
+# main fonction of spec2yocto
+# '''
+# command_list = ["prep", "compile", "install", "createRecipes", "generatePseudoSpecfile"]
+#
+# if len( sys.argv ) < 2 :
+# print "%s take on parameter \"%s\"." % ( sys.argv[0], ", ".join( command_list ) )
+# sys.exit( 1 )
+#
+# exec_command = sys.argv[1]
+# if len( sys.argv ) > 2:
+# spec_path = sys.argv[2]
+# spec_path = spec_path.replace( "\n", "" )
+#
+# if len( sys.argv ) > 3:
+# package_pn = sys.argv[3]
+# else:
+# package_pn = None
+#
+# if exec_command == "prep":
+# print SpecParser( spec_path, package_pn = package_pn ).get_prep_section()
+# res = 0
+#
+# elif exec_command == "compile":
+# res = SpecParser( spec_path, package_pn = package_pn ).get_build_section()
+# if res != 1:
+# print res
+# res = 0
+#
+# elif exec_command == "install":
+# res = SpecParser( spec_path, package_pn = package_pn ).get_install_section()
+# print res
+#
+# elif exec_command == "generatePseudoSpecfile" :
+# a_spec_parser = SpecParser( spec_path )
+# a_spec_parser.parse_raw_spec_file()
+# res = a_spec_parser.get_clean_raw()
+# if res != 1:
+# print res
+# res = 0
+#
+# elif exec_command == "have_macro_configure":
+# a_spec_parser = SpecParser( spec_path )
+# a_spec_parser.parse_raw_spec_file()
+# print a_spec_parser.have_macro_configure()
+# res = 0
+#
+# elif exec_command == "have_macro_reconfigure":
+# a_spec_parser = SpecParser( spec_path )
+# a_spec_parser.parse_raw_spec_file()
+# print a_spec_parser.have_macro_reconfigure()
+# res = 0
+#
+# elif exec_command == "createRecipes":
+# pkg_co = PackagesCollection()
+# pkg_co.save_package_provided_file()
+#
+# elif exec_command == "manifestToList":
+# pkg_co = manifestCollection()
+# pkg_co.print_list()
+#
+# else:
+# print exec_command, " is not a valid exec_command. \"", " ".join( command_list ), "\""
+#
+# sys.exit( 0 )
TERMINAL_COLORS = {"black": "\033[30;1m",
"red": "\033[31;1m",
else:
group_dico_tmp[group].append( package )
-
return group_dico_tmp
pkg_co = manifestCollection( project )
pkg_co.createRecipes()
- def do_findBestSpecFile( self, subcmd, opts, package_path, package_name ):
+ @cmdln.option( "--package_pn",
+ action = "store",
+ default = None,
+ help = "select the package_pn." )
+ def do_findBestSpecFile( self, subcmd, opts, package_path ):
"""${cmd_name}: print the list of package in projects.
${cmd_usage}--
${cmd_option_list}
"""
- res = findBestSpecFile( package_path, package_name )
+ res = findBestSpecFile( package_path, opts.package_pn )
print res
+ @cmdln.option( "--package_pn",
+ action = "append",
+ default = None,
+ help = "select the package_pn." )
+ def do_findSpecPatchFiles( self, subcmd, opts, package_path, ):
+ """${cmd_name}: print the list of package in projects.
+
+ ${cmd_usage}--
+ ${cmd_option_list}
+ """
+ res = findSpecPatchFiles( package_path, opts.package_pn )
+ print " ".join( res )
+
+ @cmdln.option( "--package_pn",
+ action = "append",
+ default = None,
+ help = "select the package_pn." )
+ @cmdln.option( "--project",
+ action = "store",
+ default = None,
+ help = "select the package_pn." )
+ def do_specfile_patcher( self, subcmd, opts, package_spec_path ):
+ """${cmd_name}: print the list of package in projects.
+
+ ${cmd_usage}--
+ ${cmd_option_list}
+ """
+ if opts.project is None:
+ project = SPEC2YOCTO_CONFIG.get_current_project()
+ else:
+ project = opts.project
+
+ res = specfile_patcher( package_spec_path, project, opts.package_pn, package_spec_path )
+
+
def do_createPackagegroup( self, subcmd, opts, project = None ):
"""${cmd_name}: print the list of package in projects.
if res != 1:
print res
-
-
-
def main():
commandline = spec2yoctoCommandline()