Skip to content

Commit 1de1172

Browse files
committed
compat.py: a measured copy resolves compat from this checkout
A copy of a member is not a member of the workspace and did not inherit its [indices], so compat resolved from the published index and a descriptor changed in a pull request was not the one measured (the archive member measured libarchive's published descriptor). The copy now names this checkout when the member declares no [indices] of its own.
1 parent 333d5bb commit 1de1172

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎tests/openkal/compat.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def prepare(member: str, pins: dict) -> str:
121121
text, count=1, flags=re.M)
122122
else:
123123
text = text.rstrip("\n") + "\n\n[dependencies]\n" + runtime
124+
# A copy is not a member of this workspace and does not inherit its
125+
# `[indices]`; without this line `compat` would resolve from the published
126+
# index and a changed descriptor in this checkout would not be measured.
127+
if not re.search(r"^\[indices\]\s*$", text, re.M):
128+
text += f'\n[indices]\ncompat = {{ path = {json.dumps(ROOT)} }}\n'
124129
for triple, runner in (pins.get("runners") or {}).items():
125130
if f"[target.{triple}]" not in text and f"[target.'{triple}']" not in text:
126131
text += f"\n[target.{triple}]\nrunner = {json.dumps(runner)}\n"

0 commit comments

Comments
 (0)