cabal-debian 4.33 → 4.35.3
raw patch · 22 files changed
+488/−212 lines, 22 files
Files
- Tests.hs +29/−11
- cabal-debian.cabal +1/−2
- changelog +27/−0
- debian/Debianize.hs +22/−4
- debian/control +2/−2
- src/Debian/Debianize.hs +2/−0
- src/Debian/Debianize/BasicInfo.hs +7/−6
- src/Debian/Debianize/BuildDependencies.hs +24/−22
- src/Debian/Debianize/Bundled.hs +98/−37
- src/Debian/Debianize/CabalInfo.hs +15/−10
- src/Debian/Debianize/DebianName.hs +8/−7
- src/Debian/Debianize/Finalize.hs +14/−13
- src/Debian/Debianize/InputCabal.hs +42/−23
- src/Debian/Debianize/InputDebian.hs +5/−5
- src/Debian/Debianize/Optparse.hs +18/−2
- src/Debian/Debianize/Output.hs +10/−2
- src/Debian/GHC.hs +151/−58
- src/Debian/Orphans.hs +2/−2
- src/Distribution/Version/Invert.hs +5/−0
- test-data/artvaluereport2/input/debian/Debianize.hs +2/−2
- test-data/clckwrks-dot-com/output/debian/control +2/−2
- test-data/creativeprompts/output/debian/control +2/−2
Tests.hs view
@@ -20,9 +20,10 @@ import Data.Text as Text (intercalate, split, Text, unlines, unpack) import Data.Version (Version(Version)) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..), parseEntry)-import Debian.Debianize.BasicInfo (compilerFlavor, Flags, verbosity)+import Debian.Debianize.BasicInfo (compilerChoice, Flags, verbosity)+import qualified Debian.Debianize.Bundled as Bundled (tests) import qualified Debian.Debianize.BinaryDebDescription as B-import Debian.Debianize.CabalInfo as A+import Debian.Debianize.CabalInfo as A (CabalInfo, debInfo, epochMap, newCabalInfo) import Debian.Debianize.CopyrightDescription import Debian.Debianize.DebianName (mapCabal, splitCabal) import qualified Debian.Debianize.DebInfo as D@@ -34,6 +35,7 @@ import Debian.Debianize.Prelude (withCurrentDirectory) import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (DebBase(DebBase))+import Debian.GHC (CompilerChoice(..), CompilerVendor(..)) import Debian.Pretty (ppShow) import Debian.Policy (databaseDirectory, PackageArchitectures(All), PackagePriority(Extra), parseMaintainer, Section(MainSection), SourceFormat(Native3), StandardsVersion(..), getDebhelperCompatLevel, getDebianStandardsVersion, License(..)) import Debian.Relation (BinPkgName(..), Relation(..), SrcPkgName(..), VersionReq(..))@@ -50,6 +52,12 @@ import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) import Text.PrettyPrint.HughesPJClass (pPrint, text, Doc) +#if MIN_VERSION_base(4,8,0)+import Data.Version (makeVersion)+#else+makeVersion :: [Int] -> Version+makeVersion ns = Version ns []+#endif -- | Backward compatibility. Should be fixed. newFlags :: IO Flags@@ -68,10 +76,13 @@ -- | Force the compiler version to 7.6 to get predictable outputs testAtoms :: IO CabalInfo-testAtoms = newFlags >>= newCabalInfo >>= return . ghc763+testAtoms = ghc763 <$> (newFlags >>= newCabalInfo) where- ghc763 :: CabalInfo -> CabalInfo- ghc763 atoms = set (A.debInfo . D.flags . compilerFlavor) GHC atoms+ ghc763 :: Either String CabalInfo -> CabalInfo+ ghc763 (Left s) = error $ "testAtoms - failed to build CabalInfo: " ++ s+ ghc763 (Right atoms) =+ set (A.debInfo . D.flags . compilerChoice)+ (CompilerChoice {_hcVendor = HVR (makeVersion [7,6,3]), _hcFlavor = GHC}) atoms -- | Create a Debianization based on a changelog entry and a license -- value. Uses the currently installed versions of debhelper and@@ -92,7 +103,8 @@ (A.debInfo . D.control . S.standardsVersion) .= standards tests :: Test-tests = TestLabel "Debianization Tests" (TestList [-- 1 and 2 do not input a cabal package - we're not ready to+tests = TestLabel "Debianization Tests" (TestList [Bundled.tests,+ -- 1 and 2 do not input a cabal package - we're not ready to -- debianize without a cabal package. {- test1 "test1", test2 "test2", -}@@ -595,8 +607,8 @@ test6 label = TestLabel label $ TestCase (do dist <- findBuildDir- (code, out, _err) <- readProcessWithExitCode "runhaskell" ["--ghc-arg=-package-db=" ++ dist ++ "/package.conf.inplace", "test-data/artvaluereport2/input/debian/Debianize.hs", "--dry-run", "--verbose"] ""- assertEqual label (ExitSuccess, "") (code, out))+ (code, out, err) <- readProcessWithExitCode "runhaskell" ["--ghc-arg=-package-db=" ++ dist ++ "/package.conf.inplace", "test-data/artvaluereport2/input/debian/Debianize.hs", "--dry-run", "--verbose"] ""+ assertEqual label (ExitSuccess, "", err) (code, out, err)) test7 :: String -> Test test7 label =@@ -615,7 +627,9 @@ outTop = "test-data/artvaluereport-data/output" (old :: D.DebInfo) <- withCurrentDirectory outTop $ newFlags >>= execDebianT inputDebianization . D.makeDebInfo let log = view D.changelog old- new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= execCabalT (debianize (defaultAtoms >> customize log))+ new <- withCurrentDirectory inTop $+ newFlags >>= newCabalInfo >>=+ either (error "test8 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize log))) diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff )@@ -634,7 +648,9 @@ TestLabel label $ TestCase (do let inTop = "test-data/alex/input" outTop = "test-data/alex/output"- new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= execCabalT (debianize (defaultAtoms >> customize))+ new <- withCurrentDirectory inTop $+ newFlags >>= newCabalInfo >>=+ either (error "test9 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize))) let Just (ChangeLog (entry : _)) = view (debInfo . D.changelog) new old <- withCurrentDirectory outTop $ newFlags >>= execDebianT (inputDebianization >> copyChangelogDate (logDate entry)) . D.makeDebInfo diff <- diffDebianizations old (view debInfo new)@@ -674,7 +690,9 @@ outTop = "test-data/archive/output" old <- withCurrentDirectory outTop $ newFlags >>= execDebianT inputDebianization . D.makeDebInfo let Just (ChangeLog (entry : _)) = view D.changelog old- new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= execCabalT (debianize (defaultAtoms >> customize >> (liftCabal $ copyChangelogDate $ logDate entry)))+ new <- withCurrentDirectory inTop $+ newFlags >>= newCabalInfo >>=+ either (error "test10 - newCabalInfo failed") (execCabalT (debianize (defaultAtoms >> customize >> (liftCabal $ copyChangelogDate $ logDate entry)))) diff <- diffDebianizations old (view debInfo new) assertEmptyDiff label diff) where
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 4.33+Version: 4.35.3 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw License: BSD3 License-File: LICENSE@@ -245,7 +245,6 @@ Build-Depends: pretty < 1.1.2, prettyclass Test-Suite cabal-debian-tests- Buildable: False Default-Language: Haskell2010 Type: exitcode-stdio-1.0 Hs-Source-Dirs: .
changelog view
@@ -1,3 +1,30 @@+haskell-cabal-debian (4.35.3) unstable; urgency=low++ * Prefer haskell-devscripts-minimal to haskell-devscripts+ * Test suite seems ok++ -- David Fox <dsf@seereason.com> Fri, 25 Nov 2016 11:45:37 -0800++haskell-cabal-debian (4.35) unstable; urgency=low++ * Add support for the packages in hvr's compiler repository.+ * Revive the test suite++ -- David Fox <dsf@seereason.com> Sat, 19 Nov 2016 07:35:29 -0800++haskell-cabal-debian (4.34.1) unstable; urgency=low++ * That was a a terrible idea.++ -- David Fox <dsf@seereason.com> Sat, 12 Nov 2016 05:33:58 -0800++haskell-cabal-debian (4.34) unstable; urgency=low++ * Make sure the appropriate compiler package is installed before+ asking it what its version number is.++ -- David Fox <dsf@seereason.com> Fri, 11 Nov 2016 16:35:17 -0800+ haskell-cabal-debian (4.33) unstable; urgency=low * Remove code that tried to copy the changelog from debian/changelog
debian/Debianize.hs view
@@ -19,20 +19,38 @@ customize :: Monad m => CabalT m () customize = do debianDefaults+ -- Some obsolete fiddling around with mapping from cabal+ -- to debian package names. This would let you create+ -- Debian package names like libghc-cabal-122-dev, which+ -- can co-exist with the standard libghc-cabal-dev package.+ -- mapCabal (PackageName "Cabal") (DebBase "cabal-122") -- splitCabal (PackageName "Cabal") (DebBase "cabal") (Version [1,22] [])+ -- Force some values so they match the expected results rather than -- changing as new package versions arrive. (debInfo . control . maintainer) .= parseMaintainer "David Fox <dsf@seereason.com>" (debInfo . sourceFormat) .= Native3 (debInfo . control . standardsVersion) .= Just (StandardsVersion 3 9 3 Nothing) (debInfo . compat) .= Just 9+ (debInfo . control . homepage) .= Just (pack "https://github.com/ddssff/cabal-debian")++ -- Any left over files that need to be included will go into+ -- haskell-cabal-debian-utils. But in this case there+ -- should be none, so the package will not be created. (debInfo . utilsPackageNameBase) .= Just "cabal-debian"- (debInfo . binaryDebDescription (BinPkgName "cabal-debian") . relations . depends) %= (++ (rels "apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19)"))- (debInfo . binaryDebDescription (BinPkgName "libghc-cabal-debian-dev") . relations . depends) %= (++ (rels "debian-policy"))++ -- Add dependencies to the binary debs.+ (debInfo . binaryDebDescription (BinPkgName "cabal-debian") . relations . depends) %=+ (++ (rels "apt-file, debian-policy, debhelper, haskell-devscripts (>= 0.8.19)"))+ (debInfo . binaryDebDescription (BinPkgName "libghc-cabal-debian-dev") . relations . depends) %=+ (++ (rels "debian-policy"))++ -- Install the executable named in an Executable section of+ -- the cabal file into a the binary deb named cabal-debian,+ -- giving it the path /usr/bin/cabal-debian. (debInfo . atomSet) %= (Set.insert $ InstallCabalExec (BinPkgName "cabal-debian") "cabal-debian" "usr/bin")- (debInfo . utilsPackageNameBase) .= Just "cabal-debian"- (debInfo . control . homepage) .= Just (pack "https://github.com/ddssff/cabal-debian") +-- | Turn a string into a relation list on binary debs. rels :: String -> Relations rels = either (throw . userError . show) id . parseRelations
debian/control view
@@ -24,8 +24,8 @@ libghc-bifunctors-prof, libghc-data-default-dev, libghc-data-default-prof,- libghc-debian-dev (>= 3.89),- libghc-debian-prof (>= 3.89),+ libghc-debian-dev (>= 3.91),+ libghc-debian-prof (>= 3.91), libghc-exceptions-dev, libghc-exceptions-prof, libghc-hsemail-dev,
src/Debian/Debianize.hs view
@@ -92,6 +92,7 @@ -- * Utility functions , module Debian.Debianize.Prelude , module Debian.Debianize.VersionSplits+ , module Debian.GHC , module Debian.Policy ) where@@ -112,4 +113,5 @@ import Debian.Debianize.Prelude (buildDebVersionMap, debOfFile, dpkgFileMap, withCurrentDirectory, (.?=)) import Debian.Debianize.SourceDebDescription import Debian.Debianize.VersionSplits (DebBase(DebBase))+import Debian.GHC (CompilerChoice(..), CompilerVendor(..), hcVendor, hcFlavor) import Debian.Policy (accessLogBaseName, apacheAccessLog, apacheErrorLog, apacheLogDirectory, appLogBaseName, Area(..), databaseDirectory, debianPackageVersion, errorLogBaseName, fromCabalLicense, getCurrentDebianUser, getDebhelperCompatLevel, getDebianStandardsVersion, haskellMaintainer, License(..), PackageArchitectures(..), PackagePriority(..), MultiArch(..), parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readLicense, readPriority, readSection, readMultiArch, readSourceFormat, Section(..), serverAccessLog, serverAppLog, serverLogDirectory, SourceFormat(..), StandardsVersion(..), toCabalLicense)
src/Debian/Debianize/BasicInfo.hs view
@@ -11,7 +11,7 @@ , upgrade , roundtrip , validate- , compilerFlavor+ , compilerChoice , cabalFlagAssignments , buildEnv -- * State Monad@@ -25,6 +25,7 @@ import Data.Generics (Data, Typeable) import Data.Set as Set (fromList, Set, union) import Debian.Debianize.Prelude (read')+import Debian.GHC (CompilerChoice, hcFlavor) import Debian.Orphans () import Distribution.Compiler (CompilerFlavor(..)) import Distribution.PackageDescription as Cabal (FlagName(FlagName))@@ -53,7 +54,7 @@ -- configure is run. Specifically, the version number in the top -- changelog entry must match, and the sets of package names in -- the control file must match.- , _compilerFlavor :: CompilerFlavor+ , _compilerChoice :: CompilerChoice -- ^ Which compiler should we generate library packages for? In theory a single -- deb could handle multiple compiler flavors, but the support tools are not ready -- for this as of right now (28 Jan 2015.)@@ -96,13 +97,13 @@ "Carefully upgrade an existing debianization", Option "" ["roundtrip"] (NoArg (roundtrip .= True)) "Rountrip a debianization to normalize it",- Option "" ["ghc"] (NoArg (compilerFlavor .= GHC)) "Generate packages for GHC - same as --with-compiler GHC",+ Option "" ["ghc"] (NoArg ((compilerChoice . hcFlavor) .= GHC)) "Generate packages for GHC - same as --with-compiler GHC", #if MIN_VERSION_Cabal(1,22,0)- Option "" ["ghcjs"] (NoArg (compilerFlavor .= GHCJS)) "Generate packages for GHCJS - same as --with-compiler GHCJS",+ Option "" ["ghcjs"] (NoArg ((compilerChoice . hcFlavor) .= GHCJS)) "Generate packages for GHCJS - same as --with-compiler GHCJS", #endif- Option "" ["hugs"] (NoArg (compilerFlavor .= Hugs)) "Generate packages for Hugs - same as --with-compiler GHC",+ Option "" ["hugs"] (NoArg ((compilerChoice . hcFlavor) .= Hugs)) "Generate packages for Hugs - same as --with-compiler GHC", Option "" ["with-compiler"] (ReqArg (\ s -> maybe (error $ "Invalid compiler id: " ++ show s)- (\ hc -> compilerFlavor .= hc)+ (\ hc -> (compilerChoice . hcFlavor) .= hc) (readMaybe (map toUpper s) :: Maybe CompilerFlavor)) "COMPILER") (unlines [ "Generate packages for this CompilerFlavor" ]), Option "f" ["flags"] (ReqArg (\ fs -> cabalFlagAssignments %= (Set.union (Set.fromList (flagList fs)))) "FLAGS")
src/Debian/Debianize/BuildDependencies.hs view
@@ -16,7 +16,7 @@ import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe) import Data.Set as Set (empty, fold, fromList, map, member, Set, singleton, toList, union) import Data.Version (showVersion, Version)-import Debian.Debianize.BasicInfo (buildEnv, compilerFlavor, EnvSet(dependOS), verbosity)+import Debian.Debianize.BasicInfo (buildEnv, compilerChoice, EnvSet(dependOS), verbosity) import Debian.Debianize.Bundled (builtIn, hcVersion) import qualified Debian.Debianize.DebInfo as D import Debian.Debianize.DebianName (mkPkgName, mkPkgName')@@ -25,18 +25,17 @@ import qualified Debian.Debianize.CabalInfo as A import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (packageRangesFromVersionSplits)-import Debian.GHC (compilerPackageName)+import Debian.GHC (CompilerChoice(..), compilerPackageName) import Debian.Orphans () import Debian.Relation (BinPkgName(..), checkVersionReq, Relation(..), Relations) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..), Relations, VersionReq(EEQ, GRE, LTE, SGR, SLT)) import Debian.Version (DebianVersion, parseDebianVersion')-import Debug.Trace (trace) import Distribution.Compiler (CompilerFlavor(..)) import Distribution.Package (Dependency(..), PackageIdentifier(pkgName, pkgVersion), PackageName(PackageName)) import Distribution.PackageDescription (PackageDescription) import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..)) import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites))-import Distribution.Text (display)+--import Distribution.Text (display) import Distribution.Version (anyVersion, asVersionIntervals, earlierVersion, foldVersionRange', fromVersionIntervals, intersectVersionRanges, isNoVersion, laterVersion, orEarlierVersion, orLaterVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion) import Distribution.Version.Invert (invertVersionRange) import Prelude hiding (init, log, map, unlines, unlines, writeFile)@@ -107,8 +106,8 @@ -- the rules for building haskell packages. debianBuildDeps :: (Monad m, Functor m) => PackageDescription -> CabalT m D.Relations debianBuildDeps pkgDesc =- do hc <- use (A.debInfo . D.flags . compilerFlavor)- let hcs = singleton hc -- vestigial+ do hchoice <- use (A.debInfo . D.flags . compilerChoice)+ let hcs = singleton hchoice -- vestigial let hcTypePairsLibs = fold union empty $ Set.map (\ hc' -> Set.map (hc',) $ hcPackageTypesLibs hc') hcs@@ -136,46 +135,47 @@ official <- use (A.debInfo . D.official) compat <- use (A.debInfo . D.compat) let xs = nub $ [maybe [] (\ n -> [D.Rel (D.BinPkgName "debhelper") (Just (D.GRE (parseDebianVersion' (show n)))) Nothing]) compat,- [D.Rel (D.BinPkgName "haskell-devscripts") (Just $ D.GRE $ parseDebianVersion' $ if official then "0.9" else "0.8" :: String) Nothing],+ [D.Rel (D.BinPkgName "haskell-devscripts-minimal") Nothing Nothing,+ D.Rel (D.BinPkgName "haskell-devscripts") (Just $ D.GRE $ parseDebianVersion' $ if official then "0.9" else "0.8" :: String) Nothing], anyrel "cdbs"] ++- (if member GHC hcs- then [anyrel' (compilerPackageName GHC B.Development)] ++ if prof then [anyrel' (compilerPackageName GHC B.Profiling)] else []+ (if member GHC (Set.map _hcFlavor hcs)+ then [anyrel' (compilerPackageName hchoice B.Development)] ++ if prof then [anyrel' (compilerPackageName hchoice B.Profiling)] else [] else []) ++ #if MIN_VERSION_Cabal(1,22,0)- (if member GHCJS hcs then [anyrel "ghcjs"] else []) +++ (if member GHCJS (Set.map _hcFlavor hcs) then [anyrel "ghcjs"] else []) ++ #endif bDeps ++ cDeps filterMissing xs where- hcPackageTypesLibs :: CompilerFlavor -> Set B.PackageType- hcPackageTypesLibs GHC = fromList [B.Development, B.Profiling]+ hcPackageTypesLibs :: CompilerChoice -> Set B.PackageType+ hcPackageTypesLibs (CompilerChoice {_hcFlavor = GHC}) = fromList [B.Development, B.Profiling] #if MIN_VERSION_Cabal(1,22,0)- hcPackageTypesLibs GHCJS = fromList [B.Development]+ hcPackageTypesLibs (CompilerChoice {_hcFlavor = GHCJS}) = fromList [B.Development] #endif hcPackageTypesLibs hc = error $ "Unsupported compiler flavor: " ++ show hc -- No point in installing profiling packages for the dependencies -- of binaries and test suites- hcPackageTypesBins :: CompilerFlavor -> Set B.PackageType+ hcPackageTypesBins :: CompilerChoice -> Set B.PackageType hcPackageTypesBins _ = singleton B.Development - hcPackageTypesTests :: CompilerFlavor -> Set B.PackageType+ hcPackageTypesTests :: CompilerChoice -> Set B.PackageType hcPackageTypesTests _ = singleton B.Development debianBuildDepsIndep :: (Monad m, Functor m) => PackageDescription -> CabalT m D.Relations debianBuildDepsIndep pkgDesc =- do hc <- use (A.debInfo . D.flags . compilerFlavor)+ do hc <- use (A.debInfo . D.flags . compilerChoice) let hcs = singleton hc -- vestigial doc <- not <$> use (A.debInfo . D.noDocumentationLibrary) bDeps <- use (A.debInfo . D.control . S.buildDependsIndep) libDeps <- allBuildDepends (maybe [] (return . libBuildInfo) (Cabal.library pkgDesc)) cDeps <- mapM docDependencies libDeps let xs = nub $ if doc && isJust (Cabal.library pkgDesc)- then (if member GHC hcs then [anyrel' (compilerPackageName GHC B.Documentation)] else []) +++ then (if member GHC (Set.map _hcFlavor hcs) then [anyrel' (compilerPackageName hc B.Documentation)] else []) ++ #if MIN_VERSION_Cabal(1,22,0)- (if member GHCJS hcs then [anyrel "ghcjs"] else []) +++ (if member GHCJS (Set.map _hcFlavor hcs) then [anyrel "ghcjs"] else []) ++ #endif bDeps ++ concat cDeps else []@@ -186,7 +186,7 @@ -- dependencies, so we have use to all the cross references. docDependencies :: (Monad m, Functor m) => Dependency_ -> CabalT m D.Relations docDependencies (BuildDepends (Dependency name ranges)) =- do hc <- use (A.debInfo . D.flags . compilerFlavor)+ do hc <- use (A.debInfo . D.flags . compilerChoice) let hcs = singleton hc -- vestigial omitProfDeps <- use (A.debInfo . D.omitProfVersionDeps) concat <$> mapM (\ hc' -> dependencies hc' B.Documentation name ranges omitProfDeps) (toList hcs)@@ -195,7 +195,7 @@ -- | The Debian build dependencies for a package include the profiling -- libraries and the documentation packages, used for creating cross -- references. Also the packages associated with extra libraries.-buildDependencies :: (Monad m, Functor m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations+buildDependencies :: (Monad m, Functor m) => Set (CompilerChoice, B.PackageType) -> Dependency_ -> CabalT m D.Relations buildDependencies hcTypePairs (BuildDepends (Dependency name ranges)) = use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps -> concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)@@ -250,7 +250,7 @@ -- | Turn a cabal dependency into debian dependencies. The result -- needs to correspond to a single debian package to be installed, -- so we will return just an OrRelation.-dependencies :: Monad m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> Bool -> CabalT m Relations+dependencies :: Monad m => CompilerChoice -> B.PackageType -> PackageName -> VersionRange -> Bool -> CabalT m Relations dependencies hc typ name cabalRange omitProfVersionDeps = do nameMap <- use A.debianNameMap -- Compute a list of alternative debian dependencies for@@ -320,7 +320,7 @@ doBundled :: Monad m => B.PackageType -> PackageName- -> CompilerFlavor+ -> CompilerChoice -> [D.Relation] -> CabalT m [D.Relation] doBundled typ name hc rels =@@ -340,12 +340,14 @@ relInfo = builtIn hc root pver = listToMaybe $ fmap (debianVersion'' atoms) (filter ((== name) . pkgName) relInfo) v = view (A.debInfo . D.flags . verbosity) atoms+#if 0 case (v > 0, filter ((== name) . pkgName) relInfo) of (True, [i]) -> trace (" " ++ show hc ++ "-" ++ show (showVersion hcv) ++ " in " ++ root ++ " provides " ++ display (pkgName i) ++ "-" ++ display (pkgVersion i)) (return ()) (True, _) -> trace (" " ++ show hc ++ "-" ++ show (showVersion hcv) ++ " in " ++ root ++ " does not provide " ++ display name) (return ()) _ -> return ()+#endif -- The name this library would have if it was in the compiler conflicts list. let naiveDebianName = mkPkgName hc name typ -- The compiler should appear in the build dependency
src/Debian/Debianize/Bundled.hs view
@@ -16,56 +16,70 @@ , aptCacheConflicts , aptVersions , hcVersion+ , parseVersion'+ , tests ) where -import Control.Applicative ((<$>))+import Control.Applicative ((<$>), (<*>)) import Control.DeepSeq (force, NFData) import Control.Exception (SomeException, try) import Control.Monad.Catch (MonadMask) import Control.Monad.Trans (MonadIO)-import Data.Char (toLower)+import Data.Char (isAlphaNum, toLower) import Data.Function.Memoize (memoize2, memoize3)-import Data.List (groupBy, isPrefixOf, isSuffixOf)-import Data.Maybe (catMaybes, listToMaybe, mapMaybe)-import Data.Version (parseVersion, Version)-import Debian.GHC ()+import Data.List (groupBy, intercalate, isPrefixOf, stripPrefix)+import Data.Maybe (listToMaybe, mapMaybe)+import Data.Set as Set (difference, fromList)+import Data.Version (parseVersion, Version(..))+import Debian.GHC (CompilerChoice(..)) import Debian.Relation (BinPkgName(..)) import Debian.Relation.ByteString () import Debian.Version (DebianVersion, parseDebianVersion', prettyDebianVersion)-import Debug.Trace (trace) import Distribution.Package (PackageIdentifier(..), PackageName(..))-import Distribution.Simple.Compiler (CompilerFlavor(..))+#if MIN_VERSION_Cabal(1,22,0)+import Distribution.Simple.Compiler (CompilerFlavor(GHCJS))+#endif import System.IO.Unsafe (unsafePerformIO) import System.Process (readProcess, showCommandForUser) import System.Unix.Chroot (useEnv)-import Text.ParserCombinators.ReadP (readP_to_S)+import Test.HUnit (assertEqual, Test(TestList, TestCase))+import Text.ParserCombinators.ReadP (char, endBy1, munch1, ReadP, readP_to_S) import Text.Regex.TDFA ((=~)) +#if MIN_VERSION_base(4,8,0)+import Data.Version (makeVersion)+#else+import Data.Monoid (mempty)++unPackageName :: PackageName -> String+unPackageName (PackageName s) = s++makeVersion :: [Int] -> Version+makeVersion ns = Version ns []+#endif+ -- | Find out what version, if any, of a cabal library is built into -- the newest version of haskell compiler hc in environment root. -- This is done by looking for .conf files beneath a package.conf.d -- directory and parsing the name. (Probably better to actually read -- the .conf file.)-builtIn :: CompilerFlavor -> FilePath -> [PackageIdentifier]+builtIn :: CompilerChoice -> FilePath -> [PackageIdentifier] builtIn hc root = let Just hcname = (hcExecutablePath root hc >>= hcBinPkgName root) in aptCacheProvides hcname root -parseVersion' :: String -> Maybe Version-parseVersion' = listToMaybe . map fst . filter ((== "") . snd) . readP_to_S parseVersion- -- | Convert CompilerFlavor to an executable name in a way that works -- for at least the cases we are interested in. This might need to be -- fudged or replaced as more cases become interesting.-hcExecutable :: CompilerFlavor -> String-hcExecutable = map toLower . show+hcExecutable :: CompilerChoice -> String+hcExecutable = map toLower . show . _hcFlavor -- | Use which(1) to determine full path name to haskell compiler executable-hcExecutablePath :: FilePath -> CompilerFlavor -> Maybe FilePath+hcExecutablePath :: FilePath -> CompilerChoice -> Maybe FilePath hcExecutablePath = memoize2 $ \root hc -> listToMaybe $ lines $ unsafePerformIO $ chroot root (readProcess "which" [hcExecutable hc] "") -hcVersion :: FilePath -> CompilerFlavor -> Maybe Version+hcVersion :: FilePath -> CompilerChoice -> Maybe Version hcVersion root hc = let Just hcpath = hcExecutablePath root hc in maybe Nothing parseVersion' $@@ -73,7 +87,7 @@ lines $ unsafePerformIO . chroot root $ readProcess hcpath- [case hc of+ [case _hcFlavor hc of #if MIN_VERSION_Cabal(1,22,0) GHCJS -> "--numeric-ghc-version" #endif@@ -95,23 +109,24 @@ aptCacheProvides = memoize2 aptCacheProvides' where aptCacheProvides' hcname root =- {-trace ("aptCacheProvides " ++ show hcname ++ " in " ++ root ++ " -> " ++ show pis)-} pis- where pis = (catMaybes .- map parseLib .- filter (isSuffixOf ".conf") .- map last .- filter (elem "package.conf.d") .- map (groupBy (\a b -> (a == '/') == (b == '/')))) lns- lns = lines $ unsafePerformIO (chroot root (readProcess "dpkg" ["-L", unBinPkgName hcname] ""))- parseLib :: String -> Maybe PackageIdentifier- parseLib s =- case s =~ ("(.*)-([0-9.]*)-(.*).conf$") :: (String, String, String, [String]) of- (_, _, _, [cabalName, ver, _sum]) ->- case parseVersion' ver of- Just v -> Just (PackageIdentifier (PackageName cabalName) v)- _ -> Nothing- _ -> Nothing+ {-trace ("aptCacheProvides " ++ show hcname ++ " in " ++ root ++ " -> " ++ show pis)-}+ packageIdentifiers root hcname +packageIdentifiers :: String -> BinPkgName -> [PackageIdentifier]+packageIdentifiers root hcname =+ (mapMaybe parsePackageIdentifier' .+ mapMaybe (dropRequiredSuffix ".conf") .+ map last .+ filter (elem "package.conf.d") .+ map (groupBy (\a b -> (a == '/') == (b == '/')))) (binPkgFiles root hcname)++dropRequiredSuffix :: String -> String -> Maybe String+dropRequiredSuffix suff x =+ let (x', suff') = splitAt (length x - length suff) x in if suff == suff' then Just x' else Nothing++binPkgFiles :: String -> BinPkgName -> [FilePath]+binPkgFiles root hcname = lines $ unsafePerformIO (chroot root (readProcess "dpkg" ["-L", unBinPkgName hcname] ""))+ {- takeBetween :: (a -> Bool) -> (a -> Bool) -> [a] -> [a] takeBetween startPred endPred = takeWhile (not . endPred) . dropWhile startPred . dropWhile (not . startPred)@@ -135,11 +150,57 @@ aptCacheShowPkg :: FilePath -> BinPkgName -> Either SomeException String aptCacheShowPkg =- memoize2 (\ root hcname -> tr root hcname $ unsafePerformIO (try (chroot root (readProcess "apt-cache" ["showpkg", unBinPkgName hcname] ""))))- where- tr root hcname x = {-trace ("aptCacheShowPkg " ++ show hcname ++ " in " ++ show root ++ " -> " ++ show x)-} x+ memoize2 (\ root hcname -> unsafePerformIO (try (chroot root (readProcess "apt-cache" ["showpkg", unBinPkgName hcname] "")))) chroot :: (NFData a, MonadIO m, MonadMask m) => String -> m a -> m a chroot "/" = id chroot root = useEnv root (return . force)++-- | A package identifier is a package name followed by a dash and+-- then a version number. A package name, according to the cabal+-- users guide "can use letters, numbers and hyphens, but not spaces."+-- So be it.+parsePackageIdentifier :: ReadP PackageIdentifier+parsePackageIdentifier = do+ makeId <$> ((,) <$> endBy1 (munch1 isAlphaNum) (char '-') <*> parseVersion)+ where+ makeId :: ([String], Version) -> PackageIdentifier+ makeId (xs, v) = PackageIdentifier {pkgName = PackageName (intercalate "-" xs), pkgVersion = v}++parseMaybe :: ReadP a -> String -> Maybe a+parseMaybe p = listToMaybe . map fst . filter ((== "") . snd) . readP_to_S p++parseVersion' :: String -> Maybe Version+parseVersion' = parseMaybe parseVersion++parsePackageIdentifier' :: String -> Maybe PackageIdentifier+parsePackageIdentifier' = parseMaybe parsePackageIdentifier++tests :: Test+tests = TestList [ TestCase (assertEqual "Bundled1"+ (Just (PackageIdentifier (PackageName "HUnit") (makeVersion [1,2,3])))+ (parseMaybe parsePackageIdentifier "HUnit-1.2.3"))+ , TestCase (assertEqual "Bundled2"+ Nothing+ (parseMaybe parsePackageIdentifier "HUnit-1.2.3 "))+ , TestCase $ do+ ghc <- (head . lines) <$> readProcess "which" ["ghc"] ""+ let ver = fmap (takeWhile (/= '/')) (stripPrefix "/opt/ghc/" ghc)+ let expected =+ (Set.fromList+ -- This is the package list for ghc-7.10.3+ ["array", "base", "binary", "bin-package-db", "bytestring", "Cabal",+ "containers", "deepseq", "directory", "filepath", "ghc", "ghc-prim",+ "haskeline", "hoopl", "hpc", "integer-gmp", "pretty", "process",+ "template-haskell", "terminfo", "time", "transformers", "unix", "xhtml"])+ actual = Set.fromList (map (unPackageName . pkgName) (aptCacheProvides (BinPkgName ("ghc" ++ maybe "" ("-" ++) ver)) "/"))+ missing (Just "8.0.2") = Set.fromList ["bin-package-db"]+ missing _ = mempty+ extra (Just "7.8.4") = Set.fromList ["haskell2010","haskell98","old-locale","old-time"]+ extra (Just "8.0.2") = Set.fromList ["ghc-boot","ghc-boot-th","ghci"]+ extra _ = mempty+ assertEqual "Bundled4"+ (missing ver, extra ver)+ (Set.difference expected actual, Set.difference actual expected)+ ]
src/Debian/Debianize/CabalInfo.hs view
@@ -14,6 +14,9 @@ , newCabalInfo ) where +#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#endif import Control.Lens import Control.Monad.Catch (MonadMask) import Control.Monad.State (execStateT)@@ -72,16 +75,18 @@ -- | Given the 'Flags' value read the cabalization and build a new -- 'CabalInfo' record.-newCabalInfo :: (MonadIO m, MonadMask m) => Flags -> m CabalInfo-newCabalInfo flags' = withProcAndSys "/" $ do- pkgDesc <- inputCabalization flags'- copyrt <- liftIO $ defaultCopyrightDescription pkgDesc- execStateT- (do (debInfo . copyright) .= Just copyrt- (debInfo . control . S.homepage) .= case strip (pack (Cabal.homepage pkgDesc)) of- x | Text.null x -> Nothing- x -> Just x)- (makeCabalInfo flags' pkgDesc)+newCabalInfo :: (MonadIO m, MonadMask m, Functor m) => Flags -> m (Either String CabalInfo)+newCabalInfo flags' =+ withProcAndSys "/" $ inputCabalization flags' >>= either (return . Left) (\p -> Right <$> doPkgDesc p)+ where+ doPkgDesc pkgDesc = do+ copyrt <- liftIO $ defaultCopyrightDescription pkgDesc+ execStateT+ (do (debInfo . copyright) .= Just copyrt+ (debInfo . control . S.homepage) .= case strip (pack (Cabal.homepage pkgDesc)) of+ x | Text.null x -> Nothing+ x -> Just x)+ (makeCabalInfo flags' pkgDesc) makeCabalInfo :: Flags -> PackageDescription -> CabalInfo makeCabalInfo fs pkgDesc =
src/Debian/Debianize/DebianName.hs view
@@ -22,6 +22,7 @@ import Debian.Debianize.BinaryDebDescription as Debian (PackageType(..)) import Debian.Debianize.DebInfo as D (overrideDebianNameBase, utilsPackageNameBase) import Debian.Debianize.VersionSplits (DebBase(DebBase, unDebBase), doSplits, insertSplit, makePackage, VersionSplits(oldestPackage, splits))+import Debian.GHC (CompilerChoice(..)) import Debian.Orphans () import Debian.Relation (PkgName(..), Relations) import qualified Debian.Relation as D (VersionReq(EEQ))@@ -39,14 +40,14 @@ deriving (Eq, Show) -- | Build the Debian package name for a given package type.-debianName :: (Monad m, Functor m, PkgName name) => PackageType -> CompilerFlavor -> CabalT m name-debianName typ cfl =+debianName :: (Monad m, Functor m, PkgName name) => PackageType -> CompilerChoice -> CabalT m name+debianName typ hc@(CompilerChoice {_hcFlavor = cfl}) = do base <- case (typ, cfl) of (Utilities, GHC) -> use (debInfo . utilsPackageNameBase) >>= maybe (((\ base -> "haskell-" ++ base ++ "-utils") . unDebBase) <$> debianNameBase) return (Utilities, _) -> use (debInfo . utilsPackageNameBase) >>= maybe (((\ base -> base ++ "-utils") . unDebBase) <$> debianNameBase) return _ -> unDebBase <$> debianNameBase- return $ mkPkgName' cfl typ (DebBase base)+ return $ mkPkgName' hc typ (DebBase base) -- | Function that applies the mapping from cabal names to debian -- names based on version numbers. If a version split happens at v,@@ -69,11 +70,11 @@ -- debian package type. Unfortunately, this does not enforce the -- correspondence between the PackageType value and the name type, so -- it can return nonsense like (SrcPkgName "libghc-debian-dev").-mkPkgName :: PkgName name => CompilerFlavor -> PackageName -> PackageType -> name-mkPkgName cfl pkg typ = mkPkgName' cfl typ (debianBaseName pkg)+mkPkgName :: PkgName name => CompilerChoice -> PackageName -> PackageType -> name+mkPkgName hc pkg typ = mkPkgName' hc typ (debianBaseName pkg) -mkPkgName' :: PkgName name => CompilerFlavor -> PackageType -> DebBase -> name-mkPkgName' cfl typ (DebBase base) =+mkPkgName' :: PkgName name => CompilerChoice -> PackageType -> DebBase -> name+mkPkgName' (CompilerChoice {_hcFlavor = cfl}) typ (DebBase base) = pkgNameFromString $ case typ of Documentation -> prefix ++ base ++ "-doc"
src/Debian/Debianize/Finalize.hs view
@@ -24,7 +24,7 @@ import Data.Set.Extra as Set (mapM_) import Data.Text as Text (intercalate, pack, Text, unlines, unpack) import Debian.Changes (ChangeLog(..), ChangeLogEntry(..))-import Debian.Debianize.BasicInfo (cabalFlagAssignments, compilerFlavor, verbosity)+import Debian.Debianize.BasicInfo (cabalFlagAssignments, compilerChoice, verbosity) import qualified Debian.Debianize.BinaryDebDescription as B import Debian.Debianize.BuildDependencies (debianBuildDeps, debianBuildDepsIndep) import qualified Debian.Debianize.CabalInfo as A@@ -37,6 +37,7 @@ import Debian.Debianize.Prelude ((.?=)) import qualified Debian.Debianize.SourceDebDescription as S import Debian.Debianize.VersionSplits (DebBase(DebBase))+import Debian.GHC (CompilerChoice, hcFlavor) import Debian.Orphans () import Debian.Policy (getCurrentDebianUser, getDebhelperCompatLevel, haskellMaintainer, maintainerOfLastResort, PackageArchitectures(Any, All), PackagePriority(Extra), parseMaintainer, parseStandardsVersion, Section(..), SourceFormat(Native3)) import Debian.Pretty (PP(..), ppShow)@@ -93,7 +94,7 @@ finalizeDebianization' :: (Monad m, Functor m) => String -> Maybe NameAddr -> Maybe Int -> Bool -> CabalT m () finalizeDebianization' date currentUser debhelperCompat setupExists = do -- In reality, hcs must be a singleton or many things won't work. But some day...- hc <- use (A.debInfo . D.flags . compilerFlavor)+ hc <- use (A.debInfo . D.flags . compilerChoice) pkgDesc <- use A.packageDescription testsStatus <- use (A.debInfo . D.testsStatus)@@ -107,7 +108,7 @@ _ -> return () finalizeSourceName B.HaskellSource- checkOfficialSettings hc+ checkOfficialSettings (view hcFlavor hc) addExtraLibDependencies hc (A.debInfo . D.watch) .?= Just (watchAtom (pkgName $ Cabal.package $ pkgDesc)) (A.debInfo . D.control . S.section) .?= Just (MainSection "haskell")@@ -329,7 +330,7 @@ -- | Convert the extraLibs field of the cabal build info into debian -- binary package names and make them dependendencies of the debian -- devel package (if there is one.)-addExtraLibDependencies :: (Monad m, Functor m) => CompilerFlavor -> CabalT m ()+addExtraLibDependencies :: (Monad m, Functor m) => CompilerChoice -> CabalT m () addExtraLibDependencies hc = do pkgDesc <- use A.packageDescription devName <- debianName B.Development hc@@ -412,16 +413,16 @@ B.provides %= (anyrel "${haskell:Provides}" :) -- | Add the library paragraphs for a particular compiler flavor.-librarySpecs :: (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> CabalT m ()+librarySpecs :: (Monad m, Functor m) => PackageDescription -> CompilerChoice -> CabalT m () librarySpecs pkgDesc hc = do let dev = isJust (Cabal.library pkgDesc) doc <- get >>= return . not . view (A.debInfo . D.noDocumentationLibrary) prof <- get >>= return . not . view (A.debInfo . D.noProfilingLibrary) when dev (librarySpec Any B.Development hc)- when (dev && prof && hc == GHC) (librarySpec Any B.Profiling hc)+ when (dev && prof && view hcFlavor hc == GHC) (librarySpec Any B.Profiling hc) when (dev && doc) (docSpecsParagraph hc) -docSpecsParagraph :: (Monad m, Functor m) => CompilerFlavor -> CabalT m ()+docSpecsParagraph :: (Monad m, Functor m) => CompilerChoice -> CabalT m () docSpecsParagraph hc = do b <- debianName B.Documentation hc binaryPackageRelations b B.Documentation@@ -431,7 +432,7 @@ (A.debInfo . D.binaryDebDescription b . B.binarySection) .?= Just (MainSection "doc") (A.debInfo . D.binaryDebDescription b . B.description) .?= Just desc -librarySpec :: (Monad m, Functor m) => PackageArchitectures -> B.PackageType -> CompilerFlavor -> CabalT m ()+librarySpec :: (Monad m, Functor m) => PackageArchitectures -> B.PackageType -> CompilerChoice -> CabalT m () librarySpec arch typ hc = do b <- debianName typ hc binaryPackageRelations b typ@@ -455,7 +456,7 @@ -- files, assign them to the packages returned by the -- utilsPackageNames lens, and make sure those packages are in the -- source deb description.-makeUtilsPackage :: forall m. (Monad m, Functor m) => PackageDescription -> CompilerFlavor -> CabalT m ()+makeUtilsPackage :: forall m. (Monad m, Functor m) => PackageDescription -> CompilerChoice -> CabalT m () makeUtilsPackage pkgDesc hc = do -- Files the cabal package expects to be installed -- Files that are already assigned to any binary deb@@ -518,7 +519,7 @@ expandAtoms :: Monad m => CabalT m () expandAtoms =- do hc <- use (A.debInfo . D.flags . compilerFlavor)+ do hc <- use (A.debInfo . D.flags . compilerChoice . hcFlavor) case hc of GHC -> (A.debInfo . D.flags . cabalFlagAssignments) %= (Set.union (Set.fromList (flagList "--ghc"))) #if MIN_VERSION_Cabal(1,22,0)@@ -556,7 +557,7 @@ -- Turn A.InstallCabalExec into A.Install expandInstallCabalExecs :: Monad m => FilePath -> CabalT m () expandInstallCabalExecs builddir = do- hc <- use (A.debInfo . D.flags . compilerFlavor)+ hc <- use (A.debInfo . D.flags . compilerChoice . hcFlavor) use (A.debInfo . D.atomSet) >>= Set.mapM_ (doAtom hc) where doAtom :: Monad m => CompilerFlavor -> D.Atom -> CabalT m ()@@ -576,7 +577,7 @@ -- Turn A.InstallCabalExecTo into a make rule expandInstallCabalExecTo :: Monad m => FilePath -> CabalT m () expandInstallCabalExecTo builddir = do- hc <- use (A.debInfo . D.flags . compilerFlavor)+ hc <- use (A.debInfo . D.flags . compilerChoice . hcFlavor) use (A.debInfo . D.atomSet) >>= Set.mapM_ (doAtom hc) where doAtom :: Monad m => CompilerFlavor -> D.Atom -> CabalT m ()@@ -653,7 +654,7 @@ finalizeRules :: (Monad m, Functor m) => CabalT m () finalizeRules = do DebBase b <- debianNameBase- compiler <- use (A.debInfo . D.flags . compilerFlavor)+ compiler <- use (A.debInfo . D.flags . compilerChoice . hcFlavor) (A.debInfo . D.rulesHead) .?= Just "#!/usr/bin/make -f" (A.debInfo . D.rulesSettings) %= (++ ["DEB_CABAL_PACKAGE = " <> pack b]) (A.debInfo . D.rulesSettings) %= (++ (["DEB_DEFAULT_COMPILER = " <> pack (List.map toLower (show compiler))]))
src/Debian/Debianize/InputCabal.hs view
@@ -1,23 +1,30 @@ -- | Input the Cabal package description.-{-# LANGUAGE CPP, DeriveDataTypeable, TemplateHaskell #-}+{-# LANGUAGE CPP, DeriveDataTypeable, ScopedTypeVariables, TemplateHaskell #-} module Debian.Debianize.InputCabal ( inputCabalization ) where - import Control.Exception (bracket)-import Control.Lens+import Control.Lens (view) import Control.Monad (when) import Control.Monad.Trans (MonadIO, liftIO)+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#endif import Data.Set as Set (toList)-import Debian.Debianize.BasicInfo (Flags, buildEnv, dependOS, verbosity, compilerFlavor, cabalFlagAssignments)+import Debian.Debianize.BasicInfo (Flags, buildEnv, dependOS, verbosity, compilerChoice, cabalFlagAssignments) import Debian.Debianize.Prelude (intToVerbosity')+import Debian.GHC (hcFlavor) #if MIN_VERSION_Cabal(1,22,0) import Debian.GHC (getCompilerInfo) #else import Debian.GHC (newestAvailableCompilerId) #endif import Debian.Orphans ()+import Distribution.Compiler (CompilerId)+#if MIN_VERSION_Cabal(1,22,0)+import Distribution.Compiler (CompilerInfo)+#endif import Distribution.Package (Package(packageId)) import Distribution.PackageDescription as Cabal (PackageDescription) import Distribution.PackageDescription.Configuration (finalizePackageDescription)@@ -33,33 +40,45 @@ import System.Process (system) import System.Unix.Mount (WithProcAndSys) +#if !MIN_VERSION_Cabal(1,22,0)+type CompilerInfo = CompilerId+#endif+ -- | Load a PackageDescription using the information in the Flags record - -- in particular, using the dependency environment in the EnvSet, find -- the newest available compiler of the requested compiler flavor and -- use that information load the configured PackageDescription.-inputCabalization :: MonadIO m => Flags -> WithProcAndSys m PackageDescription+inputCabalization :: forall m. (MonadIO m, Functor m) => Flags -> WithProcAndSys m (Either String PackageDescription) inputCabalization flags =- do let root = dependOS $ view buildEnv flags- let vb = intToVerbosity' $ view verbosity flags- fs = view cabalFlagAssignments flags- -- Load a GenericPackageDescription from the current directory and- -- from that create a finalized PackageDescription for the given- -- CompilerId.- genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readPackageDescription vb+ getCompInfo flags >>= either (return . Left) (\cinfo -> Right <$> doCompInfo cinfo)+ where+ doCompInfo :: CompilerInfo -> WithProcAndSys m PackageDescription+ doCompInfo cinfo = do+ -- Load a GenericPackageDescription from the current directory+ -- and from that create a finalized PackageDescription for the+ -- given CompilerId.+ genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readPackageDescription vb+ let finalized = finalizePackageDescription (toList fs) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc+ ePkgDesc <- either (return . Left)+ (\ (pkgDesc, _) -> do liftIO $ bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> autoreconf vb pkgDesc+ return (Right pkgDesc))+ finalized+ either (\ deps -> liftIO getCurrentDirectory >>= \ here ->+ error $ "Missing dependencies in cabal package at " ++ here ++ ": " ++ show deps)+ return+ ePkgDesc+ vb = intToVerbosity' $ view verbosity flags+ fs = view cabalFlagAssignments flags++getCompInfo :: MonadIO m => Flags -> WithProcAndSys m (Either String CompilerInfo)+getCompInfo flags = #if MIN_VERSION_Cabal(1,22,0)- cinfo <- getCompilerInfo root (view compilerFlavor flags)+ getCompilerInfo root (view (compilerChoice . hcFlavor) flags) #else- let cinfo = newestAvailableCompilerId root (view compilerFlavor flags)+ return $ newestAvailableCompilerId root (view compilerChoice flags) #endif- let finalized = finalizePackageDescription (toList fs) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc- ePkgDesc <- either (return . Left)- (\ (pkgDesc, _) -> do liftIO $ bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> autoreconf vb pkgDesc- return (Right pkgDesc))- finalized- either (\ deps -> liftIO getCurrentDirectory >>= \ here ->- error $ "Missing dependencies in cabal package at " ++ here ++ ": " ++ show deps)- return- ePkgDesc+ where+ root = dependOS $ view buildEnv flags -- | Run the package's configuration script. autoreconf :: Verbosity -> Cabal.PackageDescription -> IO ()
src/Debian/Debianize/InputDebian.hs view
@@ -18,7 +18,7 @@ import Data.Char (isSpace) import Data.Map as Map (insert, insertWith) import Data.Maybe (fromMaybe)-import Data.Monoid ((<>))+import Data.Monoid ((<>), mappend) import Data.Set as Set (fromList, insert, singleton) import Data.Text (break, lines, null, pack, strip, Text, unpack, words) import Data.Text.IO (readFile)@@ -184,8 +184,8 @@ doPaths ["CHANGELOG", "ChangeLog", "changelog", "debian/changelog"] where doPaths :: [FilePath] -> IO (Maybe ChangeLog)- doPaths (p : ps) = doPath p >>= maybe (doPaths ps) (\log -> putStrLn ("Found valid changelog at " ++ p) >> return (Just log))- doPaths [] = pure Nothing+ doPaths (p : ps) = doPath p >>= maybe (doPaths ps) (\log -> {-putStrLn ("Found valid changelog at " ++ p) >>-} return (Just log))+ doPaths [] = return Nothing doPath :: FilePath -> IO (Maybe ChangeLog) doPath p = do t <- tryIOError (readFile p)@@ -193,9 +193,9 @@ where doParse :: Text -> IO (Maybe ChangeLog) doParse t = do- pure $ either (const Nothing) Just (parseChangeLog (unpack t))+ return $ either (const Nothing) Just (parseChangeLog (unpack t)) doExn :: IOError -> IO (Maybe ChangeLog)- doExn e | isDoesNotExistError e = pure Nothing+ doExn e | isDoesNotExistError e = return Nothing doExn e = error ("inputChangelog: " ++ show e) inputCabalInfoFromDirectory :: MonadIO m => DebianT m () -- .install files, .init files, etc.
src/Debian/Debianize/Optparse.hs view
@@ -3,8 +3,10 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} module Debian.Debianize.Optparse ( CommandLineOptions(..),@@ -17,7 +19,7 @@ import Control.Lens import Control.Monad.State.Class (MonadState) import Control.Monad.Trans-import Control.Newtype+import "newtype-generics" Control.Newtype import Data.Bifunctor (first) import Data.Char(toUpper) import Data.Foldable (forM_)@@ -25,11 +27,14 @@ import Data.Maybe.Extended (fromMaybe) import Data.Maybe.Extended (nothingIf) import Data.Monoid ((<>))+import Data.Version (Version, parseVersion) import Debian.Debianize.BasicInfo+import Debian.Debianize.Bundled (parseVersion') import Debian.Debianize.DebInfo (TestsStatus(..)) import Debian.Debianize.Monad import Debian.Debianize.Prelude (maybeRead) import Debian.Debianize.VersionSplits+import Debian.GHC (CompilerChoice(..), CompilerVendor(..)) import Debian.Policy import Debian.Relation import Debian.Version (DebianVersion, parseDebianVersion')@@ -41,6 +46,7 @@ import System.FilePath(splitFileName, (</>)) import System.Posix.Env (getEnv) import System.Process (showCommandForUser)+import Text.ParserCombinators.ReadP (readP_to_S) import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..)) import Text.PrettyPrint.ANSI.Leijen (linebreak, (<+>), string, indent) import qualified Debian.Debianize.DebInfo as D@@ -518,7 +524,7 @@ <*> upgradeP <*> roundtripP <*> pure False -- validate- <*> ghcjsP -- CompilerFlavor+ <*> (CompilerChoice <$> hvrghcP <*> ghcjsP) -- CompilerChoice <*> (flagSet <$> cabalFlagsP) -- cabalFlagAssignments <*> buildEnvDirP where@@ -560,6 +566,16 @@ helpMsg = unlines [ "Roundtrip a debianization to normalize it." ]++versionR :: O.ReadM Version+versionR = (maybe (error "Invalid compiler version") id . parseVersion') <$> O.str++hvrghcP :: O.Parser CompilerVendor+hvrghcP = O.option (HVR <$> versionR) m where+ m = O.help "Use HVR's debian repository"+ <> O.long "hvr-version"+ <> O.value Debian+ <> O.metavar "VERSION" ghcjsP :: O.Parser CompilerFlavor ghcjsP = O.flag GHC
src/Debian/Debianize/Output.hs view
@@ -75,11 +75,19 @@ -- this function does everything else. performDebianization :: CabalT IO () -> IO () performDebianization custom =- parseProgramArguments >>= \CommandLineOptions {..} ->- newCabalInfo _flags >>= (evalCabalT $ do+ parseProgramArguments >>= \CommandLineOptions {..} -> do+ -- _ <- try (readProcessWithExitCode "apt-get" ["install", "-y", "--force-yes", hcDeb (view compilerFlavor _flags)] "")+ newCabalInfo _flags >>= either+ (error . ("peformDebianization - " ++))+ (evalCabalT $ do handleBehaviorAdjustment _adjustment debianize custom finishDebianization)++-- hcDeb :: CompilerFlavor -> String+-- hcDeb GHC = "ghc"+-- hcDeb GHCJS = "ghcjs"+-- hcDeb flavor = error $ "hcDeb - unexpected CompilerFlavor: " ++ show flavor -- | Depending on the options in @atoms@, either validate, describe, -- or write the generated debianization.
src/Debian/GHC.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables, TemplateHaskell #-}+{-# LANGUAGE CPP, DeriveDataTypeable, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.GHC ( withCompilerVersion@@ -9,6 +9,14 @@ -- , ghcNewestAvailableVersion' -- , ghcNewestAvailableVersion -- , compilerIdFromDebianVersion+ , CompilerVendor (Debian, HVR)+ , hvrCabalVersion+ , hvrHappyVersion+ , hvrAlexVersion+ , compilerPATH+ , withCompilerPATH+ , withModifiedPATH+ , CompilerChoice(..), hcVendor, hcFlavor , compilerPackageName #if MIN_VERSION_Cabal(1,22,0) , getCompilerInfo@@ -16,13 +24,14 @@ ) where import Control.DeepSeq (force)-import Control.Exception (SomeException, try)-import Control.Monad (when)+import Control.Exception (SomeException, throw, try)+import Control.Lens (makeLenses) import Control.Monad.Trans (MonadIO, liftIO)-import Data.Char ({-isSpace, toLower,-} toUpper)+import Data.Char (isSpace, {-toLower,-} toUpper) import Data.Function.Memoize (deriveMemoizable, memoize2)-import Data.Maybe (fromMaybe)-import Data.Version (showVersion, Version(Version), parseVersion)+import Data.Generics (Data, Typeable)+import Data.List (intercalate)+import Data.Version (showVersion, Version(..), parseVersion) import Debian.Debianize.BinaryDebDescription (PackageType(..)) import Debian.Relation (BinPkgName(BinPkgName)) import Debian.Version (DebianVersion, parseDebianVersion')@@ -32,7 +41,10 @@ #endif import System.Console.GetOpt (ArgDescr(ReqArg), OptDescr(..)) import System.Directory (doesDirectoryExist)-import System.Exit (ExitCode(ExitFailure))+import System.Environment (getEnv, setEnv)+import System.Exit (ExitCode(ExitFailure, ExitSuccess))+-- import System.IO (hPutStrLn, stderr)+import System.IO.Error (isDoesNotExistError) import System.IO.Unsafe (unsafePerformIO) import System.Process (readProcess, showCommandForUser, readProcessWithExitCode) import System.Unix.Chroot (useEnv, fchroot)@@ -41,42 +53,101 @@ import Text.Read (readMaybe) $(deriveMemoizable ''CompilerFlavor)+$(deriveMemoizable ''Version) $(deriveMemoizable ''BinPkgName)+deriving instance Data CompilerVendor+deriving instance Typeable CompilerVendor -withCompilerVersion :: FilePath -> CompilerFlavor -> (DebianVersion -> a) -> a+-- | Up until now this system only worked with Debian's or Ubuntu's+-- ghc source package, which has binary package names ghc, ghc-prof,+-- ghc-doc, etc. This type is intended to add support for Herbert+-- Valerio Riedel's (hvr's) repository of several different versions+-- of ghc and supporting tools happy, alex and cabal. These have+-- different binary package names, and the packages put the+-- executables in different locations than the Debian (and Ubuntu)+-- packages. This option is activated by the --hvr-version option to+-- cabal-debian.+data CompilerChoice =+ CompilerChoice { _hcVendor :: CompilerVendor+ , _hcFlavor :: CompilerFlavor+ } deriving (Eq, Ord, Show, Data, Typeable)+data CompilerVendor = Debian | HVR Version deriving (Eq, Ord, Show)++withCompilerVersion :: FilePath -> CompilerChoice -> (Either String DebianVersion -> a) -> a withCompilerVersion root hc f = f (newestAvailableCompiler root hc) +withCompilerPATH :: MonadIO m => CompilerVendor -> m a -> m a+withCompilerPATH vendor action = withModifiedPATH (compilerPATH vendor) action++compilerPATH :: CompilerVendor -> String -> String+compilerPATH vendor path0 = do+ case vendor of+ Debian -> path0+ HVR v -> (intercalate ":" ["/opt/ghc/" ++ showVersion v ++ "/bin",+ "/opt/cabal/" ++ showVersion (hvrCabalVersion v) ++ "/bin",+ "/opt/happy/" ++ showVersion (hvrHappyVersion v) ++ "/bin",+ "/opt/alex/" ++ showVersion (hvrAlexVersion v) ++ "/bin",+ path0])++-- | What version of Cabal goes with this version of GHC?+hvrCabalVersion :: Version -> Version+hvrCabalVersion (Version (m : n : _) _) | (m == 7 && n <= 7) || m < 7 = Version [1,16] []+hvrCabalVersion (Version (7 : n : _) _) | n <= 9 = Version [1,18] []+hvrCabalVersion (Version (7 : _) _) = Version [1,22] []+hvrCabalVersion _ = Version [1,24] []++-- | What version of Happy goes with this version of GHC?+hvrHappyVersion :: Version -> Version+hvrHappyVersion (Version (m : n : _) _) | (m == 7 && n <= 3) || m < 7 = Version [1,19,3] []+hvrHappyVersion (Version (7 : n : _) _) | n <= 2 = Version [1,19,3] []+hvrHappyVersion _ = Version [1,19,5] []++-- | What version of Alex goes with this version of GHC?+hvrAlexVersion :: Version -> Version+hvrAlexVersion _ = Version [3,1,7] []++withModifiedPATH :: MonadIO m => (String -> String) -> m a -> m a+withModifiedPATH f action = do+ path0 <- liftIO $ getEnv "PATH"+ liftIO $ setEnv "PATH" (f path0)+ -- liftIO $ hPutStrLn stderr $ "*** withCompilerPath vendor=" ++ show vendor+ -- liftIO $ hPutStrLn stderr $ "*** Setting $PATH to " ++ show path+ r <- action+ -- liftIO $ hPutStrLn stderr $ "*** Resetting $PATH to " ++ show path0+ liftIO $ setEnv "PATH" path0+ return r+ -- | Memoized version of newestAvailable'-newestAvailable :: FilePath -> BinPkgName -> Maybe DebianVersion+newestAvailable :: FilePath -> BinPkgName -> Either String DebianVersion newestAvailable root pkg = memoize2 f pkg root where- f :: BinPkgName -> FilePath -> Maybe DebianVersion+ f :: BinPkgName -> FilePath -> Either String DebianVersion f pkg' root' = unsafePerformIO (newestAvailable' root' pkg') -- | Look up the newest version of a deb available in the given changeroot.-newestAvailable' :: FilePath -> BinPkgName -> IO (Maybe DebianVersion)+newestAvailable' :: FilePath -> BinPkgName -> IO (Either String DebianVersion) newestAvailable' root (BinPkgName name) = do exists <- doesDirectoryExist root- when (not exists) (error $ "newestAvailable: no such environment: " ++ show root)- versions <- try $ chroot root $- (readProcess "apt-cache" ["showpkg", name] "" >>=- return . dropWhile (/= "Versions: ") . lines) :: IO (Either SomeException [String])- case versions of- Left e -> error $ "newestAvailable failed in " ++ show root ++ ": " ++ show e- Right (_ : versionLine : _) -> return . Just . parseDebianVersion' . takeWhile (/= ' ') $ versionLine- _ -> return Nothing- where- chroot "/" = id- chroot _ = useEnv root (return . force)+ case exists of+ False -> return $ Left $ "newestAvailable: no such environment: " ++ show root+ True -> do+ versions <- try $ chroot root $+ (readProcess "apt-cache" ["showpkg", name] "" >>=+ return . dropWhile (/= "Versions: ") . lines) :: IO (Either SomeException [String])+ case versions of+ Left e -> return $ Left $ "newestAvailable failed in " ++ show root ++ ": " ++ show e+ Right (_ : versionLine : _) -> return . Right . parseDebianVersion' . takeWhile (/= ' ') $ versionLine+ Right x -> return $ Left $ "Unexpected result from apt-cache showpkg: " ++ show x+ where+ chroot "/" = id+ chroot _ = useEnv root (return . force) -newestAvailableCompiler :: FilePath -> CompilerFlavor -> DebianVersion-newestAvailableCompiler root hc =- fromMaybe (error $ "newestAvailableCompiler - No versions of " ++ show hc ++ " available in " ++ show root)- (newestAvailable root (compilerPackageName hc Development))+newestAvailableCompiler :: FilePath -> CompilerChoice -> Either String DebianVersion+newestAvailableCompiler root hc = newestAvailable root (compilerPackageName hc Development) -newestAvailableCompilerId :: FilePath -> CompilerFlavor -> CompilerId-newestAvailableCompilerId root hc = compilerIdFromDebianVersion hc (newestAvailableCompiler root hc)+newestAvailableCompilerId :: FilePath -> CompilerChoice -> Either String CompilerId+newestAvailableCompilerId root hc@(CompilerChoice _ flavor) = fmap (compilerIdFromDebianVersion flavor) (newestAvailableCompiler root hc) {- -- | The IO portion of ghcVersion. For there to be no version of ghc@@ -143,48 +214,70 @@ s -> Just (BinPkgName s) -} -compilerPackageName :: CompilerFlavor -> PackageType -> BinPkgName-compilerPackageName GHC Documentation = BinPkgName "ghc-doc" -- "ghc-7.10.1-htmldocs"-compilerPackageName GHC Profiling = BinPkgName "ghc-prof" -- "ghc-7.10.1-prof"-compilerPackageName GHC Development = BinPkgName "ghc" -- "ghc-7.10.1"-compilerPackageName GHC _ = BinPkgName "ghc" -- "ghc-7.10.1" -- whatevs+compilerPackageName :: CompilerChoice -> PackageType -> BinPkgName+compilerPackageName (CompilerChoice Debian GHC) Documentation = BinPkgName "ghc-doc"+compilerPackageName (CompilerChoice Debian GHC) Profiling = BinPkgName "ghc-prof"+compilerPackageName (CompilerChoice Debian GHC) Development = BinPkgName "ghc"+compilerPackageName (CompilerChoice Debian GHC) _ = BinPkgName "ghc" -- whatevs+compilerPackageName (CompilerChoice (HVR v) GHC) Documentation = BinPkgName ("ghc-" ++ showVersion v ++ "-htmldocs")+compilerPackageName (CompilerChoice (HVR v) GHC) Profiling = BinPkgName ("ghc-" ++ showVersion v ++ "-prof")+compilerPackageName (CompilerChoice (HVR v) GHC) Development = BinPkgName ("ghc-" ++ showVersion v)+compilerPackageName (CompilerChoice (HVR v) GHC) _ = BinPkgName ("ghc-" ++ showVersion v) #if MIN_VERSION_Cabal(1,22,0)-compilerPackageName GHCJS Documentation = BinPkgName "ghcjs"-compilerPackageName GHCJS Profiling = error "Profiling not supported for GHCJS"-compilerPackageName GHCJS Development = BinPkgName "ghcjs"-compilerPackageName GHCJS _ = BinPkgName "ghcjs" -- whatevs+compilerPackageName (CompilerChoice _ GHCJS) Documentation = BinPkgName "ghcjs"+compilerPackageName (CompilerChoice _ GHCJS) Profiling = error "Profiling not supported for GHCJS"+compilerPackageName (CompilerChoice _ GHCJS) Development = BinPkgName "ghcjs"+compilerPackageName (CompilerChoice _ GHCJS) _ = BinPkgName "ghcjs" -- whatevs #endif-compilerPackageName x _ = error $ "Unsupported compiler flavor: " ++ show x+compilerPackageName hc _ = error $ "Unsupported compiler flavor: " ++ show hc #if MIN_VERSION_Cabal(1,22,0) -- | IO based alternative to newestAvailableCompilerId - install the -- compiler into the chroot if necessary and ask it for its version -- number. This has the benefit of working for ghcjs, which doesn't -- make the base ghc version available in the version number.------ Assumes the compiler executable is already installed in the root--- environment.-getCompilerInfo :: MonadIO m => FilePath -> CompilerFlavor -> WithProcAndSys m CompilerInfo+getCompilerInfo :: MonadIO m => FilePath -> CompilerFlavor -> WithProcAndSys m (Either String CompilerInfo) getCompilerInfo "/" flavor = liftIO $ getCompilerInfo' flavor getCompilerInfo root flavor = liftIO $ fchroot root $ getCompilerInfo' flavor -getCompilerInfo' :: CompilerFlavor -> IO CompilerInfo+getCompilerInfo' :: CompilerFlavor -> IO (Either String CompilerInfo) getCompilerInfo' flavor = do- compilerId <- runVersionCommand >>= toCompilerId flavor- compilerCompat <- case flavor of- GHCJS -> readProcessWithExitCode "ghcjs" ["--numeric-ghc-version"] "" >>= toCompilerId GHC >>= return . Just . (: [])- _ -> return Nothing- return $ (unknownCompilerInfo compilerId NoAbiTag) {compilerInfoCompat = compilerCompat}+ r <- try $ readProcessWithExitCode (hcCommand flavor) ["--numeric-version"] ""+ case r of+ Left e | isDoesNotExistError e -> return $ Left $ "getCompilerInfo - " ++ show e+ Left e -> throw e+ Right r'@(ExitFailure _, _, _) ->+ error $ processErrorMessage "getCompilerInfo" (hcCommand flavor) ["--numeric-version"] r'+ Right (_, out, _) -> do+ let compilerId = maybe (error $ "Parse error in version string: " ++ show out) (CompilerId flavor) (toVersion out)+ compilerCompat <- case flavor of+ GHCJS -> do+ (r' :: Either IOError (ExitCode, String, String)) <- try $ readProcessWithExitCode (hcCommand flavor) ["--numeric-ghc-version"] ""+ case r' of+ Right (ExitSuccess, out', _) ->+ maybe (error $ "getCompilerInfo - parse error in version string: " ++ show out') (return . Just . (: []) . CompilerId GHC) (toVersion out')+ _ -> error "getCompilerInfo - failure computing compilerCompat"+ _ -> return Nothing+ return $ Right $ (unknownCompilerInfo compilerId NoAbiTag) {compilerInfoCompat = compilerCompat}++toVersion :: String -> Maybe Version+toVersion s = case filter (all isSpace . snd) (readP_to_S parseVersion s) of+ [(v, _)] -> Just v+ _ -> Nothing++processErrorMessage :: String -> String -> [String] -> (ExitCode, String, String) -> String+processErrorMessage msg cmd args (ExitFailure n, out, err) =+ msg ++ " - " ++ showCommandForUser cmd args ++ " -> " ++ show n ++ "\n stdout: " ++ indent out ++ "\n stderr: " ++ indent err where- runVersionCommand :: IO (ExitCode, String, String)- runVersionCommand = readProcessWithExitCode versionCommand ["--numeric-version"] ""- versionCommand = case flavor of GHC -> "ghc"; GHCJS -> "ghcjs"; _ -> error $ "Flavor " ++ show flavor+ indent :: String -> String+ indent = intercalate "\n " . lines - toCompilerId :: CompilerFlavor -> (ExitCode, String, String) -> IO CompilerId- toCompilerId _ (ExitFailure n, _, err) =- error $ showCommandForUser versionCommand ["--numeric-version"] ++ " -> " ++ show n ++ ", stderr: " ++ show err- toCompilerId flavor' (_, out, _) =- case filter ((== "\n") . snd) (readP_to_S parseVersion out) of- [(v, _)] -> return $ CompilerId flavor' v- _ -> error $ "Parse failure for version string: " ++ show out+hcCommand :: CompilerFlavor -> String+hcCommand GHC = "ghc"+hcCommand GHCJS = "ghcjs"+hcCommand flavor = error $ "hcCommand - unexpected CompilerFlavor: " ++ show flavor #endif++$(makeLenses ''CompilerChoice)+$(deriveMemoizable ''CompilerVendor)+$(deriveMemoizable ''CompilerChoice)
src/Debian/Orphans.hs view
@@ -36,7 +36,7 @@ #if MIN_VERSION_Cabal(1,22,0) deriving instance Typeable AbiTag deriving instance Data AbiTag-#if 1+#if !MIN_VERSION_Cabal(1,24,0) deriving instance Eq AbiTag #endif deriving instance Ord AbiTag@@ -46,7 +46,7 @@ deriving instance Data CompilerId deriving instance Ord Language-#if 1+#if !MIN_VERSION_Cabal(1,24,0) deriving instance Eq Compiler #endif deriving instance Ord Compiler
src/Distribution/Version/Invert.hs view
@@ -1,9 +1,13 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Distribution.Version.Invert ( invertVersionRange , invertVersionIntervals ) where +#if MIN_VERSION_Cabal(1,24,0)+import Distribution.Version (invertVersionRange, invertVersionIntervals)+#else import Distribution.Version (Version(Version, versionBranch, versionTags), VersionRange, fromVersionIntervals, asVersionIntervals, mkVersionIntervals, LowerBound(LowerBound), UpperBound(UpperBound, NoUpperBound), Bound(InclusiveBound, ExclusiveBound)) @@ -39,3 +43,4 @@ lb0 :: LowerBound lb0 = LowerBound (Version {versionBranch = [0], versionTags = []}) InclusiveBound+#endif
test-data/artvaluereport2/input/debian/Debianize.hs view
@@ -22,8 +22,8 @@ -- to copyFirstLogEntry in real life, this is to make sure old and new match. main :: IO () main =- do log <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= evalCabalT (liftCabal inputChangeLog >> use (debInfo . changelog))- new <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= execCabalT (debianize (debianDefaults >> customize log {- >> removeFirstLogEntry -}))+ do log <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= either error (evalCabalT (liftCabal inputChangeLog >> use (debInfo . changelog)))+ new <- withCurrentDirectory "test-data/artvaluereport2/input" $ parseProgramArguments >>= \opts -> newCabalInfo (_flags opts) >>= either error (execCabalT (debianize (debianDefaults >> customize log {- >> removeFirstLogEntry -}))) old <- withCurrentDirectory "test-data/artvaluereport2/output" $ parseProgramArguments >>= \opts -> execDebianT inputDebianization (makeDebInfo (_flags opts)) -- The newest log entry gets modified when the Debianization is -- generated, it won't match so drop it for the comparison.
test-data/clckwrks-dot-com/output/debian/control view
@@ -5,8 +5,8 @@ Build-Depends: debhelper (>= 9) , haskell-devscripts (>= 0.8) , cdbs- , ghc- , ghc-prof+ , ghc-7.6.3+ , ghc-7.6.3-prof , libghc-clckwrks-dev (>= 0.13) , libghc-clckwrks-dev (<< 0.15) , libghc-clckwrks-plugin-bugs-dev (>= 0.3)
test-data/creativeprompts/output/debian/control view
@@ -5,8 +5,8 @@ Build-Depends: debhelper (>= 9) , haskell-devscripts (>= 0.8) , cdbs- , ghc- , ghc-prof+ , ghc-7.6.3+ , ghc-7.6.3-prof , libghc-extra-dev , libghc-hjscript-dev , libghc-http-dev