Example #1
0
    def _load_repo(self, repo_path):
        repo_layout, layout_config_path = repolayoututil.get_repo_layout(
            repo_path)
        if layout_config_path:
            logutil.start_msg('Using layout configuration from')
            logutil.end_msg(layout_config_path)
        for gd in repo_layout.group_dirs:
            gd_path = os.path.join(repo_path, gd)
            if os.path.isdir(gd_path):
                self._load_repo_package_groups(gd_path)

        for sad in repo_layout.stand_alone_package_dirs:
            sad_path = os.path.join(repo_path, sad)
            if os.path.isdir(sad_path):
                self._load_repo_stdalone_packages(
                    sad_path, repounits.PackageType.PACKAGE_STAND_ALONE)

        for sad in repo_layout.app_package_dirs:
            sad_path = os.path.join(repo_path, sad)
            if os.path.isdir(sad_path):
                self._load_repo_stdalone_packages(
                    sad_path, repounits.PackageType.PACKAGE_APPLICATION)

        for sad in repo_layout.third_party_package_dirs:
            sad_path = os.path.join(repo_path, sad)
            if os.path.isdir(sad_path):
                self._load_repo_thirdparty_dirs(sad_path)

        for pg in repo_layout.group_abs_dirs:
            if pg == '.':
                pg_path = repo_path
            else:
                pg_path = os.path.join(repo_path, pg)
            if repoloadutil.is_package_group_path(pg_path):
                self._load_repo_one_package_group(pg_path)
Example #2
0
 def _verify_cycles_impl(self, digraph):
     cycles = graphutil.find_cycles(digraph)
     if len(cycles) == 0:
         logutil.end_msg('ok')
     else:
         logutil.end_msg('found cycle(s)', color='RED')
         for cycle in cycles:
             logutil.warn('CYCLE: ' + ','.join(cycle))
         self.is_success = False
 def _verify_cycles_impl(self, digraph):
     cycles = graphutil.find_cycles(digraph)
     if len(cycles) == 0:
         logutil.end_msg('ok')
     else:
         logutil.end_msg('found cycle(s)', color='RED')
         for cycle in cycles:
             logutil.warn('CYCLE: ' + ','.join(cycle))
         self.is_success = False
Example #4
0
    def _load_repo_thirdparty_dirs(self, path):
        dirs = next(os.walk(path))[1]
        tp_paths = []
        for d in dirs:
            dir_path = os.path.join(path, d)
            if repoloadutil.is_third_party_path(dir_path):
                tp_paths.append(dir_path)

        for path in tp_paths:
            third_party = repounits.ThirdPartyDir(path)
            logutil.start_msg('Loading %s' % third_party.name)
            self.repo_context.add_unit(third_party)
            logutil.end_msg('ok')
Example #5
0
    def _load_repo_stdalone_packages(self, path, type_):
        dirs = next(os.walk(path))[1]
        package_paths = []
        for d in dirs:
            dir_path = os.path.join(path, d)
            if repoloadutil.is_package_path(dir_path):
                package_paths.append(dir_path)

        for path in package_paths:
            logutil.start_msg('Loading %s' % os.path.basename(path))
            package = repoloadutil.load_package(path, type_)
            self.repo_context.add_unit(package)
            logutil.end_msg('ok')
Example #6
0
    def _load_repo_one_package_group(self, path):
        logutil.start_msg('Loading %s' % os.path.basename(path))
        package_group = repoloadutil.load_package_group(path)
        self.repo_context.add_unit(package_group)

        for package_name in package_group.mem:
            package_path = os.path.join(package_group.path, package_name)
            if os.path.basename(package_path).find('+') >= 0:
                package = repoloadutil.load_package(
                    package_path, repounits.PackageType.PACKAGE_PLUS)
            else:
                package = repoloadutil.load_package(
                    package_path, repounits.PackageType.PACKAGE_NORMAL)
            self.repo_context.add_unit(package)
        logutil.end_msg('ok')
Example #7
0
    def load(self):
        """Load the repo context.

        Raises:
            InvalidConfigFileError:  The layout configuration is invalid.
        """
        root_path = self.repo_context.root_path
        if os.path.isfile(os.path.join(root_path,
                                       '.bdeworkspaceconfig')):
            dirs = next(os.walk(root_path))[1]
            for d in dirs:
                dir_path = os.path.join(root_path, d)
                if repoloadutil.is_bde_repo_path(dir_path):
                    logutil.start_msg('Entering repo')
                    logutil.end_msg(os.path.basename(dir_path), color='YELLOW')
                    self._load_repo(dir_path)
        else:
            self._load_repo(root_path)
        self._load_uor_doc_and_versions()