From 62df2017e3b1edd786a4c737bd4ccba2b4581d88 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 28 Apr 2023 15:32:19 +0200 Subject: dashboard: allow duplicate tree origin labels It's okay if several kernel repos specify the same labels. Only check that a single label is not used for different things. --- dashboard/app/config.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 3e26c9464..ed258569a 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -483,8 +483,8 @@ func checkKernelRepos(ns string, config *Config, repos []KernelRepo) { if len(repos) == 0 { panic(fmt.Sprintf("no repos in namespace %q", ns)) } + introduced, reached := map[string]bool{}, map[string]bool{} aliasMap := map[string]bool{} - labelMap := map[string]bool{} canBeLabels := false for _, repo := range repos { if !vcs.CheckRepoAddress(repo.URL) { @@ -504,18 +504,21 @@ func checkKernelRepos(ns string, config *Config, repos []KernelRepo) { panic(fmt.Sprintf("%v: bad kernel repo reporting priority %v for %q", ns, prio, repo.Alias)) } checkCC(&repo.CC) - for _, label := range []string{repo.LabelIntroduced, repo.LabelReached} { - if label == "" { - continue + if repo.LabelIntroduced != "" { + introduced[repo.LabelIntroduced] = true + if reached[repo.LabelIntroduced] { + panic(fmt.Sprintf("%v: label %s is used for both introduced and reached", ns, repo.LabelIntroduced)) } - if labelMap[label] { - panic(fmt.Sprintf("%v: duplicate label %q", ns, label)) + } + if repo.LabelReached != "" { + reached[repo.LabelReached] = true + if introduced[repo.LabelReached] { + panic(fmt.Sprintf("%v: label %s is used for both introduced and reached", ns, repo.LabelReached)) } - labelMap[label] = true } canBeLabels = canBeLabels || repo.DetectMissingBackports } - if len(labelMap) > 0 { + if len(introduced)+len(reached) > 0 { canBeLabels = true } if canBeLabels && !config.FindBugOriginTrees { -- cgit mrf-deployment