Ejemplo n.º 1
0
                raise Exception()
    except SystemExit:
        raise
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    if not package_name:
        utils.print_exit("error: missing package name")

    try:
        domain = Domain(domain_home)
        if not domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
        pkg = Package(domain, package_name)
        if domain.is_published(package_name):
            utils.print_exit("error: package is published")
        if not pkg.exists() and not domain.is_installed(package_name):
            utils.print_exit("error: package is not installed")
        pkg.uninstall()
    except SystemExit:
        raise
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except Exception, detail:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: operation failed")
    sys.exit(0)
Ejemplo n.º 2
0
    if filename:
        if filename.endswith(".ssm"):
            sources = [os.path.realpath(os.path.dirname(filename))]
            package_name = os.path.basename(filename)[:-4]
        else:
            utils.print_exit("error: bad filename")
    if not package_name:
        utils.print_exit("error: missing package name")

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

        if domain.is_installed(package_name) and skip_on_installed:
            utils.print_verbose("skipping installed package")
        else:
            if sources == None:
                sources = domain.get_sources().split("\n")
            for source in sources:
                source = source.strip()
                if source == "":
                    continue
                repo = Repository(source)
                tarf = repo.get(package_name)
                if tarf != None:
                    utils.print_verbose(
                        "installing package (%s) from repository (%s)" %
                        (package_name, source))
                    pkg = Package(domain, package_name)