[pkg-haskell-tools] 02/03: make-all: Depend on depends via the name of their binary package.

Joachim Breitner nomeata at moszumanska.debian.org
Fri Aug 14 11:53:22 UTC 2015


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

nomeata pushed a commit to branch master
in repository pkg-haskell-tools.

commit a40534c571e6c07f889665045bca7212929daf02
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Aug 14 12:12:07 2015 +0200

    make-all: Depend on depends via the name of their binary package.
---
 src/make-all.hs | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/make-all.hs b/src/make-all.hs
index cf6a081..78012c3 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -222,7 +222,7 @@ defaultExcludedPackages = words "ghc ghc-testsuite haskell-devscripts haskell98-
 newtype GetExcludedSources = GetExcludedSources () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
 
 newtype GetDebBuiltBy = GetDebBuiltBy String  deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
-newtype GetBinBuiltBy = GetBinBuiltBy String  deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
+newtype GetBinToDeb = GetBinToDeb String  deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
 
 manpage :: String
 manpage = unlines [ "TODO" ]
@@ -277,6 +277,7 @@ shakeMain conf@(Conf {..}) = do
             return [(pkg,s) | pkg <- pkgs]
         writeFileChanged out $ unlines [ unwords [pkg,s] | (pkg,s) <- builtBy ]
 
+    -- This maps binary package _file_ names built by us to source package names
     debBuiltByMap <- newCache $ \() -> do
         builtBy <- readFileLines $ targetDir </> "cache/built-by.txt"
         return $ M.fromList [ (deb, source)
@@ -290,19 +291,18 @@ shakeMain conf@(Conf {..}) = do
     let debBuiltBy :: String -> Action (Maybe String)
         debBuiltBy = getDebBuiltBy . GetDebBuiltBy
 
-    binBuiltByMap <- newCache $ \() -> do
+    -- This maps binary _package_ names built by us to binary packages _filenames_
+    binToDebMap <- newCache $ \() -> do
         builtBy <- readFileLines $ targetDir </> "cache/built-by.txt"
-        return $ M.fromList [ (pkgname, source)
-            | [deb,source] <- words <$> builtBy
+        return $ M.fromList [ (pkgname, deb)
+            | [deb,_source] <- words <$> builtBy
             , let [pkgname,_version,_] = splitOn "_" deb
             ]
 
-    getBinBuiltBy <- addOracle $ \(GetBinBuiltBy bin) -> do
-        map <- binBuiltByMap ()
-        return $ M.lookup bin map
+    getBinToDeb <- addOracle $ \(GetBinToDeb bin) -> M.lookup bin <$> binToDebMap ()
 
-    let binBuiltBy :: String -> Action (Maybe String)
-        binBuiltBy = getBinBuiltBy . GetBinBuiltBy
+    let binToDeb :: String -> Action (Maybe String)
+        binToDeb = getBinToDeb . GetBinToDeb
 
     targetDir </> "cache/all-changes-files.txt" %> \out -> do
         putNormal "# enumerating all changes files..."
@@ -358,17 +358,16 @@ shakeMain conf@(Conf {..}) = do
         -- This ensures all dependencies are up-to-date
         deps <- liftIO $ dependsOfDsc $ targetDir </> dsc
         putLoud $ "# " ++ source ++ " depends on:"
-        putLoud $ "# binaries: " ++ intercalate "," deps
-        depSources <- catMaybes <$> mapM binBuiltBy deps
-        depChanges <- forM depSources $ \s -> do
-            v <- versionOfSource s
-            return $ targetDir </> changesFileName s v
-        putLoud $ "# sources thereof: " ++ intercalate "," depSources
+        putLoud $ "# packages: " ++ intercalate "," deps
+        depFileNames <- catMaybes <$> mapM binToDeb deps
+        putLoud $ "# dependencies: " ++ intercalate "," depFileNames
+
+        ourBins <- readFileLines $ targetDir </> "cache" </> "binaries" </> source <.> "txt"
 
         -- 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 $ filter (/= targetDir </> changesFileName source version) depChanges
+        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