@@ -470,8 +470,7 @@ installAction flags@NixStyleFlags{extraFlags, configFlags, installFlags, project
470
470
471
471
-- check for targets already in env
472
472
let getPackageName :: PackageSpecifier UnresolvedSourcePackage -> PackageName
473
- getPackageName (NamedPackage pn _) = pn
474
- getPackageName (SpecificSourcePackage (SourcePackage pkgId _ _ _)) = pkgName pkgId
473
+ getPackageName = pkgSpecifierTarget
475
474
targetNames = S. fromList $ map getPackageName (pkgSpecs ++ uriSpecs)
476
475
envNames = S. fromList $ map getPackageName envSpecs
477
476
forceInstall = fromFlagOrDefault False $ installOverrideReinstall installFlags
@@ -571,7 +570,7 @@ withProject verbosity cliConfig targetStrings installLibs = do
571
570
if null unresolvedTargetStrings
572
571
then return (parsedPkgSpecs, parsedTargets)
573
572
else do
574
- -- Anything that could not be parsed as a packageId (e.g. a pacakge name with not version or
573
+ -- Anything that could not be parsed as a packageId (e.g. a package name without a version or
575
574
-- a target syntax using colons) must be resolved inside the project context.
576
575
(resolvedPkgSpecs, resolvedTargets) <-
577
576
resolveTargetSelectorsInProjectBaseContext verbosity baseCtx unresolvedTargetStrings targetFilter
@@ -580,7 +579,7 @@ withProject verbosity cliConfig targetStrings installLibs = do
580
579
-- Apply the local configuration (e.g. cli flags) to all direct targets of install command, see note
581
580
-- in 'installAction'.
582
581
--
583
- -- NOTE: If a target string had to be resolved inside the project conterxt , then pkgSpecs will include
582
+ -- NOTE: If a target string had to be resolved inside the project context , then pkgSpecs will include
584
583
-- the project packages turned into source distributions (getSpecsAndTargetSelectors does this).
585
584
-- We want to apply the local configuration only to the actual targets.
586
585
let config =
@@ -797,7 +796,16 @@ getSpecsAndTargetSelectors verbosity reducedVerbosity sourcePkgDb targetSelector
797
796
TarGzArchive
798
797
(distSdistFile distDirLayout (packageId pkg))
799
798
pkg
800
- NamedPackage pkgName _ -> error $ " Got NamedPackage " ++ prettyShow pkgName
799
+ NamedPackage _ _ ->
800
+ -- This may happen if 'extra-packages' are listed in the project file.
801
+ -- We don't need to do extra work for NamedPackages since they will be
802
+ -- fetched from Hackage rather than locally 'sdistize'-d. Note how,
803
+ -- below, we already return the local 'sdistize'-d packages together
804
+ -- with the 'hackagePkgs' (which are 'NamedPackage's), and that
805
+ -- 'sdistize' is a no-op for 'NamedPackages', meaning the
806
+ -- 'NamedPackage's in 'localPkgs' will be treated just like
807
+ -- 'hackagePkgs' as they should.
808
+ pure ()
801
809
802
810
if null targetsMap
803
811
then return (hackagePkgs, hackageTargets)
0 commit comments