installer

package
v0.30.0-geaaru Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: GPL-3.0 Imports: 33 Imported by: 0

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 LoadBuildTree

func LoadBuildTree(t tree.Builder, db pkg.PackageDatabase, c *config.LuetConfig) error

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

func LoadConfigProtectConFile

func LoadConfigProtectConFile(filename string, data []byte) (*ConfigProtectConfFile, error)

func LoadConfigProtectConfs

func LoadConfigProtectConfs(c *LuetConfig) error

func WithCompilerBackend

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

func WithConfig

func WithConfig(c *config.LuetConfig) func(cfg *RepositoryConfig) error

func WithDatabase

func WithDatabase(b pkg.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 ArtefactAction

type ArtefactAction struct {
	NewPackage *pkg.Package
	OldPackage *pkg.Package
}

type ArtifactMatch

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

type Client

type Client interface {
	DownloadArtifact(*artifact.PackageArtifact) (*artifact.PackageArtifact, error)
	DownloadFile(string) (string, 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(s *System) error

func (*LuetFinalizer) RunUnInstall

func (f *LuetFinalizer) RunUnInstall() error

TODO: We don't store uninstall finalizers ?!

type LuetInstaller

type LuetInstaller struct {
	PackageRepositories Repositories

	Options LuetInstallerOptions
}

func NewLuetInstaller

func NewLuetInstaller(opts LuetInstallerOptions) *LuetInstaller

func (*LuetInstaller) AreThereNotCachedRepos

func (l *LuetInstaller) AreThereNotCachedRepos() bool

func (*LuetInstaller) GetRepositoriesInstances

func (l *LuetInstaller) GetRepositoriesInstances(inMemory bool) (Repositories, error)

func (*LuetInstaller) Install

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

func (*LuetInstaller) LoadRepositories

func (l *LuetInstaller) LoadRepositories(inMemory bool) (Repositories, 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) Repositories

func (l *LuetInstaller) Repositories(r []*LuetSystemRepository)

func (*LuetInstaller) Swap

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

func (*LuetInstaller) SyncRepositories

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

func (*LuetInstaller) Uninstall

func (l *LuetInstaller) Uninstall(s *System, packs ...pkg.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                                                  config.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
	SkipFinalizers                                                 bool
	SyncRepositories                                               bool
}

type LuetRepositoryFile

type LuetRepositoryFile struct {
	FileName        string                     `json:"filename" yaml:"filename"`
	CompressionType compression.Implementation `json:"compressiontype,omitempty" yaml:"compressiontype,omitempty"`
	Checksums       artifact.Checksums         `json:"checksums,omitempty" yaml:"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() compression.Implementation

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 compression.Implementation)

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 {
	config.LuetRepository `yaml:",inline"`

	Index           compiler.ArtifactIndex        `json:"index" yaml:"index"`
	BuildTree, Tree tree.Builder                  `json:"-" yaml:"-"`
	RepositoryFiles map[string]LuetRepositoryFile `json:"repo_files" yaml:"repo_files"`
	Backend         compiler.CompilerBackend      `json:"-" yaml:"-"`
	PushImages      bool                          `json:"-" yaml:"-"`
	ForcePush       bool                          `json:"-" yaml:"-"`
	// 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 pkg.PackageDatabase) (*LuetSystemRepository, error)

func NewSystemRepository

func NewSystemRepository(repo config.LuetRepository) *LuetSystemRepository

func (*LuetSystemRepository) AddMetadata

func (r *LuetSystemRepository) AddMetadata(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() Client

func (*LuetSystemRepository) FileSearch

func (r *LuetSystemRepository) FileSearch(pattern string) (pkg.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) 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) Load

func (r *LuetSystemRepository) Load(alternativeRepoSpecfile, alternativeTreeFs, alternativeMetafs string) (*LuetSystemRepository, error)

func (*LuetSystemRepository) ReadSpecFile

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

func (*LuetSystemRepository) SearchArtefact

func (r *LuetSystemRepository) SearchArtefact(p pkg.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) SetRepositoryFile

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

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) String

func (r *LuetSystemRepository) String() string

func (*LuetSystemRepository) Sync

func (*LuetSystemRepository) SyncBuildMetadata

func (r *LuetSystemRepository) SyncBuildMetadata(path string) error

func (*LuetSystemRepository) Write

func (r *LuetSystemRepository) Write(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" yaml:"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  pkg.Package
}

type Repositories

type Repositories []*LuetSystemRepository

func SystemRepositories

func SystemRepositories(c *config.LuetConfig) Repositories

SystemRepositories returns the repositories from the local configuration file

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 pkg.Packages) []PackageMatch

func (Repositories) ResolveSelectors

func (re Repositories) ResolveSelectors(p pkg.Packages) pkg.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 pkg.PackageDatabase)

func (Repositories) World

func (r Repositories) World() pkg.Packages

type RepositoryConfig

type RepositoryConfig struct {
	Name, Description, Type string
	Urls                    []string
	Priority                int
	Src                     string
	Tree                    []string
	DB                      pkg.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, pkg.PackageDatabase) ([]*artifact.PackageArtifact, error)
}

type RepositoryOption

type RepositoryOption func(cfg *RepositoryConfig) error

type System

type System struct {
	Database pkg.PackageDatabase
	Target   string

	sync.Mutex
	// contains filtered or unexported fields
}

func (*System) Clean

func (s *System) Clean()

func (*System) ExecuteFinalizers

func (s *System) ExecuteFinalizers(packs []pkg.Package) error

func (*System) ExistsPackageFile

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

func (*System) World

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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