Skip to content
This repository
Browse code

produce a package list

  • Loading branch information...
commit 5edc790c631c415944e4455da7dd00dbdc415e57 1 parent 68c8c98
phischu authored

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. +17 1 Master.hs
18 Master.hs
@@ -23,6 +23,8 @@ import Distribution.PackageDescription.Configuration
23 23 import Distribution.System
24 24 import Distribution.Compiler
25 25
  26 +import qualified MasterPipe
  27 +
26 28
27 29 newtype Package = Package (Name,Version) deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
28 30 type Name = String
@@ -39,6 +41,7 @@ newtype GetModulesInPackage = GetModulesInPackage Package deriving (Show,Typeabl
39 41 newtype CreateModuleList = CreateModuleList Package deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
40 42 newtype ModuleList = ModuleList [Module] deriving (Show,Typeable,Eq,Hashable,Binary,NFData,Read)
41 43 newtype GetAST = GetAST (Package,Module) deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
  44 +newtype CreatePackageList = CreatePackageList () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
42 45
43 46 instance Rule ExtractedPackage () where
44 47 storedValue (ExtractedPackage (Package (name,version))) = do
@@ -58,6 +61,11 @@ instance Rule CreateModuleList () where
58 61 exists <- IO.doesFileExist (moduleListFile package)
59 62 if exists then return (Just ()) else return Nothing
60 63
  64 +instance Rule CreatePackageList () where
  65 + storedValue _ = do
  66 + exists <- IO.doesFileExist "packages.list"
  67 + if exists then return (Just ()) else return Nothing
  68 +
61 69 instance Rule GetAST () where
62 70 storedValue = undefined
63 71
@@ -76,13 +84,17 @@ moduleListFile package = "ModuleLists/"++packageIdentifier package++".modulelist
76 84 packageUrl :: Package -> String
77 85 packageUrl (Package (name,version)) = concat ["hackage.haskell.org/packages/archive/",name,"/",version,"/",name,"-",version,".tar.gz"]
78 86
  87 +convertPackage :: Package -> MasterPipe.Package
  88 +convertPackage (package@(Package (name,version))) = MasterPipe.Package name version path where
  89 + path = extractedDirectory ++ packageIdentifier package ++ "/"
  90 +
79 91 main :: IO ()
80 92 main = shakeArgs shakeOptions {shakeThreads = 4} $ do
81 93
82 94 action (do
83 95 PackageList packages <- apply1 (GetPackageList ())
84 96 apply (map ExtractedPackage packages) :: Action [()]
85   - apply (map CreateModuleList packages) :: Action [()])
  97 + apply1 (CreatePackageList ()) :: Action ())
86 98
87 99 rule (\(GetPackageList ()) -> Just (do
88 100 need ["00-index.tar"]
@@ -111,6 +123,10 @@ main = shakeArgs shakeOptions {shakeThreads = 4} $ do
111 123 system' "wget" ["-nv","hackage.haskell.org/packages/archive/00-index.tar.gz"]
112 124 system' "gunzip" ["-f","00-index.tar.gz"])
113 125
  126 + rule (\(CreatePackageList ()) -> Just $ do
  127 + PackageList packages <- apply1 (GetPackageList ())
  128 + writeFileLines "packages.list" (map (show . convertPackage) packages))
  129 +
114 130 rule (\(CreateModuleList package@(Package (name,version))) -> Just $ do
115 131 let packagedirectory = extractedDirectory++packageIdentifier package++"/"
116 132 cabalfile = packagedirectory++name++".cabal"

0 comments on commit 5edc790

Please sign in to comment.
Something went wrong with that request. Please try again.