[Haskell-cafe] Hiding platform packages in Cabal sandboxes
Sven Panne
svenpanne at gmail.com
Wed Oct 15 13:07:57 UTC 2014
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 at 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 at svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal
sandbox add-source ../OpenGLRaw
-----------------------------------------------------------------------------------------------------------------------
No problem so far. But the next step is not so OK:
-----------------------------------------------------------------------------------------------------------------------
svenpanne at 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 at 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 at 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.
More information about the Haskell-Cafe
mailing list