[packagekit] Installing PackageKit catalogs

Daniel Nicoletti dantti85-pk at yahoo.com.br
Mon Aug 16 10:47:24 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.
Yes, catalogs are a file that you put on your website or ship with your app
that does the installing job for you.
It will contain that package names matching each distro which does not
make sense to somehow be used to check if packages are installed

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

Yes the FAQ is not so good about explaining all the methods (you can help 
writting some :D )



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

hmm probably outdated


> If the DBus API has changed  in a new release, again I apologise. However, I 
>suspect that the documentation  is out of date here.

I bet it is.

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

Yes, you can send hide-foo,show-bar,hide-* altogheter

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

in gnome gconf can prevent your options, on kde I'll probably disable some of 
these options
as I don't know yet how an admin could control that...

> 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?

hmm now I understand your issue. As I don't know exactly your app I think you
should not do this kind of thing.

For example a burner app (K3B) starts and checks to see if cdrecord is 
installed,
but this check if much faster and more reliable if done in the shell because
the user might have installed a compiled version which the package manager
knows nothing.
If the command is not found call install catalog which will try to install all 
missing
packages.

does it sound better? (Also it might be slow to check this every time your app 
loads)


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

This might be a bug, tought I never tested it myself on the gnome version.
As Richard is on hollydays you would have to wait to make sure about that,
if I get some time I'll try testing this.

Best,
Daniel.

> 
> David D  Lowe
> 
> _______________________________________________
> PackageKit  mailing list
> PackageKit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/packagekit
> 


      




More information about the PackageKit mailing list