Skip to content
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

Create noindex.cache if missing #10730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions cabal-install/src/Distribution/Client/IndexUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,9 @@
Left msg -> do
warn verbosity $
concat
[ "Parsing the index cache failed ("
[ "Parsing the index cache for repo \""
, unRepoName (repoName repo)
, "\" failed ("
, msg
, "). "
, "Trying to regenerate the index cache..."
Expand All @@ -1184,6 +1186,8 @@

-- we don't hash cons local repository cache, they are hopefully small
Right res -> return res
where
RepoIndex _ctxt repo = index

-- | Read the 'Index' cache from the filesystem. Throws IO exceptions
-- if any arise and returns Left on invalid input.
Expand All @@ -1195,7 +1199,11 @@
Right . read00IndexCache <$> BSS.readFile (cacheFile index)

readNoIndexCache' :: Index -> IO (Either String NoIndexCache)
readNoIndexCache' index = structuredDecodeFileOrFail (cacheFile index)
readNoIndexCache' index = do
exists <- doesFileExist (cacheFile index)
if exists
then structuredDecodeFileOrFail (cacheFile index)
else updatePackageIndexCacheFile verbosity index >> readNoIndexCache' index

Check failure on line 1206 in cabal-install/src/Distribution/Client/IndexUtils.hs

View workflow job for this annotation

GitHub Actions / Doctest Cabal

Variable not in scope: verbosity :: Verbosity

-- | Write the 'Index' cache to the filesystem
writeIndexCache :: Index -> Cache -> IO ()
Expand Down
11 changes: 11 additions & 0 deletions changelog.d/pr-10730
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Create `noindex.cache` file if missing
packages: cabal-install
prs: #10730
issues: #9891
significance:

description: {

- Local+noindex repositories will have their `noindex.cache` file created the first time they are accessed.

}
Loading