LoopPerfect / buckaroo

The decentralized package manager for C++ and friends 🏝️
https://buckaroo.pm
MIT License
934 stars 33 forks source link

Improve error message if user tries to install a non buckaroo package #318

Open nikhedonia opened 5 years ago

joeflack4 commented 5 years ago

I might be able to help with this. @nikhedonia Would you be able to provide me some feedback first, though?

  1. Any tips for getting started if I've never used F# before?

  2. Also, I was going to post an issue before I found this one. I'm wondering, what you are describing by this issue is precisely improving the following type of error message in my own example below, correct?

(mdrtb) Joe:mdrtb joeflack4$ buckaroo add catch2
Error in Ln: 1 Col: 11
add catch2
          ^
Note: The error occurred at the end of the input stream.
Expecting: '/'
  1. Any input on what you'd like to see instead? Maybe something like this?

i. User does not specify version

(mdrtb) Joe:mdrtb joeflack4$ buckaroo add catch2
Please verify the package version. For example: 'catch2@x.y.z'

ii. User specifies version, but package was not found

(mdrtb) Joe:mdrtb joeflack4$ buckaroo add catch2@x.y.z
Version 'x.y.z' of package 'catch2' was not found.
joeflack4 commented 5 years ago

Actually, you can probably tell that I'm new. I'm not even sure if semvar (x.y.z) is valid for installing package version. Is only the link to GitHub valid?

joeflack4 commented 5 years ago

Here's another bad error message I found. Basically I was trying to see if there was an alternative to branch=:

(mdrtb) Joe:mdrtb joeflack4$ buckaroo add github.com/catchorg/Catch2@release=v2.10.2
Error in Ln: 1 Col: 32
add github.com/catchorg/Catch2@release=v2.10.2
                               ^
Expecting: decimal digit, '!', '*', '+', '<', '<=', '>', '>=', 'V', '^', 'all('
, 'any(', 'branch=', 'revision=', 'tag=', 'v' or '~'

The parser backtracked after:
  Error in Ln: 1 Col: 39
  add github.com/catchorg/Catch2@release=v2.10.2
                                        ^
  Expecting: Ascii letter or '-'
njlr commented 5 years ago

This is quite an old issue, but I think the experience still could be better.

Yes, GitHub packages are identified by a GitHub URL.

For example:

buckaroo add github.com/buckaroo-pm/catch2@1.12.1
njlr commented 5 years ago

Documentation is here: https://github.com/LoopPerfect/buckaroo/wiki/Version-Constraints-DSL

joeflack4 commented 5 years ago

And this one. It said failed to resolve, but not why. In this case, it's simply because the Catch2 project hasn't set up for buckaroo / doesn't have a buckaroo.toml file. The error message might want to describe that.

(mdrtb) Joe:mdrtb joeflack4$ buckaroo add github.com/catchorg/Catch2@branch=master
info Adding dependency on github.com/catchorg/catch2 at branch=master
[git] info Fetching refs from https://github.com/catchorg/catch2.git
[git] success Fetched 159 refs in 0.267
[git] info Shallow cloning https://github.com/catchorg/catch2.git
[solver] warning Unresolvable: github.com/catchorg/catch2@branch=master
error Failed to add the dependency
joeflack4 commented 5 years ago

@njlr Thanks! Will check that out.

Thanks for the command as well. I was able to install it. However, I do have more questions now, related to catch2 specifically.

  1. Why did 1.12.2 work, but not the newest version listed there, which is 2.4.2? The latter version is listed both in releases and in tags.
  2. Why does the releases page for buckaroo-pm/catch2 show that 1.12.1 was released after 2.4.2?
  3. I haven't read the docs yet, but would it be easy for me to submit a PR to buckaroo-pm/catch2 for a more updated version (e.g. the latest version, which is 2.10.2)? I will explore the documentation, and maybe find an answer to this on my own.
njlr commented 5 years ago

The projects under the buckaroo-pm user are forks we maintain that have buckaroo.toml and BUCK files added.

To answer your questions:

  1. We haven't added a buckaroo.toml file for 2.4.2 yet

  2. The timestamps you see are when the tag was updated by us adding these files, not the release date of the upstream code.

  3. This process is a bit in flux right now since we are changing the process a little whilst adding Bazel support to the packages.

I will look into porting 2.10.2 now.

njlr commented 5 years ago

BTW, you can always fork Catch yourself and add the appropriate files.

Once you've done that, it would be something like:

buckaroo add github.com/joeflack4/catch2
njlr commented 5 years ago

This should work now:

buckaroo add github.com/buckaroo-pm/catch2@2.10.2
joeflack4 commented 5 years ago

Thanks a ton! I'll use that.

Regarding your other comments, I figured most of that, but not all. Thanks for the clarification.

Regarding the main topic of this issue, do you think I was on track with some of my suggestions for the error messages? Is this issue something that you all are still looking for outside help on? Since I've never used F# before, do you have any pro tips / pitfalls to avoid?

njlr commented 5 years ago

There is a guide to getting the tools / dev environment setup here: https://github.com/LoopPerfect/buckaroo/blob/master/CONTRIBUTING.md

Contributions are always welcome!