[pkg-haskell-tools] 01/01: Fixed bug that caused builds to fail under certain conditions outlined below. Let's consider three haskell source packages: <A>, <B> and <C>. <A> build-depends on a library package built by <B>, called <B.a>. <B.a> (runtime-)depends on an executable package built by C, called <C.b>. Neither A nor B build-depend on packages built by C. When <A> is built, it is possible that <C> is not built yet, thus <B.a> fails to install, failing the build of <A>.

Sven Bartscher svenb-guest at moszumanska.debian.org
Thu Aug 20 20:59:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

svenb-guest pushed a commit to branch runtime-depends
in repository pkg-haskell-tools.

commit f2bcce12244b66e93410574545cdbad3ebe810af
Author: Sven Bartscher <sven.bartscher at weltraumschlangen.de>
Date:   Thu Aug 20 22:47:13 2015 +0200

    Fixed bug that caused builds to fail under certain conditions outlined
    below.
    Let's consider three haskell source packages: <A>, <B> and <C>.
    <A> build-depends on a library package built by <B>, called <B.a>.
    <B.a> (runtime-)depends on an executable package built by C, called <C.b>.
    Neither A nor B build-depend on packages built by C.
    When <A> is built, it is possible that <C> is not built yet, thus
    <B.a> fails to install, failing the build of <A>.
---
 src/make-all.hs | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/make-all.hs b/src/make-all.hs
index 50809cb..960da5c 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -3,6 +3,7 @@ import qualified Data.Map as M
 import qualified Data.Set as S
 import Control.Applicative hiding (many)
 import qualified Data.Text as T
+import Data.Char (isSpace)
 import Data.List
 import Data.List.Split
 import Data.Maybe
@@ -262,6 +263,28 @@ newtype GetBinToDeb = GetBinToDeb String  deriving (Show,Typeable,Eq,Hashable,Bi
 
 newtype GetArch = GetArch () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
 
+-- Find dependencies on binary packages we build ourselves.
+-- This is needed, because those binary packages don't need to be
+-- build-dependencies of the package that needs them at runtime
+-- and might not be built yet.
+-- Finding library packages isn't necessary, because they were already
+-- built as a build-dependency.
+extendBuildDepends :: FilePath -> (String -> Action (Maybe String)) -> [String] -> Action [String]
+extendBuildDepends targetDir binToDeb buildDeps = (buildDeps ++) <$> concat <$> mapM ourDepends buildDeps
+    where ourDepends dep = do
+            let debFile = targetDir </> dep
+            need [debFile]
+            Stdout depList <- cmd [ "dpkg-deb"
+                                  , "--field"
+                                  , debFile
+                                  , "Depends"
+                                  ]
+            let depPkgs = map cleanDep $ splitOn "," depList
+            depends <- catMaybes <$> mapM binToDeb depPkgs
+            recursive <- extendBuildDepends targetDir binToDeb depends
+            return $ depends ++ recursive
+          cleanDep = takeWhile (not . isSpace) . dropWhile isSpace
+
 manpage :: String
 manpage = unlines [ "TODO" ]
 
@@ -428,7 +451,6 @@ shakeMain conf@(Conf {..}) = do
             putNormal $ "Building " ++ source ++ " failed, remove " ++ logfile ++ " to retry."
             fail ""
 
-
     -- Build log depends on the corresponding source, and the dependencies
     targetDir </> "*.build" %> \out -> do
         let filename = takeFileName out
@@ -451,10 +473,13 @@ shakeMain conf@(Conf {..}) = do
 
         ourBins <- readFileLines $ targetDir </> "cache" </> "binaries" </> source <.> "txt"
 
+        depFileNames' <- extendBuildDepends targetDir binToDeb depFileNames
+        putLoud $ "# recursive dependencies: " ++ intercalate "," depFileNames'
+
         -- For the sake of packages like alex, uuagc etc, we exclude ourselves
         -- from this, thus allowing the use of the binary from the archive to
         -- bootstrap.
-        need $ map (targetDir </>) $ filter (`notElem` ourBins) depFileNames
+        need $ map (targetDir </>) $ filter (`notElem` ourBins) depFileNames'
 
         -- What files do we have built locally?
         -- Make sure the build uses only them

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git



More information about the Pkg-haskell-commits mailing list