deb

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2014 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package deb implements Debian-specific repository handling

Index

Constants

View Source
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

View Source
const (
	VersionDontCare = iota
	VersionLess
	VersionLessOrEqual
	VersionEqual
	VersionGreaterOrEqual
	VersionGreater
	VersionPatternMatch
	VersionRegexp
)

Version relations

Variables

View Source
var (
	ErrMalformedStanza = errors.New("malformed stanza syntax")
)

Parsing errors

Functions

func CompareVersions

func CompareVersions(ver1, ver2 string) int

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.

func ParsePPA

func ParsePPA(ppaURL string, config *utils.ConfigStructure) (url string, distribution string, components []string, err error)

ParsePPA converts ppa URL like ppa:user/ppa-name to full HTTP url

Types

type AndQuery added in v0.7.1

type AndQuery struct {
	L, R PackageQuery
}

AndQuery is L , R

func (*AndQuery) Fast added in v0.7.1

func (q *AndQuery) Fast() bool

Fast is true if any of the parts are fast

func (*AndQuery) Matches added in v0.7.1

func (q *AndQuery) Matches(pkg *Package) bool

Matches if both of L, R matches

func (*AndQuery) Query added in v0.7.1

func (q *AndQuery) Query(list *PackageList) (result *PackageList)

Query strategy depends on nodes

func (*AndQuery) String added in v0.7.1

func (q *AndQuery) String() string

String interface

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

type FieldQuery struct {
	Field    string
	Relation int
	Value    string
	Regexp   *regexp.Regexp `codec:"-"`
}

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

func (*FieldQuery) String added in v0.7.1

func (q *FieldQuery) String() string

String interface

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

func NewLocalRepo(name string, comment string) *LocalRepo

NewLocalRepo creates new instance of Debian local repository

func (*LocalRepo) Decode

func (repo *LocalRepo) Decode(input []byte) error

Decode decodes msgpack representation into LocalRepo

func (*LocalRepo) Encode

func (repo *LocalRepo) Encode() []byte

Encode does msgpack encoding of LocalRepo

func (*LocalRepo) Key

func (repo *LocalRepo) Key() []byte

Key is a unique id in DB

func (*LocalRepo) NumPackages

func (repo *LocalRepo) NumPackages() int

NumPackages return number of packages in local repo

func (*LocalRepo) RefKey

func (repo *LocalRepo) RefKey() []byte

RefKey is a unique id for package reference list

func (*LocalRepo) RefList

func (repo *LocalRepo) RefList() *PackageRefList

RefList returns package list for repo

func (*LocalRepo) String

func (repo *LocalRepo) String() string

String interface

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) Fast added in v0.7.1

func (q *NotQuery) Fast() bool

Fast is false

func (*NotQuery) Matches added in v0.7.1

func (q *NotQuery) Matches(pkg *Package) bool

Matches if not matches

func (*NotQuery) Query added in v0.7.1

func (q *NotQuery) Query(list *PackageList) (result *PackageList)

Query strategy is scan always

func (*NotQuery) String added in v0.7.1

func (q *NotQuery) String() string

String interface

type OrQuery added in v0.7.1

type OrQuery struct {
	L, R PackageQuery
}

OrQuery is L | R

func (*OrQuery) Fast added in v0.7.1

func (q *OrQuery) Fast() bool

Fast is true only if both parts are fast

func (*OrQuery) Matches added in v0.7.1

func (q *OrQuery) Matches(pkg *Package) bool

Matches if any of L, R matches

func (*OrQuery) Query added in v0.7.1

func (q *OrQuery) Query(list *PackageList) (result *PackageList)

Query strategy depends on nodes

func (*OrQuery) String added in v0.7.1

func (q *OrQuery) String() string

String interface

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

func NewPackageFromControlFile(input Stanza) *Package

NewPackageFromControlFile creates Package from parsed Debian control file

func NewSourcePackageFromControlFile

func NewSourcePackageFromControlFile(input Stanza) (*Package, error)

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

func (p *Package) Equals(p2 *Package) bool

Equals compares two packages to be identical

func (*Package) Extra

func (p *Package) Extra() Stanza

Extra returns Stanza of extra fields (it may load it from collection)

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

func (p *Package) GetDependencies(options int) (dependencies []string)

GetDependencies compiles list of dependenices by flags from options

func (*Package) GetField added in v0.7.1

func (p *Package) GetField(name string) string

GetField returns fields from package

func (*Package) Key

func (p *Package) Key(prefix string) []byte

Key returns unique key identifying package

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

func (p *Package) MatchesArchitecture(arch string) bool

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

func (p *Package) PoolDirectory() (string, error)

PoolDirectory returns directory in package pool of published repository for this package files

func (*Package) ShortKey added in v0.7.1

func (p *Package) ShortKey(prefix string) []byte

ShortKey returns key for the package that should be unique in one list

func (*Package) Stanza

func (p *Package) Stanza() (result Stanza)

Stanza creates original stanza from package

func (*Package) String

func (p *Package) String() string

String creates readable representation

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 PackageDiffs

type PackageDiffs []PackageDiff

PackageDiffs is a list of PackageDiff records

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

func (PackageFiles) Len

func (files PackageFiles) Len() int

Len returns number of files

func (PackageFiles) Less

func (files PackageFiles) Less(i, j int) bool

Less compares by filename

func (PackageFiles) Swap

func (files PackageFiles) Swap(i, j int)

Swap swaps elements

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 NewPackageList

func NewPackageList() *PackageList

NewPackageList creates empty package list

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

func (l *PackageList) Swap(i, j int)

Swap swaps two packages in index

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

func (l *PackageRefList) Len() int

Len returns number of refs

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

func (*PackageRefList) Swap

func (l *PackageRefList) Swap(i, j int)

Swap swaps two refs

type PkgQuery added in v0.7.1

type PkgQuery struct {
	Pkg     string
	Version string
	Arch    string
}

PkgQuery is search request against specific package

func (*PkgQuery) Fast added in v0.7.1

func (q *PkgQuery) Fast() bool

Fast is always true for package query

func (*PkgQuery) Matches added in v0.7.1

func (q *PkgQuery) Matches(pkg *Package) bool

Matches on specific properties

func (*PkgQuery) Query added in v0.7.1

func (q *PkgQuery) Query(list *PackageList) (result *PackageList)

Query looks up specific package

func (*PkgQuery) String added in v0.7.1

func (q *PkgQuery) String() string

String interface

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

func (repo *RemoteRepo) Key() []byte

Key is a unique id in DB

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

func (*RemoteRepo) String

func (repo *RemoteRepo) String() string

String interface

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

func NewSnapshotFromLocalRepo(name string, repo *LocalRepo) (*Snapshot, error)

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

func (s *Snapshot) Decode(input []byte) error

Decode decodes msgpack representation into Snapshot

func (*Snapshot) Encode

func (s *Snapshot) Encode() []byte

Encode does msgpack encoding of Snapshot

func (*Snapshot) Key

func (s *Snapshot) Key() []byte

Key is a unique id in DB

func (*Snapshot) NumPackages

func (s *Snapshot) NumPackages() int

NumPackages returns number of packages in snapshot

func (*Snapshot) RefKey

func (s *Snapshot) RefKey() []byte

RefKey is a unique id for package reference list

func (*Snapshot) RefList

func (s *Snapshot) RefList() *PackageRefList

RefList returns list of package refs in snapshot

func (*Snapshot) String

func (s *Snapshot) String() string

String returns string representation of 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

type Stanza map[string]string

Stanza or paragraph of Debian control file

func GetControlFileFromDeb

func GetControlFileFromDeb(packageFile string) (Stanza, error)

GetControlFileFromDeb reads control file from deb package

func GetControlFileFromDsc

func GetControlFileFromDsc(dscFile string, verifier utils.Verifier) (Stanza, error)

GetControlFileFromDsc reads control file from dsc package

func (Stanza) Copy

func (s Stanza) Copy() (result Stanza)

Copy returns copy of Stanza

func (Stanza) WriteTo

func (s Stanza) WriteTo(w *bufio.Writer) error

WriteTo saves stanza back to stream, modifying itself on the fly

Jump to

Keyboard shortcuts

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