[Pkg-haskell-commits] [tools] 05/07: Factor out parseFlatRel

Joachim Breitner nomeata at moszumanska.debian.org
Mon Sep 8 07:29:41 UTC 2014


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

nomeata pushed a commit to branch master
in repository tools.

commit 3fd3b8d00dea11ee3b523442cf93f35c7ccae318
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 28 12:00:18 2014 -0700

    Factor out parseFlatRel
---
 binNMUs.hs | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/binNMUs.hs b/binNMUs.hs
index 5234095..d9a079c 100644
--- a/binNMUs.hs
+++ b/binNMUs.hs
@@ -347,22 +347,14 @@ acquirePackagesHTTP conf suite arch = do
 rowToBinary :: Conf -> Row -> Maybe Binary
 rowToBinary conf (pkg,v,a,s,sv,d,p) = if interesting b then Just b else Nothing
       where
-        parseRels :: B.ByteString -> Relations
-        parseRels s = case parseRelations s of
-          Left pe ->  error $ printf "Failed to parse relations %s" (show pe)
-          Right rel -> rel
-
-        flatRels :: Relations -> [String]
-        flatRels = map (\(Rel (BinPkgName n) _ _) -> n) . join
-
         b = Binary
             pkg
             s
             a
             v
             sv
-            (mapMaybe (parseVirtPackage conf) $ flatRels $ parseRels d)
-            (mapMaybe (parseVirtPackage conf) $ flatRels $ parseRels p)
+            (mapMaybe (parseVirtPackage conf) $ parseFlatRel d)
+            (mapMaybe (parseVirtPackage conf) $ parseFlatRel p)
 
 
 interesting :: Binary -> Bool
@@ -503,6 +495,21 @@ conf = mkConf
 haskellRegex :: String
 haskellRegex = "libghc-(.*)-dev-([0-9.]+-[0-9a-f]{5})"
 
+-- Parsing package relations with flattening
+-- (this should be faster than flatRels . parseRels)
+parseFlatRel :: B.ByteString -> [String]
+parseFlatRel = flatRels . parseRels
+  where
+    flatRels :: Relations -> [String]
+    flatRels = map (\(Rel (BinPkgName n) _ _) -> n) . join
+
+    parseRels :: B.ByteString -> Relations
+    parseRels s = case parseRelations s of
+      Left pe ->  error $ printf "Failed to parse relations %s" (show pe)
+      Right rel -> rel
+
+
+
 
 -- Utils
 

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



More information about the Pkg-haskell-commits mailing list