cabal-debian 5.1 → 5.1.1
raw patch · 6 files changed
+48/−8 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cabal-debian.cabal +3/−3
- src/Debian/Debianize/BuildDependencies.hs +20/−2
- src/Debian/Debianize/CopyrightDescription.hs +16/−0
- src/Debian/Debianize/Finalize.hs +1/−1
- src/Debian/Debianize/Optparse.hs +1/−1
- src/Debian/Orphans.hs +7/−1
cabal-debian.cabal view
@@ -1,6 +1,6 @@ Name: cabal-debian-Version: 5.1-Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2020 Clint Adams+Version: 5.1.1+Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2022 Clint Adams License: BSD3 License-File: LICENSE Author: David Fox <dsf@seereason.com>@@ -144,7 +144,7 @@ test-data/artvaluereport2/output/debian/artvaluereport2-backups.install test-data/artvaluereport2/output/debian/copyright test-data/artvaluereport2/output/debian/source/format-Tested-With: GHC ==8.6.5 || ==8.4.4 || ==8.2.2+Tested-With: GHC ==9.2.3 || ==9.0.2 || ==8.10.7 || ==8.8.4 || ==8.6.5 || ==8.4.4 Source-Repository head type: git
src/Debian/Debianize/BuildDependencies.hs view
@@ -39,8 +39,14 @@ import qualified Distribution.PackageDescription as Cabal (PackageDescription(library, executables, testSuites)) import Distribution.Pretty (prettyShow) import Distribution.Types.LegacyExeDependency (LegacyExeDependency(..))-import Distribution.Types.PkgconfigDependency (PkgconfigDependency(..))+#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) import System.Exit (ExitCode(ExitSuccess))@@ -111,7 +117,9 @@ -- | Take the intersection of all the dependencies on a given package name mergeCabalDependencies :: [Dependency] -> [Dependency] mergeCabalDependencies =-#if MIN_VERSION_Cabal(3,0,0)+#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)+#elif 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)@@ -322,27 +330,37 @@ 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 (OrLaterVersionF v) = (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 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) 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
src/Debian/Debianize/CopyrightDescription.hs view
@@ -56,6 +56,9 @@ #if MIN_VERSION_Cabal(3,2,0) import qualified Distribution.Utils.ShortText as ST #endif+#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,14 +256,23 @@ -- 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 }@@ -270,7 +282,11 @@ 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/Finalize.hs view
@@ -463,7 +463,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")+ S.standardsVersion .?= Just (parseStandardsVersion "4.6.1") S.homepage .?= Just ("https://hackage.haskell.org/package/" <> pack (unPackageName cabal)) S.vcsFields %= Set.union (Set.fromList [ S.VCSBrowser packagesURI
src/Debian/Debianize/Optparse.hs view
@@ -354,7 +354,7 @@ standardsVersionP = O.option (parseStandardsVersion <$> O.str) m where m = O.help helpMsg <> O.long "standards-version"- <> O.value (parseStandardsVersion "4.5.0")+ <> O.value (parseStandardsVersion "4.6.1") <> O.metavar "CABALVERSION" helpMsg = unlines [ "Claim compatibility to this version of the Debian policy",
src/Debian/Orphans.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, StandaloneDeriving #-}+{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings, StandaloneDeriving #-} {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} module Debian.Orphans where @@ -96,17 +96,23 @@ 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