deb

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: MIT Imports: 38 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 (
	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

Variables

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

Parsing errors

Functions

func BuildGraph added in v0.9.1

func BuildGraph(collectionFactory *CollectionFactory) (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, 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(packageFile string) ([]string, error)

GetContentsFromDeb returns list of files installed by .deb package

func ImportPackageFiles added in v0.9.1

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

ImportPackageFiles imports files into local repository

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         []utils.GpgKey
}

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, error)

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 utils.Verifier) error

VerifyAndParse does optional signature verification and parses changes files

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

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() *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(p *Package, packagePool aptly.PackagePool)

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) *ControlFileReader

NewControlFileReader creates ControlFileReader, it wraps with buffering

func (*ControlFileReader) ReadStanza

func (c *ControlFileReader) ReadStanza(isRelease bool) (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(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 `json:"-"`
	// User-assigned name
	Name string
	// Comment
	Comment string
	// DefaultDistribution
	DefaultDistribution string `codec:",omitempty"`
	// DefaultComponent
	DefaultComponent string `codec:",omitempty"`
	// Uploaders configuration
	Uploaders *Uploaders `code:",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 {
	*sync.RWMutex
	// 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(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
	// Is this source package
	IsSource bool
	// Is this udeb package
	IsUdeb 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 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) []string

CalculateContents looks up contents in package file

func (*Package) Contents added in v0.9.6

func (p *Package) Contents(packagePool aptly.PackagePool) []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) (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 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) 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, component 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) (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) 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 checking for conficts first

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

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) 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 conflciting 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) 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(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
	Label        string
	// Architectures is a list of all architectures published
	Architectures []string
	// SourceKind is "local"/"repo"
	SourceKind string
	// Skip contents generation
	SkipContents bool

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

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

MarshalJSON requires object to be "loeaded completely"

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 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 {
	*sync.RWMutex
	// 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 bool) 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
	// Should we download .udebs?
	DownloadUdebs 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
	// SkipComponentCheck skips component list verification
	SkipComponentCheck bool
	// Status marks state of repository (being updated, no action)
	Status int
	// WorkerPID is PID of the process modifying the mirror (if any)
	WorkerPID int
	// 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, downloadUdebs 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) (oldLen, newLen int, err error)

ApplyFilter applies filtering to already built PackageList

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

func (repo *RemoteRepo) BuildDownloadQueue(packagePool aptly.PackagePool) (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, 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 utils.Verifier) error

Fetch updates information about repository

func (*RemoteRepo) FinalizeDownload added in v0.9.1

func (repo *RemoteRepo) FinalizeDownload()

FinalizeDownload swaps for final value of package refs

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

func (*RemoteRepo) UdebURL added in v0.9.1

func (repo *RemoteRepo) UdebURL(component string, architecture string) *url.URL

UdebURL returns URL of Packages files for given component and architecture

type RemoteRepoCollection

type RemoteRepoCollection struct {
	*sync.RWMutex
	// 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 `json:"-"`
	// Human-readable name
	Name string
	// Date of creation
	CreatedAt time.Time

	// Source: kind + ID
	SourceKind string   `json:"-"`
	SourceIDs  []string `json:"-"`
	// 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 {
	*sync.RWMutex
	// 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 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, isSource, isRelease 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