Add regenerate-override-patches.sh to automate coupled override-patch regeneration - #299
Open
xyos wants to merge 1 commit into
Open
Add regenerate-override-patches.sh to automate coupled override-patch regeneration#299xyos wants to merge 1 commit into
xyos wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Description of Changes
Adds
scripts/patches/regenerate-override-patches.sh, which automates regenerating@generatedoverride patches and healing the rest of the quilt series.Background: patches generated by
scripts/patches/apply-override.shrewrite shared blocks inpackage.json(for example the rootoverridesobject). Changing the version in one such patch invalidates the diff context of every later@generatedpatch in the series, which today means a slow manual conflict-resolution loop withquilt push -f/ edit /quilt refreshper patch.The new script makes this a single command:
Behavior:
@generatedpatch. The script re-reads theapply-override.shcommand stored in the patch's@generatormetadata line and re-executes it (the free-text header is extracted from the patch and re-passed via--header).--set 'PACKAGE=VERSION'(repeatable) rewrites the version for that package in the named patches'@generatorspecs and header text before regenerating, so a version bump needs no manual edits.prepare-src.sh --command rebase_patches <target>. If the rebase stops on a conflicted patch that is itself@generated, the script force-pops it, empties the stale patch file, and regenerates it deterministically from its own@generatorline, then rebases again (capped at 25 iterations). If the conflicted patch is not@generated, it stops and prints the manualquilt refreshinstructions.--target <t>selects the series to rebase (defaultcode-editor-sagemaker-server);--dry-runprints every command it would run without executing.Also updates
apply-override.shto honor a pre-setQUILT_SERIESinstead of always picking the first*.seriesfile found, so the target's series is respected (falls back to the old behavior when unset).Testing
All runs inside the
code-editor-ubuntucontainer against a full checkout:--dry-run --set 'undici=^7.29.0' --set 'ip-address=^10.3.1' common/finding-override-undici.diff common/finding-override-ip-address.diff): exits 0 and prints the exactapply-override.sh/prepare-src.shcommands it would execute.--dry-run): exits 0,git diffon the two named patches is empty, and a strict./scripts/prepare-src.sh code-editor-sagemaker-serverpasses afterwards.--set 'undici=^7.30.0' common/finding-override-undici.diff): the bump broke the context offinding-override-form-data.diffand thenfinding-override-tar.diff; both were regenerated automatically from their own@generatorlines, the loop converged in 4 rebase iterations, exit 0, and strictprepare-src.shpasses with^7.30.0present in the header,@generator,@override-package, and all hunks of the undici patch.--target, non-@generatedpatch, and missing patch arguments all fail fast with clear messages.Screenshots/Videos
Additional Notes
The rebase loop reuses
prepare-src.sh --command rebase_patches, which refreshes each patch as it re-applies. On a tree with mixed diff-header styles this can normalize the headers of a few untouched patches on the first run; the result is deterministic and stable on subsequent runs.Backporting
Not needed; developer tooling only.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.