Skip to content

Commit

Permalink
repology: use srcname for matching with gentoo atoms
Browse files Browse the repository at this point in the history
This is more correct as srcname for Gentoo in repology is derived from
atom, while visiblename can be arbitrary string which identifies a
package.

Closes: #32
Signed-off-by: Arthur Zamarin <[email protected]>
  • Loading branch information
AMDmi3 authored and arthurzam committed Oct 24, 2024
1 parent 7dd6433 commit ef0a0c6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/portage/repology/outdated.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
type Package struct {
Repo string `json:"repo"`
Name string `json:"name"`
VisibleName string `json:"visiblename"`
SrcName string `json:"srcname"`
Version string `json:"version"`
Status string `json:"status"`
}
Expand Down Expand Up @@ -128,29 +128,29 @@ func (o *outdatedCheck) getOutdatedStartingWith(letter rune) {
gentooPackages := make(map[string]struct{})
for _, v := range repoPackages[packagename] {
if v.Repo == "gentoo" {
gentooPackages[v.VisibleName] = struct{}{}
gentooPackages[v.SrcName] = struct{}{}
}
}
mainLoop:
for _, v := range repoPackages[packagename] {
category, _, _ := strings.Cut(v.VisibleName, "/")
category, _, _ := strings.Cut(v.SrcName, "/")
if v.Repo == "gentoo" {
if v.Status == "newest" {
outdated[v.VisibleName] = false
outdated[v.SrcName] = false
} else if v.Status == "outdated" {
if contains(o.blockedCategories, category) || o.atomRules[v.VisibleName].isIgnored(v.Version, v.Repo) {
if contains(o.blockedCategories, category) || o.atomRules[v.SrcName].isIgnored(v.Version, v.Repo) {
continue
}
if _, found := outdated[v.VisibleName]; !found {
outdated[v.VisibleName] = true
if _, found := outdated[v.SrcName]; !found {
outdated[v.SrcName] = true
}
if latest, found := currentVersion[v.VisibleName]; found {
if latest, found := currentVersion[v.SrcName]; found {
current := models.Version{Version: v.Version}
if current.GreaterThan(models.Version{Version: latest}) {
currentVersion[v.VisibleName] = v.Version
currentVersion[v.SrcName] = v.Version
}
} else {
currentVersion[v.VisibleName] = v.Version
currentVersion[v.SrcName] = v.Version
}
}
} else if len(newestVersion) == 0 && v.Status == "newest" && !contains(o.blockedRepos, v.Repo) {
Expand Down

0 comments on commit ef0a0c6

Please sign in to comment.