Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install only one of many executables in a package. #8614

Open
kindaro opened this issue Nov 22, 2022 · 7 comments
Open

Cannot install only one of many executables in a package. #8614

kindaro opened this issue Nov 22, 2022 · 7 comments

Comments

@kindaro
Copy link

kindaro commented Nov 22, 2022

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?…

@gbaz
Copy link
Collaborator

gbaz commented Nov 22, 2022

have you tried using pkgname:exename syntax? i.e. cabal install mypackagename:example1 ?

@kindaro
Copy link
Author

kindaro commented Nov 22, 2022

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.

  • example1
  • example:exe:example1
  • exe:example1
  • example: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.

@fgaz
Copy link
Member

fgaz commented Nov 23, 2022

#6369 was probably for remote packages. Can you try a package from hackage (or any other repo)?

@kindaro
Copy link
Author

kindaro commented Nov 23, 2022

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@

@kindaro
Copy link
Author

kindaro commented Nov 23, 2022

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.

@gbaz gbaz added this to the Considered for 3.10 milestone Dec 1, 2022
@gbaz gbaz added the type: bug label Dec 1, 2022
@Mikolaj
Copy link
Member

Mikolaj commented Dec 29, 2022

@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.

@brandonchinn178
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants