fix: leave platform-built pins to a reader

bump_commit advanced any profile whose refs all anchored at HEAD. On a
built_by profile the pin is the commit a platform compiles (mame0258,
mame0278, gsplus-legacy at recalbox gsplus.mk:8-9), so HEAD is a build
nobody ships under that name. The bump now refuses those profiles.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 15:35:51 +02:00
1 parent 54b2d31fa3
commit 18fc5ce53f
2 files changed
+28

No files matched your search

+10
View File
@@ -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
+18
View File
@@ -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."""