@@ -403,28 +403,26 @@ def config_files(self, config_root: pathlib.Path) -> Dict[pathlib.Path, bytes]:
403403 # mount point: spack binaries embed the install prefix, so each mount
404404 # point needs its own cache to avoid relocation issues.
405405 mount = self ._mount_path if self .buildcache ["mount_specific" ] else None
406+ # spack requires both fetch and push connections to be present in the
407+ # mirror entry, even for a read-only (keyless) build cache. Whether
408+ # packages are actually pushed to the cache is governed separately by
409+ # push_to_build_cache (only a build cache with a signing key is pushed to).
406410 entry = {
407411 "source" : self .buildcache ["source" ],
408412 "binary" : self .buildcache ["binary" ],
409413 "fetch" : self ._connection (self .buildcache , "fetch" , mount ),
414+ "push" : self ._connection (self .buildcache , "push" , mount ),
410415 }
411- # a build cache is only pushed to when it has a signing key; a keyless
412- # build cache is read-only (fetched from, never pushed to).
413- if self .push_to_build_cache is not None :
414- entry ["push" ] = self ._connection (self .buildcache , "push" , mount )
415416 self ._add_optional_flags (entry , self .buildcache )
416417 spack_mirrors ["mirrors" ][self .buildcache ["name" ]] = entry
417418
418- # source mirrors are read-only by default (fetch only); a push connection is
419- # emitted only when one was explicitly configured.
420419 for name , mirror in self .source_mirrors .items ():
421420 entry = {
422421 "source" : mirror ["source" ],
423422 "binary" : mirror ["binary" ],
424423 "fetch" : self ._connection (mirror , "fetch" ),
424+ "push" : self ._connection (mirror , "push" ),
425425 }
426- if mirror .get ("push" ) is not None :
427- entry ["push" ] = self ._connection (mirror , "push" )
428426 self ._add_optional_flags (entry , mirror )
429427 spack_mirrors ["mirrors" ][name ] = entry
430428
0 commit comments