cabal-debian 5.4.4 → 5.5
raw patch · 11 files changed
+102/−151 lines, 11 filesdep +Cabal-syntaxdep +ordered-containersdep ~Cabaldep ~debianPVP ok
version bump matches the API change (PVP)
Dependencies added: Cabal-syntax, ordered-containers
Dependency ranges changed: Cabal, debian
API changes (from Hackage documentation)
Files
- Tests.hs +39/−39
- cabal-debian.cabal +7/−5
- src/Debian/Debianize.hs +1/−1
- src/Debian/Debianize/BuildDependencies.hs +33/−56
- src/Debian/Debianize/CopyrightDescription.hs +0/−15
- src/Debian/Debianize/Details.hs +2/−2
- src/Debian/Debianize/Finalize.hs +6/−6
- src/Debian/Debianize/Goodies.hs +3/−3
- src/Debian/Debianize/InputCabal.hs +5/−9
- src/Debian/Debianize/InputDebian.hs +2/−2
- src/Debian/Orphans.hs +4/−13
Tests.hs view
@@ -159,12 +159,12 @@ (S.maintainer . D.control . debInfo) .= Just (NameAddr (Just "David Fox") "dsf@seereason.com") (S.standardsVersion . D.control . debInfo) .= Just (StandardsVersion 3 9 3 (Just 1)) -- This will change as new versions of debian-policy are released (S.buildDepends . D.control . debInfo) %=- (++ [[Rel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("9" :: String)))) Nothing],- [Rel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.9" :: String)))) Nothing],- [Rel (BinPkgName "cdbs") Nothing Nothing],- [Rel (BinPkgName "ghc") Nothing Nothing],- [Rel (BinPkgName "ghc-prof") Nothing Nothing]])- (S.buildDependsIndep . D.control . debInfo) %= (++ [[Rel (BinPkgName "ghc-doc") Nothing Nothing]]))+ (++ [[RRel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("9" :: String)))) Nothing []],+ [RRel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.9" :: String)))) Nothing []],+ [anyrel (BinPkgName "cdbs")],+ [anyrel (BinPkgName "ghc") ],+ [anyrel (BinPkgName "ghc-prof")]])+ (S.buildDependsIndep . D.control . debInfo) %= (++ [[anyrel (BinPkgName "ghc-doc")]])) atoms log = ChangeLog [Entry { logPackage = "haskell-cabal-debian" , logVersion = buildDebianVersion Nothing "2.6.2" Nothing@@ -206,12 +206,12 @@ (S.maintainer . D.control . debInfo) .= Just (NameAddr {nameAddr_name = Just "David Fox", nameAddr_addr = "dsf@seereason.com"}) (S.standardsVersion . D.control . debInfo) .= Just (StandardsVersion 3 9 3 (Just 1)) (S.buildDepends . D.control . debInfo)- %= (++ [[Rel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("7.0" :: String)))) Nothing],- [Rel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.8" :: String)))) Nothing],- [Rel (BinPkgName "cdbs") Nothing Nothing],- [Rel (BinPkgName "ghc") Nothing Nothing],- [Rel (BinPkgName "ghc-prof") Nothing Nothing]])- (S.buildDependsIndep . D.control . debInfo) %= (++ [[Rel (BinPkgName "ghc-doc") Nothing Nothing]]))+ %= (++ [[RRel (BinPkgName "debhelper") (Just (GRE (parseDebianVersion ("7.0" :: String)))) Nothing []],+ [RRel (BinPkgName "haskell-devscripts") (Just (GRE (parseDebianVersion ("0.8" :: String)))) Nothing []],+ [anyrel (BinPkgName "cdbs")],+ [anyrel (BinPkgName "ghc")],+ [anyrel (BinPkgName "ghc-prof")]])+ (S.buildDependsIndep . D.control . debInfo) %= (++ [[anyrel (BinPkgName "ghc-doc")]])) atoms log = ChangeLog [Entry {logPackage = "haskell-cabal-debian", logVersion = Debian.Version.parseDebianVersion ("2.6.2" :: String),@@ -302,8 +302,8 @@ (debInfo . D.control . S.uploaders) .= [NameAddr {nameAddr_name = Just "Marco Silva", nameAddr_addr = "marcot@debian.org"},NameAddr {nameAddr_name = Just "Joachim Breitner", nameAddr_addr = "nomeata@debian.org"}] (debInfo . D.control . S.priority) .= Just Extra (debInfo . D.control . S.section) .= Just (MainSection "haskell")- (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion' ("7" :: String)))) Nothing]])- (debInfo . D.control . S.buildDependsIndep) %= (++ [[Rel (BinPkgName {unBinPkgName = "perl"}) Nothing Nothing]])+ (debInfo . D.control . S.buildDepends) %= (++ [[RRel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion' ("7" :: String)))) Nothing []]])+ (debInfo . D.control . S.buildDependsIndep) %= (++ [[anyrel (BinPkgName {unBinPkgName = "perl"})]]) (debInfo . D.control . S.standardsVersion) .= Just (StandardsVersion 3 9 4 Nothing) (debInfo . D.control . S.vcsFields) %= Set.union (Set.fromList [ S.VCSBrowser "http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts" , S.VCSDarcs "http://darcs.debian.org/pkg-haskell/haskell-devscripts"])@@ -321,23 +321,23 @@ " generate appropriate substvars entries for each one, and install the", " package in the Debian temporary area as part of the build process."]) (debInfo . D.binaryDebDescription (BinPkgName "haskell-devscripts") . B.relations . B.depends) .=- [ [Rel (BinPkgName {unBinPkgName = "dctrl-tools"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "debhelper"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "dh-buildinfo"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing]- , [Rel (BinPkgName {unBinPkgName = "cdbs"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "${misc:Depends}"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "html-xml-utils"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing]- , [Rel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing] ]+ [ [anyrel (BinPkgName {unBinPkgName = "dctrl-tools"})]+ , [anyrel (BinPkgName {unBinPkgName = "debhelper"})]+ , [anyrel (BinPkgName {unBinPkgName = "dh-buildinfo"})]+ , [RRel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing []]+ , [anyrel (BinPkgName {unBinPkgName = "cdbs"})]+ , [anyrel (BinPkgName {unBinPkgName = "${misc:Depends}"})]+ , [anyrel (BinPkgName {unBinPkgName = "html-xml-utils"})]+ , [RRel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing []]+ , [RRel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing []] ] {- control %= (\ y -> y { S.source = , S.maintainer = Just (NameAddr {nameAddr_name = Just "Debian Haskell Group", nameAddr_addr = "pkg-haskell-maintainers@lists.alioth.debian.org"}) , S.uploaders = [NameAddr {nameAddr_name = Just "Marco Silva", nameAddr_addr = "marcot@debian.org"},NameAddr {nameAddr_name = Just "Joachim Breitner", nameAddr_addr = "nomeata@debian.org"}] , S.priority = Just Extra , S.section = Just (MainSection "haskell")- , S.buildDepends = (S.buildDepends y) ++ [[Rel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion'("7" :: String)))) Nothing]]- , S.buildDependsIndep = (S.buildDependsIndep y) ++ [[Rel (BinPkgName {unBinPkgName = "perl"}) Nothing Nothing]]+ , S.buildDepends = (S.buildDepends y) ++ [[RRel (BinPkgName {unBinPkgName = "debhelper"}) (Just (GRE (Debian.Version.parseDebianVersion'("7" :: String)))) Nothing []]]+ , S.buildDependsIndep = (S.buildDependsIndep y) ++ [[RRel (BinPkgName {unBinPkgName = "perl"}) Nothing Nothing []]] , S.standardsVersion = Just (StandardsVersion 3 9 4 Nothing) , S.vcsFields = Set.union (S.vcsFields y) (Set.fromList [ S.VCSBrowser "http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts" , S.VCSDarcs "http://darcs.debian.org/pkg-haskell/haskell-devscripts"])@@ -361,15 +361,15 @@ , B.relations = B.PackageRelations { B.depends =- [ [Rel (BinPkgName {unBinPkgName = "dctrl-tools"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "debhelper"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "dh-buildinfo"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing]- , [Rel (BinPkgName {unBinPkgName = "cdbs"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "${misc:Depends}"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "html-xml-utils"}) Nothing Nothing]- , [Rel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing]- , [Rel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing] ]+ [ [anyrel (BinPkgName {unBinPkgName = "dctrl-tools"})]+ , [anyrel (BinPkgName {unBinPkgName = "debhelper"})]+ , [anyrel (BinPkgName {unBinPkgName = "dh-buildinfo"})]+ , [RRel (BinPkgName {unBinPkgName = "ghc"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.6" :: String)))) Nothing []]+ , [anyrel (BinPkgName {unBinPkgName = "cdbs"})]+ , [anyrel (BinPkgName {unBinPkgName = "${misc:Depends}"})]+ , [anyrel (BinPkgName {unBinPkgName = "html-xml-utils"})]+ , [RRel (BinPkgName {unBinPkgName = "hscolour"}) (Just (GRE (Debian.Version.parseDebianVersion'("1.8" :: String)))) Nothing []]+ , [RRel (BinPkgName {unBinPkgName = "ghc-haddock"}) (Just (GRE (Debian.Version.parseDebianVersion'("7.4" :: String)))) Nothing []] ] , B.recommends = [] , B.suggests = [] , B.preDepends = []@@ -503,7 +503,7 @@ json2Path = "/usr/share/clckwrks-0.13.2/json2" anyrel :: BinPkgName -> Relation-anyrel b = Rel b Nothing Nothing+anyrel b = RRel b Nothing Nothing [] test5 :: String -> Test test5 label =@@ -526,7 +526,7 @@ doWebsite (BinPkgName "creativeprompts-production") (theSite (BinPkgName "creativeprompts-production")) doServer (BinPkgName "creativeprompts-development") (theServer (BinPkgName "creativeprompts-development")) doBackups (BinPkgName "creativeprompts-backups") "creativeprompts-backups"- (A.debInfo . D.execMap) %= Map.insert "trhsx" [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]]+ (A.debInfo . D.execMap) %= Map.insert "trhsx" [[anyrel (BinPkgName "haskell-hsx-utils")]] mapM_ (\ b -> (debInfo . D.binaryDebDescription b . B.relations . B.depends) %= \ deps -> deps ++ [[anyrel (BinPkgName "markdown")]]) [(BinPkgName "creativeprompts-production"), (BinPkgName "creativeprompts-development")] (debInfo . D.binaryDebDescription (BinPkgName "creativeprompts-development") . B.description) .=@@ -631,7 +631,7 @@ customize Nothing = error "Missing changelog" customize (Just log) = do (debInfo . D.flags . verbosity) .= 1- (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName "haskell-hsx-utils") Nothing Nothing]])+ (debInfo . D.control . S.buildDepends) %= (++ [[anyrel (BinPkgName "haskell-hsx-utils")]]) (debInfo . D.control . S.homepage) .= Just "https://artvaluereportonline.com" (debInfo . D.sourceFormat) .= Native3 (debInfo . D.changelog) .= Just log@@ -677,7 +677,7 @@ (D.InstallFile {D.execName = "alex", D.destName = "alex", D.sourceDir = Nothing, D.destDir = Nothing}) -- Bootstrap self-dependency (debInfo . D.allowDebianSelfBuildDeps) .= True- (debInfo . D.control . S.buildDepends) %= (++ [[Rel (BinPkgName "alex") Nothing Nothing]])+ (debInfo . D.control . S.buildDepends) %= (++ [[anyrel (BinPkgName "alex")]]) test10 :: String -> Test test10 label =@@ -701,7 +701,7 @@ (A.debInfo . D.compat) .= Just 13 (A.debInfo . D.control . S.standardsVersion) .= Just (StandardsVersion 3 8 1 Nothing) (A.debInfo . D.control . S.maintainer) .= parseMaintainer "David Fox <dsf@seereason.com>"- (A.debInfo . D.binaryDebDescription (BinPkgName "seereason-darcs-backups") . B.relations . B.depends) %= (++ [[Rel (BinPkgName "anacron") Nothing Nothing]])+ (A.debInfo . D.binaryDebDescription (BinPkgName "seereason-darcs-backups") . B.relations . B.depends) %= (++ [[anyrel (BinPkgName "anacron")]]) (A.debInfo . D.control . S.section) .= Just (MainSection "haskell") (A.debInfo . D.utilsPackageNameBase) .= Just "seereason-darcs-backups" (A.debInfo . D.atomSet) %= (Set.insert $ D.InstallCabalExec (BinPkgName "seereason-darcs-backups") "seereason-darcs-backups" "/etc/cron.hourly")
cabal-debian.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 Name: cabal-debian-Version: 5.4.4+Version: 5.5 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2026 Clint Adams License: BSD-3-Clause License-File: LICENSE@@ -140,7 +140,8 @@ GHC-Options: -Wall Build-Depends: base >= 4.17 && < 5,- Cabal >= 3.2 && < 3.17,+ Cabal >= 3.6 && < 3.17,+ Cabal-syntax >= 3.6 && < 3.17, containers, data-default, Diff >= 0.3.1 && < 2,@@ -152,6 +153,7 @@ lens, mtl, network-uri,+ ordered-containers >= 0.2, parsec >= 3, pretty >= 1.1.2, process,@@ -164,7 +166,7 @@ utf8-string, optparse-applicative >= 0.11 && < 0.20, prettyprinter,- debian >= 3.95+ debian >= 4.1.2 Exposed-Modules: Data.Maybe.Extended Debian.GHC@@ -218,9 +220,9 @@ Build-Depends: base >= 4.17 && < 5, cabal-debian,- Cabal >= 3.2 && < 3.17,+ Cabal-syntax >= 3.6 && < 3.17, containers,- debian >= 3.95,+ debian >= 4.1, Diff >= 0.3.1 && < 2, directory, filepath,
src/Debian/Debianize.hs view
@@ -24,7 +24,7 @@ -- > import Control.Lens -- > import Data.Map as Map -- > import Data.Set as Set--- > import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))+-- > import Debian.Relation (BinPkgName(BinPkgName), Relation(RRel)) -- > import Debian.Debianize -- > main = performDebianization $ do -- > debianDefaults
src/Debian/Debianize/BuildDependencies.hs view
@@ -15,6 +15,7 @@ import Data.Function (on) import Data.List as List (filter, groupBy, map, minimumBy, nub, sortBy) import Data.Map as Map (lookup, Map)+import qualified Data.Map.Ordered as MO import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe, maybeToList) import Data.Set as Set (empty, fold, fromList, map, member, Set, singleton, toList, union) import Debian.Debianize.Prelude@@ -29,7 +30,7 @@ import Debian.Debianize.VersionSplits (packageRangesFromVersionSplits) import Debian.GHC (compilerPackageName) import Debian.Orphans ()-import Debian.Relation (BinPkgName(..), checkVersionReq, Relation(..), Relations)+import Debian.Relation (BinPkgName(..), checkVersionReq, Relation(..), Relations, RestrictionList) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..), Relations, VersionReq(EEQ, GRE, LTE, SGR, SLT)) import Debian.Version (DebianVersion, parseDebianVersion') import Distribution.Compiler (CompilerFlavor(..))@@ -38,13 +39,9 @@ import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites)) import Distribution.Pretty (prettyShow) import Distribution.Types.LegacyExeDependency (LegacyExeDependency(..))-#if MIN_VERSION_Cabal(3,4,0) import qualified Distribution.Compat.NonEmptySet as NES import Distribution.Types.LibraryName (defaultLibName) import Distribution.Version (anyVersion, asVersionIntervals, fromVersionIntervals, intersectVersionRanges, isNoVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion)-#else-import Distribution.Version (anyVersion, asVersionIntervals, fromVersionIntervals, intersectVersionRanges, invertVersionRange, isNoVersion, toVersionIntervals, unionVersionRanges, VersionRange, withinVersion)-#endif import Distribution.Types.PkgconfigDependency (PkgconfigDependency(..)) import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (findExecutable)@@ -103,7 +100,7 @@ fixDeps :: CabalInfo -> [String] -> Relations fixDeps atoms =- concatMap (\ cab -> fromMaybe [[D.Rel (D.BinPkgName ("lib" ++ List.map toLower cab ++ "-dev")) Nothing Nothing]]+ concatMap (\ cab -> fromMaybe [anyrel' (D.BinPkgName ("lib" ++ List.map toLower cab ++ "-dev"))] (Map.lookup cab (view (A.debInfo . D.extraLibMap) atoms))) setupBuildDepends :: SetupBuildInfo -> [Dependency_]@@ -112,11 +109,7 @@ -- | Take the intersection of all the dependencies on a given package name mergeCabalDependencies :: [Dependency] -> [Dependency] mergeCabalDependencies =-#if MIN_VERSION_Cabal(3,4,0) List.map (foldl1 (\ (Dependency name range1 _) (Dependency _ range2 _) -> Dependency name (intersectVersionRanges range1 range2) (NES.singleton defaultLibName))) . groupBy ((==) `on` dependencyPackage) . sortBy (compare `on` dependencyPackage)-#else- List.map (foldl1 (\ (Dependency name range1 _) (Dependency _ range2 _) -> Dependency name (intersectVersionRanges range1 range2) mempty)) . groupBy ((==) `on` dependencyPackage) . sortBy (compare `on` dependencyPackage)-#endif where dependencyPackage (Dependency x _ _) = x @@ -143,10 +136,10 @@ testsStatus <- use (A.debInfo . D.testsStatus) cDeps <- nub . concat . concat <$> sequence- [ mapM (buildDependencies hcTypePairs) libDeps- , mapM (buildDependencies hcTypePairs) binDeps- , mapM (buildDependencies hcTypePairs) setupDeps- , mapM (buildDependencies hcTypePairs) (if testsStatus /= D.TestsDisable then testDeps else [])+ [ mapM (buildDependencies [] hcTypePairs) libDeps+ , mapM (buildDependencies [] hcTypePairs) binDeps+ , mapM (buildDependencies [] hcTypePairs) setupDeps+ , mapM (buildDependencies [MO.singleton ("nocheck", False)] hcTypePairs) (if testsStatus /= D.TestsDisable then testDeps else []) ] bDeps <- use (A.debInfo . D.control . S.buildDepends)@@ -155,9 +148,9 @@ ghcprof <- liftIO $ compilerPackageName hflavor B.Profiling let ghcrel = if member GHC hcs then maybe [] ((: []) . anyrel') ghcdev else [] let ghcrelprof = if prof then maybe [] ((: []) . anyrel') ghcprof else []- let xs = nub $ [maybe [] (\ n -> [D.Rel (D.BinPkgName "debhelper-compat") (Just (D.EEQ (parseDebianVersion' (show n)))) Nothing]) compat,- [D.Rel (D.BinPkgName "haskell-devscripts-minimal") Nothing Nothing,- D.Rel (D.BinPkgName "haskell-devscripts") (Just $ D.GRE $ parseDebianVersion' ("0.16.42" :: String)) Nothing],+ let xs = nub $ [maybe [] (\ n -> [D.RRel (D.BinPkgName "debhelper-compat") (Just (D.EEQ (parseDebianVersion' (show n)))) Nothing []]) compat,+ [D.RRel (D.BinPkgName "haskell-devscripts-minimal") Nothing Nothing [],+ D.RRel (D.BinPkgName "haskell-devscripts") (Just $ D.GRE $ parseDebianVersion' ("0.16.42" :: String)) Nothing []], anyrel "dh-sequence-haskell"] ++ (ghcrel ++ ghcrelprof) ++ bDeps ++@@ -213,20 +206,20 @@ do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial omitProfDeps <- use (A.debInfo . D.omitProfVersionDeps)- concat <$> mapM (\ hc' -> dependencies hc' B.Documentation name ranges omitProfDeps) (toList hcs)+ concat <$> mapM (\ hc' -> dependencies hc' B.Documentation name ranges omitProfDeps []) (toList hcs) docDependencies _ = return [] -- | 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 :: (MonadIO m) => Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations-buildDependencies hcTypePairs (BuildDepends (Dependency name ranges _)) =+buildDependencies :: (MonadIO m) => [RestrictionList] -> Set (CompilerFlavor, B.PackageType) -> Dependency_ -> CabalT m D.Relations+buildDependencies rlists hcTypePairs (BuildDepends (Dependency name ranges _)) = use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps ->- concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)-buildDependencies _ dep@(ExtraLibs _) =+ concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps rlists) (toList hcTypePairs)+buildDependencies _rlists _ dep@(ExtraLibs _) = do mp <- use (A.debInfo . D.execMap) return $ concat $ adapt mp dep-buildDependencies _ dep =+buildDependencies _rlists _ dep = case unboxDependency dep of Just (Dependency _name _ranges _) -> do mp <- view (A.debInfo . D.execMap) <$> get@@ -240,7 +233,7 @@ adapt mp (BuildTools (Dependency pkg _ _)) = maybe (aptFile (unPackageName pkg)) (: []) (Map.lookup (unPackageName pkg) mp) adapt _flags (ExtraLibs x) = [x]-adapt _flags (BuildDepends (Dependency pkg _ _)) = [[[D.Rel (D.BinPkgName (unPackageName pkg)) Nothing Nothing]]]+adapt _flags (BuildDepends (Dependency pkg _ _)) = [[anyrel' (D.BinPkgName (unPackageName pkg))]] -- There are three reasons this may not work, or may work -- incorrectly: (1) the build environment may be a different@@ -261,21 +254,21 @@ case takeWhile (not . isSpace) out of "" -> error $ "Unable to locate a debian package containing the build tool " ++ pkg ++ ", try using --exec-map " ++ pkg ++ ":<debname> or execMap " ++ show pkg ++- " [[Rel (BinPkgName \"<debname>\") Nothing Nothing]]"- s -> [[[D.Rel (D.BinPkgName s) Nothing Nothing]]]+ " [[RRel (BinPkgName \"<debname>\") Nothing Nothing []]]"+ s -> [[anyrel' (D.BinPkgName s)]] _ -> [] anyrel :: String -> [D.Relation] anyrel x = anyrel' (D.BinPkgName x) anyrel' :: D.BinPkgName -> [D.Relation]-anyrel' x = [D.Rel x Nothing Nothing]+anyrel' x = [D.RRel x Nothing Nothing []] -- | 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 :: MonadIO m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> Bool -> CabalT m Relations-dependencies hc typ name cabalRange omitProfVersionDeps =+dependencies :: MonadIO m => CompilerFlavor -> B.PackageType -> PackageName -> VersionRange -> Bool -> [RestrictionList] -> CabalT m Relations+dependencies hc typ name cabalRange omitProfVersionDeps rlists = do nameMap <- use A.debianNameMap -- Compute a list of alternative debian dependencies for -- satisfying a cabal dependency. The only caveat is that@@ -296,39 +289,23 @@ False -> Just <$> (cataVersionRange rangeToRange . normaliseVersionRange) range''' where-#if !MIN_VERSION_Cabal(3,4,0)- rangeToRange AnyVersionF = return $ Rel' (D.Rel dname Nothing Nothing)-#endif- rangeToRange (ThisVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.EEQ dv)) Nothing)) v- rangeToRange (LaterVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SGR dv)) Nothing)) v- rangeToRange (EarlierVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.SLT dv)) Nothing)) v+ rangeToRange (ThisVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.RRel dname (Just (D.EEQ dv)) Nothing rlists)) v+ rangeToRange (LaterVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.RRel dname (Just (D.SGR dv)) Nothing rlists)) v+ rangeToRange (EarlierVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.RRel dname (Just (D.SLT dv)) Nothing rlists)) v rangeToRange (OrLaterVersionF v)- | v == mkVersion [0] = return $ Rel' (D.Rel dname Nothing Nothing)- | otherwise = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.GRE dv)) Nothing)) v- rangeToRange (OrEarlierVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.Rel dname (Just (D.LTE dv)) Nothing)) v-#if !MIN_VERSION_Cabal(3,4,0)- rangeToRange (WildcardVersionF v) = (\ x y -> debianVersion' name x >>= \ dvx ->- debianVersion' name y >>= \ dvy ->- return $ And [Rel' (D.Rel dname (Just (D.GRE dvx)) Nothing),- Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)]) v (wildcardUpperBound v)-#endif+ | v == mkVersion [0] = return $ Rel' (D.RRel dname Nothing Nothing rlists)+ | otherwise = (debianVersion' name >=> \ dv -> return $ Rel' (D.RRel dname (Just (D.GRE dv)) Nothing rlists)) v+ rangeToRange (OrEarlierVersionF v) = (debianVersion' name >=> \ dv -> return $ Rel' (D.RRel dname (Just (D.LTE dv)) Nothing rlists)) v rangeToRange (MajorBoundVersionF v) = (\ x y -> debianVersion' name x >>= \ dvx -> debianVersion' name y >>= \ dvy ->- return $ And [Rel' (D.Rel dname (Just (D.GRE dvx)) Nothing),- Rel' (D.Rel dname (Just (D.SLT dvy)) Nothing)]) v (majorUpperBound v)+ return $ And [Rel' (D.RRel dname (Just (D.GRE dvx)) Nothing rlists),+ Rel' (D.RRel dname (Just (D.SLT dvy)) Nothing rlists)]) v (majorUpperBound v) rangeToRange (UnionVersionRangesF v1 v2) = (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ Or [x', y']) v1 v2 rangeToRange (IntersectVersionRangesF v1 v2) = (\ x y -> x >>= \ x' -> y >>= \ y' -> return $ And [x', y']) v1 v2-#if !MIN_VERSION_Cabal(3,4,0)- rangeToRange (VersionRangeParensF v) = v-#endif -- Choose the simpler of the two range''' = canon (simpler range' range'') -- Unrestrict the range for versions that we know don't exist for this debian package-#if MIN_VERSION_Cabal(3,6,0) range'' = range' -- inversion functions are gone-#else- range'' = canon (unionVersionRanges range' (invertVersionRange range))-#endif -- Restrict the range to the versions specified for this debian package range' = intersectVersionRanges cabalRange' range -- When we see a cabal equals dependency we need to turn it into@@ -360,8 +337,8 @@ -- If a library is built into the compiler, this is the debian -- package name the compiler will conflict with. doRel :: MonadIO m => Maybe BinPkgName -> D.Relation -> CabalT m [D.Relation]- doRel hcname rel@(D.Rel dname req _) = do- let comp = maybe [] (\x -> [D.Rel x Nothing Nothing]) hcname+ doRel hcname rel@(D.RRel dname req _ _) = do+ let comp = maybe [] (\x -> [D.RRel x Nothing Nothing []]) hcname -- gver <- use ghcVersion -- Look at what version of the package is provided by the compiler. atoms <- get@@ -414,4 +391,4 @@ filterMissing :: Monad m => [[Relation]] -> CabalT m [[Relation]] filterMissing rels = get >>= \ atoms -> return $- List.filter (/= []) (List.map (List.filter (\ (Rel name _ _) -> not (Set.member name (view (A.debInfo . D.missingDependencies) atoms)))) rels)+ List.filter (/= []) (List.map (List.filter (\ (RRel name _ _ _) -> not (Set.member name (view (A.debInfo . D.missingDependencies) atoms)))) rels)
src/Debian/Debianize/CopyrightDescription.hs view
@@ -53,9 +53,7 @@ import qualified Distribution.Package as Cabal import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, licenseRaw, package, maintainer)) import qualified Distribution.Utils.ShortText as ST-#if MIN_VERSION_Cabal(3,6,0) import qualified Distribution.Utils.Path as DUP-#endif import Network.URI (URI, parseURI) import Prelude hiding (init, init, log, log, unlines, readFile) import Text.PrettyPrint.HughesPJClass (text)@@ -253,23 +251,14 @@ -- provided @copyright0@ value. defaultCopyrightDescription :: Cabal.PackageDescription -> IO CopyrightDescription defaultCopyrightDescription pkgDesc = do-#if MIN_VERSION_Cabal(3,6,0) let (debianCopyrightPath, otherLicensePaths) = partition (== DUP.unsafeMakeSymbolicPath "debian/copyright") (Cabal.licenseFiles pkgDesc)-#else- let (debianCopyrightPath, otherLicensePaths) = partition (== "debian/copyright") (Cabal.licenseFiles pkgDesc)-#endif license = either (\x -> OtherLicense ("SPDX license: " ++ show x)) fromCabalLicense $ Cabal.licenseRaw pkgDesc pkgname = unPackageName . Cabal.pkgName . Cabal.package $ pkgDesc maintainer = Cabal.maintainer $ pkgDesc -- This is an @Nothing@ unless debian/copyright is (for some -- reason) mentioned in the cabal file.-#if MIN_VERSION_Cabal(3,6,0) debianCopyrightText <- mapM (readFileMaybe . DUP.getSymbolicPath) debianCopyrightPath >>= return . listToMaybe . catMaybes licenseCommentPairs <- mapM (readFileMaybe . DUP.getSymbolicPath) otherLicensePaths >>= return . filter (isJust . snd) . zip otherLicensePaths-#else- debianCopyrightText <- mapM readFileMaybe debianCopyrightPath >>= return . listToMaybe . catMaybes- licenseCommentPairs <- mapM readFileMaybe otherLicensePaths >>= return . filter (isJust . snd) . zip otherLicensePaths-#endif return $ case debianCopyrightText of Just t -> def { _summaryComment = Just t }@@ -279,11 +268,7 @@ def { _filesAndLicenses = [ sourceDefaultFilesDescription copyrt license, debianDefaultFilesDescription license ] ++-#if MIN_VERSION_Cabal(3,6,0) defaultLicenseDescriptions license (map (\(x,y) -> (DUP.getSymbolicPath x, y)) licenseCommentPairs)-#else- defaultLicenseDescriptions license licenseCommentPairs-#endif , _upstreamName = Just . pack $ pkgname , _upstreamSource = Just . pack $ "https://hackage.haskell.org/package/" ++ pkgname , _upstreamContact = nothingIf Text.null (toText maintainer)
src/Debian/Debianize/Details.hs view
@@ -14,7 +14,7 @@ import Debian.Debianize.CabalInfo as A (epochMap, debInfo) import Debian.Debianize.DebInfo as D (execMap) import Debian.Debianize.VersionSplits (DebBase(DebBase))-import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))+import Debian.Relation (BinPkgName(BinPkgName), Relation(RRel)) import Distribution.Package (mkPackageName) import Distribution.Version (mkVersion) @@ -28,7 +28,7 @@ A.epochMap %= Map.insert (mkPackageName "HTTP") 1 -- 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]])+ mapM_ (\name -> (A.debInfo . D.execMap) %= Map.insert name [[RRel (BinPkgName name) Nothing Nothing []]]) ["alex", "c2hs", "ghc", "happy", "hsx2hs"] mapCabal (mkPackageName "QuickCheck") (DebBase "quickcheck2") -- Something was required for this package at one time - it
src/Debian/Debianize/Finalize.hs view
@@ -43,7 +43,7 @@ import Debian.Orphans () import Debian.Policy (getCurrentDebianUser, getDebhelperCompatLevel, haskellMaintainer, maintainerOfLastResort, PackageArchitectures(Any, All), PackagePriority(Optional), parseMaintainer, parseStandardsVersion, Section(..), SourceFormat(Native3)) import Debian.Pretty (PP(..), ppShow)-import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), Relation(Rel), Relations, SrcPkgName(SrcPkgName))+import Debian.Relation (BinPkgName, BinPkgName(BinPkgName), Relation(RRel), Relations, SrcPkgName(SrcPkgName)) import qualified Debian.Relation as D (BinPkgName(BinPkgName), Relation(..)) import Debian.Time (getCurrentLocalRFC822Time) import qualified Debian.Version as V (buildDebianVersion, DebianVersion, parseDebianVersion', epoch, version, revision)@@ -60,7 +60,7 @@ import System.IO (hPutStrLn, stderr) import Text.Parsec.Rfc2822 (NameAddr(..)) import Distribution.Pretty (Pretty(pretty))-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) import Distribution.Utils.Path (interpretSymbolicPath) #endif @@ -430,7 +430,7 @@ g :: PackageDescription -> Map String Relations -> Relations g pkgDesc libMap = concatMap (devDep libMap) (nub $ concatMap Cabal.extraLibs $ Cabal.allBuildInfo $ pkgDesc) devDep :: Map String Relations -> String -> Relations- devDep libMap cab = maybe [[Rel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing]] id (Map.lookup cab libMap)+ devDep libMap cab = maybe [[RRel (BinPkgName ("lib" ++ cab ++ "-dev")) Nothing Nothing []]] id (Map.lookup cab libMap) -- | Applies a few settings to official packages (unless already set) checkOfficialSettings :: (Monad m) => CompilerFlavor -> CabalT m ()@@ -472,7 +472,7 @@ List.filter (not . List.null) (List.map filterOrRelation orRels) where filterOrRelation :: [Relation] -> [Relation]- filterOrRelation rels = List.filter (\ (Rel name _ _) -> not (elem name badNames)) rels+ filterOrRelation rels = List.filter (\ (RRel name _ _ _) -> not (elem name badNames)) rels cabalExecBinaryPackage :: Monad m => BinPkgName -> CabalT m () cabalExecBinaryPackage b =@@ -571,7 +571,7 @@ installedExec = Set.unions (Map.elems installedExecMap) prefixPath <- dataTop-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) let dFpD = List.map (interpretSymbolicPath Nothing) (Cabal.dataFiles pkgDesc) #else let dFpD = Cabal.dataFiles pkgDesc@@ -752,7 +752,7 @@ anyrel x = anyrel' (D.BinPkgName x) anyrel' :: D.BinPkgName -> [D.Relation]-anyrel' x = [D.Rel x Nothing Nothing]+anyrel' x = [D.RRel x Nothing Nothing []] -- Lifted from Distribution.Simple.Setup, since it's not exported. flagList :: String -> [(FlagName, Bool)]
src/Debian/Debianize/Goodies.hs view
@@ -32,7 +32,7 @@ import Debian.Orphans () import Debian.Policy (apacheAccessLog, apacheErrorLog, apacheLogDirectory, databaseDirectory, dataDirectory, serverAccessLog, serverAppLog) import Debian.Pretty (ppText)-import Debian.Relation (BinPkgName(BinPkgName), Relation(Rel))+import Debian.Relation (BinPkgName(BinPkgName), Relation(RRel)) import Distribution.PackageDescription as Cabal (PackageDescription) import Distribution.Simple.Build.PathsModule (pkgPathEnvVar) import Prelude hiding (init, log, map, unlines, writeFile)@@ -87,8 +87,8 @@ doBackups :: Monad m => BinPkgName -> String -> CabalT m () doBackups bin s = do (A.debInfo . D.backups) %= Map.insert bin s- (A.debInfo . D.binaryDebDescription bin . B.relations . B.depends) %= (++ [[Rel (BinPkgName "anacron") Nothing Nothing]])- -- depends +++= (bin, Rel (BinPkgName "anacron") Nothing Nothing)+ (A.debInfo . D.binaryDebDescription bin . B.relations . B.depends) %= (++ [[RRel (BinPkgName "anacron") Nothing Nothing []]])+ -- depends +++= (bin, RRel (BinPkgName "anacron") Nothing Nothing []) oldClckwrksSiteFlags :: D.Site -> [String] oldClckwrksSiteFlags x =
src/Debian/Debianize/InputCabal.hs view
@@ -20,16 +20,16 @@ import Distribution.Package (Package(packageId)) import Distribution.PackageDescription as Cabal (PackageDescription) import Distribution.PackageDescription.Configuration (finalizePD)-#if MIN_VERSION_Cabal(3,16,0)+#if MIN_VERSION_Cabal_syntax(3,16,0) import Distribution.Types.DependencySatisfaction (DependencySatisfaction(Satisfied)) #endif-#if MIN_VERSION_Cabal(3,8,1)+#if MIN_VERSION_Cabal_syntax(3,8,1) import Distribution.Simple.PackageDescription (readGenericPackageDescription) #else import Distribution.PackageDescription.Parsec (readGenericPackageDescription) #endif import Distribution.Types.ComponentRequestedSpec (ComponentRequestedSpec(ComponentRequestedSpec))-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) import Distribution.Simple.Utils (defaultPackageDescCwd, die', setupMessage) import Distribution.Utils.Path (relativeSymbolicPath) #else@@ -37,11 +37,7 @@ #endif import Distribution.System as Cabal (buildArch, Platform(..)) import qualified Distribution.System as Cabal (buildOS)-#if MIN_VERSION_Cabal(3,2,0) import Distribution.Types.Flag (mkFlagAssignment)-#else-import Distribution.Types.GenericPackageDescription (mkFlagAssignment)-#endif import Distribution.Verbosity (Verbosity) import Prelude hiding (break, lines, log, null, readFile, sum) import System.Directory (doesFileExist, getCurrentDirectory)@@ -62,7 +58,7 @@ -- Load a GenericPackageDescription from the current directory -- and from that create a finalized PackageDescription for the -- given CompilerId.-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) genPkgDesc <- liftIO $ defaultPackageDescCwd vb >>= readGenericPackageDescription vb Nothing . relativeSymbolicPath #else genPkgDesc <- liftIO $ defaultPackageDesc vb >>= readGenericPackageDescription vb@@ -78,7 +74,7 @@ ePkgDesc vb = intToVerbosity' $ view verbosity flags fs = view cabalFlagAssignments flags-#if MIN_VERSION_Cabal(3,16,0)+#if MIN_VERSION_Cabal_syntax(3,16,0) satisfied = Satisfied #else satisfied = True
src/Debian/Debianize/InputDebian.hs view
@@ -39,7 +39,7 @@ --import Debug.Trace (trace) import Distribution.Package (PackageIdentifier(..), unPackageName) import qualified Distribution.PackageDescription as Cabal (dataDir, PackageDescription(package))-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) import Distribution.Utils.Path (interpretSymbolicPath) #endif import Prelude hiding (break, lines, log, null, readFile, sum, words)@@ -302,7 +302,7 @@ dataTop :: Monad m => CabalT m FilePath dataTop = do d <- use packageDescription-#if MIN_VERSION_Cabal(3,14,0)+#if MIN_VERSION_Cabal_syntax(3,14,0) return $ case interpretSymbolicPath Nothing (Cabal.dataDir d) of #else return $ case Cabal.dataDir d of
src/Debian/Orphans.hs view
@@ -34,21 +34,21 @@ deriving instance Data Compiler deriving instance Data CompilerId -#if !MIN_VERSION_Cabal(3,10,1)+#if !MIN_VERSION_Cabal_syntax(3,10,1) deriving instance Ord Language #endif deriving instance Ord Compiler deriving instance Ord NameAddr-#if !MIN_VERSION_Cabal(3,10,1)+#if !MIN_VERSION_Cabal_syntax(3,10,1) deriving instance Ord License #endif -#if !MIN_VERSION_Cabal(3,10,1)+#if !MIN_VERSION_Cabal_syntax(3,10,1) instance Ord Executable where compare = compare `on` exeName #endif -#if !MIN_VERSION_Cabal(3,8,1)+#if !MIN_VERSION_Cabal_syntax(3,8,1) instance Ord PackageDescription where compare = compare `on` package #endif@@ -103,23 +103,14 @@ pretty (PP range) = (cataVersionRange prettyRange . normaliseVersionRange) range prettyRange :: VersionRangeF Text.PrettyPrint.HughesPJ.Doc -> Text.PrettyPrint.HughesPJ.Doc-#if !MIN_VERSION_Cabal(3,4,0)-prettyRange AnyVersionF = (text "*")-#endif prettyRange (ThisVersionF v) = text "=" <> pretty (PP v) prettyRange (LaterVersionF v) = text ">" <> pretty (PP v) prettyRange (EarlierVersionF v) = text "<" <> pretty (PP v) prettyRange (OrLaterVersionF v) = text ">=" <> pretty (PP v) prettyRange (OrEarlierVersionF v) = text "<=" <> pretty (PP v)-#if !MIN_VERSION_Cabal(3,4,0)-prettyRange (WildcardVersionF v) = text "=" <> pretty (PP v) <> text ".*" -- not exactly right-#endif prettyRange (MajorBoundVersionF v) = text " >= " <> pretty (PP v) -- maybe this will do? prettyRange (UnionVersionRangesF v1 v2) = text "(" <> v1 <> text " || " <> v2 <> text ")" prettyRange (IntersectVersionRangesF v1 v2) = text "(" <> v1 <> text " && " <> v2 <> text ")"-#if !MIN_VERSION_Cabal(3,4,0)-prettyRange (VersionRangeParensF v) = text "(" <> v <> text ")"-#endif instance Pretty (PP Version) where pretty = text . prettyShow . unPP