-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use node-build as main installation/building drive #272
Use node-build as main installation/building drive #272
Conversation
also some minor text adjustments
@Stratus3D, can you check this? The |
Hey @augustobmoura , sorry the late reply. I will take a look in a few hours. |
README.md
Outdated
|
||
```bash | ||
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-previous-release-team-keyring' | ||
asdf nodejs update-nodebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Is this command really necessary? If this runs before every install command, why would a user need to run it manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just seemed like a useful command in general, for scripting or just a shortcut before running commands directly on the internal nodebuild
command via asdf nodejs nodebuild ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just update node-build
when the user invokes asdf nodejs nodebuild ...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The presence of this command may confuse users. For example, users may think there is a difference between the following sequences:
$ asdf nodejs update-nodebuild
$ asdf install nodejs <version>
$ asdf install nodejs <version>
When in reality they both update the node-build
version, and then install a version of nodejs. The only difference being with the first node-build
is updated twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just update
node-build
when the user invokesasdf nodejs nodebuild ...
?
asdf nodejs nodebuild ...
is just a peek at the current node-build
installation. I don't think we should forcefully update it on the command invocation
The presence of this command may confuse users.
I agree with you. Maybe we should make it more clear that asdf
is already auto-updating node-build
on installations and that running asdf nodejs update-nodebuild
is optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some changes to the documentation, check if that is better
Overall code changes look great but I left a couple comments. I have checked out this code locally and will use it for the next several days. I'll report back if I encounter any issues. |
printf "$(colored $RED ERROR): Pulling the node-build repository exited with code %s\n" "$pull_exit_code" >&2 | ||
printf "Please check if the git repository at %s doesn't have any changes or anything\nthat might not allow a git pull\n" "$ASDF_NODEJS_NODEBUILD_HOME" >&2 | ||
exit $pull_exit_code | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user wants to do a build offline from a previously downloaded nodejs version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the user could place the tarball of the source in $ASDF_DATA_DIR/downloads/nodejs/<version>
and it should work. We might make this easier in the future, but node-build
has some limitations around it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if the script tries to download node-build
first and it fails, the user will not be able to install nodejs even if the archive is already present on their system.
But now I realize this plugin doesn't implement the required bin/download
callback (https://asdf-vm.com/plugins/create.html#environment-variables). That's on me, I never got around to adding it here.
But I think it's good to support users who are offline. If a user has an archive already downloaded to .asdf/downloads
from a past build, they should be able to install if without internet access, so I think the logic here may need to be re-worked a bit so updating node-build is skipped when the user is offline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating node-build
is optional when installing new nodejs versions and will just pop a warning. See the function try_to_update_nodebuild
on bin/install
.
This file is just the custom command for calling it manually, it's used internally on install
but we catch errors accordingly there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got an error when running this:
$ asdf install nodejs 17.2.0
Cloning node-build...
/Users/trevorbrown/.asdf/plugins/nodejs/bin/install: line 52: nodebuild_args[@]: unbound variable
OSX 10.15 with zsh
It's an error on Bash 3, I will fix it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting a different error now:
asdf install nodejs 17.2.0
Trying to update node-build... ok
Usage: node-build [-kpv] <definition> <prefix>
node-build --definitions
node-build --version
-c/--compile Force compilation even if a matching binary exists
-k/--keep Do not remove source tree after installation
-p/--patch Apply a patch from stdin before building
-v/--verbose Verbose mode: print compilation status to stdout
-4/--ipv4 Resolve names to IPv4 addresses only
-6/--ipv6 Resolve names to IPv6 addresses only
--definitions List all built-in definitions
--version Show version of node-build
Thanks for all your work on this! Sorry for having requested changes twice. |
That's a weird error. I will try to pinpoint it.
No worries, I don't think we should rush this. The plugin is already working on master. Even though this would be a huge simplification of the plugin, it's not a top priority. |
looks good!
|
@Stratus3D the comment threads are fine? You think we should merge this? |
Yes. I'm happy with things here if you are. If you want get others to review I'm fine with waiting though. |
Nah it's okay, I just wanted to check if all questions were answered. I'm merging this |
Note that this PR introduced an implicit dependency on It looks like |
good point @timdp , I think we should fix this. Can you show us how to do this with plain old Bash? Thanks! |
I did a bit of research on it, but nothing too deep. I agree that a pure bash solution should be the best, we are open to PRs if you have anything in mind |
I know for a fact that it's not present on every Linux box. For one thing, our CI servers don't have it installed. That's what drove me to this PR. Rounding without (Sent from my phone, please excuse brevity.) |
When introducing new commands I usually use busybox/alpine containers as the baseline. And they have a basic implementation of Searching a bit more I found that just a |
@timdp the fix should be merged on master. Check if that solves the problem |
CI seems happy with the new version. Thanks! 👍 |
The nodejs plugin is now using node-build and no longer needs to verify the sha of the install. See asdf-vm/asdf-nodejs#272 for more information
Heavily inspired by the #221 PR, the idea is to keep an internal installation of node-build and use theirs build/installation system that is far more mature than what we have. Aside from that, is a really good idea to centralize the know-how about building and installing node versions, and node-build seems like a great candidate for that type of project.
In this PR I refactor the install script to use
node-build
as the main installation/building driver. We manage an internalnode-build
repository and try to update it before every installation.We are also adding two additional commands added in this PR for helping manage the local installation:
asdf nodejs update-nodebuild
: For updating/cloning the localnode-build
repositoryasdf nodejs nodebuild
: A wrapper around the node-build command with the correct environment and configuration for working withasdf-nodejs
The README was heavily refactored to reflect the new building system and its possibilities.
Because
node-build
already has a built-in checksum offline strategy we don't need to query live keyservers for checking signatures anymore. A major pain point of the current installation process is how flaky and cumbersome is querying current keyservers.Other asdf projects that uses similar strategies of "outsourcing" the installation process to community tools:
python-build
ruby-build
bob
kerl
Closes #241, closes #192, closes #190, closes #189, closes #171, closes #133, closes #128, closes #106, closes #92, closes #78, closes #26