debian 3.54 → 3.55
raw patch · 6 files changed
+272/−97 lines, 6 filesdep +utf8-stringdep ~HaXmlnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: utf8-string
Dependency ranges changed: HaXml
API changes (from Hackage documentation)
- Debian.Report: trumpedXML :: Map ByteString (DebianVersion, DebianVersion) -> CFilter
+ Debian.Report: trumpedXML :: Map ByteString (DebianVersion, DebianVersion) -> CFilter Posn
Files
- Debian/Report.hs +2/−1
- Distribution/Package/Debian.hs +200/−67
- Distribution/Package/Debian/Bundled.hs +39/−9
- debian.cabal +16/−11
- utils/AptGetBuildDeps.hs +9/−4
- utils/Report.hs +6/−5
Debian/Report.hs view
@@ -9,6 +9,7 @@ import qualified Data.Map as M import qualified Data.ByteString.Char8 as B import Text.XML.HaXml+import Text.XML.HaXml.Posn -- * General Package Map Builders @@ -74,7 +75,7 @@ _ -> trumpedPM -- |create <trumped /> XML element and children from a trumped Map-trumpedXML :: M.Map B.ByteString (DebianVersion, DebianVersion) -> CFilter+trumpedXML :: M.Map B.ByteString (DebianVersion, DebianVersion) -> CFilter Posn trumpedXML trumpedMap' = mkElem "trumped" (map mkTrumpedPackage (M.toAscList trumpedMap' )) where
Distribution/Package/Debian.hs view
@@ -17,6 +17,8 @@ ( debian ) where +import Codec.Binary.UTF8.String (decodeString)+import Control.Arrow (second) import Control.Exception (SomeException, try, bracket) import Control.Monad (when,mplus) import qualified Data.ByteString.Lazy.Char8 as L@@ -24,6 +26,8 @@ import Data.List import qualified Data.Map as Map import Data.Maybe+import Data.Set (Set, member)+import qualified Data.Set (fromList) import Data.Version (showVersion) import Debian.Control import qualified Debian.Relation as D@@ -32,11 +36,16 @@ import Debian.Time (getCurrentLocalRFC822Time) import Debian.Version import Debian.Version.String+import Debian.Version.Internal (DebianVersion (DebianVersion)) import System.Cmd (system) import System.Directory import System.FilePath ((</>))-import System.IO (hPutStrLn, stderr)+import+ System.IO+ (IOMode (ReadMode), hGetContents, hPutStrLn, hSetBinaryMode, openFile, stderr)+import System.IO.Unsafe (unsafePerformIO) import System.Posix.Files (setFileCreationMask)+import System.Process (readProcessWithExitCode) import System.Unix.Process import System.Environment --import Text.ParserCombinators.ReadP@@ -58,7 +67,7 @@ import Distribution.PackageDescription (GenericPackageDescription(..), PackageDescription(..), allBuildInfo, buildTools, pkgconfigDepends,- exeName)+ exeName, extraLibs) import Distribution.PackageDescription.Configuration (finalizePackageDescription) import Distribution.ParseUtils (parseQuoted) import Distribution.Verbosity (Verbosity)@@ -189,7 +198,7 @@ , docDeb :: Maybe (String, DebianVersion) } -- |Each cabal package corresponds to a directory <name>-<version>,--- either in /usr/lib or in /usr/lib/haskell-packages/ghc6/lib.+-- either in /usr/lib or in /usr/lib/haskell-packages/ghc/lib. -- In that directory is a compiler subdirectory such as ghc-6.8.2. -- In the ghc subdirectory is one or two library files of the form -- libHS<name>-<version>.a and libHS<name>-<version>_p.a. We can@@ -208,12 +217,12 @@ case (missingBuildDeps, path) of -- There should already be a .substvars file produced by dh_haskell_prep, -- keep the relations listed there. They will contain something like this:- -- libghc6-cabal-debian-prof.substvars:- -- haskell:Depends=ghc6-prof (<< 6.8.2-999), ghc6-prof (>= 6.8.2), libghc6-cabal-debian-dev (= 0.4)- -- libghc6-cabal-debian-dev.substvars:- -- haskell:Depends=ghc6 (<< 6.8.2-999), ghc6 (>= 6.8.2)+ -- libghc-cabal-debian-prof.substvars:+ -- haskell:Depends=ghc-prof (<< 6.8.2-999), ghc-prof (>= 6.8.2), libghc-cabal-debian-dev (= 0.4)+ -- libghc-cabal-debian-dev.substvars:+ -- haskell:Depends=ghc (<< 6.8.2-999), ghc (>= 6.8.2) -- haskell-cabal-debian-doc.substvars:- -- haskell:Depends=ghc6-doc, haddock (>= 2.1.0), haddock (<< 2.1.0-999)+ -- haskell:Depends=ghc-doc, haddock (>= 2.1.0), haddock (<< 2.1.0-999) ([], Just path') -> do old <- try (readFile path') >>= return . either (\ (_ :: SomeException) -> "") id let new = addDeps old@@ -271,7 +280,7 @@ Just package -> maybe Nothing (\ (s, v) -> Just [D.Rel s (Just (D.GRE v)) Nothing]) (docDeb package) Nothing -> Nothing) cabalDeps) cabalDeps :: [Dependency]- cabalDeps = allBuildDepends pkgDesc+ cabalDeps = map unboxDependency $ allBuildDepends pkgDesc buildDepNames :: [String] buildDepNames = concat (map (map (\ (D.Rel s _ _) -> s)) buildDeps) buildDeps :: D.Relations@@ -299,7 +308,7 @@ libPaths compiler debVersions | compilerFlavor compiler == GHC = do a <- getDirPaths "/usr/lib"- b <- getDirPaths "/usr/lib/haskell-packages/ghc6/lib"+ b <- getDirPaths "/usr/lib/haskell-packages/ghc/lib" -- Build a map from names of installed debs to version numbers mapM (packageInfo compiler debVersions) (a ++ b) >>= return . catMaybes | True = error $ "Can't handle compiler flavor: " ++ show (compilerFlavor compiler)@@ -353,10 +362,10 @@ devToDoc :: Compiler -> String -> IO (Maybe String) devToDoc compiler name | compilerFlavor compiler == GHC =- case maybe Nothing (dropSuffix "-dev") (dropPrefix "libghc6-" name) of+ case maybe Nothing (dropSuffix "-dev") (dropPrefix "libghc-" name) of Just base -> - do let name1 = "libghc6-" ++ base ++ "-doc"- let name2 = "libghc6-" ++ base ++ "-doc"+ do let name1 = "libghc-" ++ base ++ "-doc"+ let name2 = "libghc-" ++ base ++ "-doc" exists1 <- doesFileExist ("/var/lib/dpkg/info/" ++ name1 ++ ".list") case exists1 of True -> return (Just name1)@@ -396,7 +405,7 @@ updateDebianization _force pkgDesc flags compiler tgtPfx = do createDirectoryIfMissing True "debian" date <- getCurrentLocalRFC822Time- copyright <- try (readFile (licenseFile pkgDesc)) >>= + copyright <- try (readFile' (licenseFile pkgDesc)) >>= return . either (\ (_ :: SomeException) -> showLicense . license $ pkgDesc) id debianMaintainer <- getDebianMaintainer flags >>= maybe (error "Missing value for --maintainer") return controlUpdate (tgtPfx </> "control") flags compiler debianMaintainer pkgDesc@@ -408,6 +417,13 @@ -- The dev postinst and prerm files are generated by haskell-devscripts via cdbs. return () +readFile' :: FilePath -> IO String+readFile' path+ = do+ file <- openFile path ReadMode+ hSetBinaryMode file True+ hGetContents file+ {- Create a debian maintainer field from the environment variables: @@ -441,7 +457,7 @@ where envMaintainer :: IO (Maybe String) envMaintainer =- do env <- getEnvironment+ do env <- map (second decodeString) `fmap` getEnvironment return $ do fullname <- lookup "DEBFULLNAME" env `mplus` lookup "NAME" env email <- lookup "DEBEMAIL" env `mplus` lookup "EMAIL" env return (fullname ++ " <" ++ email ++ ">")@@ -456,8 +472,8 @@ "include /usr/share/cdbs/1/class/hlibrary.mk"] comments = ["# How to install an extra file into the documentation package",- "#binary-fixup/libghc6-" ++ libName ++ "-doc::",- "#\techo \"Some informative text\" > debian/libghc6-" ++ libName ++ "-doc/usr/share/doc/libghc6-" ++ libName ++ "-doc/AnExtraDocFile"]+ "#binary-fixup/libghc-" ++ libName ++ "-doc::",+ "#\techo \"Some informative text\" > debian/libghc-" ++ libName ++ "-doc/usr/share/doc/libghc-" ++ libName ++ "-doc/AnExtraDocFile"] {- devrules = case (library pkgDesc, executables pkgDesc) of@@ -466,7 +482,7 @@ [["binary-fixup/" ++ (debianDevelPackageName libName) ++ "::"] ++ concat (map (\ exec -> ["\tmkdir -p debian/" ++ exeName exec ++ "/usr/bin", "\tmv debian/" ++ (debianDevelPackageName libName) ++- "/usr/lib/haskell-packages/ghc6/bin/" ++ exeName exec +++ "/usr/lib/haskell-packages/ghc/bin/" ++ exeName exec ++ " debian/" ++ exeName exec ++ "/usr/bin"]) (executables pkgDesc))] profrules = case (library pkgDesc, executables pkgDesc) of@@ -474,7 +490,7 @@ (_, execs) -> [["binary-fixup/" ++ (debianProfilingPackageName libName) ++ "::"] ++ map (\ exec -> "\trm debian/" ++ (debianProfilingPackageName libName) ++- "/usr/lib/haskell-packages/ghc6/bin/" ++ exeName exec) (executables pkgDesc)]+ "/usr/lib/haskell-packages/ghc/bin/" ++ exeName exec) (executables pkgDesc)] -} libName = unPackageName . pkgName . package $ pkgDesc @@ -557,14 +573,19 @@ sourceSpec = Paragraph ([Field ("Source", " " ++ debianSourcePackageName pkgDesc),- Field ("Priority", " " ++ "optional"),- Field ("Section", " " ++ "misc"),+ Field ("Priority", " " ++ "extra"),+ Field ("Section", " " ++ "haskell"), Field ("Maintainer", " " ++ debianMaintainer), Field ("Build-Depends", " " ++ showDeps' "Build-Depends:" debianBuildDeps), Field ("Build-Depends-Indep", " " ++ showDeps' "Build-Depends-Indep:" debianBuildDepsIndep), --Field ("Build-Depends-Indep", " " ++ buildDepsIndep),- Field ("Standards-Version", " " ++ "3.8.1")] ++- list [] (\ s -> [Field ("Homepage", " " ++ s)]) (homepage pkgDesc))+ Field ("Standards-Version", " " ++ "3.9.1"),+ Field ("Homepage",+ " " +++ if homepage pkgDesc == ""+ then "http://hackage.haskell.org/package/" +++ unPackageName (pkgName $ package pkgDesc)+ else homepage pkgDesc)]) executableSpec executable = Paragraph [Field ("Package", " " ++ map toLower (exeName executable)),@@ -584,44 +605,45 @@ [Field ("Package", " " ++ debianDocumentationPackageName (unPackageName . pkgName . package $ pkgDesc)), Field ("Architecture", " " ++ "all"), Field ("Section", " " ++ "doc"),- Field ("Depends", " " ++ showDeps' "Depends:" ([[D.Rel "${haskell:Depends}" Nothing Nothing],- [D.Rel "${misc:Depends}" Nothing Nothing]] ++ libraryDependencies "-doc")),+ Field ("Depends", " " ++ showDeps' "Depends:" [[D.Rel "${haskell:Depends}" Nothing Nothing],+ [D.Rel "${misc:Depends}" Nothing Nothing]]),+ Field ("Recommends", " " ++ "${haskell:Recommends}"),+ Field ("Suggests", " " ++ "${haskell:Suggests}"), Field ("Description", " " ++ libraryDescription "-doc")] librarySpec arch suffix = Paragraph [Field ("Package", " " ++ prefix ++ map toLower (unPackageName . pkgName . package $ pkgDesc) ++ suffix), Field ("Architecture", " " ++ arch),- Field ("Section", " " ++ "haskell"),- Field ("Depends", " " ++ showDeps' "Depends:" ([[D.Rel "${haskell:Depends}" Nothing Nothing],- [D.Rel "${misc:Depends}" Nothing Nothing]] ++ libraryDependencies suffix)),+ Field ("Depends", " " ++ showDeps' "Depends:" (+ (if suffix == "-dev"+ then [[D.Rel "${shlibs:Depends}" Nothing Nothing]]+ else []) +++ [[D.Rel "${haskell:Depends}" Nothing Nothing],+ [D.Rel "${misc:Depends}" Nothing Nothing]])),+ Field ("Recommends", " " ++ "${haskell:Recommends}"),+ Field ("Suggests", " " ++ "${haskell:Suggests}"),+ Field ("Provides", " " ++ "${haskell:Provides}"), Field ("Description", " " ++ libraryDescription suffix)] where prefix = case suffix of- "-dev" -> "libghc6-"- "-prof" -> "libghc6-"+ "-dev" -> "libghc-"+ "-prof" -> "libghc-" -- "-doc" -> docPrefix (unPackageName . pkgName . package $ pkgDesc) _ -> error $ "Unknown suffix: " ++ suffix- libraryDependencies :: String -> D.Relations- libraryDependencies "-dev" = []- libraryDependencies "-prof" = [[D.Rel (debianDevelPackageName (unPackageName . pkgName . package $ pkgDesc)) Nothing Nothing]]- libraryDependencies "-doc" = [[D.Rel "ghc6-doc" Nothing Nothing]]- libraryDependencies suffix = error $ "Unexpected library package name suffix: " ++ show suffix -- The haskell-cdbs package contains the hlibrary.mk file with -- the rules for building haskell packages. debianBuildDeps :: D.Relations debianBuildDeps = nub $ [[D.Rel "debhelper" (Just (D.GRE (parseDebianVersion "7.0"))) Nothing],- [D.Rel "haskell-devscripts" (Just (D.GRE (parseDebianVersion "0.6.15+nmu7"))) Nothing],- [D.Rel "hscolour" Nothing Nothing],+ [D.Rel "haskell-devscripts" (Just (D.GRE (parseDebianVersion "0.8"))) Nothing], [D.Rel "cdbs" Nothing Nothing],- [D.Rel "ghc6" (Just (D.GRE (parseDebianVersion "6.8"))) Nothing]] ++ - (if debLibProf flags then [[D.Rel "ghc6-prof" Nothing Nothing]] else []) +++ [D.Rel "ghc" Nothing Nothing]] +++ (if debLibProf flags then [[D.Rel "ghc-prof" Nothing Nothing]] else []) ++ (concat . map (debianDependencies bundled compiler buildDependencies) . allBuildDepends $ pkgDesc) debianBuildDepsIndep :: D.Relations debianBuildDepsIndep = nub $- [[D.Rel "ghc6-doc" Nothing Nothing],- [D.Rel "haddock" Nothing Nothing]] +++ [[D.Rel "ghc-doc" Nothing Nothing]] ++ (concat . map (debianDependencies bundled compiler docDependencies) . allBuildDepends $ pkgDesc) debianDescription = (synopsis pkgDesc) ++@@ -645,19 +667,36 @@ intercalate (",\n " ++ prefix') (map (intercalate " | " . map show) xss) where prefix' = map (\ _ -> ' ') prefix +data Dependency_+ = BuildDepends Dependency+ | BuildTools Dependency+ | PkgConfigDepends Dependency+ | ExtraLibs String+ deriving (Eq, Show)++unboxDependency :: Dependency_ -> Dependency+unboxDependency (BuildDepends d) = d+unboxDependency (BuildTools d) = d+unboxDependency (PkgConfigDepends d) = d+unboxDependency (ExtraLibs d) = Dependency (PackageName d) AnyVersion+ -- |Debian packages don't have per binary package build dependencies, -- so we just gather them all up here. allBuildDepends pkgDesc =- nub $ buildDepends pkgDesc ++ - concat (map buildTools (allBuildInfo pkgDesc) ++- map pkgconfigDepends (allBuildInfo pkgDesc))+ nub $ map BuildDepends (buildDepends pkgDesc) +++ concat (map (map BuildTools . buildTools) (allBuildInfo pkgDesc) +++ map+ (map PkgConfigDepends . pkgconfigDepends)+ (allBuildInfo pkgDesc) +++ map (map ExtraLibs . extraLibs) (allBuildInfo pkgDesc)) -- Turn a cabal dependency into a list of debian relations. If a -- library is required as a build dependency we need the profiling -- version, which pulls in the regular version, and we need the -- documentation so the cross references can be resolved.-debianDependencies :: [Bundled] -> Compiler -> (Compiler -> Dependency -> D.Relations) -> Dependency -> D.Relations-debianDependencies bundled compiler toDebRels dep | isBundled bundled compiler dep = []+debianDependencies :: [Bundled] -> Compiler -> (Compiler -> Dependency_ -> D.Relations) -> Dependency_ -> D.Relations+debianDependencies bundled compiler toDebRels dep+ | isBundled bundled compiler $ unboxDependency dep = [] debianDependencies _ compiler toDebRels dep = toDebRels compiler dep changelogUpdate :: FilePath -> String -> PackageDescription -> String -> IO ()@@ -670,13 +709,18 @@ changelog debianMaintainer pkgDesc date = render (prettyEntry (Entry { logPackage = debianSourcePackageName pkgDesc- , logVersion = debianVersionNumber pkgDesc+ , logVersion =+ updateOriginal (++ "-1~hackage1") $+ debianVersionNumber pkgDesc , logDists = [parseReleaseName "unstable"] , logUrgency = "low" , logComments = " * Debianization generated by cabal-debian\n\n" , logWho = debianMaintainer , logDate = date })) +updateOriginal :: (String -> String) -> DebianVersion -> DebianVersion+updateOriginal f (DebianVersion str dv) = DebianVersion (f str) dv+ unPackageName :: PackageName -> String unPackageName (PackageName s) = s @@ -684,10 +728,10 @@ debianSourcePackageName pkgDesc = "haskell-" ++ map toLower (unPackageName . pkgName . package $ pkgDesc) debianProfilingPackageName :: String -> String-debianProfilingPackageName x = "libghc6-" ++ map toLower x ++ "-prof"+debianProfilingPackageName x = "libghc-" ++ map toLower x ++ "-prof" debianDevelPackageName :: String -> String-debianDevelPackageName x = "libghc6-" ++ map toLower x ++ "-dev"+debianDevelPackageName x = "libghc-" ++ map toLower x ++ "-dev" --debianDevelPackageName' (Dependency (PackageName name) _) = debianDevelPackageName name @@ -698,36 +742,125 @@ -- The profiling packages depend on the other profiling packages. -- FIXME: These should have version dependencies.-profilingDependencies :: Compiler -> Dependency -> D.Relations-profilingDependencies compiler dep@(Dependency (PackageName name) ranges) =- concat (map (\ x -> debianRelations x ranges) names)- where names = if isLibrary compiler dep then [debianProfilingPackageName name] else []+profilingDependencies :: Compiler -> Dependency_ -> D.Relations+profilingDependencies+ compiler+ (BuildDepends (Dependency (PackageName name) ranges))+ = concat+ (map+ (\ x -> debianRelations (debianProfilingPackageName x) ranges)+ $ filter (not . flip member base) [name])+profilingDependencies _ _ = [] -- The development packages depend on the other development packages, -- the ones they were built with. FIXME: These should have version -- dependencies.-develDependencies :: Compiler -> Dependency -> D.Relations-develDependencies compiler dep@(Dependency (PackageName name) ranges) =- concat (map (\ x -> debianRelations x ranges) names)- where names = if isLibrary compiler dep then [debianDevelPackageName name] else []+develDependencies :: Compiler -> Dependency_ -> D.Relations+develDependencies+ compiler+ (BuildDepends (Dependency (PackageName name) ranges))+ = concat+ (map+ (\ x -> debianRelations (debianDevelPackageName x) ranges)+ $ filter (not . flip member base) [name])+develDependencies compiler dep@(ExtraLibs _)+ = concat+ (map (\ x -> debianRelations x AnyVersion) $ adapt dep)+develDependencies _ _ = [] -- The build dependencies for a package include the profiling -- libraries and the documentation packages, used for creating cross -- references.-buildDependencies :: Compiler -> Dependency -> D.Relations-buildDependencies compiler dep@(Dependency (PackageName name) ranges) =- concat (map (\ x -> debianRelations x ranges) names)- where names = if isLibrary compiler dep- then [ debianProfilingPackageName name- ] else [name]+buildDependencies :: Compiler -> Dependency_ -> D.Relations+buildDependencies+ compiler+ (BuildDepends (Dependency (PackageName name) ranges))+ = concat+ (map+ (\ x -> debianRelations x ranges)+ (if member name base+ then []+ else [debianDevelPackageName name, debianProfilingPackageName name]))+buildDependencies compiler dep@(ExtraLibs _)+ = concat+ (map (\ x -> debianRelations x AnyVersion) $ adapt dep)+buildDependencies compiler dep+ = concat+ (map (\ x -> debianRelations x ranges) $ adapt dep)+ where (Dependency (PackageName name) ranges) = unboxDependency dep +adapt :: Dependency_ -> [String]+adapt (BuildTools (Dependency (PackageName "gtk2hsC2hs") _))+ = ["gtk2hs-buildtools"]+adapt (BuildTools (Dependency (PackageName "gtk2hsHookGenerator") _))+ = ["gtk2hs-buildtools"]+adapt (BuildTools (Dependency (PackageName "gtk2hsTypeGen") _))+ = ["gtk2hs-buildtools"]+adapt (PkgConfigDepends (Dependency (PackageName pkg) _))+ = unsafePerformIO+ $ do+ ret+ <- readProcessWithExitCode "apt-file" ["-l", "search", pkg ++ ".pc"] ""+ return+ $ case ret of+ (ExitSuccess, out, _) -> [takeWhile (not . isSpace) out]+ _ -> []+adapt (ExtraLibs "gcrypt") = ["libgcrypt11-dev"]+adapt (ExtraLibs x) = ["lib" ++ x ++ "-dev"]+adapt dep+ = [name]+ where (Dependency (PackageName name) _) = unboxDependency dep+ -- The documentation dependencies for a package include the documentation -- package for any libraries which are build dependencies, so we have access -- to all the cross references.-docDependencies :: Compiler -> Dependency -> D.Relations-docDependencies compiler dep@(Dependency (PackageName name) ranges) =- concat (map (\ x -> debianRelations x ranges) names)- where names = if isLibrary compiler dep then [debianDocumentationPackageName name] else []+docDependencies :: Compiler -> Dependency_ -> D.Relations+docDependencies+ compiler+ (BuildDepends (Dependency (PackageName name) ranges))+ = concat+ (map+ (\ x -> debianRelations (debianDocumentationPackageName x) ranges)+ $ filter (not . flip member base) [name])+docDependencies _ _ = []++-- generated with:+-- apt-cache show ghc \+-- | grep ^Provides: \+-- | cut -d\ -f2-+-- | sed 's/, /\n/g' \+-- | grep libghc- \+-- | cut -d- -f2- \+-- | grep dev$ \+-- | sed 's/-dev//;s/$/",/;s/^/"/'++base :: Set String+base+ = Data.Set.fromList+ ["array",+ "base",+ "bin-package-db",+ "bytestring",+ "cabal",+ "containers",+ "directory",+ "extensible-exceptions",+ "filepath",+ "ghc-binary",+ "ghc-prim",+ "haskell2010",+ "haskell98",+ "hpc",+ "integer-gmp",+ "old-locale",+ "old-time",+ "pretty",+ "process",+ "random",+ "rts",+ "template-haskell",+ "time",+ "unix"] debianRelations :: String -> VersionRange -> D.Relations debianRelations name range =
Distribution/Package/Debian/Bundled.hs view
@@ -67,7 +67,8 @@ builtIns :: Compiler -> IO [Bundled] builtIns compiler = do ghc6 <- fmap maybeToList $ ghc6BuiltIns compiler- return $ ghc6 ++ [ (GHC, Version [6,8,3] [], ghc683BuiltIns)+ return $ ghc6 ++ [ (GHC, Version [7,0,1] [], ghc701BuiltIns)+ , (GHC, Version [6,8,3] [], ghc683BuiltIns) , (GHC, Version [6,8,2] [], ghc682BuiltIns) , (GHC, Version [6,8,1] [], ghc681BuiltIns) , (GHC, Version [6,6,1] [], ghc661BuiltIns)@@ -77,7 +78,7 @@ ghc6BuiltIns compiler@(Compiler {compilerId = CompilerId GHC compilerVersion}) = #ifdef CABAL19 do installedPackages <- getInstalledPackageIndex compiler- ghc6Files <- fmap lines $ readFile "/var/lib/dpkg/info/ghc6.list"+ ghc6Files <- fmap lines $ readFile "/var/lib/dpkg/info/ghc.list" let ghcProvides = filter (\package -> any (\dir -> elem dir ghc6Files) (libraryDirs package)) (allPackages installedPackages) return (Just (GHC, compilerVersion, map sourcePackageId ghcProvides)) #else@@ -85,7 +86,7 @@ case mInstalledPackages of Nothing -> error "Could not find the installed package database." (Just installedPackages) ->- do ghc6Files <- fmap lines $ readFile "/var/lib/dpkg/info/ghc6.list"+ do ghc6Files <- fmap lines $ readFile "/var/lib/dpkg/info/ghc.list" let ghcProvides = filter (\package -> any (\dir -> elem dir ghc6Files) (libraryDirs package)) (allPackages installedPackages) return (Just (GHC, compilerVersion, map sourcePackageId ghcProvides)) #endif@@ -121,21 +122,21 @@ case eC of Left e -> return $ Left (show e) Right (Control c) ->- case find (\p -> fieldValue "Package" p == Just (B.pack "ghc6")) c of- Nothing -> return $ Left "You do not seem to have ghc6 installed."+ case find (\p -> fieldValue "Package" p == Just (B.pack "ghc")) c of+ Nothing -> return $ Left "You do not seem to have ghc installed." (Just p) -> case fieldValue "Provides" p of- Nothing -> return $ Left "Your ghc6 package does not seem to Provide anything."+ Nothing -> return $ Left "Your ghc package does not seem to Provide anything." (Just p) -> case parseRelations p of (Left e) -> return (Left (show e)) (Right relations) ->- return $ Right $ filter (isPrefixOf "libghc6-") $ map (\ (Rel pkgName _ _) -> pkgName) (concat relations)+ return $ Right $ filter (isPrefixOf "libghc-") $ map (\ (Rel pkgName _ _) -> pkgName) (concat relations) extractBaseName :: String -> Either String String extractBaseName name =- let (_,_,_,subs) = (name =~ "^libghc6-(.*)-.*$") :: (String, String, String, [String])+ let (_,_,_,subs) = (name =~ "^libghc-(.*)-.*$") :: (String, String, String, [String]) in case subs of [base] -> Right base _ -> Left ("When attempt to extract the base name of " ++ name ++ " I found the following matches: " ++ show subs)@@ -157,6 +158,35 @@ v :: String -> [Int] -> PackageIdentifier v n x = PackageIdentifier (PackageName n) (Version x []) +ghc701BuiltIns :: [PackageIdentifier]+ghc701BuiltIns = [+ v "Cabal" [1,10,0,0],+ v "array" [0,3,0,2],+ v "base" [4,3,0,0],+ v "bin-package-db" [0,0,0,0],+ v "bytestring" [0,9,1,8],+ v "containers" [0,4,0,0],+ v "directory" [1,1,0,0],+ v "extensible-exceptions" [0,1,1,2],+ v "filepath" [1,2,0,0],+ v "ghc" [7,0,1],+ v "ghc-binary" [0,5,0,2],+ v "ghc-prim" [0,2,0,0],+ v "haskell2010" [1,0,0,0],+ v "haskell98" [1,1,0,0],+ v "hpc" [0,5,0,6],+ v "integer-gmp" [0,2,0,2],+ v "old-locale" [1,0,0,2],+ v "old-time" [1,0,0,6],+ v "pretty" [1,0,1,2],+ v "process" [1,0,1,4],+ v "random" [1,0,0,3],+ v "rts" [1,0],+ v "template-haskell" [2,5,0,0],+ v "time" [1,2,0,3],+ v "unix" [2,4,1,0]+ ]+ ghc683BuiltIns :: [PackageIdentifier] ghc683BuiltIns = ghc682BuiltIns @@ -299,4 +329,4 @@ isLibrary _ _ = True docPrefix :: String -> String-docPrefix _ = "libghc6-"+docPrefix _ = "libghc-"
debian.cabal view
@@ -1,14 +1,14 @@ Name: debian-Version: 3.54+Version: 3.55 License: BSD3 License-File: debian/copyright-Author: David Fox+Author: David Fox <dsf@seereason.com> Category: System-Maintainer: david@seereason.com-Homepage: http://src.seereason.com/haskell-debian+Maintainer: Marco Túlio Gontijo e Silva <marcot@debian.org>+Homepage: http://marcot.eti.br/darcs/haskell-debian Build-Type: Simple Synopsis: Modules for working with the Debian package system-Cabal-Version: >= 1.2+Cabal-Version: >= 1.6 Description: This library includes modules covering some basic data types defined by the Debian policy manual - version numbers, control file syntax, etc.@@ -22,8 +22,9 @@ Library Build-Depends: base >= 4 && < 5, bytestring, containers, directory, filepath, mtl, network, old-locale, parsec >= 2 && <4, pretty, process,- regex-tdfa, regex-compat, time, unix, bzlib, HaXml < 1.14, Unixutils >= 1.32, zlib, HUnit- ghc-options: -O2 -W -Wall+ regex-tdfa, regex-compat, time, unix, bzlib, HaXml == 1.20.*, Unixutils >= 1.32, zlib, HUnit,+ utf8-string+ ghc-options: -W -Wall if flag(cabal19) build-depends: Cabal >= 1.9 cpp-options: -DCABAL19@@ -72,7 +73,7 @@ Executable fakechanges Main-is: utils/FakeChanges.hs- ghc-options: -O2 -threaded -W+ ghc-options: -threaded -W Extensions: ExistentialQuantification CPP if flag(cabal19) build-depends: Cabal >= 1.9@@ -83,7 +84,7 @@ Executable debian-report Main-is: utils/Report.hs- ghc-options: -O2 -threaded -W+ ghc-options: -threaded -W C-Sources: cbits/gwinsz.c Include-Dirs: cbits Install-Includes: gwinsz.h@@ -97,7 +98,7 @@ Executable cabal-debian Main-is: utils/CabalDebian.hs- ghc-options: -O2 -threaded -W+ ghc-options: -threaded -W Build-Depends: Cabal >= 1.6.0.1 Extensions: ExistentialQuantification CPP if flag(cabal19)@@ -109,7 +110,7 @@ Executable apt-get-build-depends Main-is: utils/AptGetBuildDeps.hs- ghc-options: -O2 -threaded -W+ ghc-options: -threaded -W Extensions: ExistentialQuantification CPP if flag(cabal19) build-depends: Cabal >= 1.9@@ -117,3 +118,7 @@ else build-depends: Cabal >= 1.8 cpp-options: -DCABAL18++source-repository head+ type: darcs+ location: http://marcot.eti.br/darcs/haskell-debian
utils/AptGetBuildDeps.hs view
@@ -6,6 +6,7 @@ import Debian.Relation import System.Process import System.Exit+import System.Environment lookupBuildDeps :: FilePath -> IO [PkgName] lookupBuildDeps fp =@@ -30,10 +31,14 @@ pkgName (Rel name _ _) = name -aptGetInstall :: [PkgName] -> IO ExitCode-aptGetInstall pkgnames = - do (_,_,_,ph) <- createProcess $ proc "apt-get" ("install" : pkgnames)+aptGetInstall :: [String] -> [PkgName] -> IO ExitCode+aptGetInstall options pkgnames =+ do (_,_,_,ph)+ <- createProcess $ proc "apt-get" $ ["install"] ++ options ++ pkgnames waitForProcess ph main :: IO ()-main = lookupBuildDeps "debian/control" >>= aptGetInstall >>= exitWith+main+ = do+ options <- getArgs+ lookupBuildDeps "debian/control" >>= aptGetInstall options >>= exitWith
utils/Report.hs view
@@ -12,6 +12,7 @@ import System.Exit (exitFailure) import Text.XML.HaXml import Text.XML.HaXml.Pretty (document)+import Text.XML.HaXml.Posn import Text.PrettyPrint.HughesPJ import System.IO import System.Posix.Env@@ -29,16 +30,16 @@ trumpMap <- trumped (fetch emptyFetchCallbacks []) cacheDir arch sourcesA sourcesB print (showXML "trump.xsl" (trumpedXML trumpMap)) where- showXML :: String -> CFilter -> Doc+ showXML :: String -> CFilter Posn -> Doc showXML styleSheet = document . mkDocument styleSheet . cfilterToElem -- cliff says this is broken with regards to cdata- cfilterToElem :: CFilter -> Element- cfilterToElem f = case f (CString False "") of- [CElem e] -> xmlEscape stdXmlEscaper e+ cfilterToElem :: CFilter Posn -> Element Posn+ cfilterToElem f = case f (CString False "" noPos) of+ [CElem e _] -> xmlEscape stdXmlEscaper e [] -> error "RSS produced no output" _ -> error "RSS produced more than one output" -- <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>- mkDocument :: String -> Element -> Document+ mkDocument :: String -> Element Posn -> Document Posn mkDocument styleSheet elem = let xmlDecl = XMLDecl "1.0" (Just (EncodingDecl "utf-8")) (Just True) prolog = Prolog (Just xmlDecl) [] Nothing [PI ("xml-stylesheet","type=\"text/xsl\" href=\""++styleSheet++"\"")]