[pkg-haskell-tools] 02/02: Fix dependency calculation
Joachim Breitner
nomeata at moszumanska.debian.org
Thu Aug 13 17:00:07 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 f3f26ddc03d6781b997f797d46c6249e012c2f6e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Aug 13 18:36:51 2015 +0200
Fix dependency calculation
...should have added types somewhere :-)
---
src/make-all.hs | 43 +++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/make-all.hs b/src/make-all.hs
index 55a1500..6291a53 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -220,7 +220,8 @@ debFileNameToPackage filename =
defaultExcludedPackages = words "ghc ghc-testsuite haskell-devscripts haskell98-report haskell-platform"
newtype GetExcludedSources = GetExcludedSources () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
-newtype GetBuiltBy = GetBuiltBy String 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)
manpage :: String
manpage = unlines [ "TODO" ]
@@ -274,17 +275,32 @@ shakeMain conf@(Conf {..}) = do
return [(pkg,s) | pkg <- pkgs]
writeFileChanged out $ unlines [ unwords [pkg,s] | (pkg,s) <- builtBy ]
- builtByMap <- newCache $ \() -> do
- putNormal "# reading built-by cache..."
+ debBuiltByMap <- newCache $ \() -> do
builtBy <- readFileLines $ targetDir </> "cache/built-by.txt"
- return $ M.fromList [ (p,s) | [p,s] <- words <$> builtBy ]
+ return $ M.fromList [ (deb, source)
+ | [deb,source] <- words <$> builtBy
+ ]
- getBuiltBy <- addOracle $ \(GetBuiltBy bin) -> do
- map <- builtByMap ()
+ getDebBuiltBy <- addOracle $ \(GetDebBuiltBy bin) -> do
+ map <- debBuiltByMap ()
return $ M.lookup bin map
- let builtBy :: String -> Action (Maybe String)
- builtBy = getBuiltBy . GetBuiltBy
+ let debBuiltBy :: String -> Action (Maybe String)
+ debBuiltBy = getDebBuiltBy . GetDebBuiltBy
+
+ binBuiltByMap <- newCache $ \() -> do
+ builtBy <- readFileLines $ targetDir </> "cache/built-by.txt"
+ return $ M.fromList [ (pkgname, source)
+ | [deb,source] <- words <$> builtBy
+ , let [pkgname,_version,_] = splitOn "_" deb
+ ]
+
+ getBinBuiltBy <- addOracle $ \(GetBinBuiltBy bin) -> do
+ map <- binBuiltByMap ()
+ return $ M.lookup bin map
+
+ let binBuiltBy :: String -> Action (Maybe String)
+ binBuiltBy = getBinBuiltBy . GetBinBuiltBy
targetDir </> "cache/all-changes-files.txt" %> \out -> do
putNormal "# enumerating all changes files..."
@@ -309,10 +325,10 @@ shakeMain conf@(Conf {..}) = do
-- Binary packages depend on the corresponding changes file log
targetDir </> "*.deb" %> \out -> do
let filename = takeFileName out
- let [pkgname,version,_] = splitOn "_" filename
- sourceMB <- builtBy pkgname
+ let [_pkgname,version,_] = splitOn "_" filename
+ sourceMB <- debBuiltBy filename
case sourceMB of
- Nothing -> fail $ "Binary " ++ show pkgname ++ " not built by us."
+ Nothing -> fail $ "File " ++ filename ++ " not built by us."
Just source -> need [targetDir </> changesFileName source version]
-- Changes files depend on the corresponding log file
@@ -335,10 +351,13 @@ shakeMain conf@(Conf {..}) = do
-- This ensures all dependencies are up-to-date
deps <- liftIO $ dependsOfDsc $ targetDir </> dsc
- depSources <- catMaybes <$> mapM builtBy deps
+ 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
-- 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
--
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