Documentation ¶
Overview ¶
Package packagekit provides an interface to interact with packagekit. See: https://www.freedesktop.org/software/PackageKit/gtk-doc/index.html for more information.
Index ¶
- Constants
- func FilterPackageIDs(m map[string]*PkPackageIDActionData, packages []string) ([]string, error)
- func FilterPackageState(m map[string]*PkPackageIDActionData, packages []string, state string) (result []string, err error)
- func FilterState(m map[string]*PkPackageIDActionData, packages []string, state string) (result map[string]bool, err error)
- func FlagInData(flag, data string) bool
- func FmtTransactionMethod(method string) string
- func IsMyArch(arch string) (bool, error)
- type Conn
- func (obj *Conn) Close() error
- func (obj *Conn) CreateTransaction() (dbus.ObjectPath, error)
- func (obj *Conn) GetBus() *dbus.Conn
- func (obj *Conn) GetFilesByPackageID(packageIDs []string) (files map[string][]string, err error)
- func (obj *Conn) GetUpdates(filter uint64) ([]string, error)
- func (obj *Conn) InstallPackages(packageIDs []string, transactionFlags uint64) error
- func (obj *Conn) IsInstalled(pkg string) (bool, error)
- func (obj *Conn) IsInstalledList(packages []string) ([]bool, error)
- func (obj *Conn) PackagesToPackageIDs(packageMap map[string]string, filter uint64) (map[string]*PkPackageIDActionData, error)
- func (obj *Conn) RemovePackages(packageIDs []string, transactionFlags uint64) error
- func (obj *Conn) ResolvePackages(packages []string, filter uint64) ([]string, error)
- func (obj *Conn) UpdatePackages(packageIDs []string, transactionFlags uint64) error
- func (obj *Conn) WatchChanges() (chan *dbus.Signal, error)
- type PkPackageIDActionData
Constants ¶
const ( // FIXME: if PkBufferSize is too low, install seems to drop signals PkBufferSize = 1000 // TODO: the PkSignalTimeout value might be too low PkSignalPackageTimeout = 60 // 60 seconds, arbitrary PkSignalDestroyTimeout = 15 // 15 seconds, arbitrary PkPath = "/org/freedesktop/PackageKit" PkIface = "org.freedesktop.PackageKit" PkIfaceTransaction = PkIface + ".Transaction" )
constants which might need to be tweaked or which contain special dbus strings.
const ( PkFilterEnumUnknown uint64 = 1 << iota // "unknown" PkFilterEnumNone // "none" PkFilterEnumInstalled // "installed" PkFilterEnumNotInstalled // "~installed" PkFilterEnumDevelopment // "devel" PkFilterEnumNotDevelopment // "~devel" PkFilterEnumGui // "gui" PkFilterEnumNotGui // "~gui" PkFilterEnumFree // "free" PkFilterEnumNotFree // "~free" PkFilterEnumVisible // "visible" PkFilterEnumNotVisible // "~visible" PkFilterEnumSupported // "supported" PkFilterEnumNotSupported // "~supported" PkFilterEnumBasename // "basename" PkFilterEnumNotBasename // "~basename" PkFilterEnumNewest // "newest" PkFilterEnumNotNewest // "~newest" PkFilterEnumArch // "arch" PkFilterEnumNotArch // "~arch" PkFilterEnumSource // "source" PkFilterEnumNotSource // "~source" PkFilterEnumCollections // "collections" PkFilterEnumNotCollections // "~collections" PkFilterEnumApplication // "application" PkFilterEnumNotApplication // "~application" PkFilterEnumDownloaded // "downloaded" PkFilterEnumNotDownloaded // "~downloaded" )
type enum_filter uint64 https://github.com/hughsie/PackageKit/blob/master/lib/packagekit-glib2/pk-enum.c
const ( PkTransactionFlagEnumNone uint64 = 1 << iota // "none" PkTransactionFlagEnumOnlyTrusted // "only-trusted" PkTransactionFlagEnumSimulate // "simulate" PkTransactionFlagEnumOnlyDownload // "only-download" PkTransactionFlagEnumAllowReinstall // "allow-reinstall" PkTransactionFlagEnumJustReinstall // "just-reinstall" PkTransactionFlagEnumAllowDowngrade // "allow-downgrade" )
constants from packagekit c library.
const ( PkInfoEnumUnknown uint64 = 1 << iota PkInfoEnumInstalled PkInfoEnumAvailable PkInfoEnumLow PkInfoEnumEnhancement PkInfoEnumNormal PkInfoEnumBugfix PkInfoEnumImportant PkInfoEnumSecurity PkInfoEnumBlocked PkInfoEnumDownloading PkInfoEnumUpdating PkInfoEnumInstalling PkInfoEnumRemoving PkInfoEnumCleanup PkInfoEnumObsoleting PkInfoEnumCollectionInstalled PkInfoEnumCollectionAvailable PkInfoEnumFinished PkInfoEnumReinstalling PkInfoEnumDowngrading PkInfoEnumPreparing PkInfoEnumDecompressing PkInfoEnumUntrusted PkInfoEnumTrusted PkInfoEnumLast )
constants from packagekit c library.
const (
Paranoid = false // enable if you see any ghosts
)
global tweaks of verbosity and code path
Variables ¶
This section is empty.
Functions ¶
func FilterPackageIDs ¶
func FilterPackageIDs(m map[string]*PkPackageIDActionData, packages []string) ([]string, error)
FilterPackageIDs returns a list of packageIDs which match the set of package names in packages.
func FilterPackageState ¶
func FilterPackageState(m map[string]*PkPackageIDActionData, packages []string, state string) (result []string, err error)
FilterPackageState returns all packages that are in package and match the specific state.
func FilterState ¶
func FilterState(m map[string]*PkPackageIDActionData, packages []string, state string) (result map[string]bool, err error)
FilterState returns a map of whether each package queried matches the particular state.
func FlagInData ¶
FlagInData asks whether a flag exists inside the data portion of a packageID field?
func FmtTransactionMethod ¶
FmtTransactionMethod builds the transaction method string properly.
Types ¶
type Conn ¶
type Conn struct { Debug bool Logf func(format string, v ...interface{}) // contains filtered or unexported fields }
Conn is a wrapper struct so we can pass bus connection around in the struct.
func (*Conn) CreateTransaction ¶
CreateTransaction creates and returns a transaction path.
func (*Conn) GetFilesByPackageID ¶
GetFilesByPackageID gets the list of files that are contained inside a list of packageIDs.
func (*Conn) GetUpdates ¶
GetUpdates gets a list of packages that are installed and which can be updated, mod filter.
func (*Conn) InstallPackages ¶
InstallPackages installs a list of packages by packageID.
func (*Conn) IsInstalled ¶
IsInstalled returns if a package is installed. TODO: this could be optimized by making the resolve call directly
func (*Conn) IsInstalledList ¶
IsInstalledList queries a list of packages to see if they are installed.
func (*Conn) PackagesToPackageIDs ¶
func (obj *Conn) PackagesToPackageIDs(packageMap map[string]string, filter uint64) (map[string]*PkPackageIDActionData, error)
PackagesToPackageIDs is a helper function that *might* be generally useful outside mgmt. The packageMap input has the package names as keys and requested states as values. These states can be: installed, uninstalled, newest or a requested version str.
func (*Conn) RemovePackages ¶
RemovePackages removes a list of packages by packageID.
func (*Conn) ResolvePackages ¶
ResolvePackages runs the PackageKit Resolve method and returns the result.
func (*Conn) UpdatePackages ¶
UpdatePackages updates a list of packages to versions that are specified.
func (*Conn) WatchChanges ¶
WatchChanges gets a signal anytime an event happens.