Documentation ¶
Overview ¶
Package alpm implements Go bindings to the libalpm library used by Pacman, the Arch Linux package manager. Libalpm allows the creation of custom front ends to the Arch Linux package ecosystem.
Libalpm does not include support for the Arch User Repository (AUR).
Index ¶
- Variables
- func DefaultLogCallback(lvl LogLevel, s string)
- func VerCmp(v1, v2 string) int
- func Version() string
- type BackupFile
- type BackupList
- type DB
- func (db *DB) AddServer(server string)
- func (db *DB) Name() string
- func (db *DB) Pkg(name string) *Package
- func (db *DB) PkgCache() PackageList
- func (db *DB) Search(targets []string) PackageList
- func (db *DB) Servers() []string
- func (db *DB) SetServers(servers []string)
- func (db *DB) SetUsage(usage Usage)
- func (db *DB) Unregister() error
- type DBList
- type DepMod
- type Depend
- type DependList
- type Error
- type File
- type Handle
- func (h *Handle) AddAssumeInstalled(dep Depend) error
- func (h *Handle) AddCacheDir(hookDir string) error
- func (h *Handle) AddHookDir(hookDir string) error
- func (h *Handle) AddIgnoreGroup(hookDir string) error
- func (h *Handle) AddIgnorePkg(hookDir string) error
- func (h *Handle) AddNoExtract(hookDir string) error
- func (h *Handle) AddNoUpgrade(hookDir string) error
- func (h *Handle) Arch() (string, error)
- func (h *Handle) AssumeInstalled() (DependList, error)
- func (h *Handle) CacheDirs() (StringList, error)
- func (h *Handle) CheckSpace() (bool, error)
- func (h *Handle) DBExt() (string, error)
- func (h *Handle) DBPath() (string, error)
- func (h *Handle) DeltaRatio() (float64, error)
- func (h *Handle) GPGDir() (string, error)
- func (h *Handle) GetDefaultSigLevel() (SigLevel, error)
- func (h *Handle) GetLocalFileSigLevel() (SigLevel, error)
- func (h *Handle) GetRemoteFileSigLevel() (SigLevel, error)
- func (h *Handle) HookDirs() (StringList, error)
- func (h *Handle) IgnoreGroups() (StringList, error)
- func (h *Handle) IgnorePkgs() (StringList, error)
- func (h *Handle) LastError() error
- func (h *Handle) LocalDB() (*DB, error)
- func (h *Handle) Lockfile() (string, error)
- func (h *Handle) LogFile() (string, error)
- func (h *Handle) MatchNoExtract(dir string) (bool, error)
- func (h *Handle) MatchNoUpgrade(dir string) (bool, error)
- func (h *Handle) NoExtracts() (StringList, error)
- func (h *Handle) NoUpgrades() (StringList, error)
- func (h *Handle) RegisterSyncDB(dbname string, siglevel SigLevel) (*DB, error)
- func (h *Handle) Release() error
- func (h *Handle) RemoveAssumeInstalled(dep Depend) (bool, error)
- func (h *Handle) RemoveCacheDir(dir string) (bool, error)
- func (h *Handle) RemoveHookDir(dir string) (bool, error)
- func (h *Handle) RemoveIgnoreGroup(dir string) (bool, error)
- func (h *Handle) RemoveIgnorePkg(dir string) (bool, error)
- func (h *Handle) RemoveNoExtract(dir string) (bool, error)
- func (h *Handle) RemoveNoUpgrade(dir string) (bool, error)
- func (h *Handle) Root() (string, error)
- func (h *Handle) SetArch(str string) error
- func (h *Handle) SetAssumeInstalled(deps []Depend) error
- func (h *Handle) SetCacheDirs(hookDirs []string) error
- func (h *Handle) SetCheckSpace(value bool) error
- func (h *Handle) SetDBExt(str string) error
- func (h *Handle) SetDefaultSigLevel(siglevel SigLevel) error
- func (h *Handle) SetDeltaRatio(ratio float64) error
- func (h *Handle) SetGPGDir(str string) error
- func (h *Handle) SetHookDirs(hookDirs []string) error
- func (h *Handle) SetIgnoreGroups(hookDirs []string) error
- func (h *Handle) SetIgnorePkgs(hookDirs []string) error
- func (h *Handle) SetLocalFileSigLevel(siglevel SigLevel) error
- func (h *Handle) SetLogCallback(cb logCallbackSig)
- func (h *Handle) SetLogFile(str string) error
- func (h *Handle) SetNoExtracts(hookDirs []string) error
- func (h *Handle) SetNoUpgrades(hookDirs []string) error
- func (h *Handle) SetQuestionCallback(cb questionCallbackSig)
- func (h *Handle) SetRemoteFileSigLevel(siglevel SigLevel) error
- func (h *Handle) SetUseSyslog(value bool) error
- func (h *Handle) SyncDBByName(name string) (db *DB, err error)
- func (h *Handle) SyncDBs() (DBList, error)
- func (h *Handle) SyncSysupgrade(enableDowngrade bool) error
- func (h *Handle) TransGetAdd() PackageList
- func (h *Handle) TransGetFlags() (TransFlag, error)
- func (h *Handle) TransGetRemove() PackageList
- func (h *Handle) TransInit(flags TransFlag) error
- func (h *Handle) TransRelease() error
- func (h *Handle) UnregisterAllSyncDBs() error
- func (h *Handle) UseSyslog() (bool, error)
- type LogLevel
- type Package
- func (pkg *Package) Architecture() string
- func (pkg *Package) Backup() BackupList
- func (pkg *Package) Base() string
- func (pkg *Package) Base64Signature() string
- func (pkg *Package) BuildDate() time.Time
- func (pkg *Package) CheckDepends() DependList
- func (pkg *Package) ComputeOptionalFor() []string
- func (pkg *Package) ComputeRequiredBy() []string
- func (pkg *Package) Conflicts() DependList
- func (pkg *Package) DB() *DB
- func (pkg *Package) Deltas() StringList
- func (pkg *Package) Depends() DependList
- func (pkg *Package) Description() string
- func (pkg *Package) FileName() string
- func (pkg *Package) Files() []File
- func (pkg *Package) Groups() StringList
- func (pkg *Package) ISize() int64
- func (pkg *Package) InstallDate() time.Time
- func (pkg *Package) Licenses() StringList
- func (pkg *Package) MD5Sum() string
- func (pkg *Package) MakeDepends() DependList
- func (pkg *Package) Name() string
- func (pkg *Package) OptionalDepends() DependList
- func (pkg *Package) Origin() PkgFrom
- func (pkg *Package) Packager() string
- func (pkg *Package) Provides() DependList
- func (pkg *Package) Reason() PkgReason
- func (pkg *Package) Replaces() DependList
- func (pkg *Package) SHA256Sum() string
- func (pkg *Package) ShouldIgnore() bool
- func (pkg *Package) Size() int64
- func (pkg *Package) SyncNewVersion(l DBList) *Package
- func (pkg *Package) URL() string
- func (pkg *Package) Validation() Validation
- func (pkg *Package) Version() string
- type PackageList
- type PkgFrom
- type PkgReason
- type QuestionAny
- func (question QuestionAny) Answer() bool
- func (question QuestionAny) QuestionInstallIgnorepkg() (QuestionInstallIgnorepkg, error)
- func (question QuestionAny) QuestionReplace() (QuestionReplace, error)
- func (question QuestionAny) QuestionSelectProvider() (QuestionSelectProvider, error)
- func (question QuestionAny) SetAnswer(answer bool)
- func (question QuestionAny) Type() QuestionType
- type QuestionInstallIgnorepkg
- type QuestionReplace
- type QuestionSelectProvider
- type QuestionType
- type SigLevel
- type SigStatus
- type StringList
- type TransFlag
- type Usage
- type Validation
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultLogLevel = LogWarning
Functions ¶
func DefaultLogCallback ¶
func VerCmp ¶
VerCmp performs version comparison according to Pacman conventions. Return value is <0 if and only if v1 is older than v2.
Example ¶
fmt.Println(VerCmp("1.0-2", "2.0-1") < 0) fmt.Println(VerCmp("1:1.0-2", "2.0-1") > 0) fmt.Println(VerCmp("2.0.2-2", "2.0.2-2") == 0)
Output: true true true
Types ¶
type BackupFile ¶
type BackupList ¶
type BackupList struct {
// contains filtered or unexported fields
}
func (BackupList) ForEach ¶
func (l BackupList) ForEach(f func(BackupFile) error) error
func (BackupList) Slice ¶
func (l BackupList) Slice() (slice []BackupFile)
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB structure representing a alpm database.
func (*DB) PkgCache ¶
func (db *DB) PkgCache() PackageList
PkgCache returns the list of packages of the database
func (*DB) Search ¶
func (db *DB) Search(targets []string) PackageList
func (*DB) SetServers ¶
SetServers sets server list to use.
func (*DB) Unregister ¶
type DBList ¶
type DBList struct {
// contains filtered or unexported fields
}
DBList structure representing a alpm database list.
func (DBList) FindGroupPkgs ¶
func (l DBList) FindGroupPkgs(name string) PackageList
PkgCachebyGroup returns a PackageList of packages belonging to a group
func (DBList) FindSatisfier ¶
FindSatisfier searches a DBList for a package that satisfies depstring Example "glibc>=2.12"
type DependList ¶
type DependList struct {
// contains filtered or unexported fields
}
DependList describes a linkedlist of dependency type packages.
func (DependList) ForEach ¶
func (l DependList) ForEach(f func(Depend) error) error
ForEach executes an action on each package of the DependList.
func (DependList) Slice ¶
func (l DependList) Slice() []Depend
Slice converts the DependList to a Depend Slice.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle contains the pointer to the alpm handle
func Initialize ¶
Init initializes alpm handle
func (*Handle) AddAssumeInstalled ¶
func (*Handle) AddCacheDir ¶
func (*Handle) AddHookDir ¶
func (*Handle) AddIgnoreGroup ¶
func (*Handle) AddIgnorePkg ¶
func (*Handle) AddNoExtract ¶
func (*Handle) AddNoUpgrade ¶
func (*Handle) AssumeInstalled ¶
func (h *Handle) AssumeInstalled() (DependList, error)
use alpm_depend_t
func (*Handle) CacheDirs ¶
func (h *Handle) CacheDirs() (StringList, error)
func (*Handle) CheckSpace ¶
func (*Handle) DeltaRatio ¶
func (*Handle) GetDefaultSigLevel ¶
func (*Handle) GetLocalFileSigLevel ¶
func (*Handle) GetRemoteFileSigLevel ¶
func (*Handle) HookDirs ¶
func (h *Handle) HookDirs() (StringList, error)
func (*Handle) IgnoreGroups ¶
func (h *Handle) IgnoreGroups() (StringList, error)
func (*Handle) IgnorePkgs ¶
func (h *Handle) IgnorePkgs() (StringList, error)
func (*Handle) NoExtracts ¶
func (h *Handle) NoExtracts() (StringList, error)
func (*Handle) NoUpgrades ¶
func (h *Handle) NoUpgrades() (StringList, error)
func (*Handle) RegisterSyncDB ¶
RegisterSyncDB Loads a sync database with given name and signature check level.
func (*Handle) RemoveAssumeInstalled ¶
func (*Handle) SetAssumeInstalled ¶
func (*Handle) SetCacheDirs ¶
func (*Handle) SetCheckSpace ¶
func (*Handle) SetDefaultSigLevel ¶
func (*Handle) SetDeltaRatio ¶
func (*Handle) SetHookDirs ¶
func (*Handle) SetIgnoreGroups ¶
func (*Handle) SetIgnorePkgs ¶
func (*Handle) SetLocalFileSigLevel ¶
func (*Handle) SetLogCallback ¶
func (h *Handle) SetLogCallback(cb logCallbackSig)
func (*Handle) SetLogFile ¶
func (*Handle) SetNoExtracts ¶
func (*Handle) SetNoUpgrades ¶
func (*Handle) SetQuestionCallback ¶
func (h *Handle) SetQuestionCallback(cb questionCallbackSig)
func (*Handle) SetRemoteFileSigLevel ¶
func (*Handle) SetUseSyslog ¶
func (*Handle) SyncDBByName ¶
SyncDBByName finds a registered database by name.
func (*Handle) SyncSysupgrade ¶
func (*Handle) TransGetAdd ¶
func (h *Handle) TransGetAdd() PackageList
func (*Handle) TransGetFlags ¶
func (*Handle) TransGetRemove ¶
func (h *Handle) TransGetRemove() PackageList
func (*Handle) TransRelease ¶
func (*Handle) UnregisterAllSyncDBs ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package describes a single package and associated handle.
func (*Package) Architecture ¶
Architecture returns the package target Architecture.
func (*Package) Backup ¶
func (pkg *Package) Backup() BackupList
Backup returns a list of package backups.
func (*Package) Base64Signature ¶
func (*Package) CheckDepends ¶
func (pkg *Package) CheckDepends() DependList
Depends returns the package's check dependency list.
func (*Package) ComputeOptionalFor ¶
ComputeOptionalFor returns the names of packages that optionally require the given package
func (*Package) ComputeRequiredBy ¶
ComputeRequiredBy returns the names of reverse dependencies of a package
func (*Package) Conflicts ¶
func (pkg *Package) Conflicts() DependList
Conflicts returns the conflicts of the package as a DependList.
func (*Package) Deltas ¶
func (pkg *Package) Deltas() StringList
func (*Package) Depends ¶
func (pkg *Package) Depends() DependList
Depends returns the package's dependency list.
func (*Package) Description ¶
Description returns the package's description.
func (*Package) Groups ¶
func (pkg *Package) Groups() StringList
Groups returns the groups the package belongs to.
func (*Package) InstallDate ¶
InstallDate returns the package install date.
func (*Package) Licenses ¶
func (pkg *Package) Licenses() StringList
Licenses returns the package license list.
func (*Package) MakeDepends ¶
func (pkg *Package) MakeDepends() DependList
Depends returns the package's make dependency list.
func (*Package) OptionalDepends ¶
func (pkg *Package) OptionalDepends() DependList
Depends returns the package's optional dependency list.
func (*Package) Provides ¶
func (pkg *Package) Provides() DependList
Provides returns DependList of packages provides by package.
func (*Package) Replaces ¶
func (pkg *Package) Replaces() DependList
Replaces returns a DependList with the packages this package replaces.
func (*Package) ShouldIgnore ¶
func (*Package) SyncNewVersion ¶
NewVersion checks if there is a new version of the package in a given DBlist.
func (*Package) Validation ¶
func (pkg *Package) Validation() Validation
type PackageList ¶
type PackageList struct {
// contains filtered or unexported fields
}
PackageList describes a linked list of packages and associated handle.
func (PackageList) FindSatisfier ¶
func (l PackageList) FindSatisfier(depstring string) (*Package, error)
FindSatisfier finds a package that satisfies depstring from PkgList
func (PackageList) ForEach ¶
func (l PackageList) ForEach(f func(Package) error) error
ForEach executes an action on each package of the PackageList.
func (PackageList) Slice ¶
func (l PackageList) Slice() []Package
Slice converts the PackageList to a Package Slice.
func (PackageList) SortBySize ¶
func (l PackageList) SortBySize() PackageList
SortBySize returns a PackageList sorted by size.
type QuestionAny ¶
type QuestionAny struct {
// contains filtered or unexported fields
}
func (QuestionAny) Answer ¶
func (question QuestionAny) Answer() bool
func (QuestionAny) QuestionInstallIgnorepkg ¶
func (question QuestionAny) QuestionInstallIgnorepkg() (QuestionInstallIgnorepkg, error)
func (QuestionAny) QuestionReplace ¶
func (question QuestionAny) QuestionReplace() (QuestionReplace, error)
func (QuestionAny) QuestionSelectProvider ¶
func (question QuestionAny) QuestionSelectProvider() (QuestionSelectProvider, error)
func (QuestionAny) SetAnswer ¶
func (question QuestionAny) SetAnswer(answer bool)
func (QuestionAny) Type ¶
func (question QuestionAny) Type() QuestionType
type QuestionInstallIgnorepkg ¶
type QuestionInstallIgnorepkg struct {
// contains filtered or unexported fields
}
func (QuestionInstallIgnorepkg) Install ¶
func (question QuestionInstallIgnorepkg) Install() bool
func (QuestionInstallIgnorepkg) Pkg ¶
func (question QuestionInstallIgnorepkg) Pkg(h *Handle) Package
func (QuestionInstallIgnorepkg) SetInstall ¶
func (question QuestionInstallIgnorepkg) SetInstall(install bool)
func (QuestionInstallIgnorepkg) Type ¶
func (question QuestionInstallIgnorepkg) Type() QuestionType
type QuestionReplace ¶
type QuestionReplace struct {
// contains filtered or unexported fields
}
func (QuestionReplace) NewPkg ¶
func (question QuestionReplace) NewPkg(h *Handle) *Package
func (QuestionReplace) OldPkg ¶
func (question QuestionReplace) OldPkg(h *Handle) *Package
func (QuestionReplace) Replace ¶
func (question QuestionReplace) Replace() bool
func (QuestionReplace) SetReplace ¶
func (question QuestionReplace) SetReplace(replace bool)
func (QuestionReplace) Type ¶
func (question QuestionReplace) Type() QuestionType
type QuestionSelectProvider ¶
type QuestionSelectProvider struct {
// contains filtered or unexported fields
}
func (QuestionSelectProvider) Dep ¶
func (question QuestionSelectProvider) Dep() Depend
func (QuestionSelectProvider) Providers ¶
func (question QuestionSelectProvider) Providers(h *Handle) PackageList
func (QuestionSelectProvider) SetUseIndex ¶
func (question QuestionSelectProvider) SetUseIndex(index int)
func (QuestionSelectProvider) Type ¶
func (question QuestionSelectProvider) Type() QuestionType
func (QuestionSelectProvider) UseIndex ¶
func (question QuestionSelectProvider) UseIndex() int
type QuestionType ¶
type QuestionType uint
const ( QuestionTypeInstallIgnorepkg QuestionType = 1 << iota QuestionTypeReplacePkg QuestionTypeConflictPkg QuestionTypeCorruptedPkg QuestionTypeRemovePkgs QuestionTypeSelectProvider QuestionTypeImportKey )
type StringList ¶
type StringList struct {
// contains filtered or unexported fields
}
func (StringList) Slice ¶
func (l StringList) Slice() []string
type TransFlag ¶
type TransFlag int
const ( TransFlagNoDeps TransFlag = 1 << iota TransFlagForce TransFlagNoSave TransFlagNoDepVersion TransFlagCascade TransFlagRecurse TransFlagDBOnly TransFlagAllDeps TransFlagDownloadOnly TransFlagNoScriptlets TransFlagNoConflicts TransFlagNeeded TransFlagAllExplicit TransFlagUnneeded TransFlagRecurseAll TransFlagNoLock )
type Validation ¶
type Validation int
const ( ValidationNone Validation = 1 << iota ValidationMD5Sum ValidationSHA256Sum ValidationSignature ValidationUnkown Validation = 0 )