Ejemplo n.º 1
0
def main(sysargs=None):
    parser = get_parser()
    parser = add_global_arguments(parser)

    # List the generators
    generator_names = list_generators()

    # Create the generators
    generators = create_generators(generator_names)

    # Setup a subparser for each generator
    create_subparsers(parser, generators.values())

    args = parser.parse_args(sysargs)
    handle_global_arguments(args)

    generator = generators[args.generator]

    # Run the generator that was selected in a clone
    # The clone protects the release repo state from mid change errors
    with log_prefix('[git-bloom-generate {0}]: '.format(generator.title)):
        git_clone = GitClone()
        try:
            with git_clone:
                ret = run_generator(generator, args)
            if ret > 0:
                return ret
            git_clone.commit()
            return ret
        except GeneratorError as err:
            return err.retcode
Ejemplo n.º 2
0
def main(sysargs=None):
    parser = get_parser()
    parser = add_global_arguments(parser)

    # List the generators
    generator_names = list_generators()

    # Create the generators
    generators = create_generators(generator_names)

    # Setup a subparser for each generator
    create_subparsers(parser, generators.values())

    args = parser.parse_args(sysargs)
    handle_global_arguments(args)

    generator = generators[args.generator]

    # Check that the current directory is a serviceable git/bloom repo
    try:
        ensure_clean_working_env()
        ensure_git_root()
    except SystemExit:
        parser.print_usage()
        raise

    # Run the generator that was selected in a clone
    # The clone protects the release repo state from mid change errors
    with log_prefix('[git-bloom-generate {0}]: '.format(generator.title)):
        git_clone = GitClone()
        with git_clone:
            run_generator(generator, args)
        git_clone.commit()
Ejemplo n.º 3
0
def main(sysargs=None):
    parser = get_parser()
    parser = add_global_arguments(parser)

    # List the generators
    generator_names = list_generators()

    # Create the generators
    generators = create_generators(generator_names)

    # Setup a subparser for each generator
    create_subparsers(parser, generators.values())

    args = parser.parse_args(sysargs)
    handle_global_arguments(args)

    generator = generators[args.generator]

    # Check that the current directory is a serviceable git/bloom repo
    try:
        ensure_clean_working_env()
        ensure_git_root()
    except SystemExit:
        parser.print_usage()
        raise

    # Run the generator that was selected in a clone
    # The clone protects the release repo state from mid change errors
    with log_prefix('[git-bloom-generate {0}]: '.format(generator.title)):
        git_clone = GitClone()
        with git_clone:
            run_generator(generator, args)
        git_clone.commit()
Ejemplo n.º 4
0
def main(sysargs=None):
    # Do argparse stuff
    parser = get_argument_parser()
    parser = add_global_arguments(parser)

    # List the generators
    generator_names = list_generators()

    # Create the generators
    generators = create_generators(generator_names)

    # Setup a subparser for each generator
    create_subparsers(parser, generators.values())

    # Inject into sys.argv
    if '--prefix' not in sys.argv:
        sys.argv.extend(['--prefix', 'release'])
    args = parser.parse_args(sysargs)
    handle_global_arguments(args)

    # Set logging prefix
    push_log_prefix('[git-bloom-release]: ')

    # Run import upstream
    info("###")
    msg = "### Running 'git bloom-import-upstream --replace'... "
    info(msg)
    info("###")
    iu_args = ['--replace']
    if args.debug:
        iu_args.append('-d')
    ret = iu_main(iu_args)
    msg += "returned (" + str(ret) + ")"
    if ret > 0:
        error(msg)
        return 0
    if ret < 0:
        warning(msg)
    else:
        info(msg)
    print('\n')

    # Run release generator
    info("###")
    msg = "### Running 'git bloom-generate -y release --src upstream'... "
    info(msg)
    info("###")
    generator = generators['release']
    args.interactive = False
    release_args = copy.deepcopy(args)
    release_args.src = 'upstream'
    release_args.name = None
    ret = execute_generator(generator, release_args)
    msg += "returned (" + str(ret) + ")"
    if ret > 0:
        error(msg)
        return 0
    if ret < 0:
        warning(msg)
    else:
        info(msg)
    print('\n')

    # Run given generator
    info("###")
    msg = "### Running 'git bloom-generate -y {0}'... ".format(args.generator)
    info(msg)
    info("###")
    generator = generators[args.generator]
    ret = execute_generator(generator, args)
    msg += "returned (" + str(ret) + ")"
    if ret > 0:
        error(msg)
        return 0
    if ret < 0:
        warning(msg)
    else:
        info(msg)
    print('\n')

    # Undo log prefix
    pop_log_prefix()

    # Notify the user of success and next action suggestions
    print('\n\n')
    warning("Tip: Check to ensure that the debian tags created have the same "
            "version as the upstream version you are releasing.")
    info(ansi('greenf') + ansi('boldon') + "Everything went as expected, "
         "you should check that the new tags match your expectations, and "
         "then push to the release repo with:" + ansi('reset'))
    info("  git push --all && git push --tags  # You might have to add --force to the second command if you are over-writing existing flags")
    return 0