Fix --target and --task options
They were ignored so far is the config file was specifying a target or a task, respectively. But the proper priority is (in descending order): 1. command line options 2. environment (KAS_TARGET, KAS_TASK) 3. kas config Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
		
				
					committed by
					
						
						Daniel Wagner
					
				
			
			
				
	
			
			
			
						parent
						
							0eb2f5edeb
						
					
				
				
					commit
					fe344f93f1
				
			@@ -36,6 +36,8 @@ class Config:
 | 
				
			|||||||
        Implements the kas configuration based on config files.
 | 
					        Implements the kas configuration based on config files.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    def __init__(self, filename, target, task=None):
 | 
					    def __init__(self, filename, target, task=None):
 | 
				
			||||||
 | 
					        self._override_target = target
 | 
				
			||||||
 | 
					        self._override_task = task
 | 
				
			||||||
        self._config = {}
 | 
					        self._config = {}
 | 
				
			||||||
        self.filenames = []
 | 
					        self.filenames = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,11 +56,6 @@ class Config:
 | 
				
			|||||||
        self.handler = IncludeHandler(self.filenames)
 | 
					        self.handler = IncludeHandler(self.filenames)
 | 
				
			||||||
        self.repo_dict = self._get_repo_dict()
 | 
					        self.repo_dict = self._get_repo_dict()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if target:
 | 
					 | 
				
			||||||
            self._config['target'] = target
 | 
					 | 
				
			||||||
        if task:
 | 
					 | 
				
			||||||
            self._config['task'] = task
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def find_missing_repos(self):
 | 
					    def find_missing_repos(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
            Returns repos that are in config but not on disk
 | 
					            Returns repos that are in config but not on disk
 | 
				
			||||||
@@ -101,6 +98,8 @@ class Config:
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
            Returns a list of bitbake targets
 | 
					            Returns a list of bitbake targets
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					        if self._override_target:
 | 
				
			||||||
 | 
					            return self._override_target
 | 
				
			||||||
        environ_targets = [i
 | 
					        environ_targets = [i
 | 
				
			||||||
                           for i in os.environ.get('KAS_TARGET', '').split()
 | 
					                           for i in os.environ.get('KAS_TARGET', '').split()
 | 
				
			||||||
                           if i]
 | 
					                           if i]
 | 
				
			||||||
@@ -115,6 +114,8 @@ class Config:
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
            Returns the bitbake task
 | 
					            Returns the bitbake task
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					        if self._override_task:
 | 
				
			||||||
 | 
					            return self._override_task
 | 
				
			||||||
        return os.environ.get('KAS_TASK',
 | 
					        return os.environ.get('KAS_TASK',
 | 
				
			||||||
                              self._config.get('task', 'build'))
 | 
					                              self._config.get('task', 'build'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user