zef icon indicating copy to clipboard operation
zef copied to clipboard

zef pre-run test

Open finanalyst opened this issue 4 years ago • 14 comments

I am installing Rakudo on a new server, and ran into the backend not configured problem. It took a while to realise that git had not been installed (fresh server).

Suggestion

Would it be possible to have a one-off zef-check option that zef runs the first time that verifies whether software it relies on is present in a system, eg. git, curl, unzip. A bit like the environment checks that are in a makefile.

These 'environment' softwares are normally available on a developer's system, but not on a fresh server, or one where the intention is to install a minimum number of dependencies.

finanalyst avatar May 29 '20 14:05 finanalyst

Well those backend are all plugins. For instance no one on Linux cares that powershell is not installed. Additionally the only required backend is the one for handling paths — everything else (tar, git) is extra and depends on the ecosystems you need to use and can’t be determined until runtime when you actually give it a query (it can’t know you need git until it has to look for something and ends up with a git url, which is not always the case).

ugexe avatar May 29 '20 14:05 ugexe

However a command that outputs all the plugins and if their ‘probe’ status is true would be viable.

ugexe avatar May 29 '20 14:05 ugexe

I think that output from a probe for all plugins would be good. So if zef fails because a plugin fails, there is some more information about which one. Although when I got the info back, I checked unzip and curl. I didn't think to check if I had git. So I went looking elsewhere.

finanalyst avatar May 29 '20 14:05 finanalyst

My suggestion if one tries to install git hosted module and git client is not here, zef will notify it

melezhik avatar May 29 '20 15:05 melezhik

zef already notifies you of the possible backend missing in such a scenario

ugexe avatar May 29 '20 15:05 ugexe

I see. Does it notify about absence of git client?

On May 29, 2020 10:18 AM, "Nick Logan" [email protected] wrote:

zef already notifies you of the possible backend missing in such a scenario

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ugexe/zef/issues/350#issuecomment-636030673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHRHSPMOAJSLFM5BE477TLRT7G3LANCNFSM4NOCTFYQ .

melezhik avatar May 29 '20 15:05 melezhik

Enabled fetching backends [git path curl wget] don't understand $foobar
You may need to configure one of the following backends, or install its
underlying software - [git wget]

ugexe avatar May 29 '20 15:05 ugexe

It seems the information is there, but perhaps rewording the message might help. Instead of

You may need to configure one of the following backends, or install its
underlying software - [git wget]

Perhaps the following

The following packages are needed by zef [ git wget ] but are either missing 
or have a non-standard configuration. Try installing or reinstalling [ git wget ].

finanalyst avatar Jun 13 '20 12:06 finanalyst

That wording only makes sense for those specific backend. It doesn’t make sense for e.g. the powershell or perl based backends. The error message only tells us the adapter itself could not load, which may not even shell out to something so just using stronger wording to suggest what is missing will just make it confusing in a different way.

ugexe avatar Jun 13 '20 12:06 ugexe

And those backends aren’t needed by zef... someone else might have written a different curl backend (which is actually the case)

ugexe avatar Jun 13 '20 12:06 ugexe

hi @ugexe I second @finanalyst option. Irrespective on zef underlying model, is it a big deal for zef to check that git installed or nor not and then just say so? On my experience we have so many cases when git is not installed and this why zef could not install git based Raku modules which for the moment quite a few.

melezhik avatar Jun 13 '20 13:06 melezhik

The error message only tells us the adapter itself could not load, which may not even shell out to something so just using stronger wording to suggest what is missing will just make it confusing in a different way.

right, so maybe that is the issue with git backend?

melezhik avatar Jun 13 '20 13:06 melezhik

or maybe we need to change zef backends API, when plugin might have a configuration method, which should return false and detailed information if any of backend dependencies are missing, so that zef could call backend.configure before start using a backend?

melezhik avatar Jun 13 '20 13:06 melezhik

On my experience we have so many cases when git is not installed and this why zef could not install git based Raku modules which for the moment quite a few.

which should return false and detailed information if any of backend dependencies are missing

I mean it literally tells you "You may need to configure one of the following backends, or install its underlying software - [git wget]" as soon as it knows it needs something you don't have to do what you ask. You can install local path modules without curl/wget/etc, and indeed almost every single raku user uses this workflow as the first thing they do raku -I. bin/zef install . (and thus requires no git/curl/wget/powershell fetcher to be configured. An interactive initial start would be terrible -- see cpanm over cpan)

ugexe avatar Jun 13 '20 15:06 ugexe