Skip to content

Fix #8719. Local tarballs are not local packages. #8723

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2135,17 +2135,19 @@ isInLocal :: [PackageVersionConstraint] -> PackageSpecifier (SourcePackage (Pack
isInLocal _ NamedPackage{} = Nothing
isInLocal _extraPackages (SpecificSourcePackage pkg) = case srcpkgSource pkg of
LocalUnpackedPackage _ -> Just (packageId pkg)
-- LocalTarballPackage is matched here too, because otherwise ‘sdistize’
-- produces for ‘localPackages’ in the ‘ProjectBaseContext’ a
-- LocalTarballPackage, and ‘shouldBeLocal’ will make flags like
-- ‘--disable-library-vanilla’ have no effect for a typical
-- Things like
-- ‘cabal install --lib --enable-shared enable-executable-dynamic --disable-library-vanilla’,
-- as these flags would apply to local packages, but the sdist would
-- erroneously not get categorized as a local package, so the flags would be
-- ignored and produce a package with an unchanged hash.
LocalTarballPackage _ -> Just (packageId pkg)
-- TODO: the docs say ‘extra-packages’ is implemented in cabal project
-- files. We can fix that here by checking that the version range matches.
-- won't work as cabal install installs from sdist tarballs,
-- and sdist tarballs are not local packages, so the flags won't apply.
--
-- And that is not incorrect behavior. Correct behavior would be
-- to specify exactly which libraries should be compiled how.
-- (maybe it's possible with `cabal.project`?)
--
-- OTOH, if we match on LocalTarballPackage where, then --enable-tests
-- would force tests there, and that is not what we want to do.
--
--LocalTarballPackage _ -> _
--RemoteTarballPackage _ -> _
--RepoTarballPackage _ -> _
--RemoteSourceRepoPackage _ -> _
Expand Down