def download_buildcache_files(concrete_spec, local_dest, require_cdashid, mirror_url=None): tarfile_name = bindist.tarball_name(concrete_spec, '.spack') tarball_dir_name = bindist.tarball_directory_name(concrete_spec) tarball_path_name = os.path.join(tarball_dir_name, tarfile_name) local_tarball_path = os.path.join(local_dest, tarball_dir_name) files_to_fetch = [ { 'url': tarball_path_name, 'path': local_tarball_path, 'required': True, }, { 'url': bindist.tarball_name(concrete_spec, '.spec.yaml'), 'path': local_dest, 'required': True, }, { 'url': bindist.tarball_name(concrete_spec, '.cdashid'), 'path': local_dest, 'required': require_cdashid, }, ] return bindist.download_buildcache_entry(files_to_fetch, mirror_url)
def get_tarball(args): """Download buildcache entry from a remote mirror to local folder. This command uses the process exit code to indicate its result, specifically, a non-zero exit code indicates that the command failed to download at least one of the required buildcache components. Normally, just the tarball and .spec.yaml files are required, but if the --require-cdashid argument was provided, then a .cdashid file is also required.""" if not args.spec and not args.spec_yaml: tty.msg('No specs provided, exiting.') sys.exit(0) if not args.path: tty.msg('No download path provided, exiting') sys.exit(0) spec = get_concrete_spec(args) tarfile_name = bindist.tarball_name(spec, '.spack') tarball_dir_name = bindist.tarball_directory_name(spec) tarball_path_name = os.path.join(tarball_dir_name, tarfile_name) local_tarball_path = os.path.join(args.path, tarball_dir_name) files_to_fetch = [ { 'url': tarball_path_name, 'path': local_tarball_path, 'required': True, }, { 'url': bindist.tarball_name(spec, '.spec.yaml'), 'path': args.path, 'required': True, }, { 'url': bindist.tarball_name(spec, '.cdashid'), 'path': args.path, 'required': args.require_cdashid, }, ] result = bindist.download_buildcache_entry(files_to_fetch) if result: sys.exit(0) sys.exit(1)