How to use the kas.repos.Repo.get_root_path function in kas

To help you get started, we’ve selected a few kas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github siemens / kas / kas / repos.py View on Github external
'default repo specified.', p)
                sys.exit(1)
            patches.append(this_patch)

        url = repo_config.get('url', None)
        name = repo_config.get('name', name)
        typ = repo_config.get('type', 'git')
        refspec = repo_config.get('refspec',
                                  repo_defaults.get('refspec', None))
        path = repo_config.get('path', None)
        disable_operations = False

        if url is None:
            # No version control operation on repository
            if path is None:
                path = Repo.get_root_path(repo_fallback_path)
                logging.info('Using %s as root for repository %s', path,
                             name)

            url = path
            disable_operations = True
        else:
            if path is None:
                path = os.path.join(get_context().kas_work_dir, name)
            else:
                if not os.path.isabs(path):
                    # Relative pathes are assumed to start from work_dir
                    path = os.path.join(get_context().kas_work_dir, path)

        if typ == 'git':
            return GitRepo(url, path, refspec, layers, patches,
                           disable_operations)
github siemens / kas / kas / config.py View on Github external
def __init__(self, filename, target, task=None):
        self._override_target = target
        self._override_task = task
        self._config = {}
        self.filenames = []

        for configfile in filename.split(':'):
            configfile = os.path.abspath(configfile)
            repo_path = Repo.get_root_path(os.path.dirname(configfile),
                                           fallback=False)
            if self.filenames == []:
                common_path = repo_path
            elif repo_path != common_path:
                raise IncludeException('All concatenated config files must '
                                       'belong to the same repository or all '
                                       'must be outside of versioning control')
            self.filenames.append(configfile)

        self.handler = IncludeHandler(self.filenames)
        self.repo_dict = self._get_repo_dict()