Exemplo n.º 1
0
def show_config(args, build_worktree):
    """ Show Config """
    is_local = args.is_local
    if is_local and not build_worktree:
        raise Exception("Cannot use --local when not in a worktree")
    qibuild_cfg = qibuild.config.QiBuildConfig()
    qibuild_cfg.read(create_if_missing=True)
    if args.edit:
        editor = qibuild_cfg.defaults.env.editor
        if not editor:
            editor = qisys.interact.get_editor()
            qibuild_cfg.defaults.env.editor = editor
            qibuild_cfg.write()
        full_path = qisys.command.find_program(editor)
        if is_local:
            cfg_path = build_worktree.qibuild_xml
        else:
            cfg_path = qibuild.config.get_global_cfg_path()
        subprocess.call([full_path, cfg_path])
        return
    if not build_worktree:
        print(qibuild_cfg)
        return
    if not is_local:
        print("General configuration")
        print("---------------------")
        print(ui.indent(str(qibuild_cfg)))
        print("")
    print("Local configuration")
    print("-------------------")
    print(ui.indent(str(qibuild_cfg.local)))
Exemplo n.º 2
0
def show_config(args, build_worktree):
    """ Show Config """
    is_local = args.is_local
    if is_local and not build_worktree:
        raise Exception("Cannot use --local when not in a worktree")
    qibuild_cfg = qibuild.config.QiBuildConfig()
    qibuild_cfg.read(create_if_missing=True)
    if args.edit:
        editor = qibuild_cfg.defaults.env.editor
        if not editor:
            editor = qisys.interact.get_editor()
            qibuild_cfg.defaults.env.editor = editor
            qibuild_cfg.write()
        full_path = qisys.command.find_program(editor)
        if is_local:
            cfg_path = build_worktree.qibuild_xml
        else:
            cfg_path = qibuild.config.get_global_cfg_path()
        subprocess.call([full_path, cfg_path])
        return
    if not build_worktree:
        print(qibuild_cfg)
        return
    if not is_local:
        print("General configuration")
        print("---------------------")
        print(ui.indent(str(qibuild_cfg)))
        print("")
    print("Local configuration")
    print("-------------------")
    print(ui.indent(str(qibuild_cfg.local)))
Exemplo n.º 3
0
def do(args):
    """Main entry point"""
    git_worktree = qisrc.parsers.get_git_worktree(args)
    sync_ok = git_worktree.sync()
    git_projects = qisrc.parsers.get_git_projects(git_worktree, args,
                                                  default_all=True,
                                                  use_build_deps=True)
    if not git_projects:
        qisrc.worktree.on_no_matching_projects(git_worktree, groups=args.groups)
        return
    git_worktree.configure_projects(git_projects)
    skipped = list()
    failed = list()
    ui.info(ui.green, ":: Syncing projects ...")
    max_src = max(len(x.src) for x in git_projects)
    for (i, git_project) in enumerate(git_projects):
        ui.info_count(i, len(git_projects),
                      ui.blue, git_project.src.ljust(max_src), end="\r")

        (status, out) = git_project.sync(rebase_devel=args.rebase_devel)
        if status is None:
            ui.info("\n", "\n", ui.brown, git_project.src, "  [skipped]")
            skipped.append((git_project.src, out))
        if status is False:
            ui.info("\n", "\n", git_project.src, ui.red, "  [failed]")
            failed.append((git_project.src, out))
        if out:
            print ui.indent(out, num=2)
    #clean the screen
    ui.info_count(i, len(git_projects), ui.blue, " ".ljust(max_src), end="\r")
    print_overview(len(git_projects), len(skipped), len(failed))
    if failed or not sync_ok:
        sys.exit(1)
Exemplo n.º 4
0
 def __str__(self):
     """ String Representation of the Toochain """
     git_path = qisys.sh.get_share_path("qi", "toolchains", self.name + ".git")
     sha1 = None
     if os.path.exists(git_path):
         git = qisrc.git.Git(git_path)
         _, sha1 = git.call("rev-parse", "HEAD", raises=False)
     res = "Toolchain %s\n" % self.name
     if self.feed_url:
         res += "Using feed from %s" % self.feed_url
         if self.feed_name:
             res += " (feeds/%s.xml)" % self.feed_name
         if self.feed_branch:
             res += " on %s" % self.feed_branch
         if sha1:
             res += " - %s" % sha1[:8]
         res += "\n"
     else:
         res += "No feed\n"
     if self.packages:
         res += "  Packages:\n"
     else:
         res += "No packages\n"
     sorted_packages = sorted(self.packages)
     for package in sorted_packages:
         res += ui.indent(package.name, 2)
         if package.version:
             res += " " + package.version
         res += "\n"
         if package.path:
             res += ui.indent("in " + package.path, 3) + "\n"
     return res
Exemplo n.º 5
0
 def __str__(self):
     """ String Representation of the Toochain """
     git_path = qisys.sh.get_share_path("qi", "toolchains", self.name + ".git")
     sha1 = None
     if os.path.exists(git_path):
         git = qisrc.git.Git(git_path)
         _, sha1 = git.call("rev-parse", "HEAD", raises=False)
     res = "Toolchain %s\n" % self.name
     if self.feed_url:
         res += "Using feed from %s" % self.feed_url
         if self.feed_name:
             res += " (feeds/%s.xml)" % self.feed_name
         if self.feed_branch:
             res += " on %s" % self.feed_branch
         if sha1:
             res += " - %s" % sha1[:8]
         res += "\n"
     else:
         res += "No feed\n"
     if self.packages:
         res += "  Packages:\n"
     else:
         res += "No packages\n"
     sorted_packages = sorted(self.packages)
     for package in sorted_packages:
         res += ui.indent(package.name, 2)
         if package.version:
             res += " " + package.version
         res += "\n"
         if package.path:
             res += ui.indent("in " + package.path, 3) + "\n"
     return res
Exemplo n.º 6
0
def do(args):
    """Main entry point"""
    git_worktree = qisrc.parsers.get_git_worktree(args)
    sync_ok = git_worktree.sync()
    git_projects = qisrc.parsers.get_git_projects(git_worktree, args,
                                                  default_all=True,
                                                  use_build_deps=True)
    if not git_projects:
        qisrc.worktree.on_no_matching_projects(git_worktree, groups=args.groups)
        return
    git_worktree.configure_projects(git_projects)
    skipped = list()
    failed = list()
    ui.info(ui.green, ":: Syncing projects ...")
    max_src = max(len(x.src) for x in git_projects)
    for (i, git_project) in enumerate(git_projects):
        ui.info_count(i, len(git_projects),
                      ui.blue, git_project.src.ljust(max_src), end="\r")

        (status, out) = git_project.sync(rebase_devel=args.rebase_devel)
        if status is None:
            ui.info("\n", ui.brown, "  [skipped]")
            skipped.append((git_project.src, out))
        if status is False:
            ui.info("\n", ui.red, "  [failed]")
            failed.append((git_project.src, out))
        if out:
            print ui.indent(out + "\n\n", num=2)
    #clean the screen
    ui.info_count(i, len(git_projects), ui.blue, " ".ljust(max_src), end="\r")
    print_overview(len(git_projects), len(skipped), len(failed))
    if failed or not sync_ok:
        sys.exit(1)
Exemplo n.º 7
0
 def __str__(self):
     res = ""
     if self.ide:
         res += "  defaults.ide: %s\n" % self.ide
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str) + "\n"
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str) + "\n"
     return res
Exemplo n.º 8
0
 def __str__(self):
     res = ""
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "default settings for this worktree:\n"
         res += ui.indent(defaults_str) + "\n"
     build_str = str(self.build)
     if build_str:
         res += "build settings for this worktree:\n"
         res += ui.indent(build_str) + "\n"
     return res
Exemplo n.º 9
0
 def __str__(self):
     res = ""
     if self.ide:
         res += "  defaults.ide: %s\n" % self.ide
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str) + "\n"
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str) + "\n"
     return res
Exemplo n.º 10
0
 def __str__(self):
     res = ""
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "default settings for this worktree:\n"
         res += ui.indent(defaults_str) + "\n"
     build_str = str(self.build)
     if build_str:
         res += "build settings for this worktree:\n"
         res += ui.indent(build_str) + "\n"
     return res
Exemplo n.º 11
0
 def __str__(self):
     res = self.name
     res += "\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     return res
Exemplo n.º 12
0
 def __str__(self):
     res = self.name
     res += "\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     return res
Exemplo n.º 13
0
 def __str__(self):
     res = self.name
     access_str = str(self.access)
     if access_str:
         res += "\n"
         res += ui.indent(access_str)
     return res
Exemplo n.º 14
0
 def __str__(self):
     res = self.name
     access_str = str(self.access)
     if access_str:
         res += "\n"
         res += ui.indent(access_str)
     return res
Exemplo n.º 15
0
def do(args):
    """Main entry point"""
    build_worktree = None
    try:
        build_worktree = qibuild.parsers.get_build_worktree(args)
    except qisys.worktree.NotInWorkTree:
        pass

    if args.wizard:
        qibuild.wizard.run_config_wizard(build_worktree)
        return

    is_local = args.is_local
    if is_local and not build_worktree:
        raise Exception("Cannot use --local when not in a worktree")

    qibuild_cfg = qibuild.config.QiBuildConfig()
    qibuild_cfg.read()

    if args.edit:
        editor = qibuild_cfg.defaults.env.editor
        if not editor:
            editor = qisys.interact.get_editor()
            qibuild_cfg.defaults.env.editor = editor
            qibuild_cfg.write()

        full_path = qisys.command.find_program(editor)
        if is_local:
            cfg_path = build_worktree.qibuild_xml
        else:
            cfg_path = qibuild.config.get_global_cfg_path()
        subprocess.call([full_path, cfg_path])
        return

    if not build_worktree:
        print qibuild_cfg
        return

    if not is_local:
        print "General configuration"
        print "---------------------"
        print ui.indent(str(qibuild_cfg))
        print

    print "Local configuration"
    print "-------------------"
    print ui.indent(str(qibuild_cfg.local))
Exemplo n.º 16
0
def do(args):
    """Main entry point"""
    build_worktree = None
    try:
        build_worktree = qibuild.parsers.get_build_worktree(args)
    except qisys.worktree.NotInWorkTree:
        pass

    if args.wizard:
        qibuild.wizard.run_config_wizard(build_worktree)
        return

    is_local = args.is_local
    if is_local and not build_worktree:
        raise Exception("Cannot use --local when not in a worktree")

    qibuild_cfg = qibuild.config.QiBuildConfig()
    qibuild_cfg.read()

    if args.edit:
        editor = qibuild_cfg.defaults.env.editor
        if not editor:
            editor = qisys.interact.get_editor()
            qibuild_cfg.defaults.env.editor = editor
            qibuild_cfg.write()

        full_path = qisys.command.find_program(editor)
        if is_local:
            cfg_path = build_worktree.qibuild_xml
        else:
            cfg_path = qibuild.config.get_global_cfg_path()
        subprocess.call([full_path, cfg_path])
        return

    if not build_worktree:
        print qibuild_cfg
        return

    if not is_local:
        print "General configuration"
        print "---------------------"
        print ui.indent(str(qibuild_cfg))
        print

    print "Local configuration"
    print "-------------------"
    print ui.indent(str(qibuild_cfg.local))
Exemplo n.º 17
0
 def __str__(self):
     """ String Representation """
     res = self.name
     access_str = str(self.access)
     if access_str:
         res += "\n"
         res += ui.indent(access_str)
     return res
Exemplo n.º 18
0
 def __str__(self):
     """ String Representation """
     res = self.name
     access_str = str(self.access)
     if access_str:
         res += "\n"
         res += ui.indent(access_str)
     return res
Exemplo n.º 19
0
 def __str__(self):
     res = "Toolchain %s\n" % self.name
     if self.feed_url:
         res += "Using feed from %s\n" % self.feed_url
     else:
         res += "No feed\n"
     if self.packages:
         res += "  Packages:\n"
     else:
         res += "No packages\n"
     sorted_packages = sorted(self.packages)
     for package in sorted_packages:
         res += ui.indent(package.name, 2)
         if package.version:
             res += " " + package.version
         res += "\n"
         if package.path:
             res += ui.indent("in " + package.path, 3) + "\n"
     return res
Exemplo n.º 20
0
 def __str__(self):
     res  = "Toolchain %s\n" % self.name
     if self.feed_url:
         res += "Using feed from %s\n" % self.feed_url
     else:
         res += "No feed\n"
     if self.packages:
         res += "  Packages:\n"
     else:
         res += "No packages\n"
     sorted_packages = sorted(self.packages)
     for package in sorted_packages:
         res += ui.indent(package.name, 2)
         if package.version:
             res += " " + package.version
         res += "\n"
         if package.path:
             res +=  ui.indent("in " + package.path, 3) + "\n"
     return res
Exemplo n.º 21
0
 def __str__(self):
     res = ""
     res += self.name
     if self.build_depends:
         res += "\n"
         res += "  build dependencies: \n"
         for dep in self.build_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     if self.run_depends:
         res += "  runtime dependencies: \n"
         for dep in self.run_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     if self.test_depends:
         res += "  test time dependencies: \n"
         for dep in self.test_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     return res
Exemplo n.º 22
0
    def do_sync(git_project):
        if reset:
            (status, out) = git_project.reset()
        else:
            (status, out) = git_project.sync(rebase_devel=args.rebase_devel)

        with lock:
            ui.info_count(i[0], len(git_projects),
                          ui.blue, git_project.src.ljust(max_src))

            if status is None:
                ui.info(ui.brown, "  [skipped]")
                skipped.append((git_project.src, out))
            if status is False:
                ui.info(ui.red, "  [failed]")
                failed.append((git_project.src, out))
            if out:
                print ui.indent(out + "\n\n", num=2)

            i[0] += 1
Exemplo n.º 23
0
 def __str__(self):
     res = self.name
     res += "\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     if self.toolchain:
         res += ui.indent("toolchain: " + self.toolchain)
         res += "\n"
     if self.profiles:
         res += ui.indent("profiles: " + ", ".join(self.profiles))
         res += "\n"
     return res
Exemplo n.º 24
0
 def __str__(self):
     res = self.name
     res += "\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     if self.toolchain:
         res += ui.indent("toolchain: " + self.toolchain)
         res += "\n"
     if self.profiles:
         res += ui.indent("profiles: " + ", ".join(self.profiles))
         res += "\n"
     return res
Exemplo n.º 25
0
    def do_sync(git_project):
        if reset:
            (status, out) = git_project.reset()
        else:
            (status, out) = git_project.sync(rebase_devel=args.rebase_devel)

        with lock:
            ui.info_count(i[0], len(git_projects), ui.blue,
                          git_project.src.ljust(max_src))

            if status is None:
                ui.info(ui.brown, "  [skipped]")
                skipped.append((git_project.src, out))
            if status is False:
                ui.info(ui.red, "  [failed]")
                failed.append((git_project.src, out))
            if out:
                print ui.indent(out + "\n\n", num=2)

            i[0] += 1
Exemplo n.º 26
0
 def __str__(self):
     res = ""
     res += self.name
     if self.build_depends:
         res += "\n"
         res += "  build dependencies: \n"
         for dep in self.build_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     if self.run_depends:
         res += "  runtime dependencies: \n"
         for dep in self.run_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     if self.test_depends:
         res += "  test time dependencies: \n"
         for dep in self.test_depends:
             res += ui.indent(dep, num=4)
             res += "\n"
     return res
Exemplo n.º 27
0
 def __str__(self):
     res = ""
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "defaults:\n"
         res += ui.indent(defaults_str) + "\n"
         res += "\n"
     configs = self.configs.values()
     configs.sort(key=operator.attrgetter("name"))
     if configs:
         res += "configs:\n"
         for config in configs:
             res += ui.indent(str(config))
             res += "\n"
         res += "\n"
     ides = self.ides.values()
     ides.sort(key=operator.attrgetter("name"))
     if ides:
         res += "ides:\n"
         for ide in ides:
             res += ui.indent(str(ide))
             res += "\n"
         res += "\n"
     servers = self.servers.values()
     servers.sort(key=operator.attrgetter("name"))
     if servers:
         res += "servers:\n"
         for server in servers:
             res += ui.indent(str(server))
             res += "\n"
         res += "\n"
     worktrees = self.worktrees.values()
     worktrees.sort(key=operator.attrgetter("path"))
     if worktrees:
         res += "worktrees:\n"
         for worktree in worktrees:
             res += ui.indent(str(worktree))
             res += "\n"
     return res
Exemplo n.º 28
0
 def __str__(self):
     res = ""
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "defaults:\n"
         res += ui.indent(defaults_str) + "\n"
         res += "\n"
     configs = self.configs.values()
     configs.sort(key=operator.attrgetter('name'))
     if configs:
         res += "configs:\n"
         for config in configs:
             res += ui.indent(str(config))
             res += "\n"
         res += "\n"
     ides = self.ides.values()
     ides.sort(key=operator.attrgetter('name'))
     if ides:
         res += "ides:\n"
         for ide in ides:
             res += ui.indent(str(ide))
             res += "\n"
         res += "\n"
     servers = self.servers.values()
     servers.sort(key=operator.attrgetter('name'))
     if servers:
         res += "servers:\n"
         for server in servers:
             res += ui.indent(str(server))
             res += "\n"
         res += "\n"
     worktrees = self.worktrees.values()
     worktrees.sort(key=operator.attrgetter('path'))
     if worktrees:
         res += "worktrees:\n"
         for worktree in worktrees:
             res += ui.indent(str(worktree))
             res += "\n"
     return res
Exemplo n.º 29
0
 def __str__(self):
     """ String Representation """
     res = self.name
     res += "\n"
     if self.host:
         res += "  (host config)\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     if self.toolchain:
         res += ui.indent("toolchain: " + self.toolchain)
         res += "\n"
     if self.profiles:
         res += ui.indent("profiles: " + ", ".join(self.profiles))
         res += "\n"
     return res
Exemplo n.º 30
0
 def __str__(self):
     """ String Representation """
     res = self.name
     res += "\n"
     if self.host:
         res += "  (host config)\n"
     if self.ide:
         res += "  ide: %s\n" % self.ide
     env_str = str(self.env)
     if env_str:
         res += ui.indent(env_str)
         res += "\n"
     cmake_str = str(self.cmake)
     if cmake_str:
         res += ui.indent(cmake_str)
         res += "\n"
     if self.toolchain:
         res += ui.indent("toolchain: " + self.toolchain)
         res += "\n"
     if self.profiles:
         res += ui.indent("profiles: " + ", ".join(self.profiles))
         res += "\n"
     return res
Exemplo n.º 31
0
 def __str__(self):
     res = ""
     build_str = str(self.build)
     if build_str:
         res += "build:\n"
         res += ui.indent(build_str) + "\n"
         res += "\n"
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "defaults:\n"
         res += ui.indent(defaults_str) + "\n"
         res += "\n"
     configs = self.configs.values()
     configs.sort(key=operator.attrgetter('name'))
     if configs:
         res += "configs:\n"
         for config in configs:
             res += ui.indent(str(config))
             res += "\n"
         res += "\n"
     ides = self.ides.values()
     ides.sort(key=operator.attrgetter('name'))
     if ides:
         res += "ides:\n"
         for ide in ides:
             res += ui.indent(str(ide))
             res += "\n"
         res += "\n"
     servers = self.servers.values()
     servers.sort(key=operator.attrgetter('name'))
     if servers:
         res += "servers:\n"
         for server in servers:
             res += ui.indent(str(server))
             res += "\n"
     return res
Exemplo n.º 32
0
 def __str__(self):
     """ String Representation """
     res = ""
     defaults_str = str(self.defaults)
     if defaults_str:
         res += "defaults:\n"
         res += ui.indent(defaults_str) + "\n"
         res += "\n"
     configs = sorted(self.configs.values(), key=operator.attrgetter('name'))
     if configs:
         res += "configs:\n"
         for config in configs:
             res += ui.indent(str(config))
             res += "\n"
         res += "\n"
     ides = sorted(self.ides.values(), key=operator.attrgetter('name'))
     if ides:
         res += "ides:\n"
         for ide in ides:
             res += ui.indent(str(ide))
             res += "\n"
         res += "\n"
     servers = sorted(self.servers.values(), key=operator.attrgetter('name'))
     if servers:
         res += "servers:\n"
         for server in servers:
             res += ui.indent(str(server))
             res += "\n"
         res += "\n"
     worktrees = sorted(self.worktrees.values(), key=operator.attrgetter('path'))
     if worktrees:
         res += "worktrees:\n"
         for worktree in worktrees:
             res += ui.indent(str(worktree))
             res += "\n"
     return res