diff --git a/cabal-install/Distribution/Client/CmdUpdate.hs b/cabal-install/Distribution/Client/CmdUpdate.hs index c09560a9ce9..08788650658 100644 --- a/cabal-install/Distribution/Client/CmdUpdate.hs +++ b/cabal-install/Distribution/Client/CmdUpdate.hs @@ -184,7 +184,6 @@ updateRepo :: Verbosity -> UpdateFlags -> RepoContext -> (Repo, RepoIndexState) updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do transport <- repoContextGetTransport repoCtxt case repo of - RepoLocal{} -> return () RepoLocalNoIndex{} -> return () RepoRemote{..} -> do downloadResult <- downloadIndex transport verbosity diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs index f5613ba9e74..35166cdd811 100644 --- a/cabal-install/Distribution/Client/Config.hs +++ b/cabal-install/Distribution/Client/Config.hs @@ -250,7 +250,6 @@ instance Semigroup SavedConfig where globalConstraintsFile = combine globalConstraintsFile, globalRemoteRepos = lastNonEmptyNL globalRemoteRepos, globalCacheDir = combine globalCacheDir, - globalLocalRepos = lastNonEmptyNL globalLocalRepos, globalLocalNoIndexRepos = lastNonEmptyNL globalLocalNoIndexRepos, globalLogsDir = combine globalLogsDir, globalWorldFile = combine globalWorldFile, diff --git a/cabal-install/Distribution/Client/FetchUtils.hs b/cabal-install/Distribution/Client/FetchUtils.hs index 921c6dc0baf..05e7ffd5ef9 100644 --- a/cabal-install/Distribution/Client/FetchUtils.hs +++ b/cabal-install/Distribution/Client/FetchUtils.hs @@ -176,7 +176,6 @@ fetchRepoTarball verbosity' repoCtxt repo pkgid = do verbosity = verboseUnmarkOutput verbosity' downloadRepoPackage = case repo of - RepoLocal{} -> return (packageFile repo pkgid) RepoLocalNoIndex{} -> return (packageFile repo pkgid) RepoRemote{..} -> do diff --git a/cabal-install/Distribution/Client/GlobalFlags.hs b/cabal-install/Distribution/Client/GlobalFlags.hs index 7bf5cb54c91..68d20cd720d 100644 --- a/cabal-install/Distribution/Client/GlobalFlags.hs +++ b/cabal-install/Distribution/Client/GlobalFlags.hs @@ -62,7 +62,6 @@ data GlobalFlags = GlobalFlags { globalConstraintsFile :: Flag FilePath, globalRemoteRepos :: NubList RemoteRepo, -- ^ Available Hackage servers. globalCacheDir :: Flag FilePath, - globalLocalRepos :: NubList FilePath, globalLocalNoIndexRepos :: NubList LocalRepo, globalLogsDir :: Flag FilePath, globalWorldFile :: Flag FilePath, @@ -81,7 +80,6 @@ defaultGlobalFlags = GlobalFlags { globalConstraintsFile = mempty, globalRemoteRepos = mempty, globalCacheDir = mempty, - globalLocalRepos = mempty, globalLocalNoIndexRepos = mempty, globalLogsDir = mempty, globalWorldFile = mempty, @@ -140,19 +138,18 @@ withRepoContext verbosity globalFlags = withRepoContext' verbosity (fromNubList (globalRemoteRepos globalFlags)) - (fromNubList (globalLocalRepos globalFlags)) (fromNubList (globalLocalNoIndexRepos globalFlags)) (fromFlag (globalCacheDir globalFlags)) (flagToMaybe (globalHttpTransport globalFlags)) (flagToMaybe (globalIgnoreExpiry globalFlags)) (fromNubList (globalProgPathExtra globalFlags)) -withRepoContext' :: Verbosity -> [RemoteRepo] -> [FilePath] -> [LocalRepo] +withRepoContext' :: Verbosity -> [RemoteRepo] -> [LocalRepo] -> FilePath -> Maybe String -> Maybe Bool -> [FilePath] -> (RepoContext -> IO a) -> IO a -withRepoContext' verbosity remoteRepos localRepos localNoIndexRepos +withRepoContext' verbosity remoteRepos localNoIndexRepos sharedCacheDir httpTransport ignoreExpiry extraPaths = \callback -> do for_ localNoIndexRepos $ \local -> unless (FilePath.Posix.isAbsolute (localRepoPath local)) $ @@ -166,7 +163,6 @@ withRepoContext' verbosity remoteRepos localRepos localNoIndexRepos callback RepoContext { repoContextRepos = allRemoteRepos ++ allLocalNoIndexRepos - ++ map RepoLocal localRepos , repoContextGetTransport = getTransport transportRef , repoContextWithSecureRepo = withSecureRepo secureRepos' , repoContextIgnoreExpiry = fromMaybe False ignoreExpiry diff --git a/cabal-install/Distribution/Client/IndexUtils.hs b/cabal-install/Distribution/Client/IndexUtils.hs index 50b030e2c4c..75cc5969e86 100644 --- a/cabal-install/Distribution/Client/IndexUtils.hs +++ b/cabal-install/Distribution/Client/IndexUtils.hs @@ -140,7 +140,6 @@ indexBaseName repo = repoLocalDir repo fn fn = case repo of RepoSecure {} -> "01-index" RepoRemote {} -> "00-index" - RepoLocal {} -> "00-index" RepoLocalNoIndex {} -> "noindex" ------------------------------------------------------------------------ @@ -230,14 +229,11 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do describeState (IndexStateTime time) = "historical state as of " ++ prettyShow time pkgss <- forM (repoContextRepos repoCtxt) $ \r -> do - let mrname :: Maybe RepoName - mrname = case r of - RepoRemote remote _ -> Just $ remoteRepoName remote - RepoSecure remote _ -> Just $ remoteRepoName remote - RepoLocalNoIndex local _ -> Just $ localRepoName local - RepoLocal _ -> Nothing - - let rname = fromMaybe (RepoName "__local-repository") mrname + let rname :: RepoName + rname = case r of + RepoRemote remote _ -> remoteRepoName remote + RepoSecure remote _ -> remoteRepoName remote + RepoLocalNoIndex local _ -> localRepoName local info verbosity ("Reading available packages of " ++ unRepoName rname ++ "...") @@ -260,7 +256,6 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do unless (idxState == IndexStateHead) $ case r of - RepoLocal path -> warn verbosity ("index-state ignored for old-format repositories (local repository '" ++ path ++ "')") RepoLocalNoIndex {} -> warn verbosity "index-state ignored for file+noindex repositories" RepoRemote {} -> warn verbosity ("index-state ignored for old-format (remote repository '" ++ unRepoName rname ++ "')") RepoSecure {} -> pure () @@ -293,7 +288,7 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do prettyShow (isiHeadTime isi) ++ ")") pure RepoData - { rdIndexStates = maybe [] (\n -> [(n, isiMaxTime isi)]) mrname + { rdIndexStates = [(rname, isiMaxTime isi)] , rdIndex = pis , rdPreferences = deps } @@ -364,9 +359,6 @@ readRepoIndex verbosity repoCtxt repo idxState = case repo of RepoRemote{..} -> warn verbosity $ errMissingPackageList repoRemote RepoSecure{..} -> warn verbosity $ errMissingPackageList repoRemote - RepoLocal{..} -> warn verbosity $ - "The package list for the local repo '" ++ repoLocalDir - ++ "' is missing. The repo is invalid." RepoLocalNoIndex local _ -> warn verbosity $ "Error during construction of local+noindex " ++ unRepoName (localRepoName local) ++ " repository index: " @@ -379,7 +371,6 @@ readRepoIndex verbosity repoCtxt repo idxState = when (dt >= isOldThreshold) $ case repo of RepoRemote{..} -> warn verbosity $ errOutdatedPackageList repoRemote dt RepoSecure{..} -> warn verbosity $ errOutdatedPackageList repoRemote dt - RepoLocal{} -> return () RepoLocalNoIndex {} -> return () errMissingPackageList repoRemote = @@ -609,7 +600,6 @@ is01Index :: Index -> Bool is01Index (RepoIndex _ repo) = case repo of RepoSecure {} -> True RepoRemote {} -> False - RepoLocal {} -> False RepoLocalNoIndex {} -> True is01Index (SandboxIndex _) = False diff --git a/cabal-install/Distribution/Client/ProjectConfig.hs b/cabal-install/Distribution/Client/ProjectConfig.hs index c3c8f63c321..5a9cc29bfab 100644 --- a/cabal-install/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/Distribution/Client/ProjectConfig.hs @@ -186,7 +186,6 @@ projectConfigWithBuilderRepoContext verbosity BuildTimeSettings{..} = withRepoContext' verbosity buildSettingRemoteRepos - buildSettingLocalRepos buildSettingLocalNoIndexRepos buildSettingCacheDir buildSettingHttpTransport @@ -209,7 +208,6 @@ projectConfigWithSolverRepoContext verbosity withRepoContext' verbosity (fromNubList projectConfigRemoteRepos) - (fromNubList projectConfigLocalRepos) (fromNubList projectConfigLocalNoIndexRepos) (fromFlagOrDefault (error @@ -234,7 +232,6 @@ resolveSolverSettings ProjectConfig{ --TODO: [required eventually] some of these settings need validation, e.g. -- the flag assignments need checking. solverSettingRemoteRepos = fromNubList projectConfigRemoteRepos - solverSettingLocalRepos = fromNubList projectConfigLocalRepos solverSettingLocalNoIndexRepos = fromNubList projectConfigLocalNoIndexRepos solverSettingConstraints = projectConfigConstraints solverSettingPreferences = projectConfigPreferences @@ -300,7 +297,6 @@ resolveBuildTimeSettings verbosity ProjectConfig { projectConfigShared = ProjectConfigShared { projectConfigRemoteRepos, - projectConfigLocalRepos, projectConfigLocalNoIndexRepos, projectConfigProgPathExtra }, @@ -321,7 +317,6 @@ resolveBuildTimeSettings verbosity buildSettingOfflineMode = fromFlag projectConfigOfflineMode buildSettingKeepTempFiles = fromFlag projectConfigKeepTempFiles buildSettingRemoteRepos = fromNubList projectConfigRemoteRepos - buildSettingLocalRepos = fromNubList projectConfigLocalRepos buildSettingLocalNoIndexRepos = fromNubList projectConfigLocalNoIndexRepos buildSettingCacheDir = fromFlag projectConfigCacheDir buildSettingHttpTransport = flagToMaybe projectConfigHttpTransport diff --git a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs index 35818df8ea6..1370b3f7c5b 100644 --- a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs @@ -334,7 +334,6 @@ convertLegacyAllPackageFlags globalFlags configFlags GlobalFlags { globalConfigFile = projectConfigConfigFile, globalRemoteRepos = projectConfigRemoteRepos, - globalLocalRepos = projectConfigLocalRepos, globalLocalNoIndexRepos = projectConfigLocalNoIndexRepos, globalProgPathExtra = projectConfigProgPathExtra, globalStoreDir = projectConfigStoreDir @@ -569,7 +568,6 @@ convertToLegacySharedConfig globalConstraintsFile = mempty, globalRemoteRepos = projectConfigRemoteRepos, globalCacheDir = projectConfigCacheDir, - globalLocalRepos = projectConfigLocalRepos, globalLocalNoIndexRepos = projectConfigLocalNoIndexRepos, globalLogsDir = projectConfigLogsDir, globalWorldFile = mempty, @@ -933,11 +931,7 @@ legacySharedConfigFieldDescrs = legacyGlobalFlags (\flags conf -> conf { legacyGlobalFlags = flags }) . addFields - [ newLineListField "local-repo" - showTokenQ parseTokenQ - (fromNubList . globalLocalRepos) - (\v conf -> conf { globalLocalRepos = toNubList v }), - newLineListField "extra-prog-path-shared-only" + [ newLineListField "extra-prog-path-shared-only" showTokenQ parseTokenQ (fromNubList . globalProgPathExtra) (\v conf -> conf { globalProgPathExtra = toNubList v }) diff --git a/cabal-install/Distribution/Client/ProjectConfig/Types.hs b/cabal-install/Distribution/Client/ProjectConfig/Types.hs index 401ec181dd6..d9372162a62 100644 --- a/cabal-install/Distribution/Client/ProjectConfig/Types.hs +++ b/cabal-install/Distribution/Client/ProjectConfig/Types.hs @@ -179,7 +179,6 @@ data ProjectConfigShared -- configuration used both by the solver and other phases projectConfigRemoteRepos :: NubList RemoteRepo, -- ^ Available Hackage servers. - projectConfigLocalRepos :: NubList FilePath, projectConfigLocalNoIndexRepos :: NubList LocalRepo, projectConfigIndexState :: Flag TotalIndexState, projectConfigStoreDir :: Flag FilePath, @@ -389,7 +388,6 @@ instance Semigroup PackageConfig where data SolverSettings = SolverSettings { solverSettingRemoteRepos :: [RemoteRepo], -- ^ Available Hackage servers. - solverSettingLocalRepos :: [FilePath], solverSettingLocalNoIndexRepos :: [LocalRepo], solverSettingConstraints :: [(UserConstraint, ConstraintSource)], solverSettingPreferences :: [PackageVersionConstraint], @@ -450,7 +448,6 @@ data BuildTimeSettings buildSettingOfflineMode :: Bool, buildSettingKeepTempFiles :: Bool, buildSettingRemoteRepos :: [RemoteRepo], - buildSettingLocalRepos :: [FilePath], buildSettingLocalNoIndexRepos :: [LocalRepo], buildSettingCacheDir :: FilePath, buildSettingHttpTransport :: Maybe String, diff --git a/cabal-install/Distribution/Client/ProjectPlanOutput.hs b/cabal-install/Distribution/Client/ProjectPlanOutput.hs index c623a4d6104..058a1e9ae1e 100644 --- a/cabal-install/Distribution/Client/ProjectPlanOutput.hs +++ b/cabal-install/Distribution/Client/ProjectPlanOutput.hs @@ -201,10 +201,6 @@ encodePlanAsJson distDirLayout elaboratedInstallPlan elaboratedSharedConfig = repoToJ :: Repo -> J.Value repoToJ repo = case repo of - RepoLocal{..} -> - J.object [ "type" J..= J.String "local-repo" - , "path" J..= J.String repoLocalDir - ] RepoLocalNoIndex{..} -> J.object [ "type" J..= J.String "local-repo-no-index" , "path" J..= J.String repoLocalDir diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index 46129a42a9d..c763a2316b8 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -408,11 +408,6 @@ globalCommand commands = CommandUI { globalCacheDir (\v flags -> flags { globalCacheDir = v }) (reqArgFlag "DIR") - ,option [] ["local-repo"] - "The location of a local repository" - globalLocalRepos (\v flags -> flags { globalLocalRepos = v }) - (reqArg' "DIR" (\x -> toNubList [x]) fromNubList) - ,option [] ["logs-dir", "logsdir"] "The location to put log files" globalLogsDir (\v flags -> flags { globalLogsDir = v }) diff --git a/cabal-install/Distribution/Client/Types/Repo.hs b/cabal-install/Distribution/Client/Types/Repo.hs index 7b1065150c3..71f1e253415 100644 --- a/cabal-install/Distribution/Client/Types/Repo.hs +++ b/cabal-install/Distribution/Client/Types/Repo.hs @@ -142,16 +142,11 @@ localRepoCacheKey local = unRepoName (localRepoName local) ++ "-" ++ hashPart wh -- | Different kinds of repositories -- -- NOTE: It is important that this type remains serializable. -data Repo = - -- | Local repositories - RepoLocal { - repoLocalDir :: FilePath - } - +data Repo -- | Local repository, without index. -- -- https://github.com/haskell/cabal/issues/6359 - | RepoLocalNoIndex + = RepoLocalNoIndex { repoLocal :: LocalRepo , repoLocalDir :: FilePath } @@ -181,13 +176,11 @@ instance Structured Repo -- | Check if this is a remote repo isRepoRemote :: Repo -> Bool -isRepoRemote RepoLocal{} = False isRepoRemote RepoLocalNoIndex{} = False isRepoRemote _ = True -- | Extract @RemoteRepo@ from @Repo@ if remote. maybeRepoRemote :: Repo -> Maybe RemoteRepo -maybeRepoRemote (RepoLocal _localDir) = Nothing maybeRepoRemote (RepoLocalNoIndex _ _localDir) = Nothing maybeRepoRemote (RepoRemote r _localDir) = Just r maybeRepoRemote (RepoSecure r _localDir) = Just r diff --git a/cabal-install/Distribution/Client/Update.hs b/cabal-install/Distribution/Client/Update.hs index 59347e3f00c..6cb3eeb846f 100644 --- a/cabal-install/Distribution/Client/Update.hs +++ b/cabal-install/Distribution/Client/Update.hs @@ -74,7 +74,6 @@ updateRepo :: Verbosity -> UpdateFlags -> RepoContext -> Repo -> IO () updateRepo verbosity updateFlags repoCtxt repo = do transport <- repoContextGetTransport repoCtxt case repo of - RepoLocal{} -> return () RepoLocalNoIndex{} -> return () RepoRemote{..} -> do downloadResult <- downloadIndex transport verbosity repoRemote repoLocalDir diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index d5dbf6a3f18..1e9bcbf7390 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -370,11 +370,11 @@ instance Arbitrary ProjectConfigBuildOnly where <$> arbitrary <*> arbitrary <*> arbitrary - <*> (toNubList <$> shortListOf 2 arbitrary) -- 4 + <*> (toNubList <$> shortListOf 2 arbitrary) <*> arbitrary <*> arbitrary <*> arbitrary - <*> (fmap getShortToken <$> arbitrary) -- 8 + <*> (fmap getShortToken <$> arbitrary) <*> arbitrary <*> arbitraryNumJobs <*> arbitrary @@ -449,7 +449,6 @@ instance Arbitrary ProjectConfigShared where <*> arbitraryFlag arbitraryShortToken <*> arbitrary <*> arbitrary - <*> (toNubList <$> listOf arbitraryShortToken) <*> arbitrary <*> arbitrary <*> arbitraryFlag arbitraryShortToken @@ -480,7 +479,6 @@ instance Arbitrary ProjectConfigShared where <*> shrinkerAla (fmap NonEmpty) projectConfigHcPkg <*> shrinker projectConfigHaddockIndex <*> shrinker projectConfigRemoteRepos - <*> shrinker projectConfigLocalRepos <*> shrinker projectConfigLocalNoIndexRepos <*> shrinker projectConfigIndexState <*> shrinker projectConfigStoreDir