Beispiel #1
0
def do(args):
    """Main entry point"""
    if args.worktree:
        worktree_root = args.worktree
        worktree_root = qisys.sh.to_native_path(worktree_root)
    else:
        worktree_root = os.getcwd()
    manifest_src = "manifest/%s" % args.manifest_name
    worktree = qisys.worktree.create(worktree_root, force=args.force)
    if not args.manifest_url:
        return
    manifest_url = args.manifest_url
    branch = args.branch
    if not manifest_url:
        return worktree
    manifest_is_a_regular_file = False
    qisys.ui.info(qisys.ui.green, "initializing worktree:",
                    qisys.ui.blue, worktree_root,
                    qisys.ui.green, "using profile:",
                    qisys.ui.blue, args.profile)
    if os.path.isfile(manifest_url):
        manifest_file = manifest_url
        manifest_is_a_regular_file = True
    else:
        manifest_file = qisrc.sync.fetch_manifest(worktree,
            manifest_url, branch=branch, src=manifest_src,
            profile=args.profile)
    manifest = qisrc.manifest.load(manifest_file)
    qisrc.sync.init_worktree(worktree, manifest, setup_review=args.setup_review)
    sync_build_profiles(worktree, manifest_file)
    if not manifest_is_a_regular_file:
        worktree.set_manifest_project(manifest_src, args.profile)
    return worktree
Beispiel #2
0
def sync_all(worktree, args):
    """ Fetch any manifest project, re init everything,
    re-create branch configurations, review setup and so on

    """
    manifest_projects = worktree.get_manifest_projects()
    if not manifest_projects:
        raise qisrc.manifest.NoManifest(worktree)
    # Re-synchronize everything:
    for manifest_project in manifest_projects:
        ui.info(ui.green, "Updating", manifest_project.src, "...")
        git = qisrc.git.Git(manifest_project.path)
        git.pull(quiet=True)
        manifest_filename = manifest_project.profile + ".xml"
        manifest_xml = os.path.join(manifest_project.path, manifest_filename)
        qisrc.sync.init_worktree(worktree, manifest_xml, setup_review=args.setup_review)
        sync_build_profiles(worktree, manifest_xml)