Skip to content
Snippets Groups Projects
Commit 3c472b30 authored by P.C. Shyamshankar's avatar P.C. Shyamshankar
Browse files

Fix remaining getDirectoryFiles[IO] call-sites.

This fix addresses the fact that paths returned by `getDirectoryFiles`
and `getDirectoryFilesIO` are always relative to their first argument;
an empty directory defaulting to the "current directory".

To avoid any ambiguity, this change ensures that the first argument in
any call to those functions is either set to `top` -- if the files are
expected to be in the source tree -- or `root` -- if they are expected
to be in the build artifact tree.
parent 814d1b3a
No related branches found
No related tags found
No related merge requests found
Pipeline #2152 failed
......@@ -17,8 +17,8 @@ gmpObjects = do
-- The line below causes a Shake Lint failure on Windows, which forced us to
-- disable Lint by default. See more details here:
-- https://ghc.haskell.org/trac/ghc/ticket/15971.
map unifyPath <$>
liftIO (getDirectoryFilesIO "" [gmpPath -/- gmpObjectsDir -/- "*.o"])
map (unifyPath . (gmpPath -/-)) <$>
liftIO (getDirectoryFilesIO gmpPath [gmpObjectsDir -/- "*.o"])
gmpBase :: FilePath
gmpBase = pkgPath integerGmp -/- "gmp"
......@@ -108,18 +108,19 @@ gmpRules = do
-- Extract in-tree GMP sources and apply patches
root <//> "gmp/Makefile.in" %> \_ -> do
gmpPath <- gmpBuildPath
top <- topDirectory
removeDirectory gmpPath
-- Note: We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is
-- gmp-4.2.4.tar.bz2 repacked without the doc/ directory contents.
-- That's because the doc/ directory contents are under the GFDL,
-- which causes problems for Debian.
tarball <- unifyPath . fromSingleton "Exactly one GMP tarball is expected"
<$> getDirectoryFiles "" [gmpBase -/- "gmp-tarballs/gmp*.tar.bz2"]
<$> getDirectoryFiles top [gmpBase -/- "gmp-tarballs/gmp*.tar.bz2"]
withTempDir $ \dir -> do
let tmp = unifyPath dir
need [tarball]
build $ target gmpContext (Tar Extract) [tarball] [tmp]
need [top -/- tarball]
build $ target gmpContext (Tar Extract) [top -/- tarball] [tmp]
let patch = gmpBase -/- "gmpsrc.patch"
patchName = takeFileName patch
......
......@@ -81,10 +81,11 @@ libffiRules =
root -/- stageString stage -/- "libffi/build/Makefile.in" %> \mkIn -> do
libffiPath <- libffiBuildPath stage
removeDirectory libffiPath
top <- topDirectory
tarball <- unifyPath . fromSingleton "Exactly one LibFFI tarball is expected"
<$> getDirectoryFiles "" ["libffi-tarballs/libffi*.tar.gz"]
<$> getDirectoryFiles top ["libffi-tarballs/libffi*.tar.gz"]
need [tarball]
need [top -/- tarball]
-- Go from 'libffi-3.99999+git20171002+77e130c.tar.gz' to 'libffi-3.99999'
let libname = takeWhile (/= '+') $ takeFileName tarball
......@@ -93,12 +94,11 @@ libffiRules =
-- TODO: Simplify.
actionFinally (do
build $ target (libffiContext stage) (Tar Extract)
[tarball]
[top -/- tarball]
[root -/- stageString stage]
moveDirectory (root -/- stageString stage -/- libname) libffiPath) $
removeFiles (root -/- stageString stage) [libname <//> "*"]
top <- topDirectory
fixFile mkIn (fixLibffiMakefile top)
-- TODO: Get rid of hard-coded @libffi@.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment