diff --git a/REQUIRE b/REQUIRE index 89b198a..a4a0ea4 100644 --- a/REQUIRE +++ b/REQUIRE @@ -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 diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..52a4752 --- /dev/null +++ b/appveyor.yml @@ -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\")" diff --git a/src/WinRPM.jl b/src/WinRPM.jl index 3a244a5..9d59114 100644 --- a/src/WinRPM.jl +++ b/src/WinRPM.jl @@ -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 @@ -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 @@ -447,7 +447,22 @@ function do_install(packages::Packages) end end -const exe7z = iswindows() ? joinpath(BINDIR, "7z.exe") : "7z" +const exe7z = if Sys.iswindows() + _exe7z = joinpath(Sys.BINDIR, "7z.exe") + if isfile(_exe7z) + _exe7z + else # if it's not located in win-extras lets get it catched by the second isfile check + joinpath(Sys.BINDIR, "..", "..", "dist-extras", "7z.exe") + end +else + joinpath(Sys.BINDIR, "7z") +end + +if !isfile(exe7z) && success(`7z -h`) + warn("We're using 7z installed on your system. It might be out of date and cause problems. This usually happens when you're on windows with Julia compiled from source, and you didn't execute: `make win-extras` to get 7zip") +elseif !isfile(exe7z) + error("No 7z installed. Please install it for your machine. If you're on windows and compiled Julia from source, you need to also execute `make win-extras` to get 7zip") +end # else we're fine! function do_install(package::Package) name = names(package) @@ -459,25 +474,19 @@ 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(joinpath(cache, escape(basename(path))))[1] * ".cpio" 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) + println(stderr, stdoutstr) err = pc if isunix() cd(installdir) do @@ -519,7 +528,7 @@ end include("winrpm_bindeps.jl") -# deprecations +# deprecations @deprecate help() "Please see the README.md file at https://github.com/JuliaPackaging/WinRPM.jl" end diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..8e9fe9e --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,9 @@ +using WinRPM +using Test + +if haskey(ENV, "CI") && haskey(ENV, "WINRPM_DO_THE_TEST") && ENV["WINRPM_DO_THE_TEST"] == "true" + WinRPM.install("gcc", yes = true) + gcc = joinpath(WinRPM.installdir, "usr", string(Sys.ARCH, "-w64-mingw32"), "sys-root", "mingw", "bin", "gcc.exe") + + @test success(`$gcc --version`) +end