emacs-helm / helm-system-packages

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

[WIP] Add tramp support #12

Closed dvzubarev closed 6 years ago

dvzubarev commented 6 years ago

The first step for working with remote hosts is to replace all call-process with process-file. Now one can run M-x helm-system-packages from a remote buffer or a remote dired directory and receive packages from this remote host. Install/uninstall works fine, since eshell supports tramp. I tested only for dpkg, before merging should be tested for all other managers, I suppose. There are few problems left, however:

Before I continue, I wanted to be sure, that you are interested in supporting tramp in this package.

Ambrevar commented 6 years ago

Excellent idea, thank you very much for this one!

I'm now on an pacman-based system so I can test that.

Regarding the "find files", I think we can use disply-to-real Helm attribute to prepend the TRAMP path.

For the caches: actually a "save" mechanism is already used to find dependencies recursively. It's not very pretty at the moment. I suggest we store all the caches in an alist of

(TRAMP-PATH name-cache description-cache)

With the empty TRAMP-PATH "" being the localhost.

The current cache could be stored in helm-system-packages--tramp-path or something similar.

For the -deps functions, we could use a special key or dedicated variables. I've still got to think this through.

Ambrevar commented 6 years ago

Forgot about the shells: yes, it's totally possible to have one Eshell session per host. We could simply name the buffers *helm-system-packages-shell <TRAMP-PATH>* or something like that.

Ambrevar commented 6 years ago

Back to work: I tried your suggestion and it works beautifully! Thanks! Now the first thing to fix before everything else is executable-find. I think we should use tramp-find-executable. The following does not work if I run it on a TRAMP connection to a pacman host:

(tramp-find-executable (car (tramp-list-connections)) "pacman" exec-path)

Any clue how it works?

Ambrevar commented 6 years ago

Sorry, I misread the output, it actually works.

(if (tramp-tramp-file-p default-directory)
    (tramp-find-executable (car (tramp-list-connections)) (car p) nil)
  (executable-find (car p)))

Now I need to get the TRAMP connection associated with the default-directory since I don't think (car (tramp-list-connections)) will work with multiple TRAMP connections. Do you know how to do that?

Ambrevar commented 6 years ago

OK, found it: (tramp-dissect-file-name default-directory) will return the current connection structure.

I've pushed the changes to a tramp-support branch. I've opened a different pull request (#15) to validate the changes. Closing here.