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

07 fixes + tests #147

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
julia 0.6
julia 0.7-alpha
Compat 0.42.0
URIParser 0.0.3
@unix HTTPClient 0.0.0
LibExpat 0.2.8
Libz
CodecZlib 0.4
BinDeps 0.3
SHA
45 changes: 45 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
environment:
matrix:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"WinRPM\"); Pkg.build(\"WinRPM\")"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"WinRPM\")"
29 changes: 14 additions & 15 deletions src/WinRPM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if isunix()
using HTTPClient.HTTPC
end

using Libz, LibExpat, URIParser
using CodecZlib, LibExpat, URIParser

import Base: show, getindex, wait_close, pipeline_error

Expand Down Expand Up @@ -153,7 +153,7 @@ function update(ignorecache::Bool=false, allow_remote::Bool=true)
warn("received error $(data[2]) while downloading $source/$path")
return nothing
end
body = gunzip ? Libz.decompress(convert(Vector{UInt8},data[1])) : data[1]
body = gunzip ? transcode(GzipDecompressor, convert(Vector{UInt8}, data[1])) : data[1]
open(path2, "w") do f
write(f, body)
end
Expand Down Expand Up @@ -447,7 +447,13 @@ function do_install(packages::Packages)
end
end

const exe7z = iswindows() ? joinpath(BINDIR, "7z.exe") : "7z"
const exe7z = if try; success(`7z`) catch; false end;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a good idea to use any old random version that happens to be on the path, the behavior has been version-specific in ways that have broken this package

"7z"
elseif iswindows()
joinpath(BINDIR, "7z.exe")
else
error("No 7z installed. Please install it for your machine")
end

function do_install(package::Package)
name = names(package)
Expand All @@ -459,25 +465,18 @@ function do_install(package::Package)
error("failed to download $name $(data[2]) from $source/$path.")
end
cache = getcachedir(source)
path2 = joinpath(cache,escape(path))
path2 = joinpath(cache, escape(path))
open(path2, "w") do f
write(f, data[1])
end
info("Extracting: ", name)

if VERSION < v"0.7.0-DEV.2181"
cpio = splitext(path2)[1]*".cpio"
else
cpio = splitext(joinpath(cache, escape(basename(path))))[1] * ".cpio"
end

cpio = splitext(path2)[1]*".cpio"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong way around, should use the newer code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that was actually failing for me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you using a nightly binary of Julia, or something else? if your code was picking up whatever happened to be on the path, it could easily have been an older version with different behavior

local err = nothing
for cmd = [`$exe7z x -y $path2 -o$cache`, `$exe7z x -y $cpio -o$installdir`]
for cmd = (`$exe7z x -y $path2 -o$cache`, `$exe7z x -y $cpio -o$installdir`)
(out, pc) = open(cmd, "r")
stdoutstr = read(out, String)
if !success(pc)
wait_close(out)
println(stdoutstr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't hide error output

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch - thought that was one of my debugging println

err = pc
if isunix()
cd(installdir) do
Expand All @@ -486,7 +485,7 @@ function do_install(package::Package)
end
end
end
isfile(cpio) && rm(cpio)
(try; isfile(cpio); catch; false end;) && rm(cpio)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would this throw?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, it did though... I think this is the whole isfile can throw on windows issue...Maybe it got fixed on latest master. @KristofferC, you're probably up to date on this?

Copy link
Contributor

@tkelman tkelman Jun 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what error, and with what input path?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isfile throws on Windows for url for example, see JuliaLang/julia#26685

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is cpio ever going to have colons? it shouldn't include http:// or things like that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just saying when isfile would fail. Whether this ever can happen here I don't know.

err !== nothing && pipeline_error(err)
break
end
Expand Down Expand Up @@ -519,7 +518,7 @@ end

include("winrpm_bindeps.jl")

# deprecations
# deprecations
@deprecate help() "Please see the README.md file at https://github.com/JuliaPackaging/WinRPM.jl"

end
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using WinRPM
using Test
WinRPM.install("gcc", yes = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has the same problem as #95 (comment) - it should clean up after itself instead of making a mess of the user's environment

gcc = joinpath(WinRPM.installdir, "usr", string(Sys.ARCH, "-w64-mingw32"), "sys-root", "mingw", "bin", "gcc.exe")

@test success(`$gcc --version`)