Cannot install only one of many executables in a package.
Describe the bug
I cannot install only one of many executables in a package. All of them get built and installed at once.
To Reproduce
Steps to reproduce the behavior:
Create a trivial package with 2 executables. Ask Cabal to install some one of them.
% cabal install example1 --installdir /tmp/executables
Wrote tarball sdist to /tmp/example/dist-newstyle/sdist/example-0.1.0.0.tar.gz
Resolving dependencies...
Up to date
Symlinking 'example1' to '/tmp/executables/example1'
Symlinking 'example2' to '/tmp/executables/example2'
% ls /tmp/executables
example1 example2
I never asked for example2!
Expected behavior
Exactly one executable that I named is built and installed.
System information
- Standard issue Linux.
cabal-install version 3.8.1.0.
Additional context
This should have been solved in #6369?…
have you tried using pkgname:exename syntax? i.e. cabal install mypackagename:example1 ?
I tied various combinations of component selectors. It is not clear what the syntax of component selectors is in the first place. Last time I checked, the spelling and meaning of component selectors was not well documented.
example1example:exe:example1exe:example1example:example1
— Neither of these work as expected.
I say all the ways to select the same component should work, and work to the same outcome. If you are saying that some of them work one way and others another, I say it is unexpected and confusing behaviour.
#6369 was probably for remote packages. Can you try a package from hackage (or any other repo)?
Yes, for packages on Hackage it works as expected… sorta… It does not accept the selector of form …:exe:…, only …:….
% cabal install gloss-examples:exe:gloss-lifespan --installdir /tmp/executables
Downloading gloss-examples:exe:gloss-lifespan
Error: cabal: '/usr/bin/curl' exited with an error:
curl: (3) URL using bad/illegal format or missing URL
% cabal install gloss-examples:gloss-lifespan --installdir /tmp/executables
Resolving dependencies...
Build profile: -w ghc-9.2.4 -O1
In order, the following will be built (use -v for more details):
- OpenGL-3.0.3.0 (lib) (requires build)
- GLUT-2.7.0.16 (lib) (requires build)
- gloss-rendering-1.13.1.2 (lib) (requires build)
- gloss-1.13.2.2 (lib) (requires build)
- gloss-examples-1.13.0.4 (exe:gloss-lifespan) (requires download & build)
Downloading gloss-examples-1.13.0.4
Starting OpenGL-3.0.3.0 (lib)
Downloaded gloss-examples-1.13.0.4
Building OpenGL-3.0.3.0 (lib)
Installing OpenGL-3.0.3.0 (lib)
Completed OpenGL-3.0.3.0 (lib)
Starting GLUT-2.7.0.16 (lib)
Building GLUT-2.7.0.16 (lib)
Installing GLUT-2.7.0.16 (lib)
Completed GLUT-2.7.0.16 (lib)
Starting gloss-rendering-1.13.1.2 (lib)
Building gloss-rendering-1.13.1.2 (lib)
Installing gloss-rendering-1.13.1.2 (lib)
Completed gloss-rendering-1.13.1.2 (lib)
Starting gloss-1.13.2.2 (lib)
Building gloss-1.13.2.2 (lib)
Installing gloss-1.13.2.2 (lib)
Completed gloss-1.13.2.2 (lib)
Starting gloss-examples-1.13.0.4 (exe:gloss-lifespan)
Building gloss-examples-1.13.0.4 (exe:gloss-lifespan)
Installing gloss-examples-1.13.0.4 (exe:gloss-lifespan)
Completed gloss-examples-1.13.0.4 (exe:gloss-lifespan)
Symlinking 'gloss-lifespan' to '/tmp/executables/gloss-lifespan'
% l /tmp/executables
gloss-lifespan@
Maintainers, please indicate to me the status of this issue. I answered your questions to the best of my ability. Now I need to know whether this issue will be worked on and what else I can do to help.
@kindaro: metadata changes may not show up in notifications, so let me turn your attention to ^^^
We'd very much welcome a PR and it has some chance to get merged to cabal 3.10, depending on the review cycle.
I can also repro this. This is an issue in Docker, where I'm only copying files related to executableA to maximize cache hits, but cabal is trying to build executableB and failing to find the files