pkg

package
v0.35.5-geaaru Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: GPL-3.0 Imports: 30 Imported by: 3

Documentation

Overview

Copyright © 2022-2023 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022-2023 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022-2023 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Index

Constants

View Source
const (
	PackageMetaSuffix     = "metadata.yaml"
	PackageCollectionFile = "collection.yaml"
	PackageDefinitionFile = "definition.yaml"
)

Variables

View Source
var DBInMemoryInstance = &InMemoryDatabase{
	Mutex:             &sync.Mutex{},
	FileDatabase:      map[string][]string{},
	FinalizerDatabase: map[string]*PackageFinalizer{},
	Database:          map[string]string{},
	CacheNoVersion:    map[string]map[string]interface{}{},
	ProvidesDatabase:  map[string]map[string]Package{},
	RevDepsDatabase:   map[string]map[string]Package{},
	cached:            map[string]interface{}{},
}

Functions

func GetRawPackages

func GetRawPackages(yml []byte) (rawPackages, error)

func PackageThinIsInList

func PackageThinIsInList(p *PackageThin, list *[]*PackageThin) bool

func SortPackageThinList4Requires

func SortPackageThinList4Requires(list *[]*PackageThin)

Sort packages to have at the begin packages with zero or less requires and at the end the packages with more requires. If the number of requires are equal then it uses the PackageName() for sorting.

Types

type AnnotationKey

type AnnotationKey string
const (
	ConfigProtectAnnnotation AnnotationKey = "config_protect"
	SubsetsAnnotation        AnnotationKey = "subsets"
)

type BoltDatabase

type BoltDatabase struct {
	sync.Mutex
	Path             string
	ProvidesDatabase map[string]map[string]Package

	DB *storm.DB
}

func (*BoltDatabase) Clean

func (db *BoltDatabase) Clean() error

func (*BoltDatabase) Clone

func (db *BoltDatabase) Clone(to PackageDatabase) error

func (*BoltDatabase) Close

func (db *BoltDatabase) Close() error

func (*BoltDatabase) Copy

func (db *BoltDatabase) Copy() (PackageDatabase, error)

func (*BoltDatabase) Create

func (db *BoltDatabase) Create(id string, v []byte) (string, error)

func (*BoltDatabase) CreatePackage

func (db *BoltDatabase) CreatePackage(p Package) (string, error)

Encode encodes the package to string. It returns an ID which can be used to retrieve the package later on.

func (*BoltDatabase) FindPackage

func (db *BoltDatabase) FindPackage(tofind Package) (Package, error)

func (*BoltDatabase) FindPackageByFile

func (db *BoltDatabase) FindPackageByFile(pattern string) (Packages, error)

func (*BoltDatabase) FindPackageCandidate

func (db *BoltDatabase) FindPackageCandidate(p Package) (Package, error)

func (*BoltDatabase) FindPackageLabel

func (db *BoltDatabase) FindPackageLabel(labelKey string) (Packages, error)

func (*BoltDatabase) FindPackageLabelMatch

func (db *BoltDatabase) FindPackageLabelMatch(pattern string) (Packages, error)

func (*BoltDatabase) FindPackageMatch

func (db *BoltDatabase) FindPackageMatch(pattern string) (Packages, error)

func (*BoltDatabase) FindPackageVersions

func (db *BoltDatabase) FindPackageVersions(p Package) (Packages, error)

FindPackageVersions return the list of the packages beloging to cat/name

func (*BoltDatabase) FindPackages

func (db *BoltDatabase) FindPackages(p Package) (Packages, error)

FindPackages return the list of the packages beloging to cat/name (any versions in requested range) FIXME: Optimize, see inmemorydb

func (*BoltDatabase) Get

func (db *BoltDatabase) Get(s string) (string, error)

func (*BoltDatabase) GetAllPackages

func (db *BoltDatabase) GetAllPackages(packages chan Package) error

func (*BoltDatabase) GetPackage

func (db *BoltDatabase) GetPackage(ID string) (Package, error)

func (*BoltDatabase) GetPackageFiles

func (db *BoltDatabase) GetPackageFiles(p Package) ([]string, error)

func (*BoltDatabase) GetPackageFinalizer

func (db *BoltDatabase) GetPackageFinalizer(p Package) (*PackageFinalizer, error)

func (*BoltDatabase) GetPackages

func (db *BoltDatabase) GetPackages() []string

func (*BoltDatabase) GetRevdeps

func (db *BoltDatabase) GetRevdeps(p Package) (Packages, error)

GetRevdeps uses a new inmemory db to calcuate revdeps TODO: Have a memory instance for boltdb, so we don't compute each time we get called as this is REALLY expensive. But we don't perform usually those operations in a file db.

func (*BoltDatabase) RebuildIndexes

func (db *BoltDatabase) RebuildIndexes() error

func (*BoltDatabase) RemovePackage

func (db *BoltDatabase) RemovePackage(p Package) error

func (*BoltDatabase) RemovePackageFiles

func (db *BoltDatabase) RemovePackageFiles(p Package) error

func (*BoltDatabase) RemovePackageFinalizer

func (db *BoltDatabase) RemovePackageFinalizer(p Package) error

func (*BoltDatabase) Retrieve

func (db *BoltDatabase) Retrieve(ID string) ([]byte, error)

func (*BoltDatabase) Set

func (db *BoltDatabase) Set(k, v string) error

func (*BoltDatabase) SetPackageFiles

func (db *BoltDatabase) SetPackageFiles(p *PackageFile) error

func (*BoltDatabase) SetPackageFinalizer

func (db *BoltDatabase) SetPackageFinalizer(p *PackageFinalizer) error

func (*BoltDatabase) UpdatePackage

func (db *BoltDatabase) UpdatePackage(p Package) error

func (*BoltDatabase) World

func (db *BoltDatabase) World() Packages

type Collection

type Collection struct {
	Packages []DefaultPackage `json:"packages"`
}

type DefaultPackage

type DefaultPackage struct {
	ID               int               `storm:"id,increment" json:"id"` // primary key with auto increment
	Name             string            `json:"name"`                    // Affects YAML field names too.
	Version          string            `json:"version"`                 // Affects YAML field names too.
	Category         string            `json:"category"`                // Affects YAML field names too.
	UseFlags         []string          `json:"use_flags,omitempty"`     // Affects YAML field names too.
	State            State             `json:"state,omitempty"`
	PackageRequires  []*DefaultPackage `json:"requires"`           // Affects YAML field names too.
	PackageConflicts []*DefaultPackage `json:"conflicts"`          // Affects YAML field names too.
	Provides         []*DefaultPackage `json:"provides,omitempty"` // Affects YAML field names too.
	Hidden           bool              `json:"hidden,omitempty"`   // Affects YAML field names too.

	// Annotations are used for core features/options
	Annotations map[string]interface{} `json:"annotations,omitempty"` // Affects YAML field names too

	// Path is set only internally when tree is loaded from disk
	Path string `json:"path,omitempty"`

	Description    string   `json:"description,omitempty"`
	Uri            []string `json:"uri,omitempty"`
	License        string   `json:"license,omitempty"`
	BuildTimestamp string   `json:"buildtimestamp,omitempty"`

	Labels map[string]string `json:"labels,omitempty"` // Affects YAML field names too.

	TreeDir string `json:"treedir,omitempty"`

	Repository string `json:"repository,omitempty"`
}

DefaultPackage represent a standard package definition

func DefaultPackageFromYaml

func DefaultPackageFromYaml(yml []byte) (DefaultPackage, error)

>> Unmarshallers DefaultPackageFromYaml decodes a package from yaml bytes

func DefaultPackagesFromYAML

func DefaultPackagesFromYAML(yml []byte) ([]DefaultPackage, error)

func NewDefaultPackageFromYaml

func NewDefaultPackageFromYaml(data []byte) (*DefaultPackage, error)

func NewPackage

func NewPackage(name, version string, requires []*DefaultPackage, conflicts []*DefaultPackage) *DefaultPackage

NewPackage returns a new package

func NewPackageWithCat

func NewPackageWithCat(category, name, version string,
	requires []*DefaultPackage, conflicts []*DefaultPackage) *DefaultPackage

TODO: Permit to create a new package also with category.

func NewPackageWithCatThin

func NewPackageWithCatThin(category, name, version string) *DefaultPackage

func (*DefaultPackage) AddAnnotation

func (p *DefaultPackage) AddAnnotation(k string, v interface{})

func (*DefaultPackage) AddLabel

func (p *DefaultPackage) AddLabel(k, v string)

func (*DefaultPackage) AddURI

func (p *DefaultPackage) AddURI(s string)

func (*DefaultPackage) AddUse

func (p *DefaultPackage) AddUse(use string)

AddUse adds a use to a package

func (*DefaultPackage) Admit

func (p *DefaultPackage) Admit(a *DefaultPackage) (bool, error)

func (*DefaultPackage) AtomMatches

func (p *DefaultPackage) AtomMatches(m Package) bool

func (*DefaultPackage) BuildFormula

func (pack *DefaultPackage) BuildFormula(definitiondb PackageDatabase, db PackageDatabase) ([]bf.Formula, error)

func (*DefaultPackage) BumpBuildVersion

func (p *DefaultPackage) BumpBuildVersion() error

func (*DefaultPackage) Clone

func (p *DefaultPackage) Clone() Package

func (*DefaultPackage) Conflicts

func (p *DefaultPackage) Conflicts(req []*DefaultPackage) Package

func (*DefaultPackage) Encode

func (p *DefaultPackage) Encode(db PackageDatabase) (string, error)

Encode encodes the package to string. It returns an ID which can be used to retrieve the package later on.

func (*DefaultPackage) Expand

func (p *DefaultPackage) Expand(definitiondb PackageDatabase) (Packages, error)

func (*DefaultPackage) Explain

func (p *DefaultPackage) Explain()

func (*DefaultPackage) GetAnnotationByKey

func (p *DefaultPackage) GetAnnotationByKey(k string) (ans interface{})

func (*DefaultPackage) GetAnnotations

func (p *DefaultPackage) GetAnnotations() map[string]interface{}

func (*DefaultPackage) GetBuildTimestamp

func (p *DefaultPackage) GetBuildTimestamp() string

GetBuildTimestamp returns the package build timestamp

func (*DefaultPackage) GetCategory

func (p *DefaultPackage) GetCategory() string

func (*DefaultPackage) GetComparitionHash

func (p *DefaultPackage) GetComparitionHash() string

This method return an hash based on package name, version and his requires, conflicts that is used to identify eventually changes of the requirements of a package that is not rebumped.

func (*DefaultPackage) GetConflicts

func (p *DefaultPackage) GetConflicts() []*DefaultPackage

func (*DefaultPackage) GetDescription

func (p *DefaultPackage) GetDescription() string

func (*DefaultPackage) GetFingerPrint

func (p *DefaultPackage) GetFingerPrint() string

GetFingerPrint returns a UUID of the package. FIXME: this needs to be unique, now just name is generalized

func (*DefaultPackage) GetLabels

func (p *DefaultPackage) GetLabels() map[string]string

func (*DefaultPackage) GetLicense

func (p *DefaultPackage) GetLicense() string

func (*DefaultPackage) GetMetadataFilePath

func (d *DefaultPackage) GetMetadataFilePath() string

GetMetadataFilePath returns the canonical name of an artifact metadata file

func (*DefaultPackage) GetName

func (p *DefaultPackage) GetName() string

func (*DefaultPackage) GetPackageName

func (p *DefaultPackage) GetPackageName() string

func (*DefaultPackage) GetPath

func (p *DefaultPackage) GetPath() string

GetPath returns the path where the definition file was found

func (*DefaultPackage) GetProvidePackage

func (p *DefaultPackage) GetProvidePackage(pname string) *DefaultPackage

func (*DefaultPackage) GetProvides

func (p *DefaultPackage) GetProvides() []*DefaultPackage

func (*DefaultPackage) GetRepository

func (p *DefaultPackage) GetRepository() string

func (*DefaultPackage) GetRequires

func (p *DefaultPackage) GetRequires() []*DefaultPackage

func (*DefaultPackage) GetRuntimePackage

func (p *DefaultPackage) GetRuntimePackage() (*DefaultPackage, error)

func (*DefaultPackage) GetTreeDir

func (p *DefaultPackage) GetTreeDir() string

func (*DefaultPackage) GetURI

func (p *DefaultPackage) GetURI() []string

func (*DefaultPackage) GetUses

func (p *DefaultPackage) GetUses() []string

func (*DefaultPackage) GetVersion

func (p *DefaultPackage) GetVersion() string

func (*DefaultPackage) HasAnnotation

func (p *DefaultPackage) HasAnnotation(label string) bool

func (*DefaultPackage) HasLabel

func (p *DefaultPackage) HasLabel(label string) bool

func (*DefaultPackage) HasProvides

func (p *DefaultPackage) HasProvides() bool

func (DefaultPackage) HasRequires

func (d DefaultPackage) HasRequires() bool

func (*DefaultPackage) HashFingerprint

func (p *DefaultPackage) HashFingerprint(salt string) string

func (*DefaultPackage) HumanReadableString

func (p *DefaultPackage) HumanReadableString() string

func (*DefaultPackage) ImageID

func (p *DefaultPackage) ImageID() string

func (DefaultPackage) IsCollection

func (p DefaultPackage) IsCollection() bool

func (*DefaultPackage) IsHidden

func (p *DefaultPackage) IsHidden() bool

func (*DefaultPackage) IsSelector

func (p *DefaultPackage) IsSelector() bool

func (*DefaultPackage) JSON

func (t *DefaultPackage) JSON() ([]byte, error)

Major and minor gets escaped when marshalling in JSON, making compiler fails recognizing selectors for expansion

func (*DefaultPackage) LabelDeps

func (p *DefaultPackage) LabelDeps(definitiondb PackageDatabase, labelKey string) Packages

func (*DefaultPackage) Mark

func (p *DefaultPackage) Mark() Package

func (*DefaultPackage) MatchAnnotation

func (p *DefaultPackage) MatchAnnotation(r *regexp.Regexp) bool

func (*DefaultPackage) MatchLabel

func (p *DefaultPackage) MatchLabel(r *regexp.Regexp) bool

func (*DefaultPackage) Matches

func (p *DefaultPackage) Matches(m Package) bool

func (*DefaultPackage) PackageName

func (p *DefaultPackage) PackageName() string

func (*DefaultPackage) Rel

func (p *DefaultPackage) Rel(s string) string

func (*DefaultPackage) Related

func (p *DefaultPackage) Related(definitiondb PackageDatabase) Packages

func (*DefaultPackage) RemoveUse

func (p *DefaultPackage) RemoveUse(use string)

RemoveUse removes a use to a package

func (*DefaultPackage) Requires

func (p *DefaultPackage) Requires(req []*DefaultPackage) Package

func (*DefaultPackage) RequiresContains

func (pack *DefaultPackage) RequiresContains(definitiondb PackageDatabase, s Package) (bool, error)

RequiresContains recursively scans into the database packages dependencies to find a match with the given package It is used by the solver during uninstall.

func (*DefaultPackage) Revdeps

func (p *DefaultPackage) Revdeps(definitiondb PackageDatabase) Packages

func (*DefaultPackage) SelectorMatchVersion

func (p *DefaultPackage) SelectorMatchVersion(ver string, v version.Versioner) (bool, error)

func (*DefaultPackage) SetBuildTimestamp

func (p *DefaultPackage) SetBuildTimestamp(s string)

SetBuildTimestamp sets the package Build timestamp

func (*DefaultPackage) SetCategory

func (p *DefaultPackage) SetCategory(s string)

func (*DefaultPackage) SetDescription

func (p *DefaultPackage) SetDescription(s string)

func (*DefaultPackage) SetLicense

func (p *DefaultPackage) SetLicense(s string)

func (*DefaultPackage) SetName

func (p *DefaultPackage) SetName(s string)

func (*DefaultPackage) SetPath

func (p *DefaultPackage) SetPath(s string)

func (*DefaultPackage) SetProvides

func (p *DefaultPackage) SetProvides(req []*DefaultPackage) Package

func (*DefaultPackage) SetRepository

func (p *DefaultPackage) SetRepository(r string)

func (*DefaultPackage) SetTreeDir

func (p *DefaultPackage) SetTreeDir(s string)

func (*DefaultPackage) SetVersion

func (p *DefaultPackage) SetVersion(v string)

func (*DefaultPackage) String

func (p *DefaultPackage) String() string

func (*DefaultPackage) ToGentooPackage

func (p *DefaultPackage) ToGentooPackage() (*gentoo.GentooPackage, error)

func (*DefaultPackage) ToPackageThin

func (p *DefaultPackage) ToPackageThin() *PackageThin

func (*DefaultPackage) VersionMatchSelector

func (p *DefaultPackage) VersionMatchSelector(selector string, v version.Versioner) (bool, error)

func (*DefaultPackage) Yaml

func (p *DefaultPackage) Yaml() ([]byte, error)

type DefaultPackages

type DefaultPackages []*DefaultPackage

func (DefaultPackages) Hash

func (d DefaultPackages) Hash(salt string) string

type InMemoryDatabase

type InMemoryDatabase struct {
	*sync.Mutex
	Database          map[string]string
	FileDatabase      map[string][]string
	FinalizerDatabase map[string]*PackageFinalizer
	CacheNoVersion    map[string]map[string]interface{}
	ProvidesDatabase  map[string]map[string]Package
	RevDepsDatabase   map[string]map[string]Package
	// contains filtered or unexported fields
}

func (*InMemoryDatabase) Clean

func (db *InMemoryDatabase) Clean() error

func (*InMemoryDatabase) Clone

func (db *InMemoryDatabase) Clone(to PackageDatabase) error

func (*InMemoryDatabase) Close

func (db *InMemoryDatabase) Close() error

func (*InMemoryDatabase) Copy

func (db *InMemoryDatabase) Copy() (PackageDatabase, error)

func (*InMemoryDatabase) Create

func (db *InMemoryDatabase) Create(id string, v []byte) (string, error)

func (*InMemoryDatabase) CreatePackage

func (db *InMemoryDatabase) CreatePackage(p Package) (string, error)

Encode encodes the package to string. It returns an ID which can be used to retrieve the package later on.

func (*InMemoryDatabase) FindPackage

func (db *InMemoryDatabase) FindPackage(p Package) (Package, error)

func (*InMemoryDatabase) FindPackageByFile

func (db *InMemoryDatabase) FindPackageByFile(pattern string) (Packages, error)

func (*InMemoryDatabase) FindPackageCandidate

func (db *InMemoryDatabase) FindPackageCandidate(p Package) (Package, error)

func (*InMemoryDatabase) FindPackageLabel

func (db *InMemoryDatabase) FindPackageLabel(labelKey string) (Packages, error)

func (*InMemoryDatabase) FindPackageLabelMatch

func (db *InMemoryDatabase) FindPackageLabelMatch(pattern string) (Packages, error)

func (*InMemoryDatabase) FindPackageMatch

func (db *InMemoryDatabase) FindPackageMatch(pattern string) (Packages, error)

func (*InMemoryDatabase) FindPackageVersions

func (db *InMemoryDatabase) FindPackageVersions(p Package) (Packages, error)

FindPackages return the list of the packages beloging to cat/name

func (*InMemoryDatabase) FindPackages

func (db *InMemoryDatabase) FindPackages(p Package) (Packages, error)

FindPackages return the list of the packages beloging to cat/name (any versions in requested range)

func (*InMemoryDatabase) Get

func (db *InMemoryDatabase) Get(s string) (string, error)

func (*InMemoryDatabase) GetAllPackages

func (db *InMemoryDatabase) GetAllPackages(packages chan Package) error

func (*InMemoryDatabase) GetPackage

func (db *InMemoryDatabase) GetPackage(ID string) (Package, error)

func (*InMemoryDatabase) GetPackageFiles

func (db *InMemoryDatabase) GetPackageFiles(p Package) ([]string, error)

func (*InMemoryDatabase) GetPackageFinalizer

func (db *InMemoryDatabase) GetPackageFinalizer(p Package) (*PackageFinalizer, error)

func (*InMemoryDatabase) GetPackages

func (db *InMemoryDatabase) GetPackages() []string

func (*InMemoryDatabase) GetRevdeps

func (db *InMemoryDatabase) GetRevdeps(p Package) (Packages, error)

GetRevdeps returns the package reverse dependencies, matching also selectors in versions (>, <, >=, <=) TODO: Code should use db explictly

func (*InMemoryDatabase) RebuildIndexes

func (db *InMemoryDatabase) RebuildIndexes() error

func (*InMemoryDatabase) RemovePackage

func (db *InMemoryDatabase) RemovePackage(p Package) error

func (*InMemoryDatabase) RemovePackageFiles

func (db *InMemoryDatabase) RemovePackageFiles(p Package) error

func (*InMemoryDatabase) RemovePackageFinalizer

func (db *InMemoryDatabase) RemovePackageFinalizer(p Package) error

func (*InMemoryDatabase) Retrieve

func (db *InMemoryDatabase) Retrieve(ID string) ([]byte, error)

func (*InMemoryDatabase) Set

func (db *InMemoryDatabase) Set(k, v string) error

func (*InMemoryDatabase) SetPackageFiles

func (db *InMemoryDatabase) SetPackageFiles(p *PackageFile) error

func (*InMemoryDatabase) SetPackageFinalizer

func (db *InMemoryDatabase) SetPackageFinalizer(p *PackageFinalizer) error

func (*InMemoryDatabase) UpdatePackage

func (db *InMemoryDatabase) UpdatePackage(p Package) error

func (*InMemoryDatabase) World

func (db *InMemoryDatabase) World() Packages

type Package

type Package interface {
	Encode(PackageDatabase) (string, error)
	Related(definitiondb PackageDatabase) Packages

	BuildFormula(PackageDatabase, PackageDatabase) ([]bf.Formula, error)

	GetFingerPrint() string
	GetPackageName() string
	ImageID() string
	Requires([]*DefaultPackage) Package
	HasRequires() bool
	Conflicts([]*DefaultPackage) Package
	Revdeps(PackageDatabase) Packages
	LabelDeps(PackageDatabase, string) Packages

	GetProvides() []*DefaultPackage
	SetProvides([]*DefaultPackage) Package
	HasProvides() bool
	GetProvidePackage(string) *DefaultPackage

	GetRequires() []*DefaultPackage
	GetConflicts() []*DefaultPackage
	Expand(PackageDatabase) (Packages, error)
	SetCategory(string)

	GetName() string
	SetName(string)
	GetCategory() string
	PackageName() string

	GetVersion() string
	SetVersion(string)
	RequiresContains(PackageDatabase, Package) (bool, error)
	Matches(m Package) bool
	AtomMatches(m Package) bool
	BumpBuildVersion() error

	AddUse(use string)
	RemoveUse(use string)
	GetUses() []string

	Yaml() ([]byte, error)
	Explain()

	SetPath(string)
	GetPath() string
	Rel(string) string

	GetDescription() string
	SetDescription(string)

	AddURI(string)
	GetURI() []string

	SetLicense(string)
	GetLicense() string

	AddLabel(string, string)
	GetLabels() map[string]string
	HasLabel(string) bool
	MatchLabel(*regexp.Regexp) bool

	AddAnnotation(string, interface{})
	GetAnnotations() map[string]interface{}
	HasAnnotation(string) bool
	MatchAnnotation(*regexp.Regexp) bool
	GetAnnotationByKey(k string) interface{}

	IsHidden() bool
	IsSelector() bool
	VersionMatchSelector(string, version.Versioner) (bool, error)
	SelectorMatchVersion(string, version.Versioner) (bool, error)

	String() string
	HumanReadableString() string
	HashFingerprint(string) string

	SetBuildTimestamp(s string)
	GetBuildTimestamp() string

	Clone() Package

	GetMetadataFilePath() string
	SetTreeDir(s string)
	GetTreeDir() string

	Mark() Package

	JSON() ([]byte, error)

	GetRepository() string
	SetRepository(string)
}

Package is a package interface (TBD) FIXME: Currently some of the methods are returning DefaultPackages due to JSON serialization of the package

func DecodePackage

func DecodePackage(ID string, db PackageDatabase) (Package, error)

func FromString

func FromString(s string) Package

type PackageDatabase

type PackageDatabase interface {
	PackageSet

	Get(s string) (string, error)
	Set(k, v string) error

	Create(string, []byte) (string, error)
	Retrieve(ID string) ([]byte, error)

	Close() error
}

Database is a merely simple in-memory db. FIXME: Use a proper structure or delegate to third-party

func NewBoltDatabase

func NewBoltDatabase(path string) PackageDatabase

func NewInMemoryDatabase

func NewInMemoryDatabase(singleton bool) PackageDatabase

type PackageFile

type PackageFile struct {
	ID                 int    `storm:"id,increment"` // primary key with auto increment
	PackageFingerprint string `storm:"unique"`
	Files              []string
}

type PackageFinalizer

type PackageFinalizer struct {
	ID                 int      `storm:"id,increment"` // primary key with auto increment
	PackageFingerprint string   `storm:"unique"`
	Shell              []string `json:"shell,omitempty" yaml:"shell,omitempty"`
	Install            []string `json:"install,omitempty" yaml:"install,omitempty"`
	Uninstall          []string `json:"uninstall,omitempty" yaml:"uninstall,omitempty"`
}

type PackageMap

type PackageMap map[string]Package

func (PackageMap) String

func (pm PackageMap) String() string

type PackageSet

type PackageSet interface {
	Clone(PackageDatabase) error
	Copy() (PackageDatabase, error)

	GetRevdeps(p Package) (Packages, error)
	GetPackages() []string //Ids
	CreatePackage(pkg Package) (string, error)
	GetPackage(ID string) (Package, error)
	Clean() error
	FindPackage(Package) (Package, error)
	FindPackages(p Package) (Packages, error)
	UpdatePackage(p Package) error
	GetAllPackages(packages chan Package) error
	RemovePackage(Package) error

	GetPackageFiles(Package) ([]string, error)
	SetPackageFiles(*PackageFile) error
	RemovePackageFiles(Package) error
	FindPackageVersions(p Package) (Packages, error)
	World() Packages

	// Finalizers
	GetPackageFinalizer(Package) (*PackageFinalizer, error)
	SetPackageFinalizer(*PackageFinalizer) error
	RemovePackageFinalizer(Package) error

	FindPackageCandidate(p Package) (Package, error)
	FindPackageLabel(labelKey string) (Packages, error)
	FindPackageLabelMatch(pattern string) (Packages, error)
	FindPackageMatch(pattern string) (Packages, error)
	FindPackageByFile(pattern string) (Packages, error)

	RebuildIndexes() error
}

type PackageThin

type PackageThin struct {
	Name      string         `yaml:"name" json:"name"`
	Category  string         `yaml:"category" json:"category"`
	Version   string         `yaml:"version" json:"version"`
	Requires  []*PackageThin `yaml:"requires,omitempty" json:"requires,omitempty"`
	Conflicts []*PackageThin `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
	Provides  []*PackageThin `yaml:"provides,omitempty" json:"provides,omitempty"`
}

PackageThin is a thin representation of a package. Normally is used to sort packages.

func NewPackageThin

func NewPackageThin(name, cat, version string,
	requires, conflicts []*PackageThin) *PackageThin

func (*PackageThin) AtomMatches

func (p *PackageThin) AtomMatches(m *PackageThin) bool

func (*PackageThin) BreakCyclesOnRequires

func (p *PackageThin) BreakCyclesOnRequires(stack *[]*PackageThin)

func (*PackageThin) GenerateHash

func (p *PackageThin) GenerateHash() string

func (*PackageThin) GetCategory

func (p *PackageThin) GetCategory() string

func (*PackageThin) GetConflicts

func (p *PackageThin) GetConflicts() []*PackageThin

func (*PackageThin) GetName

func (p *PackageThin) GetName() string

func (*PackageThin) GetProvides

func (p *PackageThin) GetProvides() []*PackageThin

func (*PackageThin) GetRequires

func (p *PackageThin) GetRequires() []*PackageThin

func (*PackageThin) GetVersion

func (p *PackageThin) GetVersion() string

func (*PackageThin) HasConflicts

func (p *PackageThin) HasConflicts() bool

func (*PackageThin) HasProvides

func (p *PackageThin) HasProvides() bool

func (*PackageThin) HasRequires

func (p *PackageThin) HasRequires() bool

func (*PackageThin) HumanReadableString

func (p *PackageThin) HumanReadableString() string

func (*PackageThin) PackageName

func (p *PackageThin) PackageName() string

func (*PackageThin) RequirePackage

func (p *PackageThin) RequirePackage(m *PackageThin) bool

func (*PackageThin) String

func (p *PackageThin) String() string

func (*PackageThin) ToGentooPackage

func (p *PackageThin) ToGentooPackage() (*gentoo.GentooPackage, error)

type Packages

type Packages []Package

func (Packages) Best

func (set Packages) Best(v version.Versioner) Package

Best returns the best version of the package (the most bigger) from a list Accepts a versioner interface to change the ordering policy. If null is supplied It defaults to version.WrappedVersioner which supports both semver and debian versioning

func (Packages) Find

func (set Packages) Find(packageName string) (Package, error)

func (*Packages) ToMap

func (p *Packages) ToMap() *map[string]*DefaultPackage

func (Packages) Unique

func (set Packages) Unique() Packages

type PackagesMap

type PackagesMap map[string]*DefaultPackage

type PkgsList

type PkgsList struct {
	Packages []*DefaultPackage `json:"packages" yaml:"packages"`
}

func NewPkgsList

func NewPkgsList(list *[]*DefaultPackage) *PkgsList

type PkgsMapList

type PkgsMapList struct {
	Packages map[string][]*DefaultPackage `json:"packages_map" yaml:"packages_map"`
}

func NewPkgsMapList

func NewPkgsMapList() *PkgsMapList

func (*PkgsMapList) Add

func (pm *PkgsMapList) Add(k string, p *DefaultPackage)

type State

type State string

State represent the package state

type Tree

type Tree interface {
	GetPackageSet() PackageDatabase
	Prelude() string // A tree might have a prelude to be able to consume a tree
	SetPackageSet(s PackageDatabase)
	World() (Packages, error)
	FindPackage(Package) (Package, error)
}

Jump to

Keyboard shortcuts

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