Skip to content
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

Restore mirror capability #210

Merged
merged 7 commits into from
Dec 12, 2016
Merged

Restore mirror capability #210

merged 7 commits into from
Dec 12, 2016

Conversation

jasonkarns
Copy link
Member

@jasonkarns jasonkarns commented Nov 14, 2016

node-build will not provide a default mirror, but this PR at least restores the ability to select a mirror from which to download packages.

  • fix 2 failing tests
  • fix mirror_url formulation (currently follows ruby's mirror url format, which is $mirror_host/$checksum. Needs to be a regular mirror copying full url structure. see Add mirror support #208 (comment)

closes #208

@jasonkarns
Copy link
Member Author

@dochang Here's the restoration of the original mirror feature. If you are able, we need to first get the tests passing in this branch. I'm 99% sure the code is correct and that it's the tests that aren't correct. PRs welcome (opened against this branch) to fix the tests so that they pass.

Once the tests are green, we'll change functionality so that it doesn't rely on ruby's mirror_host/checksum format.

Cool?

@jasonkarns
Copy link
Member Author

tests green! time to fix formulation of mirror URL

Some changes were made to the mirror tests in upstream during the time
that node-build didn't have mirror support, thus those upstream changes
were missed. This replays those changes manually to the mirror tests.
An rbenv mirror has a customized repository layout: ruby tarball's url
format is like

```
$RUBY_BUILD_MIRROR_URL/$checksum
```

not like

```
$RUBY_BUILD_MIRROR_URL/2.3/ruby-2.3.1.tar.bz2
```

Common node mirrors just use the same URL structure as nodejs.org
(though typically with the /dist path segment removed).

Subsequent PRs will need to make the mirror url formulation more robust.
see #208 (comment)
Not all mirrors will use the identical scheme of matching the nodejs.org
url structure with `/dist` omitted. Now users may specify
`NODE_BUILD_MIRROR_CMD` to be the name of a command or function which
constructs the full mirrored package URL when given the original package
URL and checksum as arguments.

If omitted, the default scheme is used wherein NODE_BUILD_MIRROR_URL is
substituted for `https://nodejs.org/dist/`

The presence of *either* NODE_BUILD_MIRROR_URL or NODE_BUILD_MIRROR_CMD
is sufficient to trigger a mirror attempt.
@jasonkarns
Copy link
Member Author

@dochang would you be able to verify whether this PR works for you? Also, could you share all of the nodejs mirrors (and their respective URL structures) that you're aware of?

@dochang
Copy link

dochang commented Dec 10, 2016

@jasonkarns jasonkarns merged commit 2fa21cd into master Dec 12, 2016
@jasonkarns jasonkarns deleted the restore-mirror-capability branch December 12, 2016 14:23
dochang added a commit to dochang/dotfiles that referenced this pull request Dec 13, 2016
Because nodenv supports NODE_BUILD_MIRROR_URL now [1], [2].

[1]: nodenv/node-build#208
[2]: nodenv/node-build#210
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants