Documentation ¶
Overview ¶
Package deb implements Debian-specific repository handling
Index ¶
- Constants
- Variables
- func CompareVersions(ver1, ver2 string) int
- func FilterLatestRefs(r *PackageRefList)
- func ParsePPA(ppaURL string, config *utils.ConfigStructure) (url string, distribution string, components []string, err error)
- type AndQuery
- type CollectionFactory
- func (factory *CollectionFactory) LocalRepoCollection() *LocalRepoCollection
- func (factory *CollectionFactory) PackageCollection() *PackageCollection
- func (factory *CollectionFactory) PublishedRepoCollection() *PublishedRepoCollection
- func (factory *CollectionFactory) RemoteRepoCollection() *RemoteRepoCollection
- func (factory *CollectionFactory) SnapshotCollection() *SnapshotCollection
- type ControlFileReader
- type Dependency
- type DependencyQuery
- type FieldQuery
- type LocalRepo
- func (repo *LocalRepo) Decode(input []byte) error
- func (repo *LocalRepo) Encode() []byte
- func (repo *LocalRepo) Key() []byte
- func (repo *LocalRepo) NumPackages() int
- func (repo *LocalRepo) RefKey() []byte
- func (repo *LocalRepo) RefList() *PackageRefList
- func (repo *LocalRepo) String() string
- func (repo *LocalRepo) UpdateRefList(reflist *PackageRefList)
- type LocalRepoCollection
- func (collection *LocalRepoCollection) Add(repo *LocalRepo) error
- func (collection *LocalRepoCollection) ByName(name string) (*LocalRepo, error)
- func (collection *LocalRepoCollection) ByUUID(uuid string) (*LocalRepo, error)
- func (collection *LocalRepoCollection) Drop(repo *LocalRepo) error
- func (collection *LocalRepoCollection) ForEach(handler func(*LocalRepo) error) error
- func (collection *LocalRepoCollection) Len() int
- func (collection *LocalRepoCollection) LoadComplete(repo *LocalRepo) error
- func (collection *LocalRepoCollection) Update(repo *LocalRepo) error
- type NotQuery
- type OrQuery
- type Package
- func (p *Package) Deps() *PackageDependencies
- func (p *Package) DownloadList(packagePool aptly.PackagePool) (result []PackageDownloadTask, err error)
- func (p *Package) Equals(p2 *Package) bool
- func (p *Package) Extra() Stanza
- func (p *Package) FilepathList(packagePool aptly.PackagePool) ([]string, error)
- func (p *Package) Files() PackageFiles
- func (p *Package) GetDependencies(options int) (dependencies []string)
- func (p *Package) GetField(name string) string
- func (p *Package) Key(prefix string) []byte
- func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool, ...) error
- func (p *Package) MatchesArchitecture(arch string) bool
- func (p *Package) MatchesDependency(dep Dependency) bool
- func (p *Package) PoolDirectory() (string, error)
- func (p *Package) ShortKey(prefix string) []byte
- func (p *Package) Stanza() (result Stanza)
- func (p *Package) String() string
- func (p *Package) UpdateFiles(files PackageFiles)
- func (p *Package) VerifyFiles(packagePool aptly.PackagePool) (result bool, err error)
- type PackageCollection
- type PackageDependencies
- type PackageDiff
- type PackageDiffs
- type PackageDownloadTask
- type PackageFile
- type PackageFiles
- type PackageList
- func (l *PackageList) Add(p *Package) error
- func (l *PackageList) Append(pl *PackageList) error
- func (l *PackageList) Architectures(includeSource bool) (result []string)
- func (l *PackageList) Filter(queries []PackageQuery, withDependencies bool, source *PackageList, ...) (*PackageList, error)
- func (l *PackageList) ForEach(handler func(*Package) error) error
- func (l *PackageList) ForEachIndexed(handler func(*Package) error) error
- func (l *PackageList) Len() int
- func (l *PackageList) Less(i, j int) bool
- func (l *PackageList) PrepareIndex()
- func (l *PackageList) Remove(p *Package)
- func (l *PackageList) Scan(q PackageQuery) (result *PackageList)
- func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*Package)
- func (l *PackageList) Swap(i, j int)
- func (l *PackageList) VerifyDependencies(options int, architectures []string, sources *PackageList, ...) ([]Dependency, error)
- type PackageQuery
- type PackageRefList
- func (l *PackageRefList) Decode(input []byte) error
- func (l *PackageRefList) Diff(r *PackageRefList, packageCollection *PackageCollection) (result PackageDiffs, err error)
- func (l *PackageRefList) Encode() []byte
- func (l *PackageRefList) ForEach(handler func([]byte) error) error
- func (l *PackageRefList) Len() int
- func (l *PackageRefList) Less(i, j int) bool
- func (l *PackageRefList) Merge(r *PackageRefList, overrideMatching bool) (result *PackageRefList)
- func (l *PackageRefList) Substract(r *PackageRefList) *PackageRefList
- func (l *PackageRefList) Swap(i, j int)
- type PkgQuery
- type PublishedRepo
- func (p *PublishedRepo) Components() []string
- func (p *PublishedRepo) Decode(input []byte) error
- func (p *PublishedRepo) Encode() []byte
- func (p *PublishedRepo) GetLabel() string
- func (p *PublishedRepo) GetOrigin() string
- func (p *PublishedRepo) Key() []byte
- func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, ...) error
- func (p *PublishedRepo) RefKey(component string) []byte
- func (p *PublishedRepo) RefList(component string) *PackageRefList
- func (p *PublishedRepo) RemoveFiles(publishedStorageProvider aptly.PublishedStorageProvider, removePrefix bool, ...) error
- func (p *PublishedRepo) StoragePrefix() string
- func (p *PublishedRepo) String() string
- func (p *PublishedRepo) UpdateLocalRepo(component string)
- func (p *PublishedRepo) UpdateSnapshot(component string, snapshot *Snapshot)
- type PublishedRepoCollection
- func (collection *PublishedRepoCollection) Add(repo *PublishedRepo) error
- func (collection *PublishedRepoCollection) ByLocalRepo(repo *LocalRepo) []*PublishedRepo
- func (collection *PublishedRepoCollection) BySnapshot(snapshot *Snapshot) []*PublishedRepo
- func (collection *PublishedRepoCollection) ByStoragePrefixDistribution(storage, prefix, distribution string) (*PublishedRepo, error)
- func (collection *PublishedRepoCollection) ByUUID(uuid string) (*PublishedRepo, error)
- func (collection *PublishedRepoCollection) CheckDuplicate(repo *PublishedRepo) *PublishedRepo
- func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(prefix string, components []string, publishedStorage aptly.PublishedStorage, ...) error
- func (collection *PublishedRepoCollection) ForEach(handler func(*PublishedRepo) error) error
- func (collection *PublishedRepoCollection) Len() int
- func (collection *PublishedRepoCollection) LoadComplete(repo *PublishedRepo, collectionFactory *CollectionFactory) (err error)
- func (collection *PublishedRepoCollection) Remove(publishedStorageProvider aptly.PublishedStorageProvider, ...) error
- func (collection *PublishedRepoCollection) Update(repo *PublishedRepo) (err error)
- type RemoteRepo
- func (repo *RemoteRepo) BinaryURL(component string, architecture string) *url.URL
- func (repo *RemoteRepo) Decode(input []byte) error
- func (repo *RemoteRepo) Download(progress aptly.Progress, d aptly.Downloader, ...) error
- func (repo *RemoteRepo) Encode() []byte
- func (repo *RemoteRepo) Fetch(d aptly.Downloader, verifier utils.Verifier) error
- func (repo *RemoteRepo) FlatBinaryURL() *url.URL
- func (repo *RemoteRepo) FlatSourcesURL() *url.URL
- func (repo *RemoteRepo) IsFlat() bool
- func (repo *RemoteRepo) Key() []byte
- func (repo *RemoteRepo) NumPackages() int
- func (repo *RemoteRepo) PackageURL(filename string) *url.URL
- func (repo *RemoteRepo) RefKey() []byte
- func (repo *RemoteRepo) RefList() *PackageRefList
- func (repo *RemoteRepo) ReleaseURL(name string) *url.URL
- func (repo *RemoteRepo) SourcesURL(component string) *url.URL
- func (repo *RemoteRepo) String() string
- type RemoteRepoCollection
- func (collection *RemoteRepoCollection) Add(repo *RemoteRepo) error
- func (collection *RemoteRepoCollection) ByName(name string) (*RemoteRepo, error)
- func (collection *RemoteRepoCollection) ByUUID(uuid string) (*RemoteRepo, error)
- func (collection *RemoteRepoCollection) Drop(repo *RemoteRepo) error
- func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo) error) error
- func (collection *RemoteRepoCollection) Len() int
- func (collection *RemoteRepoCollection) LoadComplete(repo *RemoteRepo) error
- func (collection *RemoteRepoCollection) Update(repo *RemoteRepo) error
- type Snapshot
- func NewSnapshotFromLocalRepo(name string, repo *LocalRepo) (*Snapshot, error)
- func NewSnapshotFromPackageList(name string, sources []*Snapshot, list *PackageList, description string) *Snapshot
- func NewSnapshotFromRefList(name string, sources []*Snapshot, list *PackageRefList, description string) *Snapshot
- func NewSnapshotFromRepository(name string, repo *RemoteRepo) (*Snapshot, error)
- type SnapshotCollection
- func (collection *SnapshotCollection) Add(snapshot *Snapshot) error
- func (collection *SnapshotCollection) ByLocalRepoSource(repo *LocalRepo) []*Snapshot
- func (collection *SnapshotCollection) ByName(name string) (*Snapshot, error)
- func (collection *SnapshotCollection) ByRemoteRepoSource(repo *RemoteRepo) []*Snapshot
- func (collection *SnapshotCollection) BySnapshotSource(snapshot *Snapshot) []*Snapshot
- func (collection *SnapshotCollection) ByUUID(uuid string) (*Snapshot, error)
- func (collection *SnapshotCollection) Drop(snapshot *Snapshot) error
- func (collection *SnapshotCollection) ForEach(handler func(*Snapshot) error) error
- func (collection *SnapshotCollection) Len() int
- func (collection *SnapshotCollection) LoadComplete(snapshot *Snapshot) error
- func (collection *SnapshotCollection) Update(snapshot *Snapshot) error
- type Stanza
Constants ¶
const ( // DepFollowSource pulls source packages when required DepFollowSource = 1 << iota // DepFollowSuggests pulls from suggests DepFollowSuggests // DepFollowRecommends pulls from recommends DepFollowRecommends // DepFollowAllVariants follows all variants if depends on "a | b" DepFollowAllVariants // DepFollowBuild pulls build dependencies DepFollowBuild )
Dependency options
const ( VersionDontCare = iota VersionLess VersionLessOrEqual VersionEqual VersionGreaterOrEqual VersionGreater VersionPatternMatch VersionRegexp )
Version relations
Variables ¶
var (
ErrMalformedStanza = errors.New("malformed stanza syntax")
)
Parsing errors
Functions ¶
func CompareVersions ¶
CompareVersions compares two package versions
func FilterLatestRefs ¶
func FilterLatestRefs(r *PackageRefList)
FilterLatestRefs takes in a reflist with potentially multiples of the same packages and reduces it to only the latest of each package. The operations are done in-place. This implements a "latest wins" approach which can be used while merging two or more snapshots together.
Types ¶
type AndQuery ¶ added in v0.7.1
type AndQuery struct {
L, R PackageQuery
}
AndQuery is L , R
func (*AndQuery) Query ¶ added in v0.7.1
func (q *AndQuery) Query(list *PackageList) (result *PackageList)
Query strategy depends on nodes
type CollectionFactory ¶
type CollectionFactory struct {
// contains filtered or unexported fields
}
CollectionFactory is a single place to generate all desired collections
func NewCollectionFactory ¶
func NewCollectionFactory(db database.Storage) *CollectionFactory
NewCollectionFactory creates new factory
func (*CollectionFactory) LocalRepoCollection ¶
func (factory *CollectionFactory) LocalRepoCollection() *LocalRepoCollection
LocalRepoCollection returns (or creates) new LocalRepoCollection
func (*CollectionFactory) PackageCollection ¶
func (factory *CollectionFactory) PackageCollection() *PackageCollection
PackageCollection returns (or creates) new PackageCollection
func (*CollectionFactory) PublishedRepoCollection ¶
func (factory *CollectionFactory) PublishedRepoCollection() *PublishedRepoCollection
PublishedRepoCollection returns (or creates) new PublishedRepoCollection
func (*CollectionFactory) RemoteRepoCollection ¶
func (factory *CollectionFactory) RemoteRepoCollection() *RemoteRepoCollection
RemoteRepoCollection returns (or creates) new RemoteRepoCollection
func (*CollectionFactory) SnapshotCollection ¶
func (factory *CollectionFactory) SnapshotCollection() *SnapshotCollection
SnapshotCollection returns (or creates) new SnapshotCollection
type ControlFileReader ¶
type ControlFileReader struct {
// contains filtered or unexported fields
}
ControlFileReader implements reading of control files stanza by stanza
func NewControlFileReader ¶
func NewControlFileReader(r io.Reader) *ControlFileReader
NewControlFileReader creates ControlFileReader, it wraps with buffering
func (*ControlFileReader) ReadStanza ¶
func (c *ControlFileReader) ReadStanza() (Stanza, error)
ReadStanza reeads one stanza from control file
type Dependency ¶
type Dependency struct { Pkg string Relation int Version string Architecture string Regexp *regexp.Regexp }
Dependency is a parsed version of Debian dependency to package
func ParseDependency ¶
func ParseDependency(dep string) (d Dependency, err error)
ParseDependency parses dependency in format "pkg (>= 1.35) [arch]" into parts
func ParseDependencyVariants ¶
func ParseDependencyVariants(variants string) (l []Dependency, err error)
ParseDependencyVariants parses dependencies in format "pkg (>= 1.35) | other-package"
func (*Dependency) Hash ¶
func (d *Dependency) Hash() string
Hash calculates some predefined unique ID of Dependency
func (*Dependency) String ¶
func (d *Dependency) String() string
String produces human-readable representation
type DependencyQuery ¶ added in v0.7.1
type DependencyQuery struct {
Dep Dependency
}
DependencyQuery is generic Debian-dependency like query
func (*DependencyQuery) Fast ¶ added in v0.7.1
func (q *DependencyQuery) Fast() bool
Fast is always true for dependency query
func (*DependencyQuery) Matches ¶ added in v0.7.1
func (q *DependencyQuery) Matches(pkg *Package) bool
Matches on dependency condition
func (*DependencyQuery) Query ¶ added in v0.7.1
func (q *DependencyQuery) Query(list *PackageList) (result *PackageList)
Query runs PackageList.Search
func (*DependencyQuery) String ¶ added in v0.7.1
func (q *DependencyQuery) String() string
String interface
type FieldQuery ¶ added in v0.7.1
FieldQuery is generic request against field
func (*FieldQuery) Fast ¶ added in v0.7.1
func (q *FieldQuery) Fast() bool
Fast depends on the query
func (*FieldQuery) Matches ¶ added in v0.7.1
func (q *FieldQuery) Matches(pkg *Package) bool
Matches on generic field
func (*FieldQuery) Query ¶ added in v0.7.1
func (q *FieldQuery) Query(list *PackageList) (result *PackageList)
Query runs iteration through list
type LocalRepo ¶
type LocalRepo struct { // Permanent internal ID UUID string // User-assigned name Name string // Comment Comment string // DefaultDistribution DefaultDistribution string `codec:",omitempty"` // DefaultComponent DefaultComponent string `codec:",omitempty"` // contains filtered or unexported fields }
LocalRepo is a collection of packages created locally
func NewLocalRepo ¶
NewLocalRepo creates new instance of Debian local repository
func (*LocalRepo) NumPackages ¶
NumPackages return number of packages in local repo
func (*LocalRepo) RefList ¶
func (repo *LocalRepo) RefList() *PackageRefList
RefList returns package list for repo
func (*LocalRepo) UpdateRefList ¶
func (repo *LocalRepo) UpdateRefList(reflist *PackageRefList)
UpdateRefList changes package list for local repo
type LocalRepoCollection ¶
type LocalRepoCollection struct {
// contains filtered or unexported fields
}
LocalRepoCollection does listing, updating/adding/deleting of LocalRepos
func NewLocalRepoCollection ¶
func NewLocalRepoCollection(db database.Storage) *LocalRepoCollection
NewLocalRepoCollection loads LocalRepos from DB and makes up collection
func (*LocalRepoCollection) Add ¶
func (collection *LocalRepoCollection) Add(repo *LocalRepo) error
Add appends new repo to collection and saves it
func (*LocalRepoCollection) ByName ¶
func (collection *LocalRepoCollection) ByName(name string) (*LocalRepo, error)
ByName looks up repository by name
func (*LocalRepoCollection) ByUUID ¶
func (collection *LocalRepoCollection) ByUUID(uuid string) (*LocalRepo, error)
ByUUID looks up repository by uuid
func (*LocalRepoCollection) Drop ¶
func (collection *LocalRepoCollection) Drop(repo *LocalRepo) error
Drop removes remote repo from collection
func (*LocalRepoCollection) ForEach ¶
func (collection *LocalRepoCollection) ForEach(handler func(*LocalRepo) error) error
ForEach runs method for each repository
func (*LocalRepoCollection) Len ¶
func (collection *LocalRepoCollection) Len() int
Len returns number of remote repos
func (*LocalRepoCollection) LoadComplete ¶
func (collection *LocalRepoCollection) LoadComplete(repo *LocalRepo) error
LoadComplete loads additional information for local repo
func (*LocalRepoCollection) Update ¶
func (collection *LocalRepoCollection) Update(repo *LocalRepo) error
Update stores updated information about repo in DB
type NotQuery ¶ added in v0.7.1
type NotQuery struct {
Q PackageQuery
}
NotQuery is ! Q
func (*NotQuery) Query ¶ added in v0.7.1
func (q *NotQuery) Query(list *PackageList) (result *PackageList)
Query strategy is scan always
type OrQuery ¶ added in v0.7.1
type OrQuery struct {
L, R PackageQuery
}
OrQuery is L | R
func (*OrQuery) Query ¶ added in v0.7.1
func (q *OrQuery) Query(list *PackageList) (result *PackageList)
Query strategy depends on nodes
type Package ¶
type Package struct { // Basic package properties Name string Version string Architecture string // If this source package, this field holds "real" architecture value, // while Architecture would be equal to "source" SourceArchitecture string // For binary package, name of source package Source string // List of virtual packages this package provides Provides []string // Is this source package IsSource bool // Hash of files section FilesHash uint64 // Is this >= 0.6 package? V06Plus bool // contains filtered or unexported fields }
Package is single instance of Debian package
func NewPackageFromControlFile ¶
NewPackageFromControlFile creates Package from parsed Debian control file
func NewSourcePackageFromControlFile ¶
NewSourcePackageFromControlFile creates Package from parsed Debian control file for source package
func (*Package) Deps ¶
func (p *Package) Deps() *PackageDependencies
Deps returns parsed package dependencies (it may load it from collection)
func (*Package) DownloadList ¶
func (p *Package) DownloadList(packagePool aptly.PackagePool) (result []PackageDownloadTask, err error)
DownloadList returns list of missing package files for download in format [[srcpath, dstpath]]
func (*Package) FilepathList ¶
func (p *Package) FilepathList(packagePool aptly.PackagePool) ([]string, error)
FilepathList returns list of paths to files in package repository
func (*Package) Files ¶
func (p *Package) Files() PackageFiles
Files returns parsed files records (it may load it from collection)
func (*Package) GetDependencies ¶
GetDependencies compiles list of dependenices by flags from options
func (*Package) LinkFromPool ¶
func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool, prefix, component string, force bool) error
LinkFromPool links package file from pool to dist's pool location
func (*Package) MatchesArchitecture ¶
MatchesArchitecture checks whether packages matches specified architecture
func (*Package) MatchesDependency ¶
func (p *Package) MatchesDependency(dep Dependency) bool
MatchesDependency checks whether package matches specified dependency
func (*Package) PoolDirectory ¶
PoolDirectory returns directory in package pool of published repository for this package files
func (*Package) ShortKey ¶ added in v0.7.1
ShortKey returns key for the package that should be unique in one list
func (*Package) UpdateFiles ¶
func (p *Package) UpdateFiles(files PackageFiles)
UpdateFiles saves new state of files
func (*Package) VerifyFiles ¶
func (p *Package) VerifyFiles(packagePool aptly.PackagePool) (result bool, err error)
VerifyFiles verifies that all package files have neen correctly downloaded
type PackageCollection ¶
type PackageCollection struct {
// contains filtered or unexported fields
}
PackageCollection does management of packages in DB
func NewPackageCollection ¶
func NewPackageCollection(db database.Storage) *PackageCollection
NewPackageCollection creates new PackageCollection and binds it to database
func (*PackageCollection) AllPackageRefs ¶
func (collection *PackageCollection) AllPackageRefs() *PackageRefList
AllPackageRefs returns list of all packages as PackageRefList
func (*PackageCollection) ByKey ¶
func (collection *PackageCollection) ByKey(key []byte) (*Package, error)
ByKey find package in DB by its key
func (*PackageCollection) DeleteByKey ¶
func (collection *PackageCollection) DeleteByKey(key []byte) error
DeleteByKey deletes package in DB by key
func (*PackageCollection) Update ¶
func (collection *PackageCollection) Update(p *Package) error
Update adds or updates information about package in DB checking for conficts first
type PackageDependencies ¶
type PackageDependencies struct { Depends []string BuildDepends []string BuildDependsInDep []string PreDepends []string Suggests []string Recommends []string }
PackageDependencies are various parsed dependencies
type PackageDiff ¶
type PackageDiff struct {
Left, Right *Package
}
PackageDiff is a difference between two packages in a list.
If left & right are present, difference is in package version If left is nil, package is present only in right If right is nil, package is present only in left
type PackageDownloadTask ¶
type PackageDownloadTask struct { RepoURI string DestinationPath string Checksums utils.ChecksumInfo }
PackageDownloadTask is a element of download queue for the package
type PackageFile ¶
type PackageFile struct { // Filename is name of file for the package (without directory) Filename string // Hashes for the file Checksums utils.ChecksumInfo // contains filtered or unexported fields }
PackageFile is a single file entry in package
func (*PackageFile) DownloadURL ¶
func (f *PackageFile) DownloadURL() string
DownloadURL return relative URL to package download location
func (*PackageFile) Verify ¶
func (f *PackageFile) Verify(packagePool aptly.PackagePool) (bool, error)
Verify that package file is present and correct
type PackageFiles ¶
type PackageFiles []PackageFile
PackageFiles is collection of package files
func (PackageFiles) Hash ¶
func (files PackageFiles) Hash() uint64
Hash compute hash of all file items, sorting them first
type PackageList ¶
type PackageList struct {
// contains filtered or unexported fields
}
PackageList is list of unique (by key) packages
It could be seen as repo snapshot, repo contents, result of filtering, merge, etc.
If indexed, PackageList starts supporting searching
func NewPackageListFromRefList ¶
func NewPackageListFromRefList(reflist *PackageRefList, collection *PackageCollection, progress aptly.Progress) (*PackageList, error)
NewPackageListFromRefList loads packages list from PackageRefList
func (*PackageList) Add ¶
func (l *PackageList) Add(p *Package) error
Add appends package to package list, additionally checking for uniqueness
func (*PackageList) Append ¶
func (l *PackageList) Append(pl *PackageList) error
Append adds content from one package list to another
func (*PackageList) Architectures ¶
func (l *PackageList) Architectures(includeSource bool) (result []string)
Architectures returns list of architectures present in packages and flag if source packages are present.
If includeSource is true, meta-architecture "source" would be present in the list
func (*PackageList) Filter ¶
func (l *PackageList) Filter(queries []PackageQuery, withDependencies bool, source *PackageList, dependencyOptions int, architecturesList []string) (*PackageList, error)
Filter filters package index by specified queries (ORed together), possibly pulling dependencies
func (*PackageList) ForEach ¶
func (l *PackageList) ForEach(handler func(*Package) error) error
ForEach calls handler for each package in list
func (*PackageList) ForEachIndexed ¶ added in v0.7.1
func (l *PackageList) ForEachIndexed(handler func(*Package) error) error
ForEachIndexed calls handler for each package in list in indexed order
func (*PackageList) Len ¶
func (l *PackageList) Len() int
Len returns number of packages in the list
func (*PackageList) Less ¶
func (l *PackageList) Less(i, j int) bool
Less compares two packages by name (lexographical) and version (latest to oldest)
func (*PackageList) PrepareIndex ¶
func (l *PackageList) PrepareIndex()
PrepareIndex prepares list for indexing
func (*PackageList) Remove ¶
func (l *PackageList) Remove(p *Package)
Remove removes package from the list, and updates index when required
func (*PackageList) Scan ¶ added in v0.7.1
func (l *PackageList) Scan(q PackageQuery) (result *PackageList)
Scan searches package index using full scan
func (*PackageList) Search ¶
func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*Package)
Search searches package index for specified package(s) using optimized queries
func (*PackageList) VerifyDependencies ¶
func (l *PackageList) VerifyDependencies(options int, architectures []string, sources *PackageList, progress aptly.Progress) ([]Dependency, error)
VerifyDependencies looks for missing dependencies in package list.
Analysis would be peformed for each architecture, in specified sources
type PackageQuery ¶ added in v0.7.1
type PackageQuery interface { // Matches calculates match of condition against package Matches(pkg *Package) bool // Fast returns if search strategy is possible for this query Fast() bool // Query performs search on package list Query(list *PackageList) *PackageList // String interface String() string }
PackageQuery is interface of predicate on Package
type PackageRefList ¶
type PackageRefList struct { // List of package keys Refs [][]byte }
PackageRefList is a list of keys of packages, this is basis for snapshot and similar stuff
Refs are sorted in lexicographical order
func NewPackageRefList ¶
func NewPackageRefList() *PackageRefList
NewPackageRefList creates empty PackageRefList
func NewPackageRefListFromPackageList ¶
func NewPackageRefListFromPackageList(list *PackageList) *PackageRefList
NewPackageRefListFromPackageList creates PackageRefList from PackageList
func (*PackageRefList) Decode ¶
func (l *PackageRefList) Decode(input []byte) error
Decode decodes msgpack representation into PackageRefLit
func (*PackageRefList) Diff ¶
func (l *PackageRefList) Diff(r *PackageRefList, packageCollection *PackageCollection) (result PackageDiffs, err error)
Diff calculates difference between two reflists
func (*PackageRefList) Encode ¶
func (l *PackageRefList) Encode() []byte
Encode does msgpack encoding of PackageRefList
func (*PackageRefList) ForEach ¶
func (l *PackageRefList) ForEach(handler func([]byte) error) error
ForEach calls handler for each package ref in list
func (*PackageRefList) Less ¶
func (l *PackageRefList) Less(i, j int) bool
Compare compares two refs in lexographical order
func (*PackageRefList) Merge ¶
func (l *PackageRefList) Merge(r *PackageRefList, overrideMatching bool) (result *PackageRefList)
Merge merges reflist r into current reflist. If overrideMatching, merge replaces matching packages (by architecture/name) with reference from r. Otherwise, all packages are saved.
func (*PackageRefList) Substract ¶
func (l *PackageRefList) Substract(r *PackageRefList) *PackageRefList
Substract returns all packages in l that are not in r
type PkgQuery ¶ added in v0.7.1
PkgQuery is search request against specific package
func (*PkgQuery) Query ¶ added in v0.7.1
func (q *PkgQuery) Query(list *PackageList) (result *PackageList)
Query looks up specific package
type PublishedRepo ¶
type PublishedRepo struct { // Internal unique ID UUID string // Storage & Prefix & distribution should be unique across all published repositories Storage string Prefix string Distribution string Origin string Label string // Architectures is a list of all architectures published Architectures []string // SourceKind is "local"/"repo" SourceKind string // Map of sources by each component: component name -> source UUID Sources map[string]string // Legacy fields for compatibily with old published repositories (< 0.6) Component string // SourceUUID is UUID of either snapshot or local repo SourceUUID string `codec:"SnapshotUUID"` // contains filtered or unexported fields }
PublishedRepo is a published for http/ftp representation of snapshot as Debian repository
func NewPublishedRepo ¶
func NewPublishedRepo(storage, prefix, distribution string, architectures []string, components []string, sources []interface{}, collectionFactory *CollectionFactory) (*PublishedRepo, error)
NewPublishedRepo creates new published repository
storage is PublishedStorage name prefix specifies publishing prefix distribution and architectures are user-defined properties components & sources are lists of component to source mapping (*Snapshot or *LocalRepo)
func (*PublishedRepo) Components ¶ added in v0.7.1
func (p *PublishedRepo) Components() []string
Components returns sorted list of published repo components
func (*PublishedRepo) Decode ¶
func (p *PublishedRepo) Decode(input []byte) error
Decode decodes msgpack representation into PublishedRepo
func (*PublishedRepo) Encode ¶
func (p *PublishedRepo) Encode() []byte
Encode does msgpack encoding of PublishedRepo
func (*PublishedRepo) GetLabel ¶ added in v0.7.1
func (p *PublishedRepo) GetLabel() string
GetLabel returns default or manual Label:
func (*PublishedRepo) GetOrigin ¶ added in v0.7.1
func (p *PublishedRepo) GetOrigin() string
GetOrigin returns default or manual Origin:
func (*PublishedRepo) Key ¶
func (p *PublishedRepo) Key() []byte
Key returns unique key identifying PublishedRepo
func (*PublishedRepo) Publish ¶
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider, collectionFactory *CollectionFactory, signer utils.Signer, progress aptly.Progress, forceOverwrite bool) error
Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
func (*PublishedRepo) RefKey ¶
func (p *PublishedRepo) RefKey(component string) []byte
RefKey is a unique id for package reference list
func (*PublishedRepo) RefList ¶
func (p *PublishedRepo) RefList(component string) *PackageRefList
RefList returns list of package refs in local repo
func (*PublishedRepo) RemoveFiles ¶
func (p *PublishedRepo) RemoveFiles(publishedStorageProvider aptly.PublishedStorageProvider, removePrefix bool, removePoolComponents []string, progress aptly.Progress) error
RemoveFiles removes files that were created by Publish
It can remove prefix fully, and part of pool (for specific component)
func (*PublishedRepo) StoragePrefix ¶ added in v0.7.1
func (p *PublishedRepo) StoragePrefix() string
StoragePrefix returns combined storage & prefix for the repo
func (*PublishedRepo) String ¶
func (p *PublishedRepo) String() string
String returns human-readable represenation of PublishedRepo
func (*PublishedRepo) UpdateLocalRepo ¶
func (p *PublishedRepo) UpdateLocalRepo(component string)
UpdateLocalRepo updates content from local repo in component
func (*PublishedRepo) UpdateSnapshot ¶
func (p *PublishedRepo) UpdateSnapshot(component string, snapshot *Snapshot)
UpdateSnapshot switches snapshot for component
type PublishedRepoCollection ¶
type PublishedRepoCollection struct {
// contains filtered or unexported fields
}
PublishedRepoCollection does listing, updating/adding/deleting of PublishedRepos
func NewPublishedRepoCollection ¶
func NewPublishedRepoCollection(db database.Storage) *PublishedRepoCollection
NewPublishedRepoCollection loads PublishedRepos from DB and makes up collection
func (*PublishedRepoCollection) Add ¶
func (collection *PublishedRepoCollection) Add(repo *PublishedRepo) error
Add appends new repo to collection and saves it
func (*PublishedRepoCollection) ByLocalRepo ¶
func (collection *PublishedRepoCollection) ByLocalRepo(repo *LocalRepo) []*PublishedRepo
ByLocalRepo looks up repository by local repo source
func (*PublishedRepoCollection) BySnapshot ¶
func (collection *PublishedRepoCollection) BySnapshot(snapshot *Snapshot) []*PublishedRepo
BySnapshot looks up repository by snapshot source
func (*PublishedRepoCollection) ByStoragePrefixDistribution ¶ added in v0.7.1
func (collection *PublishedRepoCollection) ByStoragePrefixDistribution(storage, prefix, distribution string) (*PublishedRepo, error)
ByStoragePrefixDistribution looks up repository by storage, prefix & distribution
func (*PublishedRepoCollection) ByUUID ¶
func (collection *PublishedRepoCollection) ByUUID(uuid string) (*PublishedRepo, error)
ByUUID looks up repository by uuid
func (*PublishedRepoCollection) CheckDuplicate ¶
func (collection *PublishedRepoCollection) CheckDuplicate(repo *PublishedRepo) *PublishedRepo
CheckDuplicate verifies that there's no published repo with the same name
func (*PublishedRepoCollection) CleanupPrefixComponentFiles ¶
func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(prefix string, components []string, publishedStorage aptly.PublishedStorage, collectionFactory *CollectionFactory, progress aptly.Progress) error
CleanupPrefixComponentFiles removes all unreferenced files in published storage under prefix/component pair
func (*PublishedRepoCollection) ForEach ¶
func (collection *PublishedRepoCollection) ForEach(handler func(*PublishedRepo) error) error
ForEach runs method for each repository
func (*PublishedRepoCollection) Len ¶
func (collection *PublishedRepoCollection) Len() int
Len returns number of remote repos
func (*PublishedRepoCollection) LoadComplete ¶
func (collection *PublishedRepoCollection) LoadComplete(repo *PublishedRepo, collectionFactory *CollectionFactory) (err error)
LoadComplete loads additional information for remote repo
func (*PublishedRepoCollection) Remove ¶
func (collection *PublishedRepoCollection) Remove(publishedStorageProvider aptly.PublishedStorageProvider, storage, prefix, distribution string, collectionFactory *CollectionFactory, progress aptly.Progress) error
Remove removes published repository, cleaning up directories, files
func (*PublishedRepoCollection) Update ¶
func (collection *PublishedRepoCollection) Update(repo *PublishedRepo) (err error)
Update stores updated information about repo in DB
type RemoteRepo ¶
type RemoteRepo struct { // Permanent internal ID UUID string // User-assigned name Name string // Root of Debian archive, URL ArchiveRoot string // Distribution name, e.g. squeeze Distribution string // List of components to fetch, if empty, then fetch all components Components []string // List of architectures to fetch, if empty, then fetch all architectures Architectures []string // Should we download sources? DownloadSources bool // Meta-information about repository Meta Stanza // Last update date LastDownloadDate time.Time // Checksums for release files ReleaseFiles map[string]utils.ChecksumInfo // Filter for packages Filter string // FilterWithDeps to include dependencies from filter query FilterWithDeps bool // contains filtered or unexported fields }
RemoteRepo represents remote (fetchable) Debian repository.
Repostitory could be filtered when fetching by components, architectures
func NewRemoteRepo ¶
func NewRemoteRepo(name string, archiveRoot string, distribution string, components []string, architectures []string, downloadSources bool) (*RemoteRepo, error)
NewRemoteRepo creates new instance of Debian remote repository with specified params
func (*RemoteRepo) BinaryURL ¶
func (repo *RemoteRepo) BinaryURL(component string, architecture string) *url.URL
BinaryURL returns URL of Packages files for given component and architecture
func (*RemoteRepo) Decode ¶
func (repo *RemoteRepo) Decode(input []byte) error
Decode decodes msgpack representation into RemoteRepo
func (*RemoteRepo) Download ¶
func (repo *RemoteRepo) Download(progress aptly.Progress, d aptly.Downloader, collectionFactory *CollectionFactory, packagePool aptly.PackagePool, ignoreMismatch bool, dependencyOptions int, filterQuery PackageQuery) error
Download downloads all repo files
func (*RemoteRepo) Encode ¶
func (repo *RemoteRepo) Encode() []byte
Encode does msgpack encoding of RemoteRepo
func (*RemoteRepo) Fetch ¶
func (repo *RemoteRepo) Fetch(d aptly.Downloader, verifier utils.Verifier) error
Fetch updates information about repository
func (*RemoteRepo) FlatBinaryURL ¶
func (repo *RemoteRepo) FlatBinaryURL() *url.URL
FlatBinaryURL returns URL to Packages files for flat repo
func (*RemoteRepo) FlatSourcesURL ¶
func (repo *RemoteRepo) FlatSourcesURL() *url.URL
FlatSourcesURL returns URL to Sources files for flat repo
func (*RemoteRepo) IsFlat ¶
func (repo *RemoteRepo) IsFlat() bool
IsFlat determines if repository is flat
func (*RemoteRepo) NumPackages ¶
func (repo *RemoteRepo) NumPackages() int
NumPackages return number of packages retrived from remote repo
func (*RemoteRepo) PackageURL ¶
func (repo *RemoteRepo) PackageURL(filename string) *url.URL
PackageURL returns URL of package file relative to repository root architecture
func (*RemoteRepo) RefKey ¶
func (repo *RemoteRepo) RefKey() []byte
RefKey is a unique id for package reference list
func (*RemoteRepo) RefList ¶
func (repo *RemoteRepo) RefList() *PackageRefList
RefList returns package list for repo
func (*RemoteRepo) ReleaseURL ¶
func (repo *RemoteRepo) ReleaseURL(name string) *url.URL
ReleaseURL returns URL to Release* files in repo root
func (*RemoteRepo) SourcesURL ¶
func (repo *RemoteRepo) SourcesURL(component string) *url.URL
SourcesURL returns URL of Sources files for given component
type RemoteRepoCollection ¶
type RemoteRepoCollection struct {
// contains filtered or unexported fields
}
RemoteRepoCollection does listing, updating/adding/deleting of RemoteRepos
func NewRemoteRepoCollection ¶
func NewRemoteRepoCollection(db database.Storage) *RemoteRepoCollection
NewRemoteRepoCollection loads RemoteRepos from DB and makes up collection
func (*RemoteRepoCollection) Add ¶
func (collection *RemoteRepoCollection) Add(repo *RemoteRepo) error
Add appends new repo to collection and saves it
func (*RemoteRepoCollection) ByName ¶
func (collection *RemoteRepoCollection) ByName(name string) (*RemoteRepo, error)
ByName looks up repository by name
func (*RemoteRepoCollection) ByUUID ¶
func (collection *RemoteRepoCollection) ByUUID(uuid string) (*RemoteRepo, error)
ByUUID looks up repository by uuid
func (*RemoteRepoCollection) Drop ¶
func (collection *RemoteRepoCollection) Drop(repo *RemoteRepo) error
Drop removes remote repo from collection
func (*RemoteRepoCollection) ForEach ¶
func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo) error) error
ForEach runs method for each repository
func (*RemoteRepoCollection) Len ¶
func (collection *RemoteRepoCollection) Len() int
Len returns number of remote repos
func (*RemoteRepoCollection) LoadComplete ¶
func (collection *RemoteRepoCollection) LoadComplete(repo *RemoteRepo) error
LoadComplete loads additional information for remote repo
func (*RemoteRepoCollection) Update ¶
func (collection *RemoteRepoCollection) Update(repo *RemoteRepo) error
Update stores updated information about repo in DB
type Snapshot ¶
type Snapshot struct { // Persisten internal ID UUID string // Human-readable name Name string // Date of creation CreatedAt time.Time // Source: kind + ID SourceKind string SourceIDs []string // Description of how snapshot was created Description string // contains filtered or unexported fields }
Snapshot is immutable state of repository: list of packages
func NewSnapshotFromLocalRepo ¶
NewSnapshotFromLocalRepo creates snapshot from current state of local repository
func NewSnapshotFromPackageList ¶
func NewSnapshotFromPackageList(name string, sources []*Snapshot, list *PackageList, description string) *Snapshot
NewSnapshotFromPackageList creates snapshot from PackageList
func NewSnapshotFromRefList ¶
func NewSnapshotFromRefList(name string, sources []*Snapshot, list *PackageRefList, description string) *Snapshot
NewSnapshotFromRefList creates snapshot from PackageRefList
func NewSnapshotFromRepository ¶
func NewSnapshotFromRepository(name string, repo *RemoteRepo) (*Snapshot, error)
NewSnapshotFromRepository creates snapshot from current state of repository
func (*Snapshot) NumPackages ¶
NumPackages returns number of packages in snapshot
func (*Snapshot) RefList ¶
func (s *Snapshot) RefList() *PackageRefList
RefList returns list of package refs in snapshot
type SnapshotCollection ¶
type SnapshotCollection struct {
// contains filtered or unexported fields
}
SnapshotCollection does listing, updating/adding/deleting of Snapshots
func NewSnapshotCollection ¶
func NewSnapshotCollection(db database.Storage) *SnapshotCollection
NewSnapshotCollection loads Snapshots from DB and makes up collection
func (*SnapshotCollection) Add ¶
func (collection *SnapshotCollection) Add(snapshot *Snapshot) error
Add appends new repo to collection and saves it
func (*SnapshotCollection) ByLocalRepoSource ¶
func (collection *SnapshotCollection) ByLocalRepoSource(repo *LocalRepo) []*Snapshot
ByLocalRepoSource looks up snapshots that have specified LocalRepo as a source
func (*SnapshotCollection) ByName ¶
func (collection *SnapshotCollection) ByName(name string) (*Snapshot, error)
ByName looks up snapshot by name
func (*SnapshotCollection) ByRemoteRepoSource ¶
func (collection *SnapshotCollection) ByRemoteRepoSource(repo *RemoteRepo) []*Snapshot
ByRemoteRepoSource looks up snapshots that have specified RemoteRepo as a source
func (*SnapshotCollection) BySnapshotSource ¶
func (collection *SnapshotCollection) BySnapshotSource(snapshot *Snapshot) []*Snapshot
BySnapshotSource looks up snapshots that have specified snapshot as a source
func (*SnapshotCollection) ByUUID ¶
func (collection *SnapshotCollection) ByUUID(uuid string) (*Snapshot, error)
ByUUID looks up snapshot by UUID
func (*SnapshotCollection) Drop ¶
func (collection *SnapshotCollection) Drop(snapshot *Snapshot) error
Drop removes snapshot from collection
func (*SnapshotCollection) ForEach ¶
func (collection *SnapshotCollection) ForEach(handler func(*Snapshot) error) error
ForEach runs method for each snapshot
func (*SnapshotCollection) Len ¶
func (collection *SnapshotCollection) Len() int
Len returns number of snapshots in collection ForEach runs method for each snapshot
func (*SnapshotCollection) LoadComplete ¶
func (collection *SnapshotCollection) LoadComplete(snapshot *Snapshot) error
LoadComplete loads additional information about snapshot
func (*SnapshotCollection) Update ¶
func (collection *SnapshotCollection) Update(snapshot *Snapshot) error
Update stores updated information about repo in DB
type Stanza ¶
Stanza or paragraph of Debian control file
func GetControlFileFromDeb ¶
GetControlFileFromDeb reads control file from deb package
func GetControlFileFromDsc ¶
GetControlFileFromDsc reads control file from dsc package