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

Fix Pkg.build error printing #15802

Merged
merged 1 commit into from
Apr 8, 2016
Merged
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
6 changes: 3 additions & 3 deletions base/pkg/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,10 @@ function build(pkgs::Vector)
isempty(errs) && return
println(STDERR)
warnbanner(label="[ BUILD ERRORS ]", """
WARNING: $(join(map(x->x[1],errs),", "," and ")) had build errors.
WARNING: $(join(keys(errs),", "," and ")) had build errors.

- packages with build errors remain installed in $(pwd())
- build the package(s) and all dependencies with `Pkg.build("$(join(map(x->x[1],errs),"\", \""))")`
- build the package(s) and all dependencies with `Pkg.build("$(join(keys(errs),"\", \""))")`
- build a single package by running its `deps/build.jl` script
""")
end
Expand Down Expand Up @@ -606,7 +606,7 @@ function updatehook(pkgs::Vector)
isempty(errs) && return
println(STDERR)
warnbanner(label="[ UPDATE ERRORS ]", """
WARNING: $(join(map(x->x[1],errs),", "," and ")) had update errors.
WARNING: $(join(keys(errs),", "," and ")) had update errors.

- Unrelated packages are unaffected
- To retry, run Pkg.update() again
Expand Down
26 changes: 25 additions & 1 deletion test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ temp_pkg_dir() do
end
end
@test isa(ex,Pkg.PkgError)
@test ex.msg == "Cannot clone Example from notarealprotocol://github.com/JuliaLang/Example.jl.git. Unsupported URL protocol"
@test contains(ex.msg, "Cannot clone Example from notarealprotocol://github.com/JuliaLang/Example.jl.git")
end
end

Expand Down Expand Up @@ -257,4 +257,28 @@ temp_pkg_dir() do

# Test Pkg.Read.url works
@test Pkg.Read.url("Example") == "git://github.com/JuliaLang/Example.jl.git"

# issue #15789, build failure warning are printed correctly.
# Also makes sure `Pkg.build()` works even for non-git repo
begin
pth = joinpath(Pkg.dir(), "BuildFail")
mkdir(pth)
depspath = joinpath(pth, "deps")
mkdir(depspath)
depsbuild = joinpath(depspath, "build.jl")
touch(depsbuild)
# Pkg.build works without the src directory now
# but it's probably fine to require it.
msg = readstring(`$(Base.julia_cmd()) -f -e 'redirect_stderr(STDOUT); Pkg.build("BuildFail")'`)
@test contains(msg, "Building BuildFail")
@test !contains(msg, "ERROR")
open(depsbuild, "w") do fd
println(fd, "error(\"Throw build error\")")
end
msg = readstring(`$(Base.julia_cmd()) -f -e 'redirect_stderr(STDOUT); Pkg.build("BuildFail")'`)
@test contains(msg, "Building BuildFail")
@test contains(msg, "ERROR")
@test contains(msg, "Pkg.build(\"BuildFail\")")
@test contains(msg, "Throw build error")
end
end