--- Commands/Spec.hs.orig
+++ Commands/Spec.hs
@@ -27,28 +27,26 @@
import Header (headerOption, withSpecHead)
import PackageUtils (bringTarball, latestPackage, PackageData (..), prepare)
import SimpleCabal (buildable, mkPackageName, PackageDescription (..),
PackageIdentifier(..), PackageName, showVersion)
import SimpleCmd ((+-+), grep_, removePrefix)
import Stackage (defaultLTS)
-import Types
+import Types (Flags, LibPkgType(Base, Devel, Doc, Prof, Static),
+ PackageType(BinaryPkg, SpecFile, StandalonePkg),
+ PackageVersionSpecifier(PVPackageId), pvsStream,
+ RpmPackage(RpmHsLib), showRpm, showStream, Stream)
import Control.Monad (filterM, forM_, unless, void, when, (>=>))
-#if (defined(MIN_VERSION_base) && MIN_VERSION_base(4,8,0))
-#else
---import Control.Applicative ((<$>))
-#endif
-
import Data.Char (toUpper)
import Data.List (groupBy, intercalate, intersect, isPrefixOf,
nub, sort, (\\))
import Data.Maybe (isJust, fromMaybe, fromJust)
import Data.Time.Clock (getCurrentTime)
import Data.Time.Format (formatTime)
-import qualified Data.Version as V
+import qualified Data.Version as V (showVersion)
import Distribution.Text (display)
import Distribution.License (License (..)
#if defined(MIN_VERSION_Cabal) && MIN_VERSION_Cabal(2,2,0)
, licenseFromSPDX
#endif
@@ -77,12 +75,14 @@
import System.Locale (defaultTimeLocale)
#endif
import System.FilePath (takeBaseName, (</>), (<.>))
import qualified Paths_cabal_rpm (version)
+import qualified Distribution.Utils.ShortText as ST (fromShortText)
rstrip :: (Char -> Bool) -> String -> String
rstrip p = reverse . dropWhile p . reverse
#if defined(MIN_VERSION_Cabal) && MIN_VERSION_Cabal(2,0,0)
#else
@@ -179,25 +179,25 @@
put $ "# generated by cabal-rpm-" ++ V.showVersion Paths_cabal_rpm.version
+-+ unwords (["--standalone" | standalone] ++ ["--stream " ++ showStream (fromJust mstream) | isJust mstream, mstream /= Just defaultLTS] ++ ["--subpackage" | subpackage])
put "# https://docs.fedoraproject.org/en-US/packaging-guidelines/Haskell/"
putNewline
-- Some packages conflate the synopsis and description fields. Ugh.
- let syn = synopsis pkgDesc
+ let syn = ST.fromShortText $ synopsis pkgDesc
when (null syn) $
warn verbose "this package has no synopsis."
let initialCapital (c:cs) = toUpper c:cs
initialCapital [] = []
let syn' = if null syn
then "Haskell" +-+ name +-+ "package"
else (unwords . lines . initialCapital) syn
let summary = rstrip (== '.') syn'
when (length ("Summary : " ++ syn') > 79) $
warn verbose "this package has a long synopsis."
- let descr = description pkgDesc
+ let descr = ST.fromShortText $ description pkgDesc
when (null descr) $
warn verbose "this package has no description."
let descLines = (formatParagraphs . initialCapital . filterSymbols . finalPeriod) $ if null descr then syn' else descr
finalPeriod cs = if last cs == '.' then cs else cs ++ "."
filterSymbols (c:cs) =
if c `notElem` "@\\" then c: filterSymbols cs
--- Types.hs.orig
+++ Types.hs
@@ -29,13 +29,13 @@
streamPkgToPVS,
unversionedPkgId,
Verbose(..)
) where
import Data.Char (isDigit {--, toLower--})
-import Data.List
+import Data.List (groupBy, isPrefixOf, stripPrefix)
import Data.Maybe (fromMaybe)
#if (defined(MIN_VERSION_base) && MIN_VERSION_base(4,11,0))
#else
import Data.Semigroup ((<>))
#endif
import Distribution.Text (display)