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(ctx interface{}, 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) IPackage
- func (db *DB) PkgCache() IPackageList
- func (db *DB) Search(targets []string) IPackageList
- 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) AddArchitecture(str string) error
- 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) AssumeInstalled() (IDependList, 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) GPGDir() (string, error)
- func (h *Handle) GetArchitectures() (StringList, 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() (IDB, 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) NewDBList() IDBList
- func (h *Handle) NoExtracts() (StringList, error)
- func (h *Handle) NoUpgrades() (StringList, error)
- func (h *Handle) RegisterSyncDB(dbname string, siglevel SigLevel) (IDB, error)
- func (h *Handle) Release() error
- func (h *Handle) RemoveArchitecture(str string) (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) SetArchitectures(str []string) 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) 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, ctx interface{})
- 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, ctx interface{})
- func (h *Handle) SetRemoteFileSigLevel(siglevel SigLevel) error
- func (h *Handle) SetUseSyslog(value bool) error
- func (h *Handle) SyncDBByName(name string) (db IDB, err error)
- func (h *Handle) SyncDBListByDBName(name string) (IDBList, error)
- func (h *Handle) SyncDBs() (IDBList, 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 IDB
- type IDBList
- type IDependList
- type IPackage
- type IPackageList
- 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() IDependList
- func (pkg *Package) ComputeOptionalFor() []string
- func (pkg *Package) ComputeRequiredBy() []string
- func (pkg *Package) Conflicts() IDependList
- func (pkg *Package) ContainsFile(path string) (File, error)
- func (pkg *Package) DB() IDB
- func (pkg *Package) Depends() IDependList
- 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() IDependList
- func (pkg *Package) Name() string
- func (pkg *Package) OptionalDepends() IDependList
- func (pkg *Package) Origin() PkgFrom
- func (pkg *Package) Packager() string
- func (pkg *Package) Provides() IDependList
- func (pkg *Package) Reason() PkgReason
- func (pkg *Package) Replaces() IDependList
- func (pkg *Package) SHA256Sum() string
- func (pkg *Package) ShouldIgnore() bool
- func (pkg *Package) Size() int64
- func (pkg *Package) SyncNewVersion(l IDBList) IPackage
- func (pkg *Package) Type() string
- 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
- func (question QuestionSelectProvider) Dep() *Depend
- func (question QuestionSelectProvider) Providers(h *Handle) IPackageList
- func (question QuestionSelectProvider) SetUseIndex(index int)
- func (question QuestionSelectProvider) Type() QuestionType
- func (question QuestionSelectProvider) UseIndex() int
- type QuestionType
- type SigLevel
- type SigStatus
- type StringList
- type TransFlag
- type Usage
- type Validation
Constants ¶
This section is empty.
Variables ¶
var DefaultLogLevel = LogWarning
Functions ¶
func DefaultLogCallback ¶
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() IPackageList
PkgCache returns the list of packages of the database
func (*DB) Search ¶
func (db *DB) Search(targets []string) IPackageList
Search returns a list of packages matching the targets. In case of error the Package List will be nil
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) IPackageList
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) AddArchitecture ¶ added in v2.0.6
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() (IDependList, error)
use alpm_depend_t
func (*Handle) CacheDirs ¶
func (h *Handle) CacheDirs() (StringList, error)
func (*Handle) CheckSpace ¶
func (*Handle) GetArchitectures ¶ added in v2.0.6
func (h *Handle) GetArchitectures() (StringList, error)
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) RemoveArchitecture ¶ added in v2.0.6
func (*Handle) SetArchitectures ¶ added in v2.0.6
func (*Handle) SetCacheDirs ¶
func (*Handle) SetCheckSpace ¶
func (*Handle) SetDefaultSigLevel ¶
func (*Handle) SetHookDirs ¶
func (*Handle) SetIgnoreGroups ¶
func (*Handle) SetIgnorePkgs ¶
func (*Handle) SetLocalFileSigLevel ¶
func (*Handle) SetLogCallback ¶
func (h *Handle) SetLogCallback(cb logCallbackSig, ctx interface{})
func (*Handle) SetLogFile ¶
func (*Handle) SetNoExtracts ¶
func (*Handle) SetNoUpgrades ¶
func (*Handle) SetQuestionCallback ¶
func (h *Handle) SetQuestionCallback(cb questionCallbackSig, ctx interface{})
func (*Handle) SetRemoteFileSigLevel ¶
func (*Handle) SetUseSyslog ¶
func (*Handle) SyncDBByName ¶
SyncDBByName finds a registered database by name.
func (*Handle) SyncDBListByDBName ¶ added in v2.2.1
SyncDBListByDBName creates and returns a database list with a single database given 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 IDB ¶
type IDB interface { Unregister() error // Name returns name of the db Name() string // Servers returns host server URL. Servers() []string // SetServers sets server list to use. SetServers(servers []string) // AddServers adds a string to the server list. AddServer(server string) // SetUsage sets the Usage of the database SetUsage(usage Usage) // Name searches a package in db. Pkg(name string) IPackage // PkgCache returns the list of packages of the database PkgCache() IPackageList Search([]string) IPackageList }
IDB is an interface type for alpm.DB.
type IDBList ¶
type IDBList interface { // ForEach executes an action on each DB. ForEach(func(IDB) error) error // Slice converts DB list to DB slice. Slice() []IDB // Append modifies DB list with given DB appended. Append(IDB) // PkgCachebyGroup returns a PackageList of packages belonging to a group FindGroupPkgs(string) IPackageList // FindSatisfier searches a DBList for a package that satisfies depstring // Example "glibc>=2.12" FindSatisfier(string) (IPackage, error) }
IDBList interfaces alpm.DBList.
type IDependList ¶ added in v2.2.0
type IPackage ¶
type IPackage interface { FileName() string Base() string Base64Signature() string Validation() Validation // Architecture returns the package target Architecture. Architecture() string // Backup returns a list of package backups. Backup() BackupList // BuildDate returns the BuildDate of the package. BuildDate() time.Time // Conflicts returns the conflicts of the package as a DependList. Conflicts() IDependList // DB returns the package's origin database. DB() IDB // Depends returns the package's dependency list. Depends() IDependList // Depends returns the package's optional dependency list. OptionalDepends() IDependList // Depends returns the package's check dependency list. CheckDepends() IDependList // Depends returns the package's make dependency list. MakeDepends() IDependList // Description returns the package's description. Description() string // Files returns the file list of the package. Files() []File // ContainsFile checks if the path is in the package filelist ContainsFile(path string) (File, error) // Groups returns the groups the package belongs to. Groups() StringList // ISize returns the package installed size. ISize() int64 // InstallDate returns the package install date. InstallDate() time.Time // Licenses returns the package license list. Licenses() StringList // SHA256Sum returns package SHA256Sum. SHA256Sum() string // MD5Sum returns package MD5Sum. MD5Sum() string // Name returns package name. Name() string // Packager returns package packager name. Packager() string // Provides returns DependList of packages provides by package. Provides() IDependList // Reason returns package install reason. Reason() PkgReason // Origin returns package origin. Origin() PkgFrom // Replaces returns a DependList with the packages this package replaces. Replaces() IDependList // Size returns the packed package size. Size() int64 // URL returns the upstream URL of the package. URL() string // Version returns the package version. Version() string // ComputeRequiredBy returns the names of reverse dependencies of a package ComputeRequiredBy() []string // ComputeOptionalFor returns the names of packages that optionally // require the given package ComputeOptionalFor() []string ShouldIgnore() bool // SyncNewVersion checks if there is a new version of the // package in a given DBlist. SyncNewVersion(l IDBList) IPackage Type() string }
IPackage is an interface type for alpm.Package.
type IPackageList ¶
type IPackageList interface { // ForEach executes an action on each package of the PackageList. ForEach(func(IPackage) error) error // Slice converts the PackageList to a Package Slice. Slice() []IPackage // SortBySize returns a PackageList sorted by size. SortBySize() IPackageList // FindSatisfier finds a package that satisfies depstring from PkgList FindSatisfier(string) (IPackage, error) }
IPackageList exports the alpm.PackageList symbols.
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() IDependList
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() IDependList
Conflicts returns the conflicts of the package as a DependList.
func (*Package) ContainsFile ¶
ContainsFile checks if the path is in the package filelist
func (*Package) Depends ¶
func (pkg *Package) Depends() IDependList
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() IDependList
Depends returns the package's make dependency list.
func (*Package) OptionalDepends ¶
func (pkg *Package) OptionalDepends() IDependList
Depends returns the package's optional dependency list.
func (*Package) Provides ¶
func (pkg *Package) Provides() IDependList
Provides returns DependList of packages provides by package.
func (*Package) Replaces ¶
func (pkg *Package) Replaces() IDependList
Replaces returns a DependList with the packages this package replaces.
func (*Package) ShouldIgnore ¶
func (*Package) SyncNewVersion ¶
SyncNewVersion 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) (IPackage, error)
FindSatisfier finds a package that satisfies depstring from PkgList
func (PackageList) ForEach ¶
func (l PackageList) ForEach(f func(IPackage) error) error
ForEach executes an action on each package of the PackageList.
func (PackageList) Slice ¶
func (l PackageList) Slice() []IPackage
Slice converts the PackageList to a Package Slice.
func (PackageList) SortBySize ¶
func (l PackageList) SortBySize() IPackageList
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) IPackage
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) IPackage
func (QuestionReplace) OldPkg ¶
func (question QuestionReplace) OldPkg(h *Handle) IPackage
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) IPackageList
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 )