packages feed

cabal-debian 5.0.2 → 5.0.3

raw patch · 27 files changed

+29/−409 lines, 27 filesdep ~basedep ~hsemailPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, hsemail

API changes (from Hackage documentation)

- Distribution.Version.Invert: invertVersionIntervals :: VersionIntervals -> VersionIntervals
- Distribution.Version.Invert: invertVersionRange :: VersionRange -> VersionRange

Files

Tests.hs view
@@ -2,10 +2,6 @@ {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Main where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-import Data.Monoid (mconcat, mempty)-#endif import Debian.Debianize.Optparse(_flags, parseProgramArguments) import Control.Lens import Data.Algorithm.DiffContext (getContextDiff, prettyContextDiff)
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name:           cabal-debian-Version:        5.0.2+Version:        5.0.3 Copyright:      Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2020 Clint Adams License:        BSD3 License-File:   LICENSE@@ -155,7 +155,7 @@   Hs-Source-Dirs: src   GHC-Options: -Wall   Build-Depends:-    base < 5,+    base >= 4.8 && < 5,     bifunctors,     Cabal >= 2.2,     containers,@@ -165,7 +165,7 @@     directory,     exceptions,     filepath,-    hsemail,+    hsemail >= 2,     HUnit,     lens,     mtl,@@ -188,7 +188,6 @@     Data.Maybe.Extended     Debian.GHC     Debian.Policy-    Distribution.Version.Invert     Debian.Debianize     Debian.Debianize.BasicInfo     Debian.Debianize.BinaryDebDescription@@ -224,7 +223,7 @@   Main-is: CabalDebian.hs   ghc-options: -threaded -Wall   Build-Depends:-    base,+    base >= 4.8 && <5,     cabal-debian,     Cabal >= 2.2,     debian >= 3.95,@@ -240,7 +239,7 @@   Main-is: Tests.hs   ghc-options: -threaded -Wall   Build-Depends:-    base < 5,+    base >= 4.8 && < 5,     cabal-debian,     Cabal >= 2.2,     containers,@@ -248,7 +247,7 @@     Diff >= 0.3.1,     directory,     filepath,-    hsemail,+    hsemail >= 2,     HUnit,     lens,     pretty >= 1.1.2,
src/Debian/Debianize/BasicInfo.hs view
@@ -1,5 +1,5 @@ -- | The basic information required to load a Cabal or Debian package description.-{-# LANGUAGE CPP, DeriveDataTypeable, TemplateHaskell #-}+{-# LANGUAGE DeriveDataTypeable, TemplateHaskell #-} module Debian.Debianize.BasicInfo     ( -- * Types       Flags(..)@@ -27,11 +27,7 @@ import Debian.Debianize.Prelude (read') import Debian.Orphans () import Distribution.Compiler (CompilerFlavor(..))-#if MIN_VERSION_Cabal(2,0,0) import Distribution.PackageDescription as Cabal (FlagName, mkFlagName)-#else-import Distribution.PackageDescription as Cabal (FlagName(FlagName))-#endif import Prelude hiding (break, lines, log, null, readFile, sum) import System.Console.GetOpt (ArgDescr(ReqArg, NoArg), OptDescr(Option)) import System.FilePath ((</>))@@ -101,9 +97,7 @@       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",-#if MIN_VERSION_Cabal(1,22,0)       Option "" ["ghcjs"] (NoArg (compilerFlavor .= 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 "" ["with-compiler"] (ReqArg (\ s -> maybe (error $ "Invalid compiler id: " ++ show s)                                                         (\ hc -> compilerFlavor .= hc)@@ -122,10 +116,5 @@ -- Lifted from Distribution.Simple.Setup, since it's not exported. flagList :: String -> [(FlagName, Bool)] flagList = map tagWithValue . words-#if MIN_VERSION_Cabal(2,0,0)   where tagWithValue ('-':name) = (mkFlagName (map toLower name), False)         tagWithValue name       = (mkFlagName (map toLower name), True)-#else-  where tagWithValue ('-':name) = (FlagName (map toLower name), False)-        tagWithValue name       = (FlagName (map toLower name), True)-#endif
src/Debian/Debianize/BuildDependencies.hs view
@@ -6,9 +6,6 @@     ) where  -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-#endif import Control.Lens import Control.Monad ((>=>)) import Control.Monad.IO.Class (liftIO)@@ -41,12 +38,9 @@ import Distribution.PackageDescription as Cabal (BuildInfo(..), BuildInfo(buildTools, extraLibs, pkgconfigDepends), Library(..), Executable(..), TestSuite(..), SetupBuildInfo(..), PackageDescription(setupBuildInfo)) import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites)) import Distribution.Pretty (prettyShow)-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Types.LegacyExeDependency (LegacyExeDependency(..)) import Distribution.Types.PkgconfigDependency (PkgconfigDependency(..))-#endif-import Distribution.Version (anyVersion, asVersionIntervals, fromVersionIntervals, intersectVersionRanges, isNoVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion)-import Distribution.Version.Invert (invertVersionRange)+import Distribution.Version (anyVersion, asVersionIntervals, fromVersionIntervals, intersectVersionRanges, invertVersionRange, isNoVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (findExecutable) import System.Exit (ExitCode(ExitSuccess))
src/Debian/Debianize/Bundled.hs view
@@ -6,7 +6,7 @@ -- *That* is done using the debianNameMap of CabalInfo, which is -- built using the mapCabal, splitCabal, and remapCabal functions. -{-# LANGUAGE CPP, FlexibleContexts, ScopedTypeVariables #-}+{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-} module Debian.Debianize.Bundled     ( builtIn     -- * Utilities@@ -20,9 +20,6 @@     , tests     ) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (<*>))-#endif import Control.Exception (SomeException, try) import Control.Monad ((<=<)) import Data.Char (isAlphaNum, toLower)@@ -33,42 +30,16 @@ import Debian.Relation (BinPkgName(..)) import Debian.Relation.ByteString () import Debian.Version (DebianVersion, parseDebianVersion', prettyDebianVersion)-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (mkPackageName, PackageIdentifier(..), unPackageName) import Data.Version (parseVersion) import Distribution.Version(mkVersion, mkVersion', Version)-#else-import Data.Version (parseVersion, Version(..))-import Distribution.Package (PackageIdentifier(..), PackageName(..))-#endif-#if MIN_VERSION_Cabal(1,22,0) import Distribution.Simple.Compiler (CompilerFlavor(GHCJS))-#else-import Distribution.Compiler (CompilerFlavor)-#endif import System.Process (readProcess, showCommandForUser) import Test.HUnit (assertEqual, Test(TestList, TestCase)) import Text.ParserCombinators.ReadP (char, endBy1, munch1, ReadP, readP_to_S) import Text.Regex.TDFA ((=~)) import UnliftIO.Memoize (memoizeMVar, Memoized, runMemoized) -#if MIN_VERSION_base(4,8,0)-#if !MIN_VERSION_Cabal(2,0,0)-import Data.Version (makeVersion)-#else-#endif-#else-import Data.Monoid (mempty)--#if !MIN_VERSION_Cabal(1,22,0)-unPackageName :: PackageName -> String-unPackageName (PackageName s) = s-#endif--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@@ -95,9 +66,7 @@     Just hcpath <- runMemoized =<< hcExecutablePath hc     ver <- readProcess hcpath                  [case hc of-#if MIN_VERSION_Cabal(1,22,0)                     GHCJS -> "--numeric-ghc-version"-#endif                     _ -> "--numeric-version"]                  ""     return $ maybe Nothing parseVersion' (listToMaybe (lines ver))@@ -157,41 +126,26 @@ -- So be it. parsePackageIdentifier :: ReadP PackageIdentifier parsePackageIdentifier =-#if MIN_VERSION_Cabal(2,0,0)   makeId <$> ((,) <$> endBy1 (munch1 isAlphaNum) (char '-') <*> parseCabalVersion)     where       makeId :: ([String], Version) -> PackageIdentifier       makeId (xs, v) = PackageIdentifier {pkgName = mkPackageName (intercalate "-" xs), pkgVersion = v}-#else-  makeId <$> ((,) <$> endBy1 (munch1 isAlphaNum) (char '-') <*> parseVersion)-    where-      makeId :: ([String], Version) -> PackageIdentifier-      makeId (xs, v) = PackageIdentifier {pkgName = PackageName (intercalate "-" xs), pkgVersion = v}-#endif  parseMaybe :: ReadP a -> String -> Maybe a parseMaybe p = listToMaybe . map fst . filter ((== "") . snd) . readP_to_S p  parseVersion' :: String -> Maybe Version-#if MIN_VERSION_Cabal(2,0,0) parseVersion' = parseMaybe parseCabalVersion  parseCabalVersion :: ReadP Version parseCabalVersion = fmap mkVersion' parseVersion-#else-parseVersion' = parseMaybe parseVersion-#endif  parsePackageIdentifier' :: String -> Maybe PackageIdentifier parsePackageIdentifier' = parseMaybe parsePackageIdentifier  tests :: Test tests = TestList [ TestCase (assertEqual "Bundled1"-#if MIN_VERSION_Cabal(2,0,0)                                (Just (PackageIdentifier (mkPackageName "HUnit") (mkVersion [1,2,3])))-#else-                               (Just (PackageIdentifier (PackageName "HUnit") (makeVersion [1,2,3])))-#endif                                (parseMaybe parsePackageIdentifier "HUnit-1.2.3"))                  , TestCase (assertEqual "Bundled2"                                Nothing
src/Debian/Debianize/CabalInfo.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, DeriveDataTypeable, OverloadedStrings, TemplateHaskell #-}+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, TemplateHaskell #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.CabalInfo     ( -- * Types@@ -14,10 +14,6 @@     , newCabalInfo     ) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-import Data.Monoid (Monoid(..))-#endif import Control.Lens import Control.Monad.Catch (MonadMask) import Control.Monad.State (execStateT)
src/Debian/Debianize/CopyrightDescription.hs view
@@ -1,5 +1,5 @@ -- | <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/>-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, TupleSections, LambdaCase #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, TupleSections, LambdaCase #-} module Debian.Debianize.CopyrightDescription     ( CopyrightDescription(..)     , FilesOrLicenseDescription(..)@@ -44,26 +44,14 @@ import Debug.Trace import qualified Distribution.License as Cabal (License(UnknownLicense)) import qualified Distribution.Package as Cabal-#if MIN_VERSION_Cabal(2,2,0) import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, licenseRaw, package, maintainer))-#else-#if MIN_VERSION_Cabal(1,20,0)-import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, license, package, maintainer))-#else-import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFile, copyright, license, package, maintainer))-#endif-#endif import Network.URI (URI, parseURI) import Prelude hiding (init, init, log, log, unlines, readFile) import Text.PrettyPrint.HughesPJClass (text) import Distribution.Pretty (Pretty(pretty))  unPackageName :: Cabal.PackageName -> String-#if MIN_VERSION_Cabal(2,0,0) unPackageName p = Cabal.unPackageName p-#else-unPackageName (Cabal.PackageName x) = x-#endif  -- | Description of the machine readable debian/copyright file.  A -- special case is used to represeent the old style free format file -@@ -242,11 +230,7 @@   where     mkLicenseDescription (path, txt) =       LicenseDescription {-#if MIN_VERSION_Cabal(2,2,0)           _license = fromCabalLicense (Cabal.UnknownLicense path)-#else-          _license = fromCabalLicense (Cabal.UnknownLicense path)-#endif         , _licenseText = txt         , _comment = mempty         }@@ -258,16 +242,8 @@ -- provided @copyright0@ value. defaultCopyrightDescription :: Cabal.PackageDescription -> IO CopyrightDescription defaultCopyrightDescription pkgDesc = do-#if MIN_VERSION_Cabal(1,20,0)   let (debianCopyrightPath, otherLicensePaths) = partition (== "debian/copyright") (Cabal.licenseFiles pkgDesc)-#else-  let (debianCopyrightPath, otherLicensePaths) = partition (== "debian/copyright") [Cabal.licenseFile pkgDesc]-#endif-#if MIN_VERSION_Cabal(2,2,0)       license =  either (\x -> OtherLicense ("SPDX license: " ++ show x)) fromCabalLicense $ Cabal.licenseRaw pkgDesc-#else-      license = fromCabalLicense $ Cabal.license pkgDesc-#endif       pkgname = unPackageName . Cabal.pkgName . Cabal.package $ pkgDesc       maintainer = Cabal.maintainer $ pkgDesc   -- This is an @Nothing@ unless debian/copyright is (for some
src/Debian/Debianize/DebInfo.hs view
@@ -91,9 +91,6 @@ import Control.Monad.State (StateT) import Data.Generics (Data, Typeable) import Data.Map as Map (Map)-#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (Monoid(..))-#endif import Data.Set as Set (insert, Set) import Data.Text (Text) import Debian.Changes (ChangeLog)@@ -108,11 +105,7 @@ import Debian.Relation (BinPkgName, Relations, SrcPkgName) import Debian.Version (DebianVersion) import Prelude hiding (init, init, log, log)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr)-#else-import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr)-#endif  -- | Information required to represent a non-cabal debianization. data DebInfo
src/Debian/Debianize/DebianName.hs view
@@ -1,5 +1,5 @@ -- | How to name the debian packages based on the cabal package name and version number.-{-# LANGUAGE CPP, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeFamilies #-}+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeFamilies #-} {-# OPTIONS -Wall -Wwarn -fno-warn-name-shadowing -fno-warn-orphans #-} module Debian.Debianize.DebianName     ( debianName@@ -12,9 +12,6 @@     ) where  -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-#endif import Control.Lens import Data.Char (toLower) import Data.Map as Map (alter, lookup)@@ -28,13 +25,8 @@ import qualified Debian.Relation as D (VersionReq(EEQ)) import Debian.Version (parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..))-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName) import Distribution.Version (Version)-#else-import Data.Version (showVersion, Version)-import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName))-#endif import qualified Distribution.PackageDescription as Cabal (PackageDescription(package)) import Distribution.Pretty (prettyShow) import Prelude hiding (unlines)@@ -66,11 +58,7 @@        pkgDesc <- use packageDescription        let pkgId = Cabal.package pkgDesc        nameMap <- use A.debianNameMap-#if MIN_VERSION_Cabal(2,0,0)        let pname = pkgName pkgId-#else-       let pname@(PackageName _) = pkgName pkgId-#endif            version = (Just (D.EEQ (parseDebianVersion' (prettyShow (pkgVersion pkgId)))))        case (nameBase, Map.lookup (pkgName pkgId) nameMap) of          (Just base, _) -> return base@@ -101,13 +89,8 @@     where prefix = "lib" ++ map toLower (show hc) ++ "-"  debianBaseName :: PackageName -> DebBase-#if MIN_VERSION_Cabal(2,0,0) debianBaseName p =     DebBase (map (fixChar . toLower) (unPackageName p))-#else-debianBaseName (PackageName name) =-    DebBase (map (fixChar . toLower) name)-#endif     where       -- Underscore is prohibited in debian package names.       fixChar :: Char -> Char
src/Debian/Debianize/Details.hs view
@@ -15,13 +15,8 @@ import Debian.Debianize.DebInfo as D (execMap) import Debian.Debianize.VersionSplits (DebBase(DebBase)) import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (mkPackageName) import Distribution.Version (mkVersion)-#else-import Data.Version (Version(Version))-import Distribution.Package (PackageName(PackageName))-#endif  -- | Update the CabalInfo value in the CabalT state with some details about -- the debian repository - special cases for how some cabal packages@@ -34,7 +29,7 @@        -- Associate some build tools and their corresponding        -- (eponymous) debian package names        mapM_ (\name -> (A.debInfo . D.execMap) %= Map.insert name [[Rel (BinPkgName name) Nothing Nothing]])-            ["ghc", "happy", "alex", "hsx2hs"]+            ["alex", "c2hs", "ghc", "happy", "hsx2hs"]        -- The parsec debs are suffixed with either "2" or "3" #if !MIN_VERSION_base(4,11,1) -- The deb of ghc-8.4.3 changes the libghc-parsec3-dev name to libghc-parsec-deb@@ -45,11 +40,9 @@        -- Something was required for this package at one time - it        -- looks like a no-op now        mapCabal (mkPackageName "gtk2hs-buildtools") (DebBase "gtk2hs-buildtools")-       -- Upgrade transformers to 0.4 - no don't!-       -- remapCabal (PackageName "transformers") (DebBase "transformers4")-       -- remapCabal (PackageName "haskeline") (DebBase "haskeline0713")        mapCabal (mkPackageName "haskell-src-exts") (DebBase "src-exts")        mapCabal (mkPackageName "haskell-src-exts-simple") (DebBase "src-exts-simple")+       mapCabal (mkPackageName "haskell-src-exts-util") (DebBase "src-exts-util")        mapCabal (mkPackageName "haskell-src-meta") (DebBase "src-meta")        mapCabal (mkPackageName "Cabal") (DebBase "cabal") 
src/Debian/Debianize/ExecAtoms.hs view
@@ -1,6 +1,6 @@ -- | Things that seem like they could be clients of this library, but -- are instead included as part of the library.-{-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-}+{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} {-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-} module Debian.Debianize.ExecAtoms     ( execAtoms
src/Debian/Debianize/Files.hs view
@@ -1,16 +1,12 @@ -- | Convert a Debianization into a list of files that can then be -- written out.-{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TupleSections #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Debian.Debianize.Files     ( debianizationFileMap     ) where  -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-import Data.Monoid (mempty)-#endif import Control.Lens import Control.Monad.Fail (MonadFail) import Control.Monad.Trans (lift)
src/Debian/Debianize/Finalize.hs view
@@ -9,10 +9,6 @@     ) where  -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-import Data.Monoid (mempty)-#endif import Control.Lens hiding ((<.>)) import Control.Monad (unless, when) import Control.Monad as List (mapM_)@@ -54,28 +50,17 @@ import Debian.Time (getCurrentLocalRFC822Time) import qualified Debian.Version as V (buildDebianVersion, DebianVersion, parseDebianVersion', epoch, version, revision) import Distribution.Compiler (CompilerFlavor(GHC))-#if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerFlavor(GHCJS))-#endif-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName, unPackageName) import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName, mkFlagName, unFlagName, maintainer, PackageDescription(testSuites, description)) import Distribution.Types.UnqualComponentName --import Distribution.Utils.ShortText-#else-import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(PackageName))-import Distribution.PackageDescription as Cabal (allBuildInfo, author, BuildInfo(buildable, extraLibs), Executable(buildInfo, exeName), FlagName(FlagName), maintainer, PackageDescription(testSuites))-#endif import Distribution.PackageDescription as Cabal (PackageDescription(dataFiles, {-description,-} executables, library, package, synopsis)) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (doesFileExist) import System.FilePath ((<.>), (</>), makeRelative, splitFileName, takeDirectory, takeFileName) import System.IO (hPutStrLn, stderr)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..))-#else-import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))-#endif import Distribution.Pretty (Pretty(pretty))  -- | @debianize customize@ initializes the CabalT state from the@@ -171,13 +156,8 @@        -- finalizeDescriptions  watchAtom :: PackageName -> Text-#if MIN_VERSION_Cabal(2,0,0) watchAtom pkgname =     pack $ "version=3\nhttps://hackage.haskell.org/package/" ++ unPackageName pkgname ++ "/distro-monitor .*-([0-9\\.]+)\\.(?:zip|tgz|tbz|txz|(?:tar\\.(?:gz|bz2|xz)))\n"-#else-watchAtom (PackageName pkgname) =-    pack $ "version=3\nhttps://hackage.haskell.org/package/" ++ pkgname ++ "/distro-monitor .*-([0-9\\.]+)\\.(?:zip|tgz|tbz|txz|(?:tar\\.(?:gz|bz2|xz)))\n"-#endif  -- | Compute the final values of the BinaryDebDescription record -- description fields from the cabal descriptions and the values that@@ -261,9 +241,7 @@                               -- "haskell-" added.  Here we add prefix "ghcjs-" to                               -- haskell packages build with the ghcjs compiler.                               (GHC, B.HaskellSource) -> "haskell-" ++ debName-#if MIN_VERSION_Cabal(1,22,0)                               (GHCJS, B.HaskellSource) -> "ghcjs-" ++ debName-#endif                               (_, B.Source) -> debName                               _ -> error $ "finalizeSourceName: " ++ show typ)) @@ -464,11 +442,7 @@ officialSettings :: (Monad m) => CabalT m () officialSettings = do     pkgDesc <- use A.packageDescription-#if MIN_VERSION_Cabal(2,0,0)     let cabal = pkgName (Cabal.package pkgDesc)-#else-    let PackageName cabal = pkgName (Cabal.package pkgDesc)-#endif     zoom A.debInfo $ do         let officialError = error "officialSettings: no sourcePackageName" @@ -478,11 +452,7 @@         let packagesURI = "https://salsa.debian.org/haskell-team/DHG_packages/tree/master/p/" <> pack src         zoom D.control $ do            S.standardsVersion .?= Just (parseStandardsVersion "4.5.0")-#if MIN_VERSION_Cabal(2,0,0)            S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack (unPackageName cabal))-#else-           S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack cabal)-#endif            S.vcsFields %= Set.union (Set.fromList               [ S.VCSBrowser packagesURI               , S.VCSGit  "https://salsa.debian.org/haskell-team/DHG_packages.git"@@ -594,23 +564,15 @@        -- The names of cabal executables that go into eponymous debs        insExecPkg <- use (A.debInfo . D.executable) >>= return . Set.map ename . Set.fromList . elems -#if MIN_VERSION_Cabal(2,0,0)        let installedData :: Set (FilePath, FilePath)            installedData = Set.map (\ a -> (a, a)) $ Set.unions (Map.elems installedDataMap)            installedExec :: Set String-#else-       let installedData = Set.map (\ a -> (a, a)) $ Set.unions (Map.elems installedDataMap)-#endif            installedExec = Set.unions (Map.elems installedExecMap)         prefixPath <- dataTop        let dataFilePaths = Set.fromList (zip (List.map (prefixPath </>) (Cabal.dataFiles pkgDesc)) (Cabal.dataFiles pkgDesc)) :: Set (FilePath, FilePath)-#if MIN_VERSION_Cabal(2,0,0)            execFilePaths :: Set FilePath            execFilePaths = Set.map (unUnqualComponentName . Cabal.exeName) (Set.filter (Cabal.buildable . Cabal.buildInfo) (Set.fromList (Cabal.executables pkgDesc))) :: Set FilePath-#else-           execFilePaths = Set.map Cabal.exeName (Set.filter (Cabal.buildable . Cabal.buildInfo) (Set.fromList (Cabal.executables pkgDesc))) :: Set FilePath-#endif        let availableData = Set.union installedData dataFilePaths            availableExec = Set.union installedExec execFilePaths @@ -652,15 +614,11 @@     do hc <- use (A.debInfo . D.flags . compilerFlavor)        case hc of          GHC -> (A.debInfo . D.flags . cabalFlagAssignments) %= (Set.union (Set.fromList (flagList "--ghc")))-#if MIN_VERSION_Cabal(1,22,0)          GHCJS -> (A.debInfo . D.flags . cabalFlagAssignments) %= (Set.union (Set.fromList (flagList "--ghcjs")))-#endif          x -> error $ "Sorry, compiler not supported: " ++ show x        builddir <- use (A.debInfo . D.buildDir) >>= return . fromMaybe (case hc of                                                                GHC -> "dist-ghc/build"-#if MIN_VERSION_Cabal(1,22,0)                                                                GHCJS -> "dist-ghcjs/build"-#endif                                                                _ -> error $ "Unexpected compiler: " ++ show hc)        dDest <- dataDest        expandApacheSites@@ -696,7 +654,6 @@           where             doAtom :: Monad m => CompilerFlavor -> D.Atom -> CabalT m ()             doAtom GHC (D.InstallCabalExec b name dest) = (A.debInfo . D.atomSet) %= (Set.insert $ D.Install b (builddir </> name </> name) dest)-#if MIN_VERSION_Cabal(1,22,0)             -- A GHCJS executable is a directory with files, copy them             -- all into place.             doAtom GHCJS (D.InstallCabalExec b name dest) =@@ -705,7 +662,6 @@                         [ pack ("binary-fixup" </> ppShow b) <> "::"                         , pack ("\t(cd " <> builddir </> name <> " && find -L " <> name <.> "jsexe" <> " -type f) |\\\n" <>                                        "\t  while read i; do install -Dp " <> builddir </> name </> "$$i debian" </> ppShow b </> makeRelative "/" dest </> "$$i; done\n") ])-#endif             doAtom _ _ = return ()        -- Turn A.InstallCabalExecTo into a make rule@@ -798,17 +754,8 @@ -- Lifted from Distribution.Simple.Setup, since it's not exported. flagList :: String -> [(FlagName, Bool)] flagList = List.map tagWithValue . words-#if MIN_VERSION_Cabal(2,0,0)   where tagWithValue ('-':name) = (mkFlagName (List.map toLower name), False)         tagWithValue name       = (mkFlagName (List.map toLower name), True)-#else-  where tagWithValue ('-':name) = (FlagName (List.map toLower name), False)-        tagWithValue name       = (FlagName (List.map toLower name), True)-#endif  flagString :: [(FlagName, Bool)] -> String-#if MIN_VERSION_Cabal(2,0,0) flagString = unwords . List.map (\ (s, sense) -> "-f" ++ (if sense then "" else "-") ++ unFlagName s)-#else-flagString = unwords . List.map (\ (FlagName s, sense) -> "-f" ++ (if sense then "" else "-") ++ s)-#endif
src/Debian/Debianize/Goodies.hs view
@@ -1,6 +1,6 @@ -- | Things that seem like they could be clients of this library, but -- are instead included as part of the library.-{-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-}+{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-} module Debian.Debianize.Goodies     ( tightDependencyFixup@@ -22,9 +22,6 @@ import Data.List as List ({-dropWhileEnd, intercalate,-} intersperse, map) import Data.Map as Map (insert, insertWith, toList) import Data.Monoid ((<>))-#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (mappend)-#endif import Data.Set as Set (insert, singleton, union) import Data.Text as Text (pack, {-Text,-} unlines) import qualified Debian.Debianize.DebInfo as D
src/Debian/Debianize/InputCabal.hs view
@@ -1,5 +1,5 @@ -- | Input the Cabal package description.-{-# LANGUAGE CPP, DeriveDataTypeable, ScopedTypeVariables, TemplateHaskell #-}+{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, TemplateHaskell #-} module Debian.Debianize.InputCabal     ( inputCabalization     ) where@@ -8,43 +8,21 @@ 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, verbosity, compilerFlavor, cabalFlagAssignments) import Debian.Debianize.Prelude (intToVerbosity')-#if MIN_VERSION_Cabal(1,22,0) import Debian.GHC (getCompilerInfo)-#else-import Debian.GHC (newestAvailableCompilerId)-#endif import Debian.Orphans ()-#if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerInfo)-#else-import Distribution.Compiler (CompilerId)-#endif import Distribution.Package (Package(packageId)) import Distribution.PackageDescription as Cabal (PackageDescription)-#if MIN_VERSION_Cabal(2,2,0) import Distribution.PackageDescription.Configuration (finalizePD) import Distribution.PackageDescription.Parsec (readGenericPackageDescription) import Distribution.Types.ComponentRequestedSpec (ComponentRequestedSpec(ComponentRequestedSpec))-#else-import Distribution.PackageDescription.Configuration (finalizePackageDescription)-#if MIN_VERSION_Cabal(2,0,0)-import Distribution.PackageDescription.Parse (readGenericPackageDescription)-#else-import Distribution.PackageDescription.Parse (readPackageDescription)-#endif-#endif import Distribution.Simple.Utils (defaultPackageDesc, die', setupMessage) import Distribution.System as Cabal (buildArch, Platform(..)) import qualified Distribution.System as Cabal (buildOS)-#if MIN_VERSION_Cabal(2,2,0) import Distribution.Types.GenericPackageDescription (mkFlagAssignment)-#endif import Distribution.Verbosity (Verbosity) import Prelude hiding (break, lines, log, null, readFile, sum) import System.Directory (doesFileExist, getCurrentDirectory)@@ -52,10 +30,6 @@ import System.Posix.Files (setFileCreationMask) import System.Process (system) -#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@@ -69,16 +43,8 @@         -- Load a GenericPackageDescription from the current directory         -- and from that create a finalized PackageDescription for the         -- given CompilerId.-#if MIN_VERSION_Cabal(2,0,0)         genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readGenericPackageDescription vb-#else-        genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readPackageDescription vb-#endif-#if MIN_VERSION_Cabal(2,2,0)         let finalized = finalizePD (mkFlagAssignment (toList fs)) (ComponentRequestedSpec True False) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc-#else-        let finalized = finalizePackageDescription (toList fs) (const True) (Platform buildArch Cabal.buildOS) cinfo [] genPkgDesc-#endif         ePkgDesc <- either (return . Left)                            (\ (pkgDesc, _) -> do liftIO $ bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> autoreconf vb pkgDesc                                                  return (Right pkgDesc))@@ -92,11 +58,7 @@  getCompInfo :: MonadIO m => Flags -> m (Either String CompilerInfo) getCompInfo flags =-#if MIN_VERSION_Cabal(1,22,0)               getCompilerInfo (view compilerFlavor flags)-#else-              return $ newestAvailableCompilerId (view compilerFlavor flags)-#endif  -- | Run the package's configuration script. autoreconf :: Verbosity -> Cabal.PackageDescription -> IO ()
src/Debian/Debianize/InputDebian.hs view
@@ -1,5 +1,5 @@ -- | Read an existing Debianization from a directory file.-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables, TypeSynonymInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables, TypeSynonymInstances #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Debianize.InputDebian     ( inputDebianization@@ -19,9 +19,6 @@ import Data.Map as Map (insert, insertWith) import Data.Maybe (fromMaybe) import Data.Monoid ((<>))-#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (mappend)-#endif import Data.Set as Set (fromList, insert, singleton) import Data.Text (break, lines, null, pack, strip, Text, unpack, words) import Data.Text.IO (readFile)@@ -40,11 +37,7 @@ import Debian.Policy (parseMaintainer, parsePackageArchitectures, parseStandardsVersion, parseUploaders, readPriority, readSection, readMultiArch, readSourceFormat, Section(..)) import Debian.Relation (BinPkgName(..), parseRelations, Relations, SrcPkgName(..)) --import Debug.Trace (trace)-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), unPackageName)-#else-import Distribution.Package (PackageIdentifier(..), PackageName(..))-#endif import qualified Distribution.PackageDescription as Cabal (dataDir, PackageDescription(package)) import Prelude hiding (break, lines, log, null, readFile, sum, words) import System.Directory (doesFileExist)@@ -300,12 +293,7 @@ dataDest :: Monad m => CabalT m FilePath dataDest = do   d <- use packageDescription-#if MIN_VERSION_Cabal(2,0,0)   return $ "usr/share" </> (unPackageName $ pkgName $ Cabal.package d)-#else-  return $ "usr/share" </> ((\ (PackageName x) -> x) $ pkgName $ Cabal.package d)--#endif -- | Where to look for the data-files dataTop :: Monad m => CabalT m FilePath dataTop = do
src/Debian/Debianize/Monad.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.Monad     ( CabalInfo
src/Debian/Debianize/Optparse.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-}@@ -16,9 +15,6 @@   parseProgramArguments',   handleBehaviorAdjustment) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (<*>), pure)-#endif import Control.Applicative (many, (<|>)) import Control.Lens import Control.Monad.State.Class (MonadState)@@ -40,22 +36,13 @@ import Debian.Relation import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..))-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageName, mkPackageName, unPackageName) import Distribution.PackageDescription (FlagName, mkFlagName)-#else-import Distribution.Package (PackageName(..))-import Distribution.PackageDescription (FlagName(FlagName))-#endif import GHC.Generics import System.Environment (getArgs) import System.FilePath(splitFileName, (</>)) import System.Process (showCommandForUser)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..))-#else-import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))-#endif import Text.PrettyPrint.ANSI.Leijen (linebreak, (<+>), string, indent) import qualified  Debian.Debianize.DebInfo as D import qualified Data.Map as Map@@ -205,28 +192,15 @@ extraRelationsR = first BinPkgName <$> mappingR  cabalDebMappingR :: O.ReadM CabalDebMapping-#if MIN_VERSION_Cabal(2,0,0) cabalDebMappingR = CabalDebMapping . first mkPackageName <$> mappingR-#else-cabalDebMappingR = CabalDebMapping . first PackageName <$> mappingR-#endif  cabalEpochMappingR :: O.ReadM CabalEpochMapping-#if MIN_VERSION_Cabal(2,0,0) cabalEpochMappingR = CabalEpochMapping . first mkPackageName <$> epochMappingR-#else-cabalEpochMappingR = CabalEpochMapping . first PackageName <$> epochMappingR-#endif  cabalFlagMappingR :: O.ReadM CabalFlagMapping cabalFlagMappingR = O.str >>= \case-#if MIN_VERSION_Cabal(2,0,0)   ('-' : str) -> return $ CabalFlagMapping (mkFlagName str, False)   str -> return $ CabalFlagMapping (mkFlagName str, True)-#else-  ('-' : str) -> return $ CabalFlagMapping (FlagName str, False)-  str -> return $ CabalFlagMapping (FlagName str, True)-#endif  -- Here are parser for BehaviorAdjustment and next are parsers for -- every field of this data.  Please, keep parsers declarations in@@ -596,11 +570,7 @@  hcFlavorP :: O.Parser CompilerFlavor hcFlavorP = O.flag GHC-#if MIN_VERSION_Cabal(1,22,0)                     GHCJS-#else-                    GHC-#endif                           m where   m = O.help helpMsg       <> O.long "ghcjs"@@ -659,13 +629,8 @@   D.debVersion .= _debianVersion   D.uploadersOption %= (++ _uploaders)   D.extraDevDeps %= (++ concatMap unpack _devDep)-#if MIN_VERSION_Cabal(2,0,0)   forM_ _cabalDebMapping $ \(CabalDebMapping (pkg, rels)) -> do     D.extraLibMap %= Map.insert (unPackageName pkg) rels-#else-  forM_ _cabalDebMapping $ \(CabalDebMapping (PackageName pkg, rels)) -> do-    D.extraLibMap %= Map.insert pkg rels-#endif   addExtra _extraDepends B.depends   addExtra _extraConflicts B.conflicts   addExtra _extraProvides B.provides
src/Debian/Debianize/Prelude.hs view
@@ -1,6 +1,6 @@ -- | Functions and instances used by but not related to cabal-debian. -- These could conceivably be moved into more general libraries.-{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, Rank2Types, ScopedTypeVariables #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, Rank2Types, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Debianize.Prelude     ( curry3
src/Debian/Debianize/SourceDebDescription.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, TemplateHaskell, TypeSynonymInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, TemplateHaskell, TypeSynonymInstances #-} module Debian.Debianize.SourceDebDescription     ( SourceDebDescription     , newSourceDebDescription@@ -34,11 +34,7 @@ import Debian.Policy (PackagePriority, Section, StandardsVersion) import Debian.Relation (Relations, SrcPkgName) import Prelude hiding (init, init, log, log, unlines)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr)-#else-import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr)-#endif  -- | This type represents the debian/control file, which is the core -- of the source package debianization.  It includes the information
src/Debian/Debianize/VersionSplits.hs view
@@ -1,6 +1,6 @@ -- | Convert between cabal and debian package names based on version -- number ranges.-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-} module Debian.Debianize.VersionSplits     ( DebBase(DebBase, unDebBase)     -- * Combinators for VersionSplits@@ -22,15 +22,10 @@ import Debian.Orphans () import qualified Debian.Relation as D (VersionReq(..)) import Debian.Version (DebianVersion, parseDebianVersion')-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Package (PackageIdentifier(..), PackageName) import Distribution.Package (mkPackageName) import Distribution.Pretty (prettyShow) import Distribution.Version (Version)-#else-import Data.Version (Version(Version))-import Distribution.Package (PackageIdentifier(..), PackageName(..))-#endif import Distribution.Version (anyVersion, earlierVersion, intersectVersionRanges, orLaterVersion, VersionRange) import Prelude hiding (init, log, unlines) @@ -70,11 +65,7 @@             -> DebBase -- ^ The name to use for versions older than the split             -> VersionSplits             -> VersionSplits-#if MIN_VERSION_Cabal(2,0,0) insertSplit ver ltname sp@(VersionSplits {}) =-#else-insertSplit ver@(Version _ _) ltname sp@(VersionSplits {}) =-#endif     -- (\ x -> trace ("insertSplit " ++ show (ltname, ver, sp) ++ " -> " ++ show x) x) $     case splits sp of       -- This is the oldest split, change oldestPackage and insert a new head pair@@ -115,11 +106,7 @@ cabalFromDebian mp base@(DebBase name) ver =     case Set.toList pset of       [x] -> x-#if MIN_VERSION_Cabal(2,0,0)       [] -> mkPackageName name-#else-      [] -> PackageName name-#endif       l -> error $ "Error, multiple cabal package names associated with " ++ show base ++ ": " ++ show l     where       -- Look for splits that involve the right DebBase and return the
src/Debian/GHC.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables #-}+{-# LANGUAGE RankNTypes, ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.GHC     ( withCompilerVersion@@ -12,14 +12,9 @@     , withModifiedPATH     -- , CompilerChoice(..), hcVendor, hcFlavor     , compilerPackageName-#if MIN_VERSION_Cabal(1,22,0)     , getCompilerInfo-#endif     ) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))-#endif import Control.Exception (SomeException, throw, try) import Control.Lens (_2, over) import Control.Monad ((<=<))@@ -30,16 +25,10 @@ import Debian.Relation (BinPkgName(BinPkgName)) import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..), CompilerId(CompilerId))-#if MIN_VERSION_Cabal(1,22,0) import Distribution.Compiler (CompilerInfo(..), unknownCompilerInfo, AbiTag(NoAbiTag))-#endif-#if MIN_VERSION_Cabal(2,0,0) import Distribution.Pretty (prettyShow) import Distribution.Version (mkVersion', mkVersion, Version, versionNumbers) import Data.Version (parseVersion)-#else-import Data.Version (showVersion, Version(..), parseVersion)-#endif import System.Console.GetOpt (ArgDescr(ReqArg), OptDescr(..)) import System.Environment (getEnv) import System.Exit (ExitCode(ExitFailure, ExitSuccess))@@ -54,11 +43,7 @@  toVersion :: String -> Maybe Version toVersion s = case filter (all isSpace . snd) (readP_to_S parseVersion s) of-#if MIN_VERSION_Cabal(2,0,0)                 [(v, _)] -> Just (mkVersion' v)-#else-                [(v, _)] -> Just v-#endif                 _ -> Nothing  withCompilerVersion :: CompilerFlavor -> (DebianVersion -> a) -> IO (Either String a)@@ -129,13 +114,8 @@  compilerIdFromDebianVersion :: CompilerFlavor -> DebianVersion -> CompilerId compilerIdFromDebianVersion hc debVersion =-#if MIN_VERSION_Cabal(2,0,0)     let ds = versionNumbers (greatestLowerBound debVersion (map (\ d -> mkVersion [d]) [0..])) in     CompilerId hc (greatestLowerBound debVersion (map (\ d -> mkVersion (ds ++ [d])) [0..]))-#else-    let (Version ds ts) = greatestLowerBound debVersion (map (\ d -> Version [d] []) [0..]) in-    CompilerId hc (greatestLowerBound debVersion (map (\ d -> Version (ds ++ [d]) ts) [0..]))-#endif     where       greatestLowerBound :: DebianVersion -> [Version] -> Version       greatestLowerBound b xs = last $ takeWhile (\ v -> parseDebianVersion' (prettyShow v) < b) xs@@ -186,9 +166,7 @@  compilerPackage :: CompilerFlavor -> IO (Maybe BinPkgName) compilerPackage GHC = filePackage "ghc" >>= runMemoized-#if MIN_VERSION_Cabal(1,22,0) compilerPackage GHCJS = filePackage "ghcjs" >>= runMemoized-#endif compilerPackage x = error $ "compilerPackage - unsupported CompilerFlavor: " ++ show x  filePackage :: FilePath -> IO (Memoized (Maybe BinPkgName))@@ -209,7 +187,6 @@       toPath (ExitSuccess, [path], _) = Just path       toPath _ = Nothing -#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@@ -228,14 +205,12 @@     Right (_, out, _) -> do       let compilerId = maybe (error $ "Parse error in version string: " ++ show out) (CompilerId flavor) (toVersion out)       compilerCompat <- case flavor of-#if MIN_VERSION_Cabal(1,22,0)                           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"-#endif                           _ -> return Nothing       return $ Right $ (unknownCompilerInfo compilerId NoAbiTag) {compilerInfoCompat = compilerCompat} @@ -249,8 +224,5 @@  hcCommand :: CompilerFlavor -> String hcCommand GHC = "ghc"-#if MIN_VERSION_Cabal(1,22,0) hcCommand GHCJS = "ghcjs"-#endif hcCommand flavor = error $ "hcCommand - unexpected CompilerFlavor: " ++ show flavor-#endif
src/Debian/Orphans.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, StandaloneDeriving, CPP #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, StandaloneDeriving #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Orphans where @@ -20,11 +20,7 @@ import Distribution.Version (Version) import Language.Haskell.Extension (Language(..)) import Network.URI (URI)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (NameAddr(..))-#else-import Text.ParserCombinators.Parsec.Rfc2822 (NameAddr(..))-#endif import Text.PrettyPrint.HughesPJ (Doc) import Text.PrettyPrint.HughesPJClass (hcat, text) import Distribution.Pretty (Pretty(pretty))
src/Debian/Policy.hs view
@@ -1,6 +1,6 @@ -- | Code pulled out of cabal-debian that straightforwardly implements -- parts of the Debian policy manual, or other bits of Linux standards.-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-} module Debian.Policy     ( -- * Paths       databaseDirectory@@ -64,11 +64,7 @@ import System.FilePath ((</>)) import System.Process (readProcess) import Text.Parsec (parse)-#if MIN_VERSION_hsemail(2,0,0) import Text.Parsec.Rfc2822 (address, NameAddr(..))-#else-import Text.ParserCombinators.Parsec.Rfc2822 (address, NameAddr(..))-#endif import Text.PrettyPrint.HughesPJClass (text) import Distribution.Pretty (Pretty(pretty)) import Text.Read (readMaybe)@@ -402,20 +398,16 @@       Cabal.LGPL _ -> LGPL       Cabal.BSD3 -> BSD_3_Clause       Cabal.BSD4 -> BSD_4_Clause-      Cabal.MIT -> OtherLicense (show x)+      Cabal.MIT -> Expat       Cabal.Apache _ -> Apache       Cabal.PublicDomain -> Public_Domain       Cabal.AllRightsReserved -> OtherLicense "AllRightsReserved"       Cabal.OtherLicense -> OtherLicense (show x)       Cabal.UnknownLicense _ -> OtherLicense (show x)-#if MIN_VERSION_Cabal(1,20,0)       Cabal.MPL _ -> MPL-#if MIN_VERSION_Cabal(1,22,0)       Cabal.BSD2 -> BSD_2_Clause       Cabal.ISC -> OtherLicense (show x)       Cabal.UnspecifiedLicense -> OtherLicense (show x)-#endif-#endif  -- | Convert a Debian license to a Cabal license.  Additional cases -- and corrections welcome.@@ -423,11 +415,10 @@ toCabalLicense x =     -- This needs to be finished     case x of-#if MIN_VERSION_Cabal(1,22,0)       BSD_2_Clause -> Cabal.BSD2-#endif       BSD_3_Clause -> Cabal.BSD3       BSD_4_Clause -> Cabal.BSD4+      Expat -> Cabal.MIT       OtherLicense s -> Cabal.UnknownLicense s       _ -> Cabal.UnknownLicense (show x) 
− src/Distribution/Version/Invert.hs
@@ -1,46 +0,0 @@-{-# 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), VersionRange, fromVersionIntervals, asVersionIntervals, mkVersionIntervals,-                             LowerBound(LowerBound), UpperBound(UpperBound, NoUpperBound), Bound(InclusiveBound, ExclusiveBound))---- | This function belongs in Cabal, see http://hackage.haskell.org/trac/hackage/ticket/935.-invertVersionRange :: VersionRange -> VersionRange-invertVersionRange = fromVersionIntervals . maybe (error "invertVersionRange") id . mkVersionIntervals . invertVersionIntervals . asVersionIntervals--invertVersionIntervals :: [(LowerBound, UpperBound)] -> [(LowerBound, UpperBound)]-invertVersionIntervals xs =-    case xs of-      [] -> [(lb0, NoUpperBound)]-      ((LowerBound (Version [0] []) InclusiveBound, ub) : more) ->-          invertVersionIntervals' ub more-      ((lb, ub) : more) ->-          (lb0, invertLowerBound lb) : invertVersionIntervals' ub more-    where-      invertVersionIntervals' :: UpperBound -> [(LowerBound, UpperBound)] -> [(LowerBound, UpperBound)]-      invertVersionIntervals' NoUpperBound [] = []-      invertVersionIntervals' ub0 [] = [(invertUpperBound ub0, NoUpperBound)]-      invertVersionIntervals' ub0 [(lb, NoUpperBound)] = [(invertUpperBound ub0, invertLowerBound lb)]-      invertVersionIntervals' ub0 ((lb, ub1) : more) = (invertUpperBound ub0, invertLowerBound lb) : invertVersionIntervals' ub1 more--      invertLowerBound :: LowerBound -> UpperBound-      invertLowerBound (LowerBound v b) = UpperBound v (invertBound b)--      invertUpperBound :: UpperBound -> LowerBound-      invertUpperBound (UpperBound v b) = LowerBound v (invertBound b)-      invertUpperBound NoUpperBound = error "NoUpperBound: unexpected"--      invertBound :: Bound -> Bound-      invertBound ExclusiveBound = InclusiveBound-      invertBound InclusiveBound = ExclusiveBound--      lb0 :: LowerBound-      lb0 = LowerBound (Version [0] []) InclusiveBound-#endif
src/System/Git.hs view
@@ -1,6 +1,6 @@ -- | Git related functions that belong in some other package. -{-# LANGUAGE CPP, ScopedTypeVariables #-}+{-# LANGUAGE ScopedTypeVariables #-}  module System.Git     ( gitResetHard@@ -10,9 +10,6 @@     , withCleanRepo     ) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative (pure, (<$>))-#endif  import Control.Exception (catch, SomeException, throw) import System.Directory (getCurrentDirectory) import System.Exit (ExitCode(ExitSuccess, ExitFailure))
test-data/artvaluereport2/input/debian/Debianize.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings #-}+{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}   import Control.Lens