Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AUR dependency resolving #2169

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions pkg/dep/dep_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ func (g *Grapher) GraphFromSrcInfo(ctx context.Context, graph *topo.Graph[string
return graph, nil
}

func (g *Grapher) AddDepsForPkgs(ctx context.Context, pkgs []*aur.Pkg, graph *topo.Graph[string, *InstallInfo]) {
for _, pkg := range pkgs {
g.addDepNodes(ctx, pkg, graph)
}
}

func (g *Grapher) addDepNodes(ctx context.Context, pkg *aur.Pkg, graph *topo.Graph[string, *InstallInfo]) {
if len(pkg.MakeDepends) > 0 {
g.addNodes(ctx, graph, pkg.Name, pkg.MakeDepends, MakeDep)
Expand Down Expand Up @@ -316,8 +322,6 @@ func (g *Grapher) GraphAURTarget(ctx context.Context,
graph = topo.New[string, *InstallInfo]()
}

exists := graph.Exists(pkg.Name)

graph.AddNode(pkg.Name)

for i := range pkg.Provides {
Expand All @@ -335,10 +339,6 @@ func (g *Grapher) GraphAURTarget(ctx context.Context,
Value: instalInfo,
})

if !exists {
g.addDepNodes(ctx, pkg, graph)
}

return graph
}

Expand Down Expand Up @@ -366,6 +366,8 @@ func (g *Grapher) GraphFromAUR(ctx context.Context,
}
}

aurPkgsAdded := []*aurc.Pkg{}

for _, target := range targets {
if cachedProvidePkg, ok := g.providerCache[target]; ok {
aurPkgs = cachedProvidePkg
Expand Down Expand Up @@ -405,8 +407,11 @@ func (g *Grapher) GraphFromAUR(ctx context.Context,
Source: AUR,
Version: aurPkg.Version,
})
aurPkgsAdded = append(aurPkgsAdded, aurPkg)
}

g.AddDepsForPkgs(ctx, aurPkgsAdded, graph)

return graph, nil
}

Expand Down
Loading