Skip to content

binary_distribution: content addressable tarballs#48713

Merged
scottwittenburg merged 77 commits intospack:developfrom
scottwittenburg:content-addressable-tarballs-2
May 6, 2025
Merged

binary_distribution: content addressable tarballs#48713
scottwittenburg merged 77 commits intospack:developfrom
scottwittenburg:content-addressable-tarballs-2

Conversation

@scottwittenburg
Copy link
Copy Markdown
Contributor

@scottwittenburg scottwittenburg commented Jan 24, 2025

Introduction

This PR changes how binary mirrors are laid out, and adopts a new approach for updating the layout over time. The new buildcache layout introduces content addressable tarballs, with the consequence that spack no longer knows the final url/path to a compressed tarball or specfile without either having just built it, or else fetched the manifest (.spec.manifest.json) file from the mirror first.

Structure and organization

Below is an illustration of the new layout:

mirror/
  v3/
    layout.json
    manifests/
      key/
        keys.manifest.json
        75BC0528114909C076E2607418010FFAD73C9B07.key.manifest.json
      spec/
        gcc-runtime/
          gcc-runtime-12.3.0-s2nqujezsce4x6uhtvxscu7jhewqzztx.spec.manifest.json
        gmake/
          gmake-4.4.1-lpr4j77rcgkg5536tmiuzwzlcjsiomph.spec.manifest.json
        compiler-wrapper/
          compiler-wrapper-1.0-s7ieuyievp57vwhthczhaq2ogowf3ohe.spec.manifest.json
      index/
        index.manifest.json
  blobs/
    sha256/
      9f/
        9fc18374aebc84deb2f27898da77d4d4410e5fb44c60c6238cb57fb36147e5c7
      d0/
        d067e5562f5f202d297da124d570af95f4f47c0a87284621b00092ec23f9aeb1
      29/
        29b3a0eb6064fd588543bc43ac7d42d708a69058dafe4be0859e3200091a9a1c
      0f/
        0f24aa6b5dd7150067349865217acd3f6a383083f9eca111d2d2fed726c88210
      8f/
        8f835c69b899c8251ccc4761116d7f5c30cb28318d981b6ed60517c3d0f54b8b
      8b/
        8b718dba2e9e6e62161403567ffa75ddf2e0e72bbc50b9a2e3a534a3d634368d
      db/
        dbaec9f2f840e8ac0a67babfafdd6dab5db623a0705c5df899eb35f4e4a977d8
      fb/
        fba751c4796536737c9acbb718dad7429be1fa485f5585d450ab8b25d12ae041
      b4/
        b4371c0f5f8736cebca84b8b883b213291c91deb63c04a13f72817816d5b66a0

Every piece of actual data in a binary mirror is now a content-addressed "blob", and every blob is referenced by a manifest. For example, the manifest for gcc-runtime@12.3.0 from the depiction above looks like:

{
  "version": 3,
  "data": [
    {
      "contentLength": 10731083,
      "mediaType": "application/vnd.spack.install.v1.tar+gzip",
      "compression": "gzip",
      "checksumAlgorithm": "sha256",
      "checksum": "0f24aa6b5dd7150067349865217acd3f6a383083f9eca111d2d2fed726c88210"
    },
    {
      "contentLength": 1000,
      "mediaType": "application/vnd.spack.spec.v5+json",
      "compression": "gzip",
      "checksumAlgorithm": "sha256",
      "checksum": "fba751c4796536737c9acbb718dad7429be1fa485f5585d450ab8b25d12ae041"
    }
  ]
}

The actual data for the spec is comprised of a compressed spec file (the data with mediaType: "application/vnd.spack.spec.v5+json") and a compressed tar archive (the data with mediaType: "application/vnd.spack.install.v1.tar+gzip"). The referenced blobs/files are stored as compressed files withing the blobs/ directory, and named for their content hash, which is also present in the manifest.

The current layout version is 3, the next number in sequence after the current version. This PR makes the layout version part of the path/url, which will keep entries of different layouts separate, as opposed to the previous approach where mirrors could contain entries of mixed layout, which could not be ascertained without fetching the individual spec files.

Any content blobs can be compressed, the compression type is given in the manifest as compression, which can currently be either "gzip" or "none". At present, only spec files and installation archives are compressed, while public keys, and any type of index is stored uncompressed.

Thanks to @haampie for helping to design the layout described above.

This PR introduces a new abstraction URLBuildcacheEntry, an abstract base class for managing access to url-style binary cache entries. The current concrete implementation, URLBuildcacheEntryV3, which contains all the logic for accessing and managing buildcache entries for layout version 3. The idea here is that as new layouts are defined, we can add new concrete classes to implement them, and have a fairly clean way to understand what layout versions the current spack supports. Deprecating and removing support for older layout version should be simpler, via deleting the associated implementations and updating the factory appropriately.

Backwards compatibility

After this is merged, spack will continue to read from old buildcache layouts as needed (preferentially installing from the new layout whenever possible), but will no longer be able to write to old buildcache layouts. Installation from old buildcaches, including processing of indices for concretization, will continue to work, but if you have old buildcache mirrors configured, spack will attempt to warn you (minimally) if you use those old-layout mirrors. The cases where spack will warn are as follows:

  1. You install a spec from a v2 layout mirror
  2. You fetch a buildcache index from a v2 layout mirror
  3. You attempt to spack buildcache push/create ... to a mirror that is either empty or only contains v2 layout contents

In cases (1) and (2) spack will only warn once per mirror, per action (install spec or fetch index), per spack invocation. In case (3) a successful push to the mirror will create the v3/layout.json file spack is looking for, so after that you should not be warned when pushing to that mirror again.

To do before merging

  • implement a migration path to make current binary mirrors look like the new format
    • Original migration work needs to be revisited (migration fixed for latest layout here)
    • Also added spack buildcache migrate command to perform in-place migration of file:// or s3:// mirrors
  • Perform migration of develop mirrors
  • make required changes to some cron jobs in spack-infrastructure:
    • protected-publish (updated support for publishing v3 stacks is here, previous approach is no longer valid)
    • buildcache pruning (deferring until after merge)
    • cache indexer (updated support for indexing v3 mirrors is here, previous approach is no longer valid)
  • update spack/cache.spack.io so the website supports the new layout while keeping old versions around
    • PR to avoid processing "immutable" stacks is here
    • support the new buildcache layout (this PR can be merged at any time, it should work with old layout as well as new)
  • refine and improve the URLBuildcacheEntry abstraction and implementation (for now, removed ABC in favor of future refactoring)
  • evaluate impact on and relationship to OCI buildcache (oci pipeline tested here)
  • evaluate the impact of this change on binaries currently used for bootstrapping
    • Need to address (once again, after recent changes to this PR) issues raised in this review comment (Update: those commands work fine thanks to maintaining support for v2 layouts)
  • more tests to exercise all new functionality
  • finish updating docs to reflect new structure
  • spackbot performs PR binary graduation, which requires changes to work with new layout (deferring until after merge)

To do after merging

  • Merge this spack/spack-infrastructure PR which:
    • Updates spack branch pointer here, in case any migration is needed after this PR is merged
    • Uncomments these lines and comment or remove the other two
    • Changes the layout version to 3 on the cli of the publish cron job here
  • Update bootstrap package code as described here This was already taken care of in this PR
  • Add pruning support to spack that can be leveraged by spackbot and spack-infrastructure

Future work

If we add a layout version element to spack mirror configs, it would allow newer versions of spack to use older mirror layouts as long as those are supported. This would allow newer spack to continue using old buildcache layouts until those layout versions are no longer supported by spack. Whether or not newer spacks should be allow to create buildcache entries in old formats is still unclear to me, and hopefully the community will have input.

@spackbot-app spackbot-app bot added binary-packages commands core PR affects Spack core functionality documentation Improvements or additions to documentation gitlab Issues related to gitlab integration shell-support tests General test capability(ies) labels Jan 24, 2025
Copy link
Copy Markdown
Contributor

@kwryankrattiger kwryankrattiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things from a first pass

alalazo
alalazo previously requested changes Mar 4, 2025
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR seems to blend well with #45189, so from my point of view we can merge in any order. There are still a few issues though that I'd like to fix here.

First one is that the github-actions-v0.5 bootstrap cache does not work in this branch. To reproduce, from a clean checkout:

$ spack bootstrap disable github-actions-v0.6
==> "github-actions-v0.6" is now disabled and will not be used for bootstrapping
$ spack bootstrap disable spack-install
==> "spack-install" is now disabled and will not be used for bootstrapping
$ spack -d bootstrap now
[ ... ]
RuntimeError: cannot bootstrap any of the patchelf executables from spec "patchelf@0.13.1:0.13 %gcc platform=linux target=x86_64" due to the following failures:
github-actions-v0.5 raised RuntimeError: The binary index is empty
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/bootstrap/core.py", line 421, in ensure_executables_in_path_or_raise
    if current_bootstrapper.try_search_path(executables, abstract_spec):
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/bootstrap/core.py", line 255, in try_search_path
    return self._install_and_test(abstract_spec, bincache_platform, data, test_fn)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/bootstrap/core.py", line 210, in _install_and_test
    raise RuntimeError("The binary index is empty")

we should either fix it, in a way that continues to work for previous Spack versions, or remove it from the available mirrors in this PR.

The other issue is that:

$ spack bootstrap mirror  --binary-packages --dev /tmp/bootstrap-mirror
==> Adding "clingo-bootstrap@spack+python %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "gnupg@2.3: %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "patchelf@0.13.1: %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "gnuconfig" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "py-isort@5 %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "py-mypy@0.900: %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "py-black@:24.1.0 %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "py-flake8@3.8.2: %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding "py-pytest@6.2.4: %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Adding binary packages from "https://github.com/spack/spack-bootstrap-mirrors/releases/download/v0.6/bootstrap-buildcache.tar.gz" to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> Error: [Errno 2] No such file or directory: '/tmp/tmpq7gaf1jb/spack-src/v3/specs'

is broken here. This is not caught in CI for lack of e2e tests, but we should try to keep it in a working state.

@scottwittenburg scottwittenburg force-pushed the content-addressable-tarballs-2 branch from 0328a0f to 16de322 Compare March 5, 2025 22:44
@scottwittenburg
Copy link
Copy Markdown
Contributor Author

scottwittenburg commented Mar 5, 2025

@alalazo Thank you for looking through this and providing some useful feedback. Regarding your comments:

First one is that the github-actions-v0.5 bootstrap cache does not work in this branch.

I used the spack buildcache migrate ... command in this branch to do an in-place migration of the github-actions-v0.5 mirror, and now those commands work both before and after this change. Just one point to check on though: I compared the buildcache index of the original bootstrap mirror with the one resulting from the migration, and there is a small difference in the zlib-ng specs, to this effect:

index diff results
$ diff bootstrap_mirror_index_before.json bootstrap_mirror_index_after.json
2294c2294,2295
<                             ]
---
>                             ],
>                             "cpupart": ""
3295c3296,3297
<                             ]
---
>                             ],
>                             "cpupart": "0x022"

Since older spack will only see the build_cache/index.json and newer spack will only see v3/specs/index.json, I don't think it should present any problem down the road, but I just thought I'd get your opinion.

You also pointed out another command that was broken:

$ spack bootstrap mirror  --binary-packages --dev /tmp/bootstrap-mirror

However, I could not reproduce that. Instead I see:

command trace
spack -d bootstrap mirror --binary-packages --dev /tmp/bootstrap-mirror
==> [2025-03-05-22:31:08.281878] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-03-05-22:31:08.309218] Imported bootstrap from built-in commands
==> [2025-03-05-22:31:08.310183] Imported bootstrap from built-in commands
==> [2025-03-05-22:31:08.310904] [BOOTSTRAP ROOT SPEC] clingo-bootstrap@spack+python %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311114] [BOOTSTRAP ROOT SPEC] gnupg@2.3: %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311292] [BOOTSTRAP ROOT SPEC] patchelf@0.13.1: %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311460] [BOOTSTRAP ROOT SPEC] py-isort@5 %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311619] [BOOTSTRAP ROOT SPEC] py-mypy@0.900: %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311791] [BOOTSTRAP ROOT SPEC] py-black@:24.1.0 %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.311952] [BOOTSTRAP ROOT SPEC] py-flake8@3.8.2: %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.312109] [BOOTSTRAP ROOT SPEC] py-pytest@6.2.4: %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:08.312127] Adding "clingo-bootstrap@spack+python %gcc platform=linux target=x86_64" and dependencies to the mirror at /tmp/bootstrap-mirror/bootstrap_cache
==> [2025-03-05-22:31:08.351357] DATABASE LOCK TIMEOUT: 60s
==> [2025-03-05-22:31:08.351419] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-03-05-22:31:08.351497] Reading config from file /work/spack/etc/spack/defaults/concretizer.yaml
==> [2025-03-05-22:31:08.358126] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-03-05-22:31:08.378005] Reading config from file /work/spack/etc/spack/defaults/repos.yaml
==> [2025-03-05-22:31:33.174235] DATABASE LOCK TIMEOUT: 60s
==> [2025-03-05-22:31:33.174326] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-03-05-22:31:33.174847] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-03-05-22:31:33.187645] DATABASE LOCK TIMEOUT: 60s
==> [2025-03-05-22:31:33.187678] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-03-05-22:31:33.187752] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-03-05-22:31:33.191563] Reading config from file /work/spack/etc/spack/defaults/repos.yaml
==> [2025-03-05-22:31:33.192540] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-03-05-22:31:33.211553] [BOOTSTRAP CONFIG SCOPE] name=_builtin
==> [2025-03-05-22:31:33.211774] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-03-05-22:31:33.214819] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/work/spack/etc/spack/defaults
==> [2025-03-05-22:31:33.214848] [BOOTSTRAP CONFIG SCOPE] name=defaults/linux, path=/work/spack/etc/spack/defaults/linux
==> [2025-03-05-22:31:33.214863] [BOOTSTRAP CONFIG SCOPE] name=bootstrap, path=/root/.spack/bootstrap/config
==> [2025-03-05-22:31:33.214874] [BOOTSTRAP CONFIG SCOPE] name=bootstrap/linux, path=/root/.spack/bootstrap/config/linux
==> [2025-03-05-22:31:33.215512] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-03-05-22:31:33.225810] DATABASE LOCK TIMEOUT: 60s
==> [2025-03-05-22:31:33.225849] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-03-05-22:31:33.225932] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-03-05-22:31:33.393706] [BOOTSTRAP ROOT SPEC] clingo-bootstrap@spack+python %gcc platform=linux target=x86_64
==> [2025-03-05-22:31:33.393775] [BOOTSTRAP MODULE clingo] Try importing from Python
==> [2025-03-05-22:31:33.394018] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-03-05-22:31:33.401492] Bootstrapping clingo from pre-built binaries
==> [2025-03-05-22:31:33.401951] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-03-05-22:31:33.404890] certs: relative path not allowed: $SSL_CERT_FILE
==> [2025-03-05-22:31:34.784687] DATABASE LOCK TIMEOUT: Nones
==> [2025-03-05-22:31:34.820841] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-03-05-22:31:34.822533] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-03-05-22:31:34.832354] Reading config from file /root/.spack/bootstrap/config/linux/config.yaml
==> [2025-03-05-22:31:36.629151] Verified SHA256 checksum of the build cache
==> [2025-03-05-22:31:36.630052] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-03-05-22:31:36.730961] Relocating: /root/spack/opt/spack/bin/sbang => /root/.spack/bootstrap/store/bin/sbang.
==> [2025-03-05-22:31:36.730985] Relocating: /root/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_place/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx => /root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx.
==> [2025-03-05-22:31:36.731000] Relocating: /root/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_place/linux-centos7-x86_64/gcc-10.2.1/gcc-runtime-10.2.1-7rv2b76tgxqmkwtmngiamwac632cjjba => /root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/gcc-runtime-10.2.1-7rv2b76tgxqmkwtmngiamwac632cjjba.
==> [2025-03-05-22:31:36.731010] Relocating: /root/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_place/linux-centos7-x86_64/gcc-10.2.1/python-venv-1.0-aoamktg2gnozmfy3rbi2qpmvcghfyr2r => /root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/python-venv-1.0-aoamktg2gnozmfy3rbi2qpmvcghfyr2r.
==> [2025-03-05-22:31:36.731020] Relocating: /root/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_place => /root/.spack/bootstrap/store.
==> [2025-03-05-22:31:36.743668] Reading config from file /work/spack/etc/spack/defaults/modules.yaml
==> [2025-03-05-22:31:36.748749] Reading config from file /work/spack/etc/spack/defaults/linux/modules.yaml
==> [2025-03-05-22:31:36.749755] NO MODULE WRITTEN: list of enabled module files is empty
==> [2025-03-05-22:31:36.751267] Patched rpath in lib/python3.10/site-packages/clingo.cpython-310-x86_64-linux-gnu.so from b'/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/gcc-runtime-10.2.1-7rv2b76tgxqmkwtmngiamwac632cjjba/lib:/opt/_internal/cpython-3.10.15/lib:/opt/python/cp310-cp310/lib:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10' to b'/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64'
==> [2025-03-05-22:31:36.751489] Patched rpath in lib64/libclingo.so.4.0 from b'/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/gcc-runtime-10.2.1-7rv2b76tgxqmkwtmngiamwac632cjjba/lib:/opt/_internal/cpython-3.10.15/lib:/opt/python/cp310-cp310/lib:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10' to b'/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib:/root/.spack/bootstrap/store/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-4pi6zqqe2vm6ehc7qb4se3ql53m6relx/lib64'
==> [2025-03-05-22:31:36.763544] [BOOTSTRAP MODULE clingo] The installed spec "clingo-bootstrap@spack%gcc+python arch=linux-None-x86_64 ^python@3.10/4pi6zqqe2vm6ehc7qb4se3ql53m6relx" provides the "clingo" Python module
==> [2025-03-05-22:31:36.763977] Reading config from file /work/spack/etc/spack/defaults/concretizer.yaml
==> [2025-03-05-22:31:36.772488] [spack.solver.input_analysis] apple-libuuid is not for this platform
==> [2025-03-05-22:31:36.800064] [spack.solver.input_analysis] wgl is not for this platform
==> [2025-03-05-22:31:36.800166] [spack.solver.input_analysis] apple-gl is not for this platform
==> [2025-03-05-22:31:36.809143] [spack.solver.input_analysis] msmpi is not for this platform
==> [2025-03-05-22:31:36.834677] [spack.solver.input_analysis] veclibfort is not for this platform
==> [2025-03-05-22:31:36.834896] [spack.solver.input_analysis] nvpl-blas is not for this platform
==> [2025-03-05-22:31:36.836631] [spack.solver.input_analysis] nvpl-lapack is not for this platform
==> [2025-03-05-22:31:36.880342] [spack.solver.input_analysis] apple-libunwind is not for this platform
==> [2025-03-05-22:31:36.881900] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-03-05-22:31:36.900319] Reading config from file /root/.spack/linux/compilers.yaml
==> [2025-03-05-22:31:36.905096] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-03-05-22:31:40.381100] Concretization cache miss at 1a/1a9878e7bb0cafb14fb928b1c70cf69ad6387e47629d3a44e203366c2cd35ada
/work/spack/lib/spack/spack/solver/concretize.lp:1172:3-38: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1278:6-41: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1279:6-43: info: atom does not occur in any rule head:
  compiler_version(CompilerID,Version)

/work/spack/lib/spack/spack/solver/concretize.lp:1323:44-67: info: atom does not occur in any rule head:
  compiler_id(CompilerID)

/work/spack/lib/spack/spack/solver/concretize.lp:1331:6-45: info: atom does not occur in any rule head:
  compiler_name(CompilerID,CompilerName)

/work/spack/lib/spack/spack/solver/concretize.lp:1332:6-51: info: atom does not occur in any rule head:
  compiler_version(CompilerID,CompilerVersion)

/work/spack/lib/spack/spack/solver/concretize.lp:1338:6-45: info: atom does not occur in any rule head:
  compiler_name(CompilerID,CompilerName)

/work/spack/lib/spack/spack/solver/concretize.lp:1339:6-51: info: atom does not occur in any rule head:
  compiler_version(CompilerID,CompilerVersion)

/work/spack/lib/spack/spack/solver/concretize.lp:1378:6-41: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1399:6-41: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1400:6-43: info: atom does not occur in any rule head:
  compiler_version(CompilerID,Version)

/work/spack/lib/spack/spack/solver/concretize.lp:1401:6-41: info: atom does not occur in any rule head:
  compiler_os(CompilerID,CompilerOS)

/work/spack/lib/spack/spack/solver/concretize.lp:1427:5-40: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1428:5-36: info: atom does not occur in any rule head:
  compiler_version(CompilerID,V)

/work/spack/lib/spack/spack/solver/concretize.lp:1429:5-40: info: atom does not occur in any rule head:
  compiler_weight(CompilerID,Weight)

/work/spack/lib/spack/spack/solver/concretize.lp:1433:5-40: info: atom does not occur in any rule head:
  compiler_name(CompilerID,Compiler)

/work/spack/lib/spack/spack/solver/concretize.lp:1434:5-36: info: atom does not occur in any rule head:
  compiler_version(CompilerID,V)

/work/spack/lib/spack/spack/solver/concretize.lp:1435:9-39: info: atom does not occur in any rule head:
  compiler_weight(#X0,#P1)

/work/spack/lib/spack/spack/solver/concretize.lp:1454:6-29: info: atom does not occur in any rule head:
  compiler_id(CompilerID)

/work/spack/lib/spack/spack/solver/concretize.lp:1455:6-45: info: atom does not occur in any rule head:
  compiler_name(CompilerID,CompilerName)

==> [2025-03-05-22:31:42.776467] SolverError: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
    clingo-bootstrap@spack%gcc+python arch=linux-None-x86_64 is unsatisfiable
==> [2025-03-05-22:31:42.776542] Error: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
    clingo-bootstrap@spack%gcc+python arch=linux-None-x86_64 is unsatisfiable
Traceback (most recent call last):
  File "/work/spack/lib/spack/spack/main.py", line 1048, in main
    return _main(argv)
  File "/work/spack/lib/spack/spack/main.py", line 1000, in _main
    return finish_parse_and_run(parser, cmd_name, args, env_format_error)
  File "/work/spack/lib/spack/spack/main.py", line 1031, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/work/spack/lib/spack/spack/main.py", line 591, in _invoke_command
    return_val = command(parser, args)
  File "/work/spack/lib/spack/spack/cmd/bootstrap.py", line 464, in bootstrap
    callbacks[args.subcommand](args)
  File "/work/spack/lib/spack/spack/cmd/bootstrap.py", line 401, in _mirror
    spec = spack.concretize.concretize_one(spec_str)
  File "/work/spack/lib/spack/spack/concretize.py", line 217, in concretize_one
    result = Solver().solve([spec], tests=tests, allow_deprecated=allow_deprecated)
  File "/work/spack/lib/spack/spack/solver/asp.py", line 4641, in solve
    result, _, _ = self.solve_with_stats(specs, **kwargs)
  File "/work/spack/lib/spack/spack/solver/asp.py", line 4631, in solve_with_stats
    return self.driver.solve(
  File "/work/spack/lib/spack/spack/solver/asp.py", line 1313, in solve
    result.raise_if_unsat()
  File "/work/spack/lib/spack/spack/solver/asp.py", line 484, in raise_if_unsat
    raise SolverError(constraints, conflicts=conflicts)
spack.solver.asp.SolverError: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
    clingo-bootstrap@spack%gcc+python arch=linux-None-x86_64 is unsatisfiable

My branch is based on 8677063142, which exhibits the same behavior. Any thoughts as to what could be going on there?

EDIT: Nevermind, the error above is the same as #48973. Once I installed a compiler in the clean docker image I am using for testing, I can reproduce the above issue.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Mar 6, 2025

Since older spack will only see the build_cache/index.json and newer spack will only see v3/specs/index.json, I don't think it should present any problem down the road, but I just thought I'd get your opinion.

I'll double check, but I agree with you it shouldn't. Those binaries are installed by DAG hash, and that is the same in both index files.

Instead of iterating all mirrors to check for presence of layout.json on
every spack command, only warn in the following cases:

1. Once per mirror  when using buildcache create/push on the cli: checks
for presence of layout.json on the single mirror, and if it is not present,
warns that the mirror may be old layout.

2. When a spec is downloaded for installation from a v2 layout mirror

3. When an index is fetched from a v2 layout mirror

(1) will only happen once, ever, for a mirror, assuming a spec gets
pushed, as that will create the layout.json on the mirror as well.

(2) and (3) happen in a memoized function, so will only happen once
per mirror url, per action (install spec or fetch index), per spack
invocation.
@scottwittenburg scottwittenburg force-pushed the content-addressable-tarballs-2 branch from d0aa453 to 4ed4b43 Compare April 28, 2025 22:30
@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 29, 2025

I just checked the issues in #48713 (review) and they still persist, though they get a little further.

The issue with github-actions-v0.5 is:

[ ... ]
==> [2025-04-29-17:50:13.525453] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/index.json
==> [2025-04-29-17:50:13.526109] certs: relative path not allowed: $SSL_CERT_FILE
==> [2025-04-29-17:50:13.606240] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json
==> [2025-04-29-17:50:14.133131] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json returned 404: Not Found
[ ... ]

and is reproducible with the same commands as before. EDIT: real issue is that I used Python 3.13 which is not in buildcache v0.5

The issue with the bootstrap mirror is that the following command:

$ spack -d buildcache update-index /tmp/myfoo/bootstrap-mirror/bootstrap_cache
==> [2025-04-29-18:06:04.397460] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-18:06:04.437325] Reading config from file /home/culpo/.spack/config.yaml
==> [2025-04-29-18:06:04.461869] Imported buildcache from built-in commands
==> [2025-04-29-18:06:04.465840] Imported buildcache from built-in commands
==> [2025-04-29-18:06:04.468977] GenerateIndexError: Unable to generate package index: Failed to get list of specs from file:///tmp/myfoo/bootstrap-mirror/bootstrap_cache
==> [2025-04-29-18:06:04.469074] Error: Unable to generate package index: Failed to get list of specs from file:///tmp/myfoo/bootstrap-mirror/bootstrap_cache
Traceback (most recent call last):
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/binary_distribution.py", line 854, in _url_generate_package_index
    file_list, read_fn = _spec_files_from_cache(url, tmpspecsdir)
                         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/binary_distribution.py", line 838, in _spec_files_from_cache
    raise ListMirrorSpecsError("Failed to get list of specs from {0}".format(url))
spack.binary_distribution.ListMirrorSpecsError: Failed to get list of specs from file:///tmp/myfoo/bootstrap-mirror/bootstrap_cache

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 1049, in main
    return _main(argv)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 1001, in _main
    return finish_parse_and_run(parser, cmd_name, args, env_format_error)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 1032, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 593, in _invoke_command
    return_val = command(parser, args)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/cmd/buildcache.py", line 824, in buildcache
    return args.func(args)
           ~~~~~~~~~^^^^^^
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/cmd/buildcache.py", line 772, in update_index_fn
    return update_index(args.mirror, update_keys=args.keys)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/cmd/buildcache.py", line 758, in update_index
    bindist._url_generate_package_index(url, tmpdir)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/binary_distribution.py", line 856, in _url_generate_package_index
    raise GenerateIndexError(f"Unable to generate package index: {e}") from e
spack.binary_distribution.GenerateIndexError: Unable to generate package index: Failed to get list of specs from file:///tmp/myfoo/bootstrap-mirror/bootstrap_cache

fails to generate an index for the binary caches that was downloaded.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 29, 2025

In general, are commands like:

spack buildcache SUBCOMMAND

still supposed to be working on v1 buildcaches?

@scottwittenburg
Copy link
Copy Markdown
Contributor Author

@alalazo Here's what I see when I try the first problematic command:

Output
$ docker run --rm -v /tmp/test_bootstrap:/work -ti spack_ubuntu22_04_clean
root@cfaf21eca267:/work# source spack/share/spack/setup-env.sh 
whroot@cfaf21eca267:/work# spack clean -ab
==> Removing all temporary build stages
==> Removing cached downloads
==> Removing install failure marks
==> Removing cached information on repositories
==> Removing python cache files
==> Removing bootstrapped software and configuration in "/root/.spack/bootstrap"
root@cfaf21eca267:/work# which patchelf
root@cfaf21eca267:/work# which clingo
root@cfaf21eca267:/work# spack bootstrap disable github-actions-v0.6
==> "github-actions-v0.6" is now disabled and will not be used for bootstrapping
root@cfaf21eca267:/work# spack bootstrap disable spack-install
==> "spack-install" is now disabled and will not be used for bootstrapping
root@cfaf21eca267:/work# spack -d bootstrap now
==> [2025-04-29-16:39:23.445928] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-16:39:23.472919] Imported bootstrap from built-in commands
==> [2025-04-29-16:39:23.474033] Imported bootstrap from built-in commands
==> [2025-04-29-16:39:23.474709] DATABASE LOCK TIMEOUT: 60s
==> [2025-04-29-16:39:23.474752] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-04-29-16:39:23.474836] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-04-29-16:39:23.478053] Reading config from file /root/.spack/bootstrap.yaml
==> [2025-04-29-16:39:23.479323] Reading config from file /work/spack/etc/spack/defaults/repos.yaml
==> [2025-04-29-16:39:23.480335] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-04-29-16:39:23.503717] [BOOTSTRAP CONFIG SCOPE] name=_builtin
==> [2025-04-29-16:39:23.503991] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-04-29-16:39:23.507060] Reading config from file /root/.spack/bootstrap.yaml
==> [2025-04-29-16:39:23.508070] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/work/spack/etc/spack/defaults
==> [2025-04-29-16:39:23.508104] [BOOTSTRAP CONFIG SCOPE] name=defaults/linux, path=/work/spack/etc/spack/defaults/linux
==> [2025-04-29-16:39:23.508120] [BOOTSTRAP CONFIG SCOPE] name=bootstrap, path=/root/.spack/bootstrap/config
==> [2025-04-29-16:39:23.508131] [BOOTSTRAP CONFIG SCOPE] name=bootstrap/linux, path=/root/.spack/bootstrap/config/linux
==> [2025-04-29-16:39:23.508889] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-16:39:23.518646] DATABASE LOCK TIMEOUT: 60s
==> [2025-04-29-16:39:23.518707] PACKAGE LOCK TIMEOUT: No timeout
==> [2025-04-29-16:39:51.177552] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-04-29-16:39:51.323204] '/usr/bin/gcc' '-dumpfullversion'
==> [2025-04-29-16:39:51.325636] '/usr/bin/gcc-11' '-dumpfullversion'
==> [2025-04-29-16:39:51.327683] '/usr/bin/g++' '-dumpfullversion'
==> [2025-04-29-16:39:51.329593] '/usr/bin/g++-11' '-dumpfullversion'
==> [2025-04-29-16:39:51.369746] [BOOTSTRAP ROOT SPEC] patchelf@0.13.1: platform=linux target=x86_64
==> [2025-04-29-16:39:51.369959] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-04-29-16:39:51.376727] [BOOTSTRAP EXECUTABLES patchelf] Try installed specs with query 'patchelf@0.13.1: platform=linux target=x86_64'
==> [2025-04-29-16:39:51.377239] Bootstrapping patchelf from pre-built binaries
==> [2025-04-29-16:39:51.379413] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-04-29-16:39:51.380685] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json
==> [2025-04-29-16:39:51.381057] certs: relative path not allowed: $SSL_CERT_FILE
==> [2025-04-29-16:39:51.614094] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json returned 404: Not Found
==> [2025-04-29-16:39:51.614733] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/index.json
==> [2025-04-29-16:39:51.970038] Warning: Fetching an index from a v2 binary mirror layout, located at 
    https://mirror.spack.io/bootstrap/github-actions/v0.5 is deprecated. Support for this will be 
    removed in a future version of spack. Please consider running `spack 
    buildcache migrate' or rebuilding the specs in this mirror.
==> [2025-04-29-16:39:51.971476] DATABASE LOCK TIMEOUT: Nones
==> [2025-04-29-16:39:51.995204] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-04-29-16:39:51.996669] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-16:39:52.006593] Reading config from file /root/.spack/bootstrap/config/linux/config.yaml
==> [2025-04-29-16:39:52.011631] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/index.json
==> [2025-04-29-16:39:52.302272] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json
==> [2025-04-29-16:39:52.466695] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json returned 404: Not Found
==> [2025-04-29-16:39:52.644058] Encountered error attempting to fetch archive for patchelf/afv7arj from https://mirror.spack.io/bootstrap/github-actions/v0.5 (v3) due to Error reading manifest at https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/spec/patchelf/patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.manifest.json
==> [2025-04-29-16:39:52.645161] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.json.sig
==> [2025-04-29-16:39:52.808365] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.json.sig: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.json.sig returned 404: Not Found
==> [2025-04-29-16:39:52.809276] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.json
==> [2025-04-29-16:39:53.036883] Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spec.json
    [100%]  686.00  B @    1.3 MB/s
==> [2025-04-29-16:39:53.154802] Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64/gcc-10.2.1/patchelf-0.18.0/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.spack
    [100%]    1.56 MB @   13.3 MB/s
==> [2025-04-29-16:39:53.273716] Warning: Installing a spec from a v2 binary mirror layout, located at 
    https://mirror.spack.io/bootstrap/github-actions/v0.5 is deprecated. Support for this will be 
    removed in a future version of spack. Please consider running `spack 
    buildcache migrate' or rebuilding the specs in this mirror.
==> [2025-04-29-16:39:53.273902] Installing "patchelf@=0.18.0 ldflags='-static-libstdc++ -static-libgcc'  build_system=autotools arch=linux-centos7-x86_64" from a buildcache
==> [2025-04-29-16:39:53.285695] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-04-29-16:39:53.305546] Reading config from file /root/.spack/bootstrap/config/packages.yaml
==> [2025-04-29-16:39:53.356546] Relocating: /home/spack/spack/opt/spack/bin/sbang => /root/.spack/bootstrap/store/bin/sbang.
==> [2025-04-29-16:39:53.356581] Relocating: /home/spack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path/linux-centos7-x86_64/gcc-10.2.1/patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce => /root/.spack/bootstrap/store/linux-x86_64/patchelf-0.18.0-afv7arjarb7nzmlh7c5slkfxykybuqce.
==> [2025-04-29-16:39:53.356595] Relocating: /home/spack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path => /root/.spack/bootstrap/store.
==> [2025-04-29-16:39:53.367380] Reading config from file /work/spack/etc/spack/defaults/modules.yaml
==> [2025-04-29-16:39:53.372327] Reading config from file /work/spack/etc/spack/defaults/linux/modules.yaml
==> [2025-04-29-16:39:53.373260] NO MODULE WRITTEN: list of enabled module files is empty
==> [2025-04-29-16:39:53.374303] Patched rpath in bin/patchelf from b'/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10' to b''
==> [2025-04-29-16:39:53.378500] [BOOTSTRAP EXECUTABLES patchelf] Try installed specs with query 'patchelf@0.13.1: arch=linux-None-x86_64'
==> [2025-04-29-16:39:53.378913] Reading config from file /work/spack/etc/spack/defaults/modules.yaml
==> [2025-04-29-16:39:53.383858] Reading config from file /work/spack/etc/spack/defaults/linux/modules.yaml
==> [2025-04-29-16:39:53.618173] Adding env modifications for patchelf
==> [2025-04-29-16:39:53.618894] [BOOTSTRAP ROOT SPEC] gnupg@2.3: platform=linux target=x86_64
==> [2025-04-29-16:39:53.619253] [BOOTSTRAP ROOT SPEC] clingo-bootstrap@spack+python platform=linux target=x86_64
==> [2025-04-29-16:39:53.619274] [BOOTSTRAP MODULE clingo] Try importing from Python
==> [2025-04-29-16:39:53.619438] Reading config from file /work/spack/etc/spack/defaults/bootstrap.yaml
==> [2025-04-29-16:39:53.622634] Reading config from file /root/.spack/bootstrap/config/linux/bootstrap.yaml
==> [2025-04-29-16:39:53.627972] Bootstrapping clingo from pre-built binaries
==> [2025-04-29-16:39:53.628361] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-04-29-16:39:53.629825] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-16:39:53.639143] Reading config from file /root/.spack/bootstrap/config/linux/config.yaml
==> [2025-04-29-16:39:53.644169] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/index.json
==> [2025-04-29-16:39:53.895628] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json
==> [2025-04-29-16:39:54.017488] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json returned 404: Not Found
==> [2025-04-29-16:39:54.024086] Reading config from file /work/spack/etc/spack/defaults/mirrors.yaml
==> [2025-04-29-16:39:54.025649] Reading config from file /work/spack/etc/spack/defaults/config.yaml
==> [2025-04-29-16:39:54.037493] Reading config from file /root/.spack/bootstrap/config/linux/config.yaml
==> [2025-04-29-16:39:54.042652] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/index.json
==> [2025-04-29-16:39:54.249536] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json
==> [2025-04-29-16:39:54.352675] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/index/index.manifest.json returned 404: Not Found
==> [2025-04-29-16:39:54.556008] Encountered error attempting to fetch archive for clingo-bootstrap/smkmkb5 from https://mirror.spack.io/bootstrap/github-actions/v0.5 (v3) due to Error reading manifest at https://mirror.spack.io/bootstrap/github-actions/v0.5/v3/manifests/spec/clingo-bootstrap/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.manifest.json
==> [2025-04-29-16:39:54.557108] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.json.sig
==> [2025-04-29-16:39:54.747425] Failure reading https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.json.sig: HEAD https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.json.sig returned 404: Not Found
==> [2025-04-29-16:39:54.748373] Checking existence of https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.json
==> [2025-04-29-16:39:54.950349] Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spec.json
    [100%]    6.30 KB @   17.3 MB/s
==> [2025-04-29-16:39:55.073242] Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.spack
    [100%]    2.83 MB @   19.2 MB/s
==> [2025-04-29-16:39:55.223757] Installing "clingo-bootstrap@=spack~docs+ipo+optimized+python+static_libstdcpp build_system=cmake build_type=Release generator=make patches:=bebb819,ec99431 arch=linux-centos7-x86_64" from a buildcache
==> [2025-04-29-16:39:55.224236] Reading config from file /work/spack/etc/spack/defaults/packages.yaml
==> [2025-04-29-16:39:55.243989] Reading config from file /root/.spack/bootstrap/config/packages.yaml
==> [2025-04-29-16:39:55.332354] Relocating: /home/spack/spack/opt/spack/bin/sbang => /root/.spack/bootstrap/store/bin/sbang.
==> [2025-04-29-16:39:55.332385] Relocating: /home/spack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5 => /root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5.
==> [2025-04-29-16:39:55.332398] Relocating: /home/spack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path => /root/.spack/bootstrap/store.
==> [2025-04-29-16:39:55.338606] Reading config from file /work/spack/etc/spack/defaults/modules.yaml
==> [2025-04-29-16:39:55.343570] Reading config from file /work/spack/etc/spack/defaults/linux/modules.yaml
==> [2025-04-29-16:39:55.344503] NO MODULE WRITTEN: list of enabled module files is empty
==> [2025-04-29-16:39:55.345706] Patched rpath in lib/python3.10/site-packages/clingo.cpython-310-x86_64-linux-gnu.so from b'/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/opt/_internal/cpython-3.10.13/lib:/opt/python/cp310-cp310/lib:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10' to b'/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64'
==> [2025-04-29-16:39:55.345894] Patched rpath in lib64/libclingo.so.4.0 from b'/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/opt/_internal/cpython-3.10.13/lib:/opt/python/cp310-cp310/lib:/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10' to b'/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib:/root/.spack/bootstrap/store/linux-x86_64/clingo-bootstrap-spack-smkmkb5xqz4v2f7tl22g4e2ghamglox5/lib64'
==> [2025-04-29-16:39:55.356515] [BOOTSTRAP MODULE clingo] The installed spec "clingo-bootstrap@spack+python arch=linux-None-x86_64 ^python@3.10/smkmkb5xqz4v2f7tl22g4e2ghamglox5" provides the "clingo" Python module

The docker image I'm running there came from the following Dockerfile:

Dockerfile contents
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    python3 \
    unzip && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 29, 2025

@scottwittenburg The first failure is indeed my fault - I tried it with Python 3.13, but we don't have that binary in the v0.5 buildcache, with less recent Python versions it works.

@scottwittenburg
Copy link
Copy Markdown
Contributor Author

fails to generate an index for the binary caches that was downloaded.

I see, yes, I can reproduce that issue. At the moment support for v2 layout is read-only, so updating the mirror index of a v2 layout mirror, like the bootstrap one we're talking about above, is not expected to work. I'm not sure if it makes more sense to:

  1. Change this PR again, to support updating the index of old-layout mirrors (and presumably that would be the only non-read-only operation we support?)
  2. Let this be broken for a short period of time, until we can do what I described in a TODO comment here, which can't be done until this PR is merged.

fyi @kwryankrattiger @zackgalbreath

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 29, 2025

I'm also fine with:

  1. Let this be broken for a short period of time and implement updating the index of old-layout mirrors in a following PR

@alalazo alalazo dismissed their stale review April 29, 2025 18:23

The failure with spack bootstrap mirror can be addressed in multiple ways, both within this PR or in a following one. So it's not a blocker.

The failure on github-actions v.05 has been fixed.

@scottwittenburg
Copy link
Copy Markdown
Contributor Author

@zackgalbreath @kwryankrattiger I've been testing protected pipelines and PR pipelines in my gitlab side project using this branch, here are the most recent results:

  • develop pipeline, rebuilds anything not present in the mirror
  • develop snapshot pipeline, copies env specs from develop mirror to snapshot mirror
  • A typical PR pipeline, rebuilds anything not present in develop or PR mirror

@scottwittenburg
Copy link
Copy Markdown
Contributor Author

@haampie I think I've addressed all of your comments/requests, do you mind taking another look when you get a chance? Thanks!

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 30, 2025

One small ergonomic comment for a following PR. The spack buildcache push command allows:

mirror                mirror name, path, or URL

which is convenient to push to buildcaches I don't necessarily want to register in this instance of Spack. The spack buildcache migrate command doesn't:

$ spack buildcache migrate -d ./bootstrap-buildcache
usage: spack buildcache migrate [-hudy] mirror
spack buildcache migrate: error: argument mirror: no mirror named "./bootstrap-buildcache"

and that forces people who just want to update a buildcache to use:

$ spack mirror add bootstrap-buildcache $PWD/bootstrap-buildcache
$ spack buildcache migrate -d bootstrap-buildcache
$ spack mirror remove bootstrap-buildcache

so three commands instead of a single one.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 30, 2025

Another note. A failed migration like:

spack buildcache migrate -d bootstrap-buildcache
==> Warning: Using --delete-existing will delete the entire contents 
    of the old layout within the mirror. Because migrating a mirror 
    that has already been migrated should be fast, consider a workflow 
    where you perform a default migration (i.e. preserve the existing 
    layout rather than deleting it), then evaluate the state of the 
    migrated mirror by attempting to install from it, and finally, 
    run the migration again with --delete-existing.
==> Do you want to proceed? [y/N] y
==> Performing a signed migration of file:///tmp/github-actions-v0.6/bootstrap-buildcache and deleting existing contents
==> Migration summary:
==> Error:   python-venv/pjfgiw4: Unable to read metadata for python-venv/pjfgiw4
==> Error:   clingo-bootstrap/unriyx5: Unable to read metadata for clingo-bootstrap/unriyx5
==> Error:   gcc-runtime/7rv2b76: Unable to read metadata for gcc-runtime/7rv2b76
==> Error:   python-venv/itmfph5: Unable to read metadata for python-venv/itmfph5
==> Error:   gcc-runtime/vytidi6: Unable to read metadata for gcc-runtime/vytidi6
==> Error:   python-venv/hldes7c: Unable to read metadata for python-venv/hldes7c
==> Error:   clingo-bootstrap/jxz7beq: Unable to read metadata for clingo-bootstrap/jxz7beq
==> Error:   python-venv/5vdiojj: Unable to read metadata for python-venv/5vdiojj
==> Error:   zlib-ng/qodit36: Unable to read metadata for zlib-ng/qodit36
==> Error:   python-venv/rdposik: Unable to read metadata for python-venv/rdposik
==> Error:   clingo-bootstrap/56am5pm: Unable to read metadata for clingo-bootstrap/56am5pm
==> Error:   gcc-runtime/o6nx7ce: Unable to read metadata for gcc-runtime/o6nx7ce
==> Error:   libgpg-error/pxc5a72: Unable to read metadata for libgpg-error/pxc5a72
==> Error:   libgcrypt/aaodehi: Unable to read metadata for libgcrypt/aaodehi
==> Error:   python-venv/lmruwrr: Unable to read metadata for python-venv/lmruwrr
==> Error:   clingo-bootstrap/5v5c245: Unable to read metadata for clingo-bootstrap/5v5c245
==> Error:   python-venv/urhkxkg: Unable to read metadata for python-venv/urhkxkg
==> Error:   clingo-bootstrap/6enkeu4: Unable to read metadata for clingo-bootstrap/6enkeu4
==> Error:   python-venv/irfkqa6: Unable to read metadata for python-venv/irfkqa6
==> Error:   python-venv/f3u26s2: Unable to read metadata for python-venv/f3u26s2
==> Error:   clingo-bootstrap/vhj724h: Unable to read metadata for clingo-bootstrap/vhj724h
==> Error:   libgpg-error/lwnk6k2: Unable to read metadata for libgpg-error/lwnk6k2
==> Error:   libksba/xh7k7t5: Unable to read metadata for libksba/xh7k7t5
==> Error:   python-venv/5lqokeg: Unable to read metadata for python-venv/5lqokeg
==> Error:   python-venv/aafcmsa: Unable to read metadata for python-venv/aafcmsa
==> Error:   libgpg-error/t6pohmn: Unable to read metadata for libgpg-error/t6pohmn
==> Error:   libksba/dls4psv: Unable to read metadata for libksba/dls4psv
==> Error:   libiconv/bv2plgt: Unable to read metadata for libiconv/bv2plgt
==> Error:   zlib-ng/j3puqvi: Unable to read metadata for zlib-ng/j3puqvi
==> Error:   python-venv/rfkryfr: Unable to read metadata for python-venv/rfkryfr
==> Error:   clingo-bootstrap/tipihec: Unable to read metadata for clingo-bootstrap/tipihec
==> Error:   libksba/4zm4wcx: Unable to read metadata for libksba/4zm4wcx
==> Error:   zlib-ng/olulf6v: Unable to read metadata for zlib-ng/olulf6v
==> Error:   clingo-bootstrap/i2cye2t: Unable to read metadata for clingo-bootstrap/i2cye2t
==> Error:   python-venv/bd2vfz7: Unable to read metadata for python-venv/bd2vfz7
==> Error:   clingo-bootstrap/zo56jqv: Unable to read metadata for clingo-bootstrap/zo56jqv
==> Error:   zlib-ng/uum7msk: Unable to read metadata for zlib-ng/uum7msk
==> Error:   libiconv/clwajtb: Unable to read metadata for libiconv/clwajtb
==> Error:   libgpg-error/cuagrnb: Unable to read metadata for libgpg-error/cuagrnb
==> Error:   libassuan/uuxij4h: Unable to read metadata for libassuan/uuxij4h
==> Error:   python-venv/aoamktg: Unable to read metadata for python-venv/aoamktg
==> Error:   clingo-bootstrap/4pi6zqq: Unable to read metadata for clingo-bootstrap/4pi6zqq
==> Error:   python-venv/xktktsv: Unable to read metadata for python-venv/xktktsv
==> Error:   clingo-bootstrap/nzya47l: Unable to read metadata for clingo-bootstrap/nzya47l
==> Error:   libgpg-error/op3m3ke: Unable to read metadata for libgpg-error/op3m3ke
==> Error:   libksba/x3h5xtr: Unable to read metadata for libksba/x3h5xtr
==> Error:   python-venv/jnczqat: Unable to read metadata for python-venv/jnczqat
==> Error:   clingo-bootstrap/kavipye: Unable to read metadata for clingo-bootstrap/kavipye
==> Error:   python-venv/qwla45j: Unable to read metadata for python-venv/qwla45j
==> Error:   python-venv/ixceh5n: Unable to read metadata for python-venv/ixceh5n
==> Error:   npth/pbgogmp: Unable to read metadata for npth/pbgogmp
==> Error:   libiconv/dy5pmiq: Unable to read metadata for libiconv/dy5pmiq
==> Error:   python-venv/74ib7qs: Unable to read metadata for python-venv/74ib7qs
==> Error:   clingo-bootstrap/udskqrr: Unable to read metadata for clingo-bootstrap/udskqrr
==> Error:   python-venv/3tdbrvp: Unable to read metadata for python-venv/3tdbrvp
==> Error:   patchelf/mabcw7y: Unable to read metadata for patchelf/mabcw7y
==> Error:   python-venv/kj2y5yz: Unable to read metadata for python-venv/kj2y5yz
==> Error:   clingo-bootstrap/agrdoaj: Unable to read metadata for clingo-bootstrap/agrdoaj
==> Error:   python-venv/n6qa63z: Unable to read metadata for python-venv/n6qa63z
==> Error:   clingo-bootstrap/5bsjop6: Unable to read metadata for clingo-bootstrap/5bsjop6
==> Error:   python-venv/7dl45x6: Unable to read metadata for python-venv/7dl45x6
==> Error:   clingo-bootstrap/scm5uji: Unable to read metadata for clingo-bootstrap/scm5uji
==> Error:   libgcrypt/lfy732f: Unable to read metadata for libgcrypt/lfy732f
==> Error:   python-venv/ulwcwvh: Unable to read metadata for python-venv/ulwcwvh
==> Error:   clingo-bootstrap/cvxik6s: Unable to read metadata for clingo-bootstrap/cvxik6s
==> Error:   python-venv/r2wrrm3: Unable to read metadata for python-venv/r2wrrm3
==> Error:   python-venv/olooc6p: Unable to read metadata for python-venv/olooc6p
==> Error:   python-venv/ev2x4km: Unable to read metadata for python-venv/ev2x4km
==> Error:   python-venv/ppqua32: Unable to read metadata for python-venv/ppqua32
==> Error:   clingo-bootstrap/whdxnb2: Unable to read metadata for clingo-bootstrap/whdxnb2
==> Error:   libgcrypt/2zniebg: Unable to read metadata for libgcrypt/2zniebg
==> Error:   python-venv/fmr5y42: Unable to read metadata for python-venv/fmr5y42
==> Error:   python-venv/fquweaf: Unable to read metadata for python-venv/fquweaf
==> Error:   clingo-bootstrap/54jmcv6: Unable to read metadata for clingo-bootstrap/54jmcv6
==> Error:   libassuan/urbnck3: Unable to read metadata for libassuan/urbnck3
==> Error:   pinentry/2ayqizb: Unable to read metadata for pinentry/2ayqizb
==> Error:   python-venv/ce2msn6: Unable to read metadata for python-venv/ce2msn6
==> Error:   clingo-bootstrap/hnnz6ao: Unable to read metadata for clingo-bootstrap/hnnz6ao
==> Error:   clingo-bootstrap/rvr5ybh: Unable to read metadata for clingo-bootstrap/rvr5ybh
==> Error:   python-venv/ohen5yv: Unable to read metadata for python-venv/ohen5yv
==> Error:   libassuan/wjypew3: Unable to read metadata for libassuan/wjypew3
==> Error:   npth/4mdvxsg: Unable to read metadata for npth/4mdvxsg
==> Error:   python-venv/qkdse3u: Unable to read metadata for python-venv/qkdse3u
==> Error:   clingo-bootstrap/klvkzwp: Unable to read metadata for clingo-bootstrap/klvkzwp
==> Error:   python-venv/mhknbyj: Unable to read metadata for python-venv/mhknbyj
==> Error:   clingo-bootstrap/7utceuv: Unable to read metadata for clingo-bootstrap/7utceuv
==> Error:   libiconv/fcsxxmy: Unable to read metadata for libiconv/fcsxxmy
==> Error:   clingo-bootstrap/adriukt: Unable to read metadata for clingo-bootstrap/adriukt
==> Error:   clingo-bootstrap/fs2aukv: Unable to read metadata for clingo-bootstrap/fs2aukv
==> Error:   libgcrypt/52zd4jc: Unable to read metadata for libgcrypt/52zd4jc
==> Error:   pinentry/jli5etd: Unable to read metadata for pinentry/jli5etd
==> Error:   gnupg/5ntq7qg: Unable to read metadata for gnupg/5ntq7qg
==> Error:   libassuan/gknfboy: Unable to read metadata for libassuan/gknfboy
==> Error:   pinentry/66hrxsd: Unable to read metadata for pinentry/66hrxsd
==> Error:   clingo-bootstrap/4ojfyzo: Unable to read metadata for clingo-bootstrap/4ojfyzo
==> Error:   libiconv/l6yjt5x: Unable to read metadata for libiconv/l6yjt5x
==> Error:   zlib-ng/cjfe7fl: Unable to read metadata for zlib-ng/cjfe7fl
==> Error:   gnupg/eoavahh: Unable to read metadata for gnupg/eoavahh
==> Error:   clingo-bootstrap/6ikikft: Unable to read metadata for clingo-bootstrap/6ikikft
==> Error:   python-venv/ujskjl7: Unable to read metadata for python-venv/ujskjl7
==> Error:   clingo-bootstrap/pl5t4qt: Unable to read metadata for clingo-bootstrap/pl5t4qt
==> Error:   python-venv/fawhzj4: Unable to read metadata for python-venv/fawhzj4
==> Error:   patchelf/hz6j4rm: Unable to read metadata for patchelf/hz6j4rm
==> Error:   python-venv/ecsoc4x: Unable to read metadata for python-venv/ecsoc4x
==> Error:   clingo-bootstrap/a4oyom2: Unable to read metadata for clingo-bootstrap/a4oyom2
==> Error:   libassuan/x7mrkmk: Unable to read metadata for libassuan/x7mrkmk
==> Error:   pinentry/a25ckvv: Unable to read metadata for pinentry/a25ckvv
==> Error:   libgcrypt/at6lwhc: Unable to read metadata for libgcrypt/at6lwhc
==> Error:   npth/c3yv6do: Unable to read metadata for npth/c3yv6do
==> Error:   gnupg/7bmrigo: Unable to read metadata for gnupg/7bmrigo
==> Error:   clingo-bootstrap/et3twem: Unable to read metadata for clingo-bootstrap/et3twem
==> Error:   clingo-bootstrap/u5hxe3p: Unable to read metadata for clingo-bootstrap/u5hxe3p
==> Error:   clingo-bootstrap/zkox3jr: Unable to read metadata for clingo-bootstrap/zkox3jr
==> Error:   npth/mldfiqq: Unable to read metadata for npth/mldfiqq
==> Error:   gnupg/ielazny: Unable to read metadata for gnupg/ielazny
==> Error:   clingo-bootstrap/l2il7xe: Unable to read metadata for clingo-bootstrap/l2il7xe
==> Error:   pinentry/erpvp4z: Unable to read metadata for pinentry/erpvp4z
==> Error:   python-venv/uydy3yi: Unable to read metadata for python-venv/uydy3yi
==> Error:   patchelf/o6soxsz: Unable to read metadata for patchelf/o6soxsz
==> Error:   clingo-bootstrap/4oeblhz: Unable to read metadata for clingo-bootstrap/4oeblhz
==> Error:   clingo-bootstrap/qy5ak2w: Unable to read metadata for clingo-bootstrap/qy5ak2w
==> Error:   clingo-bootstrap/a5mztd5: Unable to read metadata for clingo-bootstrap/a5mztd5
==> Error:   libksba/7kbtasg: Unable to read metadata for libksba/7kbtasg
==> Error:   clingo-bootstrap/chkx4n6: Unable to read metadata for clingo-bootstrap/chkx4n6
==> Error:   clingo-bootstrap/s727fhu: Unable to read metadata for clingo-bootstrap/s727fhu
==> Error:   npth/jsvxvvf: Unable to read metadata for npth/jsvxvvf
==> Error:   gnupg/iwnwfoo: Unable to read metadata for gnupg/iwnwfoo
==> Warning: No specs migrated, did you mean to perform an unsigned migration instead?
==> Recursively deleting file:///tmp/github-actions-v0.6/bootstrap-buildcache/build_cache
==> Migration complete

completely deletes the existing buildcache. The behavior I'd like is to avoid deletion on non-zero exit of the command. Note that the error above happened spuriously, and I am currently unable to reproduce it.

I consider this somewhat minor, given that a warning is printed at the beginning, suggesting a less disruptive workflow, but it's also something we might want to improve in a later PR. Maybe we should give the opportunity to perform out-of-place migrations?

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Apr 30, 2025

To solve the bootstrap mirror issue this diff should be sufficient:

diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index d895956659..d20750fa58 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -2,6 +2,7 @@
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 import os
+import pathlib
 import shutil
 import sys
 import tempfile
@@ -28,7 +29,7 @@
 
 
 # Tarball to be downloaded if binary packages are requested in a local mirror
-BINARY_TARBALL = "https://github.com/spack/spack-bootstrap-mirrors/releases/download/v0.6/bootstrap-buildcache.tar.gz"
+BINARY_TARBALL = "https://github.com/spack/spack-bootstrap-mirrors/releases/download/v0.6/bootstrap-buildcache-v3.tar.gz"
 
 #: Subdirectory where to create the mirror
 LOCAL_MIRROR_DIR = "bootstrap_cache"
@@ -410,14 +411,9 @@ def _mirror(args):
         stage.create()
         stage.fetch()
         stage.expand_archive()
-        # TODO: Once content addressable tarballs PR (#48713) is merged, we can
-        # TODO: merge a PR to spack/spack-bootstrap-mirrors replacing the previous
-        # TODO: spack commit SHA, "d36452cf4e70fa1da8b9db43921850872b82ced9", with an
-        # TODO: updated SHA. Once done, we can make a new release on the bootstrap
-        # TODO: mirrors repo, reflect that new release in BINARY_TARBALL, above, and
-        # TODO: replace "build_cache", below, with "buildcache_relative_specs_path()".
-        build_cache_dir = os.path.join(stage.source_path, "build_cache")
-        shutil.move(build_cache_dir, mirror_dir)
+        stage_dir = pathlib.Path(stage.source_path)
+        for entry in stage_dir.iterdir():
+            shutil.move(str(entry), mirror_dir)
         llnl.util.tty.set_msg_enabled(True)
 
     def write_metadata(subdir, metadata):
@@ -442,7 +438,6 @@ def write_metadata(subdir, metadata):
         shutil.copy(spack.util.path.canonicalize_path(GNUPG_JSON), abs_directory)
         shutil.copy(spack.util.path.canonicalize_path(PATCHELF_JSON), abs_directory)
         instructions += cmd.format("local-binaries", rel_directory)
-        instructions += "  % spack buildcache update-index <final-path>/bootstrap_cache\n"
     print(instructions)

I migrated the bootstrap buildcache and uploaded a layout v3 tarball too, with an index included.

@scottwittenburg
Copy link
Copy Markdown
Contributor Author

@alalazo Thanks for creating a new bootstrap tarball, and trying out the spack buildcache migrate command in the process. I've tested the diff you shared above, verified it works as expected, and committed it.

I agree that if the migrate command experiences any errors, we should refrain from deleting the existing mirror. Instead we could print a message asking them to fix the errors and try again. It could also be nice to allow an out-of-place migration.

Also, I agree the migrate command should accept the same types of mirror arguments accepted by push/create.

I'd like to make these changes in a small follow-up PR, as you suggested.

@scottwittenburg scottwittenburg requested a review from haampie May 1, 2025 15:35
@scottwittenburg scottwittenburg merged commit 2c05ce3 into spack:develop May 6, 2025
35 of 36 checks passed
@scottwittenburg scottwittenburg deleted the content-addressable-tarballs-2 branch May 6, 2025 18:32
abhishek1297 pushed a commit to abhishek1297/spack-melissa that referenced this pull request May 22, 2025
binary_distribution: content addressable url buildcache

Change how binary mirrors are laid out, adopting content addressing for every
piece of data spack stores in a binary mirror. Items (e.g. tarballs, specfiles, public
keys, indices, etc) are now discoverable via manifest files which give the size,
checksum, compression type, etc of the the stored item. The information in the
manifest, in turn, is used to find the actual data, which is stored by its content
address in the blobs directory. Additionally, signing is now applied to the manifest
files, rather than to the spec files themselves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

binary-packages commands core PR affects Spack core functionality defaults documentation Improvements or additions to documentation fetching gitlab Issues related to gitlab integration shell-support tests General test capability(ies) update-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants