packages feed

hackport 0.7.1.2 → 0.7.2.1

raw patch · 5 files changed

+81/−34 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hackport.cabal view
@@ -1,6 +1,6 @@ Cabal-Version:  2.2 Name:           hackport-Version:        0.7.1.2+Version:        0.7.2.1 License:        GPL-3.0-or-later License-file:   LICENSE Author:         Henning Günther, Duncan Coutts, Lennart Kolmodin@@ -707,7 +707,8 @@ test-suite doctests-v2   type:             exitcode-stdio-1.0   default-language: Haskell98-  main-is:          tests/doctests-v2.hs+  Hs-Source-Dirs:   tests+  main-is:          doctests-v2.hs   build-depends:    base, process   build-tool-depends:     cabal-install:cabal >= 3.2,
+ hie.yaml view
@@ -0,0 +1,55 @@+cradle:+  cabal:+    - path: "cabal"+      component: "hackport:lib:hackport-external-libs-Cabal"++    - path: "cabal/Cabal"+      component: "hackport:lib:hackport-external-libs-Cabal"++    - path: "hackage-security/hackage-security/src"+      component: "hackport:lib:hackport-external-libs-hackage-security"++    - path: "cabal"+      component: "hackport:lib:hackport-external-libs-cabal-install"++    - path: "cabal/cabal-install"+      component: "hackport:lib:hackport-external-libs-cabal-install"++    - path: "src"+      component: "hackport:lib:hackport-internal"++    - path: "exe/Main.hs"+      component: "hackport:exe:hackport"++    - path: "exe/Paths_hackport.hs"+      component: "hackport:exe:hackport"++    - path: "src"+      component: "hackport:test:test-resolve-category"++    - path: "tests"+      component: "hackport:test:test-resolve-category"++    - path: "src"+      component: "hackport:test:test-print-deps"++    - path: "tests"+      component: "hackport:test:test-print-deps"++    - path: "src"+      component: "hackport:test:test-normalize-deps"++    - path: "tests"+      component: "hackport:test:test-normalize-deps"++    - path: "tests"+      component: "hackport:test:doctests"++    - path: "tests"+      component: "hackport:test:doctests-v2"++    - path: "src"+      component: "hackport:test:spec"++    - path: "tests"+      component: "hackport:test:spec"
src/Cabal2Ebuild.hs view
@@ -34,6 +34,7 @@ import qualified Distribution.Utils.ShortText as ST  import Data.Char          (isUpper)+import qualified Data.Map.Lazy as Map import Data.Maybe  import Portage.Dependency@@ -53,13 +54,14 @@     E.category    = prettyShow cat,     E.hackage_name= cabalPkgName,     E.version     = prettyShow (Cabal.pkgVersion (Cabal.package pkg)),+    E.revision    = getHackageRevision,     E.description = ST.fromShortText $ if ST.null (Cabal.synopsis pkg)                                           then Cabal.description pkg                                           else Cabal.synopsis pkg,     E.homepage        = thisHomepage,     E.license         = Portage.convertLicense $ Cabal.license pkg,     E.slot            = (E.slot E.ebuildTemplate) ++ (if hasLibs then "/${PV}" else ""),-    E.my_pn           = if any isUpper cabalPkgName then Just cabalPkgName else Nothing,+    E.cabal_pn           = if any isUpper cabalPkgName then Just cabalPkgName else Nothing,     E.features        = E.features E.ebuildTemplate                    ++ (if hasLibs then ([ Portage.Lib                                         , Portage.Profile@@ -77,6 +79,10 @@         cabalPkgName = prettyShow cabal_pn         hasLibs = isJust (Cabal.library pkg)         hasTests = (not . null) (Cabal.testSuites pkg)+        getHackageRevision =+          case Map.lookup "x-revision" (Map.fromList (Cabal.customFieldsPD pkg)) of+            Just rev -> rev+            _ -> "0"         thisHomepage = if (ST.null $ Cabal.homepage pkg)                          then E.homepage E.ebuildTemplate                          else ST.fromShortText $ Cabal.homepage pkg
src/Portage/EBuild.hs view
@@ -11,7 +11,6 @@         ( EBuild(..)         , ebuildTemplate         , showEBuild-        , src_uri         -- hspec exports         , sort_iuse         , drop_tdot@@ -44,6 +43,7 @@     category :: String,     hackage_name :: String, -- might differ a bit (we mangle case)     version :: String,+    revision :: String,     hackportVersion :: String,     description :: String,     homepage :: String,@@ -56,7 +56,7 @@     rdepend :: Dependency,     rdepend_extra :: [String]     , features :: [CabalFeature]-    , my_pn :: Maybe String -- ^ Just 'myOldName' if the package name contains upper characters+    , cabal_pn :: Maybe String -- ^ Just 'myOldName' if the package name contains upper characters     , src_prepare :: [String] -- ^ raw block for src_prepare() contents     , src_configure :: [String] -- ^ raw block for src_configure() contents     , used_options :: [(String, String)] -- ^ hints to ebuild writers/readers@@ -74,6 +74,7 @@     category = "dev-haskell",     hackage_name = "FooBar",     version = "0.1",+    revision = "0",     hackportVersion = getHackportVersion Paths_hackport.version,     description = "",     homepage = "https://hackage.haskell.org/package/${HACKAGE_N}",@@ -86,27 +87,12 @@     rdepend = empty_dependency,     rdepend_extra = [],     features = [],-    my_pn = Nothing+    cabal_pn = Nothing     , src_prepare = []     , src_configure = []     , used_options = []   } --- | Given an EBuild, give the URI to the tarball of the source code.--- Assumes that the server is always hackage.haskell.org.--- --- >>> src_uri ebuildTemplate--- "https://hackage.haskell.org/package/${P}/${P}.tar.gz"-src_uri :: EBuild -> String-src_uri e =-  case my_pn e of-    -- use standard address given that the package name has no upper-    -- characters-    Nothing -> "https://hackage.haskell.org/package/${P}/${P}.tar.gz"-    -- use MY_X variables (defined in showEBuild) as we've renamed the-    -- package-    Just _  -> "https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"- -- | Pretty-print an 'EBuild' as a 'String'. showEBuild :: TC.UTCTime -> EBuild -> String showEBuild now ebuild =@@ -118,17 +104,12 @@   ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl.   sconcat (map (\(k, v) -> ss "#hackport: " . ss k . ss ": " . ss v . nl) $ used_options ebuild).   nl.+  beforeInherit.   ss "CABAL_FEATURES=". quote' (sepBy " " $ map render (features ebuild)). nl.   ss "inherit haskell-cabal". nl.   nl.-  (case my_pn ebuild of-     Nothing -> id-     Just pn -> ss "MY_PN=". quote pn. nl.-                ss "MY_P=". quote "${MY_PN}-${PV}". nl.-                ss "S=". quote ("${WORKDIR}/${MY_P}"). nl. nl).   ss "DESCRIPTION=". quote (drop_tdot $ description ebuild). nl.   ss "HOMEPAGE=". quote (toHttps $ expandVars (homepage ebuild)). nl.-  ss "SRC_URI=". quote (src_uri ebuild). nl.   nl.   ss "LICENSE=". (either (\err -> quote "" . ss ("\t# FIXME: " ++ err))                          quote@@ -159,6 +140,17 @@          this_year :: String         this_year = TC.formatTime TC.defaultTimeLocale "%Y" now++        beforeInherit =+            case (revision ebuild, cabal_pn ebuild) of+                ("0", Nothing) -> id+                (r  , pn     ) -> revLine r. pnLine pn. nl++        revLine "0" = id+        revLine r   = ss ("CABAL_HACKAGE_REVISION=" ++ r). nl++        pnLine Nothing   = id+        pnLine (Just pn) = ss "CABAL_PN=". quote pn. nl  -- | Convert http urls into https urls, unless whitelisted as http-only. --
tests/Portage/EBuildSpec.hs view
@@ -6,13 +6,6 @@  spec :: Spec spec = do-  describe "src_uri" $ do-    it "returns the default SRC_URI for a lowercase package name" $ do-      src_uri ebuildTemplate-        `shouldBe` "https://hackage.haskell.org/package/${P}/${P}.tar.gz"-    it "returns the case-sensitive SRC_URI for a case-sensitive package name" $ do-      src_uri ebuildTemplate { my_pn = Just "Foo_Bar" }-        `shouldBe` "https://hackage.haskell.org/package/${MY_P}/${MY_P}.tar.gz"   describe "sort_iuse" $ do     it "sorts IUSE alphabetically despite pluses (+)" $ do       sort_iuse ["+a","c","+b","d"] `shouldBe` ["+a","+b","c","d"]