fix GraphFromTarget bug where empty DB would be used as identifier

This commit is contained in:
jguer 2022-11-16 01:03:57 +01:00
parent 481c63db91
commit 2805252365
No known key found for this signature in database
GPG Key ID: 6D6CC9BEA8556B35

View File

@ -126,16 +126,17 @@ func (g *Grapher) GraphFromTargets(ctx context.Context,
switch target.DB {
case "": // unspecified db
if g.dbExecutor.SyncPackage(target.Name) != nil {
graph.AddNode(target.Name)
if pkg := g.dbExecutor.SyncPackage(target.Name); pkg != nil {
dbName := pkg.DB().Name()
graph.AddNode(pkg.Name())
g.ValidateAndSetNodeInfo(graph, target.Name, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[Explicit],
Background: bgColorMap[AUR],
Background: bgColorMap[Sync],
Value: &InstallInfo{
Source: Sync,
Reason: Explicit,
Version: target.Version,
SyncDBName: &target.DB,
Version: pkg.Version(),
SyncDBName: &dbName,
},
})
@ -149,7 +150,7 @@ func (g *Grapher) GraphFromTargets(ctx context.Context,
graph.AddNode(target.Name)
g.ValidateAndSetNodeInfo(graph, target.Name, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[Explicit],
Background: bgColorMap[AUR],
Background: bgColorMap[Sync],
Value: &InstallInfo{
Source: Sync,
Reason: Explicit,