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)
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()
def test_uninstall(self): parser = None # Multiple matches args = MockArgs(['mpileaks']) self.assertRaises(SystemExit, uninstall, parser, args) # Installed dependents args = MockArgs(['libelf']) self.assertRaises(SystemExit, uninstall, parser, args) # Recursive uninstall args = MockArgs(['callpath'], all=True, dependents=True) uninstall(parser, args) all_specs = spack.store.layout.all_specs() self.assertEqual(len(all_specs), 7) # query specs with multiple configurations mpileaks_specs = [s for s in all_specs if s.satisfies('mpileaks')] callpath_specs = [s for s in all_specs if s.satisfies('callpath')] mpi_specs = [s for s in all_specs if s.satisfies('mpi')] self.assertEqual(len(mpileaks_specs), 0) self.assertEqual(len(callpath_specs), 0) self.assertEqual(len(mpi_specs), 3)
def test_uninstall(self): parser = None # Multiple matches args = MockArgs(['mpileaks']) self.assertRaises(SystemExit, uninstall, parser, args) # Installed dependents args = MockArgs(['libelf']) self.assertRaises(SystemExit, uninstall, parser, args) # Recursive uninstall args = MockArgs(['callpath'], all=True, dependents=True) uninstall(parser, args) all_specs = spack.install_layout.all_specs() self.assertEqual(len(all_specs), 7) # query specs with multiple configurations mpileaks_specs = [s for s in all_specs if s.satisfies('mpileaks')] callpath_specs = [s for s in all_specs if s.satisfies('callpath')] mpi_specs = [s for s in all_specs if s.satisfies('mpi')] self.assertEqual(len(mpileaks_specs), 0) self.assertEqual(len(callpath_specs), 0) self.assertEqual(len(mpi_specs), 3)
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)