Пример #1
0
 def add_build_tasks_init(cfg, component, init_group):
     pkgdir_task = BuildTask(cfg, init_group, 'pkgdir')
     pkgdir_task.add_create_dir(cfg.args.pkgdir)
     if not cfg.args.build_source_packages:
         return
     # Component sources are copied in an init task to ensure that
     # source packages contain the sources at the start of the
     # build, even if a bug in a component's build process
     # (e.g. missing or insufficient configuration of files to
     # touch on checkout) results in the source directory being
     # modified during the build.  If a component's build process
     # is known to modify the source directory intentionally, that
     # component's build tasks must create a separate copy for use
     # in the build.
     source_copy_group = BuildTask(cfg, init_group, 'source-copy', True)
     objdir = cfg.objdir_path(None, 'source-copy')
     for src_component in cfg.list_source_components():
         name = src_component.copy_name
         srcdir = src_component.vars.srcdir.get()
         srcdir_copy = os.path.join(objdir, name)
         copy_task = BuildTask(cfg, source_copy_group, name)
         copy_task.add_empty_dir_parent(srcdir_copy)
         copy_task.add_python(
             src_component.vars.vc.get().copy_without_metadata,
             (srcdir, srcdir_copy))
    def add_build_tasks_for_first_host(cfg, host, component, host_group):
        task = BuildTask(cfg, host_group, 'first-host')

        def py_test_fn():
            """Test Python build step failure."""
            raise ValueError('test failure')

        task.add_python(py_test_fn, ())
Пример #3
0
    def add_build_tasks_for_other_hosts(cfg, host, component, host_group):
        task = BuildTask(cfg, host_group, 'other-hosts')
        host_b = host.build_cfg
        objdir = cfg.objdir_path(host_b, '%s-other' % component.copy_name)
        task.add_empty_dir(objdir)

        def py_test_fn(arg1, arg2):
            """Test Python build step."""
            out_name = os.path.join(objdir, 'out')
            with open(out_name, 'w', encoding='utf-8') as outfile:
                outfile.write('%s %s\n' % (arg1, arg2))

        task.add_python(py_test_fn, ('test', 'python'))
Пример #4
0
 def add_build_tasks_for_first_host(cfg, host, component, host_group):
     _contribute_headers_tree(cfg, host, component, host_group, True)
     _contribute_shared_tree(cfg, host, component, host_group, True)
     # Build glibc for the build system, and use its localedef to
     # build locales.  The normal glibc configure options are not
     # used for this (they may only be appropriate for the target),
     # so the common support for autoconf-based components isn't
     # used either.
     host_b = host.build_cfg
     srcdir = component.vars.srcdir.get()
     objdir = cfg.objdir_path(host_b, 'glibc-host')
     group = BuildTask(cfg, host_group, 'glibc-host')
     init_task = BuildTask(cfg, group, 'init')
     init_task.add_empty_dir(objdir)
     cfg_task = BuildTask(cfg, group, 'configure')
     cfg_cmd = [
         os.path.join(srcdir, 'configure'),
         '--build=%s' % host_b.triplet,
         '--host=%s' % host_b.triplet, '--prefix=/usr'
     ]
     cfg_cmd.extend(host_b.configure_vars())
     cfg_cmd.append('BUILD_CC=%s' % ' '.join(host_b.tool('c-compiler')))
     cfg_task.add_command(cfg_cmd, cwd=objdir)
     build_task = BuildTask(cfg, group, 'build')
     build_task.add_make([], objdir)
     group = BuildTask(cfg, host_group, 'glibc-locales')
     group.depend('/%s/glibc-host' % host.name)
     # Building the host glibc itself does not depend on the target
     # compiler.  Building the locales does depend on the target
     # compiler (but not on the target libc), as it is used to
     # determine the endianness of each locale.
     group.depend_install(host_b, 'toolchain-1')
     group.provide_install(host_b, 'glibc-locales')
     objdir2 = cfg.objdir_path(host_b, 'glibc-locales')
     instdir = cfg.install_tree_path(host_b, 'glibc-locales')
     init_task = BuildTask(cfg, group, 'init')
     init_task.add_empty_dir(objdir2)
     init_task.add_empty_dir(instdir)
     build_task = BuildTask(cfg, group, 'build')
     build_task.add_python(
         _generate_locales_makefile,
         (cfg, component, srcdir, objdir, objdir2, instdir))
     build_task.add_make([], objdir2)
Пример #5
0
 def add_build_tasks_for_host(cfg, host, component, host_group):
     # The package-input install tree is contributed to by each
     # component that installs files intended to go in the final
     # release package.  This is an install tree for a PkgHost, not
     # for a BuildCfg.  This install tree is then subject to global
     # manipulations (such as hard-linking identical files,
     # replacing symlinks by hard links on hosts not supporting
     # symlinks, and stripping binaries) to produce the
     # package-output tree that corresponds to the exact data for
     # the release package.  Most manipulations, such as moving
     # files to different locations or removing files that are
     # installed by default but should not go in the final release
     # packages, should be done at the level of the individual
     # components; only a few manipulations are most appropriately
     # done globally just before packaging.
     host_group.declare_implicit_install(host, 'package-input')
     pkg_out_task = BuildTask(cfg, host_group, 'package-output')
     pkg_out_task.depend_install(host, 'package-input')
     pkg_out_task.provide_install(host, 'package-output')
     inst_in_path = cfg.install_tree_path(host, 'package-input')
     inst_out_path = cfg.install_tree_path(host, 'package-output')
     pkg_out_task.add_empty_dir_parent(inst_out_path)
     pkg_out_task.add_command(['cp', '-a', inst_in_path, inst_out_path])
     # The top-level directory in a package corresponds to the
     # contents of installdir.  In degenerate cases of nothing in a
     # package, installdir may not have been created (although the
     # package-input tree will always have been created, even if
     # empty).
     inst_out_main = os.path.join(inst_out_path, cfg.installdir_rel.get())
     pkg_out_task.add_create_dir(inst_out_main)
     if not host.have_symlinks():
         pkg_out_task.add_python(replace_symlinks,
                                 (cfg.context, inst_out_main))
     pkg_out_task.add_python(fix_perms, (inst_out_main,))
     pkg_out_task.add_python(hard_link_files, (cfg.context, inst_out_main))
     # Creating the package-output install tree is separated from
     # creating a .tar.xz package from it so that .tar.xz creation
     # can run in parallel with other package format creation using
     # the same tree.
     pkg_task = BuildTask(cfg, host_group, 'package-tar-xz')
     pkg_task.depend_install(host, 'package-output')
     pkg_path = cfg.pkgdir_path(host, '.tar.xz')
     pkg_task.add_command(tar_command(
         pkg_path, cfg.pkg_name_no_target_build.get(),
         cfg.source_date_epoch.get()),
                              cwd=inst_out_main)