hackport 0.6.7 → 0.7
raw patch · 15 files changed
+244/−430 lines, 15 files
Files
- Cabal2Ebuild.hs +0/−3
- Merge.hs +0/−4
- Merge/Dependencies.hs +1/−0
- Merge/Utils.hs +39/−9
- Portage/EBuild.hs +33/−30
- Portage/GHCCore.hs +41/−284
- Portage/Metadata.hs +29/−39
- hackage-security/hackage-repo-tool/hackage-repo-tool.cabal +1/−1
- hackage-security/hackage-security-HTTP/ChangeLog.md +4/−0
- hackage-security/hackage-security-HTTP/hackage-security-HTTP.cabal +8/−7
- hackage-security/hackage-security/hackage-security.cabal +8/−4
- hackport.cabal +2/−2
- tests/Merge/UtilsSpec.hs +21/−2
- tests/Portage/EBuildSpec.hs +9/−1
- tests/Portage/MetadataSpec.hs +48/−44
Cabal2Ebuild.hs view
@@ -56,9 +56,6 @@ E.description = ST.fromShortText $ if ST.null (Cabal.synopsis pkg) then Cabal.description pkg else Cabal.synopsis pkg,- E.long_desc = ST.fromShortText $ if ST.null (Cabal.description pkg)- then Cabal.synopsis pkg- else Cabal.description pkg, E.homepage = thisHomepage, E.license = Portage.convertLicense $ Cabal.license pkg, E.slot = (E.slot E.ebuildTemplate) ++ (if hasLibs then "/${PV}" else ""),
Merge.hs view
@@ -491,10 +491,6 @@ -- the existing @metadata.xml@. If an existing flag has a new and old description, -- the new one takes precedence. default_meta = Portage.makeDefaultMetadata- -- Ensure that the long description does not equal the- -- ebuild description, which fails Gentoo QA.- (if E.long_desc ebuild == E.description ebuild- then "" else E.long_desc ebuild) $ Merge.metaFlags flags `Map.union` Portage.metadataUseFlags current_meta' -- Create a 'Map.Map' of USE flags with updated descriptions.
Merge/Dependencies.hs view
@@ -579,4 +579,5 @@ ,("sdl2", ("media-libs", "libsdl2", Portage.AnySlot)) ,("SDL2_image", ("media-libs", "sdl2-image", Portage.AnySlot)) ,("SDL2_mixer", ("media-libs", "sdl2-mixer", Portage.AnySlot))+ ,("zlib", ("sys-libs", "zlib", Portage.AnySlot)) ]
Merge/Utils.hs view
@@ -10,6 +10,8 @@ , getPreviousPackageId , first_just_of , drop_prefix+ , squash_debug+ , convert_underscores , mangle_iuse , to_unstable , metaFlags@@ -18,6 +20,7 @@ , dropIfUseExpand ) where +import qualified Control.Applicative as A import qualified Control.Monad as M import qualified Data.Char as C import Data.Maybe (catMaybes, mapMaybe)@@ -103,22 +106,46 @@ -- >>> drop_prefix "no_examples" -- "no_examples" drop_prefix :: String -> String-drop_prefix x- | take 5 x `elem` ["with_","with-"] = drop 5 x- | take 4 x `elem` ["use_","use-"] = drop 4 x- | otherwise = x+drop_prefix x =+ let prefixes = ["with","use"]+ separators = ["-","_"]+ combinations = A.liftA2 (++) prefixes separators+ in case catMaybes (A.liftA2 L.stripPrefix combinations [x]) of+ [z] -> z+ _ -> x +-- | Squash debug-related @USE@ flags under the @debug@ global+-- @USE@ flag.+--+-- >>> squash_debug "use-debug-foo"+-- "debug"+-- >>> squash_debug "foo-bar"+-- "foo-bar"+squash_debug :: String -> String+squash_debug flag = if "debug" `L.isInfixOf` (C.toLower <$> flag)+ then "debug"+ else flag+ -- | Gentoo allows underscore ('_') names in @IUSE@ only for -- @USE_EXPAND@ values. If it's not a user-specified rename mangle -- it into a hyphen ('-'). -- --- >>> mangle_iuse "use_remove_my_underscores"+-- >>> convert_underscores "remove_my_underscores" -- "remove-my-underscores"-mangle_iuse :: String -> String-mangle_iuse = drop_prefix . map f+convert_underscores :: String -> String+convert_underscores = map f where f '_' = '-' f c = c +-- | Perform all @IUSE@ mangling.+--+-- >>> mangle_iuse "use_foo-bar_debug"+-- "debug"+-- >>> mangle_iuse "with-bar_quux"+-- "bar-quux"+mangle_iuse :: String -> String+mangle_iuse = squash_debug . drop_prefix . convert_underscores+ -- | Convert all stable keywords to testing (unstable) keywords. -- Preserve arch masks (-). --@@ -145,7 +172,10 @@ -- >>> metaFlags flags -- fromList [("foo","bar")] metaFlags :: [Cabal.PackageFlag] -> Map.Map String String-metaFlags flags = Map.fromList $ zip (mangle_iuse . Cabal.unFlagName . Cabal.flagName <$> flags) (Cabal.flagDescription <$> flags)+metaFlags flags =+ Map.fromList $+ zip (mangle_iuse . Cabal.unFlagName . Cabal.flagName <$> flags)+ (Cabal.flagDescription <$> flags) -- | Return a list of @USE_EXPAND@s maintained by ::gentoo. --@@ -172,7 +202,7 @@ -- then return 'Nothing'. Otherwise return 'Just' 'Cabal.PackageFlag'. dropIfUseExpand :: [String] -> Cabal.PackageFlag -> Maybe Cabal.PackageFlag dropIfUseExpand use_expands flag =- if True `elem` (L.isPrefixOf <$> use_expands <*> [Cabal.unFlagName . Cabal.flagName $ flag])+ if or (A.liftA2 L.isPrefixOf use_expands [Cabal.unFlagName . Cabal.flagName $ flag]) then Nothing else Just flag -- | Strip @USE_EXPAND@s from a ['Cabal.PackageFlag'].
Portage/EBuild.hs view
@@ -16,6 +16,7 @@ , sort_iuse , drop_tdot , quote+ , toHttps ) where import Portage.Dependency@@ -45,7 +46,6 @@ version :: String, hackportVersion :: String, description :: String,- long_desc :: String, homepage :: String, license :: Either String String, slot :: String,@@ -76,7 +76,6 @@ version = "0.1", hackportVersion = getHackportVersion Paths_hackport.version, description = "",- long_desc = "", homepage = "https://hackage.haskell.org/package/${HACKAGE_N}", license = Left "unassigned license?", slot = "0",@@ -114,7 +113,7 @@ ss ("# Copyright 1999-" ++ this_year ++ " Gentoo Authors"). nl. ss "# Distributed under the terms of the GNU General Public License v2". nl. nl.- ss "EAPI=7". nl.+ ss "EAPI=8". nl. nl. ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl. sconcat (map (\(k, v) -> ss "#hackport: " . ss k . ss ": " . ss v . nl) $ used_options ebuild).@@ -125,7 +124,8 @@ (case my_pn ebuild of Nothing -> id Just pn -> ss "MY_PN=". quote pn. nl.- ss "MY_P=". quote "${MY_PN}-${PV}". nl. 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.@@ -135,13 +135,12 @@ (license ebuild)). nl. ss "SLOT=". quote (slot ebuild). nl. ss "KEYWORDS=". quote' (sepBy " " $ keywords ebuild).nl.- ss "IUSE=". quote' (sepBy " " . sort_iuse $ L.nub $ iuse ebuild). nl.- nl.+ (if null (iuse ebuild)+ then nl+ else ss "IUSE=". quote' (sepBy " " . sort_iuse $ L.nub $ iuse ebuild). nl. nl+ ) . dep_str "RDEPEND" (rdepend_extra ebuild) (rdepend ebuild). dep_str "DEPEND" ( depend_extra ebuild) ( depend ebuild).- (case my_pn ebuild of- Nothing -> id- Just _ -> nl. ss "S=". quote ("${WORKDIR}/${MY_P}"). nl). verbatim (nl . ss "src_prepare() {" . nl) (src_prepare ebuild)@@ -157,30 +156,34 @@ , (hackage_name ebuild, "${HACKAGE_N}") ] - replace old new = L.intercalate new . LS.splitOn old- -- add to this list with any https-aware websites- -- TODO: perhaps convert this to a list of http-only webpages,- -- given the prominence of https these days (year 2020).- httpsHomepages = Just <$> [ "github.com"- , "hackage.haskell.org"- , "www.haskell.org"- , "hledger.org"- , "jaspervdj.be"- , "www.yesodweb.com"- ]- toHttps :: String -> String- toHttps x =- case parseURI x of- Just uri -> if uriScheme uri == "http:" &&- (uriRegName <$> uriAuthority uri)- `elem`- httpsHomepages- then replace "http" "https" x- else x- Nothing -> x this_year :: String this_year = TC.formatTime TC.defaultTimeLocale "%Y" now++-- | Convert http urls into https urls, unless whitelisted as http-only.+--+-- >>> toHttps "http://darcs.net"+-- "http://darcs.net"+-- >>> toHttps "http://pandoc.org"+-- "https://pandoc.org"+-- >>> toHttps "https://github.com"+-- "https://github.com"+toHttps :: String -> String+toHttps x =+ case parseURI x of+ Just uri -> if uriScheme uri == "http:" &&+ (uriRegName <$> uriAuthority uri)+ `notElem`+ httpOnlyHomepages+ then replace "http" "https" x+ else x+ Nothing -> x+ where+ replace old new = L.intercalate new . LS.splitOn old+ -- add to this list with any non https-aware websites+ httpOnlyHomepages = Just <$> [ "leksah.org"+ , "darcs.net"+ ] -- | Sort IUSE alphabetically --
Portage/GHCCore.hs view
@@ -40,7 +40,7 @@ -- The first @GHC@ version in this list is a minimum default. ghcs :: [(DC.CompilerInfo, InstalledPackageIndex)] ghcs = modern_ghcs- where modern_ghcs = [ghc741, ghc742, ghc762, ghc782, ghc7101, ghc7102, ghc801, ghc802, ghc821, ghc843, ghc863, ghc865, ghc881, ghc883, ghc884, ghc8101]+ where modern_ghcs = [ghc843, ghc863, ghc865, ghc881, ghc883, ghc884, ghc8101, ghc8104] -- | Maybe determine the appropriate 'Cabal.Version' of the @Cabal@ package -- from a given @GHC@ version.@@ -52,21 +52,14 @@ cabalFromGHC :: [Int] -> Maybe Cabal.Version cabalFromGHC ver = lookup ver table where- table = [ ([7,4,2], Cabal.mkVersion [1,14,0])- , ([7,6,2], Cabal.mkVersion [1,16,0])- , ([7,8,2], Cabal.mkVersion [1,18,1,3])- , ([7,10,1], Cabal.mkVersion [1,22,2,0])- , ([7,10,2], Cabal.mkVersion [1,22,4,0])- , ([8,0,1], Cabal.mkVersion [1,24,0,0])- , ([8,0,2], Cabal.mkVersion [1,24,2,0])- , ([8,2,1], Cabal.mkVersion [2,0,0,2])- , ([8,4,3], Cabal.mkVersion [2,2,0,1])+ table = [ ([8,4,3], Cabal.mkVersion [2,2,0,1]) , ([8,6,3], Cabal.mkVersion [2,4,0,1]) , ([8,6,5], Cabal.mkVersion [2,4,0,1]) , ([8,8,1], Cabal.mkVersion [3,0,0,0]) , ([8,8,3], Cabal.mkVersion [3,0,1,0]) , ([8,8,4], Cabal.mkVersion [3,0,1,0]) , ([8,10,1], Cabal.mkVersion [3,2,0,0])+ , ([8,10,4], Cabal.mkVersion [3,2,1,0]) ] platform :: Platform@@ -148,6 +141,9 @@ ghc nrs = DC.unknownCompilerInfo c_id DC.NoAbiTag where c_id = CompilerId GHC (mkVersion nrs) +ghc8104 :: (DC.CompilerInfo, InstalledPackageIndex)+ghc8104 = (ghc [8,10,4], mkIndex ghc8104_pkgs)+ ghc8101 :: (DC.CompilerInfo, InstalledPackageIndex) ghc8101 = (ghc [8,10,1], mkIndex ghc8101_pkgs) @@ -169,39 +165,47 @@ ghc843 :: (DC.CompilerInfo, InstalledPackageIndex) ghc843 = (ghc [8,4,3], mkIndex ghc843_pkgs) -ghc821 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc821 = (ghc [8,2,1], mkIndex ghc821_pkgs)--ghc802 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc802 = (ghc [8,0,2], mkIndex ghc802_pkgs)--ghc801 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc801 = (ghc [8,0,1], mkIndex ghc801_pkgs)--ghc7102 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc7102 = (ghc [7,10,2], mkIndex ghc7102_pkgs)--ghc7101 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc7101 = (ghc [7,10,1], mkIndex ghc7101_pkgs)--ghc782 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc782 = (ghc [7,8,2], mkIndex ghc782_pkgs)--ghc762 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc762 = (ghc [7,6,2], mkIndex ghc762_pkgs)--ghc742 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc742 = (ghc [7,4,2], mkIndex ghc742_pkgs)--ghc741 :: (DC.CompilerInfo, InstalledPackageIndex)-ghc741 = (ghc [7,4,1], mkIndex ghc741_pkgs)- -- | Non-upgradeable core packages -- Sources: -- * release notes -- example: https://downloads.haskell.org/~ghc/8.6.5/docs/html/users_guide/8.6.5-notes.html -- * our binary tarballs (package.conf.d.initial subdir) -- * ancient: http://haskell.org/haskellwiki/Libraries_released_with_GHC+ghc8104_pkgs :: [Cabal.PackageIdentifier]+ghc8104_pkgs =+ [ p "array" [0,5,4,0]+ , p "base" [4,14,1,0]+ , p "binary" [0,8,8,0] -- used by libghc+ , p "bytestring" [0,10,12,0]+-- , p "Cabal" [3,2,1,0] package is upgradeable+ , p "containers" [0,6,2,1]+ , p "deepseq" [1,4,4,0] -- used by time+ , p "directory" [1,3,6,0]+ , p "filepath" [1,4,2,1]+-- , p "exceptions [0,10,4] -- used by haskeline, package is upgradeable + , p "ghc-boot" [8,10,4]+ , p "ghc-boot-th" [8,10,4]+ , p "ghc-compact" [0,1,0,0]+ , p "ghc-prim" [0,6,1,0]+ , p "ghc-heap" [8,10,4]+ , p "ghci" [8,10,4]+-- , p "haskeline" [0,8,0,1] package is upgradeable+ , p "hpc" [0,6,1,0] -- used by libghc+ , p "integer-gmp" [1,0,3,0]+ -- , p "mtl" [2,2,2] package is upgradeable(?)+ -- , p "parsec" [3,1,14,0] package is upgradeable(?)+ , p "pretty" [1,1,3,6]+ , p "process" [1,6,9,0]+ -- , p "stm" [2,5,0,0] package is upgradeable(?)+ , p "template-haskell" [2,16,0,0] -- used by libghc+ -- , p "terminfo" [0,4,1,4]+ -- , p "text" [1,2,4,1] dependency of Cabal library+ , p "time" [1,9,3,0] -- used by unix, directory, hpc, ghc. unsafe to upgrade+ , p "transformers" [0,5,6,2] -- used by libghc+ , p "unix" [2,7,2,2]+-- , p "xhtml" [3000,2,2,1]+ ]+ ghc8101_pkgs :: [Cabal.PackageIdentifier] ghc8101_pkgs = [ p "array" [0,5,4,0]@@ -433,253 +437,6 @@ , p "transformers" [0,5,5,0] -- used by libghc , p "unix" [2,7,2,2] -- , p "xhtml" [3000,2,2,1]- ]--ghc821_pkgs :: [Cabal.PackageIdentifier]-ghc821_pkgs =- [ p "array" [0,5,2,0]- , p "base" [4,10,0,0]- , p "binary" [0,8,5,1] -- used by libghc- , p "bytestring" [0,10,8,2]--- , p "Cabal" [2,0,0,2] package is upgradeable- , p "containers" [0,5,10,2]- , p "deepseq" [1,4,3,0] -- used by time- , p "directory" [1,3,0,2]- , p "filepath" [1,4,1,2]- , p "ghc-boot" [8,2,1]- , p "ghc-boot-th" [8,2,1]- , p "ghc-compact" [0,1,0,0]- , p "ghc-prim" [0,5,1,0]- , p "ghci" [8,2,1]--- , p "haskeline" [0,7,4,0] package is upgradeable- , p "hoopl" [3,10,2,2] -- used by libghc- , p "hpc" [0,6,0,3] -- used by libghc- , p "integer-gmp" [1,0,1,0]- , p "pretty" [1,1,3,3]- , p "process" [1,6,1,0]- , p "template-haskell" [2,12,0,0] -- used by libghc- -- , p "terminfo" [0,4,1,0]- , p "time" [1,8,0,2] -- used by unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,5,2,0] -- used by libghc- , p "unix" [2,7,2,2]--- , p "xhtml" [3000,2,2]- ]--ghc802_pkgs :: [Cabal.PackageIdentifier]-ghc802_pkgs =- [ p "array" [0,5,1,1]- , p "base" [4,9,1,0]- , p "binary" [0,8,3,0] -- used by libghc- , p "bytestring" [0,10,8,1]--- , p "Cabal" [1,24,2,0] package is upgradeable- , p "containers" [0,5,7,1]- , p "deepseq" [1,4,2,0] -- used by time- , p "directory" [1,3,0,0]- , p "filepath" [1,4,1,1]- , p "ghc-boot" [8,0,2]- , p "ghc-boot-th" [8,0,2]- , p "ghc-prim" [0,5,0,0]- , p "ghci" [8,0,2]--- , p "haskeline" [0,7,3,0] package is upgradeable- , p "hoopl" [3,10,2,1] -- used by libghc- , p "hpc" [0,6,0,3] -- used by libghc- , p "integer-gmp" [1,0,0,1]- , p "pretty" [1,1,3,3]- , p "process" [1,4,3,0]- , p "template-haskell" [2,11,1,0] -- used by libghc- -- , p "terminfo" [0,4,0,2]- , p "time" [1,6,0,1] -- used by unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,5,2,0] -- used by libghc- , p "unix" [2,7,2,1]--- , p "xhtml" [3000,2,1]- ]--ghc801_pkgs :: [Cabal.PackageIdentifier]-ghc801_pkgs =- [ p "array" [0,5,1,1]- , p "base" [4,9,0,0]- , p "binary" [0,8,3,0] -- used by libghc- , p "bytestring" [0,10,8,0]--- , p "Cabal" [1,24,0,0] package is upgradeable- , p "containers" [0,5,7,1]- , p "deepseq" [1,4,2,0] -- used by time- , p "directory" [1,2,6,2]- , p "filepath" [1,4,1,0]- , p "ghc-boot" [8,0,1]- , p "ghc-prim" [0,5,0,0]- , p "ghci" [8,0,1]- , p "hoopl" [3,10,2,1] -- used by libghc- , p "hpc" [0,6,0,3] -- used by libghc- , p "integer-gmp" [1,0,0,1]- , p "pretty" [1,1,3,3]- , p "process" [1,4,2,0]- , p "template-haskell" [2,11,0,0] -- used by libghc- -- , p "terminfo" [0,4,0,2]- , p "time" [1,6,0,1] -- used by unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,5,2,0] -- used by libghc- , p "unix" [2,7,2,0]--- , p "xhtml" [3000,2,1]- ]--ghc7102_pkgs :: [Cabal.PackageIdentifier]-ghc7102_pkgs =- [ p "array" [0,5,1,0]- , p "base" [4,8,1,0]- , p "binary" [0,7,3,0] -- used by libghc- , p "bytestring" [0,10,6,0]--- , p "Cabal" [1,18,1,3] package is upgradeable- , p "containers" [0,5,6,2]- , p "deepseq" [1,4,1,1] -- used by time- , p "directory" [1,2,2,0]- , p "filepath" [1,4,0,0]- , p "ghc-prim" [0,4,0,0]- -- , p "haskell2010" [1,1,2,0] -- stopped shipping in 7.10, deprecated- -- , p "haskell98" [2,0,0,3] -- stopped shipping in 7.10, deprecated- , p "hoopl" [3,10,1,0] -- used by libghc- , p "hpc" [0,6,0,2] -- used by libghc- , p "integer-gmp" [1,0,0,0]- -- , p "old-locale" [1,0,0,6] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,2] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,2,0]- , p "process" [1,2,3,0]- , p "template-haskell" [2,10,0,0] -- used by libghc- , p "time" [1,5,0,1] -- used by haskell98, unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,4,2,0] -- used by libghc- , p "unix" [2,7,1,0]- ]--ghc7101_pkgs :: [Cabal.PackageIdentifier]-ghc7101_pkgs =- [ p "array" [0,5,1,0]- , p "base" [4,8,0,0]- , p "binary" [0,7,3,0] -- used by libghc- , p "bytestring" [0,10,6,0]--- , p "Cabal" [1,18,1,3] package is upgradeable- , p "containers" [0,5,6,2]- , p "deepseq" [1,4,1,1] -- used by time- , p "directory" [1,2,2,0]- , p "filepath" [1,4,0,0]- , p "ghc-prim" [0,4,0,0]- -- , p "haskell2010" [1,1,2,0] -- stopped shipping in 7.10, deprecated- -- , p "haskell98" [2,0,0,3] -- stopped shipping in 7.10, deprecated- , p "hoopl" [3,10,0,2] -- used by libghc- , p "hpc" [0,6,0,2] -- used by libghc- , p "integer-gmp" [1,0,0,0]- -- , p "old-locale" [1,0,0,6] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,2] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,2,0]- , p "process" [1,2,3,0]- , p "template-haskell" [2,10,0,0] -- used by libghc- , p "time" [1,5,0,1] -- used by haskell98, unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,4,2,0] -- used by libghc- , p "unix" [2,7,1,0]- ]--ghc782_pkgs :: [Cabal.PackageIdentifier]-ghc782_pkgs =- [ p "array" [0,5,0,0]- , p "base" [4,7,0,0]- , p "binary" [0,7,1,0] -- used by libghc- , p "bytestring" [0,10,4,0]--- , p "Cabal" [1,18,1,3] package is upgradeable- , p "containers" [0,5,5,1]- , p "deepseq" [1,3,0,2] -- used by time, haskell98- , p "directory" [1,2,1,0]- , p "filepath" [1,3,0,2]- , p "ghc-prim" [0,3,1,0]- , p "haskell2010" [1,1,2,0]- , p "haskell98" [2,0,0,3]- , p "hoopl" [3,10,0,1] -- used by libghc- , p "hpc" [0,6,0,1] -- used by libghc- , p "integer-gmp" [0,5,1,0]- -- , p "old-locale" [1,0,0,6] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,2] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,1,1]- , p "process" [1,2,0,0]- , p "template-haskell" [2,9,0,0] -- used by libghc- , p "time" [1,4,2] -- used by haskell98, unix, directory, hpc, ghc. unsafe to upgrade- , p "transformers" [0,3,0,0] -- used by libghc- , p "unix" [2,7,0,1]- ]--ghc762_pkgs :: [Cabal.PackageIdentifier]-ghc762_pkgs =- [ p "array" [0,4,0,1]- , p "base" [4,6,0,1]- , p "binary" [0,5,1,1] -- used by libghc- , p "bytestring" [0,10,0,2]--- , p "Cabal" [1,16,0] package is upgradeable- , p "containers" [0,5,0,0]- , p "deepseq" [1,3,0,1] -- used by time, haskell98- , p "directory" [1,2,0,1]- , p "filepath" [1,3,0,1]- , p "ghc-prim" [0,3,0,0]- , p "haskell2010" [1,1,1,0]- , p "haskell98" [2,0,0,2]- , p "hoopl" [3,9,0,0] -- used by libghc- , p "hpc" [0,6,0,0] -- used by libghc- , p "integer-gmp" [0,5,0,0]- -- , p "old-locale" [1,0,0,5] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,1] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,1,0]- , p "process" [1,1,0,2]- , p "template-haskell" [2,8,0,0] -- used by libghc- , p "time" [1,4,0,1] -- used by haskell98, unix, directory, hpc, ghc. unsafe to upgrade- , p "unix" [2,6,0,1]- ]--ghc742_pkgs :: [Cabal.PackageIdentifier]-ghc742_pkgs =- [ p "array" [0,4,0,0]- , p "base" [4,5,1,0]- , p "binary" [0,5,1,0] -- used by libghc- , p "bytestring" [0,9,2,1]--- , p "Cabal" [1,14,0] package is upgradeable- , p "containers" [0,4,2,1]- , p "deepseq" [1,3,0,0] -- used by time, haskell98- , p "directory" [1,1,0,2]--- , p "extensible-exceptions" [0,1,1,4] -- package is upgradeable, stopped shipping in 7.6- , p "filepath" [1,3,0,0]- , p "ghc-prim" [0,2,0,0]- , p "haskell2010" [1,1,0,1]- , p "haskell98" [2,0,0,1]- , p "hoopl" [3,8,7,3] -- used by libghc- , p "hpc" [0,5,1,1] -- used by libghc- , p "integer-gmp" [0,4,0,0]- -- , p "old-locale" [1,0,0,4] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,0] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,1,0]- , p "process" [1,1,0,1]- , p "template-haskell" [2,7,0,0] -- used by libghc- , p "time" [1,4]- , p "unix" [2,5,1,1]- ]--ghc741_pkgs :: [Cabal.PackageIdentifier]-ghc741_pkgs =- [ p "array" [0,4,0,0]- , p "base" [4,5,0,0]- , p "binary" [0,5,1,0] -- used by libghc- , p "bytestring" [0,9,2,1]--- , p "Cabal" [1,14,0] package is upgradeable- , p "containers" [0,4,2,1]- , p "deepseq" [1,3,0,0] -- used by time, haskell98- , p "directory" [1,1,0,2]--- , p "extensible-exceptions" [0,1,1,4] -- package is upgradeable, stopped shipping in 7.6- , p "filepath" [1,3,0,0]- , p "ghc-prim" [0,2,0,0]- , p "haskell2010" [1,1,0,1]- , p "haskell98" [2,0,0,1]- , p "hoopl" [3,8,7,3] -- used by libghc- , p "hpc" [0,5,1,1] -- used by libghc- , p "integer-gmp" [0,4,0,0]- -- , p "old-locale" [1,0,0,4] -- stopped shipping in 7.10, deprecated- -- , p "old-time" [1,1,0,0] -- stopped shipping in 7.10, deprecated- , p "pretty" [1,1,1,0]- , p "process" [1,1,0,1]- , p "template-haskell" [2,7,0,0] -- used by libghc- , p "time" [1,4]- , p "unix" [2,5,1,0] ] p :: String -> [Int] -> Cabal.PackageIdentifier
Portage/Metadata.hs view
@@ -9,6 +9,7 @@ ( Metadata(..) , metadataFromFile , pureMetadataFromFile+ , stripGlobalUseFlags -- exported for hspec , prettyPrintFlags -- exported for hspec , prettyPrintFlagsHuman , makeDefaultMetadata@@ -36,18 +37,20 @@ -- -- Trying to parse an empty 'T.Text' should return 'Nothing': ----- prop> pureMetadataFromFile T.empty == Nothing+-- >>> pureMetadataFromFile T.empty+-- Nothing -- -- Parsing a @metadata.xml@ /without/ USE flags should /always/ be equivalent--- to 'makeMinimalMetadata', no matter the package description:+-- to 'makeMinimalMetadata': ----- prop> \desc -> pureMetadataFromFile (makeDefaultMetadata desc Map.empty) == Just makeMinimalMetadata+-- >>> pureMetadataFromFile (makeDefaultMetadata Map.empty) == Just makeMinimalMetadata+-- True -- -- Parsing a @metadata.xml@ /with/ USE flags should /always/ be equivalent--- to 'makeMinimalMetadata' /plus/ the supplied USE flags, no matter the--- package description:+-- to 'makeMinimalMetadata' /plus/ the supplied USE flags: ----- prop> \desc -> pureMetadataFromFile (makeDefaultMetadata desc (Map.fromList [("name","description")])) == Just (makeMinimalMetadata {metadataUseFlags = Map.fromList [("name","description")] } )+-- >>> pureMetadataFromFile (makeDefaultMetadata (Map.fromList [("name","description")])) == Just (makeMinimalMetadata {metadataUseFlags = Map.fromList [("name","description")] } )+-- True pureMetadataFromFile :: T.Text -> Maybe Metadata pureMetadataFromFile file = parseXMLDoc file >>= \doc -> parseMetadata doc @@ -74,20 +77,33 @@ in Map.fromList $ zip z b } +-- | Remove global @USE@ flags from the flags 'Map.Map', as these should not be+-- within the local @metadata.xml@. For now, this is manually specified rather than+-- parsing @use.desc@.+stripGlobalUseFlags :: Map.Map String String -> Map.Map String String+stripGlobalUseFlags m = foldr1 Map.intersection (Map.delete <$> globals <*> [m])+ where+ globals = [ "debug"+ , "examples"+ , "static"+ ]+ -- | Pretty print as valid XML a list of flags and their descriptions -- from a given 'Map.Map'. prettyPrintFlags :: Map.Map String String -> [String] prettyPrintFlags m = (\(name,description) ->- "\t\t<flag name=\"" ++ name ++ "\">" ++- (L.intercalate " " . lines $ description) ++ "</flag>")- <$> Map.toAscList m+ "\t\t" +++ (showElement+ . add_attr (Attr (blank_name { qName = "name" }) name)+ . unode "flag" $ description))+ <$> (Map.toAscList . stripGlobalUseFlags $ m) -- | Pretty print a human-readable list of flags and their descriptions -- from a given 'Map.Map'. prettyPrintFlagsHuman :: Map.Map String String -> [String] prettyPrintFlagsHuman m = (\(name,description) -> A.bold (name ++ ": ") ++ (L.intercalate " " . lines $ description))- <$> Map.toAscList m+ <$> (Map.toAscList . stripGlobalUseFlags $ m) -- | A minimal metadata for use as a fallback value. makeMinimalMetadata :: Metadata@@ -97,19 +113,8 @@ -- don't use Text.XML.Light as we like our own pretty printer -- | Pretty print the @metadata.xml@ string.------ This function will additionally print the @<use>@ and @<longdescription>@--- xml elements if:------ 1. There are USE flags to fill the @<use>@ element, which cannot be empty;--- and--- 2. The long description is greater than 150 characters long.------ The long description also cannot be identical to the @DESCRIPTION@ field--- in an ebuild in order to pass Gentoo QA, but this is checked for outside--- of this function. See "Merge" for an example usage.-makeDefaultMetadata :: String -> Map.Map String String -> T.Text-makeDefaultMetadata long_description flags = T.pack $+makeDefaultMetadata :: Map.Map String String -> T.Text+makeDefaultMetadata flags = T.pack $ unlines [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">" , "<pkgmetadata>"@@ -118,22 +123,7 @@ , "\t\t<name>Gentoo Haskell</name>" , "\t</maintainer>" ++ if flags == Map.empty- then []+ then "" else "\n\t<use>\n" ++ (unlines $ prettyPrintFlags flags) ++ "\t</use>"- ++ if long_description == "" || length long_description <= 150- then []- else "\n" ++- (init {- strip trailing newline-}- . unlines- . map (\l -> if l `elem` ["<longdescription>", "</longdescription>"]- then "\t" ++ l -- leading/trailing lines- else "\t\t" ++ l -- description itself- )- . lines- . showElement- . unode "longdescription"- . ("\n" ++) -- prepend newline to separate from <longdescription>- . (++ "\n") -- append newline- ) long_description , "</pkgmetadata>" ]
hackage-security/hackage-repo-tool/hackage-repo-tool.cabal view
@@ -52,7 +52,7 @@ -- For boot libraries we try to accomodate the versions bundled with -- the respective GHC release build-depends: base >= 4.5 && < 4.15,- bytestring >= 0.9 && < 0.11,+ bytestring >= 0.9 && < 0.12, Cabal >= 1.14 && < 1.26 || >= 2.0 && < 2.6 || >= 3.0 && < 3.4,
hackage-security/hackage-security-HTTP/ChangeLog.md view
@@ -1,3 +1,7 @@+0.1.1.1+-------+* Add support for hackage-security-0.6+ 0.1.1 ----- * Implement updated HttpLib API from hackage-security 0.5
hackage-security/hackage-security-HTTP/hackage-security-HTTP.cabal view
@@ -1,5 +1,6 @@+cabal-version: 1.12 name: hackage-security-HTTP-version: 0.1.1+version: 0.1.1.1 synopsis: Hackage security bindings against the HTTP library description: The hackage security library provides a 'HttpLib' abstraction to allow to bind against different HTTP@@ -8,13 +9,12 @@ license: BSD3 license-file: LICENSE author: Edsko de Vries-maintainer: edsko@well-typed.com-copyright: Copyright 2015 Well-Typed LLP+maintainer: cabal-devel@haskell.org+copyright: Copyright 2015-2016 Well-Typed LLP category: Distribution homepage: https://github.com/haskell/hackage-security bug-reports: https://github.com/haskell/hackage-security/issues build-type: Simple-cabal-version: >=1.10 tested-with: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 @@ -31,8 +31,8 @@ library exposed-modules: Hackage.Security.Client.Repository.HttpLib.HTTP- build-depends: base >= 4.4 && < 5,- bytestring >= 0.9 && < 0.11,+ build-depends: base >= 4.5 && < 4.15,+ bytestring >= 0.9 && < 0.12, HTTP >= 4000.2.19 && < 4000.4, mtl >= 2.1 && < 2.3, zlib >= 0.5 && < 0.7,@@ -51,6 +51,7 @@ -- See comments in hackage-security.cabal if flag(use-network-uri) build-depends: network-uri >= 2.6 && < 2.7,- network >= 2.6 && < 3.2+ network >= 2.6 && < 2.9+ || >= 3.0 && < 3.2 else build-depends: network >= 2.5 && < 2.6
hackage-security/hackage-security/hackage-security.cabal view
@@ -111,9 +111,9 @@ Prelude -- We support ghc 7.4 (bundled with Cabal 1.14) and up build-depends: base >= 4.5 && < 4.15,- base16-bytestring >= 0.1.1 && < 0.2,- base64-bytestring >= 1.0 && < 1.2,- bytestring >= 0.9 && < 0.11,+ base16-bytestring >= 0.1.1 && < 1.1,+ base64-bytestring >= 1.0 && < 1.3,+ bytestring >= 0.9 && < 0.12, Cabal >= 1.14 && < 1.26 || >= 2.0 && < 2.6 || >= 3.0 && < 3.4,@@ -252,10 +252,14 @@ Cabal, containers, bytestring,- network-uri, tar, time, zlib++ if flag(use-network-uri)+ build-depends: network-uri+ else+ build-depends: network -- dependencies exclusive to test-suite build-depends: tasty == 1.2.*,
hackport.cabal view
@@ -1,5 +1,5 @@ Name: hackport-Version: 0.6.7+Version: 0.7 License: GPL License-file: LICENSE Author: Henning Günther, Duncan Coutts, Lennart Kolmodin@@ -16,7 +16,7 @@ location: git://github.com/gentoo-haskell/hackport.git Executable hackport- ghc-options: -Wall -threaded +RTS -N -RTS+ ghc-options: -Wall -threaded +RTS -N -RTS -with-rtsopts=-N ghc-prof-options: -caf-all -auto-all -rtsopts Main-Is: Main.hs Default-Language: Haskell2010
tests/Merge/UtilsSpec.hs view
@@ -102,9 +102,28 @@ then [flag] else [prefix ++ '-':flag] + describe "squash_debug" $ do+ it "squashes debug-related flags under the debug global USE flag" $ do+ squash_debug "use-debug-foo" `shouldBe` "debug"+ squash_debug "debug-foo" `shouldBe` "debug"+ squash_debug "foo-debugger" `shouldBe` "debug"+ it "ignores debug-unrelated flags" $ do+ squash_debug "foo-bar" `shouldBe` "foo-bar"++ describe "convert_underscores" $ do+ it "converts underscores (_) into hyphens (-)" $ do+ convert_underscores "foo_bar" `shouldBe` "foo-bar"+ it "ignores mangling of separators other than underscores" $ do+ convert_underscores "foo-bar" `shouldBe` "foo-bar"+ it "ignores mangling of characters which are not separators" $ do+ convert_underscores "foobar" `shouldBe` "foobar"+ describe "mangle_iuse" $ do- prop "converts underscores (_) into hyphens (-) and drops with/use prefixes" $ do- \a -> mangle_iuse a == drop_prefix (map (\f -> if f == '_' then '-' else f) a)+ it "performs all IUSE mangling" $ do+ mangle_iuse "use_foo_bar" `shouldBe` "foo-bar"+ mangle_iuse "with-baz-quux" `shouldBe` "baz-quux"+ mangle_iuse "use_debugging-symbols" `shouldBe` "debug"+ mangle_iuse "foo-bar-baz_quux" `shouldBe` "foo-bar-baz-quux" describe "to_unstable" $ do prop "creates an unstable keyword from a stable keyword, or preserves a mask" $ do
tests/Portage/EBuildSpec.hs view
@@ -29,4 +29,12 @@ quote "Extras for the \"contravariant\" package" "" `shouldBe` "\"Extras for the \\\"contravariant\\\" package\""-+ describe "toHttps" $ do+ it "should not convert whitelisted http-only homepages into https homepages" $ do+ toHttps "http://leksah.org" `shouldBe` "http://leksah.org"+ toHttps "http://darcs.net/" `shouldBe` "http://darcs.net/"+ it "should otherwise convert all homepages into https-aware homepages" $ do+ toHttps "http://pandoc.org" `shouldBe` "https://pandoc.org"+ toHttps "http://www.yesodweb.com/" `shouldBe` "https://www.yesodweb.com/"+ it "should ignore any conversions of homepages already marked as https-aware" $ do+ toHttps "https://github.com" `shouldBe` "https://github.com"
tests/Portage/MetadataSpec.hs view
@@ -14,20 +14,51 @@ describe "pureMetadataFromFile" $ do it "returns Nothing from an empty Text" $ do pureMetadataFromFile T.empty `shouldBe` Nothing- prop "equals makeMinimalMetadata with no USE flags, no matter the description" $ do- \desc -> pureMetadataFromFile (makeDefaultMetadata desc Map.empty) ==- Just makeMinimalMetadata- prop "equals makeMinimalMetadata plus the supplied USE flags, no matter the description" $- do let flags = Map.singleton "name" "description"- in \desc -> pureMetadataFromFile (makeDefaultMetadata desc flags)- == Just (makeMinimalMetadata { metadataUseFlags = flags } )+ it "equals makeMinimalMetadata with no USE flags" $ do+ pureMetadataFromFile (makeDefaultMetadata Map.empty) `shouldBe` Just makeMinimalMetadata+ it "equals makeMinimalMetadata plus the supplied USE flags" $ do+ let flags = Map.singleton "name" "description"+ pureMetadataFromFile (makeDefaultMetadata flags) `shouldBe` Just (makeMinimalMetadata { metadataUseFlags = flags }) + describe "stripGlobalUseFlags" $ do+ it "should remove specified global USE flags from the metadata.xml" $ do+ stripGlobalUseFlags (Map.singleton "debug" "description") `shouldBe` Map.empty+ stripGlobalUseFlags (Map.singleton "examples" "description") `shouldBe` Map.empty+ stripGlobalUseFlags (Map.singleton "static" "description") `shouldBe` Map.empty+ prop "should ignore USE flags that are not specified as global" $ do+ \name description -> stripGlobalUseFlags (Map.singleton name description) ==+ if name `elem` ["debug","examples","static"]+ then Map.empty+ else Map.singleton name description+ describe "prettyPrintFlags" $ do- prop "should correctly format a single USE flag name with its description" $ do- \name description -> prettyPrintFlags (Map.singleton name description) ==+ it "correctly handles special XML characters contained in strings" $ do+ let name = "foo"+ desc = "bar < 1.1.0"+ in prettyPrintFlags (Map.singleton name desc) `shouldBe`+ ["\t\t<flag name=\"" ++ name ++ "\">"+ ++ "bar < 1.1.0" ++ "</flag>"]+ it "correctly formats a single USE flag name with its description" $ do+ let name = "foo"+ description = "bar"+ in prettyPrintFlags (Map.singleton name description) `shouldBe` ["\t\t<flag name=\"" ++ name ++ "\">" ++ (L.intercalate " " . lines $ description) ++ "</flag>"]+ it "correctly formats multiple USE flag names with their descriptions" $ do+ let f1 = "flag1"+ f2 = "flag2"+ d1 = "foo_desc"+ d2 = "bar_desc"+ in prettyPrintFlags (Map.fromList [(f1,d1),(f2,d2)]) `shouldBe`+ ["\t\t<flag name=\"" ++ f1+ ++ "\">" ++ (L.intercalate " " . lines $ d1)+ ++ "</flag>"+ ,+ "\t\t<flag name=\"" ++ f2+ ++ "\">" ++ (L.intercalate " " . lines $ d2)+ ++ "</flag>"]+ prop "should have a length equal to the number of USE flags" $ do \flags -> length (prettyPrintFlags flags) == Map.size flags @@ -36,10 +67,9 @@ it "should have a certain number of lines" $ do -- This is the number of lines in a skeleton metadata.xml. -- If it does not equal this number, the formatting may be wrong.- length (T.lines (makeDefaultMetadata "" Map.empty)) `shouldBe` 8+ length (T.lines (makeDefaultMetadata Map.empty)) `shouldBe` 8 it "should have a certain format" $ do- let desc = "foo"- correctMetadata = T.pack $ unlines+ let correctMetadata = T.pack $ unlines [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">" , "<pkgmetadata>"@@ -49,15 +79,14 @@ , "\t</maintainer>" , "</pkgmetadata>" ]- in makeDefaultMetadata desc Map.empty `shouldBe` correctMetadata+ in makeDefaultMetadata Map.empty `shouldBe` correctMetadata context "when writing a metadata.xml with USE flags" $ do it "should have a certain number of lines" $ do let flags = Map.singleton "name" "description"- in length (T.lines (makeDefaultMetadata "" flags))+ in length (T.lines (makeDefaultMetadata flags)) `shouldBe` 10 + (Map.size flags) it "should have a certain format, including the <use> element" $ do- let desc = "foo"- flags = Map.singleton "name" "description"+ let flags = Map.fromList [("flag1","desc1"),("flag2","desc2")] correctMetadata = T.pack $ unlines [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">"@@ -67,34 +96,9 @@ , "\t\t<name>Gentoo Haskell</name>" , "\t</maintainer>" , "\t<use>"- , "\t\t<flag name=\"name\">description</flag>"+ , "\t\t<flag name=\"flag1\">desc1</flag>"+ , "\t\t<flag name=\"flag2\">desc2</flag>" , "\t</use>" , "</pkgmetadata>" ]- in makeDefaultMetadata desc flags `shouldBe` correctMetadata- context "when writing a metadata.xml with a valid long description and USE flags" $ do- it "has a certain number of lines" $ do- let desc = replicate 151 'a'- flags = Map.singleton "name" "description"- in length (T.lines (makeDefaultMetadata desc flags))- `shouldBe` 13 + (Map.size flags)- it "writes the <longdescription> and <use> elements into the metadata.xml" $ do- let desc = replicate 151 'a'- flags = Map.singleton "name" "description"- correctMetadata = T.pack $ unlines- [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"- , "<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">"- , "<pkgmetadata>"- , "\t<maintainer type=\"project\">"- , "\t\t<email>haskell@gentoo.org</email>"- , "\t\t<name>Gentoo Haskell</name>"- , "\t</maintainer>"- , "\t<use>"- , "\t\t<flag name=\"name\">description</flag>"- , "\t</use>"- , "\t<longdescription>"- , "\t\t" ++ desc- , "\t</longdescription>"- , "</pkgmetadata>"- ]- in makeDefaultMetadata desc flags `shouldBe` correctMetadata+ in makeDefaultMetadata flags `shouldBe` correctMetadata