Documentation ¶
Overview ¶
Package pacman provides routines for dealing with Pacman packages.
Index ¶
- Variables
- func EnabledRepositories() ([]string, error)
- func IsDatabaseLocked(dbpath string) bool
- func IsRepositoryEnabled(name string) (bool, error)
- func PkgNewer(a, b AnyPackage) bool
- func PkgOlder(a, b AnyPackage) bool
- func ReadDirApproxOnlyNames(h errs.Handler, dirpath string) ([]string, error)
- type AnyPackage
- type AnyPackages
- type Package
- func (p *Package) Equals(a *Package) bool
- func (pkg *Package) Newer(alt *Package) bool
- func (pkg *Package) Older(alt *Package) bool
- func (p *Package) Pkg() *Package
- func (p *Package) PkgDepends() []string
- func (p *Package) PkgMakeDepends() []string
- func (p *Package) PkgName() string
- func (p *Package) PkgVersion() string
- type PackageOrigin
- type Packages
- func ReadAllSyncDatabases() (Packages, error)
- func ReadDatabase(dbpath string) (Packages, error)
- func ReadDir(h errs.Handler, dirpath, dbpath string) (Packages, error)
- func ReadEveryFileInDir(h errs.Handler, dirpath string) (Packages, error)
- func ReadFiles(h errs.Handler, pkgfiles ...string) (Packages, error)
- func ReadLocalDatabase(eh errs.Handler) (Packages, error)
- func ReadNames(h errs.Handler, dirpath string, pkgnames ...string) (Packages, error)
- func ReadSyncDatabase(name string) (Packages, error)
Constants ¶
This section is empty.
Variables ¶
var DebugWriter io.Writer = nil
DebugWriter is used to write debugging information from this module. If it is nil, then no debugging messages are printed.
var PacmanConfPath = "/etc/pacman.conf"
PacmanConfPath contains the path to the pacman configuration. This is provided for those with special needs, such as me ;)
var PacmanLocalDatabasePath = "/var/lib/pacman/local"
PacmanLocalDatabasePath contains the path to the local pacman library. This is provided for those with special needs to modify at their own risk.
var PacmanSyncDatabaseFormat = "/var/lib/pacman/sync/%s.db"
PacmanSyncDatabaseFormat is the format that fmt.Sprinf needs to interpolate a repository name into a package database path. This is provided for those with special needs to modify at their own risk.
Functions ¶
func EnabledRepositories ¶
EnabledRepositories returns a list of repository names that are enabled in the `/etc/pacman.conf` system configuration file.
func IsDatabaseLocked ¶
IsDatabaseLocked returns whether the database given at the path is currently locked for writing or not.
func IsRepositoryEnabled ¶
IsRepositoryEnabled returns whether the repository named is enabled.
func PkgNewer ¶
func PkgNewer(a, b AnyPackage) bool
PkgNewer returns true if a's version is newer than b's. If b is nil, then true is returned.
func PkgOlder ¶
func PkgOlder(a, b AnyPackage) bool
PkgOlder returns true if a's version is older than b's. If b is nil, then false is returned.
Types ¶
type AnyPackage ¶
type AnyPackages ¶
type Package ¶
type Package struct { // Filename is the file that the package is either read from, or that // the package refers to (for example from the database). There is no // guarantee over the format of the filename! It could be a partial // path or an absolute path. Filename string Origin PackageOrigin Name string // pkgname Version string // pkgver Description string // pkgdesc Base string // pkgbase URL string // url BuildDate time.Time // builddate Packager string // packager Size uint64 // size Arch string // arch: one of any, i686, or x86_64 License string // license Backups []string // backup Replaces []string // replaces Provides []string // provides Conflicts []string // conflict Groups []string // group Depends []string // depend OptionalDepends []string // optdepend MakeDepends []string // makedepend CheckDepends []string // checkdepend MakeOptions []string // makepkgopt Xdata []string // xdata }
The Package datatype represents all the information that encompasses a Pacman package, including the filename of the package.
Note: While we could include information from the database or an AUR search, we have decided against it for now. If you feel that this is important, please contact us.
func Read ¶
Read reads the package information from a pacman package and returns it in the Package datatype.
func (*Package) Equals ¶
Check if one package is the same as another.
The equality comparisons for the []string attributes are set comparisons.
func (*Package) Newer ¶
Newer returns true if pkg's version is newer than alt's. If alt is nil, then true is returned. It takes the Epoch value into account.
func (*Package) Older ¶
Older returns true if pkg's version is older than alt's. If alt is nil, then false is returned. It takes the Epoch value into account.
func (*Package) PkgDepends ¶
func (*Package) PkgMakeDepends ¶
func (*Package) PkgVersion ¶
type PackageOrigin ¶
type PackageOrigin int
PackageOrigin exists to document which fields in the Package type can be expected to be filled with data. Note that some fields may be blank because there is nothing to specify, such as MakeDepends.
const ( // UnknownOrigin specifies unknown origin. No assumption may be made as // to what fields are filled. UnknownOrigin PackageOrigin = iota // FileOrigin specifies package file origin. All fields are filled in as // available. FileOrigin // DatabaseOrigin specifies database origin. All fields are filled in as // available. DatabaseOrigin // LocalOrigin specifies local origin. Not sure what fields are filled in. LocalOrigin // AUROrigin specifies AUR search origin. Only the following fields are // touched: // // Name // Base // Version // Description // URL // License AUROrigin )
type Packages ¶
type Packages []*Package
Packages is merely a list of packages
func ReadAllSyncDatabases ¶
ReadAllSyncDatabases reads all locally synced databases, using /etc/pacman.conf to determine which ones to read.
func ReadDatabase ¶
ReadDatabase reads all the packages from a database file.
func ReadEveryFileInDir ¶
ReadEveryFileInDir reads all the packages it finds in a directory.
Note: this will try to read each package, and currently it does this in an inefficient manner, decompressing the entire package in memory. Even a directory with only a few files will take a while to process.
func ReadLocalDatabase ¶
ReadLocalDatabase reads the database of locally installed packages.
Note: Even if an error occurs, all successfully read packages will be returned.
Note: Errors that occur are passed to the error handler eh, and it is highly recommended that eh always return nil; else reading the local database will be aborted during reading.
func ReadSyncDatabase ¶
ReadSyncDatabase reads one of the package databases synced by pacman, such as "core", "extra", "community", and so on.
It also reads "/etc/pacman.conf" to make sure that the repository is enabled.
func (Packages) Iterate ¶
func (pkgs Packages) Iterate(f func(AnyPackage))
Directories ¶
Path | Synopsis |
---|---|
Package alpm works with parts of Arch Linux packages.
|
Package alpm works with parts of Arch Linux packages. |
Package aur lets you query the Arch Linux User Repository (AUR).
|
Package aur lets you query the Arch Linux User Repository (AUR). |
Package graph provides dependency resolution for AUR packages.
|
Package graph provides dependency resolution for AUR packages. |
Package meta binds together the three places a package can reside: filesystem, database, and internet.
|
Package meta binds together the three places a package can reside: filesystem, database, and internet. |
Package pkgutil provides useful functions for working with packages.
|
Package pkgutil provides useful functions for working with packages. |