396 |
408 |
397 Symbian metadata files are subject to preprocessing, primarily with macros based |
409 Symbian metadata files are subject to preprocessing, primarily with macros based |
398 on the selected build platform. This class provides a generic means of wrapping |
410 on the selected build platform. This class provides a generic means of wrapping |
399 up the preprocessing of such files.""" |
411 up the preprocessing of such files.""" |
400 |
412 |
401 def __init__(self, aFilename, gnucpp, aRootLocation=None, log=None): |
413 def __init__(self, aFilename, gnucpp, depfiles, aRootLocation=None, log=None): |
402 """ |
414 """ |
403 @param aFilename An MMP, bld.inf or other preprocessable build spec file |
415 @param aFilename An MMP, bld.inf or other preprocessable build spec file |
404 @param aDefaultPlatform Default preprocessed version of this file |
416 @param aDefaultPlatform Default preprocessed version of this file |
405 @param aCPP location of GNU CPP |
417 @param aCPP location of GNU CPP |
|
418 @param depfiles list to add dependency file tuples to |
|
419 @param aRootLocation where the file is |
406 @param log A class with Debug(<string>), Info(<string>) and Error(<string>) methods |
420 @param log A class with Debug(<string>), Info(<string>) and Error(<string>) methods |
407 """ |
421 """ |
408 self.filename = aFilename |
422 self.filename = aFilename |
409 self.__RootLocation = aRootLocation |
423 self.__RootLocation = aRootLocation |
410 # Dictionary with key of build platform and a text string of processed output as values |
424 # Dictionary with key of build platform and a text string of processed output as values |
411 self.__PreProcessedContent = {} |
425 self.__PreProcessedContent = {} |
412 self.log = log |
426 self.log = log |
|
427 self.depfiles = depfiles |
413 |
428 |
414 self.__gnucpp = gnucpp |
429 self.__gnucpp = gnucpp |
415 if gnucpp is None: |
430 if gnucpp is None: |
416 raise ValueError('gnucpp must be set') |
431 raise ValueError('gnucpp must be set') |
417 |
432 |
513 |
528 |
514 Symbian metadata files are subject to preprocessing, primarily with macros based |
529 Symbian metadata files are subject to preprocessing, primarily with macros based |
515 on the selected build platform. This class provides a generic means of wrapping |
530 on the selected build platform. This class provides a generic means of wrapping |
516 up the preprocessing of such files.""" |
531 up the preprocessing of such files.""" |
517 |
532 |
518 def __init__(self, aFilename, gnucpp, bldinf, log=None): |
533 def __init__(self, aFilename, gnucpp, bldinf, depfiles, log=None): |
519 """ |
534 """ |
520 @param aFilename An MMP, bld.inf or other preprocessable build spec file |
535 @param aFilename An MMP, bld.inf or other preprocessable build spec file |
521 @param gnucpp location of GNU CPP |
536 @param gnucpp location of GNU CPP |
522 @param bldinf the bldinf file that this mmp comes from |
537 @param bldinf the bld.inf file this mmp was specified in |
523 @param log A class with Debug(<string>), Info(<string>) and Error(<string>) methods |
538 @param depfiles list to fill with mmp dependency files |
|
539 @param log A class with Debug(<string>), Info(<string>) and Error(<string>) methods |
524 """ |
540 """ |
525 super(MMPFile, self).__init__(aFilename, gnucpp, str(bldinf.filename.Dir()), log) |
541 super(MMPFile, self).__init__(aFilename, gnucpp, depfiles, str(bldinf.filename.Dir()), log) |
526 self.__bldinf = bldinf |
542 self.__bldinf = bldinf |
|
543 self.depfiles = depfiles |
527 |
544 |
528 self.__gnucpp = gnucpp |
545 self.__gnucpp = gnucpp |
529 if gnucpp is None: |
546 if gnucpp is None: |
530 raise ValueError('gnucpp must be set') |
547 raise ValueError('gnucpp must be set') |
531 |
548 |
1336 self.__Raptor.Warn("DEBUGGABLE keyword has no effect as DEBUGGABLE or DEBUGGABLE_UDEBONLY is already set") |
1356 self.__Raptor.Warn("DEBUGGABLE keyword has no effect as DEBUGGABLE or DEBUGGABLE_UDEBONLY is already set") |
1337 self.__debuggable = "udeb" |
1357 self.__debuggable = "udeb" |
1338 elif varname == 'FEATUREVARIANT': |
1358 elif varname == 'FEATUREVARIANT': |
1339 self.BuildVariant.AddOperation(raptor_data.Set(varname,"1")) |
1359 self.BuildVariant.AddOperation(raptor_data.Set(varname,"1")) |
1340 self.featureVariant = True |
1360 self.featureVariant = True |
|
1361 elif varname in ['COMPRESSTARGET', 'NOCOMPRESSTARGET', 'INFLATECOMPRESSTARGET', 'BYTEPAIRCOMPRESSTARGET']: |
|
1362 if self.__compressionKeyword: |
|
1363 self.__Raptor.Warn("%s keyword in %s overrides earlier use of %s" % (varname, self.__currentMmpFile, self.__compressionKeyword)) |
|
1364 self.BuildVariant.AddOperation(raptor_data.Set(self.__compressionKeyword,"")) |
|
1365 self.__debug( "Set switch " + varname + " OFF") |
|
1366 self.BuildVariant.AddOperation(raptor_data.Set(varname,"1")) |
|
1367 self.__debug( "Set switch " + varname + " ON") |
|
1368 self.__compressionKeyword = varname |
1341 else: |
1369 else: |
1342 self.__debug( "Set switch "+toks[0]+" ON") |
1370 self.__debug( "Set switch "+toks[0]+" ON") |
1343 self.BuildVariant.AddOperation(raptor_data.Set(prefix+varname, "1")) |
1371 self.BuildVariant.AddOperation(raptor_data.Set(prefix+varname, "1")) |
1344 |
1372 |
1345 return "OK" |
1373 return "OK" |
2283 resolvedDefFile = raptor_utilities.resolveSymbianPath(self.__defFileRoot, resolvedDefFile, 'DEFFILE', "", str(aBuildPlatform['EPOCROOT'])) |
2314 resolvedDefFile = raptor_utilities.resolveSymbianPath(self.__defFileRoot, resolvedDefFile, 'DEFFILE', "", str(aBuildPlatform['EPOCROOT'])) |
2284 |
2315 |
2285 return resolvedDefFile |
2316 return resolvedDefFile |
2286 |
2317 |
2287 |
2318 |
|
2319 def CheckedGet(self, key, default = None): |
|
2320 """extract a value from an self and raise an exception if None. |
|
2321 |
|
2322 An optional default can be set to replace a None value. |
|
2323 |
|
2324 This function belongs in the Evaluator class logically. But |
|
2325 Evaluator doesn't know how to raise a Metadata error. Since |
|
2326 being able to raise a metadata error is the whole point of |
|
2327 the method, it makes sense to adapt the Evaluator class from |
|
2328 raptor_meta for the use of everything inside raptor_meta. |
|
2329 |
|
2330 ... so it will be added to the Evaluator class. |
|
2331 """ |
|
2332 |
|
2333 value = self.Get(key) |
|
2334 if value == None: |
|
2335 if default == None: |
|
2336 raise MetaDataError("configuration " + self.buildUnit.name + |
|
2337 " has no variable " + key) |
|
2338 else: |
|
2339 return default |
|
2340 return value |
|
2341 |
|
2342 raptor_data.Evaluator.CheckedGet = CheckedGet |
|
2343 |
|
2344 |
2288 class MetaReader(object): |
2345 class MetaReader(object): |
2289 """Entry point class for Symbian metadata processing. |
2346 """Entry point class for Symbian metadata processing. |
2290 |
2347 |
2291 Provides a means of integrating "traditional" Symbian metadata processing |
2348 Provides a means of integrating "traditional" Symbian metadata processing |
2292 with the new Raptor build system.""" |
2349 with the new Raptor build system.""" |
2321 # and VARIANT_HRH values. Each "build platform" has one associated |
2378 # and VARIANT_HRH values. Each "build platform" has one associated |
2322 # "export platform" but several "build platforms" can be associated |
2379 # "export platform" but several "build platforms" can be associated |
2323 # with the same "export platform". |
2380 # with the same "export platform". |
2324 exports = {} |
2381 exports = {} |
2325 |
2382 |
|
2383 self.__Raptor.Debug("MetaReader: configsToBuild: %s", [b.name for b in configsToBuild]) |
2326 for buildConfig in configsToBuild: |
2384 for buildConfig in configsToBuild: |
2327 # get everything we need to know about the configuration |
2385 # get everything we need to know about the configuration |
2328 evaluator = self.__Raptor.GetEvaluator(None, buildConfig) |
2386 evaluator = self.__Raptor.GetEvaluator(None, buildConfig) |
2329 |
2387 |
2330 detail = {} |
2388 detail = {} |
2331 detail['PLATFORM'] = self.CheckValue(evaluator, "TRADITIONAL_PLATFORM") |
2389 detail['PLATFORM'] = evaluator.CheckedGet("TRADITIONAL_PLATFORM") |
2332 epocroot = self.CheckValue(evaluator, "EPOCROOT") |
2390 epocroot = evaluator.CheckedGet("EPOCROOT") |
2333 detail['EPOCROOT'] = generic_path.Path(epocroot) |
2391 detail['EPOCROOT'] = generic_path.Path(epocroot) |
2334 |
2392 |
2335 sbs_build_dir = self.CheckValue(evaluator, "SBS_BUILD_DIR") |
2393 sbs_build_dir = evaluator.CheckedGet("SBS_BUILD_DIR") |
2336 detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir) |
2394 detail['SBS_BUILD_DIR'] = generic_path.Path(sbs_build_dir) |
2337 flm_export_dir = self.CheckValue(evaluator, "FLM_EXPORT_DIR") |
2395 flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR") |
2338 detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir) |
2396 detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir) |
2339 detail['CACHEID'] = flm_export_dir |
2397 detail['CACHEID'] = flm_export_dir |
2340 if raptor_utilities.getOSPlatform().startswith("win"): |
2398 if raptor_utilities.getOSPlatform().startswith("win"): |
2341 detail['PLATMACROS'] = self.CheckValue(evaluator,"PLATMACROS.WINDOWS") |
2399 detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.WINDOWS") |
2342 else: |
2400 else: |
2343 detail['PLATMACROS'] = self.CheckValue(evaluator,"PLATMACROS.LINUX") |
2401 detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.LINUX") |
2344 |
2402 |
2345 # Apply OS variant provided we are not ignoring this |
2403 # Apply OS variant provided we are not ignoring this |
2346 if not self.__Raptor.ignoreOsDetection: |
2404 if not self.__Raptor.ignoreOsDetection: |
2347 self.__Raptor.Debug("Automatic OS detection enabled.") |
2405 self.__Raptor.Debug("Automatic OS detection enabled.") |
2348 self.ApplyOSVariant(buildConfig, epocroot) |
2406 self.ApplyOSVariant(buildConfig, epocroot) |
2369 variantHRH = variantCfgs[variantCfg] |
2427 variantHRH = variantCfgs[variantCfg] |
2370 detail['ISFEATUREVARIANT'] = False |
2428 detail['ISFEATUREVARIANT'] = False |
2371 |
2429 |
2372 detail['VARIANT_HRH'] = variantHRH |
2430 detail['VARIANT_HRH'] = variantHRH |
2373 self.__Raptor.Info("'%s' uses variant hrh file '%s'", buildConfig.name, variantHRH) |
2431 self.__Raptor.Info("'%s' uses variant hrh file '%s'", buildConfig.name, variantHRH) |
2374 detail['SYSTEMINCLUDE'] = self.CheckValue(evaluator, "SYSTEMINCLUDE") |
2432 detail['SYSTEMINCLUDE'] = evaluator.CheckedGet("SYSTEMINCLUDE") |
2375 |
2433 |
2376 detail['METADEPS'] = [] # Dependency targets for all metadata files in this platform |
|
2377 |
2434 |
2378 # find all the interface names we need |
2435 # find all the interface names we need |
2379 ifaceTypes = self.CheckValue(evaluator, "INTERFACE_TYPES") |
2436 ifaceTypes = evaluator.CheckedGet("INTERFACE_TYPES") |
2380 interfaces = ifaceTypes.split() |
2437 interfaces = ifaceTypes.split() |
2381 |
2438 |
2382 for iface in interfaces: |
2439 for iface in interfaces: |
2383 detail[iface] = self.CheckValue(evaluator, "INTERFACE." + iface) |
2440 detail[iface] = evaluator.CheckedGet("INTERFACE." + iface) |
2384 |
2441 |
2385 # not test code unless positively specified |
2442 # not test code unless positively specified |
2386 detail['TESTCODE'] = self.CheckValue(evaluator, "TESTCODE", "") |
2443 detail['TESTCODE'] = evaluator.CheckedGet("TESTCODE", "") |
2387 |
2444 |
2388 # make a key that identifies this platform uniquely |
2445 # make a key that identifies this platform uniquely |
2389 # - used to tell us whether we have done the pre-processing |
2446 # - used to tell us whether we have done the pre-processing |
2390 # we need already using another platform with compatible values. |
2447 # we need already using another platform with compatible values. |
2391 |
2448 |
2452 |
2509 |
2453 # one platform is picked as the "default" for extracting things |
2510 # one platform is picked as the "default" for extracting things |
2454 # that are supposedly platform independent (e.g. PRJ_PLATFORMS) |
2511 # that are supposedly platform independent (e.g. PRJ_PLATFORMS) |
2455 self.defaultPlatform = self.ExportPlatforms[0] |
2512 self.defaultPlatform = self.ExportPlatforms[0] |
2456 |
2513 |
2457 def CheckValue(self, evaluator, key, default = None): |
2514 |
2458 """extract a value from an evaluator and raise an exception if None. |
2515 def ReadBldInfFiles(self, aComponentList, doexport, dobuild = True): |
2459 |
|
2460 An optional default can be set to replace a None value.""" |
|
2461 value = evaluator.Get(key) |
|
2462 if value == None: |
|
2463 if default == None: |
|
2464 raise MetaDataError("configuration " + evaluator.config.name + |
|
2465 " has no variable " + key) |
|
2466 else: |
|
2467 return default |
|
2468 return value |
|
2469 |
|
2470 def ReadBldInfFiles(self, aFileList, doExportOnly): |
|
2471 """Take a list of bld.inf files and return a list of build specs. |
2516 """Take a list of bld.inf files and return a list of build specs. |
2472 |
2517 |
2473 The returned specification nodes will be suitable for all the build |
2518 The returned specification nodes will be suitable for all the build |
2474 configurations under consideration (using Filter nodes where required). |
2519 configurations under consideration (using Filter nodes where required). |
2475 """ |
2520 """ |
2476 |
2521 |
2477 # we need a Filter node per export platform |
2522 # we need a Filter node per export platform |
2478 exportNodes = [] |
2523 exportNodes = [] |
2479 for i,ep in enumerate(self.ExportPlatforms): |
2524 for i,ep in enumerate(self.ExportPlatforms): |
2480 filter = raptor_data.Filter("export_" + str(i)) |
2525 filter = raptor_data.Filter(name = "export_" + str(i)) |
2481 |
2526 |
2482 # what configurations is this node active for? |
2527 # what configurations is this node active for? |
2483 for config in ep['configs']: |
2528 for config in ep['configs']: |
2484 filter.AddConfigCondition(config.name) |
2529 filter.AddConfigCondition(config.name) |
2485 |
2530 |
2486 exportNodes.append(filter) |
2531 exportNodes.append(filter) |
2487 |
2532 |
2488 # we need a Filter node per build platform |
2533 # we need a Filter node per build platform |
2489 platformNodes = [] |
2534 platformNodes = [] |
2490 for i,bp in enumerate(self.BuildPlatforms): |
2535 for i,bp in enumerate(self.BuildPlatforms): |
2491 filter = raptor_data.Filter("build_" + str(i)) |
2536 filter = raptor_data.Filter(name = "build_" + str(i)) |
2492 |
2537 |
2493 # what configurations is this node active for? |
2538 # what configurations is this node active for? |
2494 for config in bp['configs']: |
2539 for config in bp['configs']: |
2495 filter.AddConfigCondition(config.name) |
2540 filter.AddConfigCondition(config.name) |
2496 |
2541 |
2502 filter.AddVariant(platformVar) |
2547 filter.AddVariant(platformVar) |
2503 platformNodes.append(filter) |
2548 platformNodes.append(filter) |
2504 |
2549 |
2505 # check that each bld.inf exists and add a Specification node for it |
2550 # check that each bld.inf exists and add a Specification node for it |
2506 # to the nodes of the export and build platforms that it supports. |
2551 # to the nodes of the export and build platforms that it supports. |
2507 for bif in aFileList: |
2552 for c in aComponentList: |
2508 if bif.isFile(): |
2553 if c.bldinf_filename.isFile(): |
2509 self.__Raptor.Info("Processing %s", str(bif)) |
2554 self.__Raptor.Info("Processing %s", str(c.bldinf_filename)) |
2510 try: |
2555 try: |
2511 self.AddComponentNodes(bif, exportNodes, platformNodes) |
2556 self.AddComponentNodes(c, exportNodes, platformNodes) |
2512 |
2557 |
2513 except MetaDataError, e: |
2558 except MetaDataError, e: |
2514 self.__Raptor.Error(e.Text, bldinf=str(bif)) |
2559 self.__Raptor.Error(e.Text, bldinf=str(c.bldinf_filename)) |
2515 if not self.__Raptor.keepGoing: |
2560 if not self.__Raptor.keepGoing: |
2516 return [] |
2561 return [] |
2517 else: |
2562 else: |
2518 self.__Raptor.Error("build info file does not exist", bldinf=str(bif)) |
2563 self.__Raptor.Error("build info file does not exist", bldinf=str(c.bldinf_filename)) |
2519 if not self.__Raptor.keepGoing: |
2564 if not self.__Raptor.keepGoing: |
2520 return [] |
2565 return [] |
2521 |
2566 |
2522 # now we have the top-level structure in place... |
2567 # now we have the top-level structure in place... |
2523 # |
2568 # |
2545 |
2590 |
2546 # we now need to process the EXPORTS for all the bld.inf nodes |
2591 # we now need to process the EXPORTS for all the bld.inf nodes |
2547 # before we can do anything else (because raptor itself must do |
2592 # before we can do anything else (because raptor itself must do |
2548 # some exports before the MMP files that include them can be |
2593 # some exports before the MMP files that include them can be |
2549 # processed). |
2594 # processed). |
2550 for i,p in enumerate(exportNodes): |
2595 if doexport: |
2551 exportPlatform = self.ExportPlatforms[i] |
2596 for i,p in enumerate(exportNodes): |
2552 for s in p.GetChildSpecs(): |
2597 exportPlatform = self.ExportPlatforms[i] |
2553 try: |
2598 for s in p.GetChildSpecs(): |
2554 self.ProcessExports(s, exportPlatform) |
2599 try: |
2555 |
2600 self.ProcessExports(s, exportPlatform) |
2556 except MetaDataError, e: |
2601 |
2557 self.__Raptor.Error("%s",e.Text) |
2602 except MetaDataError, e: |
2558 if not self.__Raptor.keepGoing: |
2603 self.__Raptor.Error("%s",e.Text) |
2559 return [] |
2604 if not self.__Raptor.keepGoing: |
|
2605 return [] |
|
2606 else: |
|
2607 self.__Raptor.Info("Not Processing Exports (--noexport enabled)") |
2560 |
2608 |
2561 # this is a switch to return the function at this point if export |
2609 # this is a switch to return the function at this point if export |
2562 # only option is specified in the run |
2610 # only option is specified in the run |
2563 if (self.__Raptor.doExportOnly): |
2611 if dobuild is not True: |
2564 self.__Raptor.Info("Processing Exports only") |
2612 self.__Raptor.Info("Processing Exports only") |
2565 return[] |
2613 return[] |
2566 |
2614 |
2567 # after exports are done we can look to see if there are any |
2615 # after exports are done we can look to see if there are any |
2568 # new Interfaces which can be used for EXTENSIONS. Make sure |
2616 # new Interfaces which can be used for EXTENSIONS. Make sure |
2615 if moduleName == "" or moduleName.endswith(":"): |
2663 if moduleName == "" or moduleName.endswith(":"): |
2616 moduleName = "module" |
2664 moduleName = "module" |
2617 return moduleName |
2665 return moduleName |
2618 |
2666 |
2619 |
2667 |
2620 def AddComponentNodes(self, buildFile, exportNodes, platformNodes): |
2668 def AddComponentNodes(self, component, exportNodes, platformNodes): |
2621 """Add Specification nodes for a bld.inf to the appropriate platforms.""" |
2669 """Add Specification nodes for a bld.inf to the appropriate platforms.""" |
2622 bldInfFile = BldInfFile(buildFile, self.__gnucpp, self.__Raptor) |
2670 bldInfFile = BldInfFile(component.bldinf_filename, self.__gnucpp, component.depfiles, self.__Raptor) |
2623 |
2671 component.bldinf = bldInfFile |
2624 specName = self.getSpecName(buildFile, fullPath=True) |
2672 |
2625 |
2673 specName = getSpecName(component.bldinf_filename, fullPath=True) |
2626 if isinstance(buildFile, raptor_xml.SystemModelComponent): |
2674 |
|
2675 if isinstance(component.bldinf, raptor_xml.SystemModelComponent): |
2627 # this component came from a system_definition.xml |
2676 # this component came from a system_definition.xml |
2628 layer = buildFile.GetContainerName("layer") |
2677 layer = component.bldinf.GetContainerName("layer") |
2629 component = buildFile.GetContainerName("component") |
2678 componentName = component.bldinf.GetContainerName("component") |
2630 else: |
2679 else: |
2631 # this is a plain old bld.inf file from the command-line |
2680 # this is a plain old bld.inf file from the command-line |
2632 layer = "" |
2681 layer = "" |
2633 component = "" |
2682 componentName = "" |
2634 |
2683 |
2635 # exports are independent of build platform |
2684 # exports are independent of build platform |
2636 for i,ep in enumerate(self.ExportPlatforms): |
2685 for i,ep in enumerate(self.ExportPlatforms): |
2637 specNode = raptor_data.Specification(specName) |
2686 specNode = raptor_data.Specification(name = specName) |
2638 |
2687 |
2639 # keep the BldInfFile object for later |
2688 # keep the BldInfFile object for later |
2640 specNode.bldinf = bldInfFile |
2689 specNode.component = component |
2641 |
2690 |
2642 # add some basic data in a component-wide variant |
2691 # add some basic data in a component-wide variant |
2643 var = raptor_data.Variant() |
2692 var = raptor_data.Variant(name='component-wide') |
2644 var.AddOperation(raptor_data.Set("COMPONENT_META", str(buildFile))) |
2693 var.AddOperation(raptor_data.Set("COMPONENT_META", str(component.bldinf_filename))) |
2645 var.AddOperation(raptor_data.Set("COMPONENT_NAME", component)) |
2694 var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName)) |
2646 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2695 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2647 specNode.AddVariant(var) |
2696 specNode.AddVariant(var) |
2648 |
2697 |
2649 # add this bld.inf Specification to the export platform |
2698 # add this bld.inf Specification to the export platform |
2650 exportNodes[i].AddChild(specNode) |
2699 exportNodes[i].AddChild(specNode) |
|
2700 component.exportspecs.append(specNode) |
2651 |
2701 |
2652 # get the relevant build platforms |
2702 # get the relevant build platforms |
2653 listedPlatforms = bldInfFile.getBuildPlatforms(self.defaultPlatform) |
2703 listedPlatforms = bldInfFile.getBuildPlatforms(self.defaultPlatform) |
2654 platforms = getBuildableBldInfBuildPlatforms(listedPlatforms, |
2704 platforms = getBuildableBldInfBuildPlatforms(listedPlatforms, |
2655 self.__defaultplatforms, |
2705 self.__defaultplatforms, |
2656 self.__basedefaultplatforms, |
2706 self.__basedefaultplatforms, |
2657 self.__baseuserdefaultplatforms) |
2707 self.__baseuserdefaultplatforms) |
2658 |
2708 |
2659 |
2709 |
2660 |
2710 outputDir = BldInfFile.outputPathFragment(component.bldinf_filename) |
2661 outputDir = BldInfFile.outputPathFragment(buildFile) |
|
2662 |
2711 |
2663 # Calculate "module name" |
2712 # Calculate "module name" |
2664 modulename = self.ModuleName(str(buildFile)) |
2713 modulename = self.ModuleName(str(component.bldinf_filename)) |
2665 |
2714 |
2666 for i,bp in enumerate(self.BuildPlatforms): |
2715 for i,bp in enumerate(self.BuildPlatforms): |
|
2716 plat = bp['PLATFORM'] |
2667 if bp['PLATFORM'] in platforms: |
2717 if bp['PLATFORM'] in platforms: |
2668 specNode = raptor_data.Specification(specName) |
2718 specNode = raptor_data.Specification(name = specName) |
2669 |
2719 |
2670 # keep the BldInfFile object for later |
2720 # remember what component this spec node comes from for later |
2671 specNode.bldinf = bldInfFile |
2721 specNode.component = component |
2672 |
2722 |
2673 # add some basic data in a component-wide variant |
2723 # add some basic data in a component-wide variant |
2674 var = raptor_data.Variant() |
2724 var = raptor_data.Variant(name='component-wide-settings-' + plat) |
2675 var.AddOperation(raptor_data.Set("COMPONENT_META",str(buildFile))) |
2725 var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename))) |
2676 var.AddOperation(raptor_data.Set("COMPONENT_NAME", component)) |
2726 var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName)) |
2677 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2727 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2678 var.AddOperation(raptor_data.Set("MODULE", modulename)) |
2728 var.AddOperation(raptor_data.Set("MODULE", modulename)) |
2679 var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/')) |
2729 var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/')) |
2680 var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/')) |
2730 var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/')) |
2681 var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/')) |
2731 var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/')) |
2682 |
2732 |
2683 var.AddOperation(raptor_data.Set("TEST_OPTION", specNode.bldinf.getRomTestType(bp))) |
2733 var.AddOperation(raptor_data.Set("TEST_OPTION", component.bldinf.getRomTestType(bp))) |
2684 specNode.AddVariant(var) |
2734 specNode.AddVariant(var) |
2685 |
2735 |
2686 # add this bld.inf Specification to the build platform |
2736 # add this bld.inf Specification to the build platform |
2687 platformNodes[i].AddChild(specNode) |
2737 platformNodes[i].AddChild(specNode) |
|
2738 # also attach it into the component |
|
2739 component.specs.append(specNode) |
2688 |
2740 |
2689 def ProcessExports(self, componentNode, exportPlatform): |
2741 def ProcessExports(self, componentNode, exportPlatform): |
2690 """Do the exports for a given platform and skeleton bld.inf node. |
2742 """Do the exports for a given platform and skeleton bld.inf node. |
2691 |
2743 |
2692 This will actually perform exports as certain types of files (.mmh) |
2744 This will actually perform exports as certain types of files (.mmh) |
2694 (and parts of other bld.inf nodes) can be processed. |
2746 (and parts of other bld.inf nodes) can be processed. |
2695 |
2747 |
2696 [some MMP files #include exported .mmh files] |
2748 [some MMP files #include exported .mmh files] |
2697 """ |
2749 """ |
2698 if exportPlatform["TESTCODE"]: |
2750 if exportPlatform["TESTCODE"]: |
2699 exports = componentNode.bldinf.getTestExports(exportPlatform) |
2751 exports = componentNode.component.bldinf.getTestExports(exportPlatform) |
2700 else: |
2752 else: |
2701 exports = componentNode.bldinf.getExports(exportPlatform) |
2753 exports = componentNode.component.bldinf.getExports(exportPlatform) |
2702 |
2754 |
2703 self.__Raptor.Debug("%i exports for %s", |
2755 self.__Raptor.Debug("%i exports for %s", |
2704 len(exports), str(componentNode.bldinf.filename)) |
2756 len(exports), str(componentNode.component.bldinf.filename)) |
2705 if exports: |
2757 if exports: |
2706 |
2758 |
2707 # each export is either a 'copy' or 'unzip' |
2759 # each export is either a 'copy' or 'unzip' |
2708 # maybe we should trap multiple exports to the same location here? |
2760 # maybe we should trap multiple exports to the same location here? |
2709 epocroot = str(exportPlatform["EPOCROOT"]) |
2761 epocroot = str(exportPlatform["EPOCROOT"]) |
2710 bldinf_filename = str(componentNode.bldinf.filename) |
2762 bldinf_filename = str(componentNode.component.bldinf.filename) |
2711 exportwhatlog="<whatlog bldinf='%s' mmp='' config=''>\n" % bldinf_filename |
2763 exportwhatlog="<whatlog bldinf='%s' mmp='' config=''>\n" % bldinf_filename |
2712 for export in exports: |
2764 for export in exports: |
2713 expSrc = export.getSource() |
2765 expSrc = export.getSource() |
2714 expDstList = export.getDestination() # Might not be a list in all circumstances |
2766 expDstList = export.getDestination() # Might not be a list in all circumstances |
2715 |
2767 |
2876 if os.path.exists(expfilename): |
2927 if os.path.exists(expfilename): |
2877 os.chmod(expfilename,stat.S_IREAD | stat.S_IWRITE) |
2928 os.chmod(expfilename,stat.S_IREAD | stat.S_IWRITE) |
2878 expfile = open(expfilename, 'wb') |
2929 expfile = open(expfilename, 'wb') |
2879 expfile.write(exportzip.read(file)) |
2930 expfile.write(exportzip.read(file)) |
2880 expfile.close() |
2931 expfile.close() |
|
2932 |
|
2933 # Resurrect any file execution permissions present in the archived version |
|
2934 if (exportzip.getinfo(file).external_attr >> 16L) & 0100: |
|
2935 os.chmod(expfilename, stat.S_IMODE(os.stat(expfilename).st_mode) | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) |
|
2936 |
2881 # Each file keeps its modified time the same as what it was before unzipping |
2937 # Each file keeps its modified time the same as what it was before unzipping |
2882 accesstime = time.time() |
2938 accesstime = time.time() |
2883 datetime = exportzip.getinfo(file).date_time |
2939 datetime = exportzip.getinfo(file).date_time |
2884 timeTuple=(int(datetime[0]), int(datetime[1]), int(datetime[2]), int(datetime[3]), \ |
2940 timeTuple=(int(datetime[0]), int(datetime[1]), int(datetime[2]), int(datetime[3]), \ |
2885 int(datetime[4]), int(datetime[5]), int(0), int(0), int(0)) |
2941 int(datetime[4]), int(datetime[5]), int(0), int(0), int(0)) |
3203 value = value.replace('$/', '/').replace('$;', ':') |
3276 value = value.replace('$/', '/').replace('$;', ':') |
3204 var.AddOperation(raptor_data.Set(standardVariable, value)) |
3277 var.AddOperation(raptor_data.Set(standardVariable, value)) |
3205 gnuSpec.AddVariant(var) |
3278 gnuSpec.AddVariant(var) |
3206 componentNode.AddChild(gnuSpec) |
3279 componentNode.AddChild(gnuSpec) |
3207 |
3280 |
3208 def getSpecName(self, aFileRoot, fullPath=False): |
|
3209 """Returns a build spec name: this is the file root (full path |
|
3210 or simple file name) made safe for use as a file name.""" |
|
3211 |
|
3212 if fullPath: |
|
3213 specName = str(aFileRoot).replace("/","_") |
|
3214 specName = specName.replace(":","") |
|
3215 else: |
|
3216 specName = aFileRoot.File() |
|
3217 |
|
3218 return specName.lower() |
|
3219 |
3281 |
3220 def ApplyOSVariant(self, aBuildUnit, aEpocroot): |
3282 def ApplyOSVariant(self, aBuildUnit, aEpocroot): |
3221 # Form path to kif.xml and path to buildinfo.txt |
3283 # Form path to kif.xml and path to buildinfo.txt |
3222 kifXmlPath = generic_path.Join(aEpocroot, "epoc32", "data","kif.xml") |
3284 kifXmlPath = generic_path.Join(aEpocroot, "epoc32", "data","kif.xml") |
3223 buildInfoTxtPath = generic_path.Join(aEpocroot, "epoc32", "data","buildinfo.txt") |
3285 buildInfoTxtPath = generic_path.Join(aEpocroot, "epoc32", "data","buildinfo.txt") |