Exemplo n.º 1
0
def test_built_spec_cache(tmpdir,
                          install_mockery):
    """ Because the buildcache list command fetches the buildcache index
    and uses it to populate the binary_distribution built spec cache, when
    this test calls get_mirrors_for_spec, it is testing the popluation of
    that cache from a buildcache index. """
    global mirror_path_rel

    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args(
        ['add', '--scope', 'site', 'test-mirror-rel', 'file://%s' % mirror_path_rel])
    mirror.mirror(mparser, margs)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    list_args = ['list', '-a', '-l']
    args = parser.parse_args(list_args)
    buildcache.buildcache(parser, args)

    gspec = Spec('garply')
    gspec.concretize()

    cspec = Spec('corge')
    cspec.concretize()

    full_hash_map = {
        'garply': gspec.full_hash(),
        'corge': cspec.full_hash(),
    }

    gspec_results = bindist.get_mirrors_for_spec(gspec)

    gspec_mirrors = {}
    for result in gspec_results:
        s = result['spec']
        assert(s._full_hash == full_hash_map[s.name])
        assert(result['mirror_url'] not in gspec_mirrors)
        gspec_mirrors[result['mirror_url']] = True

    cspec_results = bindist.get_mirrors_for_spec(cspec, full_hash_match=True)

    cspec_mirrors = {}
    for result in cspec_results:
        s = result['spec']
        assert(s._full_hash == full_hash_map[s.name])
        assert(result['mirror_url'] not in cspec_mirrors)
        cspec_mirrors[result['mirror_url']] = True

    bindist.clear_spec_cache()

    margs = mparser.parse_args(
        ['rm', '--scope', 'site', 'test-mirror-rel'])
    mirror.mirror(mparser, margs)
Exemplo n.º 2
0
def test_built_spec_cache(tmpdir, install_mockery):
    """ Test what's the situation now """
    global mirror_path_rel

    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args([
        'add', '--scope', 'site', 'test-mirror-rel',
        'file://%s' % mirror_path_rel
    ])
    mirror.mirror(mparser, margs)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    list_args = ['list', '-a', '-l']
    args = parser.parse_args(list_args)
    buildcache.buildcache(parser, args)

    gspec = Spec('garply')
    gspec.concretize()

    cspec = Spec('corge')
    cspec.concretize()

    full_hash_map = {
        'garply': gspec.full_hash(),
        'corge': cspec.full_hash(),
    }

    gspec_results = bindist.get_spec(gspec)

    gspec_mirrors = {}
    for result in gspec_results:
        s = result['spec']
        assert (s._full_hash == full_hash_map[s.name])
        assert (result['mirror_url'] not in gspec_mirrors)
        gspec_mirrors[result['mirror_url']] = True

    cspec_results = bindist.get_spec(cspec, full_hash_match=True)

    cspec_mirrors = {}
    for result in cspec_results:
        s = result['spec']
        assert (s._full_hash == full_hash_map[s.name])
        assert (result['mirror_url'] not in cspec_mirrors)
        cspec_mirrors[result['mirror_url']] = True

    bindist.clear_spec_cache()

    margs = mparser.parse_args(['rm', '--scope', 'site', 'test-mirror-rel'])
    mirror.mirror(mparser, margs)
Exemplo n.º 3
0
def test_relative_rpaths_create_default_layout(tmpdir, mirror_directory_rel,
                                               install_mockery):
    """
    Test the creation and installation of buildcaches with relative
    rpaths into the default directory layout scheme.
    """

    gspec = Spec('garply')
    gspec.concretize()
    cspec = Spec('corge')
    cspec.concretize()

    global mirror_path_rel
    mirror_path_rel = mirror_directory_rel
    # Install patchelf needed for relocate in linux test environment
    iparser = argparse.ArgumentParser()
    install.setup_parser(iparser)
    # Install some packages with dependent packages
    iargs = iparser.parse_args(['--no-cache', cspec.name])
    install.install(iparser, iargs)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # set default buildcache args
    create_args = [
        'create', '-a', '-u', '-r', '-d',
        str(mirror_path_rel), cspec.name
    ]

    # create build cache with relatived rpaths
    args = parser.parse_args(create_args)
    buildcache.buildcache(parser, args)
    # create mirror index
    args = parser.parse_args(
        ['update-index', '-d',
         'file://%s' % str(mirror_path_rel)])
    buildcache.buildcache(parser, args)
    # Uninstall the package and deps
    uparser = argparse.ArgumentParser()
    uninstall.setup_parser(uparser)
    uargs = uparser.parse_args(['-y', '--dependents', gspec.name])
    uninstall.uninstall(uparser, uargs)

    bindist.clear_spec_cache()
    spack.stage.purge()
Exemplo n.º 4
0
def test_relative_rpaths_install_default_layout(tmpdir,
                                                install_mockery):
    """
    Test the creation and installation of buildcaches with relative
    rpaths into the default directory layout scheme.
    """

    gspec = Spec('garply')
    gspec.concretize()
    cspec = Spec('corge')
    cspec.concretize()

    global mirror_path_rel
    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args(
        ['add', '--scope', 'site', 'test-mirror-rel', 'file://%s' % mirror_path_rel])
    mirror.mirror(mparser, margs)

    iparser = argparse.ArgumentParser()
    install.setup_parser(iparser)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # set default buildcache args
    install_args = ['install', '-a', '-u', '-f',
                    cspec.name]

    # install buildcache created with relativized rpaths
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    # This gives warning that spec is already installed
    buildcache.buildcache(parser, args)

    # Uninstall the package and deps
    uparser = argparse.ArgumentParser()
    uninstall.setup_parser(uparser)
    uargs = uparser.parse_args(['-y', '--dependents', gspec.name])
    uninstall.uninstall(uparser, uargs)

    # install build cache
    buildcache.buildcache(parser, args)

    # test overwrite install
    install_args.insert(install_args.index('-a'), '-f')
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    bindist.clear_spec_cache()
    spack.stage.purge()
    margs = mparser.parse_args(
        ['rm', '--scope', 'site', 'test-mirror-rel'])
    mirror.mirror(mparser, margs)
Exemplo n.º 5
0
def test_default_rpaths_install_nondefault_layout(tmpdir,
                                                  install_mockery):
    """
    Test the creation and installation of buildcaches with default rpaths
    into the non-default directory layout scheme.
    """

    gspec = Spec('garply')
    gspec.concretize()
    cspec = Spec('corge')
    cspec.concretize()

    global mirror_path_def
    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args(
        ['add', '--scope', 'site', 'test-mirror-def', 'file://%s' % mirror_path_def])
    mirror.mirror(mparser, margs)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # Set default buildcache args
    install_args = ['install', '-a', '-u', '%s' % cspec.name]

    # Install some packages with dependent packages
    # test install in non-default install path scheme
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)
    # test force install in non-default install path scheme
    install_args.insert(install_args.index('-a'), '-f')
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    bindist.clear_spec_cache()
    spack.stage.purge()
    margs = mparser.parse_args(
        ['rm', '--scope', 'site', 'test-mirror-def'])
    mirror.mirror(mparser, margs)
Exemplo n.º 6
0
def test_relative_rpaths_install_nondefault(tmpdir, install_mockery):
    """
    Test the installation of buildcaches with relativized rpaths
    into the non-default directory layout scheme.
    """

    gspec = Spec('garply')
    gspec.concretize()
    cspec = Spec('corge')
    cspec.concretize()

    global mirror_path_rel

    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args([
        'add', '--scope', 'site', 'test-mirror-rel',
        'file://%s' % mirror_path_rel
    ])
    mirror.mirror(mparser, margs)

    # Install patchelf needed for relocate in linux test environment
    iparser = argparse.ArgumentParser()
    install.setup_parser(iparser)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # Set default buildcache args
    install_args = ['install', '-a', '-u', '%s' % cspec.name]

    # test install in non-default install path scheme and relative path
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    bindist._cached_specs = set()
    spack.stage.purge()
    margs = mparser.parse_args(['rm', '--scope', 'site', 'test-mirror-rel'])
    mirror.mirror(mparser, margs)
Exemplo n.º 7
0
def test_buildcache(mock_archive, tmpdir):
    # tweak patchelf to only do a download
    pspec = Spec("patchelf")
    pspec.concretize()
    pkg = spack.repo.get(pspec)
    fake_fetchify(pkg.fetcher, pkg)
    mkdirp(os.path.join(pkg.prefix, "bin"))
    patchelfscr = os.path.join(pkg.prefix, "bin", "patchelf")
    f = open(patchelfscr, 'w')
    body = """#!/bin/bash
echo $PATH"""
    f.write(body)
    f.close()
    st = os.stat(patchelfscr)
    os.chmod(patchelfscr, st.st_mode | stat.S_IEXEC)

    # Install the test package
    spec = Spec('trivial-install-test-package')
    spec.concretize()
    assert spec.concrete
    pkg = spec.package
    fake_fetchify(mock_archive.url, pkg)
    pkg.do_install()
    pkghash = '/' + str(spec.dag_hash(7))

    # Put some non-relocatable file in there
    filename = os.path.join(spec.prefix, "dummy.txt")
    with open(filename, "w") as script:
        script.write(spec.prefix)

    # Create an absolute symlink
    linkname = os.path.join(spec.prefix, "link_to_dummy.txt")
    os.symlink(filename, linkname)

    # Create the build cache  and
    # put it directly into the mirror
    mirror_path = os.path.join(str(tmpdir), 'test-mirror')
    spack.mirror.create(mirror_path, specs=[])

    # register mirror with spack config
    mirrors = {'spack-mirror-test': 'file://' + mirror_path}
    spack.config.set('mirrors', mirrors)

    stage = spack.stage.Stage(
        mirrors['spack-mirror-test'], name="build_cache", keep=True)
    stage.create()

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    create_args = ['create', '-a', '-f', '-d', mirror_path, pkghash]
    # Create a private key to sign package with if gpg2 available
    spack.util.gpg.create(name='test key 1', expires='0',
                          email='*****@*****.**',
                          comment='Spack test key')

    create_args.insert(create_args.index('-a'), '--rebuild-index')

    args = parser.parse_args(create_args)
    buildcache.buildcache(parser, args)
    # trigger overwrite warning
    buildcache.buildcache(parser, args)

    # Uninstall the package
    pkg.do_uninstall(force=True)

    install_args = ['install', '-a', '-f', pkghash]
    args = parser.parse_args(install_args)
    # Test install
    buildcache.buildcache(parser, args)

    files = os.listdir(spec.prefix)

    assert 'link_to_dummy.txt' in files
    assert 'dummy.txt' in files

    # Validate the relocation information
    buildinfo = bindist.read_buildinfo_file(spec.prefix)
    assert(buildinfo['relocate_textfiles'] == ['dummy.txt'])
    assert(buildinfo['relocate_links'] == ['link_to_dummy.txt'])

    # create build cache with relative path
    create_args.insert(create_args.index('-a'), '-f')
    create_args.insert(create_args.index('-a'), '-r')
    args = parser.parse_args(create_args)
    buildcache.buildcache(parser, args)

    # Uninstall the package
    pkg.do_uninstall(force=True)

    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    # test overwrite install
    install_args.insert(install_args.index('-a'), '-f')
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    files = os.listdir(spec.prefix)
    assert 'link_to_dummy.txt' in files
    assert 'dummy.txt' in files
#    assert os.path.realpath(
#        os.path.join(spec.prefix, 'link_to_dummy.txt')
#    ) == os.path.realpath(os.path.join(spec.prefix, 'dummy.txt'))

    args = parser.parse_args(['keys'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', 'trivial'])
    buildcache.buildcache(parser, args)

    # Copy a key to the mirror to have something to download
    shutil.copyfile(mock_gpg_keys_path + '/external.key',
                    mirror_path + '/external.key')

    args = parser.parse_args(['keys'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['keys', '-f'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['keys', '-i', '-t'])
    buildcache.buildcache(parser, args)

    # unregister mirror with spack config
    mirrors = {}
    spack.config.set('mirrors', mirrors)
    shutil.rmtree(mirror_path)
    stage.destroy()

    # Remove cached binary specs since we deleted the mirror
    bindist._cached_specs = set()
Exemplo n.º 8
0
def test_default_rpaths_create_install_default_layout(tmpdir,
                                                      mirror_directory_def,
                                                      install_mockery):
    """
    Test the creation and installation of buildcaches with default rpaths
    into the default directory layout scheme.
    """

    gspec = Spec('garply')
    gspec.concretize()
    cspec = Spec('corge')
    cspec.concretize()

    iparser = argparse.ArgumentParser()
    install.setup_parser(iparser)
    # Install some packages with dependent packages
    iargs = iparser.parse_args(['--no-cache', cspec.name])
    install.install(iparser, iargs)

    global mirror_path_def
    mirror_path_def = mirror_directory_def
    mparser = argparse.ArgumentParser()
    mirror.setup_parser(mparser)
    margs = mparser.parse_args(
        ['add', '--scope', 'site', 'test-mirror-def', 'file://%s' % mirror_path_def])
    mirror.mirror(mparser, margs)
    margs = mparser.parse_args(['list'])
    mirror.mirror(mparser, margs)

    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # Set default buildcache args
    create_args = ['create', '-a', '-u', '-d', str(mirror_path_def),
                   cspec.name]
    install_args = ['install', '-a', '-u', cspec.name]

    # Create a buildache
    args = parser.parse_args(create_args)
    buildcache.buildcache(parser, args)
    # Test force overwrite create buildcache
    create_args.insert(create_args.index('-a'), '-f')
    args = parser.parse_args(create_args)
    buildcache.buildcache(parser, args)
    # create mirror index
    args = parser.parse_args(['update-index', '-d', 'file://%s' % str(mirror_path_def)])
    buildcache.buildcache(parser, args)
    # list the buildcaches in the mirror
    args = parser.parse_args(['list', '-a', '-l', '-v'])
    buildcache.buildcache(parser, args)

    # Uninstall the package and deps
    uparser = argparse.ArgumentParser()
    uninstall.setup_parser(uparser)
    uargs = uparser.parse_args(['-y', '--dependents', gspec.name])
    uninstall.uninstall(uparser, uargs)

    # test install
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    # This gives warning that spec is already installed
    buildcache.buildcache(parser, args)

    # test overwrite install
    install_args.insert(install_args.index('-a'), '-f')
    args = parser.parse_args(install_args)
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['keys', '-f'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', '-a'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', '-l', '-v'])
    buildcache.buildcache(parser, args)
    bindist.clear_spec_cache()
    spack.stage.purge()
    margs = mparser.parse_args(
        ['rm', '--scope', 'site', 'test-mirror-def'])
    mirror.mirror(mparser, margs)
Exemplo n.º 9
0
def test_packaging(mock_archive, tmpdir):
    # tweak patchelf to only do a download
    spec = Spec("patchelf")
    spec.concretize()
    pkg = spack.repo.get(spec)
    fake_fetchify(pkg.fetcher, pkg)
    mkdirp(os.path.join(pkg.prefix, "bin"))
    patchelfscr = os.path.join(pkg.prefix, "bin", "patchelf")
    f = open(patchelfscr, 'w')
    body = """#!/bin/bash
echo $PATH"""
    f.write(body)
    f.close()
    st = os.stat(patchelfscr)
    os.chmod(patchelfscr, st.st_mode | stat.S_IEXEC)

    # Install the test package
    spec = Spec('trivial-install-test-package')
    spec.concretize()
    assert spec.concrete
    pkg = spack.repo.get(spec)
    fake_fetchify(mock_archive.url, pkg)
    pkg.do_install()
    pkghash = '/' + spec.dag_hash(7)

    # Put some non-relocatable file in there
    filename = os.path.join(spec.prefix, "dummy.txt")
    with open(filename, "w") as script:
        script.write(spec.prefix)

    # Create the build cache  and
    # put it directly into the mirror

    mirror_path = os.path.join(str(tmpdir), 'test-mirror')
    specs = [spec]
    spack.mirror.create(mirror_path, specs, no_checksum=True)

    # register mirror with spack config
    mirrors = {'spack-mirror-test': 'file://' + mirror_path}
    spack.config.update_config('mirrors', mirrors)

    stage = spack.stage.Stage(mirrors['spack-mirror-test'],
                              name="build_cache",
                              keep=True)
    stage.create()
    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # Create a private key to sign package with if gpg2 available
    if has_gnupg2():
        spack.util.gpg.Gpg.create(name='test key 1',
                                  expires='0',
                                  email='*****@*****.**',
                                  comment='Spack test key')
        # Create build cache with signing
        args = parser.parse_args(['create', '-d', mirror_path, str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # test overwrite install
        args = parser.parse_args(['install', '-f', str(pkghash)])
        buildcache.buildcache(parser, args)

        # create build cache with relative path and signing
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-f', '-r',
             str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache with verification
        args = parser.parse_args(['install', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install
        args = parser.parse_args(['install', '-f', str(pkghash)])
        buildcache.buildcache(parser, args)

    else:
        # create build cache without signing
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-y',
             str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache without verification
        args = parser.parse_args(['install', '-y', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install without verification
        args = parser.parse_args(['install', '-f', '-y', str(pkghash)])
        buildcache.buildcache(parser, args)

        # create build cache with relative path
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-f', '-r', '-y',
             str(pkghash)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache
        args = parser.parse_args(['install', '-y', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install
        args = parser.parse_args(['install', '-f', '-y', str(pkghash)])
        buildcache.buildcache(parser, args)

    # Validate the relocation information
    buildinfo = bindist.read_buildinfo_file(spec.prefix)
    assert (buildinfo['relocate_textfiles'] == ['dummy.txt'])

    args = parser.parse_args(['list'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', '-f'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', 'trivial'])
    buildcache.buildcache(parser, args)

    # Copy a key to the mirror to have something to download
    shutil.copyfile(spack.mock_gpg_keys_path + '/external.key',
                    mirror_path + '/external.key')

    args = parser.parse_args(['keys'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['keys', '-f'])
    buildcache.buildcache(parser, args)

    # unregister mirror with spack config
    mirrors = {}
    spack.config.update_config('mirrors', mirrors)
    shutil.rmtree(mirror_path)
    stage.destroy()
Exemplo n.º 10
0
def test_buildcache(mock_archive, tmpdir):
    # tweak patchelf to only do a download
    spec = Spec("patchelf")
    spec.concretize()
    pkg = spack.repo.get(spec)
    fake_fetchify(pkg.fetcher, pkg)
    mkdirp(os.path.join(pkg.prefix, "bin"))
    patchelfscr = os.path.join(pkg.prefix, "bin", "patchelf")
    f = open(patchelfscr, 'w')
    body = """#!/bin/bash
echo $PATH"""
    f.write(body)
    f.close()
    st = os.stat(patchelfscr)
    os.chmod(patchelfscr, st.st_mode | stat.S_IEXEC)

    # Install the test package
    spec = Spec('trivial-install-test-package')
    spec.concretize()
    assert spec.concrete
    pkg = spec.package
    fake_fetchify(mock_archive.url, pkg)
    pkg.do_install()
    pkghash = '/' + spec.dag_hash(7)

    # Put some non-relocatable file in there
    filename = os.path.join(spec.prefix, "dummy.txt")
    with open(filename, "w") as script:
        script.write(spec.prefix)

    # Create the build cache  and
    # put it directly into the mirror

    mirror_path = os.path.join(str(tmpdir), 'test-mirror')
    spack.mirror.create(
        mirror_path, specs=[], no_checksum=True
    )

    # register mirror with spack config
    mirrors = {'spack-mirror-test': 'file://' + mirror_path}
    spack.config.set('mirrors', mirrors)

    stage = spack.stage.Stage(
        mirrors['spack-mirror-test'], name="build_cache", keep=True)
    stage.create()
    # setup argument parser
    parser = argparse.ArgumentParser()
    buildcache.setup_parser(parser)

    # Create a private key to sign package with if gpg2 available
    if has_gnupg2():
        spack.util.gpg.Gpg.create(name='test key 1', expires='0',
                                  email='*****@*****.**',
                                  comment='Spack test key')
        # Create build cache with signing
        args = parser.parse_args(['create', '-d', mirror_path, str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # test overwrite install
        args = parser.parse_args(['install', '-f', str(pkghash)])
        buildcache.buildcache(parser, args)

        # create build cache with relative path and signing
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-f', '-r', str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache with verification
        args = parser.parse_args(['install', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install
        args = parser.parse_args(['install', '-f', str(pkghash)])
        buildcache.buildcache(parser, args)

    else:
        # create build cache without signing
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-u', str(spec)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache without verification
        args = parser.parse_args(['install', '-u', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install without verification
        args = parser.parse_args(['install', '-f', '-u', str(pkghash)])
        buildcache.buildcache(parser, args)

        # create build cache with relative path
        args = parser.parse_args(
            ['create', '-d', mirror_path, '-f', '-r', '-u', str(pkghash)])
        buildcache.buildcache(parser, args)

        # Uninstall the package
        pkg.do_uninstall(force=True)

        # install build cache
        args = parser.parse_args(['install', '-u', str(spec)])
        buildcache.install_tarball(spec, args)

        # test overwrite install
        args = parser.parse_args(['install', '-f', '-u', str(pkghash)])
        buildcache.buildcache(parser, args)

    # Validate the relocation information
    buildinfo = bindist.read_buildinfo_file(spec.prefix)
    assert(buildinfo['relocate_textfiles'] == ['dummy.txt'])

    args = parser.parse_args(['list'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', '-f'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['list', 'trivial'])
    buildcache.buildcache(parser, args)

    # Copy a key to the mirror to have something to download
    shutil.copyfile(mock_gpg_keys_path + '/external.key',
                    mirror_path + '/external.key')

    args = parser.parse_args(['keys'])
    buildcache.buildcache(parser, args)

    args = parser.parse_args(['keys', '-f'])
    buildcache.buildcache(parser, args)

    # unregister mirror with spack config
    mirrors = {}
    spack.config.set('mirrors', mirrors)
    shutil.rmtree(mirror_path)
    stage.destroy()