Ticket #297 (closed defect: fixed)

Opened 6 months ago

Last modified 4 months ago

cabal fetch command don't fetch packages those have already been installed

Reported by: chylli Assigned to:
Priority: normal Milestone: Cabal-1.4
Component: cabal-install tool Version:
Severity: normal Keywords:
Cc: Difficulty: easy (<4 hours)
GHC Version: 6.8.2 Platform:

Description

when I saw cabal help:

fetch Downloads packages for later installation or study.

I think I can fetch any packages to study. But in fact it not. They only download packages those have not installed yet. I think this help info can mislead users.

Change History

06/19/08 06:09:36 changed by duncan

  • difficulty changed from normal to easy (<4 hours).
  • milestone set to Cabal-1.4.

Just need to call the the dep analysis in a different environment. Remove any installed versions of the packages requested from the installed package list that we pass to the dep analysis. That means it will tell us that we need to install the given packages.

07/03/08 03:33:41 changed by Isaac Dupree

hang on, what is cabal fetch supposed to do? Fetch[*] the source of:

A. the package itself?

B. the package and all its dependencies?

C. the package and all its uninstalled dependencies?

D. currently, it is, if I'm reading the code rightly: all the package's uninstalled dependencies (including itself if it's uninstalled), which is obviously wrong.

I assumed from the help description that it meant "A" above, but then why is the code doing dependency analysis at all? "B" = dep analyze with an empty set of "installed" packages, I suppose (would it be necessary to include the current "base" or similar in the installed-package-list though, since it's not on hackage?). "C" = just remove the named package from the installed-package-list (as Duncan said) -- but why would you want "C"?

[*] fetch means, just make sure you have a copy of it in .cabal/packages/... -- if the source is already there then no need to download again

07/29/08 10:03:14 changed by duncan

So yes, there are two overloaded purposes here. One is to get the source of a package so you can play with it, read it etc. The other is so that you can fetch packages while your online with the intention of building them later while offline.

For both cases we need at least the sources for the uninstalled dependencies since part of studying would be trying to compile and run it, which will need the deps. As for all dependencies, how far would you go? Do you really want the sources of all the core libs if you didn't happen to have those sources already? I suspect not. That's not necessary to study or build the package of interest.

So actually yes, I think we do want option C since that covers both uses cases fine.

07/29/08 13:56:00 changed by Isaac Dupree

okay, seems reasonable, although I suppose there could also be command-line flags to modify the behavior

- at least, an option for if someone wants the sources of all dependencies that are on Hackage, even if installed, otherwise they'll be hard to get

- or all packages that are not fully upgraded. For example, if you have internet connection for a short time and it'll take your computer a while to build all of them. In this case, we want the newest versions. But if you want to look at the sources, it's also likely that you'll want to look at the currently installed versions' sources :-)

but ignoring those additional features:

hmm, it's been a while since I looked at the Fetch code, but IIRC it looked not too hard to make the simple change to default to do C, for someone familiar with those types -- don't count the package itself as an *installed* dependency.

-Isaac

08/14/08 16:35:35 changed by duncan

  • status changed from new to closed.
  • resolution set to fixed.
Thu Aug 14 19:02:01 BST 2008  Duncan Coutts <duncan@haskell.org>
  * Fetch packages even if they happen to already be installed
  Though obviously not if they have already been fetched.
  This lets people study the source for core packages that
  came with their compiler say, so they did not get have the
  sources downloaded via cabal-install. Fixes ticket #297.