Пример #1
0
        if not src_domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
        if alt_src_domain and not alt_src_domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)

        sources = repo_url or (alt_src_domain or src_domain).get_sources()
        repo = Repository(sources)

        if clone_domain:
            # create new domain
            utils.print_verbose("creating new domain (%s)" % dst_domain_home)
            dst_domain.create(label, sources)

            # populating subdomains
            utils.print_verbose("setting subdomains")
            dst_domain.set_subdomains(src_domain.get_subdomains())

        if clone_installed:
            # populate with installed
            src_installed_map = src_domain.get_packages_with_state("installed")
            for src_package_name, src_package in src_installed_map.items():
                utils.print_verbose("installing package (%s)" %
                                    src_package_name)
                tarf = repo.get(src_package_name)
                if tarf == None:
                    utils.print_warning(
                        "warning: could not find package (%s)" %
                        src_package_name)
                dst_package = Package(dst_domain, src_package_name)
                try:
                    dst_package.install(tarf, None, None, False)
Пример #2
0
        if not domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
        if label != None:
            domain.set_label(label)
        if sources != None:
            domain.set_sources(sources)
        if subdomains_filename != None:
            if subdomains_filename == "-":
                f = sys.stdin
            elif subdomains_filename == "--":
                # open editor
                pass
            else:
                f = open(subdomains_filename)
            subdomains = [s for s in f if s.strip() != ""]
            domain.set_subdomains(subdomains)
        if update_published:
            try:
                root = domain.published_path
                filenames = os.listdir(root)
            except:
                utils.print_exit("error: cannot update published/ directory")

            for filename in filenames:
                file_path = "%s/%s" % (root, filename)
                if os.path.islink(file_path):
                    try:
                        _, _, platform = filename.split("_", 2)
                        dir_path = "%s/%s" % (root, platform)
                        utils.makedirs(dir_path)
                        utils.rename(file_path, "%s/%s" % (dir_path, filename))