summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeiTrofimovich <>2012-05-29 17:53:55 (GMT)
committerhdiff <hdiff@luite.com>2012-05-29 17:53:55 (GMT)
commit0278b85931c6389dea3b986c40f4db62ed82adc9 (patch)
treeeb419489d4c5e6e67b7853db95e40f6c89f0284d
parent514e553b45046ef8afe6eb0b8a21cee44370fc7d (diff)
version 0.2.180.2.18
-rw-r--r--Cabal2Ebuild.hs11
-rw-r--r--Merge.hs2
-rw-r--r--Merge/Dependencies.hs52
-rw-r--r--Portage/Dependency.hs63
-rw-r--r--Portage/EBuild.hs6
-rw-r--r--Portage/GHCCore.hs25
-rw-r--r--Portage/Version.hs8
-rw-r--r--README.rst8
-rw-r--r--Status.hs10
-rw-r--r--hackport.cabal20
-rw-r--r--tests/resolveCat.hs14
11 files changed, 154 insertions, 65 deletions
diff --git a/Cabal2Ebuild.hs b/Cabal2Ebuild.hs
index 3cd3c25..421dc97 100644
--- a/Cabal2Ebuild.hs
+++ b/Cabal2Ebuild.hs
@@ -37,7 +37,6 @@ import Distribution.Text (display)
import Data.Char (toLower,isUpper)
import Portage.Dependency
-import Portage.Use
import qualified Portage.PackageId as Portage
import qualified Portage.EBuild as Portage
import qualified Portage.Resolve as Portage
@@ -62,9 +61,11 @@ cabal2ebuild pkg = Portage.ebuildTemplate {
++ maybe [] (const (["lib","profile","haddock","hoogle"]
++ if cabalPkgName == "hscolour" then [] else ["hscolour"])
) (Cabal.library pkg) -- hscolour can't colour its own sources
+ ++ (if hasTests then ["test-suite"] else [])
} where
cabalPkgName = display $ Cabal.pkgName (Cabal.package pkg)
hasExe = (not . null) (Cabal.executables pkg)
+ hasTests = (not . null) (Cabal.testSuites pkg)
thisHomepage = if (null $ Cabal.homepage pkg)
then E.homepage E.ebuildTemplate
else Cabal.homepage pkg
@@ -73,7 +74,7 @@ convertDependencies :: O.Overlay -> Portage.Category -> [Cabal.Dependency] -> [D
convertDependencies overlay category = concatMap (convertDependency overlay category)
convertDependency :: O.Overlay -> Portage.Category -> Cabal.Dependency -> [Dependency]
-convertDependency overlay _category (Cabal.Dependency pname@(Cabal.PackageName _name) _)
+convertDependency _overlay _category (Cabal.Dependency pname@(Cabal.PackageName _name) _)
| pname `elem` coreLibs = [] -- no explicit dep on core libs
convertDependency overlay category (Cabal.Dependency pname versionRange)
= convert versionRange
@@ -90,14 +91,10 @@ convertDependency overlay category (Cabal.Dependency pname versionRange)
)(\v -> [OrLaterVersionOf (fromCabalVersion v) pn []] -- ^ @\">= v\"@
)(\v -> [OrEarlierVersionOf (fromCabalVersion v) pn []] -- ^ @\"<= v\"@
)(\v _ -> [ThisMajorOf (fromCabalVersion v) pn []] -- ^ @\"== v.*\"@ wildcard. (incl lower, excl upper)
- )(\g1 g2 -> [DependEither (flatten g1 ++ flatten g2) ] -- ^ @\"_ || _\"@ union
+ )(\g1 g2 -> [DependEither (g1 ++ g2)] -- ^ @\"_ || _\"@ union
)(\r1 r2 -> r1 ++ r2 -- ^ @\"_ && _\"@ intersection
)(\dp -> [AllOf dp ] -- ^ @\"(_)\"@ parentheses
)
- where
- flatten :: [Dependency] -> [[Dependency]]
- flatten [DependEither ds] = concatMap flatten ds
- flatten other = [other]
coreLibs :: [Cabal.PackageName]
coreLibs = map Cabal.PackageName
diff --git a/Merge.hs b/Merge.hs
index e86a1fe..bcf3e24 100644
--- a/Merge.hs
+++ b/Merge.hs
@@ -176,6 +176,8 @@ mergeGenericPackageDescription verbosity overlayPath cat pkgGenericDesc fetch =
debug verbosity ("Selected flags: " ++ show flags)
info verbosity ("Guessing GHC version: " ++ maybe "could not guess" (display.fst) mminimumGHC)
+ forM_ excludePkgs $
+ \(PackageName name) -> info verbosity $ "Excluded packages (come with ghc): " ++ name
let ebuild = (\e -> e { E.depend = Merge.dep edeps } )
. (\e -> e { E.depend_extra = Merge.dep_e edeps } )
diff --git a/Merge/Dependencies.hs b/Merge/Dependencies.hs
index 669ef35..44ebd58 100644
--- a/Merge/Dependencies.hs
+++ b/Merge/Dependencies.hs
@@ -55,6 +55,8 @@ import Distribution.PackageDescription ( PackageDescription(..)
, pkgconfigDepends
, hasLibs
, specVersion
+ , TestSuite(..)
+ , targetBuildDepends
)
import Data.Maybe ( isNothing )
import Data.List ( nub )
@@ -96,12 +98,16 @@ resolveDependencies :: Portage.Overlay -> PackageDescription -> Maybe CompilerId
resolveDependencies overlay pkg mcompiler =
edeps
{
- dep = Portage.simplify_deps ( dep edeps),
- rdep = Portage.simplify_deps (rdep edeps)
+ dep = dep2,
+ rdep = rdep2
-- todo: if rdep includes cabal or ghc, make sure it's the same
-- version as in dep
}
where
+ dep1 = Portage.simplify_deps ( dep edeps)
+ dep2 = Portage.simplifyUseDeps dep1 (dep1++rdep2)
+ rdep1 = Portage.simplify_deps (rdep edeps)
+ rdep2 = Portage.simplifyUseDeps rdep1 rdep1
compiler = maybe (fst GHCCore.defaultGHC) id mcompiler
hasBuildableExes p = any (buildable . buildInfo) . executables $ p
@@ -109,6 +115,9 @@ resolveDependencies overlay pkg mcompiler =
haskell_deps
| treatAsLibrary = add_profile $ haskellDependencies overlay pkg
| otherwise = haskellDependencies overlay pkg
+ test_deps
+ | (not . null) (testSuites pkg) = testDependencies overlay pkg
+ | otherwise = [] -- tests not enabled
cabal_dep = cabalDependency overlay pkg compiler
ghc_dep = compilerIdToDependency compiler
extra_libs = findCLibs pkg
@@ -118,7 +127,8 @@ resolveDependencies overlay pkg mcompiler =
| treatAsLibrary = emptyEDep
{
dep = cabal_dep
- : build_tools,
+ : build_tools
+ ++ test_deps,
dep_e = [ "${RDEPEND}" ],
rdep = ghc_dep
: haskell_deps
@@ -130,12 +140,23 @@ resolveDependencies overlay pkg mcompiler =
dep = ghc_dep
: cabal_dep
: build_tools
- ++ haskell_deps,
+ ++ haskell_deps
+ ++ test_deps,
dep_e = [ "${RDEPEND}" ],
rdep = extra_libs ++ pkg_config
}
add_profile = map (flip Portage.addDepUseFlag (Portage.mkQUse "profile"))
+---------------------------------------------------------------
+-- Test-suite dependencies
+---------------------------------------------------------------
+
+testDependencies :: Portage.Overlay -> PackageDescription -> [Portage.Dependency]
+testDependencies overlay pkg@(PackageDescription { package = Cabal.PackageIdentifier { Cabal.pkgName = Cabal.PackageName name}}) =
+ [Portage.DependIfUse (Portage.UseFlag "test") (Portage.AllOf $ Portage.simplify_deps deps)]
+ where cabalDeps = concat $ map targetBuildDepends $ map testBuildInfo (testSuites pkg)
+ cabalDeps' = filter (\(Cabal.Dependency (Cabal.PackageName pname) _) -> pname /= name) cabalDeps
+ deps = C2E.convertDependencies overlay (Portage.Category "dev-haskell") cabalDeps'
---------------------------------------------------------------
-- Haskell packages
@@ -204,12 +225,13 @@ staticTranslateExtraLib lib = lookup lib m
m = [ ("z", Portage.AnyVersionOf (Portage.mkPackageName "sys-libs" "zlib") [])
, ("bz2", Portage.AnyVersionOf (Portage.mkPackageName "sys-libs" "bzlib") [])
, ("mysqlclient", Portage.LaterVersionOf (Portage.Version [4,0] Nothing [] 0) (Portage.mkPackageName "virtual" "mysql") [])
- , ("pq", Portage.LaterVersionOf (Portage.Version [7] Nothing [] 0) (Portage.mkPackageName "virtual" "postgresql-base") [])
+ , ("pq", Portage.LaterVersionOf (Portage.Version [7] Nothing [] 0) (Portage.mkPackageName "dev-db" "postgresql-base") [])
, ("ev", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "libev") [])
, ("expat", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "expat") [])
, ("curl", Portage.AnyVersionOf (Portage.mkPackageName "net-misc" "curl") [])
, ("xml2", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "libxml2") [])
, ("mecab", Portage.AnyVersionOf (Portage.mkPackageName "app-text" "mecab") [])
+ , ("zmq", Portage.AnyVersionOf (Portage.mkPackageName "net-libs" "zeromq") [])
]
---------------------------------------------------------------
@@ -236,6 +258,7 @@ buildToolsTable =
[ ("happy", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "happy") [])
, ("alex", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "alex") [])
, ("c2hs", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "c2hs") [])
+ , ("cabal-install", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "cabal-install") [])
, ("gtk2hsTypeGen", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") [])
, ("gtk2hsHookGenerator", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") [])
, ("gtk2hsC2hs", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") [])
@@ -269,20 +292,20 @@ resolvePkgConfigs overlay cdeps =
resolvePkgConfig :: Portage.Overlay -> Cabal.Dependency -> Maybe Portage.Dependency
resolvePkgConfig overlay (Cabal.Dependency (Cabal.PackageName pn) _cabalVersion) = do
(cat,portname) <- lookup pn table
- return . head $ (C2E.convertDependency overlay (Portage.Category cat) (Cabal.Dependency (Cabal.PackageName portname) _cabalVersion))
+ return $ Portage.AnyVersionOf (Portage.mkPackageName cat portname) []
table :: [(String, (String, String))]
table =
[("gconf-2.0", ("gnome-base", "gconf"))
- ,("gio-2.0", ("dev-libs", "glib"))
- ,("gio-unix-2.0", ("dev-libs", "glib"))
- ,("glib-2.0", ("dev-libs", "glib"))
- ,("gmodule-2.0", ("dev-libs", "glib"))
- ,("gmodule-export-2.0", ("dev-libs", "glib"))
- ,("gmodule-no-export-2.0", ("dev-libs", "glib"))
- ,("gobject-2.0", ("dev-libs", "glib"))
- ,("gthread-2.0", ("dev-libs", "glib")) -- should be slot 2
+ ,("gio-2.0", ("dev-libs", "glib:2"))
+ ,("gio-unix-2.0", ("dev-libs", "glib:2"))
+ ,("glib-2.0", ("dev-libs", "glib:2"))
+ ,("gmodule-2.0", ("dev-libs", "glib:2"))
+ ,("gmodule-export-2.0", ("dev-libs", "glib:2"))
+ ,("gmodule-no-export-2.0", ("dev-libs", "glib:2"))
+ ,("gobject-2.0", ("dev-libs", "glib:2"))
+ ,("gthread-2.0", ("dev-libs", "glib:2"))
,("gtk+-2.0", ("x11-libs", "gtk+")) -- should be slot 2
,("gdk-2.0", ("x11-libs", "gtk+"))
@@ -331,5 +354,6 @@ table =
,("curl", ("net-misc", "curl"))
,("libxml2", ("dev-libs", "libxml2"))
+ ,("libgsasl", ("virtual", "gsasl"))
]
diff --git a/Portage/Dependency.hs b/Portage/Dependency.hs
index 7e36135..11cfea8 100644
--- a/Portage/Dependency.hs
+++ b/Portage/Dependency.hs
@@ -1,6 +1,7 @@
module Portage.Dependency (
Dependency(..),
simplify_deps,
+ simplifyUseDeps,
addDepUseFlag
) where
@@ -13,7 +14,7 @@ import Portage.PackageId
import qualified Text.PrettyPrint as Disp
import Text.PrettyPrint ( (<>), hsep )
-import Data.Maybe ( fromJust, catMaybes )
+import Data.Maybe ( fromJust, catMaybes, mapMaybe )
import Data.List ( nub, groupBy, partition, sortBy )
import Data.Ord (comparing)
@@ -23,10 +24,10 @@ data Dependency = AnyVersionOf PackageName [UseFlag]
| EarlierVersionOf Version PackageName [UseFlag] -- <package-version
| OrLaterVersionOf Version PackageName [UseFlag] -- >=package-version
| OrEarlierVersionOf Version PackageName [UseFlag] -- <=package-version
- | DependEither [[Dependency]] -- || ( depend_group1 ..depend_groupN )
- | DependIfUse UseFlag Dependency -- use? ( depend )
+ | DependEither [Dependency] -- || ( depend1 depend2 ... )
+ | DependIfUse UseFlag Dependency -- use? ( depend )
| ThisMajorOf Version PackageName [UseFlag] -- =package-version*
- | AllOf [Dependency] -- ( package-version* )
+ | AllOf [Dependency] -- ( depend1 depend2 ... )
deriving (Eq,Show)
instance Text Dependency where
@@ -37,21 +38,23 @@ a <-> b = a <> Disp.char '-' <> b
showDepend :: Dependency -> Disp.Doc
showDepend (AnyVersionOf p u) = disp p <> dispUses u
-showDepend (ThisVersionOf v p u) = Disp.char '~' <> disp p <-> disp v { versionRevision = 0 }<>dispUses u
+showDepend (ThisVersionOf v p u) = Disp.char '~' <> disp p <-> disp v { versionRevision = 0 } <> dispUses u
showDepend (LaterVersionOf v p u) = Disp.char '>' <> disp p <-> disp v <> dispUses u
showDepend (EarlierVersionOf v p u) = Disp.char '<' <> disp p <-> disp v <> dispUses u
showDepend (OrLaterVersionOf v p u) = Disp.text ">=" <> disp p <-> disp v <> dispUses u
showDepend (OrEarlierVersionOf v p u) = Disp.text "<=" <> disp p <-> disp v <> dispUses u
-showDepend (DependEither dep_groups0)
- = Disp.text "|| " <> spaceParens dep_groups
- where dep_groups = map (spaceParens . map disp) dep_groups0
- spaceParens ds = Disp.parens (Disp.space <> Disp.hsep ds <> Disp.space)
-showDepend (DependIfUse useflag dep@(DependEither _))
- = disp useflag <> Disp.text "? " <> disp dep
-showDepend (DependIfUse useflag dep)
- = disp useflag <> Disp.text "? " <> Disp.parens (disp dep)
+showDepend (DependEither dp ) = Disp.text "|| ( " <> hsep (map showDepend dp) <> Disp.text " )"
+showDepend (DependIfUse useflag dep) = disp useflag <> Disp.text "? " <> pp_deps dep
+ where -- special case to avoid double braces: test? ( ( ) )
+ pp_deps (AllOf _) = disp dep
+ pp_deps _ = Disp.parens (Disp.text " " <> disp dep <> Disp.text " ")
showDepend (ThisMajorOf v p u) = Disp.char '=' <> disp p <-> disp v <> Disp.char '*' <> dispUses u
-showDepend (AllOf dp ) = Disp.text "( " <> hsep (map showDepend dp) <> Disp.text " )"
+showDepend (AllOf []) = Disp.empty
+showDepend (AllOf (d:dp) ) =
+ Disp.text "( " <> showDepend d <> line
+ <> Disp.hcat (map (\x -> Disp.text "\t\t\t" <> (showDepend x) <> line) dp)
+ <> Disp.text "\t\t)"
+ where line = Disp.char '\n'
{- Here goes code for dependencies simplification -}
@@ -148,6 +151,7 @@ simplify_deps deps = (concatMap (simplify_group.nub) $
cmpMaybe _ _ = False
--
getPackage :: Dependency -> Maybe PackageName
+getPackage (AllOf _dependency) = Nothing
getPackage (AnyVersionOf package _uses) = Just package
getPackage (ThisVersionOf _version package _uses) = Just package
getPackage (LaterVersionOf _version package _uses) = Just package
@@ -159,6 +163,7 @@ getPackage (DependIfUse _useFlag _Dependency) = Nothing
getPackage (ThisMajorOf _version package _uses) = Just package
getUses :: Dependency -> Maybe [UseFlag]
+getUses (AllOf _d) = Nothing
getUses (AnyVersionOf _p u) = Just u
getUses (ThisVersionOf _v _p u) = Just u
getUses (LaterVersionOf _v _p u) = Just u
@@ -175,6 +180,7 @@ getPackagePart dep = fromJust (getPackage dep)
--
addDepUseFlag :: Dependency -> UseFlag -> Dependency
+addDepUseFlag (AllOf d) n = AllOf $ map (flip addDepUseFlag n) d
addDepUseFlag (AnyVersionOf p u) n = AnyVersionOf p (n:u)
addDepUseFlag (ThisVersionOf v p u) n = ThisVersionOf v p (n:u)
addDepUseFlag (LaterVersionOf v p u) n = LaterVersionOf v p (n:u)
@@ -182,5 +188,32 @@ addDepUseFlag (EarlierVersionOf v p u) n = EarlierVersionOf v p (n:u)
addDepUseFlag (OrLaterVersionOf v p u) n = OrLaterVersionOf v p (n:u)
addDepUseFlag (OrEarlierVersionOf v p u) n = OrEarlierVersionOf v p (n:u)
addDepUseFlag (ThisMajorOf v p u) n = ThisMajorOf v p (n:u)
-addDepUseFlag (DependEither d) n = DependEither $ map (\d' -> map (flip addDepUseFlag n) d') d
+addDepUseFlag (DependEither d) n = DependEither $ map (flip addDepUseFlag n) d
addDepUseFlag (DependIfUse u d) n = DependIfUse u (addDepUseFlag d n)
+
+--
+-- | remove all Use dependencies that overlap with normal dependencies
+simplifyUseDeps :: [Dependency] -- list where use deps is taken
+ -> [Dependency] -- list where common deps is taken
+ -> [Dependency] -- result deps
+simplifyUseDeps ds cs =
+ let (u,o) = partition isUseDep ds
+ c = mapMaybe getPackage cs
+ in (mapMaybe (intersectD c) u)++o
+
+intersectD :: [PackageName] -> Dependency -> Maybe Dependency
+intersectD fs (DependIfUse u d) = intersectD fs d >>= Just . DependIfUse u
+intersectD fs (DependEither ds) =
+ let ds' = mapMaybe (intersectD fs) ds
+ in if null ds' then Nothing else Just (DependEither ds')
+intersectD fs (AllOf ds) =
+ let ds' = mapMaybe (intersectD fs) ds
+ in if null ds' then Nothing else Just (AllOf ds')
+intersectD fs x =
+ let pkg = fromJust $ getPackage x -- this is unsafe but will save from error later
+ in if any (==pkg) fs then Nothing else Just x
+
+isUseDep :: Dependency -> Bool
+isUseDep (DependIfUse _ _) = True
+isUseDep _ = False
+--
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index 67202ea..bb06bdf 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -78,12 +78,12 @@ showEBuild :: EBuild -> String
showEBuild ebuild =
ss "# Copyright 1999-2012 Gentoo Foundation". nl.
ss "# Distributed under the terms of the GNU General Public License v2". nl.
- ss "# $Header: $". nl.
- nl.
- ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl.
+ ss "# $Header: $". nl.
nl.
ss "EAPI=4". nl.
nl.
+ ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl.
+ nl.
ss "CABAL_FEATURES=". quote' (sepBy " " $ features ebuild). nl.
ss "inherit haskell-cabal". nl.
nl.
diff --git a/Portage/GHCCore.hs b/Portage/GHCCore.hs
index 19af330..d49d607 100644
--- a/Portage/GHCCore.hs
+++ b/Portage/GHCCore.hs
@@ -139,8 +139,7 @@ ghc701_pkgs =
, p "old-time" [1,0,0,6]
, p "pretty" [1,0,1,2]
, p "process" [1,0,1,4]
- , p "random" [1,0,0,3]
- , p "syb" [0,2,2] -- not distributed with ghc-7, but ghc-7 PDEPENDs on it
+-- , p "random" [1,0,0,3] -- will not be shipped starting from ghc-7.2
, p "template-haskell" [2,5,0,0]
-- , p "time" [1,2,0,3] package is upgradeable
, p "unix" [2,4,1,0]
@@ -166,8 +165,8 @@ ghc6123_pkgs =
, p "old-time" [1,0,0,5]
, p "pretty" [1,0,1,1]
, p "process" [1,0,1,3]
- , p "random" [1,0,0,2]
- , p "syb" [0,1,0,2]
+-- , p "random" [1,0,0,2] -- will not be shipped starting from ghc-7.2
+-- , p "syb" [0,1,0,2] -- not distributed with ghc-7
, p "template-haskell" [2,4,0,1]
-- , p "time" [1,1,4] package is upgradeable
, p "unix" [2,4,0,2]
@@ -193,8 +192,8 @@ ghc6122_pkgs =
, p "old-time" [1,0,0,4]
, p "pretty" [1,0,1,1]
, p "process" [1,0,1,2]
- , p "random" [1,0,0,2]
- , p "syb" [0,1,0,2]
+-- , p "random" [1,0,0,2] -- will not be shipped starting from ghc-7.2
+-- , p "syb" [0,1,0,2] -- not distributed with ghc-7
, p "template-haskell" [2,4,0,1]
-- , p "time" [1,1,4] package is upgradeable
, p "unix" [2,4,0,1]
@@ -220,8 +219,8 @@ ghc6121_pkgs =
, p "old-time" [1,0,0,3]
, p "pretty" [1,0,1,1]
, p "process" [1,0,1,2]
- , p "random" [1,0,0,2]
- , p "syb" [0,1,0,2]
+-- , p "random" [1,0,0,2] -- will not be shipped starting from ghc-7.2
+-- , p "syb" [0,1,0,2] -- not distributed with ghc-7
, p "template-haskell" [2,4,0,0]
-- , p "time" [1,1,4] package is upgradeable
, p "unix" [2,4,0,0]
@@ -246,8 +245,8 @@ ghc6104_pkgs =
, p "packedstring" [0,1,0,1]
, p "pretty" [1,0,1,0]
, p "process" [1,0,1,1]
- , p "random" [1,0,0,1]
- , p "syb" [0,1,0,1]
+-- , p "random" [1,0,0,1] -- will not be shipped starting from ghc-7.2
+-- , p "syb" [0,1,0,1] -- not distributed with ghc-7
, p "template-haskell" [2,3,0,1]
-- , p "time" [1,1,4] package is upgradeable
, p "unix" [2,3,2,0]
@@ -271,8 +270,8 @@ ghc6101_pkgs =
, p "packedstring" [0,1,0,1]
, p "pretty" [1,0,1,0]
, p "process" [1,0,1,0]
- , p "random" [1,0,0,1]
- , p "syb" [0,1,0,0]
+-- , p "random" [1,0,0,1] -- will not be shipped starting from ghc-7.2
+-- , p "syb" [0,1,0,0] -- not distributed with ghc-7
, p "template-haskell" [2,3,0,0]
, p "unix" [2,3,1,0]
]
@@ -293,7 +292,7 @@ ghc682_pkgs =
, p "packedstring" [0,1,0,0]
, p "pretty" [1,0,0,0]
, p "process" [1,0,0,0]
- , p "random" [1,0,0,0]
+-- , p "random" [1,0,0,0] -- will not be shipped starting from ghc-7.2
-- , p "readline" [1,0,1,0]
, p "template-haskell" [2,2,0,0]
, p "unix" [2,3,0,0]
diff --git a/Portage/Version.hs b/Portage/Version.hs
index 97583d6..1f26d86 100644
--- a/Portage/Version.hs
+++ b/Portage/Version.hs
@@ -14,6 +14,7 @@ module Portage.Version (
Suffix(..),
fromCabalVersion,
toCabalVersion,
+ is_live
) where
import qualified Distribution.Version as Cabal
@@ -32,6 +33,13 @@ data Version = Version { versionNumber :: [Int] -- [1,42,3] ~= 1.42.3
}
deriving (Eq, Ord, Show, Read)
+-- foo-9999* is treated as live ebuild
+is_live :: Version -> Bool
+is_live v =
+ case versionNumber v of
+ [n] | n >= 9999 && (all (== '9') . show) n -> True
+ _ -> False
+
data Suffix = Alpha Int | Beta Int | Pre Int | RC Int | P Int
deriving (Eq, Ord, Show, Read)
diff --git a/README.rst b/README.rst
index b834cb0..28898aa 100644
--- a/README.rst
+++ b/README.rst
@@ -121,10 +121,10 @@ Features
- the ebuilds differ, or
- the overlay has a more recent version
- 'hackport make-ebuild <path/to/package.cabal>'
- Generates standalone .ebuild file from .cabal spec and stores result in same
- directory.
- Option is useful for packages not-on-hackage and for debug purposes.
+ 'hackport make-ebuild <category> <path/to/package.cabal>'
+ Generates standalone .ebuild file from .cabal spec and stores result
+ to the overlay into <category>/<package>
+ Option is useful for not-on-hackage packages and for debug purposes.
-------
diff --git a/Status.hs b/Status.hs
index a6d1be0..9803bac 100644
--- a/Status.hs
+++ b/Status.hs
@@ -8,7 +8,7 @@ module Status
import AnsiColor
-import qualified Portage.Version as V (versionNumber)
+import qualified Portage.Version as V (is_live)
import Portage.Overlay
import Portage.PackageId
@@ -176,10 +176,10 @@ fromHackageFilter = Map.mapMaybe $ \ sts ->
case st of
HackageOnly _ -> False
_ -> True
- -- treat versionNumber=[9999*] as oldest version not avoid masking hackage releases
- mangle_live_versions v = case V.versionNumber v of
- [n] | n >= 9999 && (all (== '9') . show) n -> v {versionNumber=[-1]}
- _ -> v
+ -- treat live as oldest version not avoid masking hackage releases
+ mangle_live_versions v
+ | V.is_live v = v {versionNumber=[-1]}
+ | otherwise = v
latestVersion = List.maximumBy (compare `on` mangle_live_versions . pkgVersion . ebuildId . fromStatus) sts
in case latestVersion of
HackageOnly _ | not (null inEbuilds) -> Just sts
diff --git a/hackport.cabal b/hackport.cabal
index a6a23ae..7dd180d 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.2.17
+Version: 0.2.18
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin
@@ -122,3 +122,21 @@ Executable hackport-guess-ghc-version
ghc-options: -Wall
other-modules:
Portage.GHCCore
+
+Test-Suite test-resolve-category
+ Type: exitcode-stdio-1.0
+ Default-Language: Haskell98
+ Main-Is: tests/resolveCat.hs
+ Hs-Source-Dirs: ., cabal/cabal, cabal/cabal-install
+ Build-Depends: base >= 3 && < 5,
+ bytestring,
+ containers,
+ directory,
+ extensible-exceptions,
+ filepath,
+ HUnit,
+ mtl,
+ pretty,
+ process,
+ unix,
+ xml
diff --git a/tests/resolveCat.hs b/tests/resolveCat.hs
index 9a69977..553d14d 100644
--- a/tests/resolveCat.hs
+++ b/tests/resolveCat.hs
@@ -1,11 +1,14 @@
-import Test.HUnit
+import Control.Monad (when)
+
+import qualified Distribution.Package as Cabal
import qualified Portage.Overlay as Portage
import qualified Portage.Resolve as Portage
import qualified Portage.PackageId as Portage
import qualified Portage.Host as Portage
-import qualified Distribution.Package as Cabal
+import System.Exit (exitFailure)
+import Test.HUnit
tests = TestList [ TestLabel "resolve cabal" (test_resolveCategory "dev-haskell" "cabal")
, TestLabel "resolve ghc" (test_resolveCategory "dev-lang" "ghc")
@@ -20,4 +23,9 @@ test_resolveCategory cat pkg = TestCase $ do
expected = Just (Portage.PackageName (Portage.Category cat) cabal)
assertEqual ("expecting to find package " ++ pkg) hits expected
-main = runTestTT tests
+something_broke :: Counts -> Bool
+something_broke stats = errors stats + failures stats > 0
+
+main =
+ do stats <- runTestTT tests
+ when (something_broke stats) exitFailure