more RawFilePath conversion
nukeFile replaced with removeWhenExistsWith removeLink, which allows using RawFilePath. Utility.Directory cannot use RawFilePath since setup does not depend on posix. This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
parent
8d66f7ba0f
commit
e505c03bcc
51 changed files with 182 additions and 153 deletions
|
@ -83,10 +83,10 @@ getbuild repodir (url, f) = do
|
|||
bv1 <- getbv
|
||||
let dest = repodir </> f
|
||||
let tmp = dest ++ ".tmp"
|
||||
nukeFile tmp
|
||||
removeWhenExistsWith removeFile tmp
|
||||
createDirectoryIfMissing True (parentDir dest)
|
||||
let oops s = do
|
||||
nukeFile tmp
|
||||
removeWhenExistsWith removeFile tmp
|
||||
putStrLn $ "*** " ++ s
|
||||
return Nothing
|
||||
uo <- defUrlOptions
|
||||
|
@ -98,7 +98,7 @@ getbuild repodir (url, f) = do
|
|||
Nothing -> oops $ "no build-version file for " ++ url
|
||||
(Just v)
|
||||
| bv2 == bv1 -> do
|
||||
nukeFile dest
|
||||
removeWhenExistsWith removeFile dest
|
||||
renameFile tmp dest
|
||||
-- remove git rev part of version
|
||||
let v' = takeWhile (/= '-') v
|
||||
|
@ -228,7 +228,7 @@ buildrpms topdir l = do
|
|||
<$> liftIO (getDirectoryContents rpmrepo)
|
||||
forM_ tarrpmarches $ \(tararch, rpmarch) ->
|
||||
forM_ (filter (isstandalonetarball tararch . fst) l) $ \(tarball, v) -> do
|
||||
liftIO $ mapM_ nukeFile (filter ((rpmarch ++ ".rpm") `isSuffixOf`) oldrpms)
|
||||
liftIO $ mapM_ (removeWhenExistsWith removeLink) (filter ((rpmarch ++ ".rpm") `isSuffixOf`) oldrpms)
|
||||
void $ liftIO $ boolSystem script
|
||||
[ Param rpmarch
|
||||
, File tarball
|
||||
|
|
|
@ -99,8 +99,8 @@ installLinkerShim top linker exe = do
|
|||
ifM (isSymbolicLink <$> getSymbolicLinkStatus exe)
|
||||
( do
|
||||
sl <- readSymbolicLink exe
|
||||
nukeFile exe
|
||||
nukeFile exedest
|
||||
removeWhenExistsWith removeLink exe
|
||||
removeWhenExistsWith removeLink exedest
|
||||
-- Assume that for a symlink, the destination
|
||||
-- will also be shimmed.
|
||||
let sl' = ".." </> takeFileName sl </> takeFileName sl
|
||||
|
|
|
@ -95,7 +95,7 @@ installGitLibs topdir = do
|
|||
unlessM (doesFileExist linktarget') $ do
|
||||
createDirectoryIfMissing True (takeDirectory linktarget')
|
||||
L.readFile f >>= L.writeFile linktarget'
|
||||
nukeFile destf
|
||||
removeWhenExistsWith removeLink destf
|
||||
rellinktarget <- relPathDirToFile (takeDirectory destf) linktarget'
|
||||
createSymbolicLink rellinktarget destf
|
||||
else cp f destf
|
||||
|
@ -125,7 +125,7 @@ installGitLibs topdir = do
|
|||
|
||||
cp :: FilePath -> FilePath -> IO ()
|
||||
cp src dest = do
|
||||
nukeFile dest
|
||||
removeWhenExistsWith removeLink dest
|
||||
unlessM (boolSystem "cp" [Param "-a", File src, File dest]) $
|
||||
error "cp failed"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue