packages feed

neil 0.6 → 0.7

raw patch · 2 files changed

+26/−14 lines, 2 files

Files

neil.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.6 build-type:         Simple name:               neil-version:            0.6+version:            0.7 license:            BSD3 license-file:       LICENSE category:           Development@@ -14,7 +14,7 @@     them in the Git repo. homepage:           http://community.haskell.org/~ndm/ bug-reports:        https://github.com/ndmitchell/neil/issues-tested-with:        GHC==7.8.2, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2+tested-with:        GHC==7.8.3, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2 extra-source-files:     CHANGES.txt 
src/Cabal.hs view
@@ -13,7 +13,7 @@ import System.Process.Extra import Arguments -defAllow = ["7.0.4","7.2.2","7.4.2","7.6.3","7.8.2"]+defAllow = ["7.0.4","7.2.2","7.4.2","7.6.3","7.8.2","7.8.3"]   ---------------------------------------------------------------------@@ -23,8 +23,15 @@ -- | Check the .cabal file is well formed cabalCheck :: IO () cabalCheck = do-    system "cabal check"-        -- a lot of the warnings aren't real problems, just be aware of them+    -- a lot of the warnings aren't real problems, so whitelist some+    (_, res) <- systemOutput "cabal check"+    let allowed = ["No errors or warnings could be found in the package."+                  ,"These warnings may cause trouble when distributing the package:"+                  ,"* 'ghc-options: -main-is' is not portable."+                  ,""]+    let bad = lines res \\ allowed+    when (bad /= []) $ error $ unlines $ "Cabal check gave bad warnings:" : map show bad+     checkCabalFile     checkReadme     let require = ":set -fwarn-unused-binds -fwarn-unused-imports"@@ -40,7 +47,7 @@     files <- getDirectoryContents tdir     let tarball = head $ [x | x <- files, ".tar.gz" `isSuffixOf` x]     withCurrentDirectory tdir $ system_ $ "tar -xf " ++ tarball-    lst <- listFiles tdir+    lst <- listFilesRecursive tdir     let binary = [".png",".gz",".bat",".zip",".gif",""]     bad <- flip filterM lst $ \file ->         return (takeExtension file `notElem` binary) &&^@@ -94,7 +101,7 @@           "--contents-location=/package/" ++ name     withTempDir $ \dir -> do         system_ $ "cp -R dist/doc/html/" ++ name ++ " \"" ++ dir ++ "/" ++ name ++ "-" ++ ver ++ "-docs\""-        files <- listFiles dir+        files <- listFilesRecursive dir         forM_ files $ \file -> when (takeExtension file == ".html") $ do             src <- readFileBinary' $ dir </> file             src <- return $ filter (/= '\r') src -- filter out \r, due to CPP bugs@@ -119,9 +126,10 @@ fixFileLinks (stripPrefix "<a href=\"file://" -> Just xs)     | (a,'\"':b) <- break (== '\"') xs     , modu <- takeFileName a-    , (pkg,_) <- breakEnd (== '-') $ takeFileName $ dropHTML $ takeDirectory a+    , pkg <- dropEnd 1 $ dropWhileEnd (/= '-') $ takeFileName $ dropHTML $ takeDirectory a     = "<a href=\"/package/" ++ pkg ++ "/docs/" ++ modu ++ "\"" ++ fixFileLinks b     where dropHTML x = if takeFileName x == "html" then takeDirectory x else x+fixFileLinks xs@(stripPrefix "<a href=\"file://" -> Just _) = error $ "Unable to remove file link, " ++ take 200 xs fixFileLinks (x:xs) = x : fixFileLinks xs fixFileLinks [] = [] @@ -142,8 +150,8 @@     let want =             "[![Hackage version](https://img.shields.io/hackage/v/" ++ project ++ ".svg?style=flat)]" ++             "(http://hackage.haskell.org/package/" ++ project ++ ") " ++-            "[![Build Status](http://img.shields.io/travis/ndmitchell/" ++ project ++ ".svg?style=flat)]" ++-            "(https://travis-ci.org/ndmitchell/" ++ project ++ ")"+            "[![Build Status](http://img.shields.io/travis/" ++ qualify project ++ ".svg?style=flat)]" +++            "(https://travis-ci.org/" ++ qualify project ++ ")"     src <- readFile "README.md"     let line1 = head $ lines src ++ [""]     when (not $ want `isSuffixOf` line1) $@@ -165,14 +173,18 @@             ["2014 is not in the copyright year" | not $ "2014" `isInfixOf` concat (grab "copyright")] ++             ["copyright string is not at the start of the license" | not $ concat (grab "copyright") `isInfixOf` concat (take 1 $ lines license)] ++             ["No correct source-repository link"-                | let want = "source-repository head type: git location: https://github.com/ndmitchell/" ++ project ++ ".git"+                | let want = "source-repository head type: git location: https://github.com/" ++ qualify project ++ ".git"                 , not $ want `isInfixOf` unwords (words $ unlines src)] ++-            ["No bug-reports link" | grab "bug-reports" /= ["https://github.com/ndmitchell/" ++ project ++ "/issues"]] +++            ["No bug-reports link" | grab "bug-reports" /= ["https://github.com/" ++ qualify project ++ "/issues"]] ++             ["Incorrect license " | grab "license" `notElem` [["BSD3"],["MIT"]]] ++-            ["Invalid tested-with: " ++ show test | length test < 1 || not (null $ test \\ defAllow) || test /= reverse (sort test) || not (test `isPrefixOf` reverse defAllow)] +++            ["Invalid tested-with: " ++ show test | length test < 1 || not (null $ test \\ defAllow) || test /= reverse (sort test) || (not (test `isPrefixOf` reverse defAllow) && False)] ++             ["Bad stabilty, should be missing" | grab "stability" /= []] ++-            ["Missing CHANGES.txt in extra-source-files" | "CHANGES.txt" `notElem` concatMap words (grab "extra-source-files")]+            ["Missing CHANGES.txt in extra-source-files" | ["CHANGES.txt","changelog.md"] `disjoint` concatMap words (grab "extra-source-files")]     unless (null bad) $ error $ unlines bad++qualify :: String -> String+qualify "filepath" = "haskell/filepath"+qualify x = "ndmitchell/" ++ x  relines :: [String] -> [String] relines (x:xs) | ":" `isSuffixOf` x = unwords (x:a) : relines b