Пример #1
0
def test_synthetic_construction_of_split_dependencies_from_same_package(
        mock_packages, config
):
    # Construct in a synthetic way (i.e. without using the solver)
    # the following spec:
    #
    #          b
    #  build /   \ link,run
    #    [email protected]   [email protected]
    #
    # To demonstrate that a spec can now hold two direct
    # dependencies from the same package
    root = Spec('b').concretized()
    link_run_spec = Spec('[email protected]').concretized()
    build_spec = Spec('[email protected]').concretized()

    root.add_dependency_edge(link_run_spec, deptype='link')
    root.add_dependency_edge(link_run_spec, deptype='run')
    root.add_dependency_edge(build_spec, deptype='build')

    # Check dependencies from the perspective of root
    assert len(root.dependencies()) == 2
    assert all(x.name == 'c' for x in root.dependencies())

    assert '@2.0' in root.dependencies(name='c', deptype='build')[0]
    assert '@1.0' in root.dependencies(name='c', deptype=('link', 'run'))[0]

    # Check parent from the perspective of the dependencies
    assert len(build_spec.dependents()) == 1
    assert len(link_run_spec.dependents()) == 1
    assert build_spec.dependents() == link_run_spec.dependents()
    assert build_spec != link_run_spec
Пример #2
0
def test_synthetic_construction_bootstrapping(mock_packages, config):
    # Construct the following spec:
    #
    #  [email protected]
    #    | build
    #  [email protected]
    #
    root = Spec('[email protected]').concretized()
    bootstrap = Spec('[email protected]').concretized()

    root.add_dependency_edge(bootstrap, deptype='build')

    assert len(root.dependencies()) == 1
    assert root.dependencies()[0].name == 'b'
    assert root.name == 'b'
Пример #3
0
def install_tarball(spec, args):
    s = Spec(spec)
    if s.external or s.virtual:
        tty.warn("Skipping external or virtual package %s" % spec.format())
        return
    for d in s.dependencies(deptype=('link', 'run')):
        tty.msg("Installing buildcache for dependency spec %s" % d)
        install_tarball(d, args)
    package = spack.repo.get(spec)
    if s.concrete and package.installed and not args.force:
        tty.warn("Package for spec %s already installed." % spec.format())
    else:
        tarball = bindist.download_tarball(spec)
        if tarball:
            if args.sha256:
                checker = spack.util.crypto.Checker(args.sha256)
                msg = ('cannot verify checksum for "{0}"' ' [expected={1}]')
                msg = msg.format(tarball, args.sha256)
                if not checker.check(tarball):
                    raise spack.binary_distribution.NoChecksumException(msg)
                tty.debug('Verified SHA256 checksum of the build cache')

            tty.msg('Installing buildcache for spec %s' % spec.format())
            bindist.extract_tarball(spec, tarball, args.allow_root,
                                    args.unsigned, args.force)
            spack.hooks.post_install(spec)
            spack.store.db.add(spec, spack.store.layout)
        else:
            tty.die('Download of binary cache file for spec %s failed.' %
                    spec.format())
Пример #4
0
    def test_compiler_in_nonbuildable_external_package(
            self, compiler, spec_str, expected, xfailold
    ):
        """Check that the compiler of a non-buildable external package does not
           spread to other dependencies, unless no other commpiler is specified."""
        packages_yaml = {
            'external-common-openssl': {
                'externals': [
                    {'spec': '[email protected]%' + compiler,
                     'prefix': '/usr'}
                ],
                'buildable': False
            }
        }
        spack.config.set('packages', packages_yaml)

        s = Spec(spec_str).concretized()
        if xfailold and spack.config.get('config:concretizer') == 'original':
            pytest.xfail('This only works on the ASP-based concretizer')
        assert s.satisfies(expected)
        assert 'external-common-perl' not in [d.name for d in s.dependencies()]
Пример #5
0
def install_tarball(spec, args):
    s = Spec(spec)
    if s.external or s.virtual:
        tty.warn("Skipping external or virtual package %s" % spec.format())
        return
    for d in s.dependencies(deptype=('link', 'run')):
        tty.msg("Installing buildcache for dependency spec %s" % d)
        install_tarball(d, args)
    package = spack.repo.get(spec)
    if s.concrete and package.installed and not args.force:
        tty.warn("Package for spec %s already installed." % spec.format())
    else:
        tarball = bindist.download_tarball(spec)
        if tarball:
            tty.msg('Installing buildcache for spec %s' % spec.format())
            bindist.extract_tarball(spec, tarball, args.allow_root,
                                    args.unsigned, args.force)
            spack.hooks.post_install(spec)
            spack.store.db.add(spec, spack.store.layout)
        else:
            tty.die('Download of binary cache file for spec %s failed.' %
                    spec.format())