mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 10:03:49 -06:00
fix: count build file trees as pinned
check_source_paths read the trees profiles pin from source and upstream only, so the two platform trees the record now holds for pin_build files read as orphaned and the record as stale.
This commit is contained in:
1 parent
adcfa283fb
commit
1396350795
2 files changed
+20
No files matched your search
@@ -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")))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user