Пример #1
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())
def install_tarball(spec, args):
    s = spack.spec.Spec(spec)
    yes_to_all = False
    force = False
    if args.yes_to_all:
        yes_to_all = True
    if args.force:
        force = True
    for d in s.dependencies():
        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 force:
        tty.warn("Package for spec %s already installed." % spec.format(),
                 " Use -f flag to overwrite.")
    else:
        tarball = bindist.download_tarball(spec)
        if tarball:
            tty.msg('Installing buildcache for spec %s' % spec.format())
            try:
                bindist.extract_tarball(spec, tarball, yes_to_all, force)
            except NoOverwriteException as e:
                tty.warn("%s exists. use -f to force overwrite." % e.args)
            except NoVerifyException:
                tty.die("Package spec file failed signature verification,"
                        " use -y flag to install build cache")
            except NoChecksumException:
                tty.die("Package tarball failed checksum verification,"
                        " use -y flag to install build cache")
            finally:
                spack.store.db.reindex(spack.store.layout)
        else:
            tty.die('Download of binary cache file for spec %s failed.' %
                    spec.format())
Пример #3
0
def install_single_tarball(spec,
                           args,
                           catch_exceptions=False,
                           perform_post_install=True):
    """Install a single tarball for given spec.
    NOTE: Does NOT install dependencies!"""
    s = Spec(spec)

    # use return value dictionary in order to allow for additional return
    # values in the future
    retval = {
        "reindex": False,
        "error": None,
    }

    if s.external or s.virtual:
        tty.warn("Skipping external or virtual package %s" % spec.format())
        return retval

    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())
            try:
                bindist.extract_tarball(spec, tarball, args.allow_root,
                                        args.unsigned, args.force)
                if perform_post_install:
                    # In multiprocessing situations, post_install-hooks have to
                    # be triggered after all tar balls have been extracted as
                    # functionatility might depend on files being present
                    # (i.e., extracted).
                    spack.hooks.post_install(spec)
                spack.store.db.add(spec, spack.store.layout)
            except spack.error.SpackError as e:
                if catch_exceptions:
                    retval["error"] = "Spec %s: %s" % (spec.format(), str(e))
                else:
                    raise e
            finally:
                retval["reindex"] = True
        else:
            retval["error"] = 'Download of binary cache file for spec '\
                              '%s failed.' % spec.format()
            if not catch_exceptions:
                tty.die(retval["error"])
    return retval
Пример #4
0
def install_tarball(spec, args):
    s = spack.spec.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.store.db.reindex(spack.store.layout)
        else:
            tty.die('Download of binary cache file for spec %s failed.' %
                    spec.format())
Пример #5
0
def install_tarball(spec, args):
    s = spack.spec.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.store.reindex()
        else:
            tty.die('Download of binary cache file for spec %s failed.' %
                    spec.format())