diff --git a/base/loading.jl b/base/loading.jl index cb4bdf518b816..7f359695a290a 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1124,10 +1124,10 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No end if ocachepath !== nothing - @debug "Loading object cache file $ocachepath for $pkg" + @debug "Loading object cache file $ocachepath for $(repr("text/plain", pkg))" sv = ccall(:jl_restore_package_image_from_file, Any, (Cstring, Any, Cint, Cstring, Cint), ocachepath, depmods, false, pkg.name, ignore_native) else - @debug "Loading cache file $path for $pkg" + @debug "Loading cache file $path for $(repr("text/plain", pkg))" sv = ccall(:jl_restore_incremental, Any, (Cstring, Any, Cint, Cstring), path, depmods, false, pkg.name) end if isa(sv, Exception) @@ -1160,7 +1160,7 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No return M end end - return ErrorException("Required dependency $pkg failed to load from a cache file.") + return ErrorException("Required dependency $(repr("text/plain", pkg)) failed to load from a cache file.") finally timing_imports && cumulative_compile_timing(false) @@ -2101,7 +2101,7 @@ function _require(pkg::PkgId, env=nothing) path = locate_package(pkg, env) if path === nothing throw(ArgumentError(""" - Package $pkg is required but does not seem to be installed: + Package $(repr("text/plain", pkg)) is required but does not seem to be installed: - Run `Pkg.instantiate()` to install all recorded dependencies. """)) end @@ -2123,7 +2123,7 @@ function _require(pkg::PkgId, env=nothing) for (concrete_pkg, concrete_build_id) in _concrete_dependencies if pkg == concrete_pkg @warn """Module $(pkg.name) with build ID $((UUID(concrete_build_id))) is missing from the cache. - This may mean $pkg does not support precompilation but is imported by a module that does.""" + This may mean $(repr("text/plain", pkg)) does not support precompilation but is imported by a module that does.""" if JLOptions().incremental != 0 # during incremental precompilation, this should be fail-fast throw(PrecompilableError()) @@ -2157,16 +2157,16 @@ function _require(pkg::PkgId, env=nothing) elseif isa(cachefile, Exception) if precompilableerror(cachefile) verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug - @logmsg verbosity "Skipping precompilation due to precompilable error. Importing $pkg." exception=m + @logmsg verbosity "Skipping precompilation due to precompilable error. Importing $(repr("text/plain", pkg))." exception=m else - @warn "The call to compilecache failed to create a usable precompiled cache file for $pkg" exception=m + @warn "The call to compilecache failed to create a usable precompiled cache file for $(repr("text/plain", pkg))" exception=m end # fall-through to loading the file locally if not incremental else cachefile, ocachefile = cachefile::Tuple{String, Union{Nothing, String}} m = _tryrequire_from_serialized(pkg, cachefile, ocachefile) if !isa(m, Module) - @warn "The call to compilecache failed to create a usable precompiled cache file for $pkg" exception=m + @warn "The call to compilecache failed to create a usable precompiled cache file for $(repr("text/plain", pkg))" exception=m else return m end @@ -2393,7 +2393,7 @@ function check_src_module_wrap(pkg::PkgId, srcpath::String) inside_string && continue if contains(s, module_rgx) if load_seen - throw(ErrorException("Package $pkg source file $srcpath has a using/import before a module declaration.")) + throw(ErrorException("Package $(repr("text/plain", pkg)) source file $srcpath has a using/import before a module declaration.")) end return true end @@ -2401,7 +2401,7 @@ function check_src_module_wrap(pkg::PkgId, srcpath::String) load_seen = true end end - throw(ErrorException("Package $pkg source file $srcpath does not contain a module declaration.")) + throw(ErrorException("Package $(repr("text/plain", pkg)) source file $srcpath does not contain a module declaration.")) end # this is called in the external process that generates precompiled package files @@ -2480,12 +2480,12 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o:: end if output_o !== nothing - @debug "Generating object cache file for $pkg" + @debug "Generating object cache file for $(repr("text/plain", pkg))" cpu_target = get(ENV, "JULIA_CPU_TARGET", nothing) opt_level = Base.JLOptions().opt_level opts = `-O$(opt_level) --output-o $(output_o) --output-ji $(output) --output-incremental=yes` else - @debug "Generating cache file for $pkg" + @debug "Generating cache file for $(repr("text/plain", pkg))" cpu_target = nothing opts = `-O0 --output-ji $(output) --output-incremental=yes` end @@ -2553,7 +2553,7 @@ for important notes. function compilecache(pkg::PkgId, internal_stderr::IO = stderr, internal_stdout::IO = stdout; reasons::Union{Dict{String,Int},Nothing}=Dict{String,Int}()) @nospecialize internal_stderr internal_stdout path = locate_package(pkg) - path === nothing && throw(ArgumentError("$pkg not found during precompilation")) + path === nothing && throw(ArgumentError("$(repr("text/plain", pkg)) not found during precompilation")) return compilecache(pkg, path, internal_stderr, internal_stdout; reasons) end @@ -2577,7 +2577,7 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in end # run the expression and cache the result verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug - @logmsg verbosity "Precompiling $pkg $(list_reasons(reasons))" + @logmsg verbosity "Precompiling $(repr("text/plain", pkg)) $(list_reasons(reasons))" # create a temporary file in `cachepath` directory, write the cache in it, # write the checksum, _and then_ atomically move the file to `cachefile`. @@ -2621,7 +2621,7 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in # append extra crc to the end of the .ji file: open(tmppath, "r+") do f if iszero(isvalid_cache_header(f)) - error("Invalid header for $pkg in new cache file $(repr(tmppath)).") + error("Invalid header for $(repr("text/plain", pkg)) in new cache file $(repr(tmppath)).") end seekend(f) write(f, crc_so) @@ -2692,7 +2692,7 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in if p.exitcode == 125 return PrecompilableError() else - error("Failed to precompile $pkg to $(repr(tmppath)).") + error("Failed to precompile $(repr("text/plain", pkg)) to $(repr(tmppath)).") end end @@ -3283,9 +3283,9 @@ function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=compilec pid, hostname, age = invokelatest(parse_pidfile_hook, pidfile) verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug if isempty(hostname) || hostname == gethostname() - @logmsg verbosity "Waiting for another process (pid: $pid) to finish precompiling $pkg. Pidfile: $pidfile" + @logmsg verbosity "Waiting for another process (pid: $pid) to finish precompiling $(repr("text/plain", pkg)). Pidfile: $pidfile" else - @logmsg verbosity "Waiting for another machine (hostname: $hostname, pid: $pid) to finish precompiling $pkg. Pidfile: $pidfile" + @logmsg verbosity "Waiting for another machine (hostname: $hostname, pid: $pid) to finish precompiling $(repr("text/plain", pkg)). Pidfile: $pidfile" end # wait until the lock is available, but don't actually acquire it # returning nothing indicates a process waited for another @@ -3438,7 +3438,7 @@ end # verify that `require(modkey, name(req_modkey))` ==> `req_modkey` pkg = identify_package(modkey, req_modkey.name) if pkg != req_modkey - @debug "Rejecting cache file $cachefile because uuid mapping for $modkey => $req_modkey has changed, expected $modkey => $pkg" + @debug "Rejecting cache file $cachefile because uuid mapping for $modkey => $req_modkey has changed, expected $modkey => $(repr("text/plain", pkg))" record_reason(reasons, "dep uuid changed") return true end diff --git a/base/pkgid.jl b/base/pkgid.jl index 20d9de559b334..a3d3ead184bb8 100644 --- a/base/pkgid.jl +++ b/base/pkgid.jl @@ -23,7 +23,7 @@ function hash(pkg::PkgId, h::UInt) return h end -show(io::IO, pkg::PkgId) = +show(io::IO, ::MIME"text/plain", pkg::PkgId) = print(io, pkg.name, " [", pkg.uuid === nothing ? "top-level" : pkg.uuid, "]") function binpack(pkg::PkgId)