[rkward-devel] check for debian packages
Milan Bouchet-Valat
nalimilan at club.fr
Wed Apr 18 14:27:05 UTC 2012
Le mercredi 18 avril 2012 à 13:03 +0200, meik michalke a écrit :
> hi,
>
> Am Dienstag, 17. April 2012 17:20:21 schrieb Milan Bouchet-Valat:
> > You would just need to give PK the package name over D-Bus, and it would
> > take care of everything, including PolicyKit authentication via the dialogs
> > adapted to the current desktop environment.
>
> hm, that sounds neat.
>
> however, in a first step of the process, we'd need to check if the package is
> actually available as a *.deb package, and if not, fall back to source
> packages. i understand that PolicyKit is a graphical-desktop-only tool, so
> we'd have to see if you can also query simple package information without the
> full GUI; if not, we'll lose the advantage of looking for package formats
> other than .deb at this stage. but even if it was just .deb for now i'd be
> completely happy ;-) and of course, for the actual installation PolicyKit
> makes a lot of sense anyway.
Indeed. I would argue PackageKit should be smart enough to check the
package exists before asking for authentication, but it doesn't seem to
work that way currently. Luckily, API exists to check for packages
existence before trying to install them:
"Resolve a package name into a package_id. This can return installed and
available packages and allows you find out if a package is installed
locally or is available in a repository."
http://www.packagekit.org/gtk-doc/PkClient.html#pk-client-resolve-async
(for the GLib-based helper library)
http://www.packagekit.org/gtk-doc/Transaction.html#Transaction.Resolve
(for the raw D-Bus interface)
A hacky solution can be to call the command line tool 'pkcon' with
command 'resolve', then parse the output, but that's obviously not the
preferred way.
> i think i'll try to hack together something standalone like an install.deb()
> function [remove.deb() would be needed, too, but i think we could omit
> update.deb() as this is better left to the system globally]. someday^TM. as
> soon as that works, it should be easy to write a wrapper for
> install.packages() which checks if 'type="deb"' and then calls install.deb(),
> otherwise simply forwards everything to the actual base::install.packages().
I think you'd better call it install.distrib(), to avoid the need to
rename it if you make it work for other distributions. ;-)
Cheers
More information about the Rkward-devel
mailing list