Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch to EAPI=5 by default, use subslots for libraries use build-tim…

…e depends

Initial support for subslot depends to lessen inconsistency
damage of haskell library upgrades.

http://dev.gentoo.org/~zmedico/portage/doc/ch05s03s07.html

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
commit b04d5eb706a4eaea370e7445e062bcbc69c3ccf8 1 parent fc9cbe8
@trofi trofi authored
View
15 Cabal2Ebuild.hs
@@ -55,6 +55,7 @@ cabal2ebuild pkg = Portage.ebuildTemplate {
else Cabal.description pkg,
E.homepage = thisHomepage,
E.license = Cabal.license pkg,
+ E.slot = (E.slot E.ebuildTemplate) ++ maybe [] (const "/${PV}") (Cabal.library pkg),
E.my_pn = if any isUpper cabalPkgName then Just cabalPkgName else Nothing,
E.features = E.features E.ebuildTemplate
++ (if hasExe then ["bin"] else [])
@@ -84,13 +85,13 @@ convertDependency overlay category (Cabal.Dependency pname versionRange)
Nothing -> Portage.PackageName category (Portage.normalizeCabalPackageName pname)
convert :: Cabal.VersionRange -> [Dependency]
convert = Cabal.foldVersionRange'
- ( [AnyVersionOf pn []] -- ^ @\"-any\"@ version
- )(\v -> [ThisVersionOf (fromCabalVersion v) pn []] -- ^ @\"== v\"@
- )(\v -> [LaterVersionOf (fromCabalVersion v) pn []] -- ^ @\"> v\"@
- )(\v -> [EarlierVersionOf (fromCabalVersion v) pn []] -- ^ @\"< v\"@
- )(\v -> [OrLaterVersionOf (fromCabalVersion v) pn []] -- ^ @\">= v\"@
- )(\v -> [OrEarlierVersionOf (fromCabalVersion v) pn []] -- ^ @\"<= v\"@
- )(\v _ -> [ThisMajorOf (fromCabalVersion v) pn []] -- ^ @\"== v.*\"@ wildcard. (incl lower, excl upper)
+ ( [AnyVersionOf pn AnySlot []] -- ^ @\"-any\"@ version
+ )(\v -> [ThisVersionOf (fromCabalVersion v) pn AnySlot []] -- ^ @\"== v\"@
+ )(\v -> [LaterVersionOf (fromCabalVersion v) pn AnySlot []] -- ^ @\"> v\"@
+ )(\v -> [EarlierVersionOf (fromCabalVersion v) pn AnySlot []] -- ^ @\"< v\"@
+ )(\v -> [OrLaterVersionOf (fromCabalVersion v) pn AnySlot []] -- ^ @\">= v\"@
+ )(\v -> [OrEarlierVersionOf (fromCabalVersion v) pn AnySlot []] -- ^ @\"<= v\"@
+ )(\v _ -> [ThisMajorOf (fromCabalVersion v) pn AnySlot []] -- ^ @\"== v.*\"@ wildcard. (incl lower, excl upper)
)(\g1 g2 -> [DependEither (g1 ++ g2)] -- ^ @\"_ || _\"@ union
)(\r1 r2 -> r1 ++ r2 -- ^ @\"_ && _\"@ intersection
)(\dp -> [AllOf dp ] -- ^ @\"(_)\"@ parentheses
View
177 Merge/Dependencies.hs
@@ -113,7 +113,7 @@ resolveDependencies overlay pkg mcompiler =
hasBuildableExes p = any (buildable . buildInfo) . executables $ p
treatAsLibrary = (not . hasBuildableExes) pkg || hasLibs pkg
haskell_deps
- | treatAsLibrary = add_profile $ haskellDependencies overlay pkg
+ | treatAsLibrary = map set_build_slot $ map add_profile $ haskellDependencies overlay pkg
| otherwise = haskellDependencies overlay pkg
test_deps
| (not . null) (testSuites pkg) = testDependencies overlay pkg
@@ -130,7 +130,7 @@ resolveDependencies overlay pkg mcompiler =
: build_tools
++ test_deps,
dep_e = [ "${RDEPEND}" ],
- rdep = ghc_dep
+ rdep = set_build_slot ghc_dep
: haskell_deps
++ extra_libs
++ pkg_config
@@ -145,7 +145,8 @@ resolveDependencies overlay pkg mcompiler =
dep_e = [ "${RDEPEND}" ],
rdep = extra_libs ++ pkg_config
}
- add_profile = map (flip Portage.addDepUseFlag (Portage.mkQUse "profile"))
+ add_profile = Portage.addDepUseFlag (Portage.mkQUse "profile")
+ set_build_slot = Portage.setSlotDep Portage.AnyBuildTimeSlot
---------------------------------------------------------------
-- Test-suite dependencies
@@ -198,7 +199,7 @@ cabalDependency overlay pkg (CompilerId GHC ghcVersion@(Cabal.Version versionNum
compilerIdToDependency :: CompilerId -> Portage.Dependency
compilerIdToDependency (CompilerId GHC versionNumbers) =
- Portage.OrLaterVersionOf (Portage.fromCabalVersion versionNumbers) (Portage.mkPackageName "dev-lang" "ghc") []
+ Portage.OrLaterVersionOf (Portage.fromCabalVersion versionNumbers) (Portage.mkPackageName "dev-lang" "ghc") Portage.AnySlot []
---------------------------------------------------------------
-- C Libraries
@@ -207,7 +208,7 @@ compilerIdToDependency (CompilerId GHC versionNumbers) =
findCLibs :: PackageDescription -> [Portage.Dependency]
findCLibs (PackageDescription { library = lib, executables = exes }) =
[ trace ("WARNING: This package depends on a C library we don't know the portage name for: " ++ p ++ ". Check the generated ebuild.")
- (Portage.AnyVersionOf (Portage.mkPackageName "unknown-c-lib" p) [])
+ (Portage.AnyVersionOf (Portage.mkPackageName "unknown-c-lib" p) Portage.AnySlot [])
| p <- notFound
] ++
found
@@ -222,17 +223,17 @@ findCLibs (PackageDescription { library = lib, executables = exes }) =
staticTranslateExtraLib :: String -> Maybe Portage.Dependency
staticTranslateExtraLib lib = lookup lib m
where
- 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 "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") [])
- , ("SDL", Portage.AnyVersionOf (Portage.mkPackageName "media-libs" "libsdl") [])
+ m = [ ("z", Portage.AnyVersionOf (Portage.mkPackageName "sys-libs" "zlib") Portage.AnySlot [])
+ , ("bz2", Portage.AnyVersionOf (Portage.mkPackageName "sys-libs" "bzlib") Portage.AnySlot [])
+ , ("mysqlclient", Portage.LaterVersionOf (Portage.Version [4,0] Nothing [] 0) (Portage.mkPackageName "virtual" "mysql") Portage.AnySlot [])
+ , ("pq", Portage.LaterVersionOf (Portage.Version [7] Nothing [] 0) (Portage.mkPackageName "dev-db" "postgresql-base") Portage.AnySlot [])
+ , ("ev", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "libev") Portage.AnySlot [])
+ , ("expat", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "expat") Portage.AnySlot [])
+ , ("curl", Portage.AnyVersionOf (Portage.mkPackageName "net-misc" "curl") Portage.AnySlot [])
+ , ("xml2", Portage.AnyVersionOf (Portage.mkPackageName "dev-libs" "libxml2") Portage.AnySlot [])
+ , ("mecab", Portage.AnyVersionOf (Portage.mkPackageName "app-text" "mecab") Portage.AnySlot [])
+ , ("zmq", Portage.AnyVersionOf (Portage.mkPackageName "net-libs" "zeromq") Portage.AnySlot [])
+ , ("SDL", Portage.AnyVersionOf (Portage.mkPackageName "media-libs" "libsdl") Portage.AnySlot [])
]
---------------------------------------------------------------
@@ -244,7 +245,7 @@ buildToolsDependencies (PackageDescription { library = lib, executables = exes }
[ case pkg of
Just p -> p
Nothing -> trace ("WARNING: Unknown build tool '" ++ pn ++ "'. Check the generated ebuild.")
- (Portage.AnyVersionOf (Portage.mkPackageName "unknown-build-tool" pn) [])
+ (Portage.AnyVersionOf (Portage.mkPackageName "unknown-build-tool" pn) Portage.AnySlot [])
| Cabal.Dependency (Cabal.PackageName pn) _range <- cabalDeps
, pkg <- return (lookup pn buildToolsTable)
]
@@ -256,13 +257,13 @@ buildToolsDependencies (PackageDescription { library = lib, executables = exes }
buildToolsTable :: [(String, Portage.Dependency)]
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") [])
+ [ ("happy", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "happy") Portage.AnySlot [])
+ , ("alex", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "alex") Portage.AnySlot [])
+ , ("c2hs", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "c2hs") Portage.AnySlot [])
+ , ("cabal-install", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "cabal-install") Portage.AnySlot [])
+ , ("gtk2hsTypeGen", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") Portage.AnySlot [])
+ , ("gtk2hsHookGenerator", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") Portage.AnySlot [])
+ , ("gtk2hsC2hs", Portage.AnyVersionOf (Portage.mkPackageName "dev-haskell" "gtk2hs-buildtools") Portage.AnySlot [])
]
-- tools that are provided by ghc or some other existing program
@@ -287,76 +288,76 @@ resolvePkgConfigs overlay cdeps =
[ case resolvePkgConfig overlay pkg of
Just d -> d
Nothing -> trace ("WARNING: Could not resolve pkg-config: " ++ pn ++ ". Check generated ebuild.")
- (Portage.AnyVersionOf (Portage.mkPackageName "unknown-pkg-config" pn) [])
+ (Portage.AnyVersionOf (Portage.mkPackageName "unknown-pkg-config" pn) Portage.AnySlot [])
| pkg@(Cabal.Dependency (Cabal.PackageName pn) _range) <- cdeps ]
resolvePkgConfig :: Portage.Overlay -> Cabal.Dependency -> Maybe Portage.Dependency
resolvePkgConfig overlay (Cabal.Dependency (Cabal.PackageName pn) _cabalVersion) = do
- (cat,portname) <- lookup pn table
- return $ Portage.AnyVersionOf (Portage.mkPackageName cat portname) []
+ (cat,portname, slot) <- lookup pn table
+ return $ Portage.AnyVersionOf (Portage.mkPackageName cat portname) slot []
-table :: [(String, (String, String))]
+table :: [(String, (String, String, Portage.SlotDepend))]
table =
[
- ("alsa", ("media-libs", "alsa-lib"))
- ,("gconf-2.0", ("gnome-base", "gconf"))
-
- ,("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+:2"))
- ,("gdk-2.0", ("x11-libs", "gtk+:2"))
- ,("gdk-pixbuf-2.0", ("x11-libs", "gtk+:2"))
- ,("gdk-pixbuf-xlib-2.0", ("x11-libs", "gtk+:2"))
- ,("gdk-x11-2.0", ("x11-libs", "gtk+:2"))
- ,("gtk+-unix-print-2.0", ("x11-libs", "gtk+:2"))
- ,("gtk+-x11-2.0", ("x11-libs", "gtk+:2"))
-
- ,("cairo", ("x11-libs", "cairo")) -- need [svg] for dev-haskell/cairo
- ,("cairo-ft", ("x11-libs", "cairo"))
- ,("cairo-ps", ("x11-libs", "cairo"))
- ,("cairo-png", ("x11-libs", "cairo"))
- ,("cairo-pdf", ("x11-libs", "cairo"))
- ,("cairo-svg", ("x11-libs", "cairo"))
- ,("cairo-xlib", ("x11-libs", "cairo"))
- ,("cairo-xlib-xrender", ("x11-libs", "cairo"))
-
- ,("pangocairo", ("x11-libs", "pango"))
- ,("pangoft2", ("x11-libs", "pango"))
- ,("pango", ("x11-libs", "pango"))
- ,("pangoxft", ("x11-libs", "pango"))
- ,("pangox", ("x11-libs", "pango"))
-
- ,("libglade-2.0", ("gnome-base", "libglade"))
- ,("gnome-vfs-2.0", ("gnome-base", "gnome-vfs"))
- ,("gnome-vfs-module-2.0", ("gnome-base", "gnome-vfs"))
- ,("webkit-1.0", ("net-libs","webkit-gtk:2"))
-
- ,("gstreamer-0.10", ("media-libs", "gstreamer"))
- ,("gstreamer-base-0.10", ("media-libs", "gstreamer"))
- ,("gstreamer-check-0.10", ("media-libs", "gstreamer"))
- ,("gstreamer-controller-0.10", ("media-libs", "gstreamer"))
- ,("gstreamer-dataprotocol-0.10", ("media-libs", "gstreamer"))
- ,("gstreamer-net-0.10", ("media-libs", "gstreamer"))
-
- ,("gstreamer-app-0.10", ("media-libs", "gst-plugins-base"))
- ,("gstreamer-audio-0.10", ("media-libs", "gst-plugins-base"))
- ,("gstreamer-video-0.10", ("media-libs", "gst-plugins-base"))
- ,("gstreamer-plugins-base-0.10", ("media-libs", "gst-plugins-base"))
-
- ,("gtksourceview-2.0", ("x11-libs", "gtksourceview:2.0"))
- ,("librsvg-2.0", ("gnome-base","librsvg"))
- ,("vte", ("x11-libs","vte:0"))
- ,("gtkglext-1.0", ("x11-libs","gtkglext"))
-
- ,("curl", ("net-misc", "curl"))
- ,("libxml2", ("dev-libs", "libxml2"))
- ,("libgsasl", ("virtual", "gsasl"))
+ ("alsa", ("media-libs", "alsa-lib", Portage.AnySlot))
+ ,("gconf-2.0", ("gnome-base", "gconf", Portage.AnySlot))
+
+ ,("gio-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gio-unix-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("glib-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gmodule-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gmodule-export-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gmodule-no-export-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gobject-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+ ,("gthread-2.0", ("dev-libs", "glib", Portage.GivenSlot "2"))
+
+ ,("gtk+-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gdk-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gdk-pixbuf-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gdk-pixbuf-xlib-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gdk-x11-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gtk+-unix-print-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+ ,("gtk+-x11-2.0", ("x11-libs", "gtk+", Portage.GivenSlot "2"))
+
+ ,("cairo", ("x11-libs", "cairo", Portage.AnySlot)) -- need [svg] for dev-haskell/cairo
+ ,("cairo-ft", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-ps", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-png", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-pdf", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-svg", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-xlib", ("x11-libs", "cairo", Portage.AnySlot))
+ ,("cairo-xlib-xrender", ("x11-libs", "cairo", Portage.AnySlot))
+
+ ,("pangocairo", ("x11-libs", "pango", Portage.AnySlot))
+ ,("pangoft2", ("x11-libs", "pango", Portage.AnySlot))
+ ,("pango", ("x11-libs", "pango", Portage.AnySlot))
+ ,("pangoxft", ("x11-libs", "pango", Portage.AnySlot))
+ ,("pangox", ("x11-libs", "pango", Portage.AnySlot))
+
+ ,("libglade-2.0", ("gnome-base", "libglade", Portage.AnySlot))
+ ,("gnome-vfs-2.0", ("gnome-base", "gnome-vfs", Portage.AnySlot))
+ ,("gnome-vfs-module-2.0", ("gnome-base", "gnome-vfs", Portage.AnySlot))
+ ,("webkit-1.0", ("net-libs","webkit-gtk", Portage.GivenSlot "2"))
+
+ ,("gstreamer-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+ ,("gstreamer-base-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+ ,("gstreamer-check-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+ ,("gstreamer-controller-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+ ,("gstreamer-dataprotocol-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+ ,("gstreamer-net-0.10", ("media-libs", "gstreamer", Portage.AnySlot))
+
+ ,("gstreamer-app-0.10", ("media-libs", "gst-plugins-base", Portage.AnySlot))
+ ,("gstreamer-audio-0.10", ("media-libs", "gst-plugins-base", Portage.AnySlot))
+ ,("gstreamer-video-0.10", ("media-libs", "gst-plugins-base", Portage.AnySlot))
+ ,("gstreamer-plugins-base-0.10", ("media-libs", "gst-plugins-base", Portage.AnySlot))
+
+ ,("gtksourceview-2.0", ("x11-libs", "gtksourceview", Portage.GivenSlot "2.0"))
+ ,("librsvg-2.0", ("gnome-base","librsvg", Portage.AnySlot))
+ ,("vte", ("x11-libs","vte", Portage.GivenSlot "0"))
+ ,("gtkglext-1.0", ("x11-libs","gtkglext", Portage.AnySlot))
+
+ ,("curl", ("net-misc", "curl", Portage.AnySlot))
+ ,("libxml2", ("dev-libs", "libxml2", Portage.AnySlot))
+ ,("libgsasl", ("virtual", "gsasl", Portage.AnySlot))
]
View
172 Portage/Dependency.hs
@@ -1,8 +1,10 @@
-module Portage.Dependency (
- Dependency(..),
- simplify_deps,
- simplifyUseDeps,
- addDepUseFlag
+module Portage.Dependency
+ ( Dependency(..)
+ , SlotDepend(..)
+ , simplify_deps
+ , simplifyUseDeps
+ , addDepUseFlag
+ , setSlotDep
) where
import Portage.Version
@@ -18,15 +20,25 @@ import Data.Maybe ( fromJust, catMaybes, mapMaybe )
import Data.List ( nub, groupBy, partition, sortBy )
import Data.Ord (comparing)
-data Dependency = AnyVersionOf PackageName [UseFlag]
- | ThisVersionOf Version PackageName [UseFlag] -- ~package-version
- | LaterVersionOf Version PackageName [UseFlag] -- >package-version
- | EarlierVersionOf Version PackageName [UseFlag] -- <package-version
- | OrLaterVersionOf Version PackageName [UseFlag] -- >=package-version
- | OrEarlierVersionOf Version PackageName [UseFlag] -- <=package-version
- | DependEither [Dependency] -- || ( depend1 depend2 ... )
+data SlotDepend = AnySlot -- nothing special
+ | AnyBuildTimeSlot -- ':='
+ | GivenSlot String -- ':slotno'
+ deriving (Eq, Show)
+
+dispSlot :: SlotDepend -> Disp.Doc
+dispSlot AnySlot = Disp.empty
+dispSlot AnyBuildTimeSlot = Disp.text ":="
+dispSlot (GivenSlot slot) = Disp.text (':' : slot)
+
+data Dependency = AnyVersionOf PackageName SlotDepend [UseFlag]
+ | ThisVersionOf Version PackageName SlotDepend [UseFlag] -- ~package-version
+ | LaterVersionOf Version PackageName SlotDepend [UseFlag] -- >package-version
+ | EarlierVersionOf Version PackageName SlotDepend [UseFlag] -- <package-version
+ | OrLaterVersionOf Version PackageName SlotDepend [UseFlag] -- >=package-version
+ | OrEarlierVersionOf Version PackageName SlotDepend [UseFlag] -- <=package-version
+ | ThisMajorOf Version PackageName SlotDepend [UseFlag] -- =package-version*
| DependIfUse UseFlag Dependency -- use? ( depend )
- | ThisMajorOf Version PackageName [UseFlag] -- =package-version*
+ | DependEither [Dependency] -- || ( depend1 depend2 ... )
| AllOf [Dependency] -- ( depend1 depend2 ... )
deriving (Eq,Show)
@@ -37,18 +49,18 @@ instance Text Dependency where
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 (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 (AnyVersionOf p s u) = disp p <> dispSlot s <> dispUses u
+showDepend (ThisVersionOf v p s u) = Disp.char '~' <> disp p <-> disp v { versionRevision = 0 } <> dispSlot s <> dispUses u
+showDepend (LaterVersionOf v p s u) = Disp.char '>' <> disp p <-> disp v <> dispSlot s <> dispUses u
+showDepend (EarlierVersionOf v p s u) = Disp.char '<' <> disp p <-> disp v <> dispSlot s <> dispUses u
+showDepend (OrLaterVersionOf v p s u) = Disp.text ">=" <> disp p <-> disp v <> dispSlot s <> dispUses u
+showDepend (OrEarlierVersionOf v p s u) = Disp.text "<=" <> disp p <-> disp v <> dispSlot s <> dispUses u
+showDepend (ThisMajorOf v p s u) = Disp.char '=' <> disp p <-> disp v <> Disp.char '*' <> dispSlot s <> dispUses u
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 []) = Disp.empty
showDepend (AllOf (d:dp) ) =
Disp.text "( " <> showDepend d <> line
@@ -59,6 +71,7 @@ showDepend (AllOf (d:dp) ) =
{- Here goes code for dependencies simplification -}
simplify_group_table :: PackageName ->
+ SlotDepend ->
[UseFlag] ->
Maybe Version ->
Maybe Version ->
@@ -68,36 +81,37 @@ simplify_group_table :: PackageName ->
-- simplify_group_table p ol l e oe exact
-- 1) trivial cases:
-simplify_group_table p u Nothing Nothing Nothing Nothing Nothing = error $ display p ++ ": unsolvable constraints"
-simplify_group_table p u (Just v) Nothing Nothing Nothing Nothing = [OrLaterVersionOf v p u]
-simplify_group_table p u Nothing (Just v) Nothing Nothing Nothing = [LaterVersionOf v p u]
-simplify_group_table p u Nothing Nothing (Just v) Nothing Nothing = [EarlierVersionOf v p u]
-simplify_group_table p u Nothing Nothing Nothing (Just v) Nothing = [OrEarlierVersionOf v p u]
-simplify_group_table p u Nothing Nothing Nothing Nothing (Just v) = [ThisVersionOf v p u]
+simplify_group_table p _s _u Nothing Nothing Nothing Nothing Nothing = error $ display p ++ ": unsolvable constraints"
+simplify_group_table p s u (Just v) Nothing Nothing Nothing Nothing = [OrLaterVersionOf v p s u]
+simplify_group_table p s u Nothing (Just v) Nothing Nothing Nothing = [LaterVersionOf v p s u]
+simplify_group_table p s u Nothing Nothing (Just v) Nothing Nothing = [EarlierVersionOf v p s u]
+simplify_group_table p s u Nothing Nothing Nothing (Just v) Nothing = [OrEarlierVersionOf v p s u]
+simplify_group_table p s u Nothing Nothing Nothing Nothing (Just v) = [ThisVersionOf v p s u]
-- 2) simplification passes
-simplify_group_table p u (Just (Version v1 _ _ _)) Nothing (Just (Version v2 _ _ _)) Nothing Nothing
+simplify_group_table p s u (Just (Version v1 _ _ _)) Nothing (Just (Version v2 _ _ _)) Nothing Nothing
-- special case: >=a-v.N a<v.(N+1) => =a-v.N*
- | (init v1 == init v2) && (last v2 == last v1 + 1) = [ThisMajorOf (Version v1 Nothing [] 0) p u]
- | otherwise = [OrLaterVersionOf (Version v1 Nothing [] 0) p u, EarlierVersionOf (Version v2 Nothing [] 0) p u]
+ | (init v1 == init v2) && (last v2 == last v1 + 1) = [ThisMajorOf (Version v1 Nothing [] 0) p s u]
+ | otherwise = [OrLaterVersionOf (Version v1 Nothing [] 0) p s u, EarlierVersionOf (Version v2 Nothing [] 0) p s u]
-- TODO: simplify constraints of type: >=a-v1; > a-v2 and such
-- 3) otherwise sink:
-simplify_group_table p u (Just v) l@(_) e@(_) oe@(_) exact@(_) = OrLaterVersionOf v p u: simplify_group_table p u Nothing l e oe exact
-simplify_group_table p u ol@(Nothing) (Just v) e@(_) oe@(_) exact@(_) = LaterVersionOf v p u: simplify_group_table p u ol Nothing e oe exact
-simplify_group_table p u ol@(Nothing) l@(Nothing) (Just v) oe@(_) exact@(_) = EarlierVersionOf v p u: simplify_group_table p u ol l Nothing oe exact
-simplify_group_table p u ol@(Nothing) l@(Nothing) e@(Nothing) (Just v) exact@(_) = OrEarlierVersionOf v p u: simplify_group_table p u ol l e Nothing exact
+simplify_group_table p s u (Just v) l@(_) e@(_) oe@(_) exact@(_) = OrLaterVersionOf v p s u: simplify_group_table p s u Nothing l e oe exact
+simplify_group_table p s u ol@(Nothing) (Just v) e@(_) oe@(_) exact@(_) = LaterVersionOf v p s u: simplify_group_table p s u ol Nothing e oe exact
+simplify_group_table p s u ol@(Nothing) l@(Nothing) (Just v) oe@(_) exact@(_) = EarlierVersionOf v p s u: simplify_group_table p s u ol l Nothing oe exact
+simplify_group_table p s u ol@(Nothing) l@(Nothing) e@(Nothing) (Just v) exact@(_) = OrEarlierVersionOf v p s u: simplify_group_table p s u ol l e Nothing exact
-- already defined earlier
--- simplify_group_table p ol@(Nothing) l@(Nothing) e@(Nothing) oe@(Nothing) (Just v) = OrEarlierVersionOf v p : simplify_group_table p ol l e oe Nothing
+-- simplify_group_table p s u ol@(Nothing) l@(Nothing) e@(Nothing) oe@(Nothing) (Just v) = OrEarlierVersionOf v p : simplify_group_table p ol l e oe Nothing
-- >a-v1 >a-v2 => >a-(max v1 v2)
-- key idea: all constraints are enforcing constraints, so we can't get
-- more, than one interval.
simplify_group :: [Dependency] -> [Dependency]
-simplify_group [dep@(AnyVersionOf _package _u)] = [dep]
-simplify_group [dep@(ThisMajorOf _v _p _u)] = [dep]
+simplify_group [dep@(AnyVersionOf _package _s _u)] = [dep]
+simplify_group [dep@(ThisMajorOf _v _p _s _u)] = [dep]
simplify_group deps = simplify_group_table package
+ slot
uses
min_or_later_v -- >=
min_later_v -- >
@@ -106,6 +120,7 @@ simplify_group deps = simplify_group_table package
exact_this_v -- ==
where
package = fromJust.getPackage $ head deps
+ slot = fromJust.getSlot $ head deps
uses = fromJust.getUses $ head deps
max_earlier_v = safe_minimum $ map earlier_v deps
max_or_earlier_v = safe_minimum $ map or_earlier_v deps
@@ -116,19 +131,19 @@ simplify_group deps = simplify_group_table package
[v] -> Just v
xs -> error $ "too many exact versions:" ++ show xs
--
- earlier_v (EarlierVersionOf v _p _u) = Just v
+ earlier_v (EarlierVersionOf v _p _s _u) = Just v
earlier_v _ = Nothing
- or_earlier_v (OrEarlierVersionOf v _p _u) = Just v
+ or_earlier_v (OrEarlierVersionOf v _p _s _u) = Just v
or_earlier_v _ = Nothing
- later_v (LaterVersionOf v _p _u) = Just v
+ later_v (LaterVersionOf v _p _s _u) = Just v
later_v _ = Nothing
- or_later_v (OrLaterVersionOf v _p _u) = Just v
+ or_later_v (OrLaterVersionOf v _p _s _u) = Just v
or_later_v _ = Nothing
- this_v (ThisVersionOf v _p _u) = Just v
+ this_v (ThisVersionOf v _p _s _u) = Just v
this_v _ = Nothing
--
safe_minimum xs = case catMaybes xs of
@@ -152,44 +167,68 @@ simplify_deps deps = (concatMap (simplify_group.nub) $
--
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
-getPackage (EarlierVersionOf _version package _uses) = Just package
-getPackage (OrLaterVersionOf _version package _uses) = Just package
-getPackage (OrEarlierVersionOf _version package _uses) = Just package
+getPackage (AnyVersionOf package _s _uses) = Just package
+getPackage (ThisVersionOf _version package _s _uses) = Just package
+getPackage (LaterVersionOf _version package _s _uses) = Just package
+getPackage (EarlierVersionOf _version package _s _uses) = Just package
+getPackage (OrLaterVersionOf _version package _s _uses) = Just package
+getPackage (OrEarlierVersionOf _version package _s _uses) = Just package
+getPackage (ThisMajorOf _version package _s _uses) = Just package
getPackage (DependEither _dependency ) = Nothing
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
-getUses (EarlierVersionOf _v _p u) = Just u
-getUses (OrLaterVersionOf _v _p u) = Just u
-getUses (OrEarlierVersionOf _v _p u) = Just u
+getUses (AnyVersionOf _p _s u) = Just u
+getUses (ThisVersionOf _v _p _s u) = Just u
+getUses (LaterVersionOf _v _p _s u) = Just u
+getUses (EarlierVersionOf _v _p _s u) = Just u
+getUses (OrLaterVersionOf _v _p _s u) = Just u
+getUses (OrEarlierVersionOf _v _p _s u) = Just u
+getUses (ThisMajorOf _v _p _s u) = Just u
getUses (DependEither _d) = Nothing
getUses (DependIfUse _u _d) = Nothing
-getUses (ThisMajorOf _v _p u) = Just u
+
+getSlot :: Dependency -> Maybe SlotDepend
+getSlot (AllOf _d) = Nothing
+getSlot (AnyVersionOf _p s _u) = Just s
+getSlot (ThisVersionOf _v _p s _u) = Just s
+getSlot (LaterVersionOf _v _p s _u) = Just s
+getSlot (EarlierVersionOf _v _p s _u) = Just s
+getSlot (OrLaterVersionOf _v _p s _u) = Just s
+getSlot (OrEarlierVersionOf _v _p s _u) = Just s
+getSlot (ThisMajorOf _v _p s _u) = Just s
+getSlot (DependEither _d) = Nothing
+getSlot (DependIfUse _u _d) = Nothing
--
getPackagePart :: Dependency -> PackageName
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)
-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 (flip addDepUseFlag n) d
-addDepUseFlag (DependIfUse u d) n = DependIfUse u (addDepUseFlag d n)
+setSlotDep :: SlotDepend -> Dependency -> Dependency
+setSlotDep n (AllOf d) = AllOf $ map (setSlotDep n) d
+setSlotDep n (AnyVersionOf p _s u) = AnyVersionOf p n u
+setSlotDep n (ThisVersionOf v p _s u) = ThisVersionOf v p n u
+setSlotDep n (LaterVersionOf v p _s u) = LaterVersionOf v p n u
+setSlotDep n (EarlierVersionOf v p _s u) = EarlierVersionOf v p n u
+setSlotDep n (OrLaterVersionOf v p _s u) = OrLaterVersionOf v p n u
+setSlotDep n (OrEarlierVersionOf v p _s u) = OrEarlierVersionOf v p n u
+setSlotDep n (ThisMajorOf v p _s u) = ThisMajorOf v p n u
+setSlotDep n (DependEither d) = DependEither $ map (setSlotDep n) d
+setSlotDep n (DependIfUse u d) = DependIfUse u (setSlotDep n d)
+
+addDepUseFlag :: UseFlag -> Dependency -> Dependency
+addDepUseFlag n (AllOf d) = AllOf $ map (addDepUseFlag n) d
+addDepUseFlag n (AnyVersionOf p s u) = AnyVersionOf p s (n:u)
+addDepUseFlag n (ThisVersionOf v p s u) = ThisVersionOf v p s (n:u)
+addDepUseFlag n (LaterVersionOf v p s u) = LaterVersionOf v p s (n:u)
+addDepUseFlag n (EarlierVersionOf v p s u) = EarlierVersionOf v p s (n:u)
+addDepUseFlag n (OrLaterVersionOf v p s u) = OrLaterVersionOf v p s (n:u)
+addDepUseFlag n (OrEarlierVersionOf v p s u) = OrEarlierVersionOf v p s (n:u)
+addDepUseFlag n (ThisMajorOf v p s u) = ThisMajorOf v p s (n:u)
+addDepUseFlag n (DependEither d) = DependEither $ map (addDepUseFlag n) d
+addDepUseFlag n (DependIfUse u d) = DependIfUse u (addDepUseFlag n d)
--
-- | remove all Use dependencies that overlap with normal dependencies
@@ -216,4 +255,3 @@ intersectD fs x =
isUseDep :: Dependency -> Bool
isUseDep (DependIfUse _ _) = True
isUseDep _ = False
---
View
2  Portage/EBuild.hs
@@ -81,7 +81,7 @@ showEBuild ebuild =
ss "# Distributed under the terms of the GNU General Public License v2". nl.
ss "# $Header: $". nl.
nl.
- ss "EAPI=4". nl.
+ ss "EAPI=5". nl.
nl.
ss ("# ebuild generated by hackport " ++ hackportVersion ebuild). nl.
nl.
Please sign in to comment.
Something went wrong with that request. Please try again.