Documentation ¶
Overview ¶
Package repoctl provides functions for managing Arch repositories.
Index ¶
- Variables
- func DependencyGraph(pkgnames []string) (*graph.Graph, error)
- func Download(destdir string, extract bool, clobber bool, pkgnames []string) error
- func DownloadExtractAUR(ap *aur.Package, destdir string, clobber bool) error
- func DownloadPackages(pkgs aur.Packages, destdir string, extract bool, clobber bool) error
- func DownloadTarballAUR(ap *aur.Package, destdir string, clobber bool) error
- func List(pkgs pacman.AnyPackages, f pkgutil.MapFunc) []string
- type InvalidFileError
- type NotExistsError
- type Repo
- func (r *Repo) AddToDatabase(pkgfiles ...string) error
- func (r *Repo) AssertSetup() error
- func (r *Repo) Copy(h errs.Handler, pkgfiles ...string) error
- func (r *Repo) CreateDatabase() error
- func (r *Repo) DatabasePath() string
- func (r *Repo) DeleteDatabase() error
- func (r *Repo) Dispatch(h errs.Handler, pkgfiles ...string) error
- func (r *Repo) Exists(p pacman.AnyPackage) bool
- func (r *Repo) FindMissing() (pacman.Packages, error)
- func (r *Repo) FindNewest(h errs.Handler, pkgnames ...string) (pacman.Packages, error)
- func (r *Repo) FindSimilar(h errs.Handler, pkgfiles ...string) (pacman.Packages, error)
- func (r *Repo) FindUpdates(h errs.Handler, pkgnames ...string) (pacman.Packages, error)
- func (r *Repo) FindUpgrades(h errs.Handler, pkgnames ...string) (Upgrades, error)
- func (r *Repo) IgnoreFltr() pkgutil.FilterFunc
- func (r *Repo) IgnoreMap() map[string]bool
- func (r *Repo) IsObsoleteCached() bool
- func (r *Repo) Link(h errs.Handler, pkgfiles ...string) error
- func (r *Repo) ListDatabase(f pkgutil.MapFunc) ([]string, error)
- func (r *Repo) ListDirectory(h errs.Handler, f pkgutil.MapFunc) ([]string, error)
- func (r *Repo) ListMeta(h errs.Handler, aur bool, f func(pacman.AnyPackage) string) ([]string, error)
- func (r *Repo) MakeAbs(pkgs pacman.Packages)
- func (r *Repo) Move(h errs.Handler, pkgfiles ...string) error
- func (r *Repo) Name() string
- func (r *Repo) OnlyNames(h errs.Handler) ([]string, error)
- func (r *Repo) ReadAUR(h errs.Handler, pkgnames ...string) (aur.Packages, error)
- func (r *Repo) ReadAllNames(h errs.Handler) (pacman.Packages, error)
- func (r *Repo) ReadDatabase() (pacman.Packages, error)
- func (r *Repo) ReadDir(h errs.Handler) (pacman.Packages, error)
- func (r *Repo) ReadMeta(h errs.Handler, pkgnames ...string) (meta.Packages, error)
- func (r *Repo) ReadNames(h errs.Handler, pkgnames ...string) (pacman.Packages, error)
- func (r *Repo) Remove(h errs.Handler, pkgnames ...string) error
- func (r *Repo) RemoveFromDatabase(pkgnames ...string) error
- func (r *Repo) Setup() error
- func (r *Repo) Update(h errs.Handler, pkgnames ...string) error
- type SignedPkg
- type Upgrade
- type Upgrades
Constants ¶
This section is empty.
Variables ¶
var ( SystemRepoAdd = "repo-add" SystemRepoRemove = "repo-remove" )
var ( ErrProfileInvalid = errors.New("require valid profile") ErrRepoDirRelative = errors.New("repository directory path must be absolute") ErrRepoDirMissing = errors.New("repository directory path does not exist") ErrRepoDirInvalid = errors.New("repository directory path is invalid") ErrPkgDirExists = errors.New("package destination directory already exists") ErrPkgFileExists = errors.New("package destination file already exists") )
Functions ¶
func DependencyGraph ¶
DependencyGraph returns a dependency graph of the given package names.
func Download ¶
Download downloads and extracts the given package tarballs.
If a package cannot be found, it will be reported, but the rest of the packages will be downloaded.
func DownloadExtractAUR ¶
DownloadExtractAUR is a helper for Download and DownloadUpgrades.
func DownloadPackages ¶
DownloadPackages downloads the given AUR packages, printing messages for each one.
func DownloadTarballAUR ¶
DownloadTarballAUR downloads the given package from AUR.
Types ¶
type InvalidFileError ¶
func (InvalidFileError) Error ¶
func (e InvalidFileError) Error() string
type NotExistsError ¶
type NotExistsError struct {
Filepath string
}
func (NotExistsError) Error ¶
func (e NotExistsError) Error() string
type Repo ¶
type Repo struct { // Directory is the absolute path to the directory where the // packages are stored. Directory string // Database is the relative path to the repository database, // relative from Directory. Database string // RequireSignature specifies whether files can be added without signature. RequireSignature bool // Backup specifies whether to backup old packages. Backup bool // BackupDir specifies where old packages are backed up to. // If the path is not absolute, then it is interpreted as // relative to the repository directory. BackupDir string // IgnoreUpgrades specifies which packages to ignore when looking // for upgrades. Explicitely specifying the file will override the // ignore however. IgnoreAUR []string // AddParameters are parameters to add to the repo-add // command line. AddParameters []string // RemoveParameters are parameters to add to the repo-remove // command line. RemoveParameters []string }
func New ¶
New creates a new default configuration with repo as the repository database. It is assumed that the database resides in the same directory as the packages.
If repo is invalid (because it is absolute), nil is returned. We don't check for database existance, because at this point, it might not exist yet.
func NewFromConf ¶
func NewFromConf(c *conf.Configuration) (*Repo, error)
NewFromConf creates a new configuration based on the configuration file.
func (*Repo) AddToDatabase ¶
AddToDatabase adds the given packages to the repository database.
func (*Repo) AssertSetup ¶
AssertSetup returns nil if a normal repository setup is present: the directory exists.
While it would make sense to check for readability and writability, in modern systems there are so many ways to achieve this, that to test all of them is more effort than it is worth.
func (*Repo) Copy ¶
Copy copies the given files into the repository if they do not already exist there and adds them to the database.
func (*Repo) CreateDatabase ¶
CreateDatabase creates the repository database (but does nothing else).
func (*Repo) DatabasePath ¶
DatabasePath returns the entire path to the database.
func (*Repo) DeleteDatabase ¶
DeleteDatabase deletes the repository database (but not the files).
func (*Repo) Exists ¶
func (r *Repo) Exists(p pacman.AnyPackage) bool
Exists checks the existance of a package file; this is only necessary for packages read from the database. If the file can't be read for any reason, then chances are any client will not be able to read it either, and so false is returned.
func (*Repo) FindMissing ¶
FindMissing returns all packages from the database that do not have associated files existing.
func (*Repo) FindNewest ¶
FindNewest returns the newest package files found for the given package names. If no names are given, all names are searched for.
func (*Repo) FindSimilar ¶
FindSimilar finds package files in the repository that have the same package name. The pkgfile given is filtered from the results.
This makes this function useful for finding all the other packages given a particular package file.
If no pkgfiles are given, nil is returned.
func (*Repo) FindUpdates ¶
FindUpdates finds all given packages with updates. If no names are given, all names are checked. Multiple packages with the same name may be returned. Use pkutil.FilterNewest to deal with this.
func (*Repo) FindUpgrades ¶
FindUpgrades finds all upgrades it finds to the given packages. If no package names are given, all available package names are searched.
func (*Repo) IgnoreFltr ¶
func (r *Repo) IgnoreFltr() pkgutil.FilterFunc
IgnoreFltr returns a FilterFunc for filtering out packages that should be ignored. For example, for a list of meta.Packages:
pkgs = pkgutil.Filter(pkgs, r.ignoreFltr()).(meta.Packages)
func (*Repo) IsObsoleteCached ¶
IsObsoleteCached returns true when obsolete package files should be cached instead of backed-up or deleted.
If the backup directory is the directory where all the packages are, then the idea is that we leave them in place.
func (*Repo) ListDirectory ¶
func (*Repo) MakeAbs ¶
MakeAbs makes all package filenames absolute. It is much easier to do this to all packages than figure out when we need it and when we don't.
func (*Repo) Move ¶
Move moves the given files into the repository if they do not already exist there and adds them to the database. If the files already exist there, then they are still deleted from where they were. Thus, the move always appears to have worked, even if no work was done.
The exception is that when the source and destination files are the same; then no move or deletion is performed.
func (*Repo) Name ¶
Name returns the name of the repository, which is interpreted to be the name of the database up to the first period.
func (*Repo) OnlyNames ¶
OnlyNames reads all possible package names from the repository. This includes packages from the database where the files have been deleted.
func (*Repo) ReadAUR ¶
ReadAUR reads the given package names from AUR. If no package names are given, ReadAUR reads all the names found in the repository.
If you don't need this special feature on zero packages, then please use aur.ReadAll instead!
func (*Repo) ReadAllNames ¶
ReadAllNames returns all packages in the repository.
func (*Repo) ReadDatabase ¶
ReadDatabase reads the database at r.Directory/r.Database. If the database does not exist, then an empty list is returned.
func (*Repo) ReadMeta ¶
ReadMeta returns all meta packages in the repository that match the given names. If no names are given, all packages in repository are returned.
func (*Repo) ReadNames ¶
ReadNames returns all packages in the repository that match the given names. If no names are given, no packages are returned.
func (*Repo) RemoveFromDatabase ¶
RemoveFromDatabase removes the given packages from the repository database.
func (*Repo) Update ¶
Update adds the newest package found for the given name to the database and dispatches the obsolete packages. Any obsolete entries in the database are removed.
If pkgnames is empty, the entire repository is scanned.
TODO: What happens when there are multiple files, and you delete the most recent one. Which file is deleted?
type SignedPkg ¶
SignedPkg represents the path components of a potentially signed package.
func NewSignedPkg ¶
NewSignedPkg returns a new SignedPkg, accompanied with an error if there is an error reading whether the signature file exists or not.
func (*SignedPkg) Apply ¶
Apply executes the function f for the package path, then the signature path. It returns the first error encountered.
func (*SignedPkg) HasSignature ¶
HasSignature returns whether the package is accompanied by a signature file.
type Upgrade ¶
Upgrade represents an available AUR upgrade.
func (*Upgrade) DownloadURL ¶
DownloadURL returns the download URL of the upgrade.