configurationengine/source/scripts/conesub_initvariant.py
changeset 5 d2c80f5cab53
parent 3 e7e0ae78773e
equal deleted inserted replaced
4:0951727b8815 5:d2c80f5cab53
   158         if not coreplat_name or not product:
   158         if not coreplat_name or not product:
   159             print >>sys.stderr, "Could not find coreplat_name or product_name from meta data."
   159             print >>sys.stderr, "Could not find coreplat_name or product_name from meta data."
   160             print >>sys.stderr, "Are you sure the given based-on-configuration is valid?"
   160             print >>sys.stderr, "Are you sure the given based-on-configuration is valid?"
   161             sys.exit(2)
   161             sys.exit(2)
   162         
   162         
   163         path = coreplat_name + '/' + product        
   163         path = coreplat_name + '/' + product
   164                     
   164         
       
   165         # the new way (product)
       
   166         if (os.path.exists(os.path.join(options.project, product, "root.confml"))):
       
   167             path = product
       
   168         # the old way (coreplat/product)
       
   169         elif (os.path.exists(os.path.join(options.project, coreplat_name, product, "root.confml"))):
       
   170             path = coreplat_name + '/' + product
       
   171         # any other way, product root somewhere else (?/?/product/root.confml)
       
   172         else:
       
   173             for root, dirs, files in os.walk(os.path.abspath(options.project)):
       
   174                 if os.path.exists(os.path.join(root, product, "root.confml")):
       
   175                     fullpath = os.path.abspath(os.path.join(root, product, "root.confml"))
       
   176                     m = re.search(r'%s[\\/](.*)[\\/]root.confml' % re.escape(os.path.abspath(options.project)), fullpath)
       
   177                     if m:
       
   178                         path = m.group(1)
       
   179                         path = re.sub(r'\\','/', path)
       
   180                     break
       
   181         
   165         temp_cpf_folder = tempfile.mkdtemp()
   182         temp_cpf_folder = tempfile.mkdtemp()
   166         
   183         
   167         export_options = ExportOptions()
   184         export_options = ExportOptions()
   168         export_options.project = options.project
   185         export_options.project = options.project
   169         export_options.remote = os.path.join(temp_cpf_folder, 'temp.cpf')
   186         export_options.remote = os.path.join(temp_cpf_folder, 'temp.cpf')
   172         export_options.password = options.password
   189         export_options.password = options.password
   173         export_options.config_wildcards = None
   190         export_options.config_wildcards = None
   174         export_options.config_regexes   = None
   191         export_options.config_regexes   = None
   175         export_options.export_dir = None
   192         export_options.export_dir = None
   176         export_options.exclude_content_filter = None
   193         export_options.exclude_content_filter = None
       
   194         export_options.include_content_filter = None
   177         export_options.added = [path + '/customer/custvariant/manual/root.confml',
   195         export_options.added = [path + '/customer/custvariant/manual/root.confml',
   178                                 path + '/customer/custvariant/configurator/root.confml']
   196                                 path + '/customer/custvariant/configurator/root.confml']
   179         export_options.exclude_empty_folders = False
   197         export_options.exclude_empty_folders = False
   180         export_options.action = None
   198         export_options.action = None
   181                 
   199                 
   239             source_project      = source_project,
   257             source_project      = source_project,
   240             target_project      = target_project,
   258             target_project      = target_project,
   241             source_config       = options.sourceconfiguration,
   259             source_config       = options.sourceconfiguration,
   242             target_config       = target_config,
   260             target_config       = target_config,
   243             layer_finder_func   = find_layers,
   261             layer_finder_func   = find_layers,
   244             merge_policy        = MergePolicy.OVERWRITE_LAYER)
   262             merge_policy        = MergePolicy.OVERWRITE_LAYER,
       
   263             find_pattern        = options.find_pattern)
   245         
   264         
   246         if options.set_active_root:
   265         if options.set_active_root:
   247             target_project.get_storage().set_active_configuration(target_config)
   266             target_project.get_storage().set_active_configuration(target_config)
   248     except MergeFailedException, e:
   267     except MergeFailedException, e:
   249         print "Could not initialize variant: %s" % e
   268         print "Could not initialize variant: %s" % e