compiler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const BuildFile = "build.yaml"
View Source
const CollectionFile = "collection.yaml"
View Source
const DefinitionFile = "definition.yaml"

Variables

This section is empty.

Functions

Types

type ArtifactIndex

type ArtifactIndex []*artifact.PackageArtifact

func (ArtifactIndex) CleanPath

func (i ArtifactIndex) CleanPath() ArtifactIndex

type BhojpurCompiler

type BhojpurCompiler struct {
	//*tree.CompilerRecipe
	Backend  CompilerBackend
	Database types.PackageDatabase
	Options  options.Compiler
}

func CompilerFinalImages

func CompilerFinalImages(cs *BhojpurCompiler) (*BhojpurCompiler, error)

func NewBhojpurCompiler

func NewBhojpurCompiler(backend CompilerBackend, db types.PackageDatabase, compilerOpts ...options.Option) *BhojpurCompiler

func NewCompiler

func NewCompiler(p ...options.Option) *BhojpurCompiler

func (*BhojpurCompiler) BuildTree

func (cs *BhojpurCompiler) BuildTree(compilerSpecs compilerspec.BhojpurCompilationspecs) (*BuildTree, error)

BuildTree returns a BuildTree which represent the order in which specs should be compiled. It places specs into levels, and each level can be built in parallel. The root nodes starting from the top. A BuildTree can be marshaled into JSON or walked like:

for _, l := range bt.AllLevels() {
	fmt.Println(strings.Join(bt.AllInLevel(l), " "))
}

func (*BhojpurCompiler) Compile

Compile is a non-parallel version of CompileParallel. It builds the compilation specs and generates an artifact

func (*BhojpurCompiler) CompileParallel

func (cs *BhojpurCompiler) CompileParallel(keepPermissions bool, ps *compilerspec.BhojpurCompilationspecs) ([]*artifact.PackageArtifact, []error)

CompileParallel compiles the supplied compilationspecs in parallel to note, no specific heuristic is implemented, and the specs are run in parallel as they are.

func (*BhojpurCompiler) CompileWithReverseDeps

func (cs *BhojpurCompiler) CompileWithReverseDeps(keepPermissions bool, ps *compilerspec.BhojpurCompilationspecs) ([]*artifact.PackageArtifact, []error)

CompileWithReverseDeps compiles the supplied compilationspecs and their reverse dependencies

func (*BhojpurCompiler) ComputeMinimumCompilableSet

func (cs *BhojpurCompiler) ComputeMinimumCompilableSet(p ...*compilerspec.BhojpurCompilationSpec) ([]*compilerspec.BhojpurCompilationSpec, error)

ComputeMinimumCompilableSet strips specs that are eventually compiled by leafs

func (*BhojpurCompiler) FromDatabase

func (cs *BhojpurCompiler) FromDatabase(db types.PackageDatabase, minimum bool, dst string) ([]*compilerspec.BhojpurCompilationSpec, error)

FromDatabase returns all the available compilation specs from a database. If the minimum flag is returned it will be computed a minimal subset that will guarantees that all packages are built ( if not targeting a single package explictly )

func (*BhojpurCompiler) FromPackage

FromPackage returns a compilation spec from a package definition

func (*BhojpurCompiler) GetBackend

func (cs *BhojpurCompiler) GetBackend() CompilerBackend

GetBackend returns the current compilation backend

func (*BhojpurCompiler) SetBackend

func (cs *BhojpurCompiler) SetBackend(b CompilerBackend)

SetBackend sets the compilation backend

type BuildTree

type BuildTree struct {
	// contains filtered or unexported fields
}

func (*BuildTree) AllInLevel

func (bt *BuildTree) AllInLevel(l int) []string

func (*BuildTree) AllLevels

func (bt *BuildTree) AllLevels() []int

func (*BuildTree) Increase

func (bt *BuildTree) Increase(s string)

func (*BuildTree) JSON

func (bt *BuildTree) JSON() (string, error)

func (*BuildTree) Level

func (bt *BuildTree) Level(s string) int

func (*BuildTree) Order

func (bt *BuildTree) Order(compilationTree map[string]map[string]interface{})

func (*BuildTree) Reset

func (bt *BuildTree) Reset(s string)

type CompilerBackend

type CompilerBackend interface {
	BuildImage(backend.Options) error
	ExportImage(backend.Options) error
	LoadImage(string) error
	RemoveImage(backend.Options) error
	ImageDefinitionToTar(backend.Options) error

	CopyImage(string, string) error
	DownloadImage(opts backend.Options) error

	Push(opts backend.Options) error
	ImageAvailable(string) bool

	ImageReference(img1 string, ondisk bool) (v1.Image, error)
	ImageExists(string) bool
}

func NewBackend

func NewBackend(ctx types.Context, s string) (CompilerBackend, error)

type ImageHashTree

type ImageHashTree struct {
	Database      types.PackageDatabase
	SolverOptions types.BhojpurSolverOptions
}

ImageHashTree is holding the Database and the options to resolve PackageImageHashTrees for a given specfile It is responsible of returning a concrete result which identifies a Package in a HashTree

func NewHashTree

func NewHashTree(db types.PackageDatabase) *ImageHashTree

func (*ImageHashTree) Query

Query takes a compiler and a compilation spec and returns a PackageImageHashTree tied to it. PackageImageHashTree contains all the informations to resolve the spec build images in order to reproducibly re-build images from packages

type PackageImageHashTree

type PackageImageHashTree struct {
	Target       *types.PackageAssert
	Dependencies types.PackagesAssertions
	Solution     types.PackagesAssertions

	SourceHash       string
	BuilderImageHash string
	// contains filtered or unexported fields
}

PackageImageHashTree represent the Package into a given image hash tree The hash tree is constructed by a set of images representing the package during its build stage. A Hash is assigned to each image from the package fingerprint, plus the SAT solver assertion result (which is hashed as well) and the specfile signatures. This guarantees that each image of the build stage is unique and can be identified later on.

func (*PackageImageHashTree) DependencyBuildImage

func (ht *PackageImageHashTree) DependencyBuildImage(p *types.Package) (string, error)

func (*PackageImageHashTree) String

func (ht *PackageImageHashTree) String() string

Directories

Path Synopsis
types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL