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

Pkg.rm sometimes has to be run twice #7757

Closed
jiahao opened this issue Jul 28, 2014 · 18 comments
Closed

Pkg.rm sometimes has to be run twice #7757

jiahao opened this issue Jul 28, 2014 · 18 comments
Labels
packages Package management and loading

Comments

@jiahao
Copy link
Member

jiahao commented Jul 28, 2014

I can't quite pin down why this happens, but I see this quite often:

julia> Pkg.rm("React")
INFO: No packages to install, update or remove
INFO: Package database updated

julia> Pkg.rm("React")
INFO: Removing React (unregistered)
@StefanKarpinski
Copy link
Sponsor Member

Is React required by some other package?

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

Yes, on my system I also have Interact installed.

@StefanKarpinski
Copy link
Sponsor Member

Did it actually remove React while Interact was still installed?

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

Yes

@JeffBezanson
Copy link
Sponsor Member

What's in your REQUIRE?

@ssfrr
Copy link
Contributor

ssfrr commented Jul 28, 2014

I've seen the same behavior when developing on AudioIO. I also haven't nailed down a reproducible case, but I think it might have to do with having Pkg.cloneed it instead of Pkg.adding it. Nothing else depends on AudioIO.

@ssfrr
Copy link
Contributor

ssfrr commented Jul 28, 2014

If it matters, the REQUIRE for AudioIO is:

julia 0.3-
BinDeps
@osx Homebrew

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

React has no REQUIRE file. (It does have a REQUIRES file. @shashi - needs rename? also needs the julia 0.3 -> julia 0.3- change)

Interact has a REQUIRE file; its only contents are React.

@kmsquire
Copy link
Member

I think he was asking for the contents of ~/.julia/v0.3/REQUIRE.

@shashi
Copy link
Contributor

shashi commented Jul 28, 2014

@jiahao Fixed that, thank you! I want to accept only julia 0.3 or greater. Because some Base functions (foldl, foldr) React imports didn't exist before that. julia 0.3- seems like it accepts only versions below 0.3?

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

0.3- catches 0.3 preleases also but nothing in 0.2.x. 0.3 only matches the final release.

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

Hmm... my ~/.julia/v0.3/REQUIRE contains React but not Interact.

I think we're on to something:

julia> Pkg.add("React")
INFO: Installing React v0.1.3
INFO: Package database updated

shell> grep React ~/.julia/v0.3/REQUIRE
React

julia> Pkg.rm("React")
INFO: No packages to install, update or remove
INFO: Package database updated

shell> grep React ~/.julia/v0.3/REQUIRE

julia> Pkg.rm("React")
INFO: Removing React (unregistered)

@IainNZ
Copy link
Member

IainNZ commented Jul 28, 2014

(sidenote: misunderstanding of what 0.3- means is pretty widespread)

@StefanKarpinski
Copy link
Sponsor Member

This misunderstanding has often given me cause to consider how else to do this, but I've never come up with anything better. Part of the confusion is what 0.3- means but some is also due to the close-open version interval thing.

@IainNZ
Copy link
Member

IainNZ commented Jul 28, 2014

maybe we could use some more characters to be more explicit about wanting a range? e.g. julia [0.2 0.3)

@StefanKarpinski
Copy link
Sponsor Member

Yes, that's possible, but I'm not eager to complicate the parser like that.

@jiahao
Copy link
Member Author

jiahao commented Aug 3, 2014

Ok, back to the original problem:

  1. Starting with a fresh package directory, if I add a new package, I am able to remove its dependencies with a single Pkg.rm without complaint. It doesn't matter if it's registered or not:
julia> Pkg.update()
INFO: Initializing package repository /Users/jiahao/.julia/v0.3
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove

julia> Pkg.clone("https://github.com/shashi/Interact.jl.git") #Pkg.add something else works too
INFO: Cloning Interact from https://github.com/shashi/Interact.jl.git
INFO: Computing changes...
INFO: Installing React v0.1.3

shell> cat ~/.julia/v0.3/REQUIRE

julia> Pkg.rm("React")
INFO: Removing React (unregistered)

julia> using Interact
ERROR: React not found
  1. If I have a package and its dependencies added manually, I need to do Pkg.rm twice.
julia> Pkg.add("React"); Pkg.clone("https://github.com/shashi/Interact.jl.git")
...

shell> cat ~/.julia/v0.3/REQUIRE
React

julia> Pkg.rm("React")
INFO: No packages to install, update or remove
INFO: Package database updated

shell> cat ~/.julia/v0.3/REQUIRE

julia> Pkg.rm("React")
INFO: Removing React (unregistered)

@tkelman
Copy link
Contributor

tkelman commented Jul 28, 2015

I just re-discovered this while working on doing something about #7054. @StefanKarpinski what's the desired behavior here? We have:

function rm(pkg::AbstractString)
    edit(Reqs.rm,pkg) && return
    ispath(pkg) || return info("Nothing to be done")
    info("Removing $pkg (unregistered)")
    Write.remove(pkg)
end

The first time you run Pkg.rm on a package that's a dependency of some other installed package, the edit takes that package out of REQUIRE but otherwise doesn't do anything, but returns true so rm finishes there. The second time, edit returns false so it goes on and thinks the package is unregistered and moves it to .trash. Seems like a bug?

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

No branches or pull requests

8 participants