[tools] 01/02: Nub architectures

Joachim Breitner nomeata at moszumanska.debian.org
Mon Jan 11 09:15:00 UTC 2016


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

nomeata pushed a commit to branch master
in repository tools.

commit 5776b76182ef506e39c40384f74729efe0e9479a
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Jan 11 09:48:54 2016 +0100

    Nub architectures
---
 binNMUs.hs | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/binNMUs.hs b/binNMUs.hs
index cb8247c..d37e724 100644
--- a/binNMUs.hs
+++ b/binNMUs.hs
@@ -196,7 +196,7 @@ formatNMU :: String -> ([(SourceName, Version)], [Arch], [Reason]) -> String
 formatNMU dist (ss, as, d) =
     printf "nmu %s . %s . %s . -m '%s'"
         (intercalate " " $ map (uncurry (printf "%s_%s")) ss)
-        (intercalate " " as)
+        (intercalate " " $ nub as)
         dist
         (intercalate ", " $ map formatReason d)
 
@@ -212,10 +212,6 @@ mkUpgradedDep d1 d2 = UpgradedDep base hash1 hash2
     base = intercalate "-" $ vpBase d1 : map fst commonHashes
     (commonHashes, (hash1,hash2):_) = span (uncurry (==)) $ zip (vpHashes d1) (vpHashes d2)
 
-ordGroupBy :: Ord b => (a -> b) -> [a] -> [(b, [a])]
-ordGroupBy f = M.toAscList . M.fromListWith (++) . map (f &&& (:[]))
-
-
 -- | Data aquisition and processing
 getNMUs :: Conf -> [SourceName] -> Arch -> IO [CBinNMU]
 getNMUs conf rms a = do
@@ -403,8 +399,8 @@ interesting b = not (null (bProvides b) && null (bDepends b))
 splitSrc :: String -> (SourceName, Maybe Version)
 splitSrc sf =
     case words sf of
-        [s,('(':sv)] -> (s, Just (init sv))
-        [s]          -> (s, Nothing)
+        [s,'(':sv] -> (s, Just (init sv))
+        [s]        -> (s, Nothing)
         _ -> error $ printf "Failed to parse source field %s" sf
 
 fetchArchive :: Conf -> Arch -> IO [Binary]
@@ -604,11 +600,15 @@ putCLn s = putStrLn ("# " ++ s)
 -- Generic grouping algorithm
 
 groupEqual :: Ord a => [(a,b)] -> [(a, [b])]
-groupEqual xs = M.toList (M.fromListWith (++) (map (second ((:[]))) xs))
+groupEqual = M.toList . M.fromListWith (++) . map (second (:[]))
 
 dontGroup :: [(a,b)] -> [(a, [b])]
 dontGroup xs = [(a,[b]) | (a,b) <- xs]
 
+ordGroupBy :: Ord b => (a -> b) -> [a] -> [(b, [a])]
+ordGroupBy f = groupEqual . map (f &&& id)
+
+
 -- Main program
 
 main :: IO ()

-- 
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