[packagekit] Installing PackageKit catalogs

David D Lowe daviddlowe.flimm at gmail.com
Mon Aug 16 06:56:29 PDT 2010


On 14/08/10 22:58, Daniel Nicoletti wrote
>> Here's what I would need to be able to use catalogs:
>> - a  way to discover if the packages listed in a catalog file are already
>> installed,  through DBus or through pkcon.
>> - a way to install catalogs without installing  gnome-packagekit, through
>> pkcon.
>>      
> Well catalogs are not for the first item.
>    

Is this by design? It would be handy to be able to do so in future.
> If you app needs to know if X package is installed you can use the packagekit
> session interface: http://www.packagekit.org/pk-faq.html#session-methods
> which also supports reading *.catalogs files BUT this session is NOT provided
> by PackageKit, it's provided by gnome-packagekit and KPackageKit.
>
>    
The FAQ doesn't mention any such method. I did some digging with d-feet 
and discovered that the methods in the org.freedesktop.PackageKit.Modify 
interface are: InstallCatalogs, InstallFontconfigResources, 
InstallGStreamerResources, InstallMimeTypes, InstallPackageFiles, 
InstallPackageNames, InstallProvideFiles and RemovePackageByFile.

I've tried the methods listed in the FAQ and they don't work. Even the 
preceding code examples don't use the InstallPackageName method, they 
use InstallPackageNames instead.

If the DBus API has changed in a new release, again I apologise. 
However, I suspect that the documentation is out of date here.
>> The documentation in  org.freedesktop.PackageKit.xml says that the method
>> InstallCatalogs takes these  flags:
>> show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning
>>      
Spent some time reading the .xml file, and now I realise that these 
flags can be combined with corresponding hide- flags. That makes much 
more sense.

For some reason though, passing never to InstallCatalogs still leaves 
one dialog for the user to respond to, whether or not the package has 
been installed already.

On the org.freedesktop.PackageKit.Query interface, two methods are 
provided: IsInstalled and SearchFile. Unfortunately, IsInstalled doesn't 
take the path to a .catalog file as an argument. This means my 
application would have to parse the .catalog itself to determine the 
correct package name to pass to it. Can I request a new method: 
IsCatalogInstalled?

Here's how far I've managed to get with the DBus API:

> def install_dependency_if_necessary(catalog):
>     # returns False if dependency is already installed, True if the 
> installation
>     # completed successfully
>     import dbus
>     import re
>     bus = dbus.SessionBus()
>
>     proxy = bus.get_object("org.freedesktop.PackageKit", 
> "/org/freedesktop/PackageKit")
>     iface = dbus.Interface(proxy, "org.freedesktop.PackageKit.Modify")
>
>     try:
>         iface.InstallCatalogs(dbus.UInt32(0), [catalog], "never")
>     except dbus.exceptions.DBusException, e:
>         if e.get_dbus_name() == 
> "org.freedesktop.PackageKit.Modify.InternalError" and \
>         re.match(r"could not do simulate: Package \S+ is already 
> installed", e.get_dbus_message()):
>             return False
>         else:
>             raise(e)
>
>     return True

However, this still has the undesired effect of displaying a dialog when 
the package has been already installed. This is a dealbreaker for me.

Am I missing something? If not, please consider adding a 
IsCatalogInstalled method to the DBus API.

David D Lowe




More information about the PackageKit mailing list