Hiding platform packages in Cabal sandboxes

As a maintainer of the various OpenGL-related packages I have the following problem: The Haskell platform has those packages (OpenGLRaw, GLURaw, ...) exposed, which is the right thing to do in general. When I want to work on those packages, I'd like to use Cabal sandboxes to avoid screwing up the platform versions of them, but things get a bit tricky then. Consider e.g. the GLURaw package, which depends on the OpenGLRaw package. Assume that I'd like to add some stuff to the OpenGLRaw package and use that in GLURaw. With cabal sandboxes I'll have to fight a little bit, because versions of these packages are already exposed: ----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox init Writing a default package environment file to /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/cabal.sandbox.config Creating a new sandbox at /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox add-source ../OpenGLRaw ----------------------------------------------------------------------------------------------------------------------- No problem so far. But the next step is not so OK: ----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies Resolving dependencies... All the requested packages are already installed: Use --reinstall if you want to reinstall anyway. ----------------------------------------------------------------------------------------------------------------------- Hmmm, obviously cabal sees the globally exposed OpenGLRaw and ignores that I've done add-source above. OK, next try with --constraint added: ----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' Resolving dependencies... In order, the following would be installed: OpenGLRaw-1.5.0.0 (reinstall) cabal: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Use --force-reinstalls if you want to install anyway. ----------------------------------------------------------------------------------------------------------------------- (Is there any documentation about --constraint? I figured that out by actually reading the cabal sources. :-/ ) Better, but still not OK, so let's add --force-reinstalls: ----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' --force-reinstalls Resolving dependencies... Warning: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Continuing even though the plan contains dangerous reinstalls. Notice: installing into a sandbox located at /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox Configuring OpenGLRaw-1.5.0.0... Building OpenGLRaw-1.5.0.0... Installed OpenGLRaw-1.5.0.0 ----------------------------------------------------------------------------------------------------------------------- That works, so after that I could actually build/install GLURaw. So in a nutshell what I have to do is: cabal sandbox init cabal sandbox add-source ../OpenGLRaw cabal install --constraint='OpenGLRaw source' --force-reinstalls --enable-documentation --haddock-hyperlink-source And for other packages I even have to add several --constraint flags, because they depend on several locally modified packages. This seems a bit weird. Is this the recommended workflow? How do other maintainers of platform packages handle this? What one *actually* wants is hiding some of the globally exposed packages while being in the sandbox (--constraint and --force-reinstalls could go away then), but I've found no way to do that. Cheers, S.

On 16 October 2014 00:07, Sven Panne
As a maintainer of the various OpenGL-related packages I have the following problem: The Haskell platform has those packages (OpenGLRaw, GLURaw, ...) exposed, which is the right thing to do in general. When I want to work on those packages, I'd like to use Cabal sandboxes to avoid screwing up the platform versions of them, but things get a bit tricky then. Consider e.g. the GLURaw package, which depends on the OpenGLRaw package. Assume that I'd like to add some stuff to the OpenGLRaw package and use that in GLURaw. With cabal sandboxes I'll have to fight a little bit, because versions of these packages are already exposed:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox init Writing a default package environment file to /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/cabal.sandbox.config Creating a new sandbox at /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox add-source ../OpenGLRaw -----------------------------------------------------------------------------------------------------------------------
No problem so far. But the next step is not so OK:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies Resolving dependencies... All the requested packages are already installed: Use --reinstall if you want to reinstall anyway. -----------------------------------------------------------------------------------------------------------------------
Hmmm, obviously cabal sees the globally exposed OpenGLRaw and ignores that I've done add-source above. OK, next try with --constraint added:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' Resolving dependencies... In order, the following would be installed: OpenGLRaw-1.5.0.0 (reinstall) cabal: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Use --force-reinstalls if you want to install anyway. -----------------------------------------------------------------------------------------------------------------------
(Is there any documentation about --constraint? I figured that out by actually reading the cabal sources. :-/ ) Better, but still not OK, so let's add --force-reinstalls:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' --force-reinstalls Resolving dependencies... Warning: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Continuing even though the plan contains dangerous reinstalls. Notice: installing into a sandbox located at /usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox Configuring OpenGLRaw-1.5.0.0... Building OpenGLRaw-1.5.0.0... Installed OpenGLRaw-1.5.0.0 -----------------------------------------------------------------------------------------------------------------------
That works, so after that I could actually build/install GLURaw. So in a nutshell what I have to do is:
cabal sandbox init cabal sandbox add-source ../OpenGLRaw cabal install --constraint='OpenGLRaw source' --force-reinstalls --enable-documentation --haddock-hyperlink-source
And for other packages I even have to add several --constraint flags, because they depend on several locally modified packages. This seems a bit weird. Is this the recommended workflow? How do other maintainers of platform packages handle this? What one *actually* wants is hiding some of the globally exposed packages while being in the sandbox (--constraint and --force-reinstalls could go away then), but I've found no way to do that.
Cheers, S. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Not the greatest idea, but what about bumping the version numbers of the packages you want to build from source (e.g. append a useless ".1" on the end of their version numbers in their .cabal files)? Then you should be able to do "cabal install OpenGLRaw" instead of needing to do the constraint, etc. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com

AFAIK there's no way to selectively "hide" packages. However, you might be
able to use cabal2nix4dev [1]. You'll have to modify the nix expressions to
use your packages instead of the existing ones from the platform (in NIX
they can happily coexist).
Perhaps somebody with direct NIX experience could provide more detailed
step by step instructions?
Michal
[1] https://github.com/dave4420/cabal2nix4dev
On Wed, Oct 15, 2014 at 9:07 AM, Sven Panne
As a maintainer of the various OpenGL-related packages I have the following problem: The Haskell platform has those packages (OpenGLRaw, GLURaw, ...) exposed, which is the right thing to do in general. When I want to work on those packages, I'd like to use Cabal sandboxes to avoid screwing up the platform versions of them, but things get a bit tricky then. Consider e.g. the GLURaw package, which depends on the OpenGLRaw package. Assume that I'd like to add some stuff to the OpenGLRaw package and use that in GLURaw. With cabal sandboxes I'll have to fight a little bit, because versions of these packages are already exposed:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox init Writing a default package environment file to
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/cabal.sandbox.config Creating a new sandbox at
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox add-source ../OpenGLRaw
-----------------------------------------------------------------------------------------------------------------------
No problem so far. But the next step is not so OK:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies Resolving dependencies... All the requested packages are already installed: Use --reinstall if you want to reinstall anyway.
-----------------------------------------------------------------------------------------------------------------------
Hmmm, obviously cabal sees the globally exposed OpenGLRaw and ignores that I've done add-source above. OK, next try with --constraint added:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' Resolving dependencies... In order, the following would be installed: OpenGLRaw-1.5.0.0 (reinstall) cabal: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Use --force-reinstalls if you want to install anyway.
-----------------------------------------------------------------------------------------------------------------------
(Is there any documentation about --constraint? I figured that out by actually reading the cabal sources. :-/ ) Better, but still not OK, so let's add --force-reinstalls:
----------------------------------------------------------------------------------------------------------------------- svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal install --only-dependencies --constraint='OpenGLRaw source' --force-reinstalls Resolving dependencies... Warning: The following packages are likely to be broken by the reinstalls: OpenGL-2.9.2.0 GLUT-2.5.1.1 GLURaw-1.4.0.1 Continuing even though the plan contains dangerous reinstalls. Notice: installing into a sandbox located at
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox Configuring OpenGLRaw-1.5.0.0... Building OpenGLRaw-1.5.0.0... Installed OpenGLRaw-1.5.0.0
-----------------------------------------------------------------------------------------------------------------------
That works, so after that I could actually build/install GLURaw. So in a nutshell what I have to do is:
cabal sandbox init cabal sandbox add-source ../OpenGLRaw cabal install --constraint='OpenGLRaw source' --force-reinstalls --enable-documentation --haddock-hyperlink-source
And for other packages I even have to add several --constraint flags, because they depend on several locally modified packages. This seems a bit weird. Is this the recommended workflow? How do other maintainers of platform packages handle this? What one *actually* wants is hiding some of the globally exposed packages while being in the sandbox (--constraint and --force-reinstalls could go away then), but I've found no way to do that.
Cheers, S. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, Oct 15, 2014 at 9:07 AM, Sven Panne
And for other packages I even have to add several --constraint flags, because they depend on several locally modified packages. This seems a bit weird. Is this the recommended workflow? How do other maintainers of platform packages handle this? What one *actually* wants is hiding some of the globally exposed packages while being in the sandbox (--constraint and --force-reinstalls could go away then), but I've found no way to do that.
As I understand it, ghc doesn't give cabal enough hooks into its package management to do it properly. I'd be looking at hsenv to set up a sandboxed ghc instead. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On 2014年10月15日 22:07, Sven Panne wrote:
As a maintainer of the various OpenGL-related packages I have the following problem: The Haskell platform has those packages (OpenGLRaw, GLURaw, ...) exposed, which is the right thing to do in general. When I want to work on those packages, I'd like to use Cabal sandboxes to avoid screwing up the platform versions of them, but things get a bit tricky then.
Though it is not a general solution, have you tried developing in a "minimal Haskell installation" (just GHC, Cabal, and packages required by those)? The OpenGL-related packages would not be already installed in that case, so you would not need to worry about hiding them. You could then test against Haskell Platform separately. Travis
participants (5)
-
Brandon Allbery
-
Ivan Lazar Miljenovic
-
Michal Antkiewicz
-
Sven Panne
-
Travis Cardwell