diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 15c8431b2a35c..23739a2936df0 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -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 @@ -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 diff --git a/test/pkg.jl b/test/pkg.jl index 4146717a45518..b228702396123 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -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 @@ -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