diff --git a/scripts/check_freshness.py b/scripts/check_freshness.py index b8e03f28b..075c45641 100644 --- a/scripts/check_freshness.py +++ b/scripts/check_freshness.py @@ -1492,6 +1492,11 @@ def check_source_paths(profiles: dict) -> Finding: sitesources.tree_key(repo, pin) for profile in profiles.values() if sitesources.cited_paths(profile) for repo, pin in sitesources.profile_trees(profile) + } | { + # The platform build files pin_build names, linked from a page too. + sitesources.tree_key(repo, pin) + for profile in profiles.values() + for repo, pin, _path in sitesources.build_files(profile) } try: recorded = set(json.loads(sitesources.SOURCE_PATHS.read_text(encoding="utf-8"))) diff --git a/tests/test_site_integration.py b/tests/test_site_integration.py index 91a3dad0d..a3371662a 100644 --- a/tests/test_site_integration.py +++ b/tests/test_site_integration.py @@ -117,6 +117,21 @@ class SourcePathsFreshness(unittest.TestCase): finding = check_freshness.check_source_paths(profiles) self.assertEqual(finding.status, check_freshness.OK, finding.detail) + def test_a_recorded_build_file_tree_is_pinned(self): + """The record holds the platform trees pin_build reads at a commit, + and the check called them orphaned.""" + import sitesources # noqa: PLC0415 + + pin = "a" * 40 + profile = {"pin_build": [{"repo": "https://github.com/o/r", "revision": pin, + "path": "p.mk"}]} + with tempfile.TemporaryDirectory() as tmp: + path = Path(tmp) / "source-paths.json" + path.write_text(json.dumps({f"github.com/o/r@{pin}": ["p.mk"]}), encoding="utf-8") + with mock.patch.object(sitesources, "SOURCE_PATHS", path): + finding = check_freshness.check_source_paths({"p": profile}) + self.assertEqual(finding.status, check_freshness.OK, finding.detail) + def test_a_moved_pin_is_stale(self): profile = _profile("geolith") moved = dict(profile, source_commit="f" * 40, upstream_commit="e" * 40)