summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergeiTrofimovich <>2014-05-29 15:09:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-05-29 15:09:00 (GMT)
commitee05b9e4ba9a9d373aceb9325cc65a9ec4dab597 (patch)
treeb81c9715b8451591e29e40ec01f020866c1b5569
parent7d4d9979d692d3acf3b349d7a3e958dd032c9c83 (diff)
version 0.4.10.4.1
-rw-r--r--Cabal2Ebuild.hs2
-rw-r--r--Merge.hs140
-rw-r--r--Merge/Dependencies.hs174
-rw-r--r--Portage/Cabal.hs6
-rw-r--r--Portage/Dependency.hs74
-rw-r--r--Portage/Dependency/Builder.hs17
-rw-r--r--Portage/Dependency/Normalize.hs29
-rw-r--r--Portage/Dependency/Print.hs8
-rw-r--r--Portage/Dependency/Types.hs27
-rw-r--r--Portage/EBuild.hs14
-rw-r--r--Portage/GHCCore.hs33
-rw-r--r--Portage/Tables.hs27
-rw-r--r--hackport.cabal3
-rw-r--r--man/hackport.169
-rw-r--r--tests/normalize_deps.hs4
-rw-r--r--tests/print_deps.hs8
16 files changed, 314 insertions, 321 deletions
diff --git a/Cabal2Ebuild.hs b/Cabal2Ebuild.hs
index e465fc9..16f4b33 100644
--- a/Cabal2Ebuild.hs
+++ b/Cabal2Ebuild.hs
@@ -83,7 +83,7 @@ convertDependency overlay category (Cabal.Dependency pname versionRange)
Just r -> r
Nothing -> Portage.PackageName category (Portage.normalizeCabalPackageName pname)
mk_p :: DRange -> Dependency
- mk_p dr = Atom pn dr (DAttr AnySlot [])
+ mk_p dr = DependAtom (Atom pn dr (DAttr AnySlot []))
p_v v = fromCabalVersion v
convert :: Cabal.VersionRange -> Dependency
diff --git a/Merge.hs b/Merge.hs
index 057af84..edebc3d 100644
--- a/Merge.hs
+++ b/Merge.hs
@@ -3,11 +3,9 @@ module Merge
, mergeGenericPackageDescription
) where
-import Control.Arrow (first, second)
import Control.Monad.Error
import Control.Exception
import qualified Data.ByteString.Lazy.Char8 as BL
-import qualified Data.Map.Strict as M
import Data.Function (on)
import Data.Maybe
import Data.Monoid
@@ -54,6 +52,7 @@ import Error as E
import Network.URI
import qualified Portage.Cabal as Portage
+import qualified Portage.Dependency.Normalize as PN
import qualified Portage.PackageId as Portage
import qualified Portage.Version as Portage
import qualified Portage.Metadata as Portage
@@ -68,6 +67,8 @@ import qualified Merge.Dependencies as Merge
import qualified Util as U
+import Debug.Trace
+
(<.>) :: String -> String -> String
a <.> b = a ++ '.':b
@@ -100,7 +101,7 @@ readPackageString args = do
-- return the available package with that version. Latest version is chosen
-- if no preference.
resolveVersion :: [SourcePackage] -> Maybe Cabal.Version -> Maybe SourcePackage
-resolveVersion avails Nothing = Just $ L.maximumBy (comparing packageInfoId) avails
+resolveVersion avails Nothing = Just $ L.maximumBy (comparing (Cabal.pkgVersion . packageInfoId)) avails
resolveVersion avails (Just ver) = listToMaybe (filter match avails)
where
match avail = ver == Cabal.pkgVersion (packageInfoId avail)
@@ -280,114 +281,27 @@ mergeGenericPackageDescription verbosity overlayPath cat pkgGenericDesc fetch us
leave_only_dynamic_fa :: Cabal.FlagAssignment -> Cabal.FlagAssignment
leave_only_dynamic_fa fa = fa L.\\ common_fa
- optimize_fa_depends :: [([(Cabal.FlagName, Bool)], [Portage.Dependency])] -> [Portage.Dependency]
- optimize_fa_depends deps = Portage.sortDeps
- . simplify
- . map ( (\fdep -> (fdep, []))
- . first leave_only_dynamic_fa) $ deps
-
tdeps :: Merge.EDep
- tdeps = (L.foldl' (\x y -> x `mappend` snd y) mempty deps1){
- Merge.dep = optimize_fa_depends $ map (second Merge.dep) deps1
- , Merge.rdep = optimize_fa_depends $ map (second Merge.rdep) deps1
- }
-
- pop_common_deps :: [(FaDep,[FaDep])] -> (FaDep,[FaDep])
- pop_common_deps xs =
- case pop_from_pairs xs of
- [] -> error "impossible"
- [x] -> x
- r -> pop_common_deps r
- where
- pop_from_pairs :: [(FaDep,[FaDep])] -> [(FaDep,[FaDep])]
- pop_from_pairs [] = []
- pop_from_pairs [y] = [y]
- pop_from_pairs (y1:y2:rest) = y1 `pop_from_pair` y2 : pop_from_pairs rest
-
- pop_from_pair :: (FaDep,[FaDep]) -> (FaDep,[FaDep]) -> (FaDep,[FaDep])
- pop_from_pair ((lfa, ld), lx) ((rfa, rd), rx) = ((fa, d), x)
- where fa = lfa `L.intersect` rfa
- d = ld `L.intersect` rd
- x = (lfa, ld L.\\ d)
- : (rfa, rd L.\\ d)
- : lx ++ rx
-
- simplify :: [(FaDep,[FaDep])] -> [Portage.Dependency]
- simplify fdephs =
- let -- extract common part of the depends
- -- filtering out empty groups
- ((common_fas, common_fdeps), all_fdeps) = second (filter (not . null . snd)) $ pop_common_deps fdephs
- -- apply assumption of 'fdep' on other depends
- -- Handle at least:
- -- 1. redundant-USE cancelation
- -- a? b? c? ( x ) a? ( x ) => a? ( x )
- -- 2. one-USE irrelevance
- -- a? b? c? d? ( x ) a? b? !c? d? ( x ) => a? b? d? ( x )
- -- Ideally this thing should be multipass
- mergeD :: (Cabal.FlagAssignment, Portage.Dependency)
- -> [(Cabal.FlagAssignment, Portage.Dependency)]
- -> [(Cabal.FlagAssignment, Portage.Dependency)]
- mergeD fdep [] = [fdep]
- mergeD lfdep@(lfa, ld) (rfdep@(rfa, rd):rest) =
- case (ld == rd, slfa `S.intersection` srfa) of
- -- [1]
- (True, ifa) | ifa == slfa || ifa == srfa
- -> mergeD (S.toList ifa, ld) rest
- -- [2]
- (True, ifa) | case (S.toList (slfa S.\\ ifa), S.toList (srfa S.\\ ifa)) of
- ([(lfn, lfv)], [(rfn, rfv)])
- -> lfn == rfn && lfv == not rfv
- _ -> False
- -> mergeD (S.toList ifa, ld) rest
- -- otherwise
- _ -> rfdep:mergeD lfdep rest
- where slfa = S.fromList lfa
- srfa = S.fromList rfa
-
- sd :: [(Cabal.FlagAssignment, [Portage.Dependency])]
- sd = M.toList $!
- L.foldl' (\fadeps (fa, new_deps) -> let push_front old_val = Just $!
- case old_val of
- Nothing -> new_deps:[]
- Just ds -> new_deps:ds
- in M.alter push_front fa fadeps
- ) M.empty $ L.foldl' (\fadeps fadep -> fadep `mergeD` fadeps)
- []
- (concatMap (\(fa, deps) -> map (\one_dep -> (fa, one_dep))
- deps)
- all_fdeps)
- -- filter out splitted packages from common group
- ys = filter (not.null.snd) $ map (second (filter (\d -> d `notElem` concatMap snd sd)
- )) all_fdeps
- -- Now we need to find noniteracting use flags if they are then we
- -- don't need to simplify them more, and output as-is
- simplifyMore :: [(Cabal.FlagAssignment,[Portage.Dependency])] -> [Portage.Dependency]
- simplifyMore [] = []
- simplifyMore fdeps =
- let fa_hist = get_fa_hist fdeps
- (u,_) = L.maximumBy (compare `on` snd) fa_hist
- (fdeps_u, fdeps_nu) = hasFlag u `L.partition` fdeps
- in if null fa_hist
- then concatMap (\(a, b) -> liftFlags a b) fdeps
- else liftFlags [u] (simplify $ map (\x -> (x,[])) $ dropFlag u fdeps_u) ++ simplifyMore fdeps_nu
- in liftFlags common_fas common_fdeps ++ simplifyMore (sd ++ ys)
-
- get_fa_hist :: [FaDep] -> [((Cabal.FlagName,Bool),Int)]
- get_fa_hist fdeps = reverse $! L.sortBy (compare `on` snd) $!
- M.toList $!
- go M.empty (concatMap fst fdeps)
- where go hist [] = hist
- go hist (fd:fds) = go (M.insertWith (+) fd 1 hist) fds
- -- drop selected use flag from a list
- dropFlag :: (Cabal.FlagName,Bool) -> [FaDep] -> [FaDep]
- dropFlag f = map (first (filter (f /=)))
- hasFlag :: (Cabal.FlagName,Bool) -> FaDep -> Bool
- hasFlag u = elem u . fst
-
- liftFlags :: Cabal.FlagAssignment -> [Portage.Dependency] -> [Portage.Dependency]
+ (tdeps, _) = L.foldl' (\(a, c) v -> let r = a `mappend` v
+ in if c > (1024 :: Int)
+ then (trace ("RUN NORM:" ++ show (length (show r))) $
+ normalize_ed r, 0)
+ else ( r, c + 1)
+ ) (mempty, 0) $ map set_fa_to_ed deps1
+
+ set_fa_to_ed :: (Cabal.FlagAssignment, Merge.EDep) -> Merge.EDep
+ set_fa_to_ed (fa, ed) = ed { Merge.rdep = liftFlags (leave_only_dynamic_fa fa) $ Merge.rdep ed
+ , Merge.dep = liftFlags (leave_only_dynamic_fa fa) $ Merge.dep ed
+ }
+ normalize_ed :: Merge.EDep -> Merge.EDep
+ normalize_ed ed = ed { Merge.rdep = PN.normalize_depend $ Merge.rdep ed
+ , Merge.dep = PN.normalize_depend $ Merge.dep ed
+ }
+
+ liftFlags :: Cabal.FlagAssignment -> Portage.Dependency -> Portage.Dependency
liftFlags fs e = let k = foldr (\(y,b) x -> Portage.mkUseDependency (b, Portage.Use . cfn_to_iuse . unFlagName $ y) . x)
id fs
- in [k $! Portage.DependAllOf e]
+ in k e
cabal_to_emerge_dep :: Cabal.PackageDescription -> Merge.EDep
cabal_to_emerge_dep cabal_pkg = Merge.resolveDependencies overlay cabal_pkg compilerId ghc_packages merged_cabal_pkg_name
@@ -425,10 +339,10 @@ mergeGenericPackageDescription verbosity overlayPath cat pkgGenericDesc fetch us
p = if Cabal.flagDefault x then "+" else ""
in p ++ cfn_to_iuse fn
- ebuild = (\e -> e { E.depend = Merge.dep tdeps} )
- . (\e -> e { E.depend_extra = Merge.dep_e tdeps } )
- . (\e -> e { E.rdepend = Merge.rdep tdeps} )
- . (\e -> e { E.rdepend_extra = Merge.rdep_e tdeps } )
+ ebuild = (\e -> e { E.depend = Merge.dep tdeps} )
+ . (\e -> e { E.depend_extra = S.toList $ Merge.dep_e tdeps } )
+ . (\e -> e { E.rdepend = Merge.rdep tdeps} )
+ . (\e -> e { E.rdepend_extra = S.toList $ Merge.rdep_e tdeps } )
. (\e -> e { E.src_configure = selected_flags (active_flags, user_specified_fas) } )
. (\e -> e { E.iuse = E.iuse e ++ map to_iuse active_flag_descs })
. ( case requested_cabal_flags of
@@ -513,5 +427,3 @@ mergeEbuild verbosity existing_meta pkgdir ebuild = do
unFlagName :: Cabal.FlagName -> String
unFlagName (Cabal.FlagName fname) = fname
-
-type FaDep = (Cabal.FlagAssignment, [Portage.Dependency])
diff --git a/Merge/Dependencies.hs b/Merge/Dependencies.hs
index 59496e6..b211d09 100644
--- a/Merge/Dependencies.hs
+++ b/Merge/Dependencies.hs
@@ -43,9 +43,6 @@ DEPEND="${RDEPEND} ghc cabal ${DEPS} ${BUILDTOOLS}"
module Merge.Dependencies
( EDep(..)
, resolveDependencies
- , intersection
- , difference
- , null
) where
import Distribution.PackageDescription ( PackageDescription(..)
@@ -59,7 +56,7 @@ import Distribution.PackageDescription ( PackageDescription(..)
, TestSuite(..)
, targetBuildDepends
)
-import Prelude hiding (null)
+
import Data.Maybe ( isJust, isNothing )
import Data.Monoid ( Monoid, mempty, mappend)
import Data.List ( nub )
@@ -70,13 +67,15 @@ import qualified Distribution.Package as Cabal
import qualified Distribution.PackageDescription as Cabal
import qualified Distribution.Version as Cabal
-import Distribution.Compiler
+import qualified Distribution.Compiler as Cabal
import qualified Portage.Cabal as Portage
import qualified Portage.Dependency as Portage
+import qualified Portage.Dependency.Normalize as PN
import qualified Portage.Overlay as Portage
import qualified Portage.PackageId as Portage
import qualified Portage.Use as Portage
+import qualified Portage.Tables as Portage
import qualified Cabal2Ebuild as C2E
import qualified Portage.GHCCore as GHCCore
@@ -86,110 +85,106 @@ import Debug.Trace ( trace )
-- | Dependencies of an ebuild
data EDep = EDep
{
- rdep :: [Portage.Dependency],
- rdep_e :: [String],
- dep :: [Portage.Dependency],
- dep_e :: [String]
+ rdep :: Portage.Dependency,
+ rdep_e :: S.Set String,
+ dep :: Portage.Dependency,
+ dep_e :: S.Set String
}
deriving (Show, Eq)
instance Monoid EDep where
mempty = EDep
{
- rdep = [],
- rdep_e = [],
- dep = [],
- dep_e = []
+ rdep = Portage.empty_dependency,
+ rdep_e = S.empty,
+ dep = Portage.empty_dependency,
+ dep_e = S.empty
}
(EDep rdepA rdep_eA depA dep_eA) `mappend` (EDep rdepB rdep_eB depB dep_eB) = EDep
- { rdep = rdepA ++ rdepB
- , rdep_e = S.toList $ (S.fromList rdep_eA) `S.union` (S.fromList rdep_eB)
- , dep = depA ++ depB
- , dep_e = S.toList $ (S.fromList dep_eA) `S.union` (S.fromList dep_eB)
+ { rdep = Portage.DependAllOf [rdepA, rdepB]
+ , rdep_e = rdep_eA `S.union` rdep_eB
+ , dep = Portage.DependAllOf [depA, depB]
+ , dep_e = dep_eA `S.union` dep_eB
}
-
-intersection :: EDep -> EDep -> EDep
-intersection (EDep a1 a2 a3 a4) (EDep b1 b2 b3 b4) = EDep (L.intersect a1 b1)
- (L.intersect a2 b2)
- (L.intersect a3 b3)
- (L.intersect a4 b4)
-
-difference :: EDep -> EDep -> EDep
-difference (EDep a1 a2 a3 a4) (EDep b1 b2 b3 b4) = EDep (f a1 b1)
- (f a2 b2)
- (f a3 b3)
- (f a4 b4)
- where f a b = L.filter (`L.notElem` b) a
-
-null :: EDep -> Bool
-null e = e == mempty
-
-resolveDependencies :: Portage.Overlay -> PackageDescription -> CompilerId
+resolveDependencies :: Portage.Overlay -> PackageDescription -> Cabal.CompilerId
-> [Cabal.PackageName] -> Cabal.PackageName
-> EDep
-resolveDependencies overlay pkg compiler ghc_package_names merged_cabal_pkg_name =
- edeps
- {
- dep = dep2,
- rdep = rdep2
- -- todo: if rdep includes cabal or ghc, make sure it's the same
- -- version as in dep
- }
+resolveDependencies overlay pkg compiler ghc_package_names merged_cabal_pkg_name = edeps
where
- dep1 = dep edeps
- dep2 = Portage.simplifyUseDeps dep1 (dep1 ++ rdep2)
- rdep1 = rdep edeps
- rdep2 = Portage.simplifyUseDeps rdep1 rdep1
-
-- hasBuildableExes p = any (buildable . buildInfo) . executables $ p
+ treatAsLibrary :: Bool
treatAsLibrary = isJust (Cabal.library pkg)
- haskell_deps
- | treatAsLibrary = map set_build_slot $ map add_profile $ haskellDependencies overlay (buildDepends pkg)
- | otherwise = haskellDependencies overlay (buildDepends pkg)
- test_deps
- | (not . L.null) (testSuites pkg) = testDependencies overlay pkg ghc_package_names merged_cabal_pkg_name
- | otherwise = [] -- tests not enabled
+ -- without slot business
+ raw_haskell_deps :: Portage.Dependency
+ raw_haskell_deps = PN.normalize_depend $ Portage.DependAllOf $ haskellDependencies overlay (buildDepends pkg)
+ haskell_deps :: Portage.Dependency
+ haskell_deps =
+ case () of
+ _ | treatAsLibrary -> Portage.set_build_slot $ add_profile $ raw_haskell_deps
+ _ | otherwise -> raw_haskell_deps
+ test_deps :: Portage.Dependency
+ test_deps = Portage.mkUseDependency (True, Portage.Use "test") $
+ Portage.set_build_slot $
+ Portage.DependAllOf $
+ -- remove depends present in common section
+ filter (\d -> not (Portage.dep_as_broad_as d raw_haskell_deps)) $
+ map PN.normalize_depend $
+ testDependencies overlay pkg ghc_package_names merged_cabal_pkg_name
+ cabal_dep :: Portage.Dependency
cabal_dep = cabalDependency overlay pkg compiler
+ ghc_dep :: Portage.Dependency
ghc_dep = compilerIdToDependency compiler
- extra_libs = findCLibs pkg
+ extra_libs :: Portage.Dependency
+ extra_libs = Portage.DependAllOf $ findCLibs pkg
+ pkg_config_libs :: [Portage.Dependency]
pkg_config_libs = pkgConfigDependencies overlay pkg
- pkg_config_tools = if L.null pkg_config_libs
+ pkg_config_tools :: Portage.Dependency
+ pkg_config_tools = Portage.DependAllOf $ if L.null pkg_config_libs
then []
else [any_c_p "virtual" "pkgconfig"]
- build_tools = buildToolsDependencies pkg ++ pkg_config_tools
+ build_tools :: Portage.Dependency
+ build_tools = Portage.DependAllOf $ pkg_config_tools : buildToolsDependencies pkg
+ edeps :: EDep
edeps
| treatAsLibrary = mempty
{
- dep = cabal_dep
- : build_tools
- ++ test_deps,
- dep_e = [ "${RDEPEND}" ],
- rdep = set_build_slot ghc_dep
- : haskell_deps
- ++ extra_libs
- ++ pkg_config_libs
+ dep = Portage.DependAllOf
+ [ cabal_dep
+ , build_tools
+ , test_deps
+ ],
+ dep_e = S.singleton "${RDEPEND}",
+ rdep = Portage.DependAllOf
+ [ Portage.set_build_slot ghc_dep
+ , haskell_deps
+ , extra_libs
+ , Portage.DependAllOf pkg_config_libs
+ ]
}
| otherwise = mempty
{
- dep = ghc_dep
- : cabal_dep
- : build_tools
- ++ haskell_deps
- ++ test_deps,
- dep_e = [ "${RDEPEND}" ],
- rdep = extra_libs ++ pkg_config_libs
+ dep = Portage.DependAllOf
+ [ ghc_dep
+ , cabal_dep
+ , build_tools
+ , haskell_deps
+ , test_deps
+ ],
+ dep_e = S.singleton "${RDEPEND}",
+ rdep = Portage.DependAllOf
+ [ extra_libs
+ , Portage.DependAllOf pkg_config_libs
+ ]
}
add_profile = Portage.addDepUseFlag (Portage.mkQUse (Portage.Use "profile"))
- set_build_slot = Portage.setSlotDep Portage.AnyBuildTimeSlot
---------------------------------------------------------------
-- Test-suite dependencies
---------------------------------------------------------------
testDependencies :: Portage.Overlay -> PackageDescription -> [Cabal.PackageName] -> Cabal.PackageName -> [Portage.Dependency]
-testDependencies overlay pkg ghc_package_names merged_cabal_pkg_name =
- [Portage.mkUseDependency (True, Portage.Use "test") (Portage.DependAllOf deps)]
+testDependencies overlay pkg ghc_package_names merged_cabal_pkg_name = deps
where cabalDeps = concat $ map targetBuildDepends $ map testBuildInfo (testSuites pkg)
cabalDeps' = fst $ Portage.partition_depends ghc_package_names merged_cabal_pkg_name cabalDeps
deps = C2E.convertDependencies overlay (Portage.Category "dev-haskell") cabalDeps'
@@ -208,8 +203,8 @@ haskellDependencies overlay deps =
-- | Select the most restrictive dependency on Cabal, either the .cabal
-- file's descCabalVersion, or the Cabal GHC shipped with.
-cabalDependency :: Portage.Overlay -> PackageDescription -> CompilerId -> Portage.Dependency
-cabalDependency overlay pkg ~(CompilerId GHC _ghcVersion@(Cabal.Version versionNumbers _)) =
+cabalDependency :: Portage.Overlay -> PackageDescription -> Cabal.CompilerId -> Portage.Dependency
+cabalDependency overlay pkg ~(Cabal.CompilerId Cabal.GHC _ghcVersion@(Cabal.Version versionNumbers _)) =
C2E.convertDependency overlay
(Portage.Category "dev-haskell")
(Cabal.Dependency (Cabal.PackageName "Cabal")
@@ -227,8 +222,8 @@ cabalDependency overlay pkg ~(CompilerId GHC _ghcVersion@(Cabal.Version versionN
-- GHC Dependency
---------------------------------------------------------------
-compilerIdToDependency :: CompilerId -> Portage.Dependency
-compilerIdToDependency ~(CompilerId GHC versionNumbers) =
+compilerIdToDependency :: Cabal.CompilerId -> Portage.Dependency
+compilerIdToDependency ~(Cabal.CompilerId Cabal.GHC versionNumbers) =
at_least_c_p_v "dev-lang" "ghc" (Cabal.versionBranch versionNumbers)
---------------------------------------------------------------
@@ -251,17 +246,19 @@ findCLibs (PackageDescription { library = lib, executables = exes }) =
found = [ p | Just p <- map staticTranslateExtraLib allE ]
any_c_p_s_u :: String -> String -> Portage.SlotDepend -> [Portage.UseFlag] -> Portage.Dependency
-any_c_p_s_u cat pn slot uses = Portage.Atom (Portage.mkPackageName cat pn)
- (Portage.DRange Portage.ZeroB Portage.InfinityB)
- (Portage.DAttr slot uses)
+any_c_p_s_u cat pn slot uses = Portage.DependAtom $
+ Portage.Atom (Portage.mkPackageName cat pn)
+ (Portage.DRange Portage.ZeroB Portage.InfinityB)
+ (Portage.DAttr slot uses)
any_c_p :: String -> String -> Portage.Dependency
any_c_p cat pn = any_c_p_s_u cat pn Portage.AnySlot []
at_least_c_p_v :: String -> String -> [Int] -> Portage.Dependency
-at_least_c_p_v cat pn v = Portage.Atom (Portage.mkPackageName cat pn)
- (Portage.DRange (Portage.NonstrictLB (Portage.Version v Nothing [] 0)) Portage.InfinityB)
- (Portage.DAttr Portage.AnySlot [])
+at_least_c_p_v cat pn v = Portage.DependAtom $
+ Portage.Atom (Portage.mkPackageName cat pn)
+ (Portage.DRange (Portage.NonstrictLB (Portage.Version v Nothing [] 0)) Portage.InfinityB)
+ (Portage.DAttr Portage.AnySlot [])
staticTranslateExtraLib :: String -> Maybe Portage.Dependency
staticTranslateExtraLib lib = lookup lib m
@@ -337,6 +334,9 @@ staticTranslateExtraLib lib = lookup lib m
, ("openal", any_c_p "media-libs" "openal")
, ("iw", any_c_p "net-wireless" "wireless-tools")
, ("attr", any_c_p "sys-apps" "attr")
+ , ("ncurses", any_c_p "sys-libs" "ncurses")
+ , ("panel", any_c_p "sys-libs" "ncurses")
+ , ("nanomsg", any_c_p "dev-libs" "nanomsg")
]
---------------------------------------------------------------
@@ -479,4 +479,8 @@ pkgconfig_table =
,("QtScript", ("dev-qt", "qtscript", Portage.AnySlot))
,("ImageMagick", ("media-gfx", "imagemagick", Portage.AnySlot))
,("MagickWand", ("media-gfx", "imagemagick", Portage.AnySlot))
+ ,("ncurses", ("sys-libs", "ncurses", Portage.AnySlot))
+ ,("ncursesw", ("sys-libs", "ncurses", Portage.AnySlot))
+ ,("panel", ("sys-libs", "ncurses", Portage.AnySlot))
+ ,("panelw", ("sys-libs", "ncurses", Portage.AnySlot))
]
diff --git a/Portage/Cabal.hs b/Portage/Cabal.hs
index 231a732..ec102b0 100644
--- a/Portage/Cabal.hs
+++ b/Portage/Cabal.hs
@@ -10,7 +10,6 @@ import qualified Data.Map as Map
import qualified Distribution.Client.PackageIndex as Cabal
import qualified Distribution.License as Cabal
import qualified Distribution.Package as Cabal
-import qualified Distribution.Version as Cabal
import qualified Distribution.Text as Cabal
import qualified Portage.Overlay as Portage
@@ -42,7 +41,6 @@ convertLicense l =
partition_depends :: [Cabal.PackageName] -> Cabal.PackageName -> [Cabal.Dependency] -> ([Cabal.Dependency], [Cabal.Dependency])
partition_depends ghc_package_names merged_cabal_pkg_name = L.partition (not . is_internal_depend)
- where is_internal_depend (Cabal.Dependency pn vr) = is_itself || is_ghc_package
- where dep = Cabal.Dependency pn (Cabal.simplifyVersionRange vr)
- is_itself = pn == merged_cabal_pkg_name
+ where is_internal_depend (Cabal.Dependency pn _vr) = is_itself || is_ghc_package
+ where is_itself = pn == merged_cabal_pkg_name
is_ghc_package = pn `elem` ghc_package_names
diff --git a/Portage/Dependency.hs b/Portage/Dependency.hs
index b53770f..9c40116 100644
--- a/Portage/Dependency.hs
+++ b/Portage/Dependency.hs
@@ -1,82 +1,10 @@
module Portage.Dependency
(
- simplifyUseDeps
- , sortDeps
-
- -- reexports
- , module Portage.Dependency.Builder
+ module Portage.Dependency.Builder
, module Portage.Dependency.Print
, module Portage.Dependency.Types
) where
-import Data.Function ( on )
-import Data.List ( partition, sortBy )
-import Data.Maybe ( fromJust, mapMaybe )
-
-import Portage.PackageId
-
import Portage.Dependency.Builder
import Portage.Dependency.Print
import Portage.Dependency.Types
-
-getPackage :: Dependency -> Maybe PackageName
-getPackage (DependAllOf _dependency) = Nothing
-getPackage (Atom pn _dr _attrs) = Just pn
-getPackage (DependAnyOf _dependency ) = Nothing
-getPackage (DependIfUse _useFlag _td _fd) = Nothing
-
--- | 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 td fd) =
- case (intersectD fs td, intersectD fs fd) of
- (Nothing, Nothing) -> Nothing
- (Just td', Nothing) -> Just $ DependIfUse u td' empty_dependency
- (Nothing, Just fd') -> Just $ DependIfUse u empty_dependency fd'
- (Just td', Just fd') -> Just $ DependIfUse u td' fd'
-intersectD fs (DependAnyOf ds) =
- let ds' = mapMaybe (intersectD fs) ds
- in if null ds' then Nothing else Just (DependAnyOf ds')
-intersectD fs (DependAllOf ds) =
- let ds' = mapMaybe (intersectD fs) ds
- in if null ds' then Nothing else Just (DependAllOf 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
-
-
-sortDeps :: [Dependency] -> [Dependency]
-sortDeps = sortBy dsort . map deeper
- where
- deeper :: Dependency -> Dependency
- deeper (DependIfUse u1 td fd) = DependIfUse u1 (deeper td) (deeper fd)
- deeper (DependAllOf ds) = DependAllOf $ sortDeps ds
- deeper (DependAnyOf ds) = DependAnyOf $ sortDeps ds
- deeper x = x
- dsort :: Dependency -> Dependency -> Ordering
- dsort (DependIfUse u1 _ _) (DependIfUse u2 _ _) = u1 `compare` u2
- dsort (DependIfUse _ _ _) (DependAnyOf _) = LT
- dsort (DependIfUse _ _ _) (DependAllOf _) = LT
- dsort (DependIfUse _ _ _) _ = GT
- dsort (DependAnyOf _) (DependAnyOf _) = EQ
- dsort (DependAnyOf _) (DependIfUse _ _ _) = GT
- dsort (DependAnyOf _) (DependAllOf _) = LT
- dsort (DependAnyOf _) _ = GT
- dsort (DependAllOf _) (DependAllOf _) = EQ
- dsort (DependAllOf _) (DependIfUse _ _ _) = LT
- dsort (DependAllOf _) (DependAnyOf _) = GT
- dsort _ (DependIfUse _ _ _) = LT
- dsort _ (DependAllOf _) = LT
- dsort _ (DependAnyOf _) = LT
- dsort a b = (compare `on` getPackage) a b
diff --git a/Portage/Dependency/Builder.hs b/Portage/Dependency/Builder.hs
index 7f5a7e0..61bb755 100644
--- a/Portage/Dependency/Builder.hs
+++ b/Portage/Dependency/Builder.hs
@@ -5,6 +5,7 @@ module Portage.Dependency.Builder
, addDepUseFlag
, setSlotDep
, mkUseDependency
+ , overAtom
) where
import Portage.Dependency.Types
@@ -15,19 +16,19 @@ empty_dependency :: Dependency
empty_dependency = DependAllOf []
addDepUseFlag :: UseFlag -> Dependency -> Dependency
-addDepUseFlag n (DependAllOf d) = DependAllOf $ map (addDepUseFlag n) d
-addDepUseFlag n (Atom pn dr (DAttr s u)) = Atom pn dr (DAttr s (n:u))
-addDepUseFlag n (DependAnyOf d) = DependAnyOf $ map (addDepUseFlag n) d
-addDepUseFlag n (DependIfUse u td fd) = DependIfUse u (addDepUseFlag n td) (addDepUseFlag n fd)
+addDepUseFlag n = overAtom (\(Atom pn dr (DAttr s u)) -> Atom pn dr (DAttr s (n:u)))
setSlotDep :: SlotDepend -> Dependency -> Dependency
-setSlotDep n (DependAllOf d) = DependAllOf $ map (setSlotDep n) d
-setSlotDep n (Atom pn dr (DAttr _s u)) = Atom pn dr (DAttr n u)
-setSlotDep n (DependAnyOf d) = DependAnyOf $ map (setSlotDep n) d
-setSlotDep n (DependIfUse u td fd) = DependIfUse u (setSlotDep n td) (setSlotDep n fd)
+setSlotDep n = overAtom (\(Atom pn dr (DAttr _s u)) -> Atom pn dr (DAttr n u))
mkUseDependency :: (Bool, Use) -> Dependency -> Dependency
mkUseDependency (b, u) d =
case b of
True -> DependIfUse u d empty_dependency
False -> DependIfUse u empty_dependency d
+
+overAtom :: (Atom -> Atom) -> Dependency -> Dependency
+overAtom f (DependAllOf d) = DependAllOf $ map (overAtom f) d
+overAtom f (DependAnyOf d) = DependAnyOf $ map (overAtom f) d
+overAtom f (DependIfUse u d1 d2) = DependIfUse u (f `overAtom` d1) (f `overAtom` d2)
+overAtom f (DependAtom a) = DependAtom (f a)
diff --git a/Portage/Dependency/Normalize.hs b/Portage/Dependency/Normalize.hs
index b98c07d..755b429 100644
--- a/Portage/Dependency/Normalize.hs
+++ b/Portage/Dependency/Normalize.hs
@@ -35,6 +35,7 @@ normalization_step = combine_atoms
. stabilize_pass remove_empty
. sort_deps
. combine_use_guards
+ . stabilize_pass flatten
remove_empty :: Dependency -> Dependency
remove_empty d =
@@ -46,7 +47,7 @@ remove_empty d =
DependAllOf deps -> DependAllOf $ filter (not . is_empty_dependency) $ map go deps
DependAnyOf deps -> DependAnyOf $ map go deps
-- no change
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go = remove_empty
-- Ideally 'combine_atoms' should handle those as well
@@ -56,7 +57,7 @@ remove_duplicates d =
DependIfUse use td fd -> DependIfUse use (go td) (go fd)
DependAnyOf deps -> DependAnyOf $ L.nub $ map go deps
DependAllOf deps -> DependAllOf $ L.nub $ map go deps
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go = remove_duplicates
-- TODO: implement flattening AnyOf the same way it's done for AllOf
@@ -73,7 +74,7 @@ flatten d =
([], [dep]) -> dep
([], ndall) -> DependAllOf ndall
(dall, ndall) -> go $ DependAllOf $ (concatMap undall dall) ++ ndall
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go :: Dependency -> Dependency
go = flatten
@@ -93,24 +94,26 @@ combine_atoms d =
DependIfUse use td fd -> DependIfUse use (go td) (go fd)
DependAllOf deps -> DependAllOf $ map go $ find_atom_intersections deps
DependAnyOf deps -> DependAnyOf $ map go $ find_atom_concatenations deps
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go = combine_atoms
find_atom_intersections :: [Dependency] -> [Dependency]
find_atom_intersections = map merge_depends . L.groupBy is_mergeable
where is_mergeable :: Dependency -> Dependency -> Bool
- is_mergeable (Atom lpn _ldrange lattr) (Atom rpn _rdrange rattr) = (lpn, lattr) == (rpn, rattr)
- is_mergeable _ _ = False
+ is_mergeable (DependAtom (Atom lpn _ldrange lattr)) (DependAtom (Atom rpn _rdrange rattr))
+ = (lpn, lattr) == (rpn, rattr)
+ is_mergeable _ _
+ = False
merge_depends :: [Dependency] -> Dependency
merge_depends [x] = x
merge_depends xs = L.foldl1' merge_pair xs
merge_pair :: Dependency -> Dependency -> Dependency
- merge_pair (Atom lp ld la) (Atom rp rd ra)
+ merge_pair (DependAtom (Atom lp ld la)) (DependAtom (Atom rp rd ra))
| lp /= rp = error "merge_pair got different 'PackageName's"
| la /= ra = error "merge_pair got different 'DAttr's"
- | otherwise = Atom lp (mergeDRanges ld rd) la
+ | otherwise = DependAtom (Atom lp (mergeDRanges ld rd) la)
merge_pair l r = error $ unwords ["merge_pair can't merge non-atoms:", show l, show r]
-- TODO
@@ -136,7 +139,7 @@ combine_use_guards d =
DependIfUse use td fd -> pop_common $ DependIfUse use (go td) (go fd)
DependAllOf deps -> DependAllOf $ map go $ find_use_intersections deps
DependAnyOf deps -> DependAnyOf $ map go $ find_use_concatenations deps
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go = combine_use_guards
find_use_intersections :: [Dependency] -> [Dependency]
@@ -202,7 +205,7 @@ propagate_context' ctx d =
False -> Nothing -- haven't managed to optimize anything
] ++ [Just deps] -- unmodified
DependAnyOf deps -> DependAnyOf $ map (go ctx) deps
- Atom _pn _dr _dattr -> case any (dep_as_broad_as d) ctx of
+ DependAtom _ -> case any (dep_as_broad_as d) ctx of
True -> empty_dependency
False -> d
where go c = propagate_context' c
@@ -258,7 +261,7 @@ lift_context d =
DependAnyOf _deps -> case L.delete d new_ctx of
[] -> d
new_ctx' -> propagate_context $ DependAllOf $ d : new_ctx'
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where new_ctx = lift_context' d
-- lift everything that can be shared somewhere else
@@ -271,7 +274,7 @@ lift_context' d =
DependIfUse _use td fd -> d : extract_common_constraints (map lift_context' [td, fd])
DependAllOf deps -> L.nub $ concatMap lift_context' deps
DependAnyOf deps -> extract_common_constraints $ map lift_context' deps
- Atom _pn _dr _dattr -> [d]
+ DependAtom _ -> [d]
-- it extracts common part of dependency comstraints.
-- Some examples:
@@ -332,7 +335,7 @@ sort_deps d =
DependIfUse use td fd -> DependIfUse use (go td) (go fd)
DependAnyOf deps -> DependAnyOf $ L.sort $ map go deps
DependAllOf deps -> DependAllOf $ L.sort $ map go deps
- Atom _pn _dr _dattr -> d
+ DependAtom _ -> d
where go = sort_deps
-- remove various types of redundancy
diff --git a/Portage/Dependency/Print.hs b/Portage/Dependency/Print.hs
index d68aa46..9c9ed02 100644
--- a/Portage/Dependency/Print.hs
+++ b/Portage/Dependency/Print.hs
@@ -52,7 +52,7 @@ valign :: Disp.Doc -> Disp.Doc
valign d = nest 0 d
showDepend :: Dependency -> Disp.Doc
-showDepend (Atom pn range dattr)
+showDepend (DependAtom (Atom pn range dattr))
= case range of
-- any version
DRange ZeroB InfinityB -> DT.disp pn <> dispDAttr dattr
@@ -60,9 +60,9 @@ showDepend (Atom pn range dattr)
DRange lb InfinityB -> dispLBound pn lb <> dispDAttr dattr
-- TODO: handle >=foo-0 special case
-- TODO: handle =foo-x.y.* special case
- DRange lb ub -> showDepend (Atom pn (DRange lb InfinityB) dattr)
+ DRange lb ub -> showDepend (DependAtom (Atom pn (DRange lb InfinityB) dattr))
<> Disp.char ' '
- <> showDepend (Atom pn (DRange ZeroB ub) dattr)
+ <> showDepend (DependAtom (Atom pn (DRange ZeroB ub) dattr))
DExact v -> Disp.char '~' <> DT.disp pn <-> DT.disp v { versionRevision = 0 } <> dispDAttr dattr
showDepend (DependIfUse u td fd) = valign $ vcat [td_doc, fd_doc]
@@ -80,7 +80,7 @@ showDependInAnyOf :: Dependency -> Disp.Doc
showDependInAnyOf d@(DependAllOf _deps) = sparens (showDepend d)
-- both lower and upper bounds are present thus needs 2 atoms
-- TODO: '=foo-x.y.*' will take only one atom, not two
-showDependInAnyOf d@(Atom _pn (DRange lb ub) _dattr)
+showDependInAnyOf d@(DependAtom (Atom _pn (DRange lb ub) _dattr))
| lb /= ZeroB && ub /= InfinityB
= sparens (showDepend d)
-- rest are fine
diff --git a/Portage/Dependency/Types.hs b/Portage/Dependency/Types.hs
index a5c7c23..92555f3 100644
--- a/Portage/Dependency/Types.hs
+++ b/Portage/Dependency/Types.hs
@@ -6,8 +6,11 @@ module Portage.Dependency.Types
, DRange(..)
, DAttr(..)
, Dependency(..)
+ , Atom(..)
, dep_as_broad_as
, is_empty_dependency
+ , dep_is_case_of
+ , range_is_case_of
) where
import Portage.PackageId
@@ -58,6 +61,11 @@ data DRange = DRange LBound UBound
| DExact Version
deriving (Eq, Show, Ord)
+range_is_case_of :: DRange -> DRange -> Bool
+range_is_case_of (DRange llow lup) (DRange rlow rup)
+ | llow >= rlow && lup <= rup = True
+range_is_case_of _ _ = False
+
-- True if 'left' "interval" covers at least as much as the 'right' "interval"
range_as_broad_as :: DRange -> DRange -> Bool
range_as_broad_as (DRange llow lup) (DRange rlow rup)
@@ -67,19 +75,21 @@ range_as_broad_as _ _ = False
data DAttr = DAttr SlotDepend [UseFlag]
deriving (Eq, Show, Ord)
-data Dependency = Atom PackageName DRange DAttr
+data Dependency = DependAtom Atom
| DependIfUse Use Dependency Dependency -- u? ( td ) !u? ( fd )
| DependAnyOf [Dependency]
| DependAllOf [Dependency]
deriving (Eq, Show, Ord)
--- returns 'True' if left constraint is the same (or looser) than right
+data Atom = Atom PackageName DRange DAttr deriving (Eq, Show, Ord)
+
+-- returns 'True' if left constraint is the same as (or looser than) right
dep_as_broad_as :: Dependency -> Dependency -> Bool
dep_as_broad_as l r
-- very broad (not only on atoms) special case
| l == r = True
-- atoms
-dep_as_broad_as (Atom lpn lr lda) (Atom rpn rr rda)
+dep_as_broad_as (DependAtom (Atom lpn lr lda)) (DependAtom (Atom rpn rr rda))
| lpn == rpn && lda == rda = lr `range_as_broad_as` rr
-- AllOf (very common case in context propagation)
dep_as_broad_as d (DependAllOf deps)
@@ -98,5 +108,14 @@ is_empty_dependency d =
-> any is_empty_dependency deps
DependAllOf deps
-> all is_empty_dependency deps
- Atom _pn _dr _dattr
+ DependAtom _
-> False
+
+dep_is_case_of :: Dependency -> Dependency -> Bool
+dep_is_case_of l r
+ -- very broad (not only on atoms) special case
+ | l == r = True
+-- only on atoms
+dep_is_case_of (DependAtom (Atom lpn lr lda)) (DependAtom (Atom rpn rr rda))
+ | lpn == rpn && lda == rda = lr `range_is_case_of` rr
+dep_is_case_of _ _ = False
diff --git a/Portage/EBuild.hs b/Portage/EBuild.hs
index ce85865..36cc6f4 100644
--- a/Portage/EBuild.hs
+++ b/Portage/EBuild.hs
@@ -30,9 +30,9 @@ data EBuild = EBuild {
slot :: String,
keywords :: [String],
iuse :: [String],
- depend :: [Dependency],
+ depend :: Dependency,
depend_extra :: [String],
- rdepend :: [Dependency],
+ rdepend :: Dependency,
rdepend_extra :: [String],
features :: [String],
my_pn :: Maybe String -- ^ Just 'myOldName' if the package name contains upper characters
@@ -59,9 +59,9 @@ ebuildTemplate = EBuild {
slot = "0",
keywords = ["~amd64","~x86"],
iuse = [],
- depend = [],
+ depend = empty_dependency,
depend_extra = [],
- rdepend = [],
+ rdepend = empty_dependency,
rdepend_extra = [],
features = [],
my_pn = Nothing
@@ -174,10 +174,10 @@ tabify_line l = replicate need_tabs '\t' ++ nonsp
tabify :: String -> String
tabify = unlines . map tabify_line . lines
-dep_str :: String -> [String] -> [Dependency] -> DString
-dep_str var extra deps = ss var. sc '='. quote' (ss $ drop_leadings $ unlines extra ++ deps_s). nl
+dep_str :: String -> [String] -> Dependency -> DString
+dep_str var extra dep = ss var. sc '='. quote' (ss $ drop_leadings $ unlines extra ++ deps_s). nl
where indent = 1 * tab_size
- deps_s = tabify (dep2str indent $ PN.normalize_depend $ DependAllOf deps)
+ deps_s = tabify (dep2str indent $ PN.normalize_depend dep)
drop_leadings = dropWhile (== '\t')
quote :: String -> DString
diff --git a/Portage/GHCCore.hs b/Portage/GHCCore.hs
index 104785d..be5bc3e 100644
--- a/Portage/GHCCore.hs
+++ b/Portage/GHCCore.hs
@@ -30,7 +30,7 @@ import Debug.Trace
-- It means that first ghc in this list is a minmum default.
ghcs :: [(CompilerId, PackageIndex)]
ghcs = modern_ghcs ++ ancient_ghcs
- where modern_ghcs = [ghc741, ghc742, ghc761, ghc762]
+ where modern_ghcs = [ghc741, ghc742, ghc761, ghc762, ghc782]
ancient_ghcs = [ghc6104, ghc6121, ghc6122, ghc6123, ghc704]
cabalFromGHC :: [Int] -> Maybe Version
@@ -52,6 +52,7 @@ cabalFromGHC ver = lookup ver table
,([7,4,2], Version [1,14,0] [])
,([7,6,1], Version [1,16,0] [])
,([7,6,2], Version [1,16,0] [])
+ ,([7,8,2], Version [1,18,1,3] [])
]
platform :: Platform
@@ -117,6 +118,9 @@ packageNamesFromPackageIndex pix = nub $ map fst $ allPackagesByName pix
ghc :: [Int] -> CompilerId
ghc nrs = CompilerId GHC (Version nrs [])
+ghc782 :: (CompilerId, PackageIndex)
+ghc782 = (ghc [7,8,2], mkIndex ghc782_pkgs)
+
ghc762 :: (CompilerId, PackageIndex)
ghc762 = (ghc [7,6,2], mkIndex ghc762_pkgs)
@@ -147,6 +151,33 @@ ghc6104 = (ghc [6,10,4], mkIndex ghc6104_pkgs)
-- | Non-upgradeable core packages
-- Source: http://haskell.org/haskellwiki/Libraries_released_with_GHC
+ghc782_pkgs :: [PackageIdentifier]
+ghc782_pkgs =
+ [ p "array" [0,5,0,0]
+ , p "base" [4,7,0,0]
+-- , p "binary" [0,7,1,0] package is upgradeable
+ , 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]
+ , p "old-time" [1,1,0,2]
+ , 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 :: [PackageIdentifier]
ghc762_pkgs =
[ p "array" [0,4,0,1]
diff --git a/Portage/Tables.hs b/Portage/Tables.hs
new file mode 100644
index 0000000..5af0ddd
--- /dev/null
+++ b/Portage/Tables.hs
@@ -0,0 +1,27 @@
+-- | Tables of portage specific convertations
+module Portage.Tables
+ ( set_build_slot
+ ) where
+
+import Portage.Dependency.Builder
+import Portage.Dependency.Types
+import Portage.PackageId
+
+import Data.Monoid
+
+set_build_slot :: Dependency -> Dependency
+set_build_slot =
+ overAtom $ \a@(Atom pn dr (DAttr _ u)) ->
+ case mconcat $ map First $ map (matches a) slottedPkgs of
+ First (Just s) -> Atom pn dr (DAttr s u)
+ First Nothing -> Atom pn dr (DAttr AnyBuildTimeSlot u)
+ where
+ matches (Atom pn _ _) (nm,s)
+ | pn == nm = Just s
+ | otherwise = Nothing
+
+slottedPkgs :: [(PackageName, SlotDepend)]
+slottedPkgs =
+ [ (mkPackageName "dev-haskell" "quickcheck", GivenSlot "2=")
+ , (mkPackageName "dev-haskell" "hdbc", GivenSlot "2=")
+ ]
diff --git a/hackport.cabal b/hackport.cabal
index 7952de9..e6a30ba 100644
--- a/hackport.cabal
+++ b/hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.4
+Version: 0.4.1
License: GPL
License-file: LICENSE
Author: Henning G√ľnther, Duncan Coutts, Lennart Kolmodin
@@ -83,6 +83,7 @@ Executable hackport
Portage.Overlay
Portage.Resolve
Portage.Host
+ Portage.Tables
Merge.Dependencies
Setup
Status
diff --git a/man/hackport.1 b/man/hackport.1
new file mode 100644
index 0000000..545461c
--- /dev/null
+++ b/man/hackport.1
@@ -0,0 +1,69 @@
+.TH HACKPORT "1" "May 2014" "hackport version 0.4" "User Commands"
+.SH NAME
+hackport \- Version 0.4
+.SH SYNOPSIS
+.B hackport
+\fICOMMAND \fR[\fIFLAGS\fR]
+.br
+.B hackport
+[\fIGLOBAL FLAGS\fR]
+.SH DESCRIPTION
+hackport \fB\-\-\fR Create Ebuilds from Cabal packages
+.SS "Global flags:"
+.TP
+\fB\-h\fR \fB\-\-help\fR
+Show help text
+.TP
+\fB\-V\fR \fB\-\-version\fR
+Print version information
+.TP
+\fB\-\-numeric\-version\fR
+Print just the version number
+.TP
+\fB\-p\fR \fB\-\-overlay\-path\fR=\fIPATH\fR Override search path list where .hackport/ lives
+(default list: ['.', paludis\-ovls or emerge\-ovls])
+.HP
+\fB\-\-portage\-path\fR=\fIPATH\fR Override path to your portage tree
+.SS "Commands:"
+.TP
+list
+List packages
+.TP
+make\-ebuild
+Make an ebuild from a .cabal file
+.TP
+status
+Show status
+.TP
+diff
+Run diff
+.TP
+update
+Update the local cache
+.TP
+merge
+Make an ebuild out of hackage package
+.TP
+distromap
+Build a distromap file
+.TP
+help
+Help about commands.
+.PP
+TODO: this is the commandDescription for globalCommand
+.SH EXAMPLES
+\(bu Generate ebuild category/foo for foo.cabal into overlay /path/to/overlay:
+
+ $> hackport -p /path/to/overlay make-ebuild category foo.cabal
+.SH "SEE ALSO"
+The full documentation for
+.B hackport
+is maintained as a Texinfo manual. If the
+.B info
+and
+.B hackport
+programs are properly installed at your site, the command
+.IP
+.B info hackport
+.PP
+should give you access to the complete manual.
diff --git a/tests/normalize_deps.hs b/tests/normalize_deps.hs
index c1d7af2..17df270 100644
--- a/tests/normalize_deps.hs
+++ b/tests/normalize_deps.hs
@@ -36,12 +36,12 @@ d_any :: [P.Dependency] -> P.Dependency
d_any = P.DependAnyOf
d_ge :: P.PackageName -> [Int] -> P.Dependency
-d_ge pn v = P.Atom pn
+d_ge pn v = P.DependAtom $ P.Atom pn
(P.DRange (P.NonstrictLB $ p_v v) P.InfinityB)
def_attr
d_p :: String -> P.Dependency
-d_p pn = P.Atom (P.mkPackageName "c" pn)
+d_p pn = P.DependAtom $ P.Atom (P.mkPackageName "c" pn)
(P.DRange P.ZeroB P.InfinityB)
def_attr
diff --git a/tests/print_deps.hs b/tests/print_deps.hs
index ab3894d..dd21726 100644
--- a/tests/print_deps.hs
+++ b/tests/print_deps.hs
@@ -57,10 +57,10 @@ test_print_mixed = TestCase $ do
}
d_all = P.DependAllOf
d_any = P.DependAnyOf
- d_ge v = P.Atom pn
+ d_ge v = P.DependAtom $ P.Atom pn
(P.DRange (P.NonstrictLB $ p_v v) P.InfinityB)
def_attr
- d_lt v = P.Atom pn
+ d_lt v = P.DependAtom $ P.Atom pn
(P.DRange P.ZeroB (P.StrictUB $ p_v v))
def_attr
deps = [ -- from agda: "mtl ==2.0.* || >=2.1.1 && <2.2"
@@ -99,10 +99,10 @@ test_print_denorm = TestCase $ do
}
d_all = P.DependAllOf
d_any = P.DependAnyOf
- d_ge v = P.Atom pn
+ d_ge v = P.DependAtom $ P.Atom pn
(P.DRange (P.NonstrictLB $ p_v v) P.InfinityB)
def_attr
- d_lt v = P.Atom pn
+ d_lt v = P.DependAtom $ P.Atom pn
(P.DRange P.ZeroB (P.StrictUB $ p_v v))
def_attr
deps = [ -- from agda: "mtl ==2.0.* || >=2.1.1 && <2.2"