-
Notifications
You must be signed in to change notification settings - Fork 44
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 powershell command for download #144
base: master
Are you sure you want to change the base?
Conversation
Use powershell command as proposed in JuliaLang#25477. Later on, I'd prefer only one download function in Base that would work - or would be easy to overwrite in .juliarc for really specific configuration.
I guess we could simply use |
kinda stale, but that's #81. either way, should preserve the retrying |
Good point, retying preserved. Good to know that in both JuliaLang/julia#25477. and this PR the TLS1.2 is required - and is only supported by .NET 4.5 and above. So on my win server 2012R2 this is installed by default, but for Win7, wou have .NET 3.5 bundled and you need to update it yourself. Nice summary here. And I'm very positive to have only one download function in base and use it everywhere - but I'd also like a optional hook-in mechanism such that the user might customize it for some corner cases - on clusters, in corporate environment, etc... The custom routine might ask e.g. a linux machine by ssh to download it for you to a shared storage and than copy it from that place to the destination place. |
On Julia 0.7 replace command changed - added compat macro + version bump |
So I guess we can't use |
I don't see a reason why we couldn't do the retry feature. Just replace It's really a huge pain to struggle with firewalls, SSL, TLS etc. to find out that only WinRPM has problem downloading a single "index file" whereas JuliaBase, BinDeps, Conda, pip and shell are OK. Or vice versa. For me, it should be fixable on one central place only. In the best case with some hook-in mechanism that allows the tweaking/hacking without the need to modify the code of Julia |
src/WinRPM.jl
Outdated
client = "New-Object System.Net.Webclient" | ||
# in the following we escape ' with '' (see https://ss64.com/ps/syntax-esc.html) | ||
filename = joinpath(tempdir(), split(source, "/")[end]) | ||
downloadfile = "($client).DownloadFile('$(@compat replace(source, "'" => "''"))', '$(@compat replace(filename, "'" => "''"))')" |
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.
shouldn't need the at-compat macro for these, believe they're method extensions in compat rather than syntax rewrites
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.
Actually, the old method replace(str, pat, r)
has been deprecated in 0.7 with replace(s::AbstractString, pat=>r; [count::Integer])
. Therefore the @compat
for use on both 0.6 and 1.0.
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.
@compat
is only needed for syntactic changes. Else you just need using Compat
somewhere (either in the file or once for the whole package).
Good point. Better try that then. |
The support for win7 starts to be a mess. For PS download using TLS1.2 PowerShell at least at version 3 is a must (PS 2.0 uses .Net 2.0 that has no chance to get TLS1.2 through). I'd recommend anyone on win7 to install PS 5.1 wmf 5.1. |
src/WinRPM.jl
Outdated
end | ||
warn("""Unknown download failure. WinRPM download function relies on Windows PowerShell functionality. | ||
Check that PowerShell 3 or higher is installed and TLS 1.2 protocol support enabled.)""") |
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.
Extra trailing )
in message
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.
Fixed.
and for people who don't have admin rights and are unable to update powershell? |
One of my motivation for this PR is to re-run discussion that didn't happen prior JuliaLang/julia#25477 rapid merges. Problems there would resurface for win users after 1.0 release - WinRPM might do the burn test in a more flexible way. The original ccall to And it's only Windows7 that is affected, anything newer works out-of-the-box. And note that even with But, as I noted before, anything more elegant that always works would be better - and in that case, I'd like it to be implemented in |
Changes to Base.download won't happen on 0.6 of course. Win 7 without admin rights is likely more common than any windows server versions, particularly without the admin rights needed there to adjust the security settings. There's no clear best single option here, but trying a few with fallbacks seems better than clearly regressing in a known and previously supported configuration. |
I see your point. I also didn't know there is the link to the EasyFix page directly below the 0.6.2 download link. |
I'd be inclined to use the same approach as |
I'm not familiar with versioning during 0.7-DEV. How can I find the .XXXX number for the PR#25477? |
Using |
Let's keep the 0.6+ version untouched and let's just improve things for 0.7 - unification to Base.download regardless of windows/unix/mac. Added retry functionality + better error message on windows (as Base.download does not provide any. |
src/WinRPM.jl
Outdated
end | ||
warn("""Unknown download failure in `Base.download` function""") | ||
if iswindows() |
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.
Can we just rethrow the exception raised by Base.download
? It needs to print a more helpful error message anyway (e.g. it could check what PowerShell version is installed), so no need to duplicate that logic.
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.
We shouldn't rethrow the error. This is not what the rest of WinRPM code expect - it expects to print the error as a warning and send a errcode !=200. The WinRPM.update
function then silently recovers and tries a different provider.
- I'd suggest catching an error thrown by
Base.download
, display it as a warning and continue the same path the old code expects. And we should update theBase.download
function to give more info in its error exception. - Or, we can rewrite also the other parts of WinRPM - but that won't bring much functionality either.
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.
Makes sense. Just printing the message should be OK.
So, you think we should rather enhance the |
Yes, but I don't think we need a |
OK, so let's just do the minimal change, only affecting 0.7. Since 0.7 we'll rely on |
resize!(dest, findfirst(iszero, dest) - 1) | ||
filename = transcode(String, dest) | ||
try | ||
filename = joinpath(tempdir(), split(source, "/")[end]) |
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.
this looks highly likely to have collisions
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.
So you'd rather not enforce the filename?
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.
No, don't drop most of source.
Update the branch
Use powershell command as proposed in JuliaLang/julia#25477.
Later on, I'd prefer only one download function in Base that would work - or would be easy to overwrite in .juliarc for really specific configuration.
Fixes #47.