-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
Auto xz #607
Auto xz #607
Conversation
The CHANGELOG lines I suggested are already committed on my branch -- it started as an attempt to copy over the documentation changes from I can easily remove the commit that includes these documentation changes, if you'd like to draft them up yourself. I accidentally left the command-line flags ( |
Includes platform/feature detection to guess if the user has the ability to decompress xz tarballs using `tar`. Doesn't attempt to fetch/decompress xz tarballs for Node versions less than 4. (KISS). The feature is set up to use xz instead of gz by default, but the default behavior is easily configurable. Co-authored-by: John Gee <[email protected]>
I made a branch where I simply copy-paste the xz section from the file It's more concisely worded, and has the benefit of explaining the command-line flags. If you'd like that pushed to this branch, I can easily do so. Also: I updated the wording in my suggested Lastly: I rebased on |
(By the way, I tested this PR, and it worked as expected. Here is a branch I put together with For ease of review, and demonstrating the soundness of the port. |
Plenty here thanks. I was happy with the pattern we worked out for I'm heading for a big release on another product, so might be a couple of weeks before I work on this.
I do like the copy-paste wording better. |
Considering going with the original
Somewhat torn on whether the new situation ( It's an unexpected behavior change for a subset of a subset of people, so much so that it may be zero actual users: People who have enabled xz in |
I also had some thoughts about the environment variable, and there being a "default on" but also a user-indicated "explicit on."
Between these two things, much of the code for this feature could be simplified or removed. So I thought I'd bring that up before this is merged, since I feel once the code were to be merged it would probably stick around. (I feel some guilt at influencing |
No need to call out the changed behaviour as such, likely affects no one, and non-breaking in the sense it will continue to work with gzip. (Both as you noted.)
It is a bit over-engineered, but I'm comfortable that we give people control in case of issues initially. Especially since we can only make an educated guess whether |
* CHANGELOG.md: Copy xz entry from the nvh changelog Copied and pasted from here: https://github.com/shadowspawn/nvh/blob/master/CHANGELOG.md * README.md: Copy xz info from docs at nvh repo Copied and pasted from here: https://github.com/shadowspawn/nvh/blob/master/docs/environment-variables.md ("NVH" changed to "N" as appropriate.) Co-authored-by: John Gee <[email protected]>
I updated this PR to use the original Everything here is now a copy-pasted version of the feature and docs as they appear in Here's a list of the changes that were made to the script itself so as to follow the style of
if test "$N_USE_XZ" = "true"; then
local tarflag="-Jx"
else
local tarflag="-zx"
fi (The above code snippet is from this PR for local tarflags="-zx"
if [[ "${NVH_USE_XZ}" = "true" ]]; then local tarflags="-Jx"; fi (The above code snippet is from |
# For research, see https://github.com/shadowspawn/nvh/issues/8 | ||
local uname_s="$(uname -s)" | ||
if [[ "${uname_s}" = "Linux" ]] && command -v xz &> /dev/null ; then | ||
# tar on linux is likely to support xv if it is available separately |
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'd suggest rewording this:
# tar on linux is likely to support xv if it is available separately
available separately
-->
available on the PATH
Also, a typo:
xv
--> xz
Pull Request
Problem
Somewhat smaller archives are available, compressed with xz. However,
n
currently only uses gzip archives. (Edit to add: TheN_USE_XZ
environment variable is already implemented/respected inn
, but this obscure feature is likely not used very heavily. Having it on by default would make more of an impact.)See: #606
Solution
Determine if using xz is possible for the current user/desired version of node. If using xz seems possible, fetch/decompress an archive compressed with xz, instead of an archive compressed with gzip.
tar
on the user's system, based on research of likely Linux/macOS configurations.ChangeLog
Added
N_USE_XZ
(other than0
), including setting it to be null or empty, to enable xz-compressed tarballs, overriding whatever the default behavior may be.N_USE_XZ
entirely in order to returnn
to its default behavior.)Changed
N_USE_XZ
as0
will now have the effect of disabling the use of tarballs compressed with xz, rather than enabling it. (Previously, exportingN_USE_XZ
as any non-zero-length value, including the number0
, would enable the use of xz-compressed tarballs.)