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

rebase of #56 (implement clone/free) onto #81 (graph refactor) #83

Closed
wants to merge 16 commits into from

Conversation

carlobaldassi
Copy link
Member

@carlobaldassi carlobaldassi commented Dec 17, 2017

As per the title, this rebases #56 on top of #81, cc @KristofferC, @StefanKarpinski.
I had to change a few things, and this allowed me to catch a few issues on the graph refactoring that I fixed. It seems to work now, or at least tests pass.

One annoying thing is that I had to bring back some pieces of Pkg2 from bin/ into src/, to allow for the parsing of REQUIRE files. I suppose that it's going to be needed as long as we support Pkg2-style dependency specifications (that part of the code needs to be fixed BTW).

@carlobaldassi carlobaldassi force-pushed the kc/clonerepo2-rebased branch 2 times, most recently from 4d9af18 to 5aaf9cf Compare December 18, 2017 10:10
@carlobaldassi
Copy link
Member Author

Update: fixed the parsing of Pkg2 REQUIRE files.

@StefanKarpinski
Copy link
Member

Thank you for doing this, @carlobaldassi!

@carlobaldassi
Copy link
Member Author

I was feeling guilty for the amount of disruptiveness of my PRs :)

The Travis job fails with ERROR: LoadError: LoadError: ArgumentError: Module SHA not found in current path., while AppVeyor succeeds. Does somebody have a clue?

@StefanKarpinski
Copy link
Member

Unfortunately, I'm not sure what's up with CI on this and @KristofferC is on vacation, so 🤷‍♂️

@KristofferC
Copy link
Member

When I made this PR, SHA was not needed for Pkg3 itself, only for the bin stuff. This PR changes the .travis.yml script to only use Pkg3. We thus never do Pkg.clone and thus not download SHA.

@carlobaldassi
Copy link
Member Author

Ok the issue with Travis testing is fixed now. It's rather crude, but then again this won't be a problem once Pkg3 is moved to stdlib I guess.

@carlobaldassi carlobaldassi changed the base branch from master to cb/graphrefactor December 22, 2017 11:57
@carlobaldassi carlobaldassi force-pushed the kc/clonerepo2-rebased branch from 6d80313 to ee2bd89 Compare January 6, 2018 00:30
@carlobaldassi carlobaldassi changed the base branch from cb/graphrefactor to cb/backtrack January 6, 2018 00:31
@carlobaldassi carlobaldassi changed the base branch from cb/backtrack to master January 6, 2018 13:24
@carlobaldassi
Copy link
Member Author

This is now on top of master, i.e. on top of all the graph refactoring stuff.

@KristofferC
Copy link
Member

Lovely, thanks a lot!

@andyferris
Copy link
Member

FYI I made a rebase of this at ajf/clonerepo2-rebased.

I found a problem where the tokenizer can't understand git urls like pkg> clone git@github.com:a/b (while the Pkg3.clone("git@github.com:a/b") works fine).

@andyferris
Copy link
Member

Using this, this seems neat.

I'll note a couple things that would help me to use Pkg3 at work (eventually - doesn't have to be this PR):

  1. Use something other than REQUIRE to get the dependencies (it can remain as a "backup option"). Apart from consistency with the rest of the .toml files, I would like to add private dependencies here without breaking Pkg2 compatibility with standard METADATA (this would help me getting a private registry running for Julia v0.6).
  2. Allow one to specify a path inside the git repo as the base path of the package, since Pkg3 can support multiple packages per git repository using trees (this is going to be awesome, but probably not immediately necessary).

@KristofferC
Copy link
Member

I found a problem where the tokenizer can't understand git urls..

For now, you need to surround the url with quotes.

Use something other than REQUIRE to get the dependencies (it can remain as a "backup option").

Definitely, but in order to make this PR right now (and to test with existing package) it needed to handle REQUIRE files.

since Pkg3 can support multiple packages per git repository using trees

It can, I didn't know this?

Copy link
Member

@StefanKarpinski StefanKarpinski left a comment

Choose a reason for hiding this comment

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

Relatively minor comments, but overall this looks great. Sorry this took me so long to get around to reviewing.

@@ -12,7 +12,7 @@ const colors = Dict(
'↑' => :light_yellow,
'~' => :light_yellow,
'↓' => :light_magenta,
'?' => :red,
'?' => :white,
Copy link
Member

Choose a reason for hiding this comment

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

Seems unrelated?

Copy link
Member

Choose a reason for hiding this comment

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

There was some reason for this that made red look weird but I don't remember. Will change it back.

@@ -256,7 +303,7 @@ function version_data(env::EnvCache, pkgs::Vector{PackageSpec})
end
end
end
@assert haskey(hashes, uuid)
# @assert haskey(hashes, uuid)
Copy link
Member

Choose a reason for hiding this comment

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

Is this no longer a valid assertion? If not we should remove this comment. If it's still valid, it should be uncommented.

@@ -351,7 +398,7 @@ function install(
return version_path, true
end

function update_manifest(env::EnvCache, uuid::UUID, name::String, hash::SHA1, version::VersionNumber)
function update_manifest(env::EnvCache, uuid::UUID, name::String, hash::Union{Void, SHA1}, version::VersionNumber, path::AbstractString)
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make more sense for the signature here to be Union{String, SHA1} and call it hash_or_path? Or is the deal here that path is always supplied but hash may not be? It seems like the code is using an empty path value to indicate lack of a path value but the either or pattern might be cleaner.

push!(pkgs, PackageSpec(r.package))
end
# TODO: Get rid of this one?
registry_resolve!(env, pkgs)
Copy link
Member

Choose a reason for hiding this comment

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

How do we determine if this should or shouldn't be gotten rid if?

Copy link
Member

Choose a reason for hiding this comment

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

The problem is using REQUIRE files that do not have UUIDs so the only way to get the UUIDS is to go to the registry. When we are not using REQUIRE files the UUIDs can just be read from the Manifest file.

Copy link
Member

Choose a reason for hiding this comment

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

This should be harmless – if all the packages are already resolved, it won't hit the registry at all.

src/REPLMode.jl Outdated
function do_clone!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
isempty(tokens) && cmderror("`clone` take an url to a package to clone")
local url
basepath = get(ENV, "JULIA_DEV_PATH", default_dev_path())
Copy link
Member

Choose a reason for hiding this comment

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

So even though this is a "path" to a place, we use _PATH and _PATH as a suffix in LOAD_PATH and DEPOT_PATH to indicate a list of places to look for things, whereas this is a single location to put things, which seems more like Sys.BINDIR or JULIA_PKGDIR so I think this environment variable should be called JULIA_DEVDIR or JULIA_DEV_DIR. I favor the former since we're going to have a bunch of variables with names like SRCDIR and LIBDIR so using the name DEVDIR seems more consistent.

@StefanKarpinski
Copy link
Member

since Pkg3 can support multiple packages per git repository using trees

It can, I didn't know this?

It's not yet implemented, but since a version is just a tree and a tree doesn't need to appear at the root of a repository, it could with the right tooling work. Since we don't really have any dev tooling for tagging Pkg3 packages yet, it doesn't support this but it also doesn't not support this – if you arranged for a Pkg3 version entry to map to a subtree in the repo, it would just work. Of course that subtree should look like a normal package, but that's certainly doable.

@andyferris
Copy link
Member

since a version is just a tree and a tree doesn't need to appear at the root of a repository, it could with the right tooling work. Since we don't really have any dev tooling for tagging Pkg3 packages yet, it doesn't support this but it also doesn't not support this – if you arranged for a Pkg3 version entry to map to a subtree in the repo, it would just work. Of course that subtree should look like a normal package, but that's certainly doable.

Exactly. AFAICT, if I make my own head-written registry, I can have my own monorepo for all of my company's private packages - that is implemented. (After reading some blogposts on Google's monorepo, it seems rather appealing, but in any case it would be good to put some related libraries and/or tools/apps/projects into one repository).

I would be extremely happy if any new tooling regarding creating and editing registries, package templates, and developing packages could respect this possibility - since adding this later might be difficult after architectural decisions are made and lead to avoidable refactoring.

Regarding the functionality in this PR, I guess packages in development mode need a local git repository (cloned in this case) and a subdirectory of the repository, which can then be mapped to-and-from a tree hash?

@StefanKarpinski
Copy link
Member

My thinking is that if a MetaProject.toml file exists we look in that for where the actual projects are and dev tools all respect that.

@andyferris
Copy link
Member

OK, cool, so this isn't recorded in the registry at all... actually that's quite nice and lets developers move stuff around inside the repository quite easily.

@KristofferC KristofferC force-pushed the kc/clonerepo2-rebased branch from 1f0f0ae to d8c97b7 Compare January 29, 2018 08:44
!isfile(reqfile) && continue
for r in filter!(r->r isa Pkg2.Reqs.Requirement, Pkg2.Reqs.read(reqfile))
# @assert length(r.versions.intervals) == 1
pkg_name, version = r.package, r.versions.intervals[1]
Copy link
Member Author

Choose a reason for hiding this comment

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

I had fixed this (and the following lines) in bcdfe81

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, must have messed up in rebasing :/

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be preferable to apply the fixes to c728e4b, where the rebase went wrong

Copy link
Member

Choose a reason for hiding this comment

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

alright, I'll try...

Copy link
Member

Choose a reason for hiding this comment

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

Hopefully good now

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

KristofferC and others added 5 commits January 29, 2018 15:03
Needs to bring back pieces of Pkg2 to parse
old-style REQUIRE files
Work-around for bootstrapping problem in trying to use
Pkg3 to clone itself
@KristofferC KristofferC force-pushed the kc/clonerepo2-rebased branch from 9583edb to c80ef4d Compare January 29, 2018 14:06
@KristofferC KristofferC force-pushed the kc/clonerepo2-rebased branch from c80ef4d to cd4e43d Compare January 29, 2018 20:22
@KristofferC
Copy link
Member

Everything here should now be with similar functionality in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants