Example #1
0
File: build.py Project: aduprat/OBM
def main():
    logging.basicConfig(level=logging.DEBUG)

    locale_name = 'en_US.UTF-8'
    logging.info("Setting locale to %s" % locale_name)
    locale.setlocale(locale.LC_ALL, locale_name)

    argument_parser = build_argument_parser(sys.argv)
    args = argument_parser.parse_args()

    config = ob.read_config(args.configuration_file)

    packages_dir = os.path.join(args.work_dir, args.package_type)

    checkout_dir = os.path.dirname(os.path.abspath('.'))

    available_packages = ob.read_packages(config, checkout_dir)

    package_names = set(args.packages)
    assert_package_option_is_correct(argument_parser.format_usage(),
            package_names, available_packages)

    if 'all' in package_names:
        packages = [p for p in available_packages]
    else:
        packages = [p for p in available_packages if p.name in package_names]

    packagers = make_packagers(config, args, packages_dir, checkout_dir,
            packages)

    for packager in packagers:
        packager.prepare_build()
        packager.build()
Example #2
0
File: build.py Project: hmsami/OBM
def main():
    logging.basicConfig(level=logging.DEBUG)

    locale_name = 'en_US.UTF-8'
    logging.info("Setting locale to %s" % locale_name)
    locale.setlocale(locale.LC_ALL, locale_name)

    argument_parser = build_argument_parser(sys.argv)
    args = argument_parser.parse_args()

    logging.info("The following parameters will be used from the environment and the command line :")
    argsd = vars(args)
    for key in argsd.iterkeys():
        logging.info("\t[%s] = %s" % (key, argsd[key]))
    logging.info("End of parameter list")

    config = ob.read_config(args.configuration_file)
    checkout_dir = os.path.dirname(os.path.abspath('.'))

    available_packages = ob.read_packages(config, checkout_dir)
    package_names = set(args.packages)
    assert_package_option_is_correct(argument_parser.format_usage(),
            package_names, available_packages)

    if 'all' in package_names:
        packages = [p for p in available_packages]
    else:
        packages = [p for p in available_packages if p.name in package_names]

    prepare_dirs(args.work_dir)

    packagers = make_packagers(config, args, args.work_dir, checkout_dir,
            packages)

    try:
        processcount=int(args.processcount)
        
        pool = multiprocessing.Pool(processcount)
        tasks = set([pool.apply_async(launch_packager, [packager]) for packager in packagers])
        pending_tasks = tasks.copy()
        pool.close()
        logging.info("Processing %d packaging tasks..." % len(tasks))
        while len(pending_tasks) > 0:
            for task in tasks:
                if task in pending_tasks and task.ready() is True:
                    if task.get() is False:
                        exit_failure(pool)
                    else:
                        pending_tasks.discard(task)
                        logging.info("%d packaging tasks remaining..." % len(pending_tasks))
                task.wait(1.)
        exit_success(pool)
    except (KeyboardInterrupt) as ex:
        logging.warning("KEYBOARD INTERRUPT")
        exit_failure(pool)
Example #3
0
def main():
    logging.basicConfig(level=logging.DEBUG)

    locale_name = 'en_US.UTF-8'
    logging.info("Setting locale to %s" % locale_name)
    locale.setlocale(locale.LC_ALL, locale_name)

    argument_parser = build_argument_parser(sys.argv)
    args = argument_parser.parse_args()

    logging.info(
        "The following parameters will be used from the environment and the command line :"
    )
    argsd = vars(args)
    for key in argsd.iterkeys():
        logging.info("\t[%s] = %s" % (key, argsd[key]))
    logging.info("End of parameter list")

    config = ob.read_config(args.configuration_file)
    checkout_dir = os.path.dirname(os.path.abspath('.'))

    available_packages = ob.read_packages(config, checkout_dir)
    package_names = set(args.packages)
    assert_package_option_is_correct(argument_parser.format_usage(),
                                     package_names, available_packages)

    if 'all' in package_names:
        packages = [p for p in available_packages]
    else:
        packages = [p for p in available_packages if p.name in package_names]

    prepare_dirs(args.work_dir)

    packagers = make_packagers(config, args, args.work_dir, checkout_dir,
                               packages)

    try:
        processcount = int(args.processcount)

        pool = multiprocessing.Pool(processcount)
        tasks = set([
            pool.apply_async(launch_packager, [packager])
            for packager in packagers
        ])
        pending_tasks = tasks.copy()
        pool.close()
        logging.info("Processing %d packaging tasks..." % len(tasks))
        while len(pending_tasks) > 0:
            for task in tasks:
                if task in pending_tasks and task.ready() is True:
                    if task.get() is False:
                        exit_failure(pool)
                    else:
                        pending_tasks.discard(task)
                        logging.info("%d packaging tasks remaining..." %
                                     len(pending_tasks))
                task.wait(1.)
        exit_success(pool)
    except (KeyboardInterrupt) as ex:
        logging.warning("KEYBOARD INTERRUPT")
        exit_failure(pool)