Documentation ¶
Overview ¶
Package graph provides dependency resolution for AUR packages. It is not very optimized, but it should work (hopefully).
Usage ¶
First, you have to create a graph:
pkgs, err := aur.ReadAll(list) if err != nil { return err } g, err := graph.NewGraph() if err != nil { return err }
Once you have a graph, you can then get the ordered dependency list with the following function:
graph.Dependencies(g)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
A Factory creates a dependency graph given a set of packages.
It can perform AUR calls to resolve dependencies and it can truncate dependencies so that they are not resolved beyond packages available in repositories. This reduces the dependency list
func NewFactory ¶
NewFactory returns a new dependency graph, ignoring repositories given in `ignore`.
Note that it makes a difference between dependencies that are in AUR, and those availabe in the repositories. Ignoring repositories effectively "demotes" any packages available in them back to AUR.
Any package that is in the dependency graph that is not from AUR is treated as a leaf in the graph, since we assume that pacman can resolve those dependencies.
func (*Factory) NewGraph ¶
NewGraph returns a dependency graph of the given AUR packages. Extra packages may be pulled into the graph to properly build the dependency graph.
func (*Factory) NumRequestsAUR ¶
NumRequestsAUR returns the number of requests made to AUR.
func (*Factory) SetDependencyFunc ¶
func (f *Factory) SetDependencyFunc(fn func(pacman.AnyPackage) []string)
SetDependencyFunc controls which dependency list is used. By default, make and install dependencies are included.
func (*Factory) SetNoUnknown ¶
SetNoUnknown controls whether unknown packages (i.e., not on AUR) are injected into the graph. If this is set to true, NewGraph will fail if any unknown packages are found.
func (*Factory) SetSkipInstalled ¶
SetSkipInstalled controls whether installed packages are disregarded from the dependency tree.
func (*Factory) SetTruncate ¶
SetTruncate controls whether packages available in a repository are not further investigated.
type Graph ¶
type Graph struct { *simple.DirectedGraph // contains filtered or unexported fields }
Graph implements graph.Graph.
func (*Graph) AddEdgeFromTo ¶
AddEdgeFromTo adds a directed edge from u to v.
func (*Graph) AddNode ¶
AddNode adds the node and initializes data structures but does nothing else.
func (*Graph) HasName ¶
HasName returns whether the package with the given name exists within the graph.
func (*Graph) NewNode ¶
func (g *Graph) NewNode(pkg pacman.AnyPackage) *Node
NewNode returns a new node.
func (*Graph) NodeWithName ¶
NodeWithName returns the node with the given name, or nil.
type Node ¶
type Node struct { simple.Node pacman.AnyPackage }
Node implements graph.Node.
func (*Node) AllDepends ¶
AllDepends returns a (newly created) string slice of the installation and make dependencies of this package.
func (*Node) NumAllDepends ¶
NumAllDepends returns the number of make and installation dependencies the package has.