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

Update from Base and recommit changes in Pkg.jl on top of it. #626

Merged
merged 5 commits into from
Aug 13, 2018
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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: julia

julia:
- 0.7
- 1.0
- nightly

os:
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ desc = "The next-generation Julia package manager."
keywords = ["package", "management"]
license = "MIT"
name = "Pkg"
version = "1.0.0"
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[deps]
Expand Down
37 changes: 17 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
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"
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
Expand All @@ -15,24 +26,10 @@ notifications:
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
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
# We swap the uuid for Pkg here to make it not load the stdlib version of Pkg
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia --project -e "import InteractiveUtils; versioninfo();
- C:\julia\bin\julia -e "using InteractiveUtils; versioninfo();
using UUIDs;
before = read(\"Project.toml\", String);
after = replace(before, \"uuid = \\\"44cfe95a-1eb2-52ea-b672-e2afdf69b78f\\\"\" =>
Expand All @@ -41,5 +38,5 @@ build_script:
import Pkg; Pkg.build()"

test_script:
- C:\projects\julia\bin\julia --project -e "import Pkg; Pkg.test(; coverage=true)"

- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
1 change: 1 addition & 0 deletions bin/generate.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

prefix = joinpath(homedir(), ".julia", "registries", "General")

Expand Down
1 change: 1 addition & 0 deletions bin/genstdlib.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Pkg: TOML

Expand Down
2 changes: 1 addition & 1 deletion bin/gitmeta.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Pkg.TOML
import LibGit2
Expand All @@ -18,7 +19,6 @@ const STDLIBS = sort!(by = lowercase, [
"Logging"
"Markdown"
"Mmap"
"OldPkg"
"Pkg"
"Printf"
"Profile"
Expand Down
1 change: 1 addition & 0 deletions bin/loadmeta.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Base: thispatch, thisminor, nextpatch, nextminor
import LinearAlgebra: checksquare
Expand Down
1 change: 1 addition & 0 deletions bin/update.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..", "ext"))

Expand Down
1 change: 1 addition & 0 deletions bin/utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env julia
# This file is a part of Julia. License is MIT: https://julialang.org/license

function packagelt(a::String, b::String)
a == "julia" && b != "julia" && return true
Expand Down
2 changes: 2 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

Base.ACTIVE_PROJECT[] = joinpath(@__DIR__, "..")
using Documenter
using Pkg
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ Testing...

Sometimes one might want to use some packages only at testing time but not
enforce a dependency on them when the package is used. This is possible by
adding `[extra]` dependencies and adding a a "test target" to the Project file.
adding dependencies to `[extras]` and a `test` target in `[targets]` to the Project file.
Here we add the `Test` standard library as a test-only dependency by adding the
following to the Project file:

Expand Down
2 changes: 1 addition & 1 deletion ext/TOML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ julia> TOML.parsefile("etc/example.toml")

## Documentation
```julia
TOML.print(io::IO, a::Associative)
TOML.print(io::IO, a::AbstractDict)
```
Writes a TOML representation to the supplied `IO`.

Expand Down
2 changes: 2 additions & 0 deletions ext/TOML/src/TOML.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module TOML
using Dates

Expand Down
2 changes: 2 additions & 0 deletions ext/TOML/src/parser.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"TOML Table"
struct Table
values::Dict{String,Any}
Expand Down
2 changes: 2 additions & 0 deletions ext/TOML/src/print.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"Identify if character in subset of bare key symbols"
isbare(c::AbstractChar) = 'A' <= c <= 'Z' || 'a' <= c <= 'z' || isdigit(c) || c == '-' || c == '_'

Expand Down
12 changes: 5 additions & 7 deletions ext/TOML/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using TOML
import TOML: linecol, whitespace, comment, newline, expect, lookup, Parser, parse

if Base.isdeprecated(Base, :Test)
using Test
else
using Base.Test
end
using Test

macro testval(s, v)
f = "foo = $s"
Expand All @@ -32,7 +30,7 @@ macro fail(s...)
pvar = :pv
ppvar = :ppv

# debuging report
# debugging report
dbgexp = if debug
quote
println("\nTEST FAIL: ", escape_string($teststr))
Expand Down Expand Up @@ -81,7 +79,7 @@ macro success(s...)
pvar = :pv
ppvar = :ppv

# debuging report
# debugging report
dbgexp = if debug
quote
println("\nTEST SUCCESS: ", escape_string($teststr))
Expand Down
62 changes: 20 additions & 42 deletions src/API.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module API

using UUIDs
Expand Down Expand Up @@ -448,70 +450,46 @@ function clone(url::String, name::String = "")
develop(ctx, [Pkg.REPLMode.parse_package(url; add_or_develop=true)])
end

function dir(pkg::String, paths::String...)
@warn "Pkg.dir is only kept for legacy CI script reasons" maxlog=1
function dir(pkg::String, paths::AbstractString...)
@warn "`Pkg.dir(pkgname, paths...)` is deprecated; instead, do `import $pkg; joinpath(dirname(pathof($pkg)), \"..\", paths...)`." maxlog=1
pkgid = Base.identify_package(pkg)
pkgid == nothing && return nothing
pkgid === nothing && return nothing
path = Base.locate_package(pkgid)
pkgid == nothing && return nothing
return joinpath(abspath(path, "..", "..", paths...))
path === nothing && return nothing
return abspath(path, "..", "..", paths...)
end

precompile() = precompile(Context())
function precompile(ctx::Context)
printpkgstyle(ctx, :Precompiling, "project...")

pkgids = [Base.PkgId(UUID(uuid), name) for (name, uuid) in ctx.env.project["deps"] if !(UUID(uuid) in keys(ctx.stdlibs))]
if ctx.env.pkg !== nothing && isfile( joinpath( dirname(ctx.env.project_file), "src", ctx.env.pkg.name * ".jl"))
pkgids = [Base.PkgId(UUID(uuid), name) for (name, uuid) in ctx.env.project["deps"] if !(UUID(uuid) in keys(ctx.stdlibs))]
if ctx.env.pkg !== nothing && isfile( joinpath( dirname(ctx.env.project_file), "src", ctx.env.pkg.name * ".jl") )
push!(pkgids, Base.PkgId(ctx.env.pkg.uuid, ctx.env.pkg.name))
end

needs_to_be_precompiled = String[]
# TODO: since we are a complete list, but not topologically sorted, handling of recursion will be completely at random
for pkg in pkgids
paths = Base.find_all_in_cache_path(pkg)
sourcepath = Base.locate_package(pkg)
if sourcepath == nothing
# XXX: this isn't supposed to be fatal
pkgerror("couldn't find path to $(pkg.name) when trying to precompilie project")
end
found_matching_precompile = false
stale = true
for path_to_try in paths::Vector{String}
staledeps = Base.stale_cachefile(sourcepath, path_to_try)
if !(staledeps isa Bool)
found_matching_precompile = true
end
staledeps === true && continue
# TODO: else, this returns a list of packages that may be loaded to make this valid (the topological list)
stale = false
break
end
if !found_matching_precompile
# Don't bother attempting to precompile packages that appear to contain `__precompile__(false)`
source = read(sourcepath, String)
if !occursin(r"__precompile__\(false\)", source)
push!(needs_to_be_precompiled, pkg.name)
end
if stale
printpkgstyle(ctx, :Precompiling, pkg.name)
Base.compilecache(pkg, sourcepath)
end
end

# Perhaps running all the imports in the same process would avoid some overheda.
# Julia starts pretty fast though (0.3 seconds)
code = join(["import " * pkg for pkg in needs_to_be_precompiled], '\n') * "\nexit(0)"
for (i, pkg) in enumerate(needs_to_be_precompiled)
code = """
empty!(Base.DEPOT_PATH)
append!(Base.DEPOT_PATH, $(repr(map(abspath, DEPOT_PATH))))
empty!(Base.DL_LOAD_PATH)
append!(Base.DL_LOAD_PATH, $(repr(map(abspath, Base.DL_LOAD_PATH))))
empty!(Base.LOAD_PATH)
append!(Base.LOAD_PATH, $(repr(Base.LOAD_PATH)))
import $pkg
"""
printpkgstyle(ctx, :Precompiling, pkg * " [$i of $(length(needs_to_be_precompiled))]")
run(pipeline(ignorestatus(```
$(Base.julia_cmd()) -O$(Base.JLOptions().opt_level) --color=no --history-file=no
--startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no")
--compiled-modules="yes"
--depwarn=no
--eval $code
```)))
end
return nothing
nothing
end


Expand Down
2 changes: 2 additions & 0 deletions src/Display.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module Display

using UUIDs
Expand Down
4 changes: 3 additions & 1 deletion src/GitTools.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module GitTools

using ..Pkg
import LibGit2
using Printf

Base.@kwdef mutable struct MiniProgressBar
max::Float64 = 1
max::Float64 = 1.0
header::String = ""
color::Symbol = :white
width::Int = 40
Expand Down
8 changes: 4 additions & 4 deletions src/GraphType.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export Graph, ResolveLog, add_reqs!, add_fixed!, simplify_graph!, simplify_graph
# a message for the log.
#
# Specialized functions called `log_event_[...]!` are used to store the
# various events. The events are also recorded in orded in a shared
# various events. The events are also recorded in order in a shared
# ResolveJournal, which is used to provide a plain chronological view.
#
# The `showlog` functions are used for display, and called to create messages
Expand All @@ -41,7 +41,7 @@ end

mutable struct ResolveLog
# init: used to keep track of all package entries which were created during
# intialization, since the `pool` can be pruned during the resolution
# initialization, since the `pool` can be pruned during the resolution
# process.
init::ResolveLogEntry

Expand Down Expand Up @@ -89,7 +89,7 @@ mutable struct GraphData
# states per package: one per version + uninstalled
spp::Vector{Int}

# pakage dict: associates an index to each package id
# package dict: associates an index to each package id
pdict::Dict{UUID,Int}

# package versions: for each package, keep the list of the
Expand Down Expand Up @@ -772,7 +772,7 @@ function log_event_maxsumsolved!(graph::Graph, p0::Int, s0::Int, p1::Int)
if s0 == spp[p0] - 1
msg = "set by the solver to its maximum version: $(pvers[p0][s0]) (installation is required by $other_id)"
else
msg = "set by the solver version: $(pvers[p0][s0]) (version $(pvers[p0][s0+1]) would violate a dependecy relation with $other_id)"
msg = "set by the solver version: $(pvers[p0][s0]) (version $(pvers[p0][s0+1]) would violate a dependency relation with $other_id)"
end
other_entry = rlog.pool[pkgs[p1]]
entry = rlog.pool[p]
Expand Down
Loading