packagekit

package
Version: v0.0.0-...-54296da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2017 License: AGPL-3.0 Imports: 6 Imported by: 0

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

View Source
const (
	PK_DEBUG = false
	PARANOID = false // enable if you see any ghosts
)

global tweaks of verbosity and code path

View Source
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.

View Source
const (
	PK_FILTER_ENUM_UNKNOWN         uint64 = 1 << iota // "unknown"
	PK_FILTER_ENUM_NONE                               // "none"
	PK_FILTER_ENUM_INSTALLED                          // "installed"
	PK_FILTER_ENUM_NOT_INSTALLED                      // "~installed"
	PK_FILTER_ENUM_DEVELOPMENT                        // "devel"
	PK_FILTER_ENUM_NOT_DEVELOPMENT                    // "~devel"
	PK_FILTER_ENUM_GUI                                // "gui"
	PK_FILTER_ENUM_NOT_GUI                            // "~gui"
	PK_FILTER_ENUM_FREE                               // "free"
	PK_FILTER_ENUM_NOT_FREE                           // "~free"
	PK_FILTER_ENUM_VISIBLE                            // "visible"
	PK_FILTER_ENUM_NOT_VISIBLE                        // "~visible"
	PK_FILTER_ENUM_SUPPORTED                          // "supported"
	PK_FILTER_ENUM_NOT_SUPPORTED                      // "~supported"
	PK_FILTER_ENUM_BASENAME                           // "basename"
	PK_FILTER_ENUM_NOT_BASENAME                       // "~basename"
	PK_FILTER_ENUM_NEWEST                             // "newest"
	PK_FILTER_ENUM_NOT_NEWEST                         // "~newest"
	PK_FILTER_ENUM_ARCH                               // "arch"
	PK_FILTER_ENUM_NOT_ARCH                           // "~arch"
	PK_FILTER_ENUM_SOURCE                             // "source"
	PK_FILTER_ENUM_NOT_SOURCE                         // "~source"
	PK_FILTER_ENUM_COLLECTIONS                        // "collections"
	PK_FILTER_ENUM_NOT_COLLECTIONS                    // "~collections"
	PK_FILTER_ENUM_APPLICATION                        // "application"
	PK_FILTER_ENUM_NOT_APPLICATION                    // "~application"
	PK_FILTER_ENUM_DOWNLOADED                         // "downloaded"
	PK_FILTER_ENUM_NOT_DOWNLOADED                     // "~downloaded"
)

type enum_filter uint64 https://github.com/hughsie/PackageKit/blob/master/lib/packagekit-glib2/pk-enum.c

View Source
const (
	PK_TRANSACTION_FLAG_ENUM_NONE            uint64 = 1 << iota // "none"
	PK_TRANSACTION_FLAG_ENUM_ONLY_TRUSTED                       // "only-trusted"
	PK_TRANSACTION_FLAG_ENUM_SIMULATE                           // "simulate"
	PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD                      // "only-download"
	PK_TRANSACTION_FLAG_ENUM_ALLOW_REINSTALL                    // "allow-reinstall"
	PK_TRANSACTION_FLAG_ENUM_JUST_REINSTALL                     // "just-reinstall"
	PK_TRANSACTION_FLAG_ENUM_ALLOW_DOWNGRADE                    // "allow-downgrade"
)

constants from packagekit c library.

View Source
const (
	PK_INFO_ENUM_UNKNOWN uint64 = 1 << iota
	PK_INFO_ENUM_INSTALLED
	PK_INFO_ENUM_AVAILABLE
	PK_INFO_ENUM_LOW
	PK_INFO_ENUM_ENHANCEMENT
	PK_INFO_ENUM_NORMAL
	PK_INFO_ENUM_BUGFIX
	PK_INFO_ENUM_IMPORTANT
	PK_INFO_ENUM_SECURITY
	PK_INFO_ENUM_BLOCKED
	PK_INFO_ENUM_DOWNLOADING
	PK_INFO_ENUM_UPDATING
	PK_INFO_ENUM_INSTALLING
	PK_INFO_ENUM_REMOVING
	PK_INFO_ENUM_CLEANUP
	PK_INFO_ENUM_OBSOLETING
	PK_INFO_ENUM_COLLECTION_INSTALLED
	PK_INFO_ENUM_COLLECTION_AVAILABLE
	PK_INFO_ENUM_FINISHED
	PK_INFO_ENUM_REINSTALLING
	PK_INFO_ENUM_DOWNGRADING
	PK_INFO_ENUM_PREPARING
	PK_INFO_ENUM_DECOMPRESSING
	PK_INFO_ENUM_UNTRUSTED
	PK_INFO_ENUM_TRUSTED
	PK_INFO_ENUM_UNAVAILABLE
	PK_INFO_ENUM_LAST
)

constants from packagekit c library.

Variables

View Source
var (
	// PkArchMap contains the mapping from PackageKit arch to GOARCH.
	// GOARCH's: 386, amd64, arm, arm64, mips64, mips64le, ppc64, ppc64le
	PkArchMap = map[string]string{

		"noarch": "ANY",
		"all":    "ANY",

		"x86_64":  "amd64",
		"aarch64": "arm64",

		"amd64": "amd64",
		"arm64": "arm64",
		"i386":  "386",
		"i486":  "386",
		"i586":  "386",
		"i686":  "386",
	}
)

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

func FlagInData(flag, data string) bool

FlagInData asks whether a flag exists inside the data portion of a packageID field?

func FmtTransactionMethod

func FmtTransactionMethod(method string) string

FmtTransactionMethod builds the transaction method string properly.

func IsMyArch

func IsMyArch(arch string) bool

IsMyArch determines if a PackageKit architecture matches the current os arch.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a wrapper struct so we can pass bus connection around in the struct.

func NewBus

func NewBus() *Conn

NewBus returns a new bus connection.

func (*Conn) Close

func (bus *Conn) Close() error

Close closes the dbus connection object.

func (*Conn) CreateTransaction

func (bus *Conn) CreateTransaction() (dbus.ObjectPath, error)

CreateTransaction creates and returns a transaction path.

func (*Conn) GetBus

func (bus *Conn) GetBus() *dbus.Conn

GetBus gets the dbus connection object.

func (*Conn) GetFilesByPackageID

func (bus *Conn) GetFilesByPackageID(packageIDs []string) (files map[string][]string, err error)

GetFilesByPackageID gets the list of files that are contained inside a list of packageIDs.

func (*Conn) GetUpdates

func (bus *Conn) GetUpdates(filter uint64) ([]string, error)

GetUpdates gets a list of packages that are installed and which can be updated, mod filter.

func (*Conn) InstallPackages

func (bus *Conn) InstallPackages(packageIDs []string, transactionFlags uint64) error

InstallPackages installs a list of packages by packageID.

func (*Conn) IsInstalled

func (bus *Conn) IsInstalled(pkg string) (bool, error)

IsInstalled returns if a package is installed. TODO: this could be optimized by making the resolve call directly

func (*Conn) IsInstalledList

func (bus *Conn) IsInstalledList(packages []string) ([]bool, error)

IsInstalledList queries a list of packages to see if they are installed.

func (*Conn) PackagesToPackageIDs

func (bus *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

func (bus *Conn) RemovePackages(packageIDs []string, transactionFlags uint64) error

RemovePackages removes a list of packages by packageID.

func (*Conn) ResolvePackages

func (bus *Conn) ResolvePackages(packages []string, filter uint64) ([]string, error)

ResolvePackages runs the PackageKit Resolve method and returns the result.

func (*Conn) UpdatePackages

func (bus *Conn) UpdatePackages(packageIDs []string, transactionFlags uint64) error

UpdatePackages updates a list of packages to versions that are specified.

func (*Conn) WatchChanges

func (bus *Conn) WatchChanges() (chan *dbus.Signal, error)

WatchChanges gets a signal anytime an event happens.

type PkPackageIDActionData

type PkPackageIDActionData struct {
	Found     bool
	Installed bool
	Version   string
	PackageID string
	Newest    bool
}

PkPackageIDActionData is a struct that is returned by PackagesToPackageIDs in the map values.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL