Beispiel #1
0
def nuke(argv=None, completer=None):
    """nuke the local install"""

    usage = "Usage: redpill nuke [options]\n\n    %s" % nuke.__doc__
    op = OptionParser(usage=usage, add_help_option=False)

    if completer:
        return op

    options, args = parse_options(op, argv, completer)

    lock(BUILD_LOCK)
    rmdir(LOCAL)
    rmdir(RECEIPTS)
    unlock(BUILD_LOCK)
Beispiel #2
0
def build(argv=None, completer=None):
    """download and build the dependencies"""

    usage = "Usage: redpill build [options]\n\n    %s" % build.__doc__
    role = get_default_role()

    op = OptionParser(usage=usage, add_help_option=False)

    op.add_option('--role', dest='role', default=role,
                  help="specify the role to build [%s]" % role)

    options, args = parse_options(op, argv, completer)

    load_role(options.role)
    install_packages()
Beispiel #3
0
def build(argv=None, completer=None):
    """download and build the dependencies"""

    usage = "Usage: redpill build [options]\n\n    %s" % build.__doc__

    op = OptionParser(usage=usage, add_help_option=False)

    op.add_option('--role', dest='role', default=get_role(),
                  help="specify the role to build [%s]" % get_role())

    options, args = parse_options(op, argv, completer)

    if VIRGIN_BUILD and options.role != 'base':
        build_base_and_reload()

    load_role(options.role)
    install_packages()
Beispiel #4
0
def uninstall(argv=None, completer=None):
    """uninstall specific build packages"""

    usage = (
        "Usage: redpill uninstall [packages]\n\n    %s"
        % uninstall.__doc__
        )

    op = OptionParser(usage=usage, add_help_option=False)

    init_build_recipes()
    if completer:
        return op, ListCompleter(get_installed_packages())

    options, args = parse_options(op, argv, completer, True)
    for package in args:
        uninstall_package(package)

    uninstall_packages()
Beispiel #5
0
def install(argv=None, completer=None):
    """install specific build packages"""

    usage = (
        "Usage: redpill install [packages]\n\n    %s"
        % install.__doc__
        )

    op = OptionParser(usage=usage, add_help_option=False)

    init_build_recipes()
    if completer:
        installed_packages = get_installed_packages()
        potentials = [pkg for pkg in RECIPES if pkg not in installed_packages]
        return op, ListCompleter(potentials)

    options, args = parse_options(op, argv, completer, True)
    for package in args:
        install_package(package)

    install_packages()
Beispiel #6
0
def info(argv=None, completer=None):
    """show metadata relating to the installs"""

    usage = "Usage: redpill info [options]\n\n    %s" % info.__doc__
    op = OptionParser(usage=usage, add_help_option=False)

    op.add_option(
        '--hash', action='store_true',
        help="show the sha256 hash of the output"
        )

    op.add_option(
        '--installed', action='store_true',
        help="output the list of installed packages/versions"
        )

    op.add_option(
        '--role', action='store_true',
        help="output the default redpill role"
        )

    if completer:
        return op

    options, args = parse_options(op, argv, completer)

    lock(BUILD_LOCK)
    if options.role:
        output = get_role()
    elif options.installed:
        output = get_installed_info()
    else:
        output = get_build_info()

    if options.hash:
        output = sha256(output).hexdigest()

    print output
    unlock(BUILD_LOCK)