Library version choosing of cabal sandbox build

Hi, if I'm having a cabal file without an upper bound for a library, the newest available version of the library is 3, there's a local/user installation of the version 2 of the library, which version of the library is a cabal sandbox build supposed to use? In my case I can see that version 2 of the library is used. If this is intended, how can I ensure that always the newest version is used independent of any local/user installations? Thanks! Greetings, Daniel

dan@machine ~> cabal --version cabal-install version 1.20.0.3 using version 1.20.0.1 of the Cabal library

Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer * installed * newest * other in that order. If you want to make sure the newest version is used temporarily you can pass --constraint="foo-1.2.3.4" to cabal install. If you want to make this change more permanent you can set an exact version in a cabal.config file in the same directory as the .cabal file. On Tue, Jul 15, 2014 at 12:57 PM, Daniel Trstenjak < daniel.trstenjak@gmail.com> wrote:
dan@machine ~> cabal --version cabal-install version 1.20.0.3 using version 1.20.0.1 of the Cabal library _______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel

Hi Johan,
Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer
* installed * newest * other
in that order.
If you want to make sure the newest version is used temporarily you can pass --constraint="foo-1.2.3.4" to cabal install. If you want to make this change more permanent you can set an exact version in a cabal.config file in the same directory as the .cabal file.
So there's no flag to always use the newest one, right? In my use case it would be a bit cumbersome to first find these libraries and then to list all of them by hand. The concrete use case is to test your project with the newest available library versions. Greetings, Daniel

* Daniel Trstenjak
Hi Johan,
Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer
* installed * newest * other
in that order.
If you want to make sure the newest version is used temporarily you can pass --constraint="foo-1.2.3.4" to cabal install. If you want to make this change more permanent you can set an exact version in a cabal.config file in the same directory as the .cabal file.
So there's no flag to always use the newest one, right?
In my use case it would be a bit cumbersome to first find these libraries and then to list all of them by hand.
The concrete use case is to test your project with the newest available library versions.
You should create a fresh sandbox per build, then. This is both sufficient (nothing is installed => no reason to prefer an older version) and necessary (when in a sandbox, cabal won't let you have two different versions of the library installed). Roman

Hi Roman,
You should create a fresh sandbox per build, then.
This is both sufficient (nothing is installed => no reason to prefer an older version) and necessary (when in a sandbox, cabal won't let you have two different versions of the library installed).
As long as you haven't installed the library locally (in ~/.cabal) then it's sufficient, otherwise it isn't. Greetings, Daniel

* Daniel Trstenjak
Hi Roman,
You should create a fresh sandbox per build, then.
This is both sufficient (nothing is installed => no reason to prefer an older version) and necessary (when in a sandbox, cabal won't let you have two different versions of the library installed).
As long as you haven't installed the library locally (in ~/.cabal) then it's sufficient, otherwise it isn't.
When in a sandbox, cabal ignores the user package database. As long as you don't install it *globally*, you should be fine. Roman

Hi Johan, On Tue, Jul 15, 2014 at 01:07:17PM +0200, Johan Tibell wrote:
Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer
* installed * newest * other
in that order.
Just to make it clear, a cabal sandbox build does consider the installed libraries in the user package database, right? Greetings, Daniel

Right On Wed, Jul 16, 2014 at 9:42 AM, Daniel Trstenjak < daniel.trstenjak@gmail.com> wrote:
Hi Johan,
On Tue, Jul 15, 2014 at 01:07:17PM +0200, Johan Tibell wrote:
Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer
* installed * newest * other
in that order.
Just to make it clear, a cabal sandbox build does consider the installed libraries in the user package database, right?
Greetings, Daniel _______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel

This doesn't make sense to me. Can you elaborate?
* Johan Tibell
Right
On Wed, Jul 16, 2014 at 9:42 AM, Daniel Trstenjak < daniel.trstenjak@gmail.com> wrote:
Hi Johan,
On Tue, Jul 15, 2014 at 01:07:17PM +0200, Johan Tibell wrote:
Cabal is allowed to use any version that fullfills the required bounds. It uses a heuristic the tends to prefer
* installed * newest * other
in that order.
Just to make it clear, a cabal sandbox build does consider the installed libraries in the user package database, right?
Greetings, Daniel _______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel
_______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel

Sorry, I read this to quickly as I was in a rush this morning. Sandboxes
consider only the global package DB, not the user package DB.
On Wed, Jul 16, 2014 at 11:59 AM, Roman Cheplyaka
This doesn't make sense to me. Can you elaborate?
* Johan Tibell
[2014-07-16 10:00:59+0200] Right
On Wed, Jul 16, 2014 at 9:42 AM, Daniel Trstenjak < daniel.trstenjak@gmail.com> wrote:
Hi Johan,
On Tue, Jul 15, 2014 at 01:07:17PM +0200, Johan Tibell wrote:
Cabal is allowed to use any version that fullfills the required
bounds.
It uses
a heuristic the tends to prefer
* installed * newest * other
in that order.
Just to make it clear, a cabal sandbox build does consider the installed libraries in the user package database, right?
Greetings, Daniel _______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel
_______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel

On Wed, Jul 16, 2014 at 12:00:27PM +0200, Johan Tibell wrote:
Sorry, I read this to quickly as I was in a rush this morning. Sandboxes consider only the global package DB, not the user package DB.
Ok, I just saw, that I've irritated myself, because just removing the upper bound of the library wasn't sufficient, because an indirect dependency of my project also depends on the library and still had an upper bound. Sorry for the confusion. Greetings, Daniel

On Wed, Jul 16, 2014 at 3:42 AM, Daniel Trstenjak < daniel.trstenjak@gmail.com> wrote:
Just to make it clear, a cabal sandbox build does consider the installed libraries in the user package database, right?
No, the sandbox mechanism coopts the user package database mechanism, so it cannot see anything in the normal user package database --- the sandbox *is* the user package database. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (4)
-
Brandon Allbery
-
Daniel Trstenjak
-
Johan Tibell
-
Roman Cheplyaka