Esempio n. 1
0
def main():
  bt = build_target.make_host_build_target()
  mutations = bt.to_dict()
  del mutations['build_path']
  am = FPUT.make_artifact_manager(debug = False, recipes = FPUT.TEST_RECIPES, build_target = bt,
                                  mutations = mutations)
  wanted =  [
    package_descriptor('orange_juice', '1.4.5'),
    package_descriptor('smoothie', '1.0.0'),
   ]
  
  tm = tools_manager('/tmp/new_tools', am)
  tm.ensure_tools(wanted)
  tm.ensure_tools(wanted)
Esempio n. 2
0
 def _filenames(clazz, env, packages):
     filenames = []
     for package in packages:
         pdesc = package_descriptor(package.name, package.version)
         pmeta = env.artifact_manager.find_by_package_descriptor(
             pdesc, env.config.build_target, relative_filename=False)
         filenames.append(pmeta.filename)
     return filenames
Esempio n. 3
0
 def descriptors(self):
     rows = self._db.select_namedtuples(
         '''select name, version, revision, epoch from packages order by name asc'''
     )
     result = package_descriptor_list()
     for row in rows:
         result.append(
             package_descriptor(
                 row.name,
                 build_version(row.version, row.revision, row.epoch)))
     return result
Esempio n. 4
0
 def test_libjpeg(self):
     filename = self.data_path('build_libjpeg.rebc')
     script = self._load_builder_script(filename)
     expected_requirements = []
     expected_properties = {}
     self.assertEqual(
         package_descriptor('libjpeg',
                            '9a-1',
                            requirements=expected_requirements,
                            properties=expected_properties),
         script.descriptor)
     self.assertEqual([], script.descriptor.requirements)
Esempio n. 5
0
 def test_zlib(self):
     filename = self.data_path('build_zlib.rebc')
     script = self._load_builder_script(filename)
     expected_requirements = []
     expected_properties = {}
     self.assertEqual(
         package_descriptor('zlib',
                            '1.2.8-1',
                            requirements=expected_requirements,
                            properties=expected_properties).__dict__,
         script.descriptor.__dict__)
     self.assertEqual([], script.descriptor.requirements)
def _command_create(root_dir, name, version, revision):
    root_dir = path.abspath(root_dir)
    #print "         root_dir: ", root_dir
    #print "             name: ", name
    #print "          version: ", version
    #print "         revision: ", revision

    package_info = package_descriptor(name, version, revision)
    base_dir = package_info.full_name
    filename = '%s.tar.gz' % (base_dir)
    print("         base_dir: ", base_dir)
    archiver.create(filename, root_dir, base_dir=base_dir)
Esempio n. 7
0
    def test_libopenjpeg(self):
        filename = self.data_path('build_libopenjpeg.rebc')
        script = self._load_builder_script(filename)

        expected_requirements = requirement.parse('cmake(all) >= 3.3.1-1')
        expected_properties = {}
        expected_package_info = package_descriptor(
            'libopenjpeg',
            '2.1-1',
            requirements=expected_requirements,
            properties=expected_properties)
        self.assertEqual(expected_package_info, script.descriptor)
        self.assertEqual(expected_requirements, script.descriptor.requirements)
Esempio n. 8
0
    def test_libpng(self):
        filename = self.data_path('rebuild.recipe')
        script = self._load_builder_script(filename)

        expected_requirements = requirement.parse('zlib(all) >= 1.2.8-1')
        expected_properties = {}
        expected_package_info = package_descriptor(
            'libpng',
            '1.6.18-1',
            requirements=expected_requirements,
            properties=expected_properties)

        self.assertEqual(expected_package_info, script.descriptor)
        self.assertEqual(expected_requirements, script.descriptor.requirements)
Esempio n. 9
0
 def _parse_package(self, node):
     name, version = self._parse_package_header(node)
     enabled = True
     properties = {}
     requirements = []
     steps = []
     instructions = []
     enabled = 'True'
     load = []
     for child in node.children:
         text = child.data.text
         if text.startswith('properties'):
             properties = self._parse_properties(child)
         elif text.startswith('requirements'):
             requirements.extend(self._parse_requirements(child))
         elif text.startswith('steps'):
             steps = self._parse_steps(child)
         elif text.startswith('enabled'):
             enabled = self._parse_enabled(child)
         elif text.startswith('load'):
             load = self._parse_load(child)
             self._load_code(load, child)
         elif text.startswith('instructions'):
             instructions = self._parse_instructions(child)
         elif text.startswith('export_compilation_flags_requirements'):
             export_compilation_flags_requirements = self._parse_export_compilation_flags_requirements(
                 child)
             properties[
                 'export_compilation_flags_requirements'] = export_compilation_flags_requirements
         else:
             self._error('unknown recipe section: \"%s\"' % (text), node)
     desc = package_descriptor(name,
                               version,
                               requirements=requirements,
                               properties=properties)
     return recipe(2, self.filename, enabled, properties, requirements,
                   desc, instructions, steps, load)
Esempio n. 10
0
 def test_descriptor(self):
     self.assertEqual(
         package_descriptor('kiwi', '6.7.8-2', self.TEST_PROPERTIES,
                            self.TEST_REQUIREMENTS),
         self.TEST_ENTRY.descriptor)
Esempio n. 11
0
 def _load_row_to_package_descriptor(self, row):
     assert row
     return package_descriptor(
         row.name, build_version(row.version, row.revision, row.epoch),
         json.loads(row.properties),
         util.sql_decode_requirements(row.requirements))
Esempio n. 12
0
 def descriptor(self):
   return package_descriptor(self.name, str(self.build_version), properties = self.properties, requirements = self.requirements)
Esempio n. 13
0
    def create_package(self, filename, debug=False):
        tmp_dir = temp_file.make_temp_dir(delete=not debug)
        if debug:
            print('tmp_dir: %s' % (tmp_dir))
        stage_dir = path.join(tmp_dir, 'stage')
        files_dir = path.join(stage_dir, 'files')
        env_files_dir = path.join(stage_dir, 'env')
        file_util.mkdir(files_dir)
        file_util.mkdir(env_files_dir)
        temp_file.write_temp_files(files_dir, self.files)
        temp_file.write_temp_files(env_files_dir, self.env_files)

        tmp_compiler_dir = path.join(tmp_dir, 'objects')

        cc = compiler(build_target.make_host_build_target())

        include_path = []
        lib_path = []

        static_c_libs = self.objects.get('static_c_libs', [])
        for static_c_lib in static_c_libs:
            sources, headers = static_c_lib.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, static_c_lib.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, static_c_lib.filename)
            include_path.append(include_dir)
            lib_path.append(lib_dir)
            cflags = ['-I%s' % (include_dir)]
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            lib_filename = path.join(tmp_compiler_dir, static_c_lib.filename,
                                     path.basename(static_c_lib.filename))
            lib = cc.make_static_lib(lib_filename,
                                     [target.object for target in targets])
            file_util.copy(lib, path.join(files_dir, static_c_lib.filename))
            for header in headers:
                file_util.copy(header.path,
                               path.join(files_dir, header.filename))

        shared_c_libs = self.objects.get('shared_c_libs', [])
        for shared_c_lib in shared_c_libs:
            sources, headers = shared_c_lib.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, shared_c_lib.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, shared_c_lib.filename)
            include_path.append(include_dir)
            lib_path.append(lib_dir)
            cflags = ['-I%s' % (include_dir)]
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            lib_filename = path.join(tmp_compiler_dir, shared_c_lib.filename,
                                     path.basename(shared_c_lib.filename))
            lib = cc.make_shared_lib(lib_filename,
                                     [target.object for target in targets])
            file_util.copy(lib, path.join(files_dir, shared_c_lib.filename))
            for header in headers:
                file_util.copy(header.path,
                               path.join(files_dir, header.filename))

        c_programs = self.objects.get('c_programs', [])
        for c_program in c_programs:
            sources, headers = c_program.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, c_program.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, c_program.filename)
            cflags = ['-I%s' % (include_dir)]
            cflags += ['-I%s' % (inc) for inc in include_path]
            ldflags = ['-L%s' % (lib_dir)]
            ldflags += ['-L%s' % (lib) for lib in lib_path]
            ldflags += c_program.ldflags or []
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            exe_filename = path.join(tmp_compiler_dir, c_program.filename,
                                     path.basename(c_program.filename))
            exe = cc.link_exe(exe_filename,
                              [target.object for target in targets],
                              ldflags=ldflags)
            file_util.copy(exe, path.join(files_dir, c_program.filename))

        pkg_desc = package_descriptor(self.metadata.name,
                                      self.metadata.build_version,
                                      properties=self.properties,
                                      requirements=self.requirements)
        return package.create_package(filename, pkg_desc,
                                      self.metadata.build_target, stage_dir)