emacs-helm / helm-system-packages

A Helm interface to the package manager of your operating system
GNU General Public License v3.0
105 stars 11 forks source link

Use package-kit #28

Open DamienCassou opened 5 years ago

DamienCassou commented 5 years ago

PackageKit is an high-level interface to handle package managers of many distributions including apt, dnf, pacman, portage, urpmi...

To get the list of packages, you have to write something like that (in a buffer with lexical-binding:t):

(let ((transaction (dbus-call-method
                    :system
                    "org.freedesktop.PackageKit"
                    "/org/freedesktop/PackageKit"
                    "org.freedesktop.PackageKit"
                    "CreateTransaction"))
      (count 0))

  (dbus-register-signal
   :system
   "org.freedesktop.PackageKit"
   transaction
   "org.freedesktop.PackageKit.Transaction"
   "Package"
   (lambda (&rest arguments)
     ; in `arguments`, you get the package name, the installation status and a summary
     (cl-incf count)))

  (dbus-register-signal
   :system
   "org.freedesktop.PackageKit"
   transaction
   "org.freedesktop.PackageKit.Transaction"
   "Finished"
   (lambda (&rest arguments)
     (message "Finished with %d packages" count)))

  (dbus-call-method
   :system
   "org.freedesktop.PackageKit"
   transaction
   "org.freedesktop.PackageKit.Transaction"
   "GetPackages"
   :uint64 4))
Ambrevar commented 5 years ago

This is interesting.

I don't use it (it does not support Guix) so I'm not completely sure but my understanding is that it competes on the same level as Helm System Packages. While we can certainly re-use it, I wonder if there is an incentive for people using a PackageKit interface to use Helm System Packages.

@DamienCassou: Do you use any PackageKit interface? How does it compare to Helm System Packages? Are there missing features on both sides?

Anyways, if adding an interface to PackageKit allows Helm System Packages to support 4-5 more package managers, I guess it's a good idea to give it a shot.

DamienCassou commented 5 years ago

I don't use it (it does not support Guix)

Nix is supported ;-).

it competes on the same level as Helm System Packages

PackageKit abstracts away the package manager and provides a D-Bus API, a C library and a command-line interface. Some GUIs have been built on top, e.g., the Gnome Software application to install packages.

If you see helm-system-packages as an helm interface to control your package manager, then both would work quite fine together. Write a module for PackageKit and you can get rid of most of the other modules :-). I would certainly like to keep doing things from Emacs.

Do you use any PackageKit interface? How does it compare to Helm System Packages? Are there missing features on both sides?

I mostly used dnf on the command-line. Now I'm slowly switching to Helm System Packages. I rarely use Gnome Software.

Ambrevar commented 5 years ago

Is Nix supported? I don't see it here: https://www.freedesktop.org/software/PackageKit/pk-matrix.html.

I'm happy to merge a PackageKit interface. I won't get rid of the other interface though because:

DamienCassou commented 5 years ago

Pierre Neidhardt notifications@github.com writes:

Is Nix supported? I don't see it here: https://www.freedesktop.org/software/PackageKit/pk-matrix.html.

This website seems out of date. Here is the ./configure template:

https://github.com/hughsie/PackageKit/blob/master/configure.ac#L356

As you can see, there is a --enable-nix option.

-- Damien Cassou http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill