emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
226 stars 17 forks source link

Convince eldev to not bootstrap? #81

Open sellout opened 1 year ago

sellout commented 1 year ago

I’m handing eldev an Emacs with pinned versions of all the packages (eldev, relint, etc.) already there on the load-path. However, eldev still wants to bootstrap and pull everything down itself. How can I convince it to use what’s already provided?

Options like --external only seem to apply to dependencies of my project (which makes sense), but I’m hoping there’s something similar for eldev’s dependencies.

sellout commented 1 year ago

To clarify a bit, I suppose this isn’t quite a bootstrapping issue, as I’m using ELDEV_LOCAL to point to the local eldev, which works. And what I thought wasn’t working, but is is using (eldev-use-local-dependency "path/to/dash") etc. to specify the other dependencies.

However, it still wants to download package archives, even though it doesn’t need to load anything from them, and that’s where I’m currently stuck. I tried (setq package-archives nil) in my Eldev, but that didn’t have any effect.

I finally got it. Four things I needed to do:

  1. ELDEV_LOCAL to avoid downloading Eldev,
  2. eldev-use-local-dependency for each linter & dependency needed,
  3. eldev --external to avoid downloading any archives, and
  4. export HOME="$PWD/fake-home so Eldev could write its pseudo-package temp file somewhere.

This is still a bit awkward in a couple was (e.g., step 2 requires explicitly listing transitive dependencies), but I have a successful build now that doesn’t try to do any networking.

doublep commented 1 year ago

Yeah, this sounds like a bug. I guess Eldev should use provided tools in --external mode if they are enough. I'm not sure if it should try fetching if something is e.g. not installed (does that even work?).

Maybe as a workaround you could try modifying eldev-known-tool-packages for now, by stripping :archive/`:archives'. But I will look into fixing this eventually.

doublep commented 1 year ago

I now tried to reproduce it, but couldn't. I don't have package-lint installed normally, so what I did is trying to run the linter in external mode from some directory:

~/iter2$ eldev clean all; eldev clean global-cache; eldev -X -dt lint package
Deleted 1 directory
Nothing to delete
Started up on Sat Jan 21 13:58:43 2023
Running on GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33, cairo version 1.16.0)
 of 2022-12-03
Project directory: ‘/home/paul/iter2/’
Loading file ‘/home/paul/.eldev/config’...
Loading file ‘Eldev’...
Loading file ‘Eldev-local’...
Executing command ‘lint’...
Going to run the following linter: ‘package’
Running linter ‘package’...
Need the following extra dependencies for set ‘runtime’: package-lint 0.14

Dependency ‘package-lint’ version 0.14 is required, but only 0.12 is installed in ‘~/.emacs.d/elpa’; skipping linter ‘package’
Linter has no complaints
Deleting package archive contents to avoid polluting the external directory: ‘--eldev--’
Finished successfully on Sat Jan 21 13:58:44 2023

It never accesses the network. I even double-verified this by termporarily disabling network connection on my machine. The message it gives is not exactly correct, but that's it. I already have a fix and improvement locally, after which it says instead:

Dependency ‘package-lint’ is not installed in ‘~/.emacs.d/elpa’; skipping linter ‘package’
Either install it there, or use global option ‘--isolated’ (‘-I’)
Required as a development tool, not as a dependecy of the project

However, the only network access I could reproduce is bootstrapping Eldev itself if not available locally (i.e. after setting ELDEV_LOCAL to an empty string and making sure it is not installed yet). However, that is understandable, as if Eldev package is missing, Eldev obviously cannot run. Also note that -X (--external) doesn't apply here, since the package is needed before even parsing the command line, so it needs to be present in the standard location regardless of -X.

I need a full description of the setup where it misbehaves for you.