session reversion: rewrite all version operators unconditionally (match bash) - #13
Merged
Merged
Conversation
…ch bash) Fixes #12. deb-session-reversion.sh (whose mina callers invoke it with no flag) rewrites the old version to the new one across every versioned dependency constraint on every reversion. deb-toolkit did this only under --update-deps, and even then only for exact `=` pins, leaving `>=`/`<<`/etc. alone on the theory that a looser constraint is still satisfied by a higher version. That theory fails for mina: reversions are not monotonic (manager.sh reversions to an arbitrary target, e.g. a fork build 3.4.0-rc2-company -<hash> down to a clean 3.4.0-rc2). On a downward reversion a stale `(>= old)` is unsatisfiable and the package will not install. Changes: - replace_in_constraint rewrites all Debian relation operators (=, <<, <=, >=, >>), matching the operator as a prefix so both `(<< X)` and `(=X)` — mina emits both — are handled. - reversion performs the dependency rewrite unconditionally; the --update-deps CLI flag and update_deps manifest field are kept, accepted, and ignored (deprecated) so existing callers/manifests keep working. The flag now warns. - rewrite stays constraint-scoped (inside `(...)`), so a version-like substring in a package name is never mangled — an improvement over the bash bare-substring pass. Verified against the bash scripts on a realistic downward reversion with mixed `(=X)`/`(<< X)` formats: control fields are now identical.
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.
Fixes #12.
Problem
deb-session-reversion.sh— which mina's callers (reversion.sh,manager.sh) invoke with no flag — rewrites the old version to the new one across every versioned dependency constraint on every reversion.deb-toolkit session reversiondid this only under--update-deps, and even then only for exact=pins, leaving>=/<</etc. alone on the theory that a looser constraint is still satisfied by a higher version.That theory breaks for mina: reversions are not monotonic.
manager.shreversions from$__source_versionto an arbitrary$__target_version— e.g. a fork build3.4.0-rc2-company-<hash>down to a clean3.4.0-rc2. On a downward reversion a left-alone(>= old)is unsatisfiable and the package won't install.Changes
replace_in_constraintrewrites all Debian relation operators (=,<<,<=,>=,>>), matching the operator as a prefix rather than splitting on whitespace — so both(<< X)(spaced) and(=X)(no space) are handled. mina emits both forms.--update-depsCLI flag and theupdate_depsmanifest field are kept, accepted, and ignored (deprecated), so existing callers and manifests keep parsing/working; the flag emits a deprecation warning. bash has no "version-only" reversion mode, so matching bash means always rewriting.(...)), so a version-like substring in a package name is never mangled — an improvement over the bash bare-substring pass, and identical output on mina's real (parenthesized-constraint) inputs.Verification
Against the bash scripts, realistic downward reversion
3.4.0-rc2-company-abc123 → 3.4.0-rc2, mixed(=X)/(<< X), no flag:Control fields identical. (Before this change, deb-toolkit left every one of those deps at the old version — even with
--update-deps.)(=X)).session_roundtripintegration test, which previously asserted>=should be left alone — that assertion encoded the bug.cargo test --all-targets(52 unit + integration),fmt,clippy -D warnings.Not in scope
The secondary
savedivergence noted in #12 — deb-toolkit drops the leading./and root entry in data.tar vsdpkg-deb --build— is untouched here; that's asaveconcern, not reversion. #12 tracks it.