depends_res[self.__base_name] = build_requires_list
else:
depends_res[package_name] = build_requires_list
-
return depends_res
def __clean_package_line( self, package_line ):
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 )
-
TERMINAL_COLORS = {"black": "\033[30;1m",
"red": "\033[31;1m",
"green": "\033[32;1m",
for pkg in group_dico[group]:
group_file.write( "RDEPENDS_${PN} += \"%s\"\n" % pkg )
+def generateBuildStatus( project_path ):
+ res_native = {}
+ res = {}
+ if not os.path.isdir( project_path ):
+ msg = "The path \"%s\" is not a directory."
+ msg = msg % ( project_path )
+ print >> sys.stderr, colorize( msg, "red" )
+ sys.exit( 1 )
+
+ for package_path in os.listdir( project_path ):
+ project_full_path = os.path.join( project_path, package_path )
+ if ( package_path == "build_stats" ) and os.path.isfile( project_full_path ) :
+ pass
+
+ elif os.path.isdir( project_full_path ):
+ BN, PV, PR = cleanPackageName( package_path )
+ res_status = check_package_status( project_full_path )
+
+ if BN.endswith("-native"):
+ res_native[BN] = [PV ] + res_status
+ else:
+ res[BN] = [PV ] + res_status
+
+ # ignorefiles
+ elif package_path in ["."]:
+ pass
+
+ else:
+ msg = "This directory should not contain the file \"%s\"."
+ msg = msg % ( package_path )
+ print >> sys.stderr, colorize( msg, "red" )
+ sys.exit( 1 )
+
+ return res_native, res
+
+def cleanPackageName( package_path ):
+ if package_path.count( "-" ) < 2:
+ msg = "unknow format for package \"%s\"."
+ msg = msg % ( package_path )
+ print >> sys.stderr, colorize( msg, "red" )
+ sys.exit( 1 )
+
+ PR=package_path[package_path.rindex("-")+1:]
+ package_path=package_path[:package_path.rindex("-")]
+ PV=package_path[package_path.rindex("-")+1:]
+ BN=package_path[:package_path.rindex("-")]
+
+ return BN, PV, PR
+
+
+def check_package_status( project_full_path ):
+ tasks_order = ["do_fetch",
+ "do_unpack",
+ "do_patch",
+ "do_populate_lic",
+ "do_configure",
+ "do_compile",
+ "do_install",
+ "do_populate_sysroot",
+ "do_package",
+ "do_packagedata",
+ "do_package_write_rpm"]
+
+ max_index=-1
+ for package_task in os.listdir( project_full_path ):
+ if package_task in tasks_order:
+ task_index = tasks_order.index( package_task )
+
+ if task_index > max_index:
+ max_index = task_index
+
+ if max_index == -1:
+ msg = "No log task in \"%s\"."
+ msg = msg % ( project_full_path )
+ print >> sys.stderr, colorize( msg, "red" )
+ sys.exit( 1 )
+
+ last_task = tasks_order[max_index][3:]
+
+ task_status = ""
+ status = "unknow"
+ with open( os.path.join( project_full_path, tasks_order[max_index] ) ) as status_file:
+ for line in status_file:
+ if line.startswith( "Status: " ):
+ status = line[len( "Status: " ):].replace( "\n", "" ).replace( " ", "" )
+ break
+ if last_task == "package_write_rpm" and status == "PASSED":
+ status = "OK"
+
+ return [last_task, status]
+
+
+
+
def clean_Packagegroup( project,group_dico ):
group_dico_tmp = {}
action = "store",
default = None,
help = "run the in debug mode.[yes/no]" )
+ def do_generateBuildStatus( self, subcmd, opts, project_path ):
+ """${cmd_name}: print the list of package in projects.
+
+ ${cmd_usage}--
+ ${cmd_option_list}
+ """
+ global DEBUG_RUN
+ if opts.debug == "no":
+ DEBUG_RUN = False
+ elif opts.debug == "yes":
+ DEBUG_RUN = True
+
+ res_native, res = generateBuildStatus( project_path )
+
+ res_native_keys = res_native.keys()
+ res_keys = res.keys()
+
+ res_native_keys.sort()
+ res_keys.sort()
+
+ for r in res_native_keys:
+ print r + "\t" + "\t".join( res_native[r] )
+ print
+ for r in res_keys:
+ print r + "\t" + "\t".join( res[r] )
+
+
+ @cmdln.option( "--debug",
+ action = "store",
+ default = None,
+ help = "run the in debug mode.[yes/no]" )
def do_generatePseudoSpecfile( self, subcmd, opts, spec_path ):
"""${cmd_name}: print the list of package in projects.