From d0de6dde304b7688b581c41a6fda7eca2c35decb Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 27 Oct 2026 05:24:04 +0100 Subject: [PATCH] fix: rebuild source paths from the written pins load_emulator_profiles caches by directory, and the run had loaded the profiles before writing them, so the record rebuilt after a write kept the pins just replaced: linapple, then ten profiles in one advance. The cache is cleared first. The record is rebuilt for those ten. --- scripts/profile_sync.py | 5 +++++ tests/test_profile_sync.py | 25 +++++++++++++++++++++++++ website/src/data/source-paths.json | 20 ++++++++++---------- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/scripts/profile_sync.py b/scripts/profile_sync.py index 31b64c6e6..2cf73fdbf 100644 --- a/scripts/profile_sync.py +++ b/scripts/profile_sync.py @@ -4881,9 +4881,14 @@ def _refresh_source_paths(args: argparse.Namespace) -> None: """ if not _WRITTEN or args.dry_run or args.offline or os.environ.get("RETROBIOS_OFFLINE"): return + import common # noqa: PLC0415 import sitesources # noqa: PLC0415 from common import write_if_changed # noqa: PLC0415 + # The run loaded the profiles before writing them, and the loader caches + # by directory: read again, the record described the pins just replaced + # (linapple, then ten profiles in one advance). + common._emulator_profiles_cache.clear() profiles = load_emulator_profiles(args.emulators_dir, skip_aliases=False) held, unread = sitesources.build_source_paths( profiles, [sitesources.TREE_CACHE], fetch=True diff --git a/tests/test_profile_sync.py b/tests/test_profile_sync.py index 0882de60f..140e6df6e 100644 --- a/tests/test_profile_sync.py +++ b/tests/test_profile_sync.py @@ -4780,6 +4780,31 @@ class AWriteRefreshesTheSourcePaths(unittest.TestCase): profile_sync._WRITTEN.clear() + def test_the_record_reads_the_pins_just_written(self): + # The loader caches by directory and the run had loaded the profiles + # before writing them: the record kept the pins it had replaced. + from unittest import mock # noqa: PLC0415 + + import common # noqa: PLC0415 + import sitesources # noqa: PLC0415 + + with tempfile.TemporaryDirectory() as tmp: + profile = Path(tmp) / "p.yml" + profile.write_text('emulator: P\nsource_commit: "old"\n', encoding="utf-8") + common._emulator_profiles_cache.clear() + self.addCleanup(common._emulator_profiles_cache.clear) + common.load_emulator_profiles(tmp, skip_aliases=False) + profile.write_text('emulator: P\nsource_commit: "new"\n', encoding="utf-8") + with mock.patch.object(sitesources, "build_source_paths", return_value=({}, [])) as built, \ + mock.patch.dict(os.environ, {"RETROBIOS_OFFLINE": ""}), \ + mock.patch("common.write_if_changed"), \ + contextlib.redirect_stderr(io.StringIO()), \ + contextlib.redirect_stdout(io.StringIO()): + profile_sync._WRITTEN.add("p") + self.addCleanup(profile_sync._WRITTEN.clear) + profile_sync._refresh_source_paths(self._args(emulators_dir=tmp)) + self.assertEqual(built.call_args[0][0]["p"]["source_commit"], "new") + class AnUnreadTreeKeepsItsRecord(unittest.TestCase): """sitesources --fetch, rate-limited by GitLab, dropped about twenty trees it never read from source-paths.json.""" diff --git a/website/src/data/source-paths.json b/website/src/data/source-paths.json index 2bb3ed75d..7590b7195 100644 --- a/website/src/data/source-paths.json +++ b/website/src/data/source-paths.json @@ -85,7 +85,7 @@ "Makefile", "libretro-radio.c" ], - "git.libretro.com/libretro/rust-dos@b53562f080b667c0fcbb2f54bab7be549cce46b9": [ + "git.libretro.com/libretro/rust-dos@152d9bca7820f0d9a5d1ca820a2d20855698a211": [ "crates/gus/build.rs", "crates/gus/src/builtin.rs", "crates/mt32/src/lib.rs", @@ -180,7 +180,7 @@ "psx/dev/exp1.h", "psx/psx.c" ], - "github.com/ARMSX2/ARMSX2@c7517b9b3de811a92985c76a134b83c7368d0d4b": [ + "github.com/ARMSX2/ARMSX2@7f9144189c74edcf5a7ab3ba2aa2247635d24047": [ ".github/workflows/build-all.yml", ".github/workflows/linux_build_qt.yml", "README.md", @@ -1160,7 +1160,7 @@ "Source/Core/DiscIO/NANDImporter.cpp", "Source/Core/DolphinQt/MenuBar.cpp" ], - "github.com/RPCS3/rpcs3@f4d4c1b4712ae6c6fe8c80ff8eaa4036f80f26fc": [ + "github.com/RPCS3/rpcs3@c365ea76a552961ff078ea1a46da9d4b07729674": [ "rpcs3/Crypto/key_vault.h", "rpcs3/Emu/Cell/Modules/cellFont.cpp", "rpcs3/Emu/Cell/Modules/cellSsl.cpp", @@ -1611,7 +1611,7 @@ "src/dbvz.c", "src/emulator.c" ], - "github.com/SquirrelJME/SquirrelJME@4fd08e91275994e1181bcbe8744bee9322c5daec": [ + "github.com/SquirrelJME/SquirrelJME@24d0e97d4297d0bce26a9651f5bce5d326ea690a": [ "nanocoat/src/boot.c" ], "github.com/StillJC/ArcadeDuck@80cdb6da6b51d687192a6346efe4499b10fe4faf": [ @@ -1755,7 +1755,7 @@ "src/general.c", "src/palette.c" ], - "github.com/TomHarte/CLK@ab20398aa990ecf2fb24034b7e11b55f0a6b60c7": [ + "github.com/TomHarte/CLK@9020107b563b68595ffdb6ef18aacdec85c78d69": [ "Analyser/Static/Commodore/StaticAnalyser.cpp", "Analyser/Static/Commodore/Target.hpp", "Analyser/Static/MSX/StaticAnalyser.cpp", @@ -2840,7 +2840,7 @@ "github.com/digarok/gsplus@41e71031debbde98e66ea5c5c67498e9b4726a6d": [ "gsplus/src/config.c" ], - "github.com/dividebysandwich/rust-dos@e1a01b94f6f229082a7555380b5193c78104bb6f": [ + "github.com/dividebysandwich/rust-dos@152d9bca7820f0d9a5d1ca820a2d20855698a211": [ "crates/gus/build.rs", "crates/gus/src/builtin.rs", "crates/mt32/src/lib.rs", @@ -3717,7 +3717,7 @@ "ForWindows/MainForm.cpp", "Portable/LynxEmulatorGuest.cpp" ], - "github.com/joncampbell123/dosbox-x@5a0a023a0d9f741a48faac897b8633b3c1c8e749": [ + "github.com/joncampbell123/dosbox-x@997f616e0886a835fc3660f2b935688f17f20d42": [ "configure.ac", "contrib/windows/installer/DOSBox-X-installer.iss", "src/Makefile.am", @@ -6065,7 +6065,7 @@ "core/nullDC.cpp", "core/reios/reios.cpp" ], - "github.com/libretro/parallel-n64@bc7ba1d175890638e995e3e8ca6dcf385b3041b6": [ + "github.com/libretro/parallel-n64@f87550d9ad70cb320870e2b5fd960235287abb89": [ "libretro/libretro.c", "mupen64plus-core/src/device/pif/bootrom_hle.c" ], @@ -6099,7 +6099,7 @@ "core/Database.c", "core/libretro.c" ], - "github.com/libretro/px68k-libretro@a935187697c7aa29064959e67b5fe0dbb0ba5021": [ + "github.com/libretro/px68k-libretro@5510637a4c0a08ac0302087ea498093dcc3e9d17": [ "libretro.c" ], "github.com/libretro/quasi88-libretro@7884be5277776a5d8c4fdc4e574e9b5b589945c9": [ @@ -8877,7 +8877,7 @@ "win/src/main/emulator/EmulatorPlatform.java", "x64/src/main/emulator/EmulatorPlatform.java" ], - "github.com/shinyquagsire23/OpenJKDF2@e4f7c0a2b10ab8ed8b89a6c90c61153604ae2e39": [ + "github.com/shinyquagsire23/OpenJKDF2@798f930402525a23b94671d85b97b00390342fa0": [ "src/Dw/dwInits.cpp", "src/Main/InstallHelper.c", "src/Main/Main.c",