MCPcopy Index your code
hub / github.com/celer-pkg/celer / matchBuildConfig

Method matchBuildConfig

configs/port.go:470–503  ·  view source on GitHub ↗
(config buildsystems.BuildConfig)

Source from the content-addressed store, hash-verified

468}
469
470func (p Port) matchBuildConfig(config buildsystems.BuildConfig) bool {
471 // Merge SystemNames and SystemName into a single list.
472 var targetSystemNames []string
473 if len(config.SystemNames) > 0 {
474 targetSystemNames = config.SystemNames
475 } else if config.SystemName != "" {
476 targetSystemNames = []string{config.SystemName}
477 }
478
479 // Trim whitespace from system names and processor.
480 targetSystemProcessor := strings.ToLower(strings.TrimSpace(config.SystemProcessor))
481 currentSystemName := strings.ToLower(p.currentSystemName())
482 currentProcessor := strings.ToLower(p.currentSystemProcessor())
483
484 // Compare system processor if specified.
485 if targetSystemProcessor != "" && targetSystemProcessor != currentProcessor {
486 return false
487 }
488
489 // No target system name specified indicates that
490 // system name is not a factor for matching, so consider it a match.
491 if len(targetSystemNames) == 0 {
492 return true
493 } else {
494 // Compare system names if specified.
495 for _, targetSystemName := range targetSystemNames {
496 targetSystemName = strings.ToLower(strings.TrimSpace(targetSystemName))
497 if targetSystemName != "" && targetSystemName == currentSystemName {
498 return true
499 }
500 }
501 return false
502 }
503}
504
505func (p Port) currentSystemName() string {
506 if p.DevDep || p.HostDep {

Callers 1

findMatchedConfigMethod · 0.95

Calls 2

currentSystemNameMethod · 0.95

Tested by

no test coverage detected