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

Partial package updates #17132

Merged
merged 6 commits into from
Jul 12, 2016
Merged

Partial package updates #17132

merged 6 commits into from
Jul 12, 2016

Conversation

carlobaldassi
Copy link
Member

@carlobaldassi carlobaldassi commented Jun 26, 2016

This introduces the possibility to do Pkg.update(pkgs...) and only update a subset of the packages.

The result is that only the packages explicitly provided and their dependencies will be updated, everything else is kept fixed.

For example:

julia> Pkg.update("Colors")
INFO: Updating METADATA...
INFO: Computing changes...
INFO: Upgrading Colors: v0.6.4 => v0.6.5
INFO: Upgrading Compat: v0.8.1 => v0.8.2

Also, the packages explicitly provided will never get downgraded (which is a rare occurrence, but in principle may happen with a full Pkg.update()).

In case the update fails to install the latest version of the packages explicitly provided, an info message is emitted, and some analysis is attempted to suggest possible causes (a full analysis is basically out of the question, and unlikely to be of any practical relevance IMO). For example, in a case in which I had artificially capped the version of Colors.jl:

julia> Pkg.update("Colors")
INFO: Updating METADATA...
INFO: Computing changes...
INFO: Package Colors was set to version 0.6.4, but a higher version 0.6.5 exists.
      The update is prevented by explicit requirements constraints. Edit your REQUIRE file to change this.
INFO: No packages to install, update or remove

Still missing: tests, perhaps extra docs (? Someone please advise me on this, I only updated the docstring and it works in the repl, should I do something else?), probably some note in NEWS.

We may also want to add a keyword argument to truly restrict the update to the packages given as arguments, not their dependencies (e.g. dependencies=false? Suggestions welcome). This however would require some additional work, especially to perform the analysis afterwards. Maybe it can be done as a second PR.

I tried to test this functionality in a variety of cases (registered packages, unregistered ones, dirty ones, checked out, etc.) but it would be best if other people could put this to test as well.

[edit by tkelman: closes #13487]

@carlobaldassi carlobaldassi added the domain:packages Package management and loading label Jun 26, 2016
@toivoh
Copy link
Contributor

toivoh commented Jun 26, 2016

If packages B and C depend on package A and you do

Pkg.update("B")

could this update A to a version that is incompatible with the currently installed version of C?

@carlobaldassi
Copy link
Member Author

carlobaldassi commented Jun 26, 2016

@toivoh: no, dependency resolution is done the same way as always, just with additional constraints on packages which shouldn't be updated. If it happens, it's a bug.

@@ -203,8 +203,12 @@ pin(pkg::AbstractString, ver::VersionNumber) = cd(Entry.pin,pkg,ver)
Update the metadata repo – kept in `Pkg.dir("METADATA")` – then update any fixed packages
that can safely be pulled from their origin; then call `Pkg.resolve()` to determine a new
optimal set of packages versions.

update(pkgs...)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these should be separate docstrings for the docsystem to handle them properly - the new signature should be added to the rst version of the docs (kinda messy at the moment) so make docs populates the rest of it

@tkelman tkelman added the needs tests Unit tests are required for this change label Jun 26, 2016
@carlobaldassi carlobaldassi removed the needs tests Unit tests are required for this change label Jul 11, 2016
@carlobaldassi carlobaldassi changed the title WIP: Partial package updates Partial package updates Jul 11, 2016
@carlobaldassi
Copy link
Member Author

Added tests (kind of messy, but the best I could come up with), docs, item in NEWS, and rebased.
This should now be ready to go.

@@ -66,6 +66,73 @@ function dependencies(avail::Dict, fix::Dict = Dict{String,Fixed}("julia"=>Fixed
avail, conflicts
end

function partial_update_mask(instd::Dict{String,Tuple{VersionNumber,Bool}}, avail::Dict{String,Dict{VersionNumber,Available}}, upkgs::Set{String})
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the Bool in this Tuple?

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's the fixed tag as returned by Read.installed, see here.

I tend to spell out the type signatures in full in these functions (rather than just writing instd::Dict) mostly for "documentation" purposes.

@carlobaldassi
Copy link
Member Author

I have addressed all the comments (as always, thanks @tkelman!) and rebased.

# the latest version
blocking_parents = Set{String}()
for (p1,d1) in deps
p1 in upkgs && continue # package `p1` is among the ones to be updated, skip the check
Copy link
Contributor

@tkelman tkelman Jul 12, 2016

Choose a reason for hiding this comment

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

❤️ the comments

@tkelman
Copy link
Contributor

tkelman commented Jul 12, 2016

This is great, glad you had a more productive JuliaCon hacking session than I did. Kind of sneaking in a feature, but I say we merge it.

A side-effect of having this feature is that too-loose version bounds in packages on their dependencies will now be more visible. We may have to work out an automated cross-package multi-version testing system to identify that kind of issue.

@StefanKarpinski
Copy link
Sponsor Member

I'm also in favor of merging this. People will be a lot less unhappy with the current package manager if they don't have to wait until Pkg3 for this nice functionality :)

@StefanKarpinski StefanKarpinski merged commit 9dcdec9 into master Jul 12, 2016
@StefanKarpinski StefanKarpinski deleted the cb/partupdate branch July 12, 2016 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:packages Package management and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pkg.update("Foo") to update a single package only?
4 participants