Hello community,

here is the log from the commit of package hpack for openSUSE:Factory checked 
in at 2018-07-24 17:23:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hpack (Old)
 and      /work/SRC/openSUSE:Factory/.hpack.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hpack"

Tue Jul 24 17:23:37 2018 rev:11 rq:623904 version:0.29.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/hpack/hpack.changes      2018-05-30 
12:28:57.830759355 +0200
+++ /work/SRC/openSUSE:Factory/.hpack.new/hpack.changes 2018-07-24 
17:23:37.879395521 +0200
@@ -1,0 +2,24 @@
+Wed Jul 18 14:26:50 UTC 2018 - psim...@suse.com
+
+- Cosmetic: replace tabs with blanks, strip trailing white space,
+  and update copyright headers with spec-cleaner.
+
+-------------------------------------------------------------------
+Tue Jul 17 19:31:03 UTC 2018 - psim...@suse.com
+
+- Update hpack to version 0.29.5.
+  - Fix a regression related to indentation sniffing (close #310)
+  - Desugar ^>= when dependency is a string (see #309)
+  - Add support for Apache, MPL and ISC when inferring `license` (see #305)
+  - Desugar `^>=` for compatibility with `Cabal < 2` (see #213)
+  - Add support for GPL, LGPL and AGPL when inferring `license` (see #305)
+  - Add missing `extra-source-files` (see #302)
+  - Infer `license` from `license-file`
+  - Put the `cabal-version` at the beginning of the generated file. This Is
+    required with `cabal-version: 2.1` and higher. (see #292)
+  - With `cabal-version: 2.1` or higher omit `>=` when rendering (see #292)
+  - Require `cabal-version: 2.2` when SPDX license identifiers are used (see 
#292)
+  - Map cabal-style licenses to SPDX license identifiers when `cabal-version`
+    is 2.2 or higher (see #292)
+
+-------------------------------------------------------------------
@@ -92 +115,0 @@
-

Old:
----
  hpack-0.28.2.tar.gz

New:
----
  hpack-0.29.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hpack.spec ++++++
--- /var/tmp/diff_new_pack.Cgjt4u/_old  2018-07-24 17:23:38.279396032 +0200
+++ /var/tmp/diff_new_pack.Cgjt4u/_new  2018-07-24 17:23:38.283396036 +0200
@@ -19,7 +19,7 @@
 %global pkg_name hpack
 %bcond_with tests
 Name:           %{pkg_name}
-Version:        0.28.2
+Version:        0.29.5
 Release:        0
 Summary:        An alternative format for Haskell packages
 License:        MIT
@@ -40,6 +40,7 @@
 BuildRequires:  ghc-http-client-devel
 BuildRequires:  ghc-http-client-tls-devel
 BuildRequires:  ghc-http-types-devel
+BuildRequires:  ghc-infer-license-devel
 BuildRequires:  ghc-pretty-devel
 BuildRequires:  ghc-rpm-macros
 BuildRequires:  ghc-scientific-devel

++++++ hpack-0.28.2.tar.gz -> hpack-0.29.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/CHANGELOG.md 
new/hpack-0.29.5/CHANGELOG.md
--- old/hpack-0.28.2/CHANGELOG.md       2018-03-16 11:34:12.000000000 +0100
+++ new/hpack-0.29.5/CHANGELOG.md       2018-07-16 22:27:18.000000000 +0200
@@ -1,4 +1,29 @@
-## next
+## Changes in 0.29.5
+  - Fix a regression related to indentation sniffing (close #310)
+
+## Changes in 0.29.4
+  - Desugar ^>= when dependency is a string (see #309)
+  - Add support for Apache, MPL and ISC when inferring `license` (see #305)
+
+## Changes in 0.29.3
+  - Desugar `^>=` for compatibility with `Cabal < 2` (see #213)
+  - Add support for GPL, LGPL and AGPL when inferring `license` (see #305)
+
+## Changes in 0.29.2
+  - Add missing `extra-source-files` (see #302)
+
+## Changes in 0.29.1
+  - Infer `license` from `license-file`
+
+## Changes in 0.29.0
+  - Put the `cabal-version` at the beginning of the generated file. This Is
+    required with `cabal-version: 2.1` and higher. (see #292)
+  - With `cabal-version: 2.1` or higher omit `>=` when rendering (see #292)
+  - Require `cabal-version: 2.2` when SPDX license identifiers are used (see 
#292)
+  - Map cabal-style licenses to SPDX license identifiers when `cabal-version`
+    is 2.2 or higher (see #292)
+
+## Changes in 0.28.2
   - Exit with `exitFailure` on `AlreadyGeneratedByNewerHpack` or
     `ExistingCabalFileWasModifiedManually` in `Hpack.printResult`
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/hpack.cabal new/hpack-0.29.5/hpack.cabal
--- old/hpack-0.28.2/hpack.cabal        2018-03-16 11:34:12.000000000 +0100
+++ new/hpack-0.29.5/hpack.cabal        2018-07-16 22:27:18.000000000 +0200
@@ -1,11 +1,13 @@
--- This file has been generated from package.yaml by hpack version 0.27.0.
+cabal-version: >= 1.10
+
+-- This file has been generated from package.yaml by hpack version 0.29.4.
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 5391105d37fea2b976290b95e847c0d2da5ea7e0ef9ae9e5cf8945911dd983a1
+-- hash: c9c40490b86bd987b33ab63f10fd311c44b89e37d5a75d5af8cd25db72992e99
 
 name:           hpack
-version:        0.28.2
+version:        0.29.5
 synopsis:       An alternative format for Haskell packages
 description:    See README at <https://github.com/sol/hpack#readme>
 category:       Development
@@ -15,8 +17,6 @@
 license:        MIT
 license-file:   LICENSE
 build-type:     Simple
-cabal-version:  >= 1.10
-
 extra-source-files:
     CHANGELOG.md
 
@@ -29,7 +29,7 @@
       src
   ghc-options: -Wall
   build-depends:
-      Cabal
+      Cabal >=2.2
     , Glob >=0.9.0
     , aeson >=1.2.1.0
     , base >=4.9 && <5
@@ -43,6 +43,7 @@
     , http-client
     , http-client-tls
     , http-types
+    , infer-license >=0.2.0 && <0.3
     , pretty
     , scientific
     , text
@@ -63,6 +64,7 @@
       Hpack.CabalFile
       Hpack.Defaults
       Hpack.Haskell
+      Hpack.License
       Hpack.Options
       Hpack.Render.Dsl
       Hpack.Render.Hints
@@ -80,7 +82,7 @@
       driver
   ghc-options: -Wall
   build-depends:
-      Cabal
+      Cabal >=2.2
     , Glob >=0.9.0
     , aeson >=1.2.1.0
     , base >=4.9 && <5
@@ -95,6 +97,7 @@
     , http-client
     , http-client-tls
     , http-types
+    , infer-license >=0.2.0 && <0.3
     , pretty
     , scientific
     , text
@@ -115,7 +118,7 @@
   ghc-options: -Wall
   cpp-options: -DTEST
   build-depends:
-      Cabal
+      Cabal >=2.2
     , Glob >=0.9.0
     , HUnit >=1.6.0.0
     , QuickCheck
@@ -132,6 +135,7 @@
     , http-client
     , http-client-tls
     , http-types
+    , infer-license >=0.2.0 && <0.3
     , interpolate
     , mockery >=0.3
     , pretty
@@ -153,6 +157,7 @@
       Hpack.ConfigSpec
       Hpack.DefaultsSpec
       Hpack.HaskellSpec
+      Hpack.LicenseSpec
       Hpack.OptionsSpec
       Hpack.Render.DslSpec
       Hpack.Render.HintsSpec
@@ -172,6 +177,7 @@
       Hpack.Config
       Hpack.Defaults
       Hpack.Haskell
+      Hpack.License
       Hpack.Options
       Hpack.Render
       Hpack.Render.Dsl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/CabalFile.hs 
new/hpack-0.29.5/src/Hpack/CabalFile.hs
--- old/hpack-0.28.2/src/Hpack/CabalFile.hs     2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/src/Hpack/CabalFile.hs     2018-07-16 22:27:18.000000000 
+0200
@@ -28,7 +28,12 @@
     parse (splitHeader -> (h, c)) = CabalFile (extractVersion h) (extractHash 
h) c
 
     splitHeader :: String -> ([String], [String])
-    splitHeader = fmap (dropWhile null) . span ("--" `isPrefixOf`) . 
removeGitConflictMarkers . lines
+    splitHeader (removeGitConflictMarkers . lines -> c) =
+      case span (not . isComment) c of
+        (cabalVersion, xs) -> case span isComment xs of
+          (header, body) -> (header, cabalVersion ++ dropWhile null body)
+
+    isComment = ("--" `isPrefixOf`)
 
 extractHash :: [String] -> Maybe Hash
 extractHash = extract "-- hash: " Just
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/Config.hs 
new/hpack-0.29.5/src/Hpack/Config.hs
--- old/hpack-0.28.2/src/Hpack/Config.hs        2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/src/Hpack/Config.hs        2018-07-16 22:27:18.000000000 
+0200
@@ -44,6 +44,7 @@
 , GhcOption
 , Verbatim(..)
 , VerbatimValue(..)
+, verbatimValueToString
 , CustomSetup(..)
 , Section(..)
 , Library(..)
@@ -91,6 +92,10 @@
 import           Control.Monad.Trans.Writer
 import           Control.Monad.Trans.Except
 import           Control.Monad.IO.Class
+import           Data.Version
+
+import           Distribution.Pretty (prettyShow)
+import qualified Distribution.SPDX.License as SPDX
 
 import           Data.Aeson.Config.Types
 import           Data.Aeson.Config.FromValue hiding (decodeValue)
@@ -102,6 +107,7 @@
 import           Hpack.Defaults
 import qualified Hpack.Yaml as Yaml
 import           Hpack.Syntax.Dependency
+import           Hpack.License
 
 package :: String -> String -> Package
 package name version = Package {
@@ -499,7 +505,7 @@
 , packageConfigMaintainer :: Maybe (List String)
 , packageConfigCopyright :: Maybe (List String)
 , packageConfigBuildType :: Maybe BuildType
-, packageConfigLicense :: Maybe String
+, packageConfigLicense :: Maybe (Maybe String)
 , packageConfigLicenseFile :: Maybe (List String)
 , packageConfigTestedWith :: Maybe String
 , packageConfigFlags :: Maybe (Map String FlagSection)
@@ -562,6 +568,7 @@
 
 data DecodeResult = DecodeResult {
   decodeResultPackage :: Package
+, decodeResultCabalVersion :: String
 , decodeResultCabalFile :: FilePath
 , decodeResultWarnings :: [String]
 } deriving (Eq, Show)
@@ -574,14 +581,127 @@
   userDataDir <- liftIO $ maybe (getAppUserDataDirectory "hpack") return 
mUserDataDir
   toPackage userDataDir dir config
   where
-    addCabalFile :: (Package, [String]) -> DecodeResult
-    addCabalFile (pkg, warnings) = DecodeResult pkg (takeDirectory_ file </> 
(packageName pkg ++ ".cabal")) warnings
+    addCabalFile :: ((Package, String), [String]) -> DecodeResult
+    addCabalFile ((pkg, cabalVersion), warnings) = DecodeResult pkg 
cabalVersion (takeDirectory_ file </> (packageName pkg ++ ".cabal")) warnings
 
     takeDirectory_ :: FilePath -> FilePath
     takeDirectory_ p
       | takeFileName p == p = ""
       | otherwise = takeDirectory p
 
+deleteVerbatimField :: String -> [Verbatim] -> [Verbatim]
+deleteVerbatimField name = map $ \ case
+  literal@VerbatimLiteral {} -> literal
+  VerbatimObject o -> VerbatimObject (Map.delete name o)
+
+verbatimValueToString :: VerbatimValue -> String
+verbatimValueToString = \ case
+  VerbatimString s -> s
+  VerbatimNumber n -> scientificToVersion n
+  VerbatimBool b -> show b
+  VerbatimNull -> ""
+
+determineCabalVersion :: Maybe (License SPDX.License) -> Package -> (Package, 
String)
+determineCabalVersion inferredLicense pkg@Package{..} = (
+    pkg {
+        packageVerbatim = deleteVerbatimField "cabal-version" packageVerbatim
+      , packageLicense = formatLicense <$> license
+      }
+  , "cabal-version: " ++ fromMaybe inferredCabalVersion verbatimCabalVersion 
++ "\n\n"
+  )
+  where
+    license = fmap prettyShow <$> (parsedLicense <|> inferredLicense)
+
+    parsedLicense = parseLicense <$> packageLicense
+
+    formatLicense = \ case
+      MustSPDX spdx -> spdx
+      CanSPDX _ spdx | version >= makeVersion [2,2] -> spdx
+      CanSPDX cabal _ -> prettyShow cabal
+      DontTouch original -> original
+
+    mustSPDX :: Bool
+    mustSPDX = maybe False f license
+      where
+        f = \case
+          DontTouch _ -> False
+          CanSPDX _ _ -> False
+          MustSPDX _ -> True
+
+    verbatimCabalVersion :: Maybe String
+    verbatimCabalVersion = listToMaybe (mapMaybe f packageVerbatim)
+      where
+        f :: Verbatim -> Maybe String
+        f = \ case
+          VerbatimLiteral _ -> Nothing
+          VerbatimObject o -> case Map.lookup "cabal-version" o of
+            Just v -> Just (verbatimValueToString v)
+            Nothing -> Nothing
+
+    inferredCabalVersion :: String
+    inferredCabalVersion
+      | version >= makeVersion [2,1] = showVersion version
+      | otherwise = (">= " ++) . showVersion $ version
+
+    version = fromMaybe (makeVersion [1,10]) $ maximum [
+        packageCabalVersion
+      , packageLibrary >>= libraryCabalVersion
+      , internalLibsCabalVersion packageInternalLibraries
+      , executablesCabalVersion packageExecutables
+      , executablesCabalVersion packageTests
+      , executablesCabalVersion packageBenchmarks
+      ]
+
+    packageCabalVersion :: Maybe Version
+    packageCabalVersion = maximum [
+        Nothing
+      , makeVersion [2,2] <$ guard mustSPDX
+      , makeVersion [1,24] <$ packageCustomSetup
+      , makeVersion [1,18] <$ guard (not (null packageExtraDocFiles))
+      ]
+
+    libraryCabalVersion :: Section Library -> Maybe Version
+    libraryCabalVersion sect = maximum [
+        makeVersion [1,22] <$ guard hasReexportedModules
+      , makeVersion [2,0]  <$ guard hasSignatures
+      , makeVersion [2,0] <$ guard hasGeneratedModules
+      , makeVersion [2,2] <$ guard (hasCxxParams sect)
+      ]
+      where
+        hasReexportedModules = any (not . null . libraryReexportedModules) sect
+        hasSignatures = any (not . null . librarySignatures) sect
+        hasGeneratedModules = any (not . null . libraryGeneratedModules) sect
+
+    internalLibsCabalVersion :: Map String (Section Library) -> Maybe Version
+    internalLibsCabalVersion internalLibraries
+      | Map.null internalLibraries = Nothing
+      | otherwise = foldr max (Just $ makeVersion [2,0]) versions
+      where
+        versions = libraryCabalVersion <$> Map.elems internalLibraries
+
+    executablesCabalVersion :: Map String (Section Executable) -> Maybe Version
+    executablesCabalVersion = foldr max Nothing . map executableCabalVersion . 
Map.elems
+
+    executableCabalVersion :: Section Executable -> Maybe Version
+    executableCabalVersion sect = maximum [
+        makeVersion [2,0] <$ guard (executableHasGeneratedModules sect)
+      , makeVersion [2,2] <$ guard (hasCxxParams sect)
+      ]
+
+    executableHasGeneratedModules :: Section Executable -> Bool
+    executableHasGeneratedModules = any (not . null . 
executableGeneratedModules)
+
+    hasCxxParams :: Section a -> Bool
+    hasCxxParams sect = or [
+        check sect
+      , any (any check) (sectionConditionals sect)
+      ]
+      where
+        check s = or [
+            (not . null . sectionCxxOptions) s
+          , (not . null . sectionCxxSources) s
+          ]
+
 decodeValue :: FromValue a => FilePath -> Value -> Warnings (Errors IO) a
 decodeValue file value = do
   (a, unknown) <- lift . ExceptT . return $ first (prefix ++) 
(Config.decodeValue value)
@@ -710,7 +830,7 @@
 type CommonOptionsWithDefaults a = Product DefaultsConfig (CommonOptions 
ParseCSources ParseCxxSources ParseJsSources a)
 type WithCommonOptionsWithDefaults a = Product DefaultsConfig 
(WithCommonOptions ParseCSources ParseCxxSources ParseJsSources a)
 
-toPackage :: FilePath -> FilePath -> ConfigWithDefaults -> Warnings (Errors 
IO) Package
+toPackage :: FilePath -> FilePath -> ConfigWithDefaults -> Warnings (Errors 
IO) (Package, String)
 toPackage userDataDir dir =
       expandDefaultsInConfig userDataDir dir
   >=> traverseConfig (expandForeignSources dir)
@@ -799,7 +919,7 @@
 
 type GlobalOptions = CommonOptions CSources CxxSources JsSources Empty
 
-toPackage_ :: MonadIO m => FilePath -> Product GlobalOptions (PackageConfig 
CSources CxxSources JsSources) -> Warnings m Package
+toPackage_ :: MonadIO m => FilePath -> Product GlobalOptions (PackageConfig 
CSources CxxSources JsSources) -> Warnings m (Package, String)
 toPackage_ dir (Product g PackageConfig{..}) = do
   let
     globalVerbatim = commonOptionsVerbatim g
@@ -832,14 +952,25 @@
 
   dataFiles <- expandGlobs "data-files" dataBaseDir (fromMaybeList 
packageConfigDataFiles)
 
+  let
+    licenseFiles :: [String]
+    licenseFiles = fromMaybeList $ packageConfigLicenseFile <|> do
+      guard licenseFileExists
+      Just (List ["LICENSE"])
+
+  inferredLicense <- case (packageConfigLicense, licenseFiles) of
+    (Nothing, [file]) -> do
+      input <- liftIO (tryReadFile (dir </> file))
+      case input >>= inferLicense of
+        Nothing -> do
+          tell ["Inferring license from file " ++ file ++ " failed!"]
+          return Nothing
+        license -> return license
+    _ -> return Nothing
+
   let defaultBuildType :: BuildType
       defaultBuildType = maybe Simple (const Custom) mCustomSetup
 
-      configLicenseFiles :: Maybe (List String)
-      configLicenseFiles = packageConfigLicenseFile <|> do
-        guard licenseFileExists
-        Just (List ["LICENSE"])
-
       pkg = Package {
         packageName = packageName_
       , packageVersion = maybe "0.0.0" unPackageVersion packageConfigVersion
@@ -853,8 +984,8 @@
       , packageMaintainer = fromMaybeList packageConfigMaintainer
       , packageCopyright = fromMaybeList packageConfigCopyright
       , packageBuildType = fromMaybe defaultBuildType packageConfigBuildType
-      , packageLicense = packageConfigLicense
-      , packageLicenseFile = fromMaybeList configLicenseFiles
+      , packageLicense = join packageConfigLicense
+      , packageLicenseFile = licenseFiles
       , packageTestedWith = packageConfigTestedWith
       , packageFlags = flags
       , packageExtraSourceFiles = extraSourceFiles
@@ -873,7 +1004,7 @@
 
   tell nameWarnings
   tell (formatMissingSourceDirs missingSourceDirs)
-  return pkg
+  return (determineCabalVersion inferredLicense pkg)
   where
     nameWarnings :: [String]
     packageName_ :: String
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/License.hs 
new/hpack-0.29.5/src/Hpack/License.hs
--- old/hpack-0.28.2/src/Hpack/License.hs       1970-01-01 01:00:00.000000000 
+0100
+++ new/hpack-0.29.5/src/Hpack/License.hs       2018-07-16 22:27:18.000000000 
+0200
@@ -0,0 +1,47 @@
+{-# LANGUAGE DeriveFunctor #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE LambdaCase #-}
+module Hpack.License where
+
+import           Control.Arrow ((&&&))
+
+import           Distribution.Pretty (prettyShow)
+import           Distribution.Version (mkVersion)
+import qualified Distribution.License as Cabal
+import qualified Distribution.SPDX.License as SPDX
+import           Distribution.Parsec.Class (eitherParsec)
+
+import qualified Data.License.Infer as Infer
+
+data License a = DontTouch String | CanSPDX Cabal.License a | MustSPDX a
+  deriving (Eq, Show, Functor)
+
+parseLicense :: String -> License SPDX.License
+parseLicense license = case lookup license knownLicenses of
+  Just l -> CanSPDX l (Cabal.licenseToSPDX l)
+  Nothing -> case spdxLicense of
+    Just l -> MustSPDX l
+    Nothing -> DontTouch license
+  where
+    knownLicenses :: [(String, Cabal.License)]
+    knownLicenses = map (prettyShow &&& id) (Cabal.BSD4 : Cabal.knownLicenses)
+
+    spdxLicense :: Maybe SPDX.License
+    spdxLicense  = either (const Nothing) Just (eitherParsec license)
+
+inferLicense :: String -> Maybe (License SPDX.License)
+inferLicense = fmap (uncurry CanSPDX . (id &&& Cabal.licenseToSPDX) . 
toLicense) . Infer.inferLicense
+  where
+    toLicense = \ case
+      Infer.MIT -> Cabal.MIT
+      Infer.ISC -> Cabal.ISC
+      Infer.BSD2 -> Cabal.BSD2
+      Infer.BSD3 -> Cabal.BSD3
+      Infer.BSD4 -> Cabal.BSD4
+      Infer.Apache_2_0 -> Cabal.Apache (Just $ mkVersion [2,0])
+      Infer.MPL_2_0 -> Cabal.MPL (mkVersion [2,0])
+      Infer.GPLv2 -> Cabal.GPL (Just $ mkVersion [2])
+      Infer.GPLv3 -> Cabal.GPL (Just $ mkVersion [3])
+      Infer.LGPLv2_1 -> Cabal.LGPL (Just $ mkVersion [2,1])
+      Infer.LGPLv3 -> Cabal.LGPL (Just $ mkVersion [3])
+      Infer.AGPLv3 -> Cabal.AGPL (Just $ mkVersion [3])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/Render/Hints.hs 
new/hpack-0.29.5/src/Hpack/Render/Hints.hs
--- old/hpack-0.28.2/src/Hpack/Render/Hints.hs  2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/src/Hpack/Render/Hints.hs  2018-07-16 22:27:18.000000000 
+0200
@@ -38,7 +38,7 @@
 }
 
 sanitize :: [String] -> [String]
-sanitize = filter (not . null) . map stripEnd
+sanitize = filter (not . isPrefixOf "cabal-version:") . filter (not . null) . 
map stripEnd
 
 stripEnd :: String -> String
 stripEnd = reverse . dropWhile isSpace . reverse
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/Render.hs 
new/hpack-0.29.5/src/Hpack/Render.hs
--- old/hpack-0.28.2/src/Hpack/Render.hs        2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/src/Hpack/Render.hs        2018-07-16 22:27:18.000000000 
+0200
@@ -1,6 +1,5 @@
 {-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE QuasiQuotes #-}
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE ViewPatterns #-}
 {-# LANGUAGE CPP #-}
@@ -38,13 +37,11 @@
 import           Data.Char
 import           Data.Maybe
 import           Data.List
-import           Data.Version
 import           Data.Map.Lazy (Map)
 import qualified Data.Map.Lazy as Map
 
 import           Hpack.Util
 import           Hpack.Config
-import           Hpack.Syntax.Dependency (scientificToVersion)
 import           Hpack.Render.Hints
 import           Hpack.Render.Dsl
 
@@ -112,7 +109,6 @@
           files  -> ("license-files", formatList files)
       , ("tested-with", packageTestedWith)
       , ("build-type", Just (show packageBuildType))
-      , ("cabal-version", cabalVersion)
       ]
 
     formatList :: [String] -> Maybe String
@@ -120,66 +116,6 @@
       where
         separator = let Alignment n = headerFieldsAlignment in ",\n" ++ 
replicate n ' '
 
-    cabalVersion :: Maybe String
-    cabalVersion = (">= " ++) . showVersion <$> maximum [
-        Just (makeVersion [1,10])
-      , packageCabalVersion
-      , packageLibrary >>= libraryCabalVersion
-      , internalLibsCabalVersion packageInternalLibraries
-      , executablesCabalVersion packageExecutables
-      , executablesCabalVersion packageTests
-      , executablesCabalVersion packageBenchmarks
-      ]
-     where
-      packageCabalVersion :: Maybe Version
-      packageCabalVersion = maximum [
-          Nothing
-        , makeVersion [1,24] <$ packageCustomSetup
-        , makeVersion [1,18] <$ guard (not (null packageExtraDocFiles))
-        ]
-
-      libraryCabalVersion :: Section Library -> Maybe Version
-      libraryCabalVersion sect = maximum [
-          makeVersion [1,22] <$ guard hasReexportedModules
-        , makeVersion [2,0]  <$ guard hasSignatures
-        , makeVersion [2,0] <$ guard hasGeneratedModules
-        , makeVersion [2,2] <$ guard (hasCxxParams sect)
-        ]
-        where
-          hasReexportedModules = any (not . null . libraryReexportedModules) 
sect
-          hasSignatures = any (not . null . librarySignatures) sect
-          hasGeneratedModules = any (not . null . libraryGeneratedModules) sect
-
-      internalLibsCabalVersion :: Map String (Section Library) -> Maybe Version
-      internalLibsCabalVersion internalLibraries
-        | Map.null internalLibraries = Nothing
-        | otherwise = foldr max (Just $ makeVersion [2,0]) versions
-        where
-          versions = libraryCabalVersion <$> Map.elems internalLibraries
-
-      executablesCabalVersion :: Map String (Section Executable) -> Maybe 
Version
-      executablesCabalVersion = foldr max Nothing . map executableCabalVersion 
. Map.elems
-
-      executableCabalVersion :: Section Executable -> Maybe Version
-      executableCabalVersion sect = maximum [
-          makeVersion [2,0] <$ guard (executableHasGeneratedModules sect)
-        , makeVersion [2,2] <$ guard (hasCxxParams sect)
-        ]
-
-      executableHasGeneratedModules :: Section Executable -> Bool
-      executableHasGeneratedModules = any (not . null . 
executableGeneratedModules)
-
-      hasCxxParams :: Section a -> Bool
-      hasCxxParams sect = or [
-          check sect
-        , any (any check) (sectionConditionals sect)
-        ]
-        where
-          check s = or [
-              (not . null . sectionCxxOptions) s
-            , (not . null . sectionCxxSources) s
-            ]
-
 sortStanzaFields :: [(String, [String])] -> [Element] -> [Element]
 sortStanzaFields sectionsFieldOrder = go
   where
@@ -336,13 +272,9 @@
 renderVerbatimObject :: Map String VerbatimValue -> [Element]
 renderVerbatimObject = map renderPair . Map.toList
   where
-    renderPair (key, value) = case value of
-      VerbatimString s -> case lines s of
-        [x] -> Field key (Literal x)
-        xs -> Field key (LineSeparatedList xs)
-      VerbatimNumber n -> Field key (Literal $ scientificToVersion n)
-      VerbatimBool b -> Field key (Literal $ show b)
-      VerbatimNull -> Field key (Literal "")
+    renderPair (key, value) = case lines (verbatimValueToString value) of
+      [x] -> Field key (Literal x)
+      xs -> Field key (LineSeparatedList xs)
 
 renderConditional :: (a -> [Element]) -> Conditional (Section a) -> Element
 renderConditional renderSectionData (Conditional condition sect mElse) = case 
mElse of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack/Syntax/Dependency.hs 
new/hpack-0.29.5/src/Hpack/Syntax/Dependency.hs
--- old/hpack-0.28.2/src/Hpack/Syntax/Dependency.hs     2018-03-16 
11:34:12.000000000 +0100
+++ new/hpack-0.29.5/src/Hpack/Syntax/Dependency.hs     2018-07-16 
22:27:18.000000000 +0200
@@ -2,6 +2,7 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE LambdaCase #-}
 module Hpack.Syntax.Dependency (
   Dependencies(..)
 , DependencyVersion(..)
@@ -16,6 +17,7 @@
 import           Data.Semigroup (Semigroup(..))
 import           Text.PrettyPrint (renderStyle, Style(..), Mode(..))
 import           Control.Monad
+import           Distribution.Version (VersionRangeF(..))
 import qualified Distribution.Compat.ReadP as D
 import qualified Distribution.Package as D
 import qualified Distribution.Text as D
@@ -152,7 +154,7 @@
 dependencyVersionFromCabal :: D.VersionRange -> DependencyVersion
 dependencyVersionFromCabal versionRange
   | D.isAnyVersion versionRange = AnyVersion
-  | otherwise = VersionRange . renderStyle style . D.disp $ versionRange
+  | otherwise = VersionRange . renderStyle style . D.disp $ 
toPreCabal2VersionRange versionRange
   where
     style = Style OneLineMode 0 0
 
@@ -169,3 +171,24 @@
 cabalParse subject s = case [d | (d, "") <- D.readP_to_S D.parse s] of
   [d] -> return d
   _ -> fail $ unwords ["invalid",  subject, show s]
+
+toPreCabal2VersionRange :: D.VersionRange -> D.VersionRange
+toPreCabal2VersionRange = D.embedVersionRange . D.cataVersionRange f
+  where
+    f :: VersionRangeF (VersionRangeF D.VersionRange) -> VersionRangeF 
D.VersionRange
+    f = \ case
+      MajorBoundVersionF v -> IntersectVersionRangesF (D.embedVersionRange 
lower) (D.embedVersionRange upper)
+        where
+          lower = OrLaterVersionF v
+          upper = EarlierVersionF (D.majorUpperBound v)
+
+      AnyVersionF -> AnyVersionF
+      ThisVersionF v -> ThisVersionF v
+      LaterVersionF v -> LaterVersionF v
+      OrLaterVersionF v -> OrLaterVersionF v
+      EarlierVersionF v -> EarlierVersionF v
+      OrEarlierVersionF v -> OrEarlierVersionF v
+      WildcardVersionF v -> WildcardVersionF v
+      UnionVersionRangesF a b -> UnionVersionRangesF (D.embedVersionRange a) 
(D.embedVersionRange b)
+      IntersectVersionRangesF a b -> IntersectVersionRangesF 
(D.embedVersionRange a) (D.embedVersionRange b)
+      VersionRangeParensF a -> VersionRangeParensF (D.embedVersionRange a)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/src/Hpack.hs 
new/hpack-0.29.5/src/Hpack.hs
--- old/hpack-0.28.2/src/Hpack.hs       2018-03-16 11:34:12.000000000 +0100
+++ new/hpack-0.29.5/src/Hpack.hs       2018-07-16 22:27:18.000000000 +0200
@@ -164,19 +164,21 @@
 
 hpackResultWithVersion :: Version -> Options -> IO Result
 hpackResultWithVersion v (Options options force toStdout) = do
-  DecodeResult pkg cabalFile warnings <- readPackageConfig options >>= either 
die return
+  DecodeResult pkg cabalVersion cabalFile warnings <- readPackageConfig 
options >>= either die return
   oldCabalFile <- readCabalFile cabalFile
-  let new = renderPackage (maybe [] cabalFileContents oldCabalFile) pkg
+  let
+    body = renderPackage (maybe [] cabalFileContents oldCabalFile) pkg
+    withoutHeader = cabalVersion ++ body
   let
     status = case force of
       Force -> Generated
-      NoForce -> maybe Generated (mkStatus (lines new) v) oldCabalFile
+      NoForce -> maybe Generated (mkStatus (lines withoutHeader) v) 
oldCabalFile
   case status of
     Generated -> do
-      let hash = sha256 new
+      let hash = sha256 withoutHeader
       if toStdout
-        then Utf8.putStr new
-        else Utf8.writeFile cabalFile (header (decodeOptionsTarget options) v 
hash ++ new)
+        then Utf8.putStr withoutHeader
+        else Utf8.writeFile cabalFile (cabalVersion ++ header 
(decodeOptionsTarget options) v hash ++ body)
     _ -> return ()
   return Result {
       resultWarnings = warnings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/EndToEndSpec.hs 
new/hpack-0.29.5/test/EndToEndSpec.hs
--- old/hpack-0.28.2/test/EndToEndSpec.hs       2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/test/EndToEndSpec.hs       2018-07-16 22:27:18.000000000 
+0200
@@ -299,6 +299,82 @@
         version: {}
         |] `shouldFailWith` "package.yaml: Error while parsing $.version - 
expected Number or String, encountered Object"
 
+    describe "license" $ do
+      it "accepts cabal-style licenses" $ do
+        [i|
+        license: BSD3
+        |] `shouldRenderTo` (package [i|
+        license: BSD3
+        |])
+
+      it "accepts SPDX licenses" $ do
+        [i|
+        license: BSD-3-Clause
+        |] `shouldRenderTo` (package [i|
+        license: BSD-3-Clause
+        |]) {packageCabalVersion = "2.2"}
+
+      context "with an ambiguous license" $ do
+        it "treats it as a cabal-style license" $ do
+          [i|
+          license: MIT
+          |] `shouldRenderTo` (package [i|
+          license: MIT
+          |])
+
+      context "when cabal-version >= 2.2" $ do
+        it "maps license to SPDX license identifier" $ do
+          [i|
+          license: BSD3
+          library:
+            cxx-options: -Wall
+          |] `shouldRenderTo` (package [i|
+          license: BSD-3-Clause
+          library
+            other-modules:
+                Paths_foo
+            cxx-options: -Wall
+            default-language: Haskell2010
+          |]) {packageCabalVersion = "2.2"}
+
+        it "doesn't touch unknown licenses" $ do
+          [i|
+          license: some-license
+          library:
+            cxx-options: -Wall
+          |] `shouldRenderTo` (package [i|
+          license: some-license
+          library
+            other-modules:
+                Paths_foo
+            cxx-options: -Wall
+            default-language: Haskell2010
+          |]) {packageCabalVersion = "2.2"}
+
+      context "with a LICENSE file" $ do
+        before_ (writeFile "LICENSE" license) $ do
+          it "infers license" $ do
+            [i|
+            |] `shouldRenderTo` (package [i|
+            license-file: LICENSE
+            license: MIT
+            |])
+
+          context "when license can not be inferred" $ do
+            it "warns" $ do
+              writeFile "LICENSE" "some-licenese"
+              [i|
+              name: foo
+              |] `shouldWarn` ["Inferring license from file LICENSE failed!"]
+
+          context "when license is null" $ do
+            it "does not infer license" $ do
+              [i|
+              license: null
+              |] `shouldRenderTo` (package [i|
+              license-file: LICENSE
+              |])
+
     describe "build-type" $ do
       it "accept Simple" $ do
         [i|
@@ -476,7 +552,7 @@
           cxx-options: -Wall
         |] `shouldRenderTo` (executable_ "foo" [i|
         cxx-options: -Wall
-        |]) {packageCabalVersion = ">= 2.2"}
+        |]) {packageCabalVersion = "2.2"}
 
     describe "cxx-sources" $ before_ (touch "foo.cc" >> touch 
"cxxbits/bar.cc") $ do
       it "accepts cxx-sources" $ do
@@ -489,7 +565,7 @@
         cxx-sources:
             cxxbits/bar.cc
             foo.cc
-        |]) {packageCabalVersion = ">= 2.2"}
+        |]) {packageCabalVersion = "2.2"}
 
     describe "extra-lib-dirs" $ do
       it "accepts extra-lib-dirs" $ do
@@ -1240,12 +1316,12 @@
 run_ userDataDir c old = do
   mPackage <- readPackageConfig defaultDecodeOptions {decodeOptionsTarget = c, 
decodeOptionsUserDataDir = Just userDataDir}
   return $ case mPackage of
-    Right (DecodeResult pkg _ warnings) ->
+    Right (DecodeResult pkg cabalVersion _ warnings) ->
       let
         FormattingHints{..} = sniffFormattingHints (lines old)
         alignment = fromMaybe 0 formattingHintsAlignment
         settings = formattingHintsRenderSettings
-        output = Hpack.renderPackageWith settings alignment 
formattingHintsFieldOrder formattingHintsSectionsFieldOrder pkg
+        output = cabalVersion ++ Hpack.renderPackageWith settings alignment 
formattingHintsFieldOrder formattingHintsSectionsFieldOrder pkg
       in
         Right (warnings, output)
     Left err -> Left err
@@ -1349,13 +1425,36 @@
 
 renderPackage :: Package -> String
 renderPackage Package{..} = unindent [i|
+cabal-version: #{packageCabalVersion}
 name: #{packageName}
 version: #{packageVersion}
 build-type: #{packageBuildType}
-cabal-version: #{packageCabalVersion}
 
 #{unindent packageContent}
 |]
 
 indentBy :: Int -> String -> String
 indentBy n = unlines . map (replicate n ' ' ++) . lines
+
+license :: String
+license = [i|
+Copyright (c) 2014-2018 Simon Hengel <s...@typeful.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+|]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Helper.hs 
new/hpack-0.29.5/test/Helper.hs
--- old/hpack-0.28.2/test/Helper.hs     2018-03-16 11:34:12.000000000 +0100
+++ new/hpack-0.29.5/test/Helper.hs     2018-07-16 22:27:18.000000000 +0200
@@ -3,6 +3,7 @@
 module Helper (
   module Test.Hspec
 , module Test.Mockery.Directory
+, module Control.Monad
 , module Control.Applicative
 , withTempDirectory
 , module System.FilePath
@@ -12,6 +13,7 @@
 
 import           Test.Hspec
 import           Test.Mockery.Directory
+import           Control.Monad
 import           Control.Applicative
 import           System.Directory (getCurrentDirectory, setCurrentDirectory, 
canonicalizePath)
 import           Control.Exception
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/CabalFileSpec.hs 
new/hpack-0.29.5/test/Hpack/CabalFileSpec.hs
--- old/hpack-0.28.2/test/Hpack/CabalFileSpec.hs        2018-03-16 
11:34:12.000000000 +0100
+++ new/hpack-0.29.5/test/Hpack/CabalFileSpec.hs        2018-07-16 
22:27:18.000000000 +0200
@@ -4,7 +4,6 @@
 import           Helper
 import           Test.QuickCheck
 import           Data.Version (showVersion)
-import           Control.Monad
 import           Data.String.Interpolate
 import           Data.String.Interpolate.Util
 
@@ -17,13 +16,19 @@
 spec = do
   describe "readCabalFile" $ do
     let
-      file = "package.yaml"
+      file = "hello.cabal"
       hash = "some-hash"
+
     it "includes hash" $ do
       inTempDirectory $ do
-        writeFile file $ header file version hash
+        writeFile file $ header "package.yaml" version hash
         readCabalFile file `shouldReturn` Just (CabalFile (Just version) (Just 
hash) [])
 
+    it "accepts cabal-version at the beginning of the file" $ do
+      inTempDirectory $ do
+        writeFile file $ ("cabal-version: 2.2\n" ++ header "package.yaml" 
version hash)
+        readCabalFile file `shouldReturn` Just (CabalFile (Just version) (Just 
hash) ["cabal-version: 2.2"])
+
   describe "extractVersion" $ do
     it "extracts Hpack version from a cabal file" $ do
       let cabalFile = ["-- This file has been generated from package.yaml by 
hpack version 0.10.0."]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/ConfigSpec.hs 
new/hpack-0.29.5/test/Hpack/ConfigSpec.hs
--- old/hpack-0.28.2/test/Hpack/ConfigSpec.hs   2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/test/Hpack/ConfigSpec.hs   2018-07-16 22:27:18.000000000 
+0200
@@ -59,7 +59,7 @@
   writeFile (dir </> "package.yaml") content
   withCurrentDirectory dir beforeAction
   r <- readPackageConfig (testDecodeOptions $ dir </> "package.yaml")
-  either expectationFailure (\ (DecodeResult p _ warnings) -> expectation (p, 
warnings)) r
+  either expectationFailure (\ (DecodeResult p _ _ warnings) -> expectation 
(p, warnings)) r
 
 withPackageConfig :: String -> IO () -> (Package -> Expectation) -> Expectation
 withPackageConfig content beforeAction expectation = withPackage content 
beforeAction (expectation . fst)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/LicenseSpec.hs 
new/hpack-0.29.5/test/Hpack/LicenseSpec.hs
--- old/hpack-0.28.2/test/Hpack/LicenseSpec.hs  1970-01-01 01:00:00.000000000 
+0100
+++ new/hpack-0.29.5/test/Hpack/LicenseSpec.hs  2018-07-16 22:27:18.000000000 
+0200
@@ -0,0 +1,63 @@
+{-# LANGUAGE QuasiQuotes #-}
+module Hpack.LicenseSpec (spec) where
+
+import           Helper
+import           Data.Maybe
+import           Data.String.Interpolate
+
+import           Distribution.Pretty (prettyShow)
+import           Distribution.Parsec.Class (simpleParsec)
+import qualified Distribution.License as Cabal
+
+import           Hpack.License
+
+cabal :: String -> Cabal.License
+cabal = fromJust . simpleParsec
+
+cabalLicenses :: [(String, License String)]
+cabalLicenses = [
+    ("GPL",               CanSPDX (cabal "GPL") "LicenseRef-GPL")
+  , ("GPL-2",             CanSPDX (cabal "GPL-2") "GPL-2.0-only")
+  , ("GPL-3",             CanSPDX (cabal "GPL-3") "GPL-3.0-only")
+
+  , ("LGPL",              CanSPDX (cabal "LGPL") "LicenseRef-LGPL")
+  , ("LGPL-2.1",          CanSPDX (cabal "LGPL-2.1") "LGPL-2.1-only")
+  , ("LGPL-3",            CanSPDX (cabal "LGPL-3") "LGPL-3.0-only")
+
+  , ("AGPL",              CanSPDX (cabal "AGPL") "LicenseRef-AGPL")
+  , ("AGPL-3",            CanSPDX (cabal "AGPL-3") "AGPL-3.0-only")
+
+
+  , ("BSD2",              CanSPDX (cabal "BSD2") "BSD-2-Clause")
+  , ("BSD3",              CanSPDX (cabal "BSD3") "BSD-3-Clause")
+  , ("BSD4",              CanSPDX (cabal "BSD4") "BSD-4-Clause")
+
+  , ("MIT",               CanSPDX (cabal "MIT") "MIT")
+  , ("ISC",               CanSPDX (cabal "ISC") "ISC")
+
+  , ("MPL-2.0",           CanSPDX (cabal "MPL-2.0") "MPL-2.0")
+
+  , ("Apache",            CanSPDX (cabal "Apache") "LicenseRef-Apache")
+  , ("Apache-2.0",        CanSPDX (cabal "Apache-2.0") "Apache-2.0")
+
+  , ("PublicDomain",      CanSPDX (cabal "PublicDomain") 
"LicenseRef-PublicDomain")
+  , ("OtherLicense",      CanSPDX (cabal "OtherLicense") 
"LicenseRef-OtherLicense")
+  , ("AllRightsReserved", CanSPDX (cabal "AllRightsReserved") "NONE")
+  ]
+
+spdxLicenses :: [(String, License String)]
+spdxLicenses = [
+    ("GPL-2.0-or-later",  MustSPDX "GPL-2.0-or-later")
+  ]
+
+unknownLicenses :: [(String, License String)]
+unknownLicenses = [
+    ("some-license",      DontTouch "some-license")
+  ]
+
+spec :: Spec
+spec = do
+  describe "parseLicense" $ do
+    forM_ (cabalLicenses ++ spdxLicenses ++ unknownLicenses) $ \ (license, 
expected) -> do
+      it [i|parses #{license}|] $ do
+        prettyShow <$> parseLicense license `shouldBe` expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/Render/HintsSpec.hs 
new/hpack-0.29.5/test/Hpack/Render/HintsSpec.hs
--- old/hpack-0.28.2/test/Hpack/Render/HintsSpec.hs     2018-03-16 
11:34:12.000000000 +0100
+++ new/hpack-0.29.5/test/Hpack/Render/HintsSpec.hs     2018-07-16 
22:27:18.000000000 +0200
@@ -15,7 +15,6 @@
             , "license:"
             , "license-file: "
             , "build-type:     Simple"
-            , "cabal-version:  >= 1.10"
             ]
       extractFieldOrder input `shouldBe` [
               "name"
@@ -23,7 +22,6 @@
             , "license"
             , "license-file"
             , "build-type"
-            , "cabal-version"
             ]
 
   describe "extractSectionsFieldOrder" $ do
@@ -60,6 +58,9 @@
     it "removes trailing whitespace" $ do
       sanitize ["foo  ", "bar  "] `shouldBe` ["foo", "bar"]
 
+    it "removes cabal-version" $ do
+      sanitize ["cabal-version: 2.2", "bar  "] `shouldBe` ["bar"]
+
   describe "unindent" $ do
     it "unindents" $ do
       let input = [
@@ -81,7 +82,6 @@
             , "license:        MIT"
             , "license-file:   LICENSE"
             , "build-type:     Simple"
-            , "cabal-version:  >= 1.10"
             ]
       sniffAlignment input `shouldBe` Just 16
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/RenderSpec.hs 
new/hpack-0.29.5/test/Hpack/RenderSpec.hs
--- old/hpack-0.28.2/test/Hpack/RenderSpec.hs   2018-03-16 11:34:12.000000000 
+0100
+++ new/hpack-0.29.5/test/Hpack/RenderSpec.hs   2018-07-16 22:27:18.000000000 
+0200
@@ -28,7 +28,6 @@
           "name: foo"
         , "version: 0.0.0"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         ]
 
     it "aligns fields" $ do
@@ -36,7 +35,6 @@
           "name:           foo"
         , "version:        0.0.0"
         , "build-type:     Simple"
-        , "cabal-version:  >= 1.10"
         ]
 
     it "includes description" $ do
@@ -47,7 +45,6 @@
         , "             ."
         , "             bar"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         ]
 
     it "aligns description" $ do
@@ -58,7 +55,6 @@
         , "                ."
         , "                bar"
         , "build-type:     Simple"
-        , "cabal-version:  >= 1.10"
         ]
 
     it "includes stability" $ do
@@ -67,7 +63,6 @@
         , "version: 0.0.0"
         , "stability: experimental"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         ]
 
     it "includes license-file" $ do
@@ -76,7 +71,6 @@
         , "version: 0.0.0"
         , "license-file: FOO"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         ]
 
     it "aligns license-files" $ do
@@ -86,7 +80,6 @@
         , "license-files:  FOO,"
         , "                BAR"
         , "build-type:     Simple"
-        , "cabal-version:  >= 1.10"
         ]
 
     it "includes copyright holder" $ do
@@ -95,7 +88,6 @@
         , "version: 0.0.0"
         , "copyright: (c) 2015 Simon Hengel"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         ]
 
     it "aligns copyright holders" $ do
@@ -105,7 +97,6 @@
         , "copyright:      (c) 2015 Foo,"
         , "                (c) 2015 Bar"
         , "build-type:     Simple"
-        , "cabal-version:  >= 1.10"
         ]
 
     it "includes extra-source-files" $ do
@@ -113,7 +104,6 @@
           "name: foo"
         , "version: 0.0.0"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         , "extra-source-files:"
         , "    foo"
         , "    bar"
@@ -124,7 +114,6 @@
           "name: foo"
         , "version: 0.0.0"
         , "build-type: Simple"
-        , "cabal-version: >= 1.10"
         , ""
         , "library"
         , "  buildable: False"
@@ -137,7 +126,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "library"
           , "  default-language: Haskell2010"
@@ -145,19 +133,17 @@
 
     context "when given list of existing fields" $ do
       it "retains field order" $ do
-        renderPackageWith defaultRenderSettings 16 ["cabal-version", 
"version", "name", "build-type"] [] package `shouldBe` unlines [
-            "cabal-version:  >= 1.10"
-          , "version:        0.0.0"
-          , "name:           foo"
+        renderPackageWith defaultRenderSettings 16 ["version", "build-type", 
"name"] [] package `shouldBe` unlines [
+            "version:        0.0.0"
           , "build-type:     Simple"
+          , "name:           foo"
           ]
 
       it "uses default field order for new fields" $ do
-        renderPackageWith defaultRenderSettings 16 ["name", "version", 
"cabal-version"] [] package `shouldBe` unlines [
+        renderPackageWith defaultRenderSettings 16 [] [] package `shouldBe` 
unlines [
             "name:           foo"
           , "version:        0.0.0"
           , "build-type:     Simple"
-          , "cabal-version:  >= 1.10"
           ]
 
       it "retains section field order" $ do
@@ -165,7 +151,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  default-language: Haskell2010"
@@ -180,7 +165,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  main-is: Main.hs"
@@ -195,7 +179,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  main-is: Main.hs"
@@ -208,7 +191,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  main-is: Main.hs"
@@ -223,7 +205,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  main-is: Main.hs"
@@ -238,7 +219,6 @@
             "name: foo"
           , "version: 0.0.0"
           , "build-type: Simple"
-          , "cabal-version: >= 1.10"
           , ""
           , "executable foo"
           , "  main-is: Main.hs"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/Syntax/DependencySpec.hs 
new/hpack-0.29.5/test/Hpack/Syntax/DependencySpec.hs
--- old/hpack-0.28.2/test/Hpack/Syntax/DependencySpec.hs        2018-03-16 
11:34:12.000000000 +0100
+++ new/hpack-0.29.5/test/Hpack/Syntax/DependencySpec.hs        2018-07-16 
22:27:18.000000000 +0200
@@ -46,6 +46,11 @@
             - hpack >= 2 && < 3
           |] `shouldDecodeTo_` Dependencies [("hpack", VersionRange ">=2 && 
<3")]
 
+        it "accepts ^>=" $ do
+          [yaml|
+            - hpack ^>= 1.2.3.4
+          |] `shouldDecodeTo_` Dependencies [("hpack", VersionRange ">=1.2.3.4 
&& <1.3")]
+
         it "accepts git dependencies" $ do
           let source = GitRef "https://github.com/sol/hpack"; "master" Nothing
           [yaml|
@@ -147,6 +152,11 @@
               hpack: 2.*
             |] `shouldDecodeTo_` Dependencies [("hpack", VersionRange "==2.*")]
 
+          it "accepts ^>=" $ do
+            [yaml|
+              hpack: ^>= 1.2.3.4
+            |] `shouldDecodeTo_` Dependencies [("hpack", VersionRange 
">=1.2.3.4 && <1.3")]
+
           it "reports parse errors" $ do
             [yaml|
               hpack: foo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hpack-0.28.2/test/Hpack/Syntax/GitSpec.hs 
new/hpack-0.29.5/test/Hpack/Syntax/GitSpec.hs
--- old/hpack-0.28.2/test/Hpack/Syntax/GitSpec.hs       2018-03-16 
11:34:12.000000000 +0100
+++ new/hpack-0.29.5/test/Hpack/Syntax/GitSpec.hs       2018-07-16 
22:27:18.000000000 +0200
@@ -3,7 +3,6 @@
 
 import           Helper
 import           Data.String.Interpolate
-import           Control.Monad
 
 import           Hpack.Syntax.Git
 


Reply via email to