alibuild 2.0.6__tar.gz → 2.0.7__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.6 → alibuild-2.0.7}/PKG-INFO +1 -1
  2. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild.egg-info/PKG-INFO +1 -1
  3. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/_version.py +3 -3
  4. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/migrate.py +36 -15
  5. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/utilities.py +6 -1
  6. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/reference.md +30 -0
  7. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/user.md +3 -2
  8. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_migrate.py +48 -0
  9. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_utilities.py +10 -0
  10. {alibuild-2.0.6 → alibuild-2.0.7}/.claude/skills/s3-conditional-writes/SKILL.md +0 -0
  11. {alibuild-2.0.6 → alibuild-2.0.7}/.claude/skills/support-architecture/SKILL.md +0 -0
  12. {alibuild-2.0.6 → alibuild-2.0.7}/.flake8 +0 -0
  13. {alibuild-2.0.6 → alibuild-2.0.7}/.github/dependabot.yml +0 -0
  14. {alibuild-2.0.6 → alibuild-2.0.7}/.github/workflows/documentation.yml +0 -0
  15. {alibuild-2.0.6 → alibuild-2.0.7}/.github/workflows/homebrew.yml +0 -0
  16. {alibuild-2.0.6 → alibuild-2.0.7}/.github/workflows/pr-check.yml +0 -0
  17. {alibuild-2.0.6 → alibuild-2.0.7}/.github/workflows/release.yml +0 -0
  18. {alibuild-2.0.6 → alibuild-2.0.7}/.gitignore +0 -0
  19. {alibuild-2.0.6 → alibuild-2.0.7}/.pylintrc +0 -0
  20. {alibuild-2.0.6 → alibuild-2.0.7}/ANALYTICS.md +0 -0
  21. {alibuild-2.0.6 → alibuild-2.0.7}/DESIGN.md +0 -0
  22. {alibuild-2.0.6 → alibuild-2.0.7}/LICENSE.md +0 -0
  23. {alibuild-2.0.6 → alibuild-2.0.7}/PACKAGING.md +0 -0
  24. {alibuild-2.0.6 → alibuild-2.0.7}/README.rst +0 -0
  25. {alibuild-2.0.6 → alibuild-2.0.7}/REMOTE_STORE_CAS_AC.md +0 -0
  26. {alibuild-2.0.6 → alibuild-2.0.7}/alfaBuild +0 -0
  27. {alibuild-2.0.6 → alibuild-2.0.7}/aliBuild +0 -0
  28. {alibuild-2.0.6 → alibuild-2.0.7}/aliDeps +0 -0
  29. {alibuild-2.0.6 → alibuild-2.0.7}/aliDoctor +0 -0
  30. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild.egg-info/SOURCES.txt +0 -0
  31. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild.egg-info/dependency_links.txt +0 -0
  32. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild.egg-info/requires.txt +0 -0
  33. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild.egg-info/top_level.txt +0 -0
  34. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/__init__.py +0 -0
  35. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/analytics.py +0 -0
  36. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/args.py +0 -0
  37. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/build.py +0 -0
  38. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/build_template.sh +0 -0
  39. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/clean.py +0 -0
  40. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/cmd.py +0 -0
  41. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/completion.py +0 -0
  42. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/completions/__init__.py +0 -0
  43. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/completions/bash.sh +0 -0
  44. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/completions/zsh.sh +0 -0
  45. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/deps.py +0 -0
  46. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/doctor.py +0 -0
  47. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/git.py +0 -0
  48. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/init.py +0 -0
  49. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/install.py +0 -0
  50. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/keyring.json +0 -0
  51. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/log.py +0 -0
  52. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/reconstruct.py +0 -0
  53. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/sandbox.py +0 -0
  54. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/scm.py +0 -0
  55. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/signing.py +0 -0
  56. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/sl.py +0 -0
  57. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/source.py +0 -0
  58. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/sync.py +0 -0
  59. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/sync_reapi.py +0 -0
  60. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/templating_plugin.py +0 -0
  61. {alibuild-2.0.6 → alibuild-2.0.7}/alibuild_helpers/workarea.py +0 -0
  62. {alibuild-2.0.6 → alibuild-2.0.7}/alienv +0 -0
  63. {alibuild-2.0.6 → alibuild-2.0.7}/codecov.yml +0 -0
  64. {alibuild-2.0.6 → alibuild-2.0.7}/debian/changelog +0 -0
  65. {alibuild-2.0.6 → alibuild-2.0.7}/debian/compat +0 -0
  66. {alibuild-2.0.6 → alibuild-2.0.7}/debian/control +0 -0
  67. {alibuild-2.0.6 → alibuild-2.0.7}/debian/copyright +0 -0
  68. {alibuild-2.0.6 → alibuild-2.0.7}/debian/files +0 -0
  69. {alibuild-2.0.6 → alibuild-2.0.7}/debian/rules +0 -0
  70. {alibuild-2.0.6 → alibuild-2.0.7}/docs/SUPPORT +0 -0
  71. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/alice_logo.png +0 -0
  72. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/deps.png +0 -0
  73. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/index.md +0 -0
  74. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/quick.md +0 -0
  75. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/stylesheets/extra.css +0 -0
  76. {alibuild-2.0.6 → alibuild-2.0.7}/docs/docs/troubleshooting.md +0 -0
  77. {alibuild-2.0.6 → alibuild-2.0.7}/docs/mkdocs.yml +0 -0
  78. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/alibuild_nix.jnj +0 -0
  79. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/alidist-aliphysics.nix +0 -0
  80. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/alidist-helpers.nix +0 -0
  81. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/alidist.nix +0 -0
  82. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/flake.lock +0 -0
  83. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/flake.nix +0 -0
  84. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/hyperloop.nix +0 -0
  85. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/hyperloopTest.nix +0 -0
  86. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/nix-interactive.bash +0 -0
  87. {alibuild-2.0.6 → alibuild-2.0.7}/extras/nix/update-envs.sh +0 -0
  88. {alibuild-2.0.6 → alibuild-2.0.7}/pb +0 -0
  89. {alibuild-2.0.6 → alibuild-2.0.7}/pyproject.toml +0 -0
  90. {alibuild-2.0.6 → alibuild-2.0.7}/requirements.txt +0 -0
  91. {alibuild-2.0.6 → alibuild-2.0.7}/setup.cfg +0 -0
  92. {alibuild-2.0.6 → alibuild-2.0.7}/setup.py +0 -0
  93. {alibuild-2.0.6 → alibuild-2.0.7}/templates/alibuild_nix.jnj +0 -0
  94. {alibuild-2.0.6 → alibuild-2.0.7}/templates/alibuild_to_please.jnj +0 -0
  95. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_analytics.py +0 -0
  96. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_args.py +0 -0
  97. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_build.py +0 -0
  98. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_clean.py +0 -0
  99. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_cmd.py +0 -0
  100. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_completion.py +0 -0
  101. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_deps.py +0 -0
  102. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_doctor.py +0 -0
  103. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_git.py +0 -0
  104. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_hashing.py +0 -0
  105. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_init.py +0 -0
  106. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_install.py +0 -0
  107. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_log.py +0 -0
  108. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_packagelist.py +0 -0
  109. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_parseRecipe.py +0 -0
  110. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_reconstruct.py +0 -0
  111. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_sandbox.py +0 -0
  112. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_signing.py +0 -0
  113. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_source.py +0 -0
  114. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_sync.py +0 -0
  115. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_sync_reapi.py +0 -0
  116. {alibuild-2.0.6 → alibuild-2.0.7}/tests/test_workarea.py +0 -0
  117. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken1.sh +0 -0
  118. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken2.sh +0 -0
  119. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken3.sh +0 -0
  120. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken4.sh +0 -0
  121. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken5.sh +0 -0
  122. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken6.sh +0 -0
  123. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/broken7.sh +0 -0
  124. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/clobber-initdotsh.sh +0 -0
  125. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/defaults-o2.sh +0 -0
  126. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/delete-etc.sh +0 -0
  127. {alibuild-2.0.6 → alibuild-2.0.7}/tests/testdist/tracking-env.sh +0 -0
  128. {alibuild-2.0.6 → alibuild-2.0.7}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alibuild
3
- Version: 2.0.6
3
+ Version: 2.0.7
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.6
3
+ Version: 2.0.7
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.6'
32
- __version_tuple__ = version_tuple = (2, 0, 6)
31
+ __version__ = version = '2.0.7'
32
+ __version_tuple__ = version_tuple = (2, 0, 7)
33
33
 
34
- __commit_id__ = commit_id = 'g53d1fd621'
34
+ __commit_id__ = commit_id = 'g194bf901d'
@@ -395,6 +395,28 @@ def _github_raw_base(remote_url):
395
395
  return "https://raw.githubusercontent.com/" + (match.group(1) if match else "alisw/alidist")
396
396
 
397
397
 
398
+ def recipe_from_meta(meta, tarball_path):
399
+ """The recipe an aliBuild 2.0 tarball archives in its .meta.json, or None.
400
+
401
+ Such a tarball is normally in the Action Cache already, and the migration
402
+ loop skips it as present before getting here. It reaches migrate when it was
403
+ uploaded to a plain legacy store, with no Action Cache to write to (e.g. a
404
+ Jenkins daily run with aliBuild 2.0 against b3://). It records no alidist
405
+ commit, so the archived recipe is the only way to migrate it -- and the
406
+ better one, being exactly what was built. A text that does not match its
407
+ recorded digest is not trusted (None: fall back to the alidist commit)."""
408
+ archived = meta.get("recipe") or {}
409
+ text = archived.get("text")
410
+ if not text:
411
+ return None
412
+ digest = "sha256:" + hashlib.sha256(text.encode("utf-8", "ignore")).hexdigest()
413
+ if archived.get("digest") not in (None, digest):
414
+ warning("%s: the archived recipe does not match its digest %s; ignoring it",
415
+ tarball_path, archived.get("digest"))
416
+ return None
417
+ return text
418
+
419
+
398
420
  def recover_recipe(alidist_dir, alidist_commit, package):
399
421
  """Recover the full recipe of `package` at the recorded alidist commit.
400
422
 
@@ -805,21 +827,20 @@ def migrate_tarball(sync, tarball_path, alidist_dir, container_override=None,
805
827
  tarball_path)
806
828
  return None
807
829
  container = container_for_migration(meta["architecture"], container_override)
808
- # Only legacy tarballs carry an alidist commit; current builds record it in the AC
809
- # entry. Checked before the try below, whose handler would otherwise raise a
810
- # second KeyError while reporting the first.
811
- alidist_commit = (meta.get("alidist") or {}).get("commit")
812
- if not alidist_commit:
813
- warning("%s records no alidist commit; skipping (not a legacy tarball -- "
814
- "current builds archive the recipe and are already in the ledger)",
815
- tarball_path)
816
- return None
817
- try:
818
- recipe = recover_recipe(alidist_dir, alidist_commit, meta["package"]["name"])
819
- except Exception as exc: # pylint: disable=broad-except
820
- warning("Could not recover recipe for %s from alidist@%s: %s",
821
- meta["package"]["name"], alidist_commit, exc)
822
- return None
830
+ recipe = recipe_from_meta(meta, tarball_path)
831
+ if recipe is None:
832
+ # aliBuild 1.x tarballs record the alidist commit instead of the recipe.
833
+ alidist_commit = (meta.get("alidist") or {}).get("commit")
834
+ if not alidist_commit:
835
+ warning("%s records neither its recipe nor an alidist commit; skipping "
836
+ "(not migratable)", tarball_path)
837
+ return None
838
+ try:
839
+ recipe = recover_recipe(alidist_dir, alidist_commit, meta["package"]["name"])
840
+ except Exception as exc: # pylint: disable=broad-except
841
+ warning("Could not recover recipe for %s from alidist@%s: %s",
842
+ meta["package"]["name"], alidist_commit, exc)
843
+ return None
823
844
  if verify:
824
845
  ok, reason = verify_recovered_recipe(meta, recipe)
825
846
  if not ok:
@@ -452,7 +452,7 @@ class GitReader:
452
452
  m = re.search(r'^dist:(.*)@([^@]+)$', self.url)
453
453
  fn, gh = m.groups()
454
454
  err, d = git(("show", f"{gh}:{fn.lower()}.sh"),
455
- directory=self.configDir)
455
+ directory=self.configDir, check=False)
456
456
  if err:
457
457
  raise RuntimeError("Cannot read recipe {fn} from reference {gh}.\n"
458
458
  "Make sure you run first (this will not alter your recipes):\n"
@@ -543,6 +543,11 @@ def getPkgDirs(configDir):
543
543
  return pkgDirs
544
544
 
545
545
  def resolveFilename(taps: dict, pkg: str, configDir: str):
546
+ # A recipe pinned in the defaults' overrides (PKG@<ref>) is read with
547
+ # "git show" from the -c repository: it is not a file to look for, and no
548
+ # BITS_PATH directory can shadow it.
549
+ if pkg in taps:
550
+ return (taps[pkg], os.path.abspath(configDir))
546
551
  for d in getPkgDirs(configDir):
547
552
  filename = checkForFilename(taps, pkg, d)
548
553
  if os.path.exists(filename):
@@ -4,6 +4,7 @@ layout: main
4
4
  ---
5
5
 
6
6
  1. [Recipe formats](#recipe-formats)
7
+ 1. [Searching several directories: `BITS_PATH`](#searching-several-directories-bits_path)
7
8
  1. [The header](#the-header)
8
9
  2. [The body](#the-body)
9
10
  3. [Defaults, common requirements for builds](#defaults)
@@ -18,6 +19,35 @@ The recipes themselves are called `<package>.sh` where `<package>` is the name
18
19
  of the package whose build recipe is described. Please note that all recipe
19
20
  filenames are lowercase: _e.g._ the recipe for `ROOT` will be in `root.sh`.
20
21
 
22
+ ### Searching several directories: `BITS_PATH`
23
+
24
+ Recipes can also come from directories other than the `-c` one, listed in the
25
+ `BITS_PATH` environment variable, separated by colons as in `PATH`:
26
+
27
+ ```bash
28
+ export BITS_PATH=/home/user/my-recipes:extra
29
+ aliBuild build O2 --defaults o2
30
+ ```
31
+
32
+ For every package, and for the `defaults-<name>.sh` selected with
33
+ `--defaults`, aliBuild looks in each `BITS_PATH` directory in order and then in
34
+ the `-c` directory, and takes the first `<package>.sh` it finds. So a recipe in
35
+ a `BITS_PATH` directory replaces the one of the same name in alidist, and the
36
+ `-c` directory is always searched last.
37
+
38
+ - A relative entry is taken relative to the `-c` directory, not to the current
39
+ directory: above, `extra` means `alidist/extra`.
40
+ - Empty entries and a trailing colon are ignored; an unset or empty
41
+ `BITS_PATH` means only the `-c` directory is searched.
42
+ - Some files are only read from the `-c` directory: the architecture defaults
43
+ (`defaults-<arch>.sh`, see [below](#architecture-defaults)), and the list of
44
+ available defaults printed when the one requested does not exist.
45
+ - A recipe pinned to a commit in a defaults' `overrides` (`ROOT@<ref>`, see
46
+ [Defaults](#defaults)) is read with `git show` from that commit of the `-c`
47
+ repository, whatever `BITS_PATH` says. The `-c` directory must then be a
48
+ git repository. aliBuild v1.17.15 to v2.0.6 cannot find such a
49
+ recipe and stop with `Package ROOT not found`.
50
+
21
51
  The recipe itself is made up of two parts: an header, and the actual build
22
52
  script, separated by three dashes (`---`) standalone.
23
53
 
@@ -427,8 +427,9 @@ aliBuild reconstruct O2 --version nightly-20261015 \
427
427
  `aliBuild migrate` turns tarballs from a classic store into reapi entries, so
428
428
  that releases built before any of this existed become installable and
429
429
  reconstructible. For each tarball it reads the embedded `.meta.json` provenance,
430
- recovers the full recipe from the alidist commit recorded there, synthesises the
431
- Action Cache entry, and writes the CAS blob, the recipe blob, the entry, the
430
+ takes the full recipe from it (tarballs built by aliBuild 2.0 archive it there,
431
+ including those uploaded to a classic store only) or else recovers it from the
432
+ alidist commit recorded there (aliBuild 1.x), synthesises the Action Cache entry, and writes the CAS blob, the recipe blob, the entry, the
432
433
  legacy redirect and the per-package link. The old store is only ever read, never
433
434
  written.
434
435
 
@@ -226,6 +226,54 @@ class MigrateTestCase(unittest.TestCase):
226
226
  self.assertIn("build zlib", recipe) # recovered from alidist
227
227
  self.assertEqual(entry["action"]["package"], "zlib")
228
228
 
229
+ def _meta_with_archived_recipe(self, text, digest=None):
230
+ """The .meta.json of an aliBuild 2.0 build: the recipe, no alidist commit."""
231
+ meta = json.loads(json.dumps(META))
232
+ del meta["alidist"], meta["alibuild_version"]
233
+ meta["recipe"] = {
234
+ "digest": digest or "sha256:" + hashlib.sha256(text.encode()).hexdigest(),
235
+ "text": text, "env": {}, "append_path": {}, "prepend_path": {}}
236
+ return meta
237
+
238
+ def test_migrate_tarball_uses_the_archived_recipe(self):
239
+ # A 2.0 build uploaded to a legacy store only (no Action Cache): it has
240
+ # no alidist commit, and used to be skipped as "already in the ledger".
241
+ text = "package: zlib\nversion: v1.3.1\n---\narchived zlib\n"
242
+ path = self._write_tarball(self._meta_with_archived_recipe(text))
243
+ sync = FakeReapiSync()
244
+ self.assertEqual(migrate_tarball(sync, path, None), "z" * 40)
245
+ entry, _, recipe = sync.calls[0]
246
+ self.assertEqual(recipe, text)
247
+ self.assertEqual(entry["action"]["recipeDigest"],
248
+ "sha256:" + hashlib.sha256(text.encode()).hexdigest())
249
+
250
+ def test_migrate_tarball_prefers_the_archived_recipe(self):
251
+ alidist, commit = self._make_alidist()
252
+ text = "package: zlib\nversion: v1.3.1\n---\narchived zlib\n"
253
+ meta = self._meta_with_archived_recipe(text)
254
+ meta["alidist"] = {"commit": commit}
255
+ sync = FakeReapiSync()
256
+ migrate_tarball(sync, self._write_tarball(meta), alidist)
257
+ self.assertIn("archived zlib", sync.calls[0][2])
258
+
259
+ def test_migrate_tarball_distrusts_a_mismatched_archived_recipe(self):
260
+ text = "package: zlib\n---\narchived zlib\n"
261
+ meta = self._meta_with_archived_recipe(text, digest="sha256:" + "0" * 64)
262
+ sync = FakeReapiSync()
263
+ self.assertIsNone(migrate_tarball(sync, self._write_tarball(meta), None))
264
+ self.assertEqual(sync.calls, [])
265
+ # ... and uses the alidist commit instead when there is one.
266
+ alidist, commit = self._make_alidist()
267
+ meta["alidist"] = {"commit": commit}
268
+ migrate_tarball(sync, self._write_tarball(meta), alidist)
269
+ self.assertIn("build zlib", sync.calls[0][2])
270
+
271
+ def test_migrate_tarball_skips_without_recipe_or_commit(self):
272
+ meta = json.loads(json.dumps(META)) # alidist commit None, no recipe
273
+ sync = FakeReapiSync()
274
+ self.assertIsNone(migrate_tarball(sync, self._write_tarball(meta), None))
275
+ self.assertEqual(sync.calls, [])
276
+
229
277
  def test_migrate_tarball_skips_without_meta(self):
230
278
  alidist, _ = self._make_alidist()
231
279
  path = os.path.join(self.tmp, "nometa.tar.gz")
@@ -460,6 +460,16 @@ class TestUtilities(unittest.TestCase):
460
460
  self.assertEqual(resolveFilename({}, "zlib", "alidost"), (None, None))
461
461
  self.assertEqual(resolveFilename({}, "python", "alidist"), ("/bar/python.sh", "/bar"))
462
462
 
463
+ # A recipe pinned in the defaults' overrides is not a file: it is read
464
+ # from the -c repository at that ref, whatever BITS_PATH contains.
465
+ taps = {"root": "dist:ROOT@v6-32-00"}
466
+ with patch.object(os.path, "exists", fake_exists), \
467
+ patch.object(os.path, "abspath", fake_abspath), \
468
+ patch.object(os, "environ", {"BITS_PATH": "/bar:/foo"}):
469
+ self.assertEqual(resolveFilename(taps, "root", "alidist"),
470
+ ("dist:ROOT@v6-32-00", "/fake/alidist"))
471
+ self.assertEqual(resolveFilename(taps, "python", "alidist"), ("/bar/python.sh", "/bar"))
472
+
463
473
 
464
474
  class TestTopologicalSort(unittest.TestCase):
465
475
  """Check that various properties of topological sorting hold."""
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