compiler

package
v0.31.1-geaaru Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: GPL-3.0 Imports: 25 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

func GenerateChanges

func GenerateChanges(b CompilerBackend, fromImage, toImage backend.Options) ([]artifact.ArtifactLayer, error)

GenerateChanges generates changes between two images using a backend by leveraging export/extractrootfs methods example of json return: [

{
  "Image1": "luet/base",
  "Image2": "alpine",
  "DiffType": "File",
  "Diff": {
    "Adds": null,
    "Dels": [
      {
        "Name": "/luetbuild",
        "Size": 5830706
      },
      {
        "Name": "/luetbuild/Dockerfile",
        "Size": 50
      },
      {
        "Name": "/luetbuild/output1",
        "Size": 5830656
      }
    ],
    "Mods": null
  }
}

]

Types

type ArtifactIndex

type ArtifactIndex []*artifact.PackageArtifact

func (ArtifactIndex) CleanPath

func (i ArtifactIndex) CleanPath() ArtifactIndex

type ArtifactLayerSummary

type ArtifactLayerSummary struct {
	FromImage   string `json:"image1"`
	ToImage     string `json:"image2"`
	AddFiles    int    `json:"add_files"`
	AddSizes    int64  `json:"add_sizes"`
	DelFiles    int    `json:"del_files"`
	DelSizes    int64  `json:"del_sizes"`
	ChangeFiles int    `json:"change_files"`
	ChangeSizes int64  `json:"change_sizes"`
}

type ArtifactLayersSummary

type ArtifactLayersSummary struct {
	Layers []ArtifactLayerSummary `json:"summary"`
}

func ComputeArtifactLayerSummary

func ComputeArtifactLayerSummary(diffs []artifact.ArtifactLayer) ArtifactLayersSummary

type CompilerBackend

type CompilerBackend interface {
	BuildImage(backend.Options) error
	ExportImage(backend.Options) error
	RemoveImage(backend.Options) error
	ImageDefinitionToTar(backend.Options) error
	ExtractRootfs(opts backend.Options, keepPerms bool) error

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

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

	ImageExists(string) bool
}

func NewBackend

func NewBackend(s string) (CompilerBackend, error)

type ImageHashTree

type ImageHashTree struct {
	Database      pkg.PackageDatabase
	SolverOptions config.LuetSolverOptions
}

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 pkg.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 LuetCompiler

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

func NewCompiler

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

func NewLuetCompiler

func NewLuetCompiler(backend CompilerBackend, db pkg.PackageDatabase, compilerOpts ...options.Option) *LuetCompiler

func (*LuetCompiler) Compile

func (cs *LuetCompiler) Compile(keepPermissions bool, p *compilerspec.LuetCompilationSpec) (*artifact.PackageArtifact, error)

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

func (*LuetCompiler) CompileParallel

func (cs *LuetCompiler) CompileParallel(keepPermissions bool, ps *compilerspec.LuetCompilationspecs) ([]*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 (*LuetCompiler) CompileWithReverseDeps

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

CompileWithReverseDeps compiles the supplied compilationspecs and their reverse dependencies

func (*LuetCompiler) ComputeDepTree

func (*LuetCompiler) ComputeMinimumCompilableSet

func (cs *LuetCompiler) ComputeMinimumCompilableSet(p ...*compilerspec.LuetCompilationSpec) ([]*compilerspec.LuetCompilationSpec, error)

ComputeMinimumCompilableSet strips specs that are eventually compiled by leafs

func (*LuetCompiler) FromDatabase

func (cs *LuetCompiler) FromDatabase(db pkg.PackageDatabase, minimum bool, dst string) ([]*compilerspec.LuetCompilationSpec, 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 (*LuetCompiler) FromPackage

FromPackage returns a compilation spec from a package definition

func (*LuetCompiler) GetBackend

func (cs *LuetCompiler) GetBackend() CompilerBackend

GetBackend returns the current compilation backend

func (*LuetCompiler) SetBackend

func (cs *LuetCompiler) SetBackend(b CompilerBackend)

SetBackend sets the compilation backend

type PackageImageHashTree

type PackageImageHashTree struct {
	Target       *solver.PackageAssert
	Dependencies solver.PackagesAssertions
	Solution     solver.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 pkg.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