Global Constraints for Cabal and also Release Plan?

Any more feedback on this? And also, do we have any plans for an
upcoming Cabal release?
Braindump here:
Once this lands and we have a cabal release, we can do a trial run of
a new minimal platform release. So I'm inclined to try to target a
cabal release for sooner than later if possible, to enable trying to
get the "minimal platform" proposal happening.
A "nice to have" in the future for the platform would be to help
address https://github.com/haskell/haskell-platform/issues/207
The proposal there would be to add an env variable (perhaps
CABAL_PATH_PREFIX) which, if it existed, would be added to the path
before running child processes (such as those kicked off by
build-type:configure). That way windows environments could provide the
Msys2 bin directory and those tools would then be made available to
the configure scripts, etc.
I haven't investigated adding this yet, but I don't think it would be
too much work.
If people are open to this, and especially if there were some
pointers, I'd be happy to look at this.
In any case, this is only a "nice to have" since it can be worked
around with an explicit "switcher script" prior to running
cabal-install.
Anyway, what are people's thoughts on A) getting the "global
constraints" PR added (https://github.com/haskell/cabal/pull/2820), B)
possibly adding the cabal-path-prefix logic, and C) a release
timetable with or without B so as to enable facilitate a minimal
platform release?
-g
On Fri, Sep 11, 2015 at 5:17 PM, Gershom B
I've changed Freeze.hs to also respect this flag, and submitted a pull request:
https://github.com/haskell/cabal/pull/2820
--Gershom
On Thu, Sep 10, 2015 at 6:45 PM, Gershom B
wrote: Hi all. I've got a branch of cabal with a new feature: https://github.com/gbaz/cabal/tree/constraints-config
This lets you either pass `constraints-file` on the command line or in the ~/.cabal/config file.
The constraints-file serves as a "default" cabal.config file for freezes should one not be provided by a particular package.
Thus, a "minimal" platform can ship with a file that includes the platform constraints. Later, a user can simply download a new file for a new constraints set -- say lts -- and swap their config to point to that instead.
This makes both the platform in its new ideally-more-minimal guise and stackage play nicer together and with cabal, in a way that required minimal changes to cabal proper.
Ideally this or a relative can land soon to help enable the minimal platform plans (the work grew out of the discussion on: https://github.com/haskell/haskell-platform/issues/206)
There are two places where I wasn't quite sure what to do. In PackageEnvironment.hs, the tryLoadSandboxPackageEnvironmentFile doesn't check if this flag is set and handle that case. So this is when we are already in a sandbox and the question is if we should _also_ respect this flag, just as a sandbox also respects a cabal.config file directly in the directory. My gut says "don't respect it in sandboxes" but i'm not sure.
Additionally, the freezePackages function in Freeze.hs doesn't respect this flag. I'm not sure exactly what the full call chain here is yet, so haven't worked out the logic.
Anyway, thoughts?
--gershom

On 09/22/2015 12:11 AM, Gershom B wrote: [--snip--]
The proposal there would be to add an env variable (perhaps CABAL_PATH_PREFIX) which, if it existed, would be added to the path before running child processes (such as those kicked off by build-type:configure). That way windows environments could provide the Msys2 bin directory and those tools would then be made available to the configure scripts, etc.
I'm not sure I understand... what does CABAL_PATH_PREFIX add over just adding whatever is needed to the $PATH before executing cabal? (Without having looked at the issue thread.) I'm mainly worried about option-itis... which cabal-install is already suffering a lot from. Regards,

On September 24, 2015 at 11:01:53 AM, Bardur Arantsson (spam@scientician.net) wrote:
On 09/22/2015 12:11 AM, Gershom B wrote: [--snip--]
The proposal there would be to add an env variable (perhaps CABAL_PATH_PREFIX) which, if it existed, would be added to the path before running child processes (such as those kicked off by build-type:configure). That way windows environments could provide the Msys2 bin directory and those tools would then be made available to the configure scripts, etc.
I'm not sure I understand... what does CABAL_PATH_PREFIX add over just adding whatever is needed to the $PATH before executing cabal?
(Without having looked at the issue thread.)
I'm mainly worried about option-itis... which cabal-install is already suffering a lot from.
This is a fine question. By the way, I realized this might better be served as a cabal-path-prefix option (in cabal config) rather than an env variable, since that is more uniform. In any case, the issue is this. Suppose I want to work with MSys2, as MinGHC does. This is what lets me build against various c libraries, even in a windows environment. To do so, I need all the MSys2 tools in my path. So far, so good. But… those tools overlap in name with other tools in my path. For example, with my existing cygwin installation. And also with other tools of the same names at times that are the _windows_ versions of those common utilities. So, I want MSys2 tools in my path but _only_ when I am building cabal packages, and not otherwise. Either I manually modify my env each time I want to build a cabal package, _or_ we teach cabal to be clever and handle it for us, which is the motivation for this. Certainly, if we want a good “out of the box” experience for windows users, asking them to modify their path before they run cabal, every time they do so, is not a very great experience. —gershom

On 24 September 2015 at 17:06, Gershom B
So, I want MSys2 tools in my path but _only_ when I am building cabal packages, and not otherwise.
IIUC, 'extra-prog-path' in '~/.cabal/config' already does what you want. It looks like it also supports multiple directories, using comma as separator.

On September 24, 2015 at 11:52:51 AM, Mikhail Glushenkov (the.dead.shall.rise@gmail.com) wrote:
On 24 September 2015 at 17:06, Gershom B wrote:
So, I want MSys2 tools in my path but _only_ when I am building cabal packages, and not otherwise.
IIUC, 'extra-prog-path' in '~/.cabal/config' already does what you want. It looks like it also supports multiple directories, using comma as separator.
Hmm… we should investigate if that is sufficient, or if it can be changed to do so. Consider for example if we have a configure build-type, that runs an autoconf script. It is not enough that the executable we run be in the path, but also that the “path” available to the autoconf script be amended as well. So if this only changes where _cabal_ searches for executables, but does not affect the path made available to them, I think this will be insufficient? The potential overlap is certainly worth investigating, though. -g

On 24 September 2015 at 17:56, Gershom B
Consider for example if we have a configure build-type, that runs an autoconf script. It is not enough that the executable we run be in the path, but also that the “path” available to the autoconf script be amended as well.
Yes, 'extra-prog-path' also affects the PATH environment variable of the programs invoked by cabal-install: https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Progr... https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Progr... https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Confi...

On September 24, 2015 at 12:16:29 PM, Mikhail Glushenkov (the.dead.shall.rise@gmail.com) wrote:
On 24 September 2015 at 17:56, Gershom B wrote:
Consider for example if we have a configure build-type, that runs an autoconf script. It is not enough that the executable we run be in the path, but also that the “path” available to the autoconf script be amended as well.
Yes, 'extra-prog-path' also affects the PATH environment variable of the programs invoked by cabal-install:
https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Progr... https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Progr... https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Confi...
Ah this looks like it only takes hold for the simple build-type and not “build-type: configure” for use with autoconf. (i.e. the “building network” case). I don’t quite see what’s going on in terms of how anything is implemented yet, but I would take it there would be no objections to extending this to handle the “build-type: configure” case? And of course I’d welcome any pointers as to what needs to be changed to make that work.. -gershom

On September 25, 2015 at 5:43:38 PM, Gershom B (gershomb@gmail.com) wrote:
Ah this looks like it only takes hold for the simple build-type and not “build-type: configure” for use with autoconf. (i.e. the “building network” case). I don’t quite see what’s going on in terms of how anything is implemented yet, but I would take it there would be no objections to extending this to handle the “build-type: configure” case? And of course I’d welcome any pointers as to what needs to be changed to make that work..
And this is now implemented here: https://github.com/haskell/cabal/pull/2840 —Gershom

On 09/24/2015 05:06 PM, Gershom B wrote:
On September 24, 2015 at 11:01:53 AM, Bardur Arantsson (spam@scientician.net) wrote:
On 09/22/2015 12:11 AM, Gershom B wrote: [--snip--]
The proposal there would be to add an env variable (perhaps CABAL_PATH_PREFIX) which, if it existed, would be added to the path before running child processes (such as those kicked off by build-type:configure). That way windows environments could provide the Msys2 bin directory and those tools would then be made available to the configure scripts, etc.
I'm not sure I understand... what does CABAL_PATH_PREFIX add over just adding whatever is needed to the $PATH before executing cabal?
(Without having looked at the issue thread.)
I'm mainly worried about option-itis... which cabal-install is already suffering a lot from.
This is a fine question. By the way, I realized this might better be served as a cabal-path-prefix option (in cabal config) rather than an env variable, since that is more uniform.
In any case, the issue is this. Suppose I want to work with MSys2, as MinGHC does. This is what lets me build against various c libraries, even in a windows environment. To do so, I need all the MSys2 tools in my path. So far, so good.
But… those tools overlap in name with other tools in my path. For example, with my existing cygwin installation. And also with other tools of the same names at times that are the _windows_ versions of those common utilities.
So, I want MSys2 tools in my path but _only_ when I am building cabal packages, and not otherwise.
Either I manually modify my env each time I want to build a cabal package, _or_ we teach cabal to be clever and handle it for us, which is the motivation for this.
Just write a little wrapper for cabal which sets the path and calls the "real" cabal...?

Hi Gershom,
On 22 September 2015 at 00:11, Gershom B
Any more feedback on this? And also, do we have any plans for an upcoming Cabal release?
Re: next release, I think we should do one in the near future, but I'd like to see some outstanding PRs merged first. I have the following preliminary wishlist: a) Decide what to do about no-reinstall patches (merge/no merge for the time being/wait for Duncan to finish his new hotness). b) Merge gen-bounds (#2774) (modulo bikeshedding). c) Merge #2732 and #2731 (Andres's solver improvements) - needs tests/testing. Maybe someone can help Andres on this. d) Merge your constraints-file patch (#2820) - haven't had time to look at it yet, sorry! e) Test the HTTPS code, esp. on Windows. Can be done as part of beta. See also #2764. f) Merge #2522 (**/* globbing) in some form (requires some work on my part) g) #2829 - Thomas's reconfigure work. Not yet finished AFAICT. h) init-config/'user-config init' command - IIRC there are two PRs implementing the same thing. i) Merge Edsko's foreign library patches (#2540). IIRC, they are good to go but need rebasing. Hopefully haven't forgotten anything!
participants (3)
-
Bardur Arantsson
-
Gershom B
-
Mikhail Glushenkov