Something went wrong. Try again.
Maps Linux distribution source packages to their upstream repositories, and through them to each other
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859package bulk
import ( "sort"
"tangled.org/odd.computer/isomorph/internal/distro/opensuse" "tangled.org/odd.computer/isomorph/internal/model")
// FromOpenSUSE builds one row per source package of Tumbleweed's src-oss repository. bins (the// oss repository) supplies binary names through each binary's source RPM; giturls (package ->// git URLs, rb.zq1.de) corroborates the spec's Url:.func FromOpenSUSE(srcs, bins []opensuse.RPM, giturls map[string][]string, files map[string]*opensuse.OBSFiles) []Package { binaries := map[string][]string{} for _, b := range bins { if b.Arch == "src" || b.Arch == "nosrc" || b.SourceRPM == "" { continue } if n := opensuse.SourceName(b.SourceRPM); n != "" { binaries[n] = append(binaries[n], b.Name) } } seen := map[string]bool{} var out []Package for _, s := range srcs { if (s.Arch != "src" && s.Arch != "nosrc") || seen[s.Name] { continue } seen[s.Name] = true bs := dedupe(binaries[s.Name]) p := Package{ Distro: model.OpenSUSE, Suite: "tumbleweed", Name: s.Name, Version: s.Version, OSVEcosystem: "openSUSE:Tumbleweed", PURL: "pkg:rpm/opensuse/" + s.Name + "?arch=src", Binaries: bs, Homepage: s.URL, Status: StatusUnresolved, } fill(&p, opensuse.Candidates(s.URL, giturls[s.Name], files[s.Name])) out = append(out, p) } sort.Slice(out, func(i, j int) bool { return out[i].Name < out[j].Name }) return out}
func dedupe(s []string) []string { sort.Strings(s) var out []string for i, v := range s { if i == 0 || v != s[i-1] { out = append(out, v) } } return out}