Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
c5f51c26
Commit
c5f51c26
authored
Oct 24, 2014
by
Mikhail Glushenkov
Browse files
Force-update the cache in 'add-source'/'remove-source'.
Fixes #2060.
parent
8eee043f
Changes
2
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/IndexUtils.hs
View file @
c5f51c26
...
...
@@ -21,6 +21,7 @@ module Distribution.Client.IndexUtils (
parsePackageIndex
,
readRepoIndex
,
updateRepoIndexCache
,
updatePackageIndexCacheFile
,
BuildTreeRefType
(
..
),
refTypeFromTypeCode
,
typeCodeFromRefType
)
where
...
...
cabal-install/Distribution/Client/Sandbox/Index.hs
View file @
c5f51c26
...
...
@@ -22,6 +22,7 @@ import qualified Distribution.Client.Tar as Tar
import
Distribution.Client.IndexUtils
(
BuildTreeRefType
(
..
)
,
refTypeFromTypeCode
,
typeCodeFromRefType
,
updatePackageIndexCacheFile
,
getSourcePackagesStrict
)
import
Distribution.Client.PackageIndex
(
allPackages
)
import
Distribution.Client.Types
(
Repo
(
..
),
LocalRepo
(
..
)
...
...
@@ -43,7 +44,8 @@ import Data.Maybe ( catMaybes )
import
System.Directory
(
createDirectoryIfMissing
,
doesDirectoryExist
,
doesFileExist
,
renameFile
)
import
System.FilePath
(
(
</>
),
(
<.>
),
takeDirectory
,
takeExtension
)
import
System.FilePath
(
(
</>
),
(
<.>
),
takeDirectory
,
takeExtension
,
replaceExtension
)
import
System.IO
(
IOMode
(
..
),
SeekMode
(
..
)
,
hSeek
,
withBinaryFile
)
...
...
@@ -150,6 +152,8 @@ addBuildTreeRefs verbosity path l' refType = do
hSeek
h
AbsoluteSeek
(
fromIntegral
offset
)
BS
.
hPut
h
(
Tar
.
write
entries
)
debug
verbosity
$
"Successfully appended to '"
++
path
++
"'"
updatePackageIndexCacheFile
verbosity
path
(
path
`
replaceExtension
`
"cache"
)
-- | Remove given local build tree references from the index.
removeBuildTreeRefs
::
Verbosity
->
FilePath
->
[
FilePath
]
->
IO
[
FilePath
]
...
...
@@ -164,10 +168,10 @@ removeBuildTreeRefs verbosity path l' = do
-- much smaller.
BS
.
writeFile
tmpFile
.
Tar
.
writeEntries
.
Tar
.
filterEntries
(
p
l
)
.
Tar
.
read
=<<
BS
.
readFile
path
-- This invalidates the cache, so we don't have to update it explicitly.
renameFile
tmpFile
path
debug
verbosity
$
"Successfully renamed '"
++
tmpFile
++
"' to '"
++
path
++
"'"
updatePackageIndexCacheFile
verbosity
path
(
path
`
replaceExtension
`
"cache"
)
-- FIXME: return only the refs that vere actually removed.
return
l
where
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment