Adding a world file to cabal-install

Hello, I recently upgraded GHC on one of my machines and therefore had to reinstall all installed packages. Granted, cabal-install makes this a lot easier nowadays, but I saw that there's a ticket [1] for adding a "world" file (speaking in Gentoo terminology) that records all user requested packages, so I gave that a try. You can find a patch for the Head branch that adds preliminary support here: http://darcs.monoid.at/cabal-install/ Basically the patch adds Distribution.Client.World that provides an /insert/, /delete/, and /getContents/ interface. /World.insert/ is called from Distribution.Client.Install upon successful build. What's currently missing is the implementation of a cabal command that rebuilds the package list from ~/.cabal/world (or some other location set by the currently also missing configuration options). 1. The world file only contains the list of package names and versions as requested by the user. I suppose that's all that's needed for rebuilding, right? 2. How should that command look like? Something like: # cabal install --world Suggestions and advice welcome! Cheers, Peter [1] http://hackage.haskell.org/trac/hackage/ticket/199

On Fri, 2009-02-06 at 15:18 +0100, Peter Robinson wrote:
Hello,
Hi Peter,
I recently upgraded GHC on one of my machines and therefore had to reinstall all installed packages. Granted, cabal-install makes this a lot easier nowadays, but I saw that there's a ticket [1] for adding a "world" file (speaking in Gentoo terminology) that records all user requested packages, so I gave that a try. You can find a patch for the Head branch that adds preliminary support here: http://darcs.monoid.at/cabal-install/
Yay! :-)
Basically the patch adds Distribution.Client.World that provides an /insert/, /delete/, and /getContents/ interface. /World.insert/ is called from Distribution.Client.Install upon successful build.
Sounds sensible.
What's currently missing is the implementation of a cabal command that rebuilds the package list from ~/.cabal/world (or some other location set by the currently also missing configuration options).
Ok.
1. The world file only contains the list of package names and versions as requested by the user. I suppose that's all that's needed for rebuilding, right?
Yes.
2. How should that command look like? Something like: # cabal install --world
Hmm.
Suggestions and advice welcome!
Yes, if anyone else has a suggestion on this pitch in. In gentoo we say: $ emerge --upgrade world ie world acts rather like a meta-package of all the things the user deliberately installed. Thanks very much Peter for having a go at this one. I promise I'll properly review your patch soon. I'm shortly going to do a release and I think I might leave this new feature 'til afterwards. However don't worry as I expect to put out another release shortly after that with more dependency resolver improvements so your feature will make it for that release. Duncan

Hi Duncan,
2009/2/8 Duncan Coutts
On Fri, 2009-02-06 at 15:18 +0100, Peter Robinson wrote:
2. How should that command look like? Something like: # cabal install --world
Yes, if anyone else has a suggestion on this pitch in. In gentoo we say:
$ emerge --upgrade world
ie world acts rather like a meta-package of all the things the user deliberately installed.
Mhm, I agree with that but I'm unsure how to relate meta-packages to normal packages: In my understanding a meta-package doesn't have a version, so it doesn't have a 'PackageIdentifier' (and can't be an instance of class Package).
Thanks very much Peter for having a go at this one. I promise I'll properly review your patch soon.
You might as well wait until I've figured out the meta-package stuff as that might require some changes.
I'm shortly going to do a release and I think I might leave this new feature 'til afterwards. However don't worry as I expect to put out another release shortly after that with more dependency resolver improvements so your feature will make it for that release.
No problem. Peter

On Sun, 2009-02-08 at 14:29 +0100, Peter Robinson wrote:
2. How should that command look like? Something like: # cabal install --world
Yes, if anyone else has a suggestion on this pitch in. In gentoo we say:
$ emerge --upgrade world
ie world acts rather like a meta-package of all the things the user deliberately installed.
Mhm, I agree with that but I'm unsure how to relate meta-packages to normal packages: In my understanding a meta-package doesn't have a version, so it doesn't have a 'PackageIdentifier' (and can't be an instance of class Package).
Thanks very much Peter for having a go at this one. I promise I'll properly review your patch soon.
You might as well wait until I've figured out the meta-package stuff as that might require some changes.
Right, we just have to make up a version number, but if it's the only version available and there is no installed version then that's not a problem. See for example planLocalPackage in Distribution/Client/Install.hs. It makes up an AvailablePackage based on the local package and adds it to the index of available packages. Another alternative is to not treat it like a meta-package and instead of adding the world meta-package to the list of packages to resolve for, we add all the world entries to the list instead. So it would be equivalent to: $ cabal install $(cat ./world.list) Duncan

2009/2/8 Duncan Coutts
Another alternative is to not treat it like a meta-package and instead of adding the world meta-package to the list of packages to resolve for, we add all the world entries to the list instead. So it would be equivalent to:
$ cabal install $(cat ./world.list)
I think that alternative is probably the easiest/cleanest. So essentially, before calling installWithPlanner we need to check if "world" is in the UnresolvedDeps list and, if so, replace it with the list of packages from the world file. I suppose this will also require a check in hackage-scripts/Unpack.unpackPackage to prevent uploading a package called "world". About IO errors when updating the world file: At the moment they are considered as non-fatal (ie. printed by chattyTry), is that ok? Peter

On Fri, Feb 6, 2009 at 3:18 PM, Peter Robinson
Hello,
I recently upgraded GHC on one of my machines and therefore had to reinstall all installed packages. Granted, cabal-install makes this a lot easier nowadays, but I saw that there's a ticket [1] for adding a "world" file (speaking in Gentoo terminology) that records all user requested packages, so I gave that a try. You can find a patch for the Head branch that adds preliminary support here: http://darcs.monoid.at/cabal-install/
Basically the patch adds Distribution.Client.World that provides an /insert/, /delete/, and /getContents/ interface. /World.insert/ is called from Distribution.Client.Install upon successful build. What's currently missing is the implementation of a cabal command that rebuilds the package list from ~/.cabal/world (or some other location set by the currently also missing configuration options).
1. The world file only contains the list of package names and versions as requested by the user. I suppose that's all that's needed for rebuilding, right?
We also need the values for the flags specified by the user, i think.

2009/2/9 Andrea Vezzosi
1. The world file only contains the list of package names and versions as requested by the user. I suppose that's all that's needed for rebuilding, right?
We also need the values for the flags specified by the user, i think.
True, so currently the whole UnresolvedDependency record is written to the world file. Now about those flags, at the moment nothing stops you from typing $ cabal install world someOtherPkg --flags="someflag" which installs all packages from world and someOtherPkg, and also adds someOtherPkg to world if it wasn't present yet. However, "someflag" is only set for someOtherPkg, while the packages in world are built with the flags specified in the world file, which might be counterintuitive. Alternatively, we could simply disallow installing other packages along with world, i.e. $ cabal install world would be the only way to install world. Peter

I've attached a patch to the ticket [1] for world-file support. Every user-requested package is recorded, without implied dependencies. A world file entry consists of the package name, the requested version, and user flags (if any). Recording these flags for each package provides functionality similar to the USE flags in Gentoo. On compiler upgrade these packages can be reinstalled by: # cabal install world It is also possible to upgrade all packages in the world file. This might come in handy as an alternative to the currently disabled global-upgrade: # cabal upgrade world Peter [1] http://hackage.haskell.org/trac/hackage/ticket/199
participants (3)
-
Andrea Vezzosi
-
Duncan Coutts
-
Peter Robinson