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

Question about: store-dir, package-dbs, and simulate sandbox #9737

Closed
chansey97 opened this issue Feb 23, 2024 · 4 comments
Closed

Question about: store-dir, package-dbs, and simulate sandbox #9737

chansey97 opened this issue Feb 23, 2024 · 4 comments

Comments

@chansey97
Copy link
Contributor

What is your question?

Even though the sandbox functionality has been removed, I still wish a way to simulate its functionality.

I tried the --store-dir=DIR option on, it works well on Windows.

For example,

cabal --store-dir "./store-dir" build

It will build all the packages in the current project directory.

## My project folder now generate a new subfolder `store-dir`
\---store-dir
    \---ghc-9.8.1
        +---incoming
        +---package.db
        +---linear-1.22-bd032fa56680dc724a9bbbfee960b52b4c4a70c6
        +---OpenGL-3.0.3.0-2ae721ae6ad7822f734a3392b576ce1d14f6aabd
        +---kan-extensions-5.2.5-4b3c60b0ae89aab3067951ef9c1cac496a515b
        +...

However, --store-dir=DIR can only be set via command line at the moment.

The 1st question is that is it possible to set --store-dir=DIR in cabal.project in the future version?

The 2nd question is that, in this context, what role does the option package-dbs: play?

P.s. In the above command, i.e. cabal --store-dir "./store-dir" build, I did not set package-dbs in cabal.project at all, but it works. Why we have both --store-dir and --package-db (or package-dbs:) at the same time?

If I config cabal.project as the follows

-- cabal.project
packages: ./*.cabal
package-dbs: in-place

and type cabal build on command line.

It complains

ghc-9.8.1.exe: can't find a package database at in-place

I also tried

-- cabal.project
packages: ./*.cabal
package-dbs: ./in-place/ghc-9.8.1/package.db

and on command line cabal --store-dir "./input" build.

It doesn't work as well.

ghc-9.8.1.exe: can't find a package database at ./in-place/ghc-9.8.1/package.db

System information

  • Operating system: Windows + MSYS64 MINGW
  • ghc-9.8.1, cabal-install version 3.10.2.1
@mpickering
Copy link
Collaborator

See #9678 for a discussion about the semantics of --package-db flag. In short, you probably don't want to use it for this use case.

You could set store-dir in a cabal.config file instead of a cabal.project file but that is supposed to be for system-wide configuration. I don't think you are really supposed to set --store-dir per project which is why you can't set it in a cabal.project file.

@chansey97
Copy link
Contributor Author

@mpickering Thanks for clarification.

And sorry for slightly off topic, do you know any practical use case for utilizing the --package-db?

@mpickering
Copy link
Collaborator

@chansey97 If you/a distro want to augment the global package database with some more packages which are always available then you can build the package database yourself (probably not with cabal-install) and then make it available for cabal-install to use.

In the cabal testsuite we do this in order to provide up-to-date Cabal library versions for cabal-install to use.

@chansey97
Copy link
Contributor Author

@mpickering I see, thanks! Close this issue.

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

2 participants