Esempio n. 1
0
def list_manifests(git_worktree):
    if not git_worktree.manifests:
        ui.info("No manifest yet. Use qisrc manifest --add to get one")
        return
    ui.info(ui.green, "Manifests configured in", ui.reset, ui.bold, git_worktree.root)
    for name, manifest in git_worktree.manifests.iteritems():
        ui.info(ui.green, " * ", ui.blue, name, ui.reset, "(on %s)" % manifest.branch)
        ui.info(ui.tabs(2), "url:", manifest.url)
        if manifest.groups:
            ui.info(ui.tabs(2), "groups:", ", ".join(manifest.groups))
Esempio n. 2
0
 def _sync_repos(self, old_repos, new_repos, force=False):
     """ Sync the remote repo configurations with the git worktree """
     res = True
     # 1/ create, remove or move the git projects:
     # Compute the work that needs to be done:
     (to_add, to_move, to_rm, to_update) = \
         compute_repo_diff(old_repos, new_repos)
     if to_rm or to_add or to_move or to_update:
         ui.info(ui.green, ":: Computing diff ...")
     if to_rm:
         for repo in to_rm:
             ui.info(ui.red, "* ", ui.reset, "removing", ui.blue, repo.src)
     if to_add:
         for repo in to_add:
             ui.info(ui.green, "* ", ui.reset, "adding", ui.blue, repo.src)
     if to_move:
         for (repo, new_src) in to_move:
             ui.info(ui.brown, "* ", ui.reset, "moving", ui.blue, repo.src,
                     ui.reset, " to ", ui.blue, new_src)
     if to_update:
         for (old_repo, new_repo) in to_update:
             ui.info(ui.green, "* ", ui.reset, "updating", ui.blue,
                     old_repo.src)
             if new_repo.review and not old_repo.review:
                 ui.info(ui.tabs(2), ui.green, "(now using code review)")
             project = self.git_worktree.get_git_project(new_repo.src)
             project.read_remote_config(new_repo)
             project.save_config()
     for repo in to_rm:
         self.git_worktree.remove_repo(repo)
     if to_add:
         ui.info(ui.green, ":: Cloning new repositories ...")
     for i, repo in enumerate(to_add):
         ui.info_count(i, len(to_add), ui.blue, repo.project, ui.green,
                       "->", ui.blue, repo.src, ui.white,
                       "(%s)" % repo.default_branch)
         project = self.git_worktree.get_git_project(repo.src)
         if project:  # Repo is already there, re-apply config
             project.read_remote_config(repo)
             project.save_config()
             continue
         if not self.git_worktree.clone_missing(repo):
             res = False
         else:
             project = self.git_worktree.get_git_project(repo.src)
             project.read_remote_config(repo)
             project.save_config()
     if to_move:
         ui.info(ui.green, ":: Moving repositories ...")
     for (repo, new_src) in to_move:
         if self.git_worktree.move_repo(repo, new_src, force=force):
             project = self.git_worktree.get_git_project(new_src)
             project.read_remote_config(repo)
             project.save_config()
         else:
             res = False
     return res
Esempio n. 3
0
def _use_cmake_cache(args):
    """
    Use cmake cache to get informations about searched package.
    Mandatory to find package dependencies or include dir.
    """
    build_worktree = qibuild.parsers.get_build_worktree(args)
    project = qibuild.parsers.get_one_build_project(build_worktree, args)
    package = args.package
    cache = qibuild.cmake.read_cmake_cache(project.cmake_cache)
    keys = sorted(cache.keys())
    keys = [k for k in keys if k.upper().startswith(package.upper())]
    if not keys:
        ui.error("Nothing found about CMake module: ", package)
        sys.exit(1)
    ui.info("CMake module: ", package)
    for key in keys:
        value = cache[key]
        if not value:
            value = "<empty>"
        ui.info(ui.tabs(1), key, "\n", ui.tabs(2), value)
Esempio n. 4
0
def _use_cmake_cache(args):
    """
    Use cmake cache to get informations about searched package.
    Mandatory to find package dependencies or include dir.
    """
    build_worktree = qibuild.parsers.get_build_worktree(args)
    project = qibuild.parsers.get_one_build_project(build_worktree, args)
    package = args.package
    cache = qibuild.cmake.read_cmake_cache(project.cmake_cache)
    keys = sorted(cache.keys())
    keys = [k for k in keys if k.upper().startswith(package.upper())]
    if not keys:
        ui.error("Nothing found about CMake module: ", package)
        sys.exit(1)
    ui.info("CMake module: ", package)
    for key in keys:
        value = cache[key]
        if not value:
            value = "<empty>"
        ui.info(ui.tabs(1), key, "\n",
                ui.tabs(2), value)
Esempio n. 5
0
    def _sync_repos(self, old_repos, new_repos, force=False):
        """ Sync the remote repo configurations with the git worktree """
        res = True
        ##
        # 1/ create, remove or move the git projects:

        # Compute the work that needs to be done:
        (to_add, to_move, to_rm, to_update) = \
            compute_repo_diff(old_repos, new_repos)

        if to_rm or to_add or to_move or to_update:
            ui.info(ui.green, ":: Computing diff ...")

        if to_rm:
            for repo in to_rm:
                ui.info(ui.red, "* ", ui.reset, "removing", ui.blue, repo.src)
        if to_add:
            for repo in to_add:
                ui.info(ui.green, "* ", ui.reset, "adding", ui.blue, repo.src)

        if to_move:
            for (repo, new_src) in to_move:
                ui.info(ui.brown, "* ", ui.reset, "moving", ui.blue, repo.src,
                        ui.reset, " to ", ui.blue, new_src)

        if to_update:
            for (old_repo, new_repo) in to_update:
                ui.info(ui.green, "* ",
                        ui.reset, "updating", ui.blue, old_repo.src)
                if new_repo.review:
                    ui.info(ui.tabs(2), ui.green, "(now using code review)")
                project = self.git_worktree.get_git_project(new_repo.src)
                project.read_remote_config(new_repo)
                project.apply_config()

        for repo in to_rm:
            self.git_worktree.remove_repo(repo)

        if to_add:
            ui.info(ui.green, ":: Cloning new repositories ...")

        for i, repo in enumerate(to_add):
            ui.info_count(i, len(to_add),
                    ui.blue, repo.project,
                    ui.green, "->",
                    ui.blue, repo.src,
                    ui.white, "(%s)" % repo.default_branch)
            project = self.git_worktree.get_git_project(repo.src)
            if project:  # Repo is already there, re-apply config
                project.read_remote_config(repo)
                project.apply_config()
                continue
            if not self.git_worktree.clone_missing(repo):
                res = False
            else:
                project = self.git_worktree.get_git_project(repo.src)
                project.read_remote_config(repo)
                project.apply_config()

        if to_move:
            ui.info(ui.green, ":: Moving repositories ...")
        for (repo, new_src) in to_move:
            if not self.git_worktree.move_repo(repo, new_src, force=force):
                res = False

        return res