-
Notifications
You must be signed in to change notification settings - Fork 698
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
source-repository-package not optional #5444
Comments
So basically, they shouldn't be added like they're another package in the same project, but they should just expand the universe of things that the solver knows about to depend on? |
At least that was my (possibly naive) expectation. The main reason I want to use this feature is to be able to build packages that are not being uploaded to Hackage, like reflex (reflex-frp/reflex-dom#140, reflex-frp/reflex#177) |
That feels like how it should work to me, too. |
This is a general problem; we only have Otoh, we can add additional package repo indices via What would be useful to have is a way to merely add single packages to the "universe" (similiar to PS: @nomeata for now you can workaround this by having separate |
That idea (adding packages to the universe) was basically the cabal-side design of the provenance-qualified package imports proposal: ghc-proposals/ghc-proposals#115 Cabal could adopt that or something similar even without GHC actually implementing the ability to track provenance in the packagedb proper. |
The documented use case for `optional-packages`` is vendored dependencies. I guess usually you use your dependencies, so usually people don’t notice the difference, but I would argue that the current behaviour is not following the principle of least surprise.
Doing that already :-) |
@nomeata well, the main use-case for If we now wanted the variant that such (possibly temporarily) vendored dependencies are declared "exclusive" (i.e. they hide all other versions for the same package-name), but at the same time act like index-packages (i.e. they're only included in the install-plan if anything force them in by actually depending on them), we need yet another mode (strawman: index-exclusive) than the one I suggested in #5444 (comment) (I'm not sure how provenance-qualification would benefit here; once remote git repo deps are involved, we're not in a self-describing package context anymore, but instead in a cabal.project-specific context where the cabal.project file sets up the "routing" of where packages are procured from -- i.e. that's where the "local" of "nix-style local builds" becomes apparent: we're dealing with local versions of packages which are supposed to supplant/shadow any pre-existing Hackage packages of the same name; I don't think we intend to introduce new names or labelled namespaces when vendor a package in this context -- for example, if I locally vendor a Git snapshot of |
Good point… index-exlusive sounds right. Not sure if we need all the others :-) |
well, you need the PS: we also have and here's a link to the docs for convenience: http://cabal.readthedocs.io/en/latest/nix-local-build.html#specifying-the-local-packages |
The docs don't help me to understand why I'd want extra-packages. |
@hvr, you write
But the provenance quantification proposal described how to specify git repo deps as repositories, which is exactly what you're describing. And it described how to do so within cabal files rather than just project files.
All that is required is to allow |
(I briefly talked with @gbaz about the provenance qualification; there's overlap in what you can do via @nomeata that's true; the documentation of |
This discussion prompted me to not use |
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number)
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versiont) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
What needs to be done to move this ticket/the discussion further? This is still a problem today. |
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraings were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. cardano-foundation#1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long.
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
2027: Allow to build with cabal r=rvl a=hasufell The process to create these files is roughly: 1. run `stack2cabal` 2. work around cabal bugs (see haskell/cabal#5444) 3. disable tests to avoid build failures with --enable-tests from unrelated packages (cabal considers all packages defined via source-repository-package as *local* and will try to build its tests) 4. fix package constraints in cabal.project.freeze, where stackage constraints were overwritten in stack.yaml files (usually raising a version number) Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions) 3. #1303 is an excellent workaround for nix users, but requires nix. This should be the go-to fallback in case cabal project files get out of sync for too long. Co-authored-by: Julian Ospald <[email protected]> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Rodney Lorrimar <[email protected]>
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
1775: Fix build for cabal users that don't have systemd r=intricate a=hasufell This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all ---- related: - #1666 - #1200 This has also been discussed on slack. Instructions for this edge case should probably be added to the wiki? Co-authored-by: Julian Ospald <[email protected]>
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
Another problem that this causes: all The problem is greatly amplified in that it's enough for a single package deep down in the transitive chain to completely mess up caching. For example, we're using a custom commit of the EDIT: As follow-up for anyone looking in future: it appears that you can leave |
I think I was mistaken actually: https://stackoverflow.com/questions/54351314/how-to-cache-a-haskell-dependency-to-speed-up-compilation-time |
Have you tried E.g. in https://github.com/phadej/trustee which has two
in |
@phadej 3.4 is indeed an improvement, but afais the solver still considers all source-repository-packages, even if it isn't actually part of the depgraph (e.g. because it's behind a disabled flag or because it isn't an actual dependency of anything). As in: in some projects I have to remove a source-repository-package from cabal.project to make the project build (examples are cardano-wallet/cardano-node with systemd disabled). |
I tried it and it seems all the inplace packages and their dependencies now have proper unit IDs and can be picked up via |
I think allowing conditionals in project files (that can case on compilers, etc just like in packages) would resolve this as per #7783 ? |
I think that's just a workaround. Local packages that are not needed for the build and are not requested as targets by the user shouldn't be part of the resolution. |
That would ruin install plan caching e.g. in project where there are different packages:
would need to run solver in between, which will make |
I'm not sure I follow. I'd expect Cabal to cache plans for all the targets separately then, unless there's a build plan that works for all of them. I also think your described behavior is too implicit and not a good default. I'd actually expect two resolutions, unless I did run something like |
That would be another caching strategy, |
I'd welcome a feature where However, it would be weird to say
and EDIT: currently e.g. That is a somewhat radical change (i.e. only truly local unpacked packages were "project" / "local" packages), which needs some dedicated person to push through. I won't be one. |
Can anyone point me to the documentation (if it exists, I couldn't find it) or implementation for "override package-repositories"? |
I don't know, but somewhat related is #7783. |
* Update nixpkgs pins * Remove sphinx override * Boot with ghc 8.10.7 * Patch code in case we decide to run sphinx doc generation * Remove reference to old pkg * Bump pinned haskellNix in nix-tools subdir * Remove sphinx dependency and don't build docs for old GHCs * Add materialized files * Remove broken assert * Fix disabling docs * ifdLevel 1 * Try building ghc 9.2.8 with 9.2.8 * ifdLevel 0 * Try ghc902 to boot native ghc928 * Try haskell.nix ghc902 to boot native ghc928 * ifdLevel 1 * Stick with haskell.nix ghc 8.10.7 for building 9.2.8 * Bump ghc99 * Fix hash for linux * Use ghc 9.6.4 to build git ghc commits * Disable ghc-iserv-prof for ghc HEAD for now * Fix logic * ifdLevel 2 * Bump pins * Fix for libsodium 1.0.19 * Fix hash * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Bump iserv-proxy * Let's try using it directly. * Add os-string package for ghc head * Fix winePackage.minimal * Update hackage-head * Disable plugin test for ghc head * Fix for emscripten in nixpkgs-unstable * Fix for ghc 9.8.1 * Keep haddock but not sphinx docs * ifdLevel 0 * ifdLevel 1 * Fix for musl * ifdLevel 2 * ifdLevel 0 * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Update hackage head * Fix for ghc head * Better fix for `os-string` * Workaround for haskell/cabal#5444 * Conditional source-repository-package support * Add missing \n * Avoid libsodium on ghcjs and update hackage head * Updte head.hackage sha256 * Updte head.hackage sha256 * Fix code coverage for ghc HEAD * Fix code coverage for ghc HEAD * Fix code coverage for ghc HEAD * Updte head.hackage sha256 * Fixes for latest ghc 9.9 * ifdLevel 0 * Bump ghc99 pin * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Fix paths * ifdLevel 1 * Fix paths * ifdLevel 2 * ifdLevel 3 * Fix for ghc 8.10 * Exclude plugin test * ifdLevel 0 * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Remove patch replaced by ghc source patch * Always build mingwW64 * Drop bad hack * Try to fix windows ASLR. Since binutils 2.36, it defaults to building ASLR for windows. This somehow seems to break with libffi and ghc. Not quite clear why exactly, however reverting back to non ASLR does fix it for us for now. * Update pkgconf-nixpkgs-map.nix Handle `throw`. * Fixup throw catch * Add back in libsodium. * [win] fix Error: CFI instruction used without previous .cfi_startproc * Fixup windows relocs * Fix spelling mistake * Update lock files * Add BUGLOG * Bump LLVM. There is no 9 left in nixpkgs. * ifdLevel 1 * Make libcxxabi mapping work across multiple nixpkgs * fix if * fix parens * ifdLevel 2 * ifdLevel 3 * head.hackage still needed for text-short See haskell-hvr/text-short#45 * disable c++ as one breaking issue * ifdLevel 1 * ifdLevel 2 * Use nixpkgs ghc964 to build hadrian when possible * Update hadrian materialization * ifdLevel 3 * Update pins * ifdLevel 2 * ifdLevel 0 * ifdLevel 1 * ifdLevel 2 * ifdLevel 1 * Fix for new git * ifdLevel 2 * ifdLevel 3 * Use the old nixpkgs-unstable for now * ifdLevel 1 * ifdLevel 2 * Remove updated libsodium * Use the old nixpkgs pins for now * ifdLevel 3 * Put nixpkgs updates back in * ifdLevel 0 * Bump nixpkgs pins * ifdLevel 1 * ifdLevel 2 * Fix for TH test * ifdLevel 3 * Use .dll.a file in th-dlls-minimal * Add fix for DLL loading using a `.dll.a` file * Fix typo * Apply fix to more ghc versions * Patch remaining GHC versions * Update BUGLOG * Revert "Patch remaining GHC versions" This reverts commit d7b153f. * Update hackage repo hashes in cabal.project.local * ifdLevel 1 * Bump nixpkgs pins and add 24.05 * Pin libsodium to nixpkgs 23.11 version for ci * ifdLevel 2 * Fix libsodium pin * Pin libsodium for GHA as well * Update test/default.nix Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * ifdLevel 1 * Only pin libsodium for haskell code in tests * Update nixpkgs-unstable pin * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Fix musl libsodium tests * Add 9.6 linker to 8.10 windows * ifdLevel 0 * Disable darwin for now * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Disable darwin for now * Revert "Add 9.6 linker to 8.10 windows" This reverts commit 3ec62f3. * Use stable-haskell/iserv-proxy?ref=iserv-syms for ghc <9.4 * Enable macOS and ifdLevel 0 * ifdLevel 1 * ifdLevel 2 * Disable failing test * ifdLevel 3 * Add macOS back * We only need iserv-proxy for cross compilation (so leave it out of native ci) * Add materialized spdx file --------- Co-authored-by: Moritz Angermann <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I was hoping that I can use
source-repository-package
to point to “optional” dependencies, i.e. dependencies that are used when needed, but not built when not. I want to use this in mycabal.project
:because
ghcjs-base
is not on Hackage yet. The problem is that this package is only a dependency ofjsaddle
when usingghcjs
, but not when usingghc
. Furthemore,ghcjs-base
has dependencies that cannot be fulfilled withghc
.So with this in
cabal.project
,cabal
thinks it has to buildghcjs-base
, even with usingghc
, and fails.The text was updated successfully, but these errors were encountered: