Documentation ¶
Index ¶
- type Graph
- func (g Graph) Config(name string) *build.Configuration
- func (g Graph) DependenciesOf(node string) []string
- func (g Graph) MakeTarget(pkgName, arch string) (string, error)
- func (g Graph) MakefileEntry(pkgName string) (string, error)
- func (g Graph) Nodes() []string
- func (g Graph) Sorted() ([]string, error)
- func (g Graph) SubgraphWithLeaves(leaves []string) (*Graph, error)
- func (g Graph) SubgraphWithRoots(roots []string) (*Graph, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
A Graph represents an interdependent set of Wolfi packages defined in one or more Melange configuration files.
func NewGraph ¶
NewGraph returns a new Graph using Melange configuration discovered in the given directory.
The input is any fs.FS filesystem implementation. Given a directory path, you can call NewGraph like this:
pkg.NewGraph(os.DirFS('path/to/directory'))
func (Graph) Config ¶
func (g Graph) Config(name string) *build.Configuration
Config returns the Melange configuration for the package with the given name, if the package is present in the Graph. If it's not present, Config returns nil. Providing the name of a subpackage will return the configuration of the subpackage's origin package.
func (Graph) DependenciesOf ¶
DependenciesOf returns a slice of the names of the given package's dependencies, sorted alphabetically.
func (Graph) MakeTarget ¶
MakeTarget creates the make target for the given package in the Graph.
func (Graph) Nodes ¶
Nodes returns a slice of the names of all nodes in the Graph, sorted alphabetically.
func (Graph) Sorted ¶
Sorted returns a list of all package names in the Graph, sorted in topological order, meaning that packages earlier in the list depend on packages later in the list.
func (Graph) SubgraphWithLeaves ¶
SubgraphWithLeaves returns a new Graph that's a subgraph of g, where the set of the new Graph's leaves will be identical to or a subset of the given set of leaves.
In other words, the new subgraph will contain all packages (transitively) that are dependent on the packages whose names were given as the `leaves` argument.
func (Graph) SubgraphWithRoots ¶
SubgraphWithRoots returns a new Graph that's a subgraph of g, where the set of the new Graph's roots will be identical to or a subset of the given set of roots.
In other words, the new subgraph will contain all dependencies (transitively) of all packages whose names were given as the `roots` argument.