Skip to content

build_ipa.sh: the DMCommit and DMChain stamps overwrite an existing entry - #1582

Closed
oliverames wants to merge 2 commits into
seedds:mainfrom
oliverames:pr-stamp-existing
Closed

oliverames wants to merge 2 commits into
seedds:mainfrom
oliverames:pr-stamp-existing

Conversation

@oliverames

@oliverames oliverames commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The prepare's build stamps stopped one class of prepared projects with Add: :DMCommit Entry Already Exists and [RED] build_ipa.sh exit code 1. A front end or a fork copy of dm/ios can declare DMCommit (and DMChain) in its project.yml Info values (PR #1383's snapshot does, with its own dev stamp); xcodegen then writes the key into Gen/Info.plist before the stamp step, and PlistBuddy's Add refuses an existing entry, so the prepare died at the last step of an otherwise complete run (34 minutes of shaders and a pipeline archive already done). The fix makes both stamps fall back to Set: the built commit and the carried chain win in the plist, which is also the more truthful source identity for an app that had someone else's in.

Gen/Info.plist is regenerated at every prepare, so the replaced value does not outlive the build, and a project that carries no such key behaves exactly as before. No other stamp path changed.

Docs changed: none (the option page's environment switches don't describe these keys).

Checked

  • Tests: bash -n dm/ios/tools/build_ipa.sh passes. No other test is stated.
  • Games run, with title ID and version: Mario Kart World, title ID 0400C3F00006E000 (from the folder name), version not stated. The folder that failed before (#1383 snapshot on the Duo, /Users/oliverames/.../Mario Kart World/0400C3F00006E000_build/logs/prepare_xcode.log) now completes with the same project output; the app's log opens with source: <built commit>, shader chain 96064c74793c and plays the game.
  • Devices and OS: the Duo; model and OS version not stated
  • scripts/regress.py check --games: not stated

Front ends

None: no front end has to act on this.

Docs

  • The finding is in its game note or its docs/reference/<subsystem>.md entry, and python3 dm/tools/docs_symptoms.py was run (the symptom index). Not applicable: a build-script fix with no game note or reference entry
  • A chain tool changed: dmsh_chain.py --header was run and dm/gfx/nvn/dmsh_chain.h is part of the change. Not applicable: no chain tool changed
  • No game files, keys or data extracted from a game in the change or the attachments

@github-actions github-actions Bot added packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers ios The iPhone and iPad app (dm/ios) labels Nov 6, 2026
@oliverames
oliverames force-pushed the pr-stamp-existing branch 2 times, most recently from 027a2bd to fa81e8f Compare November 10, 2026 03:13
…ntry, so a project.yml that carries one prepares the app

A project source a front end or a fork copy keeps can carry DMCommit in its Info.plist values; xcodegen writes it into Gen/Info.plist at the generate step, and the prepare then stopped at the stamp: "Add: :DMCommit Entry Already Exists", "[RED] build_ipa.sh exit code 1" (the Mario Kart World seedds#1383 snapshot on the Duo, 2026-11-06, its prepare_xcode.log). The built commit belongs in the stamp, so it now falls back to Set: the same prepare succeeds and the app logs the real source and chain. Gen/Info.plist is regenerated at every prepare, so the replaced value does not outlive the build.

Checked: bash -n passes; the Mario Kart World prepare that failed before now stamps both keys and finishes with the same Xcode project output ('source: <built commit>' in its prepare_xcode.log).
seedds added a commit that referenced this pull request Nov 26, 2026
Use plutil -replace instead of PlistBuddy Add when stamping DMCommit, DMChain, and MetalCaptureEnabled into Gen/Info.plist so a project.yml that already defines any of those keys does not abort build_ipa.sh (PR #1582). Unlike PlistBuddy Add || Set, plutil -replace inserts or overwrites in one command, updates mismatched value types, and emits no stderr noise.

Add a focused unit test in dm/ios/tests/test_xcode_workflow.py covering absent, pre-existing, wrong-typed, dirty, and non-NVN/non-capture cases.

Co-authored-by: Oliver Ames <7366664+oliverames@users.noreply.github.com>
@seedds

seedds commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks @oliverames for finding and reporting this!

Landed on main in bfa8c07 (co-authored with you). Instead of PlistBuddy Add || Set, build_ipa.sh now uses plutil -replace for DMCommit, DMChain, and MetalCaptureEnabled, which inserts or overwrites in a single command without stderr noise and also handles pre-existing entries whose plist type differs (for example, an all-digit hash parsed as an integer in YAML).

Checked with bash -n, ruff, a new unit test in dm/ios/tests/test_xcode_workflow.py covering absent, pre-existing, and wrong-typed entries, and the iOS packaging test suite. Nothing left open.

@seedds seedds closed this Nov 26, 2026
@oliverames
oliverames deleted the pr-stamp-existing branch November 28, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ios The iPhone and iPad app (dm/ios) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants