installer

package
v0.0.0-...-f3480f8 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 33 Imported by: 3

Documentation

Index

Constants

View Source
const (
	REPOSITORY_METAFILE  = "repository.meta.yaml"
	REPOSITORY_SPECFILE  = "repository.yaml"
	TREE_TARBALL         = "tree.tar"
	COMPILERTREE_TARBALL = "compilertree.tar"

	REPOFILE_TREE_KEY          = "tree"
	REPOFILE_COMPILER_TREE_KEY = "compilertree"
	REPOFILE_META_KEY          = "meta"

	DiskRepositoryType   = "disk"
	HttpRepositoryType   = "http"
	DockerRepositoryType = "docker"
)
View Source
const (
	SLabel      = iota
	SRegexPkg   = iota
	SRegexLabel = iota
	FileSearch  = iota
)

Variables

This section is empty.

Functions

func FromMetadata

func FromMetadata(b bool) func(cfg *RepositoryConfig) error

FromMetadata when enabled considers packages metadata when building repository indexes

func FromRepository

func FromRepository(b bool) func(cfg *RepositoryConfig) error

FromRepository when enabled considers packages metadata from remote repositories when building the new repository index

func OrderFinalizers

func OrderFinalizers(allRepos types.PackageDatabase, toInstall map[string]ArtifactMatch, solution types.PackagesAssertions) ([]*types.Package, error)

func WithCompilerBackend

func WithCompilerBackend(b compiler.CompilerBackend) func(cfg *RepositoryConfig) error

func WithContext

func WithContext(c types.Context) func(cfg *RepositoryConfig) error

func WithDatabase

func WithDatabase(b types.PackageDatabase) func(cfg *RepositoryConfig) error

func WithDescription

func WithDescription(s string) func(cfg *RepositoryConfig) error

func WithForce

func WithForce(b bool) func(cfg *RepositoryConfig) error

func WithImagePrefix

func WithImagePrefix(s string) func(cfg *RepositoryConfig) error

func WithName

func WithName(s string) func(cfg *RepositoryConfig) error

func WithPriority

func WithPriority(b int) func(cfg *RepositoryConfig) error

func WithPushImages

func WithPushImages(b bool) func(cfg *RepositoryConfig) error

func WithSource

func WithSource(s string) func(cfg *RepositoryConfig) error

func WithTree

func WithTree(s ...string) func(cfg *RepositoryConfig) error

func WithType

func WithType(s string) func(cfg *RepositoryConfig) error

func WithUrls

func WithUrls(s ...string) func(cfg *RepositoryConfig) error

Types

type ArtifactMatch

type ArtifactMatch struct {
	Package    *types.Package
	Artifact   *artifact.PackageArtifact
	Repository Repository
}

type BuildTreeResult

type BuildTreeResult struct {
	Repositories Repositories
	TemplatesDir map[*LuetSystemRepository][]string
	RepoDir      map[*LuetSystemRepository]string
}

func LoadBuildTree

func LoadBuildTree(t tree.Builder, db types.PackageDatabase, ctx types.Context) (BuildTreeResult, error)

LoadBuildTree loads to the tree the compilation specs from the system repositories

type Client

type Client interface {
	DownloadArtifact(*artifact.PackageArtifact) (*artifact.PackageArtifact, error)
	DownloadFile(string) (string, error)
	CacheGet(*artifact.PackageArtifact) (*artifact.PackageArtifact, error)
}

type LuetFinalizer

type LuetFinalizer struct {
	Shell     []string `json:"shell"`
	Install   []string `json:"install"`
	Uninstall []string `json:"uninstall"` // TODO: Where to store?
}

func NewLuetFinalizerFromYaml

func NewLuetFinalizerFromYaml(data []byte) (*LuetFinalizer, error)

func (*LuetFinalizer) RunInstall

func (f *LuetFinalizer) RunInstall(ctx types.Context, s *System) error

func (*LuetFinalizer) RunUnInstall

func (f *LuetFinalizer) RunUnInstall(ctx types.Context) error

TODO: We don't store uninstall finalizers ?!

type LuetInstaller

type LuetInstaller struct {
	Options LuetInstallerOptions
}

func NewLuetInstaller

func NewLuetInstaller(opts LuetInstallerOptions) *LuetInstaller

func (*LuetInstaller) Install

func (l *LuetInstaller) Install(cp types.Packages, s *System) error

func (*LuetInstaller) Reclaim

func (l *LuetInstaller) Reclaim(s *System) error

Reclaim adds packages to the system database if files from artifacts in the repositories are found in the system target

func (*LuetInstaller) Swap

func (l *LuetInstaller) Swap(toRemove types.Packages, toInstall types.Packages, s *System) error

func (*LuetInstaller) SyncRepositories

func (l *LuetInstaller) SyncRepositories() (Repositories, error)

func (*LuetInstaller) Uninstall

func (l *LuetInstaller) Uninstall(s *System, packs ...*types.Package) error

func (*LuetInstaller) Upgrade

func (l *LuetInstaller) Upgrade(s *System) error

Upgrade upgrades a System based on the Installer options. Returns error in case of failure

type LuetInstallerOptions

type LuetInstallerOptions struct {
	SolverOptions                                                  types.LuetSolverOptions
	Concurrency                                                    int
	NoDeps                                                         bool
	OnlyDeps                                                       bool
	Force                                                          bool
	PreserveSystemEssentialData                                    bool
	FullUninstall, FullCleanUninstall                              bool
	CheckConflicts                                                 bool
	SolverUpgrade, RemoveUnavailableOnUpgrade, UpgradeNewRevisions bool
	Ask                                                            bool
	DownloadOnly                                                   bool
	Relaxed                                                        bool
	PackageRepositories                                            types.LuetRepositories
	AutoOSCheck                                                    bool

	Context types.Context
}

type LuetRepositoryFile

type LuetRepositoryFile struct {
	FileName        string                          `json:"filename"`
	CompressionType types.CompressionImplementation `json:"compressiontype,omitempty"`
	Checksums       artifact.Checksums              `json:"checksums,omitempty"`
}

func NewDefaultCompilerTreeRepositoryFile

func NewDefaultCompilerTreeRepositoryFile() LuetRepositoryFile

func NewDefaultMetaRepositoryFile

func NewDefaultMetaRepositoryFile() LuetRepositoryFile

func NewDefaultTreeRepositoryFile

func NewDefaultTreeRepositoryFile() LuetRepositoryFile

func (*LuetRepositoryFile) GetChecksums

func (f *LuetRepositoryFile) GetChecksums() artifact.Checksums

GetChecksums gets the checksum of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the checksums that the client will use to verify the artifact

func (*LuetRepositoryFile) GetCompressionType

func (f *LuetRepositoryFile) GetCompressionType() types.CompressionImplementation

GetCompressionType gets the compression type of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the compression type that the client will use to uncompress the artifact

func (*LuetRepositoryFile) GetFileName

func (f *LuetRepositoryFile) GetFileName() string

GetFileName returns the name of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the filename that the client will pull

func (*LuetRepositoryFile) SetChecksums

func (f *LuetRepositoryFile) SetChecksums(c artifact.Checksums)

SetChecksums sets the checksum of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this sets the checksums that the client will use to verify the artifact

func (*LuetRepositoryFile) SetCompressionType

func (f *LuetRepositoryFile) SetCompressionType(c types.CompressionImplementation)

SetCompressionType sets the compression type of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this sets the compression type that the client will use to uncompress the artifact

func (*LuetRepositoryFile) SetFileName

func (f *LuetRepositoryFile) SetFileName(n string)

SetFileName sets the name of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this set the filename that the client will pull

type LuetSearchModeType

type LuetSearchModeType int

type LuetSearchOpts

type LuetSearchOpts struct {
	Mode LuetSearchModeType
}

type LuetSystemRepository

type LuetSystemRepository struct {
	*types.LuetRepository

	Index           compiler.ArtifactIndex        `json:"index"`
	BuildTree, Tree tree.Builder                  `json:"-"`
	RepositoryFiles map[string]LuetRepositoryFile `json:"repo_files"`
	Backend         compiler.CompilerBackend      `json:"-"`
	PushImages      bool                          `json:"-"`
	ForcePush       bool                          `json:"-"`
	// contains filtered or unexported fields
}

func GenerateRepository

func GenerateRepository(p ...RepositoryOption) (*LuetSystemRepository, error)

GenerateRepository generates a new repository from the given argument. If the repository is of the docker type, it will also push the package images. In case the repository is local, it will build the package Index

func NewLuetSystemRepositoryFromYaml

func NewLuetSystemRepositoryFromYaml(data []byte, db types.PackageDatabase) (*LuetSystemRepository, error)

func NewSystemRepository

func NewSystemRepository(repo types.LuetRepository) *LuetSystemRepository

func (*LuetSystemRepository) AddMetadata

func (r *LuetSystemRepository) AddMetadata(ctx types.Context, repospec, dst string) (*artifact.PackageArtifact, error)

AddMetadata adds the repository serialized content into the metadata key of the repository It writes the serialized content to repospec, and writes the repository.meta.yaml file into dst

func (*LuetSystemRepository) AddRepositoryFile

func (r *LuetSystemRepository) AddRepositoryFile(src, fileKey, repositoryRoot string, defaults LuetRepositoryFile) (*artifact.PackageArtifact, error)

AddRepositoryFile adds a path to a key in the repository manifest. The path will be compressed, and a default File has to be passed in case there is no entry into the repository manifest

func (*LuetSystemRepository) AddTree

AddTree adds a tree.Builder with the given key to the repository. It will generate an artifact which will be then embedded in the repository manifest It returns the generated artifacts and an error

func (*LuetSystemRepository) AddUrl

func (r *LuetSystemRepository) AddUrl(p string)

func (*LuetSystemRepository) BumpRevision

func (r *LuetSystemRepository) BumpRevision(repospec string, resetRevision bool) error

BumpRevision bumps the internal repository revision by reading the current one from repospec

func (*LuetSystemRepository) Client

func (r *LuetSystemRepository) Client(ctx types.Context) Client

func (*LuetSystemRepository) FileSearch

func (r *LuetSystemRepository) FileSearch(pattern string) (types.Packages, error)

FileSearch search a pattern among the artifacts in a repository

func (*LuetSystemRepository) GetAuthentication

func (r *LuetSystemRepository) GetAuthentication() map[string]string

func (*LuetSystemRepository) GetBackend

func (*LuetSystemRepository) GetDescription

func (r *LuetSystemRepository) GetDescription() string

func (*LuetSystemRepository) GetIndex

func (*LuetSystemRepository) GetLastUpdate

func (r *LuetSystemRepository) GetLastUpdate() string

func (*LuetSystemRepository) GetMetaPath

func (r *LuetSystemRepository) GetMetaPath() string

func (*LuetSystemRepository) GetName

func (r *LuetSystemRepository) GetName() string

func (*LuetSystemRepository) GetPriority

func (r *LuetSystemRepository) GetPriority() int

func (*LuetSystemRepository) GetReferenceID

func (r *LuetSystemRepository) GetReferenceID() string

func (*LuetSystemRepository) GetRepositoryFile

func (r *LuetSystemRepository) GetRepositoryFile(name string) (LuetRepositoryFile, error)

func (*LuetSystemRepository) GetRevision

func (r *LuetSystemRepository) GetRevision() int

func (*LuetSystemRepository) GetTree

func (r *LuetSystemRepository) GetTree() tree.Builder

func (*LuetSystemRepository) GetTreePath

func (r *LuetSystemRepository) GetTreePath() string

func (*LuetSystemRepository) GetType

func (r *LuetSystemRepository) GetType() string

func (*LuetSystemRepository) GetUrls

func (r *LuetSystemRepository) GetUrls() []string

func (*LuetSystemRepository) GetVerify

func (r *LuetSystemRepository) GetVerify() bool

func (*LuetSystemRepository) IncrementRevision

func (r *LuetSystemRepository) IncrementRevision()

func (*LuetSystemRepository) ReadSpecFile

func (r *LuetSystemRepository) ReadSpecFile(file string) (*LuetSystemRepository, error)

func (*LuetSystemRepository) SearchArtefact

func (r *LuetSystemRepository) SearchArtefact(p *types.Package) (*artifact.PackageArtifact, error)

func (*LuetSystemRepository) Serialize

func (*LuetSystemRepository) SetAuthentication

func (r *LuetSystemRepository) SetAuthentication(auth map[string]string)

func (*LuetSystemRepository) SetBackend

func (*LuetSystemRepository) SetIndex

func (*LuetSystemRepository) SetLastUpdate

func (r *LuetSystemRepository) SetLastUpdate(u string)

func (*LuetSystemRepository) SetMetaPath

func (r *LuetSystemRepository) SetMetaPath(p string)

func (*LuetSystemRepository) SetName

func (r *LuetSystemRepository) SetName(p string)

func (*LuetSystemRepository) SetPriority

func (r *LuetSystemRepository) SetPriority(n int)

func (*LuetSystemRepository) SetReferenceID

func (r *LuetSystemRepository) SetReferenceID(ref string)

func (*LuetSystemRepository) SetRepositoryFile

func (r *LuetSystemRepository) SetRepositoryFile(name string, f LuetRepositoryFile)

func (*LuetSystemRepository) SetSnapshotID

func (r *LuetSystemRepository) SetSnapshotID(i string)

Sets snapshot ID

func (*LuetSystemRepository) SetTree

func (r *LuetSystemRepository) SetTree(b tree.Builder)

func (*LuetSystemRepository) SetTreePath

func (r *LuetSystemRepository) SetTreePath(p string)

func (*LuetSystemRepository) SetType

func (r *LuetSystemRepository) SetType(p string)

func (*LuetSystemRepository) SetUrls

func (r *LuetSystemRepository) SetUrls(urls []string)

func (*LuetSystemRepository) SetVerify

func (r *LuetSystemRepository) SetVerify(p bool)

func (*LuetSystemRepository) Snapshot

func (r *LuetSystemRepository) Snapshot(id, dst string) (artifacts []*artifact.PackageArtifact, snapshotIndex string, err error)

Snapshot creates a copy of the current repository index into dst. The copy will be prefixed with "id". This allows the clients to refer to old versions of the repository by using the reference_id

func (*LuetSystemRepository) Sync

func (*LuetSystemRepository) SyncBuildMetadata

func (r *LuetSystemRepository) SyncBuildMetadata(ctx types.Context, path string) error

func (*LuetSystemRepository) Write

func (r *LuetSystemRepository) Write(ctx types.Context, dst string, resetRevision, force bool) error

Write writes the repository metadata to the supplied destination

type LuetSystemRepositoryMetadata

type LuetSystemRepositoryMetadata struct {
	Index []*artifact.PackageArtifact `json:"index,omitempty"`
}

func NewLuetSystemRepositoryMetadata

func NewLuetSystemRepositoryMetadata(file string, removeFile bool) (*LuetSystemRepositoryMetadata, error)

func (*LuetSystemRepositoryMetadata) ReadFile

func (m *LuetSystemRepositoryMetadata) ReadFile(file string, removeFile bool) error

func (*LuetSystemRepositoryMetadata) ToArtifactIndex

func (m *LuetSystemRepositoryMetadata) ToArtifactIndex() (ans compiler.ArtifactIndex)

func (*LuetSystemRepositoryMetadata) WriteFile

func (m *LuetSystemRepositoryMetadata) WriteFile(path string) error

type Option

type Option struct {
	Force              bool
	NoDeps             bool
	CheckConflicts     bool
	FullUninstall      bool
	FullCleanUninstall bool
	OnlyDeps           bool
	RunFinalizers      bool

	CheckFileConflicts bool
}

type PackageMatch

type PackageMatch struct {
	Repo     *LuetSystemRepository
	Artifact *artifact.PackageArtifact
	Package  *types.Package
}

type Repositories

type Repositories []*LuetSystemRepository

func SystemRepositories

func SystemRepositories(t types.LuetRepositories) Repositories

SystemRepositories returns the repositories from the local configuration file it filters the available repositories returning the ones that are enabled

func (Repositories) Len

func (r Repositories) Len() int

func (Repositories) Less

func (r Repositories) Less(i, j int) bool

func (Repositories) PackageMatches

func (re Repositories) PackageMatches(p types.Packages) []PackageMatch

func (Repositories) ResolveSelectors

func (re Repositories) ResolveSelectors(p types.Packages) types.Packages

func (Repositories) Search

func (re Repositories) Search(s string) []PackageMatch

func (Repositories) SearchLabel

func (re Repositories) SearchLabel(s string) []PackageMatch

func (Repositories) SearchLabelMatch

func (re Repositories) SearchLabelMatch(s string) []PackageMatch

func (Repositories) SearchPackages

func (re Repositories) SearchPackages(p string, t LuetSearchModeType) []PackageMatch

func (Repositories) Swap

func (r Repositories) Swap(i, j int)

func (Repositories) SyncDatabase

func (r Repositories) SyncDatabase(d types.PackageDatabase)

func (Repositories) World

func (r Repositories) World() types.Packages

type Repository

type Repository interface {
	GetTree() tree.Builder
	Client(types.Context) Client
	GetName() string
}

type RepositoryConfig

type RepositoryConfig struct {
	Name, Description, Type string
	Urls                    []string
	Priority                int
	Src                     string
	Tree                    []string
	DB                      types.PackageDatabase
	CompilerBackend         compiler.CompilerBackend
	ImagePrefix             string

	PushImages, Force, FromRepository, FromMetadata bool
	// contains filtered or unexported fields
}

func (*RepositoryConfig) Apply

func (cfg *RepositoryConfig) Apply(opts ...RepositoryOption) error

Apply applies the given options to the config, returning the first error encountered (if any).

type RepositoryGenerator

type RepositoryGenerator interface {
	Generate(*LuetSystemRepository, string, bool) error
	Initialize(string, types.PackageDatabase) ([]*artifact.PackageArtifact, error)
}

type RepositoryOption

type RepositoryOption func(cfg *RepositoryConfig) error

func WithCompilerParser

func WithCompilerParser(parsers ...tree.FileParser) RepositoryOption

func WithRuntimeParser

func WithRuntimeParser(parsers ...tree.FileParser) RepositoryOption

type System

type System struct {
	Database types.PackageDatabase
	Target   string

	sync.Mutex
	// contains filtered or unexported fields
}

func (*System) Clean

func (s *System) Clean()

func (*System) ExecuteFinalizers

func (s *System) ExecuteFinalizers(ctx types.Context, packs []*types.Package) error

func (*System) ExistsPackageFile

func (s *System) ExistsPackageFile(file string) (bool, *types.Package, error)

func (*System) FileIndex

func (s *System) FileIndex() map[string]*types.Package

func (*System) OSCheck

func (s *System) OSCheck(ctx types.Context) (notFound types.Packages)

func (*System) World

func (s *System) World() (types.Packages, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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