alibuild 2.0.2__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. {alibuild-2.0.2 → alibuild-2.0.4}/PKG-INFO +1 -1
  2. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild.egg-info/PKG-INFO +1 -1
  3. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/_version.py +3 -3
  4. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/reconstruct.py +31 -0
  5. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/sync_reapi.py +7 -1
  6. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/user.md +8 -0
  7. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_reconstruct.py +75 -0
  8. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_sync_reapi.py +25 -0
  9. {alibuild-2.0.2 → alibuild-2.0.4}/.claude/skills/s3-conditional-writes/SKILL.md +0 -0
  10. {alibuild-2.0.2 → alibuild-2.0.4}/.claude/skills/support-architecture/SKILL.md +0 -0
  11. {alibuild-2.0.2 → alibuild-2.0.4}/.flake8 +0 -0
  12. {alibuild-2.0.2 → alibuild-2.0.4}/.github/dependabot.yml +0 -0
  13. {alibuild-2.0.2 → alibuild-2.0.4}/.github/workflows/documentation.yml +0 -0
  14. {alibuild-2.0.2 → alibuild-2.0.4}/.github/workflows/homebrew.yml +0 -0
  15. {alibuild-2.0.2 → alibuild-2.0.4}/.github/workflows/pr-check.yml +0 -0
  16. {alibuild-2.0.2 → alibuild-2.0.4}/.github/workflows/release.yml +0 -0
  17. {alibuild-2.0.2 → alibuild-2.0.4}/.gitignore +0 -0
  18. {alibuild-2.0.2 → alibuild-2.0.4}/.pylintrc +0 -0
  19. {alibuild-2.0.2 → alibuild-2.0.4}/ANALYTICS.md +0 -0
  20. {alibuild-2.0.2 → alibuild-2.0.4}/DESIGN.md +0 -0
  21. {alibuild-2.0.2 → alibuild-2.0.4}/LICENSE.md +0 -0
  22. {alibuild-2.0.2 → alibuild-2.0.4}/PACKAGING.md +0 -0
  23. {alibuild-2.0.2 → alibuild-2.0.4}/README.rst +0 -0
  24. {alibuild-2.0.2 → alibuild-2.0.4}/REMOTE_STORE_CAS_AC.md +0 -0
  25. {alibuild-2.0.2 → alibuild-2.0.4}/alfaBuild +0 -0
  26. {alibuild-2.0.2 → alibuild-2.0.4}/aliBuild +0 -0
  27. {alibuild-2.0.2 → alibuild-2.0.4}/aliDeps +0 -0
  28. {alibuild-2.0.2 → alibuild-2.0.4}/aliDoctor +0 -0
  29. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild.egg-info/SOURCES.txt +0 -0
  30. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild.egg-info/dependency_links.txt +0 -0
  31. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild.egg-info/requires.txt +0 -0
  32. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild.egg-info/top_level.txt +0 -0
  33. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/__init__.py +0 -0
  34. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/analytics.py +0 -0
  35. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/args.py +0 -0
  36. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/build.py +0 -0
  37. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/build_template.sh +0 -0
  38. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/clean.py +0 -0
  39. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/cmd.py +0 -0
  40. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/completion.py +0 -0
  41. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/completions/__init__.py +0 -0
  42. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/completions/bash.sh +0 -0
  43. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/completions/zsh.sh +0 -0
  44. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/deps.py +0 -0
  45. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/doctor.py +0 -0
  46. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/git.py +0 -0
  47. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/init.py +0 -0
  48. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/install.py +0 -0
  49. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/keyring.json +0 -0
  50. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/log.py +0 -0
  51. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/migrate.py +0 -0
  52. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/sandbox.py +0 -0
  53. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/scm.py +0 -0
  54. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/signing.py +0 -0
  55. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/sl.py +0 -0
  56. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/source.py +0 -0
  57. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/sync.py +0 -0
  58. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/templating_plugin.py +0 -0
  59. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/utilities.py +0 -0
  60. {alibuild-2.0.2 → alibuild-2.0.4}/alibuild_helpers/workarea.py +0 -0
  61. {alibuild-2.0.2 → alibuild-2.0.4}/alienv +0 -0
  62. {alibuild-2.0.2 → alibuild-2.0.4}/codecov.yml +0 -0
  63. {alibuild-2.0.2 → alibuild-2.0.4}/debian/changelog +0 -0
  64. {alibuild-2.0.2 → alibuild-2.0.4}/debian/compat +0 -0
  65. {alibuild-2.0.2 → alibuild-2.0.4}/debian/control +0 -0
  66. {alibuild-2.0.2 → alibuild-2.0.4}/debian/copyright +0 -0
  67. {alibuild-2.0.2 → alibuild-2.0.4}/debian/files +0 -0
  68. {alibuild-2.0.2 → alibuild-2.0.4}/debian/rules +0 -0
  69. {alibuild-2.0.2 → alibuild-2.0.4}/docs/SUPPORT +0 -0
  70. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/alice_logo.png +0 -0
  71. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/deps.png +0 -0
  72. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/index.md +0 -0
  73. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/quick.md +0 -0
  74. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/reference.md +0 -0
  75. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/stylesheets/extra.css +0 -0
  76. {alibuild-2.0.2 → alibuild-2.0.4}/docs/docs/troubleshooting.md +0 -0
  77. {alibuild-2.0.2 → alibuild-2.0.4}/docs/mkdocs.yml +0 -0
  78. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/alibuild_nix.jnj +0 -0
  79. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/alidist-aliphysics.nix +0 -0
  80. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/alidist-helpers.nix +0 -0
  81. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/alidist.nix +0 -0
  82. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/flake.lock +0 -0
  83. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/flake.nix +0 -0
  84. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/hyperloop.nix +0 -0
  85. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/hyperloopTest.nix +0 -0
  86. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/nix-interactive.bash +0 -0
  87. {alibuild-2.0.2 → alibuild-2.0.4}/extras/nix/update-envs.sh +0 -0
  88. {alibuild-2.0.2 → alibuild-2.0.4}/pb +0 -0
  89. {alibuild-2.0.2 → alibuild-2.0.4}/pyproject.toml +0 -0
  90. {alibuild-2.0.2 → alibuild-2.0.4}/requirements.txt +0 -0
  91. {alibuild-2.0.2 → alibuild-2.0.4}/setup.cfg +0 -0
  92. {alibuild-2.0.2 → alibuild-2.0.4}/setup.py +0 -0
  93. {alibuild-2.0.2 → alibuild-2.0.4}/templates/alibuild_nix.jnj +0 -0
  94. {alibuild-2.0.2 → alibuild-2.0.4}/templates/alibuild_to_please.jnj +0 -0
  95. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_analytics.py +0 -0
  96. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_args.py +0 -0
  97. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_build.py +0 -0
  98. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_clean.py +0 -0
  99. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_cmd.py +0 -0
  100. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_completion.py +0 -0
  101. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_deps.py +0 -0
  102. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_doctor.py +0 -0
  103. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_git.py +0 -0
  104. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_hashing.py +0 -0
  105. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_init.py +0 -0
  106. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_install.py +0 -0
  107. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_log.py +0 -0
  108. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_migrate.py +0 -0
  109. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_packagelist.py +0 -0
  110. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_parseRecipe.py +0 -0
  111. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_sandbox.py +0 -0
  112. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_signing.py +0 -0
  113. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_source.py +0 -0
  114. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_sync.py +0 -0
  115. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_utilities.py +0 -0
  116. {alibuild-2.0.2 → alibuild-2.0.4}/tests/test_workarea.py +0 -0
  117. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken1.sh +0 -0
  118. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken2.sh +0 -0
  119. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken3.sh +0 -0
  120. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken4.sh +0 -0
  121. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken5.sh +0 -0
  122. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken6.sh +0 -0
  123. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/broken7.sh +0 -0
  124. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/clobber-initdotsh.sh +0 -0
  125. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/defaults-o2.sh +0 -0
  126. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/delete-etc.sh +0 -0
  127. {alibuild-2.0.2 → alibuild-2.0.4}/tests/testdist/tracking-env.sh +0 -0
  128. {alibuild-2.0.2 → alibuild-2.0.4}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alibuild
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: ALICE Build Tool
5
5
  Home-page: https://alisw.github.io/alibuild
6
6
  Author: Giulio Eulisse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alibuild
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: ALICE Build Tool
5
5
  Home-page: https://alisw.github.io/alibuild
6
6
  Author: Giulio Eulisse
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2.0.2'
32
- __version_tuple__ = version_tuple = (2, 0, 2)
31
+ __version__ = version = '2.0.4'
32
+ __version_tuple__ = version_tuple = (2, 0, 4)
33
33
 
34
- __commit_id__ = commit_id = 'g523c3af01'
34
+ __commit_id__ = commit_id = 'g923d84715'
@@ -66,6 +66,17 @@ def add_parser(subparsers, detected_arch, work_dir_default):
66
66
  help="With --verify --rebuild: treat a non-identical rebuilt tarball as a failure "
67
67
  "(default: soft, since legacy pre-normalisation tarballs are not "
68
68
  "bit-reproducible).")
69
+ p.add_argument("--docker-image", dest="dockerImage", default=None, metavar="IMAGE",
70
+ help="Rebuild in IMAGE instead of the build container recorded in the AC "
71
+ "entry, e.g. when that image is gone from the registry. The container "
72
+ "is not an input to the action hash; --rebaseline --apply records "
73
+ "IMAGE as the entry's action.container.")
74
+ p.add_argument("--docker-extra-args", dest="dockerExtraArgs", default="", metavar="ARGLIST",
75
+ help="As for 'aliBuild build': passed to the rebuild's 'docker run', e.g. "
76
+ "--docker-extra-args='--cpus=8 --memory=32g' (with '=').")
77
+ p.add_argument("-j", "--jobs", dest="jobs", type=int, default=None, metavar="N",
78
+ help="Parallel compilation processes for the rebuild ('aliBuild build -j'). "
79
+ "Default: build's, all the cores of the machine.")
69
80
  p.add_argument("--alidist", dest="alidist", default=None, metavar="DIR",
70
81
  help="alidist checkout used to supply the defaults config file "
71
82
  "(defaults-<name>.sh) when it is not archived in the ledger (it is a config, "
@@ -468,6 +479,11 @@ def verify_rebuild(args, sync, closure, build_runner=None):
468
479
  ac_store = ac_store[:-4]
469
480
  container = entry["action"].get("container") or {}
470
481
  image = container.get("digest") or container.get("image")
482
+ if getattr(args, "dockerImage", None):
483
+ warning("NOT rebuilding %s in its recorded build container:\n"
484
+ " recorded: %s\n using : %s",
485
+ args.package, image or "none (native build)", args.dockerImage)
486
+ image = args.dockerImage
471
487
  # Rebuild with the defaults this build actually used (they feed the action
472
488
  # hash), not a hardcoded guess: prefer the recorded field, else recover the
473
489
  # flavour from the archived defaults recipe (migrated entries lack the field).
@@ -510,8 +526,12 @@ def verify_rebuild(args, sync, closure, build_runner=None):
510
526
  cmd += ["--insecure"]
511
527
  if os.path.isdir(reference_dir):
512
528
  cmd += ["--reference-sources", reference_dir]
529
+ if getattr(args, "jobs", None):
530
+ cmd += ["-j", str(args.jobs)]
513
531
  if image:
514
532
  cmd += ["--docker", "--docker-image", image]
533
+ if getattr(args, "dockerExtraArgs", ""):
534
+ cmd.append("--docker-extra-args=" + args.dockerExtraArgs)
515
535
 
516
536
  # The materialised recipes are a plain directory, not an SCM checkout; pass the
517
537
  # alidist provenance explicitly so the build doesn't require a git repo (the
@@ -574,6 +594,17 @@ def do_rebaseline(args, sync, closure, result):
574
594
  result.algo, result.rebuilt)
575
595
  info(" orphaned old CAS blob: %s%s", old_cas,
576
596
  " (will delete)" if getattr(args, "delete_old", False) else " (left in place)")
597
+ if getattr(args, "dockerImage", None):
598
+ # Rebuilt in another image: record the one actually used, as `aliBuild build`
599
+ # does. Not in the action hash nor in the signed payload, so the entry keeps
600
+ # its key and is re-signed below like any re-baseline.
601
+ from argparse import Namespace
602
+ from alibuild_helpers.build import resolve_container_provenance
603
+ container = resolve_container_provenance(Namespace(docker=True,
604
+ dockerImage=args.dockerImage))
605
+ info(" rewrite action.container: %s -> %s", entry["action"].get("container"),
606
+ container)
607
+ entry = dict(entry, action=dict(entry["action"], container=container))
577
608
 
578
609
  if not getattr(args, "apply", False):
579
610
  warning("DRY RUN: nothing written. Re-run with --apply to perform the "
@@ -363,7 +363,13 @@ class REAPIRemoteSync(Boto3RemoteSync):
363
363
  The check has to happen before the base implementation writes anything: it
364
364
  claims the per-package link and uploads the legacy symlinks *before* calling
365
365
  _upload_tarball, so aborting from in there leaves a claimed link with no
366
- artifact behind it for a later build to clean up."""
366
+ artifact behind it for a later build to clean up.
367
+
368
+ A read-only store publishes nothing, so there is nothing to check either:
369
+ return before the ledger lookup, which needs the AC *write* bucket and would
370
+ otherwise fail on an empty bucket name (the base class returns early too)."""
371
+ if not self.writeStore:
372
+ return
367
373
  ac_entry = spec.get("ac_entry")
368
374
  if ac_entry:
369
375
  self.assert_deps_in_ledger(ac_entry["action"])
@@ -404,6 +404,14 @@ aliBuild reconstruct O2 --version nightly-20261015 \
404
404
  store redirect to the rebuilt hash, so later verifications are byte-identical.
405
405
  A dry run unless `--apply`; `--delete-old` additionally removes the blob the
406
406
  re-baseline orphans.
407
+ - `--docker-image IMAGE`: rebuild in `IMAGE` instead of the recorded build
408
+ container, e.g. when that has been deleted from the registry. The container is
409
+ not part of the action hash; `--rebaseline --apply` records `IMAGE` as the
410
+ entry's `action.container`. Expect `--persist` to reproduce only packages whose
411
+ output does not depend on the image.
412
+ - `-j N`, `--docker-extra-args ARGS`: passed to the rebuild's `aliBuild build`,
413
+ e.g. `-j 8 --docker-extra-args='--cpus=8 --memory=32g'` to keep it within a
414
+ batch slot.
407
415
  - `--output-config DIR`: where to materialise the recipes. Defaults to
408
416
  `WORKDIR/reconstruct-PACKAGE`.
409
417
  - `--alidist DIR`: an alidist checkout to take the defaults file
@@ -1,4 +1,5 @@
1
1
  import hashlib
2
+ import json
2
3
  import os
3
4
  import os.path
4
5
  import shutil
@@ -611,6 +612,80 @@ class ReconstructTestCase(unittest.TestCase):
611
612
  self.assertIn("--legacy-links-store", commands[0])
612
613
  self.assertIn("https://example/cas", commands[0])
613
614
 
615
+ def test_verify_rebuild_docker_image_override_and_jobs(self):
616
+ """--docker-image replaces the recorded container; -j and
617
+ --docker-extra-args reach the isolated build."""
618
+ closure = [self.entries["hash-zlib"]] # recorded alisw/slc7-builder@sha256:abc
619
+ for override, jobs, image in ((None, None, "alisw/slc7-builder@sha256:abc"),
620
+ ("reg/new@sha256:def", 8, "reg/new@sha256:def")):
621
+ args = self._rebuild_args()
622
+ args.dockerImage, args.jobs, args.dockerExtraArgs = override, jobs, "--cpus=8"
623
+ commands = []
624
+ with patch("alibuild_helpers.reconstruct.materialize_recipes"), \
625
+ patch("alibuild_helpers.reconstruct.restore_sources", return_value=([], [])), \
626
+ patch("alibuild_helpers.reconstruct.GitSourceStore"):
627
+ verify_rebuild(args, self.make_sync(()), closure,
628
+ build_runner=lambda cmd: commands.append(cmd) or 1)
629
+ cmd = commands[0]
630
+ self.assertEqual(cmd[cmd.index("--docker-image") + 1], image)
631
+ self.assertIn("--docker-extra-args=--cpus=8", cmd)
632
+ if jobs:
633
+ self.assertEqual(cmd[cmd.index("-j") + 1], "8")
634
+ else:
635
+ self.assertNotIn("-j", cmd)
636
+
637
+ @patch("alibuild_helpers.signing.sign_via_proxy")
638
+ @patch("alibuild_helpers.sync_reapi.REAPIRemoteSync._s3_init", new=MagicMock())
639
+ def test_do_rebaseline_records_the_override_container_and_stays_signed(self, sign_via_proxy):
640
+ from alibuild_helpers import signing
641
+ seed = bytes(range(32))
642
+ keyid, pub = signing.public_key(seed)
643
+ sign_via_proxy.side_effect = lambda entry, url, tok, signer, **kw: \
644
+ signing.sign(entry, seed, signer)
645
+ s = sync_reapi.REAPIRemoteSync(
646
+ "reapi://proxy/cas", "reapi://proxy/cas", ARCH, "/sw",
647
+ legacyStore="reapi://proxy/repo", casPublicUrl="https://example/cas",
648
+ sign_url="https://proxy/sign", sign_token="tok")
649
+ s.s3 = MagicMock()
650
+ tarball = os.path.join(self.tmp, "zlib.tar.gz")
651
+ with open(tarball, "wb") as handle:
652
+ handle.write(b"rebuilt")
653
+ rebuilt = hashlib.sha256(b"rebuilt").hexdigest()
654
+ result = RebuildResult(True, kind="differ", algo="sha256", recorded="a" * 64,
655
+ rebuilt=rebuilt, tarball=tarball)
656
+ used = {"runtime": "docker", "image": "reg/new@sha256:def",
657
+ "digest": "reg/new@sha256:def"}
658
+ entry = make_entry("zlib", "v1", "1", "a" * 64, "rz",
659
+ container={"image": "reg/gone", "digest": "reg/gone@sha256:abc"})
660
+ with patch("alibuild_helpers.build.resolve_container_provenance",
661
+ return_value=used) as resolve:
662
+ self.assertTrue(do_rebaseline(
663
+ Namespace(package="zlib", version="v1", apply=True, delete_old=False,
664
+ dockerImage="reg/new@sha256:def"), s, [entry], result))
665
+ self.assertEqual(resolve.call_args.args[0].dockerImage, "reg/new@sha256:def")
666
+ written = [json.loads(c.kwargs["Body"]) for c in s.s3.put_object.call_args_list
667
+ if c.kwargs["Key"].startswith("ac/")]
668
+ self.assertEqual(len(written), 1)
669
+ self.assertEqual(written[0]["action"]["container"], used)
670
+ self.assertEqual(written[0]["result"]["outputDigest"], "sha256:" + rebuilt)
671
+ ring = signing.load_keyring({"keys": {keyid: {"publicKey": pub, "signer": "ci"}},
672
+ "revoked": []})
673
+ self.assertTrue(signing.verify(written[0], ring)[0])
674
+ # The closure's own entry is not mutated.
675
+ self.assertEqual(entry["action"]["container"]["image"], "reg/gone")
676
+
677
+ def test_do_persist_with_override_leaves_the_ac_entry_alone(self):
678
+ result = RebuildResult(True, kind="match", algo="sha256",
679
+ recorded="a" * 64, rebuilt="a" * 64, tarball="/x")
680
+ sync_mock = MagicMock()
681
+ sync_mock.artifact_blob_exists.return_value = False
682
+ sync_mock.put_artifact_blob.return_value = "a" * 64
683
+ args = self._persist_args(apply=True)
684
+ args.dockerImage = "reg/new@sha256:def"
685
+ self.assertTrue(do_persist(args, sync_mock, [self._rebaseline_entry()], result))
686
+ self.assertEqual({call[0] for call in sync_mock.method_calls},
687
+ {"artifact_blob_exists", "put_artifact_blob"})
688
+
614
689
 
615
690
  if __name__ == "__main__":
616
691
  unittest.main()
@@ -220,6 +220,31 @@ class REAPIRemoteSyncTestCase(unittest.TestCase):
220
220
  self.assertEqual(client.upload_file.call_args.kwargs["Key"], cas_path)
221
221
  self.assertEqual(bucket_of[store_key], "artifacts")
222
222
 
223
+ @patch("alibuild_helpers.sync_reapi.file_digest",
224
+ new=MagicMock(return_value=REAPI_CONTENT_HASH))
225
+ @patch("os.path.getsize", new=MagicMock(return_value=4096))
226
+ @patch("os.listdir",
227
+ new=lambda path: [tarball_name(REAPI_SPEC)] if path.endswith("-1") else [])
228
+ @patch("os.readlink", new=MagicMock(return_value="../../store/de/dead/x.tar.gz"))
229
+ @patch("os.path.islink", new=MagicMock(return_value=True))
230
+ def test_upload_read_only_store_is_a_noop_with_deps(self) -> None:
231
+ # A read-only store (e.g. the isolated rebuild of `aliBuild reconstruct`)
232
+ # must not run the ledger check: it has no AC write bucket, and looking a
233
+ # dependency up in "" raised ParamValidationError for every package with
234
+ # dependencies.
235
+ client = self.make_client()
236
+ reapi = sync_reapi.REAPIRemoteSync(
237
+ remoteStore="reapi://localhost/bucket", writeStore="",
238
+ architecture=ARCHITECTURE, workdir="/sw")
239
+ reapi.s3 = client
240
+ spec = json.loads(json.dumps(REAPI_SPEC))
241
+ spec["ac_entry"]["action"]["deps"] = [
242
+ {"actionHash": "0" * 40, "package": "dep"}]
243
+ reapi.upload_symlinks_and_tarball(spec)
244
+ client.head_object.assert_not_called()
245
+ client.put_object.assert_not_called()
246
+ client.upload_file.assert_not_called()
247
+
223
248
  @patch("alibuild_helpers.sync_reapi.file_digest",
224
249
  new=MagicMock(return_value=REAPI_CONTENT_HASH))
225
250
  @patch("os.path.getsize", new=MagicMock(return_value=4096))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes