Beispiel #1
0
    return basic_apps


def generate_cmdline(apps):
    cmdline_path = os.path.join(resolve.get_build_path(), "cmdline")
    print "Saving command line to %s" % cmdline_path
    with open(cmdline_path, "w") as cmdline_file:
        if apps:
            cmdline_file.write(get_command_line(apps))
        else:
            print "No apps selected"


if __name__ == "__main__":
    image_configs_dir = resolve.get_images_dir()

    parser = argparse.ArgumentParser(prog="module.py")
    parser.add_argument(
        "-c",
        "--image-config",
        action="store",
        default="default",
        help="image configuration name. Looked up in " + image_configs_dir,
    )
    args = parser.parse_args()

    image_config_file = os.path.join(image_configs_dir, args.image_config + ".py")
    if not os.path.exists(image_config_file):
        print "No such image configuration: " + args.image_config
        sys.exit(1)
Beispiel #2
0
    extra_args = {}
    if args.quiet:
        extra_args['stdout'] = open('/dev/null', 'w')

    for local_path in resolve.all_module_directories():
        if os.path.exists(os.path.join(local_path, 'Makefile')):
            if not args.quiet:
                print('Cleaning ' + local_path + ' ...')
            if subprocess.call(make_cmd('-q clean', j=args.j, jobserver=args.jobserver_fds),
                               shell=True, cwd=local_path, stderr=subprocess.PIPE, **extra_args) != 2:
                if subprocess.call(make_cmd('clean', j=args.j, jobserver=args.jobserver_fds),
                                   shell=True, cwd=local_path, **extra_args):
                    raise Exception('\'make clean\' failed in ' + local_path)

if __name__ == "__main__":
    image_configs_dir = resolve.get_images_dir()

    parser = argparse.ArgumentParser(prog='module.py')
    parser.add_argument('--jobserver-fds', action='store', default=None,
                        help='make -j support')
    parser.add_argument('-j', action='store', default=None,
                        help='make -j support')
    subparsers = parser.add_subparsers(help="Command")

    build_cmd = subparsers.add_parser("build", help="Build modules")
    build_cmd.add_argument("-c", "--image-config", action="store", default="default",
                        help="image configuration name. Looked up in " + image_configs_dir)
    build_cmd.add_argument("--usrskel", action="store", default="default",
                        help="override default usr.manifest.skel")
    build_cmd.set_defaults(func=build)