Skip to content

Commit 10e4710

Browse files
committed
Resolve #6729: WIP
1 parent b89a1c6 commit 10e4710

File tree

12 files changed

+11
-59
lines changed

12 files changed

+11
-59
lines changed

cabal-install/Distribution/Client/CmdUpdate.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ updateRepo :: Verbosity -> UpdateFlags -> RepoContext -> (Repo, RepoIndexState)
184184
updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do
185185
transport <- repoContextGetTransport repoCtxt
186186
case repo of
187-
RepoLocal{} -> return ()
188187
RepoLocalNoIndex{} -> return ()
189188
RepoRemote{..} -> do
190189
downloadResult <- downloadIndex transport verbosity

cabal-install/Distribution/Client/Config.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ instance Semigroup SavedConfig where
251251
globalConstraintsFile = combine globalConstraintsFile,
252252
globalRemoteRepos = lastNonEmptyNL globalRemoteRepos,
253253
globalCacheDir = combine globalCacheDir,
254-
globalLocalRepos = lastNonEmptyNL globalLocalRepos,
255254
globalLocalNoIndexRepos = lastNonEmptyNL globalLocalNoIndexRepos,
256255
globalLogsDir = combine globalLogsDir,
257256
globalWorldFile = combine globalWorldFile,

cabal-install/Distribution/Client/FetchUtils.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ fetchRepoTarball verbosity' repoCtxt repo pkgid = do
176176
verbosity = verboseUnmarkOutput verbosity'
177177

178178
downloadRepoPackage = case repo of
179-
RepoLocal{} -> return (packageFile repo pkgid)
180179
RepoLocalNoIndex{} -> return (packageFile repo pkgid)
181180

182181
RepoRemote{..} -> do

cabal-install/Distribution/Client/GlobalFlags.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ data GlobalFlags = GlobalFlags {
6363
globalConstraintsFile :: Flag FilePath,
6464
globalRemoteRepos :: NubList RemoteRepo, -- ^ Available Hackage servers.
6565
globalCacheDir :: Flag FilePath,
66-
globalLocalRepos :: NubList FilePath,
6766
globalLocalNoIndexRepos :: NubList LocalRepo,
6867
globalLogsDir :: Flag FilePath,
6968
globalWorldFile :: Flag FilePath,
@@ -85,7 +84,6 @@ defaultGlobalFlags = GlobalFlags {
8584
globalConstraintsFile = mempty,
8685
globalRemoteRepos = mempty,
8786
globalCacheDir = mempty,
88-
globalLocalRepos = mempty,
8987
globalLocalNoIndexRepos = mempty,
9088
globalLogsDir = mempty,
9189
globalWorldFile = mempty,
@@ -146,19 +144,18 @@ withRepoContext verbosity globalFlags =
146144
withRepoContext'
147145
verbosity
148146
(fromNubList (globalRemoteRepos globalFlags))
149-
(fromNubList (globalLocalRepos globalFlags))
150147
(fromNubList (globalLocalNoIndexRepos globalFlags))
151148
(fromFlag (globalCacheDir globalFlags))
152149
(flagToMaybe (globalHttpTransport globalFlags))
153150
(flagToMaybe (globalIgnoreExpiry globalFlags))
154151
(fromNubList (globalProgPathExtra globalFlags))
155152

156-
withRepoContext' :: Verbosity -> [RemoteRepo] -> [FilePath] -> [LocalRepo]
153+
withRepoContext' :: Verbosity -> [RemoteRepo] -> [LocalRepo]
157154
-> FilePath -> Maybe String -> Maybe Bool
158155
-> [FilePath]
159156
-> (RepoContext -> IO a)
160157
-> IO a
161-
withRepoContext' verbosity remoteRepos localRepos localNoIndexRepos
158+
withRepoContext' verbosity remoteRepos localNoIndexRepos
162159
sharedCacheDir httpTransport ignoreExpiry extraPaths = \callback -> do
163160
for_ localNoIndexRepos $ \local ->
164161
unless (FilePath.Posix.isAbsolute (localRepoPath local)) $
@@ -172,7 +169,6 @@ withRepoContext' verbosity remoteRepos localRepos localNoIndexRepos
172169
callback RepoContext {
173170
repoContextRepos = allRemoteRepos
174171
++ allLocalNoIndexRepos
175-
++ map RepoLocal localRepos
176172
, repoContextGetTransport = getTransport transportRef
177173
, repoContextWithSecureRepo = withSecureRepo secureRepos'
178174
, repoContextIgnoreExpiry = fromMaybe False ignoreExpiry

cabal-install/Distribution/Client/IndexUtils.hs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ indexBaseName repo = repoLocalDir repo </> fn
141141
fn = case repo of
142142
RepoSecure {} -> "01-index"
143143
RepoRemote {} -> "00-index"
144-
RepoLocal {} -> "00-index"
145144
RepoLocalNoIndex {} -> "noindex"
146145

147146
------------------------------------------------------------------------
@@ -231,14 +230,11 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do
231230
describeState (IndexStateTime time) = "historical state as of " ++ prettyShow time
232231

233232
pkgss <- forM (repoContextRepos repoCtxt) $ \r -> do
234-
let mrname :: Maybe RepoName
235-
mrname = case r of
236-
RepoRemote remote _ -> Just $ remoteRepoName remote
237-
RepoSecure remote _ -> Just $ remoteRepoName remote
238-
RepoLocalNoIndex local _ -> Just $ localRepoName local
239-
RepoLocal _ -> Nothing
240-
241-
let rname = fromMaybe (RepoName "__local-repository") mrname
233+
let rname :: RepoName
234+
rname = case r of
235+
RepoRemote remote _ -> remoteRepoName remote
236+
RepoSecure remote _ -> remoteRepoName remote
237+
RepoLocalNoIndex local _ -> localRepoName local
242238

243239
info verbosity ("Reading available packages of " ++ unRepoName rname ++ "...")
244240

@@ -261,7 +257,6 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do
261257

262258
unless (idxState == IndexStateHead) $
263259
case r of
264-
RepoLocal path -> warn verbosity ("index-state ignored for old-format repositories (local repository '" ++ path ++ "')")
265260
RepoLocalNoIndex {} -> warn verbosity "index-state ignored for file+noindex repositories"
266261
RepoRemote {} -> warn verbosity ("index-state ignored for old-format (remote repository '" ++ unRepoName rname ++ "')")
267262
RepoSecure {} -> pure ()
@@ -294,7 +289,7 @@ getSourcePackagesAtIndexState verbosity repoCtxt mb_idxState = do
294289
prettyShow (isiHeadTime isi) ++ ")")
295290

296291
pure RepoData
297-
{ rdIndexStates = maybe [] (\n -> [(n, isiMaxTime isi)]) mrname
292+
{ rdIndexStates = [(rname, isiMaxTime isi)]
298293
, rdIndex = pis
299294
, rdPreferences = deps
300295
}
@@ -372,9 +367,6 @@ readRepoIndex verbosity repoCtxt repo idxState =
372367
case repo of
373368
RepoRemote{..} -> warn verbosity $ errMissingPackageList repoRemote
374369
RepoSecure{..} -> warn verbosity $ errMissingPackageList repoRemote
375-
RepoLocal{..} -> warn verbosity $
376-
"The package list for the local repo '" ++ repoLocalDir
377-
++ "' is missing. The repo is invalid."
378370
RepoLocalNoIndex local _ -> warn verbosity $
379371
"Error during construction of local+noindex "
380372
++ unRepoName (localRepoName local) ++ " repository index: "
@@ -387,7 +379,6 @@ readRepoIndex verbosity repoCtxt repo idxState =
387379
when (dt >= isOldThreshold) $ case repo of
388380
RepoRemote{..} -> warn verbosity $ errOutdatedPackageList repoRemote dt
389381
RepoSecure{..} -> warn verbosity $ errOutdatedPackageList repoRemote dt
390-
RepoLocal{} -> return ()
391382
RepoLocalNoIndex {} -> return ()
392383

393384
errMissingPackageList repoRemote =
@@ -617,7 +608,6 @@ is01Index :: Index -> Bool
617608
is01Index (RepoIndex _ repo) = case repo of
618609
RepoSecure {} -> True
619610
RepoRemote {} -> False
620-
RepoLocal {} -> False
621611
RepoLocalNoIndex {} -> True
622612
is01Index (SandboxIndex _) = False
623613

cabal-install/Distribution/Client/ProjectConfig.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ projectConfigWithBuilderRepoContext verbosity BuildTimeSettings{..} =
186186
withRepoContext'
187187
verbosity
188188
buildSettingRemoteRepos
189-
buildSettingLocalRepos
190189
buildSettingLocalNoIndexRepos
191190
buildSettingCacheDir
192191
buildSettingHttpTransport
@@ -209,7 +208,6 @@ projectConfigWithSolverRepoContext verbosity
209208
withRepoContext'
210209
verbosity
211210
(fromNubList projectConfigRemoteRepos)
212-
(fromNubList projectConfigLocalRepos)
213211
(fromNubList projectConfigLocalNoIndexRepos)
214212
(fromFlagOrDefault
215213
(error
@@ -234,7 +232,6 @@ resolveSolverSettings ProjectConfig{
234232
--TODO: [required eventually] some of these settings need validation, e.g.
235233
-- the flag assignments need checking.
236234
solverSettingRemoteRepos = fromNubList projectConfigRemoteRepos
237-
solverSettingLocalRepos = fromNubList projectConfigLocalRepos
238235
solverSettingLocalNoIndexRepos = fromNubList projectConfigLocalNoIndexRepos
239236
solverSettingConstraints = projectConfigConstraints
240237
solverSettingPreferences = projectConfigPreferences
@@ -300,7 +297,6 @@ resolveBuildTimeSettings verbosity
300297
ProjectConfig {
301298
projectConfigShared = ProjectConfigShared {
302299
projectConfigRemoteRepos,
303-
projectConfigLocalRepos,
304300
projectConfigLocalNoIndexRepos,
305301
projectConfigProgPathExtra
306302
},
@@ -321,7 +317,6 @@ resolveBuildTimeSettings verbosity
321317
buildSettingOfflineMode = fromFlag projectConfigOfflineMode
322318
buildSettingKeepTempFiles = fromFlag projectConfigKeepTempFiles
323319
buildSettingRemoteRepos = fromNubList projectConfigRemoteRepos
324-
buildSettingLocalRepos = fromNubList projectConfigLocalRepos
325320
buildSettingLocalNoIndexRepos = fromNubList projectConfigLocalNoIndexRepos
326321
buildSettingCacheDir = fromFlag projectConfigCacheDir
327322
buildSettingHttpTransport = flagToMaybe projectConfigHttpTransport

cabal-install/Distribution/Client/ProjectConfig/Legacy.hs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ convertLegacyAllPackageFlags globalFlags configFlags
335335
globalConfigFile = projectConfigConfigFile,
336336
globalSandboxConfigFile = _, -- ??
337337
globalRemoteRepos = projectConfigRemoteRepos,
338-
globalLocalRepos = projectConfigLocalRepos,
339338
globalLocalNoIndexRepos = projectConfigLocalNoIndexRepos,
340339
globalProgPathExtra = projectConfigProgPathExtra,
341340
globalStoreDir = projectConfigStoreDir
@@ -571,7 +570,6 @@ convertToLegacySharedConfig
571570
globalConstraintsFile = mempty,
572571
globalRemoteRepos = projectConfigRemoteRepos,
573572
globalCacheDir = projectConfigCacheDir,
574-
globalLocalRepos = projectConfigLocalRepos,
575573
globalLocalNoIndexRepos = projectConfigLocalNoIndexRepos,
576574
globalLogsDir = projectConfigLogsDir,
577575
globalWorldFile = mempty,
@@ -937,11 +935,7 @@ legacySharedConfigFieldDescrs =
937935
legacyGlobalFlags
938936
(\flags conf -> conf { legacyGlobalFlags = flags })
939937
. addFields
940-
[ newLineListField "local-repo"
941-
showTokenQ parseTokenQ
942-
(fromNubList . globalLocalRepos)
943-
(\v conf -> conf { globalLocalRepos = toNubList v }),
944-
newLineListField "extra-prog-path-shared-only"
938+
[ newLineListField "extra-prog-path-shared-only"
945939
showTokenQ parseTokenQ
946940
(fromNubList . globalProgPathExtra)
947941
(\v conf -> conf { globalProgPathExtra = toNubList v })

cabal-install/Distribution/Client/ProjectConfig/Types.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ data ProjectConfigShared
178178

179179
-- configuration used both by the solver and other phases
180180
projectConfigRemoteRepos :: NubList RemoteRepo, -- ^ Available Hackage servers.
181-
projectConfigLocalRepos :: NubList FilePath,
182181
projectConfigLocalNoIndexRepos :: NubList LocalRepo,
183182
projectConfigIndexState :: Flag TotalIndexState,
184183
projectConfigStoreDir :: Flag FilePath,
@@ -388,7 +387,6 @@ instance Semigroup PackageConfig where
388387
data SolverSettings
389388
= SolverSettings {
390389
solverSettingRemoteRepos :: [RemoteRepo], -- ^ Available Hackage servers.
391-
solverSettingLocalRepos :: [FilePath],
392390
solverSettingLocalNoIndexRepos :: [LocalRepo],
393391
solverSettingConstraints :: [(UserConstraint, ConstraintSource)],
394392
solverSettingPreferences :: [PackageVersionConstraint],
@@ -449,7 +447,6 @@ data BuildTimeSettings
449447
buildSettingOfflineMode :: Bool,
450448
buildSettingKeepTempFiles :: Bool,
451449
buildSettingRemoteRepos :: [RemoteRepo],
452-
buildSettingLocalRepos :: [FilePath],
453450
buildSettingLocalNoIndexRepos :: [LocalRepo],
454451
buildSettingCacheDir :: FilePath,
455452
buildSettingHttpTransport :: Maybe String,

cabal-install/Distribution/Client/ProjectPlanOutput.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ encodePlanAsJson distDirLayout elaboratedInstallPlan elaboratedSharedConfig =
201201
repoToJ :: Repo -> J.Value
202202
repoToJ repo =
203203
case repo of
204-
RepoLocal{..} ->
205-
J.object [ "type" J..= J.String "local-repo"
206-
, "path" J..= J.String repoLocalDir
207-
]
208204
RepoLocalNoIndex{..} ->
209205
J.object [ "type" J..= J.String "local-repo-no-index"
210206
, "path" J..= J.String repoLocalDir

cabal-install/Distribution/Client/Setup.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,6 @@ globalCommand commands = CommandUI {
427427
globalCacheDir (\v flags -> flags { globalCacheDir = v })
428428
(reqArgFlag "DIR")
429429

430-
,option [] ["local-repo"]
431-
"The location of a local repository"
432-
globalLocalRepos (\v flags -> flags { globalLocalRepos = v })
433-
(reqArg' "DIR" (\x -> toNubList [x]) fromNubList)
434-
435430
,option [] ["logs-dir", "logsdir"]
436431
"The location to put log files"
437432
globalLogsDir (\v flags -> flags { globalLogsDir = v })

cabal-install/Distribution/Client/Types/Repo.hs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,11 @@ localRepoCacheKey local = unRepoName (localRepoName local) ++ "-" ++ hashPart wh
142142
-- | Different kinds of repositories
143143
--
144144
-- NOTE: It is important that this type remains serializable.
145-
data Repo =
146-
-- | Local repositories
147-
RepoLocal {
148-
repoLocalDir :: FilePath
149-
}
150-
145+
data Repo
151146
-- | Local repository, without index.
152147
--
153148
-- https://github.com/haskell/cabal/issues/6359
154-
| RepoLocalNoIndex
149+
= RepoLocalNoIndex
155150
{ repoLocal :: LocalRepo
156151
, repoLocalDir :: FilePath
157152
}
@@ -181,13 +176,11 @@ instance Structured Repo
181176

182177
-- | Check if this is a remote repo
183178
isRepoRemote :: Repo -> Bool
184-
isRepoRemote RepoLocal{} = False
185179
isRepoRemote RepoLocalNoIndex{} = False
186180
isRepoRemote _ = True
187181

188182
-- | Extract @RemoteRepo@ from @Repo@ if remote.
189183
maybeRepoRemote :: Repo -> Maybe RemoteRepo
190-
maybeRepoRemote (RepoLocal _localDir) = Nothing
191184
maybeRepoRemote (RepoLocalNoIndex _ _localDir) = Nothing
192185
maybeRepoRemote (RepoRemote r _localDir) = Just r
193186
maybeRepoRemote (RepoSecure r _localDir) = Just r

cabal-install/Distribution/Client/Update.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ updateRepo :: Verbosity -> UpdateFlags -> RepoContext -> Repo -> IO ()
7474
updateRepo verbosity updateFlags repoCtxt repo = do
7575
transport <- repoContextGetTransport repoCtxt
7676
case repo of
77-
RepoLocal{} -> return ()
7877
RepoLocalNoIndex{} -> return ()
7978
RepoRemote{..} -> do
8079
downloadResult <- downloadIndex transport verbosity repoRemote repoLocalDir

0 commit comments

Comments
 (0)