diff --git a/scripts/profile_sync.py b/scripts/profile_sync.py index 338efbd6..97823280 100644 --- a/scripts/profile_sync.py +++ b/scripts/profile_sync.py @@ -2927,6 +2927,16 @@ def bump_commit( if pending_recale(report, accept_changed, text): return False document = yaml.safe_load(text) + if document.get("built_by"): + # The pin is the commit a platform builds (recalbox gsplus.mk, the + # mame0258 its package fetches), not a point on a moving branch: + # HEAD is a build nobody ships under this name. + print( + f"{path.stem}: pinned to the build {', '.join(document['built_by'])} " + "ships, advanced by hand", + file=sys.stderr, + ) + return False if any(isinstance(document.get(f), dict) for f in ("source_commit", "upstream_commit")): # A pin per build mode names one revision per repository, and the # report heads only the primary one: rewriting str(dict) was a diff --git a/tests/test_profile_sync.py b/tests/test_profile_sync.py index f16e5f9f..e98e8a0d 100644 --- a/tests/test_profile_sync.py +++ b/tests/test_profile_sync.py @@ -2999,6 +2999,24 @@ class TestBumpCommit(unittest.TestCase): self.assertEqual(profile_sync.pending_recale(report), 0) self.assertTrue(bump_commit(self.path, report)) + def test_refused_on_a_build_a_platform_compiles(self): + # mame0258 documents the MAME Recalbox builds: libretro/mame HEAD + # is a later release, and every ref still anchors there. + self.path.write_text(SAMPLE + "built_by: [recalbox]\n", encoding="utf-8") + part = PartResult( + RefPart("a.c", 10, 12, "a.c:10-12"), "ANCHORED", None, 10, 12, [] + ) + report = ProfileReport( + name="p", repo="o/n", pin="pin", head="newhead", + entries=[ + EntryReport("a.bin", "a.c:10-12, (just a note)", "ANCHORED", [part]) + ], + counts={"ANCHORED": 1}, + ) + with contextlib.redirect_stderr(io.StringIO()): + self.assertFalse(bump_commit(self.path, report)) + self.assertNotIn("newhead", self.path.read_text()) + def test_refused_when_no_ref_reads_the_pinned_repository(self): """gam4980: every bare libretro.c ref anchored in upstream, and the bump wrote the fork's HEAD over refs that never described it."""