debian

package
v0.0.0-...-e4defeb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2013 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package debian implements Debian-specific repository handling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Package

type Package struct {
	Name         string
	Version      string
	Filename     string
	Filesize     int64
	Architecture string
	Depends      []string
	PreDepends   []string
	Suggests     []string
	Recommends   []string
	Extra        debc.Paragraph
}

Package is single instance of Debian package

TODO: support source & binary

func NewPackageFromControlFile

func NewPackageFromControlFile(input debc.Paragraph) *Package

NewPackageFromControlFile creates Package from parsed Debian control file

func (*Package) Decode

func (p *Package) Decode(input []byte) error

Decode decodes msgpack representation into Package

func (*Package) Encode

func (p *Package) Encode() []byte

Encode does msgpack encoding of Package

func (*Package) Equals

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

Equals compares two packages to be identical

func (*Package) Key

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

Key returns unique key identifying package

func (*Package) String

func (p *Package) String() string

String creates readable representation

func (*Package) VerifyFile

func (p *Package) VerifyFile(filepath string) bool

VerifyFile verifies integrity and existence of local files for the package

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.

func NewPackageList

func NewPackageList() *PackageList

NewPackageList creates empty package list

func (*PackageList) Add

func (l *PackageList) Add(p *Package) error

Add appends package to package list, additionally checking for uniqueness

func (*PackageList) ForEach

func (l *PackageList) ForEach(handler func(*Package))

ForEach calls handler for each package in list

TODO: Error handling

func (*PackageList) Len

func (l *PackageList) Len() int

Len returns number of packages in the list

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 lexographical order

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

func (l *PackageRefList) Encode() []byte

Encode does msgpack encoding of PackageRefList

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

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

Swap swaps two refs

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 debc.Paragraph
	// Last update date
	LastDownloadDate time.Time
	// contains filtered or unexported fields
}

RemoteRepo represents remote (fetchable) Debian repository.

Repostitory could be filtered when fetching by components, architectures TODO: support flat format

func NewRemoteRepo

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

NewRemoteRepo creates new instance of Debian remote repository with specified params

func (*RemoteRepo) BinaryURL

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

BinaryURL returns URL of Packages file for given component and architecture

func (*RemoteRepo) Decode

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

Decode decodes msgpack representation into RemoteRepo

func (*RemoteRepo) Download

func (repo *RemoteRepo) Download(d utils.Downloader, db database.Storage, packageRepo *Repository) error

Download downloads all repo files

func (*RemoteRepo) Encode

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

Encode does msgpack encoding of RemoteRepo

func (*RemoteRepo) Fetch

func (repo *RemoteRepo) Fetch(d utils.Downloader) error

Fetch updates information about repository

func (*RemoteRepo) Key

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

Key is a unique id in DB

func (*RemoteRepo) NumPackages

func (repo *RemoteRepo) NumPackages() int

NumPackages return number of packages retrived from remore 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) ReleaseURL

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

ReleaseURL returns URL to Release file in repo root TODO: InRelease, Release.gz, Release.bz2 handling

func (*RemoteRepo) String

func (repo *RemoteRepo) String() string

String interface

type RemoteRepoCollection

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

RemoteRepoCollection does listing, updating/adding/deleting of RemoteRepos

func NewRemoteRepoCollection

func NewRemoteRepoCollection(db database.Storage) *RemoteRepoCollection

NewRemoteRepoCollection loads RemoteRepos from DB and makes up collection

func (*RemoteRepoCollection) Add

func (collection *RemoteRepoCollection) Add(repo *RemoteRepo) error

Add appends new repo to collection and saves it

func (*RemoteRepoCollection) ByName

func (collection *RemoteRepoCollection) ByName(name string) (*RemoteRepo, error)

ByName looks up repository by name

func (*RemoteRepoCollection) ForEach

func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo))

ForEach runs method for each repository

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 Repository

type Repository struct {
	RootPath string
}

Repository abstract file system with package pool and published package repos

func NewRepository

func NewRepository(root string) *Repository

NewRepository creates new instance of repository which specified root

func (*Repository) PoolPath

func (r *Repository) PoolPath(filename string) (string, error)

PoolPath returns full path to package file in pool

PoolPath checks that final path doesn't go out of repository root path

Jump to

Keyboard shortcuts

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