Documentation
¶
Overview ¶
Package apt contains functions for managing a Debian APT repository
Index ¶
- Variables
- type DirectoryStore
- func (dir DirectoryStore) Create(ctx context.Context, name string, content io.Reader, contentLen int64) (FileToken, error)
- func (dir DirectoryStore) Delete(ctx context.Context, name string) error
- func (dir DirectoryStore) Get(ctx context.Context, name string) (io.ReadCloser, FileToken, error)
- func (dir DirectoryStore) Link(ctx context.Context, oldName string, newName string) error
- func (dir DirectoryStore) List(ctx context.Context, name string) ([]string, error)
- func (dir DirectoryStore) Overwrite(ctx context.Context, name string, content io.Reader, contentLen int64) (FileToken, error)
- func (dir DirectoryStore) Replace(ctx context.Context, name string, token FileToken, content io.Reader, ...) (FileToken, error)
- func (dir DirectoryStore) URL(ctx context.Context, name string) (string, error)
- type Dist
- func (dist *Dist) AddPackage(ctx context.Context, component string, pkg IndexStanza) error
- func (dist *Dist) AddSource(ctx context.Context, component string, newSrc IndexStanza) error
- func (dist *Dist) Architectures() []string
- func (dist *Dist) Codename() string
- func (dist *Dist) Components() []string
- func (dist *Dist) ListPackages(ctx context.Context, component string, arch string) ([]IndexStanza, error)
- func (dist *Dist) ListSources(ctx context.Context, component string) ([]IndexStanza, error)
- func (dist *Dist) ModifyIndexFile(ctx context.Context, filename string, modifyFunc func([]byte) ([]byte, error)) error
- func (dist *Dist) Publish(ctx context.Context) error
- func (dist *Dist) RemovePackage(ctx context.Context, component string, arch string, name string) error
- func (dist *Dist) RemoveSource(ctx context.Context, component string, name string) error
- func (dist *Dist) Repo() *Repo
- func (dist *Dist) SerialNumber() uint64
- type DistConfig
- type FileHasher
- type FileInfo
- type FileToken
- type HTTPStore
- func (store *HTTPStore) Create(ctx context.Context, name string, content io.Reader, contentLen int64) (FileToken, error)
- func (store *HTTPStore) Delete(ctx context.Context, name string) error
- func (store *HTTPStore) Get(ctx context.Context, name string) (io.ReadCloser, FileToken, error)
- func (store *HTTPStore) Link(ctx context.Context, oldName string, newName string) error
- func (store *HTTPStore) List(ctx context.Context, name string) ([]string, error)
- func (store *HTTPStore) Overwrite(ctx context.Context, name string, content io.Reader, contentLen int64) (FileToken, error)
- func (store *HTTPStore) Replace(ctx context.Context, name string, token FileToken, content io.Reader, ...) (FileToken, error)
- func (store *HTTPStore) URL(ctx context.Context, name string) (string, error)
- type IndexStanza
- type ReleaseFile
- type Repo
- func (repo *Repo) AddToPool(ctx context.Context, component string, sourceName string, filename string, ...) (*FileInfo, error)
- func (repo *Repo) GetDist(ctx context.Context, codename string) (*Dist, error)
- func (repo *Repo) GetPackage(ctx context.Context, pkg IndexStanza) (io.ReadCloser, error)
- func (repo *Repo) ListDists(ctx context.Context) ([]string, error)
- func (repo *Repo) NewDist(codename string, config *DistConfig) (*Dist, error)
- func (repo *Repo) SignDist(ctx context.Context, codename string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotExist = fs.ErrNotExist ErrExist = fs.ErrExist )
var ErrAlreadyInPool = errors.New("already exists in pool but with different contents")
ErrAlreadyInPool is returned (possibly wrapped) by [AddToPool] when the file already exists in the pool but with different contents
Functions ¶
This section is empty.
Types ¶
type DirectoryStore ¶
type DirectoryStore string
func (DirectoryStore) Delete ¶
func (dir DirectoryStore) Delete(ctx context.Context, name string) error
func (DirectoryStore) Get ¶
func (dir DirectoryStore) Get(ctx context.Context, name string) (io.ReadCloser, FileToken, error)
type Dist ¶
type Dist struct {
// contains filtered or unexported fields
}
AddPackage, AddSource, RemovePackage, RemoveSource are safe to call concurrently with each other.
func (*Dist) AddPackage ¶
func (*Dist) Architectures ¶
func (*Dist) Components ¶
func (*Dist) ListPackages ¶
func (*Dist) ListSources ¶
func (*Dist) ModifyIndexFile ¶
func (*Dist) Publish ¶
Publish uploads all index files and publishes the distribution. If repo.Signed is true, an InRelease file is published and signed with repo.PrivateKey (an error is returned if it is nil). If repo.Signed is false, a Release file is published instead.
func (*Dist) RemovePackage ¶
func (*Dist) RemoveSource ¶
func (*Dist) SerialNumber ¶
type DistConfig ¶
type FileHasher ¶
type FileHasher struct {
// contains filtered or unexported fields
}
func NewFileHasher ¶
func NewFileHasher(path string) *FileHasher
func (*FileHasher) FileInfo ¶
func (h *FileHasher) FileInfo() *FileInfo
type FileInfo ¶
type FileInfo struct {
Path string // e.g. "main/binary-arm64/Packages"
Size uint64
MD5 [16]byte
SHA1 [20]byte
SHA256 [32]byte
// contains filtered or unexported fields
}
func (*FileInfo) ByHashPath ¶
type HTTPStore ¶
Read-only HTTP store
type IndexStanza ¶
type IndexStanza struct {
Package string
controlfile.Stanza
}
func ParseIndexStanza ¶
func ParseIndexStanza(data []byte) (IndexStanza, []byte)
type ReleaseFile ¶
type ReleaseFile struct {
Origin string
Label string
Codename string
Date time.Time
ValidUntil time.Time
SerialNumber uint64
Architectures []string
Components []string
AcquireByHash bool
NoSupportArchAll string
IndexFiles map[string]*FileInfo
}
func ParseReleaseFile ¶
func ParseReleaseFile(data []byte) (*ReleaseFile, error)
func (*ReleaseFile) GetIndexFile ¶
func (r *ReleaseFile) GetIndexFile(name string) (*FileInfo, decompressor)
func (*ReleaseFile) GetIndexFiles ¶
func (r *ReleaseFile) GetIndexFiles(name string) []*FileInfo
func (*ReleaseFile) Marshal ¶
func (r *ReleaseFile) Marshal() ([]byte, error)
type Repo ¶
type Repo struct {
Store Store
PublicKeys []pgpsign.PublicKey // nil to disable verification of InRelease files when Signed is true
EnforceValidAt time.Time // if not zero, require (In)Release file to be valid at this time
Signed bool // download/publish InRelease files instead of Release files
PrivateKey *pgpsign.PrivateKey // required to sign InRelease files when Signed is true
Validity time.Duration // zero for no expiration
LegacySignatures bool
LegacyIndexFiles bool
}
Methods are safe to call concurrently
func (*Repo) GetDist ¶
GetDist retrieves the given distribution from the repository. If repo.Signed is true, the InRelease file is downloaded and verified with repo.PublicKeys (if non-nil). If repo.Signed is false, the Release file is downloaded instead.
func (*Repo) GetPackage ¶
func (repo *Repo) GetPackage(ctx context.Context, pkg IndexStanza) (io.ReadCloser, error)
Download the given package from the pool. Package integrity is not verified until the ReadCloser is closed; be sure to check the return value of Close before executing any code contained in the package.
type Store ¶
type Store interface {
Get(context.Context, string) (io.ReadCloser, FileToken, error)
URL(context.Context, string) (string, error)
List(context.Context, string) ([]string, error)
Create(context.Context, string, io.Reader, int64) (FileToken, error)
Overwrite(context.Context, string, io.Reader, int64) (FileToken, error)
Replace(context.Context, string, FileToken, io.Reader, int64) (FileToken, error)
Delete(context.Context, string) error
Link(ctx context.Context, old string, new string) error
}