Esempio n. 1
0
def generate_manifests(modules, basic_apps, usrskel='default'):
    for manifest_type in ["usr", "bootfs"]:
        manifest_name = "%s.manifest" % manifest_type
        print("Preparing %s" % manifest_name)

        manifest_skel = "%s.skel" % manifest_name
        if manifest_type == "usr" and usrskel != "default":
            manifest_skel = usrskel

        with open(os.path.join(resolve.get_build_path(), manifest_name), "w") as manifest:
            manifest.write('[manifest]\n')

            if manifest_skel != 'none':
                append_manifest(os.path.join(resolve.get_osv_base(), manifest_skel), manifest)

            for module in modules:
                module_manifest = os.path.join(module.local_path, manifest_name)

                if os.path.exists(module_manifest):
                    print("Appending %s to %s" % (module_manifest, manifest_name))
                    append_manifest(module_manifest, manifest, variables={
                        'MODULE_DIR': module.local_path,
                        'OSV_BASE': resolve.get_osv_base()
                    })

                filemap_attr = '%s_files' % manifest_type
                if hasattr(module, filemap_attr):
                    filemap.as_manifest(getattr(module, filemap_attr), manifest.write)

            for app in basic_apps:
                app.prepare_manifest(resolve.get_build_path(), manifest_type, manifest)
Esempio n. 2
0
File: module.py Progetto: crxyz/osv
def generate_manifests(modules, basic_apps):
    for manifest_type in ["usr", "bootfs"]:
        manifest_name = "%s.manifest" % manifest_type
        print("Preparing %s" % manifest_name)

        with open(os.path.join(resolve.get_build_path(), manifest_name), "w") as manifest:
            manifest.write("[manifest]\n")

            append_manifest(os.path.join(resolve.get_osv_base(), "%s.skel" % manifest_name), manifest)

            for module in modules:
                module_manifest = os.path.join(module.local_path, manifest_name)

                if os.path.exists(module_manifest):
                    print("Appending %s to %s" % (module_manifest, manifest_name))
                    append_manifest(
                        module_manifest,
                        manifest,
                        variables={"MODULE_DIR": module.local_path, "OSV_BASE": resolve.get_osv_base()},
                    )

                filemap_attr = "%s_files" % manifest_type
                if hasattr(module, filemap_attr):
                    filemap.as_manifest(getattr(module, filemap_attr), manifest.write)

            for app in basic_apps:
                app.prepare_manifest(resolve.get_build_path(), manifest_type, manifest)
Esempio n. 3
0
def generate_manifests(modules, basic_apps):
    for manifest_type in ["usr", "bootfs"]:
        manifest_name = "%s.manifest" % manifest_type
        print "Preparing %s" % manifest_name

        with open(os.path.join(resolve.get_build_path(), manifest_name), "w") as manifest:
            append_manifest(os.path.join(resolve.get_osv_base(), "%s.skel" % manifest_name), manifest)

            for module in modules:
                module_manifest = os.path.join(module.local_path, manifest_name)

                if os.path.exists(module_manifest):
                    print "Appending %s to %s" % (module_manifest, manifest_name)
                    append_manifest(module_manifest, manifest, variables={
                        'MODULE_DIR': module.local_path,
                        'OSV_BASE': resolve.get_osv_base()
                    })

                filemap_attr = '%s_files' % manifest_type
                if hasattr(module, filemap_attr):
                    filemap.as_manifest(getattr(module, filemap_attr), manifest.write)

            for app in basic_apps:
                app.prepare_manifest(resolve.get_build_path(), manifest_type, manifest)

            # Add a generated content here
            if manifest_type == 'usr':
                with open(os.path.join(resolve.get_build_path(), 'test.manifest.gen')) as src_file:
                    for line in src_file:
                        manifest.write(line)
Esempio n. 4
0
File: api.py Progetto: ayush1794/osv
 def prepare_manifest(self, build_dir, manifest_type, manifest):
     if manifest_type == 'usr':
         file_name = '30-auto-%02d' % self.sequence
         local_path = os.path.join(resolve.get_build_path(), file_name)
         with open(local_path, 'w') as cmdline_file:
             cmdline_file.write(self.cmdline)
         manifest.write('/init/%s: %s\n' % (file_name, local_path))
Esempio n. 5
0
 def prepare_manifest(self, build_dir, manifest_type, manifest):
     if manifest_type == 'usr':
         file_name = '30-auto-%02d' % self.sequence
         local_path = os.path.join(resolve.get_build_path(), file_name)
         with open(local_path, 'w') as cmdline_file:
             cmdline_file.write(self.cmdline)
         manifest.write('/init/%s: %s\n' % (file_name, local_path))
Esempio n. 6
0
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"
Esempio n. 7
0
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")
Esempio n. 8
0
def generate_manifests(modules, basic_apps):
    for manifest_type in ["usr", "bootfs"]:
        manifest_name = "%s.manifest" % manifest_type
        print "Preparing %s" % manifest_name

        with open(os.path.join(resolve.get_build_path(), manifest_name), "w") as manifest:
            append_manifest(os.path.join(resolve.get_osv_base(), "%s.skel" % manifest_name), manifest)

            for module in modules:
                module_dir = resolve.get_module_dir(module)
                module_manifest = os.path.join(module_dir, manifest_name)
                print "Appending %s to %s" % (module_manifest, manifest_name)
                append_manifest(
                    module_manifest, manifest, variables={"MODULE_DIR": module_dir, "OSV_BASE": resolve.get_osv_base()}
                )

            for app in basic_apps:
                app.prepare_manifest(resolve.get_build_path(), manifest_type, manifest)
Esempio n. 9
0
def generate_manifests(modules, basic_apps):
    for manifest_type in ["usr", "bootfs"]:
        manifest_name = "%s.manifest" % manifest_type
        print "Preparing %s" % manifest_name

        with open(os.path.join(resolve.get_build_path(), manifest_name), "w") as manifest:
            append_manifest(os.path.join(resolve.get_osv_base(), "%s.skel" % manifest_name), manifest)

            for module in modules:
                module_dir = resolve.get_module_dir(module)
                module_manifest = os.path.join(module_dir, manifest_name)
                print "Appending %s to %s" % (module_manifest, manifest_name)
                append_manifest(module_manifest, manifest, variables={
                        'MODULE_DIR': module_dir,
                        'OSV_BASE': resolve.get_osv_base()
                    })

            for app in basic_apps:
                app.prepare_manifest(resolve.get_build_path(), manifest_type, manifest)