deb

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 44 Imported by: 2

Documentation

Overview

Package deb implements Debian-specific repository handling

Index

Constants

View Source
const (
	SourceSnapshot   = "snapshot"
	SourceLocalRepo  = "local"
	SourceRemoteRepo = "repo"
)

Source kinds

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
	// DepVerboseResolve emits additional logs while dependencies are being resolved
	DepVerboseResolve
)

Dependency options

View Source
const (
	PackageTypeBinary    = "deb"
	PackageTypeUdeb      = "udeb"
	PackageTypeSource    = "source"
	PackageTypeInstaller = "installer"
)

Package types

View Source
const (
	ArchitectureAll    = "all"
	ArchitectureAny    = "any"
	ArchitectureSource = "source"
)

Special architectures

View Source
const (
	MirrorIdle = iota
	MirrorUpdating
)

RemoteRepo statuses

View Source
const (
	SortName = iota
	SortTime
)

Snapshot sorting methods

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

Version relations

View Source
const MaxFieldSize = 2 * 1024 * 1024

MaxFieldSize is maximum stanza field size in bytes

Variables

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

Parsing errors

Functions

func BuildGraph added in v0.9.1

func BuildGraph(collectionFactory *CollectionFactory, layout string) (gographviz.Interface, error)

BuildGraph generates graph contents from aptly object database

func CollectChangesFiles added in v0.9.6

func CollectChangesFiles(locations []string, reporter aptly.ResultReporter) (changesFiles, failedFiles []string)

CollectChangesFiles walks filesystem collecting all .changes files

func CollectPackageFiles added in v0.9.1

func CollectPackageFiles(locations []string, reporter aptly.ResultReporter) (packageFiles, otherFiles, failedFiles []string)

CollectPackageFiles walks filesystem collecting all candidates for package files

func CompareVersions

func CompareVersions(ver1, ver2 string) int

CompareVersions compares two package versions

func GetContentsFromDeb added in v0.9.6

func GetContentsFromDeb(file io.Reader, packageFile string) ([]string, error)

GetContentsFromDeb returns list of files installed by .deb package

func ImportChangesFiles added in v1.4.0

func ImportChangesFiles(changesFiles []string, reporter aptly.ResultReporter, acceptUnsigned, ignoreSignatures, forceReplace, noRemoveFiles bool,
	verifier pgp.Verifier, repoTemplate *template.Template, progress aptly.Progress, localRepoCollection *LocalRepoCollection, packageCollection *PackageCollection,
	pool aptly.PackagePool, checksumStorageProvider aptly.ChecksumStorageProvider, uploaders *Uploaders, parseQuery parseQuery) (processedFiles []string, failedFiles []string, err error)

ImportChangesFiles imports referenced files in changes files into local repository

func ImportPackageFiles added in v0.9.1

func ImportPackageFiles(list *PackageList, packageFiles []string, forceReplace bool, verifier pgp.Verifier,
	pool aptly.PackagePool, collection *PackageCollection, reporter aptly.ResultReporter, restriction PackageQuery,
	checksumStorageProvider aptly.ChecksumStorageProvider) (processedFiles []string, failedFiles []string, err error)

ImportPackageFiles imports files into local repository

func ParseDependencyArch added in v1.5.0

func ParseDependencyArch(d *Dependency)

ParseDependencyArch parses the dependency name in format "pkg:any" into name and architecture

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

func ParsePrefix added in v0.9.1

func ParsePrefix(param string) (storage, prefix string)

ParsePrefix splits [storage:]prefix into components

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(list PackageCatalog) bool

Fast is true if any of the parts are fast

func (*AndQuery) Matches added in v0.7.1

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

Matches if both of L, R matches

func (*AndQuery) Query added in v0.7.1

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

Query strategy depends on nodes

func (*AndQuery) String added in v0.7.1

func (q *AndQuery) String() string

String interface

type Changes added in v0.9.6

type Changes struct {
	Changes               string
	Distribution          string
	Files                 PackageFiles
	BasePath, ChangesName string
	TempDir               string
	Source                string
	Binary                []string
	Architectures         []string
	Stanza                Stanza
	SignatureKeys         []pgp.Key
}

Changes is a result of .changes file parsing

func NewChanges added in v0.9.6

func NewChanges(path string) (*Changes, error)

NewChanges moves .changes file into temporary directory and creates Changes structure

func (*Changes) Cleanup added in v0.9.6

func (c *Changes) Cleanup() error

Cleanup removes all temporary files

func (*Changes) GetArchitecture added in v0.9.6

func (c *Changes) GetArchitecture() string

GetArchitecture implements PackageLike interface

func (*Changes) GetField added in v0.9.6

func (c *Changes) GetField(field string) string

GetField implements PackageLike interface

func (*Changes) GetName added in v0.9.6

func (c *Changes) GetName() string

GetName implements PackageLike interface

func (*Changes) GetVersion added in v0.9.6

func (c *Changes) GetVersion() string

GetVersion implements PackageLike interface

func (*Changes) MatchesArchitecture added in v0.9.6

func (c *Changes) MatchesArchitecture(arch string) bool

MatchesArchitecture implements PackageLike interface

func (*Changes) MatchesDependency added in v0.9.6

func (c *Changes) MatchesDependency(d Dependency) bool

MatchesDependency implements PackageLike interface

func (*Changes) PackageQuery added in v0.9.6

func (c *Changes) PackageQuery() PackageQuery

PackageQuery returns query that every package should match to be included

func (*Changes) Prepare added in v0.9.6

func (c *Changes) Prepare() error

Prepare creates temporary directory, copies file there and verifies checksums

func (*Changes) VerifyAndParse added in v0.9.6

func (c *Changes) VerifyAndParse(acceptUnsigned, ignoreSignature bool, verifier pgp.Verifier) error

VerifyAndParse does optional signature verification and parses changes files

type ChecksumCollection added in v1.1.0

type ChecksumCollection struct {
	// contains filtered or unexported fields
}

ChecksumCollection does management of ChecksumInfo in DB

func NewChecksumCollection added in v1.1.0

func NewChecksumCollection(db database.ReaderWriter) *ChecksumCollection

NewChecksumCollection creates new ChecksumCollection and binds it to database

func (*ChecksumCollection) Get added in v1.1.0

func (collection *ChecksumCollection) Get(path string) (*utils.ChecksumInfo, error)

Get finds checksums in DB by path

func (*ChecksumCollection) Update added in v1.1.0

func (collection *ChecksumCollection) Update(path string, c *utils.ChecksumInfo) error

Update adds or updates information about checksum in DB

type CollectionFactory

type CollectionFactory struct {
	*sync.Mutex
	// 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) ChecksumCollection added in v1.1.0

func (factory *CollectionFactory) ChecksumCollection(db database.ReaderWriter) aptly.ChecksumStorage

ChecksumCollection returns (or creates) new ChecksumCollection

func (*CollectionFactory) Flush added in v0.9.1

func (factory *CollectionFactory) Flush()

Flush removes all references to collections, so that memory could be reclaimed

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

func (*CollectionFactory) TemporaryDB added in v1.0.0

func (factory *CollectionFactory) TemporaryDB() (database.Storage, error)

TemporaryDB creates new temporary DB

DB should be closed/droped after being used

type ContentsIndex added in v0.9.6

type ContentsIndex struct {
	// contains filtered or unexported fields
}

ContentsIndex calculates mapping from files to packages, with sorting and aggregation

func NewContentsIndex added in v0.9.6

func NewContentsIndex(db database.Storage) *ContentsIndex

NewContentsIndex creates empty ContentsIndex

func (*ContentsIndex) Empty added in v0.9.6

func (index *ContentsIndex) Empty() bool

Empty checks whether index contains no packages

func (*ContentsIndex) Push added in v0.9.6

func (index *ContentsIndex) Push(qualifiedName []byte, contents []string, dbw database.Writer) error

Push adds package to contents index, calculating package contents as required

func (*ContentsIndex) WriteTo added in v0.9.6

func (index *ContentsIndex) WriteTo(w io.Writer) (int64, error)

WriteTo dumps sorted mapping of files to qualified package names

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, isRelease, isInstaller bool) *ControlFileReader

NewControlFileReader creates ControlFileReader, it wraps with buffering

func (*ControlFileReader) ReadBufferedStanza added in v1.5.0

func (c *ControlFileReader) ReadBufferedStanza(stanza Stanza) error

ReadBufferedStanza reads one stanza from control file into the provided stanza

func (*ControlFileReader) ReadStanza

func (c *ControlFileReader) ReadStanza() (Stanza, error)

ReadStanza reads 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(list PackageCatalog) bool

Fast is always true for dependency query

func (*DependencyQuery) Matches added in v0.7.1

func (q *DependencyQuery) Matches(pkg PackageLike) bool

Matches on dependency condition

func (*DependencyQuery) Query added in v0.7.1

func (q *DependencyQuery) Query(list PackageCatalog) (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(list PackageCatalog) bool

Fast depends on the query

func (*FieldQuery) Matches added in v0.7.1

func (q *FieldQuery) Matches(pkg PackageLike) bool

Matches on generic field

func (*FieldQuery) Query added in v0.7.1

func (q *FieldQuery) Query(list PackageCatalog) (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 `codec:"UUID" json:"-"`
	// User-assigned name
	Name string
	// Comment
	Comment string
	// DefaultDistribution
	DefaultDistribution string `codec:",omitempty"`
	// DefaultComponent
	DefaultComponent string `codec:",omitempty"`
	// Uploaders configuration
	Uploaders *Uploaders `codec:"Uploaders,omitempty" json:"-"`
	// 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 MatchAllQuery added in v1.0.0

type MatchAllQuery struct{}

MatchAllQuery is query that matches all the packages

func (*MatchAllQuery) Fast added in v1.0.0

func (q *MatchAllQuery) Fast(list PackageCatalog) bool

Fast is always true for match all query

func (*MatchAllQuery) Matches added in v1.0.0

func (q *MatchAllQuery) Matches(pkg PackageLike) bool

Matches on specific properties

func (*MatchAllQuery) Query added in v1.0.0

func (q *MatchAllQuery) Query(list PackageCatalog) (result *PackageList)

Query looks up specific package

func (*MatchAllQuery) String added in v1.0.0

func (q *MatchAllQuery) String() string

String interface

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(list PackageCatalog) bool

Fast is false

func (*NotQuery) Matches added in v0.7.1

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

Matches if not matches

func (*NotQuery) Query added in v0.7.1

func (q *NotQuery) Query(list PackageCatalog) (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(list PackageCatalog) bool

Fast is true only if both parts are fast

func (*OrQuery) Matches added in v0.7.1

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

Matches if any of L, R matches

func (*OrQuery) Query added in v0.7.1

func (q *OrQuery) Query(list PackageCatalog) (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
	// Hash of files section
	FilesHash uint64
	// Is this package a dummy installer package
	IsInstaller bool
	// Is this source package
	IsSource bool
	// Is this udeb package
	IsUdeb bool
	// Is this >= 0.6 package?
	V06Plus bool
	// contains filtered or unexported fields
}

Package is single instance of Debian package

func NewInstallerPackageFromControlFile added in v1.4.0

func NewInstallerPackageFromControlFile(input Stanza, repo *RemoteRepo, component, architecture string, d aptly.Downloader) (*Package, error)

NewInstallerPackageFromControlFile creates a dummy installer Package from parsed hash sum file

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 NewUdebPackageFromControlFile added in v0.9.1

func NewUdebPackageFromControlFile(input Stanza) *Package

NewUdebPackageFromControlFile creates .udeb Package from parsed Debian control file

func (*Package) CalculateContents added in v0.9.6

func (p *Package) CalculateContents(packagePool aptly.PackagePool, progress aptly.Progress) ([]string, error)

CalculateContents looks up contents in package file

func (*Package) Contents added in v0.9.6

func (p *Package) Contents(packagePool aptly.PackagePool, progress aptly.Progress) []string

Contents returns cached package contents

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, checksumStorage aptly.ChecksumStorage) (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) ExtendedStanza added in v0.9.6

func (p *Package) ExtendedStanza() Stanza

ExtendedStanza returns package stanza enhanced with aptly-specific fields

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) GetArchitecture added in v0.9.6

func (p *Package) GetArchitecture() string

GetArchitecture returns package arch

func (*Package) GetDependencies

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

GetDependencies compiles list of dependncies 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) GetFullName added in v1.5.0

func (p *Package) GetFullName() string

GetFullName returns the package full name

func (*Package) GetName added in v0.9.6

func (p *Package) GetName() string

GetName returns package name

func (*Package) GetVersion added in v0.9.6

func (p *Package) GetVersion() string

GetVersion returns package version

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, relPath string, force bool) error

LinkFromPool links package file from pool to dist's pool location

func (*Package) MarshalJSON added in v0.9.1

func (p *Package) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaller interface

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) QualifiedName added in v0.9.6

func (p *Package) QualifiedName() string

QualifiedName returns [$SECTION/]$NAME

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, checksumStorage aptly.ChecksumStorage) (result bool, err error)

VerifyFiles verifies that all package files have neen correctly downloaded

type PackageCatalog added in v0.9.1

type PackageCatalog interface {
	Scan(q PackageQuery) (result *PackageList)
	Search(dep Dependency, allMatches bool) (searchResults []*Package)
	SearchSupported() bool
	SearchByKey(arch, name, version string) (result *PackageList)
}

PackageCatalog is abstraction on top of PackageCollection and PackageList

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, dbw database.Writer) error

DeleteByKey deletes package in DB by key

func (*PackageCollection) Scan added in v0.9.1

func (collection *PackageCollection) Scan(q PackageQuery) (result *PackageList)

Scan does full scan on all the packages

func (*PackageCollection) Search added in v0.9.1

func (collection *PackageCollection) Search(dep Dependency, allMatches bool) (searchResults []*Package)

Search is not implemented

func (*PackageCollection) SearchByKey added in v0.9.1

func (collection *PackageCollection) SearchByKey(arch, name, version string) (result *PackageList)

SearchByKey finds package by exact key

func (*PackageCollection) SearchSupported added in v0.9.1

func (collection *PackageCollection) SearchSupported() bool

SearchSupported returns false

func (*PackageCollection) Update

func (collection *PackageCollection) Update(p *Package) error

Update adds or updates information about package in DB

func (*PackageCollection) UpdateInTransaction added in v1.5.0

func (collection *PackageCollection) UpdateInTransaction(p *Package, transaction database.Transaction) error

UpdateInTransaction updates/creates package info in the context of the outer transaction

type PackageConflictError added in v0.9.1

type PackageConflictError struct {
	// contains filtered or unexported fields
}

PackageConflictError means that package can't be added to the list due to error

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

func (PackageDiff) MarshalJSON added in v0.9.1

func (d PackageDiff) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

type PackageDiffs

type PackageDiffs []PackageDiff

PackageDiffs is a list of PackageDiff records

type PackageDownloadTask

type PackageDownloadTask struct {
	File         *PackageFile
	Additional   []PackageDownloadTask
	TempDownPath string
	Done         bool
}

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
	// PoolPath persists relative path to file in the package pool
	PoolPath string
	// 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) GetPoolPath added in v1.1.0

func (f *PackageFile) GetPoolPath(packagePool aptly.PackagePool) (string, error)

GetPoolPath returns path to the file in the pool

For legacy packages which do not have PoolPath field set, that calculates LegacyPath via pool

func (*PackageFile) Verify

func (f *PackageFile) Verify(packagePool aptly.PackagePool, checksumStorage aptly.ChecksumStorage) (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) ParseSumField added in v1.4.0

func (files PackageFiles) ParseSumField(input string, setter func(sum *utils.ChecksumInfo, data string), withSize bool, onlyBasePath bool) (PackageFiles, error)

ParseSumField populates PackageFiles by parsing given input

func (PackageFiles) ParseSumFields added in v0.9.6

func (files PackageFiles) ParseSumFields(stanza Stanza) (PackageFiles, error)

ParseSumFields populates PackageFiles by parsing stanza checksums fields

func (PackageFiles) Swap

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

Swap swaps elements

type PackageLike added in v0.9.6

type PackageLike interface {
	GetField(string) string
	MatchesDependency(Dependency) bool
	MatchesArchitecture(string) bool
	GetName() string
	GetVersion() string
	GetArchitecture() string
}

PackageLike is something like Package :) To be refined later

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 without duplicate package

func NewPackageListFromRefList

func NewPackageListFromRefList(reflist *PackageRefList, collection *PackageCollection, progress aptly.Progress) (*PackageList, error)

NewPackageListFromRefList loads packages list from PackageRefList

func NewPackageListWithDuplicates added in v0.9.7

func NewPackageListWithDuplicates(duplicates bool, capacity int) *PackageList

NewPackageListWithDuplicates creates empty package list which might allow or block duplicate packages

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) FilterWithProgress added in v1.1.0

func (l *PackageList) FilterWithProgress(queries []PackageQuery, withDependencies bool, source *PackageList, dependencyOptions int, architecturesList []string, progress aptly.Progress) (*PackageList, error)

FilterWithProgress filters package index by specified queries (ORed together), possibly pulling dependencies and displays progress

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) FullNames added in v1.5.0

func (l *PackageList) FullNames() []string

FullNames builds a list of package {name}_{version}_{arch}

func (*PackageList) Has added in v1.2.0

func (l *PackageList) Has(p *Package) bool

Has checks whether package is already in the list

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) SearchByKey added in v0.9.1

func (l *PackageList) SearchByKey(arch, name, version string) (result *PackageList)

SearchByKey looks up package by exact key reference

func (*PackageList) SearchSupported added in v0.9.1

func (l *PackageList) SearchSupported() bool

SearchSupported returns true for PackageList

func (*PackageList) Strings added in v0.9.1

func (l *PackageList) Strings() []string

Strings builds list of strings with package keys

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 performed 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 PackageLike) bool
	// Fast returns if search strategy is possible for this query
	Fast(list PackageCatalog) bool
	// Query performs search on package list
	Query(list PackageCatalog) *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) FilterLatestRefs added in v0.9.1

func (l *PackageRefList) FilterLatestRefs()

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 (*PackageRefList) ForEach

func (l *PackageRefList) ForEach(handler func([]byte) error) error

ForEach calls handler for each package ref in list

func (*PackageRefList) Has added in v0.9.1

func (l *PackageRefList) Has(p *Package) bool

Has checks whether package is part of reflist

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, ignoreConflicting bool) (result *PackageRefList)

Merge merges reflist r into current reflist. If overrideMatching, merge replaces matching packages (by architecture/name) with reference from r. If ignoreConflicting is set, all packages are preserved, otherwise conflicting packages are overwritten with packages from "right" snapshot.

func (*PackageRefList) Strings added in v0.9.1

func (l *PackageRefList) Strings() []string

Strings builds list of strings with package keys

func (*PackageRefList) Subtract added in v1.0.0

func (l *PackageRefList) Subtract(r *PackageRefList) *PackageRefList

Subtract 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(list PackageCatalog) bool

Fast is always true for package query

func (*PkgQuery) Matches added in v0.7.1

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

Matches on specific properties

func (*PkgQuery) Query added in v0.7.1

func (q *PkgQuery) Query(list PackageCatalog) (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
	NotAutomatic         string
	ButAutomaticUpgrades string
	Label                string
	Suite                string
	Codename             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 compatibility with old published repositories (< 0.6)
	Component string
	// SourceUUID is UUID of either snapshot or local repo
	SourceUUID string `codec:"SnapshotUUID"`

	// Skip contents generation
	SkipContents bool

	// Skip bz2 compression for index files
	SkipBz2 bool

	// Provide index files per hash also
	AcquireByHash bool
	// 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) GetCodename added in v1.5.1

func (p *PublishedRepo) GetCodename() string

GetCodename returns default or manual Codename:

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) GetPath added in v1.5.0

func (p *PublishedRepo) GetPath() string

GetPath returns the unique name of the repo

func (*PublishedRepo) GetSuite added in v1.5.0

func (p *PublishedRepo) GetSuite() string

GetSuite returns default or manual Suite:

func (*PublishedRepo) Key

func (p *PublishedRepo) Key() []byte

Key returns unique key identifying PublishedRepo

func (*PublishedRepo) MarshalJSON added in v0.9.1

func (p *PublishedRepo) MarshalJSON() ([]byte, error)

MarshalJSON requires object to be "loaded completely"

func (*PublishedRepo) Publish

func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
	collectionFactory *CollectionFactory, signer pgp.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) SourceNames added in v1.5.2

func (p *PublishedRepo) SourceNames() []string

Components returns sorted list of published repo source names

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 representation 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,
	force, skipCleanup bool) error

Remove removes published repository, cleaning up directories, files

func (*PublishedRepoCollection) Update

func (collection *PublishedRepoCollection) Update(repo *PublishedRepo) 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
	// Meta-information about repository
	Meta Stanza
	// Last update date
	LastDownloadDate time.Time
	// Checksums for release files
	ReleaseFiles map[string]utils.ChecksumInfo `json:"-"` // exclude from json output
	// Filter for packages
	Filter string
	// Status marks state of repository (being updated, no action)
	Status int
	// WorkerPID is PID of the process modifying the mirror (if any)
	WorkerPID int
	// FilterWithDeps to include dependencies from filter query
	FilterWithDeps bool
	// SkipComponentCheck skips component list verification
	SkipComponentCheck bool
	// SkipArchitectureCheck skips architecture list verification
	SkipArchitectureCheck bool
	// Should we download sources?
	DownloadSources bool
	// Should we download .udebs?
	DownloadUdebs bool
	// Should we download installer files?
	DownloadInstaller bool
	// Packages for json output
	Packages []string `codec:"-" json:",omitempty"`
	// contains filtered or unexported fields
}

RemoteRepo represents remote (fetchable) Debian repository.

Repository could be filtered when fetching by components, architectures

func NewRemoteRepo

func NewRemoteRepo(name string, archiveRoot string, distribution string, components []string,
	architectures []string, downloadSources bool, downloadUdebs bool, downloadInstaller bool) (*RemoteRepo, error)

NewRemoteRepo creates new instance of Debian remote repository with specified params

func (*RemoteRepo) ApplyFilter added in v0.9.1

func (repo *RemoteRepo) ApplyFilter(dependencyOptions int, filterQuery PackageQuery, progress aptly.Progress) (oldLen, newLen int, err error)

ApplyFilter applies filtering to already built PackageList

func (*RemoteRepo) BinaryPath added in v1.1.0

func (repo *RemoteRepo) BinaryPath(component string, architecture string) string

BinaryPath returns path to Packages files for given component and architecture

func (*RemoteRepo) BuildDownloadQueue added in v0.9.1

func (repo *RemoteRepo) BuildDownloadQueue(packagePool aptly.PackagePool, packageCollection *PackageCollection, checksumStorage aptly.ChecksumStorage, skipExistingPackages bool) (queue []PackageDownloadTask, downloadSize int64, err error)

BuildDownloadQueue builds queue, discards current PackageList

func (*RemoteRepo) CheckLock added in v0.9.1

func (repo *RemoteRepo) CheckLock() error

CheckLock returns error if mirror is being updated by another process

func (*RemoteRepo) Decode

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

Decode decodes msgpack representation into RemoteRepo

func (*RemoteRepo) DownloadPackageIndexes added in v0.9.1

func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.Downloader, verifier pgp.Verifier, collectionFactory *CollectionFactory,
	ignoreMismatch bool) error

DownloadPackageIndexes downloads & parses package index 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 pgp.Verifier) error

Fetch updates information about repository

func (*RemoteRepo) FetchBuffered added in v1.5.0

func (repo *RemoteRepo) FetchBuffered(stanza Stanza, d aptly.Downloader, verifier pgp.Verifier) error

FetchBuffered updates information about repository, reading new stanzas into the provided one

func (*RemoteRepo) FinalizeDownload added in v0.9.1

func (repo *RemoteRepo) FinalizeDownload(collectionFactory *CollectionFactory, progress aptly.Progress) error

FinalizeDownload swaps for final value of package refs

func (*RemoteRepo) FlatBinaryPath added in v1.1.0

func (repo *RemoteRepo) FlatBinaryPath() string

FlatBinaryPath returns path to Packages files for flat repo

func (*RemoteRepo) FlatSourcesPath added in v1.1.0

func (repo *RemoteRepo) FlatSourcesPath() string

FlatSourcesPath returns path to Sources files for flat repo

func (*RemoteRepo) IndexesRootURL added in v1.1.0

func (repo *RemoteRepo) IndexesRootURL() *url.URL

IndexesRootURL builds URL for various indexes

func (*RemoteRepo) InstallerPath added in v1.4.0

func (repo *RemoteRepo) InstallerPath(component string, architecture string) string

InstallerPath returns path of Packages files for given component and architecture

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) MarkAsIdle added in v0.9.1

func (repo *RemoteRepo) MarkAsIdle()

MarkAsIdle clears updating flag

func (*RemoteRepo) MarkAsUpdating added in v0.9.1

func (repo *RemoteRepo) MarkAsUpdating()

MarkAsUpdating puts current PID and sets status to updating

func (*RemoteRepo) NumPackages

func (repo *RemoteRepo) NumPackages() int

NumPackages return number of packages retrieved from remote repo

func (*RemoteRepo) PackageList added in v1.5.0

func (repo *RemoteRepo) PackageList() *PackageList

PackageList returns package list for 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) SetArchiveRoot added in v1.2.0

func (repo *RemoteRepo) SetArchiveRoot(archiveRoot string)

SetArchiveRoot of remote repo

func (*RemoteRepo) SourcesPath added in v1.1.0

func (repo *RemoteRepo) SourcesPath(component string) string

SourcesPath returns path to Sources files for given component

func (*RemoteRepo) String

func (repo *RemoteRepo) String() string

String interface

func (*RemoteRepo) UdebPath added in v1.1.0

func (repo *RemoteRepo) UdebPath(component string, architecture string) string

UdebPath returns path of Packages files for given component and architecture

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 `codec:"UUID" json:"-"`
	// Human-readable name
	Name string
	// Date of creation
	CreatedAt time.Time

	// Source: kind + ID
	SourceKind string   `codec:"SourceKind"`
	SourceIDs  []string `codec:"SourceIDs" json:"-"`
	// Sources
	Snapshots   []*Snapshot   `codec:"-" json:",omitempty"`
	RemoteRepos []*RemoteRepo `codec:"-" json:",omitempty"`
	LocalRepos  []*LocalRepo  `codec:"-" json:",omitempty"`
	Packages    []string      `codec:"-" json:",omitempty"`

	// Description of how snapshot was created
	Description string

	Origin               string
	NotAutomatic         string
	ButAutomaticUpgrades 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) ResourceKey added in v1.5.0

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

ResourceKey is a unique identifier of the resource this snapshot uses. Instead of uuid it uses name which needs to be unique as well.

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) ForEachSorted added in v0.9.1

func (collection *SnapshotCollection) ForEachSorted(sortMethod string, handler func(*Snapshot) error) error

ForEachSorted runs method for each snapshot following some sort order

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 snapshot 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 pgp.Verifier) (Stanza, error)

GetControlFileFromDsc reads control file from dsc package

func (Stanza) Clean added in v1.5.0

func (s Stanza) Clean()

func (Stanza) Clear added in v1.5.0

func (s Stanza) Clear()

func (Stanza) Copy

func (s Stanza) Copy() Stanza

func (Stanza) Empty added in v1.5.0

func (s Stanza) Empty() bool

func (Stanza) Reset added in v1.5.0

func (s Stanza) Reset(key string)

func (Stanza) WriteTo

func (s Stanza) WriteTo(w *bufio.Writer, isSource, isRelease, isInstaller bool) error

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

type Uploaders added in v0.9.6

type Uploaders struct {
	Groups map[string][]string `json:"groups"`
	Rules  []UploadersRule     `json:"rules"`
}

Uploaders is configuration of restrictions for .changes file importing

func NewUploadersFromFile added in v0.9.6

func NewUploadersFromFile(path string) (*Uploaders, error)

NewUploadersFromFile loads Uploaders structue from .json file

func (*Uploaders) ExpandGroups added in v0.9.6

func (u *Uploaders) ExpandGroups(items []string) []string

ExpandGroups expands list of keys/groups into list of keys

func (*Uploaders) IsAllowed added in v0.9.6

func (u *Uploaders) IsAllowed(changes *Changes) error

IsAllowed checks whether listed keys are allowed to upload given .changes file

func (*Uploaders) String added in v0.9.6

func (u *Uploaders) String() string

type UploadersRule added in v0.9.6

type UploadersRule struct {
	Condition         string       `json:"condition"`
	Allow             []string     `json:"allow"`
	Deny              []string     `json:"deny"`
	CompiledCondition PackageQuery `json:"-" codec:"-"`
}

UploadersRule is single rule of format: what packages can group or key upload

func (UploadersRule) String added in v0.9.6

func (u UploadersRule) String() string

Jump to

Keyboard shortcuts

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