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 all 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\")"
37 changes: 23 additions & 14 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,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")
Copy link
Contributor

Choose a reason for hiding this comment

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

If the problem is that you're trying to test packages in source builds on windows, it would be better to fix this in your personal build process rather than copy-paste these fallbacks everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

So do the stuff for cross compiling and creating an installer!?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or make install and copy files around. Otherwise the environment you're testing in and the environment that practically every Windows user will be working in will have discrepancies.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I still don't see the exe in the right folder:

sdani@LAPTOP-4CL7JAI3 ~/julia
$ make win-extras
...
sdani@LAPTOP-4CL7JAI3 ~/julia
$ make install

/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/usr/bin/julia /home/s                                                                                                                                                                                                                                                                                                                                                        dani/julia/julia-abab96668c/bin/
/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/usr/bin/*.dll /home/s                                                                                                                                                                                                                                                                                                                                                        dani/julia/julia-abab96668c/bin/
/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/usr/lib/libjulia.dll.                                                                                                                                                                                                                                                                                                                                                        a /home/sdani/julia/julia-abab96668c/lib/
/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/usr/bin/libopenlibm.d                                                                                                                                                                                                                                                                                                                                                        ll.a /home/sdani/julia/julia-abab96668c/lib/
# Copy public headers
cp -R -L /home/sdani/julia/usr/include/julia/* /home/sdani/julia/julia-abab96668                                                                                                                                                                                                                                                                                                                                                        c/include/julia
# Copy system image
/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/usr/lib/julia/sys.dll                                                                                                                                                                                                                                                                                                                                                         /home/sdani/julia/julia-abab96668c/lib/julia
# Copy in system image build script
/home/sdani/julia/contrib/install.sh 755 /home/sdani/julia/contrib/build_sysimg.                                                                                                                                                                                                                                                                                                                                                        jl /home/sdani/julia/julia-abab96668c/share/julia/
# Copy in all .jl sources as well
cp -R -L /home/sdani/julia/usr/share/julia /home/sdani/julia/julia-abab96668c/sh                                                                                                                                                                                                                                                                                                                                                        are/
# Copy documentation
cp -R -L /home/sdani/julia/doc/_build/html /home/sdani/julia/julia-abab96668c/sh                                                                                                                                                                                                                                                                                                                                                        are/doc/julia/
# Remove various files which should not be installed
rm -f /home/sdani/julia/julia-abab96668c/share/julia/base/version_git.sh
rm -f /home/sdani/julia/julia-abab96668c/share/julia/test/Makefile
# Copy in beautiful new man page
/home/sdani/julia/contrib/install.sh 644 /home/sdani/julia/usr/share/man/man1/ju                                                                                                                                                                                                                                                                                                                                                        lia.1 /home/sdani/julia/julia-abab96668c/share/man/man1/
# Copy icon and .desktop file
mkdir -p /home/sdani/julia/julia-abab96668c/share/icons/hicolor/scalable/apps/
/home/sdani/julia/contrib/install.sh 644 /home/sdani/julia/contrib/julia.svg /ho                                                                                                                                                                                                                                                                                                                                                        me/sdani/julia/julia-abab96668c/share/icons/hicolor/scalable/apps/
touch -c /home/sdani/julia/julia-abab96668c/share/icons/hicolor/
gtk-update-icon-cache /home/sdani/julia/julia-abab96668c/share/icons/hicolor/
make: gtk-update-icon-cache: Command not found
make: [Makefile:346: install] Error 127 (ignored)
mkdir -p /home/sdani/julia/julia-abab96668c/share/applications/
/home/sdani/julia/contrib/install.sh 644 /home/sdani/julia/contrib/julia.desktop                                                                                                                                                                                                                                                                                                                                                         /home/sdani/julia/julia-abab96668c/share/applications/
# Install appdata file
mkdir -p /home/sdani/julia/julia-abab96668c/share/appdata/
/home/sdani/julia/contrib/install.sh 644 /home/sdani/julia/contrib/julia.appdata                                                                                                                                                                                                                                                                                                                                                        .xml /home/sdani/julia/julia-abab96668c/share/appdata/
# Update RPATH entries and JL_SYSTEM_IMAGE_PATH if ../lib/julia != ../lib/julia
# On FreeBSD, remove the build's libdir from each library's RPATH
mkdir -p /home/sdani/julia/julia-abab96668c/etc
cp -R /home/sdani/julia/usr/etc/julia /home/sdani/julia/julia-abab96668c/etc/

sdani@LAPTOP-4CL7JAI3 ~/julia
$ usr/bin/julia.exe

julia> z7 = joinpath(Sys.BINDIR, "7z.exe")
"C:\\Users\\sdani\\juliastuff\\cygwin\\home\\sdani\\julia\\usr\\bin\\7z.exe"

julia> isfile(z7)
false

Not sure whats up with julia-abab96668c, but even that bin dir doesn't contain a 7z exe.

I'm not going to start copying random files around :D if make win-extras copies it into this folder, this is good enough for me as long as the normal case is covered first. If you have more patience to fix these fiddly issues, i would very much appreciate if you could just push to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not going to start copying random files around

Why not? That's what building the installer has always done. Guess it happens as part of make binary-dist then. You can locally approximate it. This could be cleaned up in the Julia makefiles, but really isn't that hard to deal with locally - it shouldn't be propagating out into every package that needs to extract files.

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this line

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)
Expand All @@ -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)
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

println(stderr, stdoutstr)
err = pc
if isunix()
cd(installdir) do
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using WinRPM
using Test

if haskey(ENV, "CI") && haskey(ENV, "WINRPM_DO_THE_TEST") && ENV["WINRPM_DO_THE_TEST"] == "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 env var would need to be set in the appveyor config for this to do anything

Copy link
Member Author

Choose a reason for hiding this comment

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

grafik

Copy link
Contributor

Choose a reason for hiding this comment

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

that should be set in the yaml where it's visible and can be modified by people who don't have access to that settings page - generally the UI should be avoided, the yaml takes precedence for anything set both places

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