hadrian: many builders do not pass `buildOptions` to `cmd`
As evidenced by the code in hadrian/src/Builder.hs
(the code for Tar
is slightly modified compared to master at the moment, comes from a WIP update to !3027 (closed)):
runBuilderWith :: Builder -> BuildInfo -> Action ()
runBuilderWith builder BuildInfo {..} = do
[...]
case builder of
[...]
Ar Unpack _ -> cmd echo [Cwd output] [path] buildArgs
Autoreconf dir -> cmd echo [Cwd dir] ["sh", path] buildArgs
Configure dir -> do
[...]
cmd echo env [Cwd dir] ["sh", path] buildOptions buildArgs
[...]
GhcPkg Copy _ -> do
Stdout pkgDesc <- cmd [path]
[ "--expand-pkgroot"
, "--no-user-package-db"
, "describe"
, input -- the package name
]
cmd (Stdin pkgDesc) [path] (buildArgs ++ ["-"])
GhcPkg Unregister _ -> do
Exit _ <- cmd echo [path] (buildArgs ++ [input])
return ()
[...]
Make dir -> cmd echo path ["-C", dir] buildArgs
Makeinfo -> do
cmd echo [path] "--no-split" [ "-o", output] [input]
Xelatex -> do
unit $ cmd [Cwd output] [path] buildArgs
unit $ cmd [Cwd output] [path] buildArgs
unit $ cmd [Cwd output] [path] buildArgs
unit $ cmd [Cwd output] ["makeindex"] (input -<.> "idx")
unit $ cmd [Cwd output] [path] buildArgs
unit $ cmd [Cwd output] [path] buildArgs
Tar tarMode ->
let modeArg = case tarMode of
Create -> "-c"
Extract -> "-x"
in cmd buildOptions echo [path] (modeArg : buildArgs)
_ -> cmd echo [path] buildArgs
While some builders have a specific way of, say, dealing with Cwd
(e.g Make's -C
argument), most of them don't pass buildOptions
. The main consequence is that when we use something like runBuilderWithOptions
to pass a specific Cwd
to run the command(s) in, it is simply ignored.
This is at best inconsistent, if not simply bogus. We probably want to figure out a consistent, unified story there to avoid any surprise.