Beispiel #1
0
                globls.debug = True
            else:
                raise Exception()
    except SystemExit:
        raise
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    if domain_home == None:
        utils.print_exit("error: bad/missing argument(s)")

    try:
        domain = Domain(domain_home)
        if not domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
        if not domain.is_frozen():
            utils.print_exit("warning: domain not frozen")
        domain.unfreeze()
    except SystemExit:
        raise
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: could not unfreeze domain")

    sys.exit(0)
Beispiel #2
0
                raise Exception()
    except SystemExit:
        raise
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    if domain_home == None:
        utils.print_exit("error: bad/missing argument(s)")

    try:
        domain = Domain(domain_home)
        if not domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)

        if domain.is_frozen():
            utils.print_exit("warning: domain is already frozen")
        else:
            try:
                domain.freeze()
            except:
                utils.print_exit("error: could not freeze domain")
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: operation failed")
    sys.exit(0)
Beispiel #3
0
                        utils.print_verbose(
                            "publishing package (%s) from alt src domain (%s)"
                            % (src_package_name, src_package.domain.path))
                        dst_package = src_package

                    if dst_domain.is_published(src_package_name,
                                               publish_platform):
                        if republish:
                            dst_domain.unpublish_package(
                                dst_package, published_platform)
                        else:
                            utils.print_warning(
                                "warning: skipping published package (%s)" %
                                (src_package_name, ))
                            continue
                    dst_domain.publish_package(dst_package, publish_platform)

        # set frozen?
        if src_domain.is_frozen():
            utils.print_verbose("freezing domain (%s)" % dst_domain_home)
            dst_domain.freeze()
    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)
Beispiel #4
0
def get_output_records(domain_home, publish_platform, format_fields):
    """Produce records for a domain according to the selected
    format_fields.
    """
    records = []
    try:
        if os.path.isdir(domain_home):
            domain = Domain(domain_home)
            #published_platforms = domain.get_published_platforms()
            published_packages = domain.get_packages_with_state(
                "published", publish_platform)

            # generate record for each package
            for package_name in domain.get_package_names(package_name_pattern):
                dom_package = Package(domain, package_name)

                #if package_name in published_packages:
                #platforms = published_platforms
                #else:
                #platforms = [""]

                # for each publish platform
                #for publish_platform in platforms:
                #if publish_platform != "" \
                #and not domain.is_published(package_name, publish_platform):
                ## must be installed or published
                #continue

                if package_name.endswith(
                        "_" + publish_platform) or domain.is_published(
                            package_name, publish_platform):
                    state = domain.get_package_state(package_name,
                                                     publish_platform)
                    pub_package = published_packages.get(package_name)
                    package = pub_package or dom_package

                    publish_timestamp = pub_package and utils.get_path_timestamp(
                        pub_package.path)
                    timestamp = install_timestamp = utils.get_path_timestamp(
                        package.path)

                    # generate record
                    record = []
                    for fname in format_fields:
                        if fname in ["title"]:
                            # load only if necessary
                            control_map = package and package.get_control(
                            ) or {}

                        if fname.startswith("_"):
                            record.append("")
                        elif fname in ["domain", "publish_domain"]:
                            record.append(domain.path)
                        elif fname in ["domain_owner", "publish_domain_owner"]:
                            record.append(domain.get_owner())
                        elif fname in ["domain_state", "publish_domain_state"]:
                            record.append(domain.is_frozen() and "F" or "")
                        elif fname == "domains":
                            record.append("%s (%s)" %
                                          (domain.path, package.domain.path))
                        elif fname == "install_domain":
                            record.append(package.domain.path)
                        elif fname == "install_domain_owner":
                            record.append(package.domain.get_owner())
                        elif fname == "install_domain_state":
                            record.append(package.domain.is_frozen() and "F"
                                          or "")
                        elif fname == "install_timestamp":
                            record.append(install_timestamp)
                        elif fname == "name":
                            record.append(package_name)
                        elif fname == "name_and_publish_platform":
                            if not publish_platform or package_name.endswith(
                                    "_" + publish_platform):
                                record.append(package_name)
                            else:
                                record.append("%s (%s)" %
                                              (package_name, publish_platform))
                        elif fname == "publish_platform":
                            record.append(publish_platform or "")
                        elif fname == "publish_timestamp":
                            record.append(publish_timestamp or "")
                        elif fname == "state":
                            record.append(state)
                        elif fname == "title":
                            record.append(control_map.get("title", "***"))
                        else:
                            record.append("***")
                    records.append(record)
    except:
        if globls.debug:
            traceback.print_exc()
        raise
    return records