Пример #1
0
def get_all_subdomains(domain_home, level=0):
    if level >= 10:
        return []

    domain = Domain(domain_home)
    paths = []
    for path in domain.get_subdomains():
        paths.append([path, level])
        paths.extend(get_all_subdomains(path, level + 1))
    return paths
Пример #2
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)
Пример #3
0
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    try:
        domain = Domain(domain_home)
        if show_installed:
            # TODO: should paths or names be shown for installed and published?
            print("%s" % "\n".join(domain.get_installed()))
        if show_label:
            print("%s" % str(domain.get_label()))
        if show_published:
            print("%s" % "\n".join(domain.get_published()))
        if show_sources:
            print("%s" % str(domain.get_sources()))
        if show_subdomains:
            print("\n".join(domain.get_subdomains()))
        if show_version:
            version = domain.get_version()
            version_string = ".".join(map(str, version))
            print("%s" % version_string)
    except SystemExit:
        raise
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: operation failed")
    sys.exit(0)
Пример #4
0
                "title", "domain_state", "domain"
            ]
        else:
            # summary
            #format_fields = ["state", "name_and_publish_platform"]
            format_fields = ["state", "name"]
        headings, fmt = get_headings_and_fmt(format_fields)

    for i, domain_home in enumerate(domain_homes):
        try:
            domain = Domain(domain_home)
            if not domain.is_compatible():
                utils.print_error(MSG_INCOMPATIBLE_DOMAIN)
                continue

            subdomains = domain.get_subdomains()
        except:
            print("warning: not a domain (%s)" % domain_home)
            continue

        if i:
            # aesthetic
            print

        if output_type in ["long", "medium"] and headings:
            print(headings)
        for domain_home in subdomains + [domain_home]:
            try:
                domain = Domain(domain_home)
                package_names = domain.get_package_names()
                platforms = set(