Skip to content

Commit fc2fef3

Browse files
committed
tweak presentation of build cache by recipe
1 parent 42f9d8d commit fc2fef3

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

stackinator/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def generate(self, recipe):
233233
spack_version=spack_version,
234234
spack_meta=spack_meta,
235235
gpg_keys=recipe.mirrors.keys,
236-
cache=recipe.mirrors.buildcache,
236+
cache=recipe.build_cache_mirror,
237237
exclude_from_cache=["nvhpc", "cuda", "perl"],
238238
verbose=False,
239239
)

stackinator/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def make_argparser():
8686
"--build",
8787
required=True,
8888
type=str,
89-
help="Where to set up the stackinator build directory. ('/tmp' is not allowed, use '/var/tmp'",
89+
help="Where to set up the stackinator build directory. ('/tmp' is not allowed, use '/var/tmp')",
9090
)
9191
parser.add_argument("--no-bwrap", action="store_true", required=False)
9292
parser.add_argument(

stackinator/recipe.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ def __init__(self, args):
172172
# load the optional mirrors.yaml from system config, and add any additional
173173
# mirrors specified on the command line.
174174
self._logger.debug("Configuring mirrors.")
175-
self.mirrors = mirror.Mirrors(self.system_config_path, args.cache)
176-
self.cache = self.mirrors.build_cache_mirror
175+
self.mirrors = mirror.Mirrors(self.system_config_path, pathlib.Path(args.cache))
177176

178177
# optional post install hook
179178
if self.post_install_hook is not None:
@@ -202,6 +201,13 @@ def spack_repo(self):
202201
return repo_path
203202
return None
204203

204+
# Returns:
205+
# Path: if the recipe specified a build cache mirror
206+
# None: if no build cache mirror is used
207+
@property
208+
def build_cache_mirror(self):
209+
return self.mirrors.build_cache_mirror
210+
205211
# Returns:
206212
# Path: of the recipe extra path if it exists
207213
# None: if there is no user-provided extra path in the recipe
@@ -511,7 +517,7 @@ def compiler_files(self):
511517
)
512518

513519
makefile_template = env.get_template("Makefile.compilers")
514-
push_to_cache = self.cache
520+
push_to_cache = self.build_cache_mirror is not None
515521
files["makefile"] = makefile_template.render(
516522
compilers=self.compilers,
517523
push_to_cache=push_to_cache,
@@ -542,7 +548,7 @@ def environment_files(self):
542548
jenv.filters["py2yaml"] = schema.py2yaml
543549

544550
makefile_template = jenv.get_template("Makefile.environments")
545-
push_to_cache = self.cache is not None
551+
push_to_cache = self.build_cache_mirror is not None
546552
files["makefile"] = makefile_template.render(
547553
environments=self.environments,
548554
push_to_cache=push_to_cache,

0 commit comments

Comments
 (0)