You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal install pkg-x.y.z fails unless --ignore-project is given #8325
If you sit in a local project directory and cabal install a remote package, you cannot give its version suffix unless you also pass --ignore-project.
Reproducer:
change to a cabal project root
cabal install fix-whitespace-0.0.8 fails:
Error: cabal: No targets given and there is no package in the current
directory. Use the target 'all' for all packages in the project or specify
packages or components by name or location.
cabal install fix-whitespace succeeds
cabal install --ignore-project fix-whitespace-0.0.8 also succeeds
Run cabal install --install-method=copy --installdir=$HOME/.local/bin fix-whitespace-0.0.8
cabal: No targets given and there is no package in the current directory. Use
the target 'all' for all packages in the project or specify packages or
components by name or location.
I think there were suggestions in some other tickets to make cabal install foo ignore the current project file. As it stands, it fully takes the file into account (e.g., using flags and constraints from the file), which probably also manifests in the strange way you mention.
Hmm, there is another factor, the command fails if there is no .cabal files in the project root dir (the layout of cabal repo itself) but
mkdir test && cd test && cabal init -n && cabal install haskell-say-1.0.0.0 works
in the cabal repo cd cabal-install && cabal install haskell-say-1.0.0.0 also works
As stated in that issue cabal install foo should be affected by project configuration cause you could have a constraint: foo > 1.1 in your cabal.project. That is the case if package foo contains a library used in your project but it also contains an executable which you might use. And that is a design decision (which could be revisited of course)
What is surprising to me is that $PACKAGE-$VERSION can be a local target. What is the use of that?
Intuitively, I would always associate a remote target with the form $PACKAGE-$VERSION.
But clearly, the OP points out a bug: that $PACKAGE is recognized as remote target but $PACKAGE-$VERSION is not.
Activity
Mikolaj commentedon Jul 26, 2022
I think there were suggestions in some other tickets to make
cabal install fooignore the current project file. As it stands, it fully takes the file into account (e.g., using flags and constraints from the file), which probably also manifests in the strange way you mention.jneira commentedon Jul 26, 2022
Hmm, there is another factor, the command fails if there is no .cabal files in the project root dir (the layout of cabal repo itself) but
mkdir test && cd test && cabal init -n && cabal install haskell-say-1.0.0.0workscd cabal-install && cabal install haskell-say-1.0.0.0also worksAs stated in that issue
cabal install fooshould be affected by project configuration cause you could have aconstraint: foo > 1.1in your cabal.project. That is the case if package foo contains a library used in your project but it also contains an executable which you might use. And that is a design decision (which could be revisited of course)andreasabel commentedon Jul 26, 2022
What is surprising to me is that
$PACKAGE-$VERSIONcan be a local target. What is the use of that?Intuitively, I would always associate a remote target with the form
$PACKAGE-$VERSION.But clearly, the OP points out a bug: that
$PACKAGEis recognized as remote target but$PACKAGE-$VERSIONis not.