fix(ebuild): condition-aware inherit extraction and mvdan/sh compat fixes#74
Closed
kolkov wants to merge 1 commit into
Closed
fix(ebuild): condition-aware inherit extraction and mvdan/sh compat fixes#74kolkov wants to merge 1 commit into
kolkov wants to merge 1 commit into
Conversation
…ixes
Replace unconditional AST walker in script.go with condition-aware
walkIfClause that statically evaluates simple [[ ${PV} == X ]]
conditions. This prevents loading eclasses from dead branches
(e.g., git-r3 for non-live ebuilds like make-4.4.1).
Also integrates local mvdan/sh fixes via go.mod replace directive:
- ${var@a}, ${var@A}, ${var@P} param expansions
- Unset array [@] fix, type -P, read -a, declare -f/-p
- !(pattern) extglob negation
- formatInto OOB panic fix for $'\0' dollar-quoting
All three previously-failing packages now build:
findutils, sed, make (dev-build/make-4.4.1-r102).
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.
Summary
script.go: replaces flatsyntax.Walkwith a recursive AST walker that evaluates[[ ${PV} == literal ]]conditions statically, skipping eclasses behind false conditions (e.g.,git-r3for make-4.4.1 where PV != 9999)go.mod replace: integrates 8 bash-compat fixes from localfeat/bash-compat-gentoobranch (array slicing,type -P, arithmetic operators, printf escapes, formatInto OOB panic, etc.)Changes
internal/ebuild/script.go(core)ParseEbuildScript(path, vars)/ParseEbuildScriptFromString(content, vars)— newvarsparameterwalkStmts,walkNode,walkIfClause,walkCallExprevalCondition— statically evaluates[[ ${VAR} == literal ]]and glob patternspvFromPath— extracts PV from ebuild filename for auto-detectioninternal/ebuild/executor.goParseEbuildScriptgo.modreplace mvdan.cc/sh/v3 => ../reference/mvdan-shfor local patched versionTests
ParseEbuildScriptcallers in testsVerified
Test plan
go test -v -race ./internal/ebuild/...— all passgolangci-lint run— 0 issuesgrpm emerge -k sys-apps/findutils— builds OKgrpm emerge -k sys-apps/sed— builds OKgrpm emerge -k dev-build/make— builds OK (no git-r3 panic)