cabal-debian 5.0.3 → 5.1
raw patch · 5 files changed
+60/−12 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cabal-debian.cabal +1/−1
- src/Debian/Debianize/CabalInfo.hs +13/−2
- src/Debian/Debianize/CopyrightDescription.hs +21/−3
- src/Debian/Debianize/Finalize.hs +17/−5
- src/Debian/Debianize/InputCabal.hs +8/−1
cabal-debian.cabal view
@@ -1,5 +1,5 @@ Name: cabal-debian-Version: 5.0.3+Version: 5.1 Copyright: Copyright (c) 2007-2014, David Fox, Jeremy Shaw; 2017-2020 Clint Adams License: BSD3 License-File: LICENSE
src/Debian/Debianize/CabalInfo.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wall #-} module Debian.Debianize.CabalInfo ( -- * Types@@ -33,6 +36,9 @@ import Debian.Version (DebianVersion) import Distribution.Package (PackageName) import Distribution.PackageDescription as Cabal (PackageDescription(homepage))+#if MIN_VERSION_Cabal(3,2,0)+import qualified Distribution.Utils.ShortText as ST+#endif import Prelude hiding (init, init, log, log, null) -- | Bits and pieces of information about the mapping from cabal package@@ -78,10 +84,15 @@ copyrt <- liftIO $ defaultCopyrightDescription pkgDesc execStateT (do (debInfo . copyright) .= Just copyrt- (debInfo . control . S.homepage) .= case strip (pack (Cabal.homepage pkgDesc)) of+ (debInfo . control . S.homepage) .= case strip (toText (Cabal.homepage pkgDesc)) of x | Text.null x -> Nothing x -> Just x) (makeCabalInfo flags' pkgDesc)+#if MIN_VERSION_Cabal(3,2,0)+ toText = pack . ST.fromShortText+#else+ toText = pack+#endif makeCabalInfo :: Flags -> PackageDescription -> CabalInfo makeCabalInfo fs pkgDesc =
src/Debian/Debianize/CopyrightDescription.hs view
@@ -1,5 +1,13 @@ -- | <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/>-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, TupleSections, LambdaCase #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TupleSections #-}+ module Debian.Debianize.CopyrightDescription ( CopyrightDescription(..) , FilesOrLicenseDescription(..)@@ -45,6 +53,9 @@ import qualified Distribution.License as Cabal (License(UnknownLicense)) import qualified Distribution.Package as Cabal import qualified Distribution.PackageDescription as Cabal (PackageDescription(licenseFiles, copyright, licenseRaw, package, maintainer))+#if MIN_VERSION_Cabal(3,2,0)+import qualified Distribution.Utils.ShortText as ST+#endif import Network.URI (URI, parseURI) import Prelude hiding (init, init, log, log, unlines, readFile) import Text.PrettyPrint.HughesPJClass (text)@@ -255,15 +266,22 @@ def { _summaryComment = Just t } Nothing -> -- All we have is the name of the license- let copyrt = fmap dots $ nothingIf (Text.null . strip) (pack (Cabal.copyright pkgDesc)) in+ let copyrt = fmap dots $ nothingIf (Text.null . strip) (toText (Cabal.copyright pkgDesc)) in def { _filesAndLicenses = [ sourceDefaultFilesDescription copyrt license, debianDefaultFilesDescription license ] ++ defaultLicenseDescriptions license licenseCommentPairs , _upstreamName = Just . pack $ pkgname , _upstreamSource = Just . pack $ "https://hackage.haskell.org/package/" ++ pkgname- , _upstreamContact = nothingIf Text.null (pack maintainer)+ , _upstreamContact = nothingIf Text.null (toText maintainer) }+ where+ toText =+#if MIN_VERSION_Cabal(3,2,0)+ pack . ST.fromShortText+#else+ pack+#endif {- -- We don't really have a way to associate licenses with
src/Debian/Debianize/Finalize.hs view
@@ -54,8 +54,10 @@ 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 import Distribution.PackageDescription as Cabal (PackageDescription(dataFiles, {-description,-} executables, library, package, synopsis))+#if MIN_VERSION_Cabal(3,2,0)+import qualified Distribution.Utils.ShortText as ST+#endif import Prelude hiding (init, log, map, unlines, unlines, writeFile) import System.Directory (doesFileExist) import System.FilePath ((<.>), (</>), makeRelative, splitFileName, takeDirectory, takeFileName)@@ -262,8 +264,13 @@ pkgDesc <- use A.packageDescription maintainerOption <- use (A.debInfo . D.maintainerOption) uploadersOption <- use (A.debInfo . D.uploadersOption)- let cabalAuthorString = takeWhile (\ c -> c /= ',' && c /= '\n') (Cabal.author pkgDesc)- cabalMaintainerString = takeWhile (\ c -> c /= ',' && c /= '\n') (Cabal.maintainer pkgDesc)+#if MIN_VERSION_Cabal(3,2,0)+ let toString = ST.fromShortText+#else+ let toString = id+#endif+ cabalAuthorString = takeWhile (\ c -> c /= ',' && c /= '\n') (toString (Cabal.author pkgDesc))+ cabalMaintainerString = takeWhile (\ c -> c /= ',' && c /= '\n') (toString (Cabal.maintainer pkgDesc)) cabalMaintainerString' = cabalAuthorString <> " <" <> cabalMaintainerString <> ">" cabalMaintainerString'' = cabalAuthorString <> " " <> cabalMaintainerString changelogSignature <-@@ -369,10 +376,15 @@ -- I don't know why (unwords . words) was applied here. Maybe I'll find out when -- this version goes into production. :-/ Ok, now I know, because sometimes the -- short cabal description has more than one line.- synop = List.intercalate " " $ fmap (dropWhileEnd isSpace) $ lines $ synopsis p+ synop = List.intercalate " " $ fmap (dropWhileEnd isSpace) $ lines $ toString $ synopsis p desc' :: [String]- desc' = List.map addDot . stripWith List.null $ fmap (dropWhileEnd isSpace) $ lines $ Cabal.description p+ desc' = List.map addDot . stripWith List.null $ fmap (dropWhileEnd isSpace) $ lines $ toString $ Cabal.description p addDot line = if List.null line then "." else line+#if MIN_VERSION_Cabal(3,2,0)+ toString = ST.fromShortText+#else+ toString = id+#endif -- | Make sure there is a changelog entry with the version number and -- source package name implied by the debianization. This means
src/Debian/Debianize/InputCabal.hs view
@@ -1,5 +1,8 @@ -- | Input the Cabal package description.-{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-} module Debian.Debianize.InputCabal ( inputCabalization ) where@@ -22,7 +25,11 @@ 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(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)