![]() |
![]() |
![]() |
PackageKit Reference Manual | ![]() |
---|
If you do not have a C or C++ language binding, PackageKit executes helper scripts written in pretty much any language. It then watches the standard out and standard error and parses the output into compiled backend commands. This means a python library can be interfaced easily with a C backend.
Even when using helpers, a compiled backend stub is still used for two reasons:
It is still needed for the dlopen internally in PackageKit.
You can add cleverness in the C backend that you might not want to do in the scripted backend, for example using a hashtable in C rather than checking all the names in awk.
Backends are typically open-programmable, which means we can define a
standard for what goes on stdin and stdout to try and maximise
the common code between the backends.
The following section will explain the convention used on
backends/conary
and backends/yum
.
If you are unable to write scripts that conform to these specifications then just launch a PkSpawn object in the compiled helper with stdout callbacks and then try to do screenscraping in the backend. This screenscraping is least popular for obvious reasons.
Backends scripts are run with arguments and data is sent to standard out and standard error asyncronously so that PackageKit can proxy this to DBUS. A method has command line arguments seporated with tabs, and data is also seporated with tabs.
It is important to flush the standard output after each output, else
Linux will helpfully buffer the output into more efficient size chunks.
If you do not flush, then there will be a long IPC delay.
Flushing can be achived in C using fflush
or in python
using sys.stdout.flush()
.
The following methods are mapped from the helper to comand line programs in the spawn helper.
Method | File |
---|---|
Search Name | search-name.* |
Search Group | search-group.* |
Search Details | search-details.* |
Search File | search-file.* |
Install Package | install.* |
Install File | install-file.* |
Remove Package | remove.* |
Get Depends | get-depends.* |
Resolve | resolve.* |
Get Requires | get-requires.* |
Get Update Detail | get-update-detail.* |
Get Details | get-details.* |
Get Files | get-files.* |
Update Package | update.* |
Update System | update-system.* |
Get Updates | get-updates.* |
Refresh Cache | refresh-cache.* |
Get Repo List | get-repo-list.* |
Repo Enable | repo-enable.* |
Repo Set Data | repo-set-data.* |