MCPcopy Create free account
hub / github.com/celer-pkg/celer / fixBuild

Method fixBuild

buildsystems/buildconfig_hooks.go:189–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189func (b BuildConfig) fixBuild() error {
190 for _, script := range b.FixBuild {
191 script = strings.TrimSpace(script)
192 if script == "" {
193 continue
194 }
195
196 title := fmt.Sprintf("[fix build %s]", b.PortConfig.nameVersion())
197 script = b.expandVariables(script)
198 if err := checkUnexpandedVariables(script, title); err != nil {
199 return err
200 }
201 executor := cmd.NewExecutor(title, script)
202 executor.SetWorkDir(b.PortConfig.RepoDir)
203 executor.MSYS2Env(runtime.GOOS == "windows")
204 if err := executor.Execute(); err != nil {
205 return err
206 }
207 }
208
209 return nil
210}
211
212// checkUnexpandedVariables checks if there are any unexpanded variables in the script.
213// It looks for patterns like ${VAR_NAME} or $VAR_NAME that weren't expanded.

Callers

nothing calls this directly

Calls 8

expandVariablesMethod · 0.95
NewExecutorFunction · 0.92
checkUnexpandedVariablesFunction · 0.85
SprintfMethod · 0.80
nameVersionMethod · 0.80
SetWorkDirMethod · 0.80
MSYS2EnvMethod · 0.80
ExecuteMethod · 0.80

Tested by

no test coverage detected