Exemplo n.º 1
0
 def performance(self, value):
     if value == self._performance:
         return
     self._performance = value
     if self._performance:
         self.timer = debug_timer('perf', 'info', disabled=False)
         log.configure('perf=info format=brief')
     else:
         self.timer = debug_timer('perf', 'debug', disabled=True)
Exemplo n.º 2
0
 def __init__(self):
     self._build_root = None
     self.build_target = build_target.make_host_build_target(
         level=build_level.RELEASE)
     self.host_build_target = build_target.make_host_build_target(
         level=build_level.RELEASE)
     self.root_dir = None
     self.deps_only = False
     self.disabled = False
     self.keep_going = False
     self.no_checksums = False
     self.no_network = False
     self.recipes_only = False
     self.scratch = False
     self.skip_tests = False
     self.skip_to_step = None
     self.source_dir = None
     self.source_git = None
     self.source_pcloud = None
     self.third_party_prefix = self.DEFAULT_THIRD_PARTY_PREFIX
     self.timestamp = time_util.timestamp()
     self.tmp_dir = None
     self.tools_only = False
     self.users = False
     self.verbose = False
     self.wipe = False
     self._performance = False
     self.timer = debug_timer('perf', 'debug', disabled=True)
     self._performance = False
     self._trash_dir = None
     self.artifacts_dir = None
     self.download_only = False
Exemplo n.º 3
0
    def xtest_performance(self):
        db = DB(self._make_tmp_db_path())
        TEST_REQUIREMENTS = RL.parse('foo >= 1.2.3-1 bar >= 6.6.6-1',
                                     default_system_mask=build_system.ALL)
        TEST_FILES = FCL([('lib/libfoo.a', 'c1'), ('include/libfoo.h', 'c2')])
        TEST_PROPERTIES = {'p1': 'v1', 'p2': 6}

        t = debug_timer('x', level='error')
        n = 1000
        t.start('insert %d ()' % (n))
        for i in range(1, n + 1):
            name = 'n%s' % (i)
            version = '1.0.0'
            files = FCL([('lib/libfoo%s.a' % (i), 'c1'),
                         ('include/libfoo%s.h' % (i), 'c2')])
            p = PE(name, version, 0, 0, TEST_REQUIREMENTS, TEST_PROPERTIES,
                   files)
            db.add_package(p)
        t.stop()

        t.start('%s: list_all()')
        db.list_all()
        t.stop()

        t.start('%s: names()')
        names = db.names()
        print(len(names))
        for name in names:
            files = db.files(name)
            #print('%s: %s' % (name, len(files)))
        t.stop()
Exemplo n.º 4
0
    def create_package(clazz,
                       tarball_path,
                       pkg_desc,
                       build_target,
                       stage_dir,
                       timer=None):
        timer = timer or debug_timer('package', disabled=True)

        properties = dict_util.filter_without_keys(
            pkg_desc.properties, ['export_compilation_flags_requirements'])

        # Hack the export_compilation_flags_requirements property to be a plain
        # string list instead of the masked config it is
        key = 'export_compilation_flags_requirements'
        if key in pkg_desc.properties:
            properties[key] = [str(x) for x in pkg_desc.properties[key]]

        files_dir = path.join(stage_dir, 'files')
        timer.start('create_package - find files')
        files = file_find.find(files_dir,
                               relative=True,
                               file_type=file_find.FILE | file_find.LINK)
        timer.stop()
        timer.start('create_package - files checksums')
        files_checksum_list = file_checksum_list.from_files(files,
                                                            root_dir=files_dir)
        timer.stop()

        env_files_dir = path.join(stage_dir, 'env')
        timer.start('create_package - find env_files')
        if path.isdir(env_files_dir):
            env_files = file_find.find(env_files_dir,
                                       relative=True,
                                       file_type=file_find.FILE
                                       | file_find.LINK)
        else:
            env_files = []
        timer.stop()
        timer.start('create_package - env_files checksums')
        env_files_checksum_list = file_checksum_list.from_files(
            env_files, root_dir=env_files_dir)
        timer.stop()

        pkg_files = package_files(files_checksum_list, env_files_checksum_list)

        metadata = package_metadata(
            '', pkg_desc.name, pkg_desc.version.upstream_version,
            pkg_desc.version.revision, pkg_desc.version.epoch,
            build_target.system, build_target.level, build_target.arch,
            build_target.distro, build_target.distro_version,
            pkg_desc.requirements, properties, pkg_files)
        metadata_filename = path.join(stage_dir, clazz.METADATA_FILENAME)
        file_util.save(metadata_filename, content=metadata.to_json())
        clazz._create_package(tarball_path, stage_dir, timer)
        return clazz._create_package_result(tarball_path, metadata)
Exemplo n.º 5
0
 def __init__(self):
     self.timer = debug_timer('test_compound_step', 'info')
Exemplo n.º 6
0
 def __init__(self):
   log.add_logging(self, 'artifact_manager')
   build_blurb.add_blurb(self, 'artifact_manager')
   self._reset_requirement_managers()
   self._read_only = False
   self._timer = debug_timer('am', 'error', disabled = True)
Exemplo n.º 7
0
    def _make_test_context(clazz, config, test_source):
        timer = debug_timer('am', 'error', disabled=True)
        timer.start('_make_test_context()')
        test_name = path.splitext(path.basename(test_source))[0]
        test_root_dir = path.join(config.script.test_dir, test_name)
        pm_root_dir = path.join(test_root_dir, 'requirements')

        pm = package_manager(pm_root_dir, config.artifact_manager)

        timer.start('load tarball')
        package = pm.load_tarball(config.package_tarball,
                                  config.script.build_target)
        timer.stop()
        pd = package.package_descriptor

        timer.start('resolve_deps')
        deps_packages = config.script.resolve_deps(['RUN', 'TEST'], False)
        timer.stop()
        all_packages = deps_packages + [pd]
        all_packages_names = [p.name for p in all_packages]

        timer.start('install packages')
        pm.install_packages(deps_packages, config.script.build_target,
                            ['RUN', 'TEST'])
        timer.stop()
        timer.start('install tarball')
        pm.install_tarball(config.package_tarball, ['RUN', 'TEST'])
        timer.stop()

        tool_reqs = pd.requirements.filter_by(
            ['TOOL'], config.script.env.config.host_build_target.system)
        tool_reqs_names = tool_reqs.names()
        timer.start('resolve tools deps')
        resolved_tool_reqs = config.artifact_manager.resolve_deps(
            tool_reqs_names, config.script.env.config.host_build_target,
            ['TOOL'], True)
        timer.stop()
        timer.start('tools update')
        config.tools_manager.ensure_tools(resolved_tool_reqs)
        timer.stop()

        saved_env = os_env.clone_current_env()

        shell_env = os_env.make_clean_env()
        shell_env = config.tools_manager.transform_env(shell_env,
                                                       resolved_tool_reqs)
        shell_env = pm.transform_env(shell_env, all_packages_names)

        test_source_with_replacements = path.join(test_root_dir,
                                                  path.basename(test_source))
        substitutions = {}
        substitutions.update(config.script.substitutions)
        substitutions.update({
            'REBUILD_TEST_NAME': test_name,
            'REBUILD_SHELL_FRAMEWORK_DIR': pm.shell_framework_dir,
            '_BES_DEV_ROOT': pm.shell_framework_dir,
        })
        for kv in config.extra_env:
            shell_env[kv.key] = variable.substitute(kv.value, substitutions)
        shell_env.update(substitutions)
        file_replace.copy_with_substitute(test_source,
                                          test_source_with_replacements,
                                          substitutions,
                                          backup=False)
        timer.stop()
        return clazz._test_context(package.package_descriptor, shell_env,
                                   saved_env, test_root_dir, test_name,
                                   test_source_with_replacements, pm)