diff --git a/.golangci.yml b/.golangci.yml index 1c8c638d9..3bdce91d3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -48,7 +48,6 @@ linters: disable-all: true enable: - bodyclose - - depguard - dogsled - dupl - errorlint diff --git a/go.mod b/go.mod index 6c1f800a8..561c9d93a 100644 --- a/go.mod +++ b/go.mod @@ -2,16 +2,16 @@ module github.com/Jguer/yay/v12 require ( github.com/Jguer/aur v1.2.3 - github.com/Jguer/go-alpm/v2 v2.2.0 + github.com/Jguer/go-alpm/v2 v2.2.1 github.com/Jguer/votar v1.0.0 github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5 github.com/Morganamilo/go-srcinfo v1.0.0 github.com/bradleyjkemp/cupaloy v2.3.0+incompatible github.com/leonelquinteros/gotext v1.5.2 - github.com/stretchr/testify v1.8.3 - golang.org/x/sys v0.9.0 - golang.org/x/term v0.9.0 - golang.org/x/text v0.10.0 // indirect + github.com/stretchr/testify v1.8.4 + golang.org/x/sys v0.10.0 + golang.org/x/term v0.10.0 + golang.org/x/text v0.11.0 // indirect gopkg.in/h2non/gock.v1 v1.1.2 ) @@ -28,7 +28,7 @@ require ( github.com/deckarep/golang-set/v2 v2.3.0 github.com/itchyny/gojq v0.12.13 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect - github.com/ohler55/ojg v1.18.7 // indirect + github.com/ohler55/ojg v1.19.1 // indirect ) require github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index b9d6d2dfe..12767ea14 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/Jguer/aur v1.2.3 h1:D+OGgLxnAnZnw88DsRvnRQsn0Poxsy9ng7pBcsA0krM= github.com/Jguer/aur v1.2.3/go.mod h1:Dahvb6L1yr0rR7svyYSDwaRJoQMeyvJblwJ3QH/7CUs= -github.com/Jguer/go-alpm/v2 v2.2.0 h1:+sh4UEZwTpcAO+vHdySsnLZSnLZIBun8j85BbPExSlg= -github.com/Jguer/go-alpm/v2 v2.2.0/go.mod h1:uLQcTMNM904dRiGU+/JDtDdd7Nd8mVbEVaHjhmziT7w= +github.com/Jguer/go-alpm/v2 v2.2.1 h1:PMIRKo2lY0wfhN8W8Scc5v82zQeDsTv702CuDiz81sA= +github.com/Jguer/go-alpm/v2 v2.2.1/go.mod h1:lfe8gSe83F/KERaQvEfrSqQ4n+8bES+ZIyKWR/gm3MI= github.com/Jguer/votar v1.0.0 h1:drPYpV5Py5BeAQS8xezmT6uCEfLzotNjLf5yfmlHKTg= github.com/Jguer/votar v1.0.0/go.mod h1:rc6vgVlTqNjI4nAnPbDTbdxw/N7kXkbB8BcUDjeFbYQ= github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5 h1:TMscPjkb1ThXN32LuFY5bEYIcXZx3YlwzhS1GxNpn/c= @@ -36,8 +36,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/ohler55/ojg v1.18.7 h1:sC7zy0usEiWa6bvx3NU1yZH4kCA2F3Qzs6iiDX4+xdk= -github.com/ohler55/ojg v1.18.7/go.mod h1:uHcD1ErbErC27Zhb5Df2jUjbseLLcmOCo6oxSr3jZxo= +github.com/ohler55/ojg v1.19.1 h1:ruSyx+OGrE2HvJgUvtDWiqHJFfMs6e7IM0yZhcrs3NU= +github.com/ohler55/ojg v1.19.1/go.mod h1:uHcD1ErbErC27Zhb5Df2jUjbseLLcmOCo6oxSr3jZxo= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -48,8 +48,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -64,18 +64,18 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/pkg/db/executor.go b/pkg/db/executor.go index d02defe9d..a77d17f71 100644 --- a/pkg/db/executor.go +++ b/pkg/db/executor.go @@ -52,12 +52,14 @@ type Executor interface { PackageOptionalDepends(IPackage) []Depend PackageProvides(IPackage) []Depend PackagesFromGroup(string) []IPackage + PackagesFromGroupAndDB(string, string) ([]IPackage, error) RefreshHandle() error SyncUpgrades(enableDowngrade bool) ( map[string]SyncUpgrade, error) Repos() []string - SatisfierFromDB(string, string) IPackage + SatisfierFromDB(string, string) (IPackage, error) SyncPackage(string) IPackage + SyncPackageFromDB(string, string) IPackage SyncPackages(...string) []IPackage SyncSatisfier(string) IPackage SyncSatisfierExists(string) bool diff --git a/pkg/db/ialpm/alpm.go b/pkg/db/ialpm/alpm.go index e71320075..b5d030184 100644 --- a/pkg/db/ialpm/alpm.go +++ b/pkg/db/ialpm/alpm.go @@ -311,6 +311,22 @@ func (ae *AlpmExecutor) PackagesFromGroup(groupName string) []alpm.IPackage { return groupPackages } +func (ae *AlpmExecutor) PackagesFromGroupAndDB(groupName, dbName string) ([]alpm.IPackage, error) { + singleDBList, err := ae.handle.SyncDBListByDBName(dbName) + if err != nil { + return nil, err + } + + groupPackages := []alpm.IPackage{} + _ = singleDBList.FindGroupPkgs(groupName).ForEach(func(pkg alpm.IPackage) error { + groupPackages = append(groupPackages, pkg) + + return nil + }) + + return groupPackages, nil +} + func (ae *AlpmExecutor) LocalPackages() []alpm.IPackage { localPackages := []alpm.IPackage{} _ = ae.localDB.PkgCache().ForEach(func(pkg alpm.IPackage) error { @@ -369,18 +385,27 @@ func (ae *AlpmExecutor) SyncPackage(pkgName string) alpm.IPackage { return nil } -func (ae *AlpmExecutor) SatisfierFromDB(pkgName, dbName string) alpm.IPackage { +func (ae *AlpmExecutor) SyncPackageFromDB(pkgName, dbName string) alpm.IPackage { singleDB, err := ae.handle.SyncDBByName(dbName) if err != nil { return nil } - foundPkg, err := singleDB.PkgCache().FindSatisfier(pkgName) + return singleDB.Pkg(pkgName) +} + +func (ae *AlpmExecutor) SatisfierFromDB(pkgName, dbName string) (alpm.IPackage, error) { + singleDBList, err := ae.handle.SyncDBListByDBName(dbName) if err != nil { - return nil + return nil, err } - return foundPkg + foundPkg, err := singleDBList.FindSatisfier(pkgName) + if err != nil { + return nil, nil + } + + return foundPkg, nil } func (ae *AlpmExecutor) PackageDepends(pkg alpm.IPackage) []alpm.Depend { diff --git a/pkg/db/mock/executor.go b/pkg/db/mock/executor.go index e72633bc6..3de6cde04 100644 --- a/pkg/db/mock/executor.go +++ b/pkg/db/mock/executor.go @@ -28,11 +28,13 @@ type DBExecutor struct { PackageOptionalDependsFn func(alpm.IPackage) []alpm.Depend PackageProvidesFn func(IPackage) []Depend PackagesFromGroupFn func(string) []IPackage + PackagesFromGroupAndDBFn func(string, string) ([]IPackage, error) RefreshHandleFn func() error ReposFn func() []string SyncPackageFn func(string) IPackage SyncPackagesFn func(...string) []IPackage SyncSatisfierFn func(string) IPackage + SatisfierFromDBFn func(string, string) (IPackage, error) SyncUpgradesFn func(bool) (map[string]db.SyncUpgrade, error) SetLoggerFn func(*text.Logger) } @@ -140,6 +142,13 @@ func (t *DBExecutor) PackagesFromGroup(s string) []IPackage { panic("implement me") } +func (t *DBExecutor) PackagesFromGroupAndDB(s, s2 string) ([]IPackage, error) { + if t.PackagesFromGroupAndDBFn != nil { + return t.PackagesFromGroupAndDBFn(s, s2) + } + panic("implement me") +} + func (t *DBExecutor) RefreshHandle() error { if t.RefreshHandleFn != nil { return t.RefreshHandleFn() @@ -161,7 +170,10 @@ func (t *DBExecutor) Repos() []string { panic("implement me") } -func (t *DBExecutor) SatisfierFromDB(s, s2 string) IPackage { +func (t *DBExecutor) SatisfierFromDB(s, s2 string) (IPackage, error) { + if t.SatisfierFromDBFn != nil { + return t.SatisfierFromDBFn(s, s2) + } panic("implement me") } diff --git a/pkg/dep/dep_graph.go b/pkg/dep/dep_graph.go index aab48e8fd..4477065c4 100644 --- a/pkg/dep/dep_graph.go +++ b/pkg/dep/dep_graph.go @@ -138,19 +138,7 @@ func (g *Grapher) GraphFromTargets(ctx context.Context, switch target.DB { case "": // unspecified db if pkg := g.dbExecutor.SyncSatisfier(target.Name); pkg != nil { - dbName := pkg.DB().Name() - - reason := Explicit - if localPkg := g.dbExecutor.LocalPackage(pkg.Name()); localPkg != nil { - reason = Reason(localPkg.Reason()) - } - - g.GraphSyncPkg(ctx, graph, pkg, &InstallInfo{ - Source: Sync, - Reason: reason, - Version: pkg.Version(), - SyncDBName: &dbName, - }) + g.GraphSyncPkg(ctx, graph, pkg, nil) continue } @@ -158,18 +146,7 @@ func (g *Grapher) GraphFromTargets(ctx context.Context, groupPackages := g.dbExecutor.PackagesFromGroup(target.Name) if len(groupPackages) > 0 { dbName := groupPackages[0].DB().Name() - graph.AddNode(target.Name) - g.ValidateAndSetNodeInfo(graph, target.Name, &topo.NodeInfo[*InstallInfo]{ - Color: colorMap[Explicit], - Background: bgColorMap[Sync], - Value: &InstallInfo{ - Source: Sync, - Reason: Explicit, - Version: "", - SyncDBName: &dbName, - IsGroup: true, - }, - }) + g.GraphSyncGroup(ctx, graph, target.Name, dbName) continue } @@ -178,22 +155,27 @@ func (g *Grapher) GraphFromTargets(ctx context.Context, case "aur": aurTargets = append(aurTargets, target.Name) default: - reason := Explicit - if pkg := g.dbExecutor.LocalPackage(target.Name); pkg != nil { - reason = Reason(pkg.Reason()) + pkg, err := g.dbExecutor.SatisfierFromDB(target.Name, target.DB) + if err != nil { + return nil, err } + if pkg != nil { + g.GraphSyncPkg(ctx, graph, pkg, nil) - graph.AddNode(target.Name) - g.ValidateAndSetNodeInfo(graph, target.Name, &topo.NodeInfo[*InstallInfo]{ - Color: colorMap[reason], - Background: bgColorMap[Sync], - Value: &InstallInfo{ - Source: Sync, - Reason: reason, - Version: target.Version, - SyncDBName: &target.DB, - }, - }) + continue + } + + groupPackages, err := g.dbExecutor.PackagesFromGroupAndDB(target.Name, target.DB) + if err != nil { + return nil, err + } + if len(groupPackages) > 0 { + g.GraphSyncGroup(ctx, graph, target.Name, target.DB) + + continue + } + + g.logger.Errorln(gotext.Get("No package found for"), " ", target) } } @@ -329,7 +311,7 @@ func (g *Grapher) addDepNodes(ctx context.Context, pkg *aur.Pkg, graph *topo.Gra func (g *Grapher) GraphSyncPkg(ctx context.Context, graph *topo.Graph[string, *InstallInfo], - pkg alpm.IPackage, instalInfo *InstallInfo, + pkg alpm.IPackage, upgradeInfo *db.SyncUpgrade, ) *topo.Graph[string, *InstallInfo] { if graph == nil { graph = topo.New[string, *InstallInfo]() @@ -342,10 +324,53 @@ func (g *Grapher) GraphSyncPkg(ctx context.Context, return nil }) + dbName := pkg.DB().Name() + info := &InstallInfo{ + Source: Sync, + Reason: Explicit, + Version: pkg.Version(), + SyncDBName: &dbName, + } + + if upgradeInfo == nil { + if localPkg := g.dbExecutor.LocalPackage(pkg.Name()); localPkg != nil { + info.Reason = Reason(localPkg.Reason()) + } + } else { + info.Upgrade = true + info.Reason = Reason(upgradeInfo.Reason) + info.LocalVersion = upgradeInfo.LocalVersion + } + g.ValidateAndSetNodeInfo(graph, pkg.Name(), &topo.NodeInfo[*InstallInfo]{ - Color: colorMap[Reason(pkg.Reason())], + Color: colorMap[info.Reason], + Background: bgColorMap[info.Source], + Value: info, + }) + + return graph +} + +func (g *Grapher) GraphSyncGroup(ctx context.Context, + graph *topo.Graph[string, *InstallInfo], + groupName, dbName string, +) *topo.Graph[string, *InstallInfo] { + if graph == nil { + graph = topo.New[string, *InstallInfo]() + } + + graph.AddNode(groupName) + + g.ValidateAndSetNodeInfo(graph, groupName, &topo.NodeInfo[*InstallInfo]{ + Color: colorMap[Explicit], Background: bgColorMap[Sync], - Value: instalInfo, + Value: &InstallInfo{ + Source: Sync, + Reason: Explicit, + Version: "", + SyncDBName: &dbName, + IsGroup: true, + }, }) return graph diff --git a/pkg/dep/dep_graph_test.go b/pkg/dep/dep_graph_test.go index f99a3bab3..1a3025aef 100644 --- a/pkg/dep/dep_graph_test.go +++ b/pkg/dep/dep_graph_test.go @@ -690,6 +690,20 @@ func TestGrapher_GraphFromTargets_ReinstalledDeps(t *testing.T) { panic("implement me " + s) }, + SatisfierFromDBFn: func(s, s2 string) (mock.IPackage, error) { + if s2 == "extra" { + switch s { + case "libzip": + return &mock.Package{ + PName: "libzip", + PVersion: "1.9.2-1", + PDB: mock.NewDB("extra"), + }, nil + } + } + + panic("implement me " + s2 + "/" + s) + }, LocalSatisfierExistsFn: func(s string) bool { switch s { @@ -755,15 +769,6 @@ func TestGrapher_GraphFromTargets_ReinstalledDeps(t *testing.T) { Version: "1.9.2-1", SyncDBName: ptrString("extra"), }, - // In an ideal world this should be the same as "libzip dep", - // but due to the difference in handling cases with specified and - // unspecified dbs, this is how it is. - "extra/libzip dep": { - Source: Sync, - Reason: Dep, - Version: "", - SyncDBName: ptrString("extra"), - }, } tests := []struct { @@ -786,7 +791,7 @@ func TestGrapher_GraphFromTargets_ReinstalledDeps(t *testing.T) { targets: []string{"aur/gourou", "extra/libzip"}, wantLayers: []map[string]*InstallInfo{ {"gourou": installInfos["gourou dep"]}, - {"libzip": installInfos["extra/libzip dep"]}, + {"libzip": installInfos["libzip dep"]}, }, wantErr: false, }, diff --git a/pkg/download/unified.go b/pkg/download/unified.go index 5f22dc777..48fa5b80b 100644 --- a/pkg/download/unified.go +++ b/pkg/download/unified.go @@ -24,7 +24,7 @@ type httpRequestDoer interface { type DBSearcher interface { SyncPackage(string) db.IPackage - SatisfierFromDB(string, string) db.IPackage + SyncPackageFromDB(string, string) db.IPackage } func downloadGitRepo(ctx context.Context, cmdBuilder exe.GitCmdBuilder, @@ -212,7 +212,7 @@ func getPackageUsableName(dbExecutor DBSearcher, aurClient aur.QueryClient, if dbName != "aur" && mode.AtLeastRepo() { var pkg db.IPackage if dbName != "" { - pkg = dbExecutor.SatisfierFromDB(name, dbName) + pkg = dbExecutor.SyncPackageFromDB(name, dbName) } else { pkg = dbExecutor.SyncPackage(name) } diff --git a/pkg/download/utils_test.go b/pkg/download/utils_test.go index 39082e570..43f9dc0f3 100644 --- a/pkg/download/utils_test.go +++ b/pkg/download/utils_test.go @@ -102,7 +102,7 @@ func (d *testDBSearcher) SyncPackage(name string) db.IPackage { return nil } -func (d *testDBSearcher) SatisfierFromDB(name string, db string) db.IPackage { +func (d *testDBSearcher) SyncPackageFromDB(name string, db string) db.IPackage { if v, ok := d.absPackagesDB[name]; ok && v == db { return &testPackage{ name: name, diff --git a/pkg/upgrade/service.go b/pkg/upgrade/service.go index 82e2be22f..4716578f0 100644 --- a/pkg/upgrade/service.go +++ b/pkg/upgrade/service.go @@ -161,11 +161,10 @@ func (u *UpgradeService) upGraph(ctx context.Context, graph *topo.Graph[string, syncUpgrades, err := u.dbExecutor.SyncUpgrades(enableDowngrade) for _, up := range syncUpgrades { - dbName := up.Package.DB().Name() if filter != nil && !filter(&db.Upgrade{ Name: up.Package.Name(), RemoteVersion: up.Package.Version(), - Repository: dbName, + Repository: up.Package.DB().Name(), Base: up.Package.Base(), LocalVersion: up.LocalVersion, Reason: up.Reason, @@ -173,19 +172,8 @@ func (u *UpgradeService) upGraph(ctx context.Context, graph *topo.Graph[string, continue } - reason := dep.Explicit - if up.Reason == alpm.PkgReasonDepend { - reason = dep.Dep - } - - graph = u.grapher.GraphSyncPkg(ctx, graph, up.Package, &dep.InstallInfo{ - Source: dep.Sync, - Reason: reason, - Version: up.Package.Version(), - SyncDBName: &dbName, - LocalVersion: up.LocalVersion, - Upgrade: true, - }) + upgradeInfo := up + graph = u.grapher.GraphSyncPkg(ctx, graph, up.Package, &upgradeInfo) } errs.Add(err)