From 4ee37c37de98c67e61ad9cba028cfd8d54136d3a Mon Sep 17 00:00:00 2001 From: Paul Ferrell <51765748+Paul-Ferrell@users.noreply.github.com> Date: Thu, 28 Oct 2021 06:34:31 -0600 Subject: buildcaches: fix directory link relocation (#26948) When relocating a binary distribution, Spack only checks files to see if they are a link that needs to be relocated. Directories can be such links as well, however, and need to undergo the same checks and potential relocation. --- .../repos/builtin.mock/packages/symly/package.py | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 var/spack/repos/builtin.mock/packages/symly/package.py (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/symly/package.py b/var/spack/repos/builtin.mock/packages/symly/package.py new file mode 100644 index 0000000000..a22e3cef09 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/symly/package.py @@ -0,0 +1,45 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +import os +import sys + +from spack import * + + +class Symly(Package): + """A toy package full of symlinks.""" + + homepage = "https://www.example.com" + has_code = False + version('3.0.0') + + def install(self, spec, prefix): + symly_c = ''' +#include + +int main() { + printf("I'm just here to give the build system something to do..."); + return 0; +} +''' + mkdirp('%s/symly' % self.stage.source_path) + with open('%s/symly/symly.c' % self.stage.source_path, 'w') as f: + f.write(symly_c) + gcc = which('/usr/bin/gcc') + if sys.platform == 'darwin': + gcc = which('/usr/bin/clang') + mkdirp(prefix.bin) + mkdirp(prefix.lib64) + gcc('-o', 'symly.bin', + 'symly/symly.c') + print("prefix.bin", prefix.bin) + copy('symly.bin', '%s/symly' % prefix.bin) + # create a symlinked file. + os.symlink('%s/symly' % prefix.bin, + '%s/symly' % prefix.lib64) + # Create a symlinked directory. + os.symlink(prefix.bin, prefix.include) -- cgit v1.2.3-70-g09d2