cabal-debian 5.0.1 → 5.0.2
raw patch · 3 files changed
+38/−3 lines, 3 filesdep ~CabalPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal
API changes (from Hackage documentation)
Files
- cabal-debian.cabal +1/−1
- src/Debian/Debianize/BuildDependencies.hs +35/−0
- src/Debian/Debianize/InputCabal.hs +2/−2
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 5.0.1+Version: 5.0.2 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2020 Clint Adams License: BSD3 License-File: LICENSE
src/Debian/Debianize/BuildDependencies.hs view
@@ -78,7 +78,11 @@ unboxDependency (BuildDepends d) = Just d unboxDependency (BuildTools d) = Just d unboxDependency (PkgConfigDepends d) = Just d+#if MIN_VERSION_Cabal(3,0,0)+unboxDependency (ExtraLibs _) = Nothing -- Dependency (PackageName d) anyVersion mempty+#else unboxDependency (ExtraLibs _) = Nothing -- Dependency (PackageName d) anyVersion+#endif -- |Debian packages don't have per binary package build dependencies, -- so we just gather them all up here.@@ -113,9 +117,17 @@ -- | Take the intersection of all the dependencies on a given package name mergeCabalDependencies :: [Dependency] -> [Dependency] mergeCabalDependencies =+#if MIN_VERSION_Cabal(3,0,0)+ List.map (foldl1 (\ (Dependency name range1 _) (Dependency _ range2 _) -> Dependency name (intersectVersionRanges range1 range2) mempty)) . groupBy ((==) `on` dependencyPackage) . sortBy (compare `on` dependencyPackage)+#else List.map (foldl1 (\ (Dependency name range1) (Dependency _ range2) -> Dependency name (intersectVersionRanges range1 range2))) . groupBy ((==) `on` dependencyPackage) . sortBy (compare `on` dependencyPackage)+#endif where+#if MIN_VERSION_Cabal(3,0,0)+ dependencyPackage (Dependency x _ _) = x+#else dependencyPackage (Dependency x _) = x+#endif -- The haskell-devscripts-minimal package contains the hlibrary.mk file with -- the rules for building haskell packages.@@ -206,7 +218,11 @@ -- documentation package for any libraries which are build -- dependencies, so we have use to all the cross references. docDependencies :: (MonadIO m) => Dependency_ -> CabalT m D.Relations+#if MIN_VERSION_Cabal(3,0,0)+docDependencies (BuildDepends (Dependency name ranges _)) =+#else docDependencies (BuildDepends (Dependency name ranges)) =+#endif do hc <- use (A.debInfo . D.flags . compilerFlavor) let hcs = singleton hc -- vestigial omitProfDeps <- use (A.debInfo . D.omitProfVersionDeps)@@ -217,27 +233,46 @@ -- 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+#if MIN_VERSION_Cabal(3,0,0)+buildDependencies hcTypePairs (BuildDepends (Dependency name ranges _)) =+ use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps ->+ concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)+#else buildDependencies hcTypePairs (BuildDepends (Dependency name ranges)) = use (A.debInfo . D.omitProfVersionDeps) >>= \ omitProfDeps -> concat <$> mapM (\ (hc, typ) -> dependencies hc typ name ranges omitProfDeps) (toList hcTypePairs)+#endif buildDependencies _ dep@(ExtraLibs _) = do mp <- use (A.debInfo . D.execMap) return $ concat $ adapt mp dep buildDependencies _ dep = case unboxDependency dep of+#if MIN_VERSION_Cabal(3,0,0)+ Just (Dependency _name _ranges _) ->+#else Just (Dependency _name _ranges) ->+#endif do mp <- view (A.debInfo . D.execMap) <$> get return $ concat $ adapt mp dep Nothing -> return [] adapt :: Map.Map String Relations -> Dependency_ -> [Relations]+#if MIN_VERSION_Cabal(3,0,0)+adapt mp (PkgConfigDepends (Dependency pkg _ _)) =+ maybe (aptFile (unPackageName pkg)) (: []) (Map.lookup (unPackageName pkg) mp)+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]]]+#else adapt mp (PkgConfigDepends (Dependency pkg _)) = maybe (aptFile (unPackageName pkg)) (: []) (Map.lookup (unPackageName pkg) mp) 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]]]+#endif -- There are three reasons this may not work, or may work -- incorrectly: (1) the build environment may be a different
src/Debian/Debianize/InputCabal.hs view
@@ -39,7 +39,7 @@ import Distribution.PackageDescription.Parse (readPackageDescription) #endif #endif-import Distribution.Simple.Utils (defaultPackageDesc, die, setupMessage)+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)@@ -109,4 +109,4 @@ ret <- system "autoreconf" case ret of ExitSuccess -> return ()- ExitFailure n -> die ("autoreconf failed with status " ++ show n)+ ExitFailure n -> die' verbose ("autoreconf failed with status " ++ show n)