Permalink
Browse files

Support cabal's new (_) dependency, with parantheses

  • Loading branch information...
1 parent 769ba1c commit 33ecc291b57528babfe0f3a40ebba6bc2a21e801 @kolmodin kolmodin committed Dec 26, 2010
Showing with 5 additions and 2 deletions.
  1. +2 −1 Cabal2Ebuild.hs
  2. +3 −1 Portage/Dependency.hs
View
@@ -89,7 +89,8 @@ convertDependency category (Cabal.Dependency pname versionRange)
)(\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
- )(\r1 r2 -> r1 ++ r2
+ )(\r1 r2 -> r1 ++ r2 -- ^ @\"_ && _\"@ intersection
+ )(\dp -> [AllOf dp ] -- ^ @\"(_)\"@ parentheses
)
where
flatten :: [Dependency] -> [[Dependency]]
View
@@ -9,7 +9,7 @@ import Distribution.Text ( display, Text(..) )
import Portage.PackageId
import qualified Text.PrettyPrint as Disp
-import Text.PrettyPrint ( (<>) )
+import Text.PrettyPrint ( (<>), hsep )
import Data.Maybe ( fromJust, catMaybes )
import Data.List ( nub, groupBy, partition, sortBy )
@@ -26,6 +26,7 @@ data Dependency = AnyVersionOf PackageName
| DependEither [[Dependency]] -- || ( depend_group1 ..depend_groupN )
| DependIfUse UseFlag Dependency -- use? ( depend )
| ThisMajorOf Version PackageName -- =package-version*
+ | AllOf [Dependency] -- ( package-version* )
deriving (Eq,Show)
instance Text Dependency where
@@ -50,6 +51,7 @@ showDepend (DependIfUse useflag dep@(DependEither _))
showDepend (DependIfUse useflag dep)
= Disp.text useflag <> Disp.text "? " <> Disp.parens (disp dep)
showDepend (ThisMajorOf v p) = Disp.char '=' <> disp p <-> disp v <> Disp.char '*'
+showDepend (AllOf dp ) = Disp.text "( " <> hsep (map showDepend dp) <> Disp.text " )"
{- Here goes code for dependencies simplification -}

0 comments on commit 33ecc29

Please sign in to comment.