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 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.
Index ¶
- Constants
- Variables
- func GetRawPackages(yml []byte) (rawPackages, error)
- type AnnotationKey
- type BoltDatabase
- func (db *BoltDatabase) Clean() error
- func (db *BoltDatabase) Clone(to PackageDatabase) error
- func (db *BoltDatabase) Close() error
- func (db *BoltDatabase) Copy() (PackageDatabase, error)
- func (db *BoltDatabase) Create(id string, v []byte) (string, error)
- func (db *BoltDatabase) CreatePackage(p Package) (string, error)
- func (db *BoltDatabase) FindPackage(tofind Package) (Package, error)
- func (db *BoltDatabase) FindPackageByFile(pattern string) (Packages, error)
- func (db *BoltDatabase) FindPackageCandidate(p Package) (Package, error)
- func (db *BoltDatabase) FindPackageLabel(labelKey string) (Packages, error)
- func (db *BoltDatabase) FindPackageLabelMatch(pattern string) (Packages, error)
- func (db *BoltDatabase) FindPackageMatch(pattern string) (Packages, error)
- func (db *BoltDatabase) FindPackageVersions(p Package) (Packages, error)
- func (db *BoltDatabase) FindPackages(p Package) (Packages, error)
- func (db *BoltDatabase) Get(s string) (string, error)
- func (db *BoltDatabase) GetAllPackages(packages chan Package) error
- func (db *BoltDatabase) GetPackage(ID string) (Package, error)
- func (db *BoltDatabase) GetPackageFiles(p Package) ([]string, error)
- func (db *BoltDatabase) GetPackageFinalizer(p Package) (*PackageFinalizer, error)
- func (db *BoltDatabase) GetPackages() []string
- func (db *BoltDatabase) GetRevdeps(p Package) (Packages, error)
- func (db *BoltDatabase) RebuildIndexes() error
- func (db *BoltDatabase) RemovePackage(p Package) error
- func (db *BoltDatabase) RemovePackageFiles(p Package) error
- func (db *BoltDatabase) RemovePackageFinalizer(p Package) error
- func (db *BoltDatabase) Retrieve(ID string) ([]byte, error)
- func (db *BoltDatabase) Set(k, v string) error
- func (db *BoltDatabase) SetPackageFiles(p *PackageFile) error
- func (db *BoltDatabase) SetPackageFinalizer(p *PackageFinalizer) error
- func (db *BoltDatabase) UpdatePackage(p Package) error
- func (db *BoltDatabase) World() Packages
- type Collection
- type DefaultPackage
- func DefaultPackageFromYaml(yml []byte) (DefaultPackage, error)
- func DefaultPackagesFromYAML(yml []byte) ([]DefaultPackage, error)
- func NewDefaultPackageFromYaml(data []byte) (*DefaultPackage, error)
- func NewPackage(name, version string, requires []*DefaultPackage, conflicts []*DefaultPackage) *DefaultPackage
- func NewPackageWithCat(category, name, version string, requires []*DefaultPackage, ...) *DefaultPackage
- func NewPackageWithCatThin(category, name, version string) *DefaultPackage
- func (p *DefaultPackage) AddAnnotation(k string, v interface{})
- func (p *DefaultPackage) AddLabel(k, v string)
- func (p *DefaultPackage) AddURI(s string)
- func (p *DefaultPackage) AddUse(use string)
- func (p *DefaultPackage) Admit(a *DefaultPackage) (bool, error)
- func (p *DefaultPackage) AtomMatches(m Package) bool
- func (pack *DefaultPackage) BuildFormula(definitiondb PackageDatabase, db PackageDatabase) ([]bf.Formula, error)
- func (p *DefaultPackage) BumpBuildVersion() error
- func (p *DefaultPackage) Clone() Package
- func (p *DefaultPackage) Conflicts(req []*DefaultPackage) Package
- func (p *DefaultPackage) Encode(db PackageDatabase) (string, error)
- func (p *DefaultPackage) Expand(definitiondb PackageDatabase) (Packages, error)
- func (p *DefaultPackage) Explain()
- func (p *DefaultPackage) GetAnnotationByKey(k string) (ans interface{})
- func (p *DefaultPackage) GetAnnotations() map[string]interface{}
- func (p *DefaultPackage) GetBuildTimestamp() string
- func (p *DefaultPackage) GetCategory() string
- func (p *DefaultPackage) GetComparitionHash() string
- func (p *DefaultPackage) GetConflicts() []*DefaultPackage
- func (p *DefaultPackage) GetDescription() string
- func (p *DefaultPackage) GetFingerPrint() string
- func (p *DefaultPackage) GetLabels() map[string]string
- func (p *DefaultPackage) GetLicense() string
- func (d *DefaultPackage) GetMetadataFilePath() string
- func (p *DefaultPackage) GetName() string
- func (p *DefaultPackage) GetPackageName() string
- func (p *DefaultPackage) GetPath() string
- func (p *DefaultPackage) GetProvidePackage(pname string) *DefaultPackage
- func (p *DefaultPackage) GetProvides() []*DefaultPackage
- func (p *DefaultPackage) GetRepository() string
- func (p *DefaultPackage) GetRequires() []*DefaultPackage
- func (p *DefaultPackage) GetRuntimePackage() (*DefaultPackage, error)
- func (p *DefaultPackage) GetTreeDir() string
- func (p *DefaultPackage) GetURI() []string
- func (p *DefaultPackage) GetUses() []string
- func (p *DefaultPackage) GetVersion() string
- func (p *DefaultPackage) HasAnnotation(label string) bool
- func (p *DefaultPackage) HasLabel(label string) bool
- func (p *DefaultPackage) HasProvides() bool
- func (d DefaultPackage) HasRequires() bool
- func (p *DefaultPackage) HashFingerprint(salt string) string
- func (p *DefaultPackage) HumanReadableString() string
- func (p *DefaultPackage) ImageID() string
- func (p DefaultPackage) IsCollection() bool
- func (p *DefaultPackage) IsHidden() bool
- func (p *DefaultPackage) IsSelector() bool
- func (t *DefaultPackage) JSON() ([]byte, error)
- func (p *DefaultPackage) LabelDeps(definitiondb PackageDatabase, labelKey string) Packages
- func (p *DefaultPackage) Mark() Package
- func (p *DefaultPackage) MatchAnnotation(r *regexp.Regexp) bool
- func (p *DefaultPackage) MatchLabel(r *regexp.Regexp) bool
- func (p *DefaultPackage) Matches(m Package) bool
- func (p *DefaultPackage) PackageName() string
- func (p *DefaultPackage) Rel(s string) string
- func (p *DefaultPackage) Related(definitiondb PackageDatabase) Packages
- func (p *DefaultPackage) RemoveUse(use string)
- func (p *DefaultPackage) Requires(req []*DefaultPackage) Package
- func (pack *DefaultPackage) RequiresContains(definitiondb PackageDatabase, s Package) (bool, error)
- func (p *DefaultPackage) Revdeps(definitiondb PackageDatabase) Packages
- func (p *DefaultPackage) SelectorMatchVersion(ver string, v version.Versioner) (bool, error)
- func (p *DefaultPackage) SetBuildTimestamp(s string)
- func (p *DefaultPackage) SetCategory(s string)
- func (p *DefaultPackage) SetDescription(s string)
- func (p *DefaultPackage) SetLicense(s string)
- func (p *DefaultPackage) SetName(s string)
- func (p *DefaultPackage) SetPath(s string)
- func (p *DefaultPackage) SetProvides(req []*DefaultPackage) Package
- func (p *DefaultPackage) SetRepository(r string)
- func (p *DefaultPackage) SetTreeDir(s string)
- func (p *DefaultPackage) SetVersion(v string)
- func (p *DefaultPackage) String() string
- func (p *DefaultPackage) ToGentooPackage() (*gentoo.GentooPackage, error)
- func (p *DefaultPackage) ToPackageThin() *PackageThin
- func (p *DefaultPackage) VersionMatchSelector(selector string, v version.Versioner) (bool, error)
- func (p *DefaultPackage) Yaml() ([]byte, error)
- type DefaultPackages
- type InMemoryDatabase
- func (db *InMemoryDatabase) Clean() error
- func (db *InMemoryDatabase) Clone(to PackageDatabase) error
- func (db *InMemoryDatabase) Close() error
- func (db *InMemoryDatabase) Copy() (PackageDatabase, error)
- func (db *InMemoryDatabase) Create(id string, v []byte) (string, error)
- func (db *InMemoryDatabase) CreatePackage(p Package) (string, error)
- func (db *InMemoryDatabase) FindPackage(p Package) (Package, error)
- func (db *InMemoryDatabase) FindPackageByFile(pattern string) (Packages, error)
- func (db *InMemoryDatabase) FindPackageCandidate(p Package) (Package, error)
- func (db *InMemoryDatabase) FindPackageLabel(labelKey string) (Packages, error)
- func (db *InMemoryDatabase) FindPackageLabelMatch(pattern string) (Packages, error)
- func (db *InMemoryDatabase) FindPackageMatch(pattern string) (Packages, error)
- func (db *InMemoryDatabase) FindPackageVersions(p Package) (Packages, error)
- func (db *InMemoryDatabase) FindPackages(p Package) (Packages, error)
- func (db *InMemoryDatabase) Get(s string) (string, error)
- func (db *InMemoryDatabase) GetAllPackages(packages chan Package) error
- func (db *InMemoryDatabase) GetPackage(ID string) (Package, error)
- func (db *InMemoryDatabase) GetPackageFiles(p Package) ([]string, error)
- func (db *InMemoryDatabase) GetPackageFinalizer(p Package) (*PackageFinalizer, error)
- func (db *InMemoryDatabase) GetPackages() []string
- func (db *InMemoryDatabase) GetRevdeps(p Package) (Packages, error)
- func (db *InMemoryDatabase) RebuildIndexes() error
- func (db *InMemoryDatabase) RemovePackage(p Package) error
- func (db *InMemoryDatabase) RemovePackageFiles(p Package) error
- func (db *InMemoryDatabase) RemovePackageFinalizer(p Package) error
- func (db *InMemoryDatabase) Retrieve(ID string) ([]byte, error)
- func (db *InMemoryDatabase) Set(k, v string) error
- func (db *InMemoryDatabase) SetPackageFiles(p *PackageFile) error
- func (db *InMemoryDatabase) SetPackageFinalizer(p *PackageFinalizer) error
- func (db *InMemoryDatabase) UpdatePackage(p Package) error
- func (db *InMemoryDatabase) World() Packages
- type Package
- type PackageDatabase
- type PackageFile
- type PackageFinalizer
- type PackageMap
- type PackageSet
- type PackageThin
- func (p *PackageThin) AtomMatches(m *PackageThin) bool
- func (p *PackageThin) GenerateHash() string
- func (p *PackageThin) GetCategory() string
- func (p *PackageThin) GetConflicts() []*PackageThin
- func (p *PackageThin) GetName() string
- func (p *PackageThin) GetProvides() []*PackageThin
- func (p *PackageThin) GetRequires() []*PackageThin
- func (p *PackageThin) GetVersion() string
- func (p *PackageThin) HasConflicts() bool
- func (p *PackageThin) HasProvides() bool
- func (p *PackageThin) HasRequires() bool
- func (p *PackageThin) HumanReadableString() string
- func (p *PackageThin) PackageName() string
- func (p *PackageThin) RequirePackage(m *PackageThin) bool
- func (p *PackageThin) ToGentooPackage() (*gentoo.GentooPackage, error)
- type Packages
- type PackagesMap
- type PkgsMapList
- type State
- type Tree
Constants ¶
const ( PackageMetaSuffix = "metadata.yaml" PackageCollectionFile = "collection.yaml" PackageDefinitionFile = "definition.yaml" )
Variables ¶
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 ¶
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) 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) 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) 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 (*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 (*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) 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) 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 ¶
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 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 ¶
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) 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) ToGentooPackage ¶
func (p *PackageThin) ToGentooPackage() (*gentoo.GentooPackage, error)
type Packages ¶
type Packages []Package
func (Packages) Best ¶
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) ToMap ¶
func (p *Packages) ToMap() *map[string]*DefaultPackage
type PackagesMap ¶
type PackagesMap map[string]*DefaultPackage
type PkgsMapList ¶
type PkgsMapList struct {
Packages map[string][]*DefaultPackage
}
func NewPkgsMapList ¶
func NewPkgsMapList() *PkgsMapList
func (*PkgsMapList) Add ¶
func (pm *PkgsMapList) Add(k string, p *DefaultPackage)
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) }