Permalink
Browse files

adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)

  • Loading branch information...
1 parent 4475bd7 commit 60d04de62b22f2dc54da359bc3fa621ddc39c282 @kolmodin kolmodin committed Nov 29, 2009
Showing with 23 additions and 614 deletions.
  1. +2 −2 Cabal2Ebuild.hs
  2. +0 −586 CabalDistributionVersion.hs
  3. +5 −5 Diff.hs
  4. +4 −3 Main.hs
  5. +7 −12 Merge.hs
  6. +1 −1 Portage/Cabal.hs
  7. +4 −5 hackport.cabal
View
4 Cabal2Ebuild.hs
@@ -111,8 +111,8 @@ defaultDepGHC = OrLaterVersionOf (Version [6,6,1] Nothing [] 0) "dev-lang/gh
-- map the cabal license type to the gentoo license string format
convertLicense :: Cabal.License -> String
-convertLicense Cabal.GPL = "GPL-2" -- almost certainly version 2
-convertLicense Cabal.LGPL = "LGPL-2.1" -- probably version 2.1
+convertLicense (Cabal.GPL mv) = "GPL-" ++ (maybe "2" show mv) -- almost certainly version 2
+convertLicense (Cabal.LGPL mv) = "LGPL-" ++ (maybe "2.1" show mv) -- probably version 2.1
convertLicense Cabal.BSD3 = "BSD"
convertLicense Cabal.BSD4 = "BSD-4"
convertLicense Cabal.PublicDomain = "public-domain"
View
586 CabalDistributionVersion.hs
@@ -1,586 +0,0 @@
------------------------------------------------------------------------------
--- |
--- Module : Distribution.Version
--- Copyright : Isaac Jones, Simon Marlow 2003-2004
--- Duncan Coutts 2008
---
--- Maintainer : cabal-devel@haskell.org
--- Portability : portable
---
--- Exports the 'Version' type along with a parser and pretty printer. A version
--- is something like @\"1.3.3\"@. It also defines the 'VersionRange' data
--- types. Version ranges are like @\">= 1.2 && < 2\"@.
---
--- Backported to not use WildcardVersion for use in Cabal-1.6.
-
-{- Copyright (c) 2003-2004, Isaac Jones
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of Isaac Jones nor the names of other
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
-
-module CabalDistributionVersion (
- -- * Package versions
- Version(..),
-
- -- * Version ranges
- VersionRange(..),
-
- -- ** Constructing
- anyVersion, noVersion,
- thisVersion, notThisVersion,
- laterVersion, earlierVersion,
- orLaterVersion, orEarlierVersion,
- unionVersionRanges, intersectVersionRanges,
- withinVersion,
- betweenVersionsInclusive,
-
- -- ** Inspection
- withinRange,
- isAnyVersion,
- isNoVersion,
- isSpecificVersion,
- simplifyVersionRange,
- foldVersionRange,
-
- -- * Version intervals view
- asVersionIntervals,
- VersionInterval,
- LowerBound(..),
- UpperBound(..),
- Bound(..),
-
- -- ** 'VersionIntervals' abstract type
- -- | The 'VersionIntervals' type and the accompanying functions are exposed
- -- primarily for completeness and testing purposes. In practice
- -- 'asVersionIntervals' is the main function to use to
- -- view a 'VersionRange' as a bunch of 'VersionInterval's.
- --
- VersionIntervals,
- toVersionIntervals,
- fromVersionIntervals,
- withinIntervals,
- versionIntervals,
- mkVersionIntervals,
- unionVersionIntervals,
- intersectVersionIntervals,
-
- ) where
-
--- import Data.Version ( Version(..) )
-
--- import Distribution.Text ( Text(..) )
--- import qualified Distribution.Compat.ReadP as Parse
--- import Distribution.Compat.ReadP ((+++))
--- import qualified Text.PrettyPrint as Disp
--- import Text.PrettyPrint ((<>), (<+>))
--- import qualified Data.Char as Char (isDigit)
-import Control.Exception (assert)
-
-import Distribution.Version
-
--- -----------------------------------------------------------------------------
--- Version ranges
-
--- | The version range @-any@. That is, a version range containing all
--- versions.
---
--- > withinRange v anyVersion = True
---
-anyVersion :: VersionRange
-anyVersion = AnyVersion
-
--- | The empty version range, that is a version range containing no versions.
---
--- This can be constructed using any unsatisfiable version range expression,
--- for example @> 1 && < 1@.
---
--- > withinRange v anyVersion = False
---
-noVersion :: VersionRange
-noVersion = IntersectVersionRanges (LaterVersion v) (EarlierVersion v)
- where v = Version [1] []
-
--- | The version range @== v@
---
--- > withinRange v' (thisVersion v) = v' == v
---
-thisVersion :: Version -> VersionRange
-thisVersion = ThisVersion
-
--- | The version range @< v || > v@
---
--- > withinRange v' (notThisVersion v) = v' /= v
---
--- notThisVersion :: Version -> VersionRange
--- notThisVersion v = UnionVersionRanges (EarlierVersion v) (LaterVersion v)
-
--- | The version range @> v@
---
--- > withinRange v' (laterVersion v) = v' > v
---
-laterVersion :: Version -> VersionRange
-laterVersion = LaterVersion
-
--- | The version range @>= v@
---
--- > withinRange v' (orLaterVersion v) = v' >= v
---
--- orLaterVersion :: Version -> VersionRange
--- orLaterVersion v = UnionVersionRanges (ThisVersion v) (LaterVersion v)
-
--- | The version range @< v@
---
--- > withinRange v' (earlierVersion v) = v' < v
---
-earlierVersion :: Version -> VersionRange
-earlierVersion = EarlierVersion
-
--- | The version range @<= v@
---
--- > withinRange v' (orEarlierVersion v) = v' <= v
---
--- orEarlierVersion :: Version -> VersionRange
--- orEarlierVersion v = UnionVersionRanges (ThisVersion v) (EarlierVersion v)
-
--- | The version range @vr1 || vr2@
---
--- > withinRange v' (unionVersionRanges vr1 vr2)
--- > = withinRange v' vr1 || withinRange v' vr2
---
-unionVersionRanges :: VersionRange -> VersionRange -> VersionRange
-unionVersionRanges = UnionVersionRanges
-
--- | The version range @vr1 && vr2@
---
--- > withinRange v' (intersectVersionRanges vr1 vr2)
--- > = withinRange v' vr1 && withinRange v' vr2
---
-intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange
-intersectVersionRanges = IntersectVersionRanges
-
--- | The version range @== v.*@.
---
--- For example, for version @1.2@, the version range @== 1.2.*@ is the same as
--- @>= 1.2 && < 1.3@
---
--- > withinRange v' (laterVersion v) = v' >= v && v' < upper v
--- > where
--- > upper (Version lower t) = Version (init lower ++ [last lower + 1]) t
---
-withinVersion :: Version -> VersionRange
-withinVersion v = IntersectVersionRanges (orLaterVersion v) (earlierVersion (wildcardUpperBound v))
---withinVersion = WildcardVersion
-
--- | The version range @>= v1 && <= v2@.
---
--- In practice this is not very useful because we normally use inclusive lower
--- bounds and exclusive upper bounds.
---
--- > withinRange v' (laterVersion v) = v' > v
---
--- betweenVersionsInclusive :: Version -> Version -> VersionRange
--- betweenVersionsInclusive v1 v2 =
--- IntersectVersionRanges (orLaterVersion v1) (orEarlierVersion v2)
-
--- | Fold over the syntactic structure of a 'VersionRange'.
---
--- This provides a syntacic view of the expression defining the version range.
--- For a semantic view use 'asVersionIntervals'.
---
-foldVersionRange :: a -> (Version -> a) -> (Version -> a) -> (Version -> a)
- -> (Version -> Version -> a)
- -> (a -> a -> a) -> (a -> a -> a)
- -> VersionRange -> a
-foldVersionRange anyv this later earlier _wildcard union intersect = fold
- where
- fold AnyVersion = anyv
- fold (ThisVersion v) = this v
- fold (LaterVersion v) = later v
- fold (EarlierVersion v) = earlier v
- -- fold (WildcardVersion v) = wildcard v (wildcardUpperBound v)
- fold (UnionVersionRanges v1 v2) = union (fold v1) (fold v2)
- fold (IntersectVersionRanges v1 v2) = intersect (fold v1) (fold v2)
-
--- | Does this version fall within the given range?
---
--- This is the evaluation function for the 'VersionRange' type.
---
-{-
-withinRange :: Version -> VersionRange -> Bool
-withinRange v = foldVersionRange
- True
- (\v' -> versionBranch v == versionBranch v')
- (\v' -> versionBranch v > versionBranch v')
- (\v' -> versionBranch v < versionBranch v')
- (\l u -> versionBranch v >= versionBranch l
- && versionBranch v < versionBranch u)
- (||)
- (&&)
- -}
-
--- | View a 'VersionRange' as a union of intervals.
---
--- This provides a canonical view of the semantics of a 'VersionRange' as
--- opposed to the syntax of the expression used to define it. For the syntactic
--- view use 'foldVersionRange'.
---
--- Each interval is non-empty. The sequence is in increasing order and no
--- intervals overlap or touch. Therefore only the first and last can be
--- unbounded. The sequence can be empty if the range is empty
--- (e.g. a range expression like @< 1 && > 2@).
---
--- Other checks are trivial to implement using this view. For example:
---
--- > isNoVersion vr | [] <- asVersionIntervals vr = True
--- > | otherwise = False
---
--- > isSpecificVersion vr
--- > | [(LowerBound v InclusiveBound
--- > ,UpperBound v' InclusiveBound)] <- asVersionIntervals vr
--- > , v == v' = Just v
--- > | otherwise = Nothing
---
-asVersionIntervals :: VersionRange -> [VersionInterval]
-asVersionIntervals = versionIntervals . toVersionIntervals
-
--- | Does this 'VersionRange' place any restriction on the 'Version' or is it
--- in fact equivalent to 'AnyVersion'.
---
--- Note this is a semantic check, not simply a syntactic check. So for example
--- the following is @True@ (for all @v@).
---
--- > isAnyVersion (EarlierVersion v `UnionVersionRanges` orLaterVersion v)
---
-{-
-isAnyVersion :: VersionRange -> Bool
-isAnyVersion vr = case asVersionIntervals vr of
- [(LowerBound v InclusiveBound, NoUpperBound)] | isVersion0 v -> True
- _ -> False
- -}
-
--- | This is the converse of 'isAnyVersion'. It check if the version range is
--- empty, if there is no possible version that satisfies the version range.
---
--- For example this is @True@ (for all @v@):
---
--- > isNoVersion (EarlierVersion v `IntersectVersionRanges` LaterVersion v)
---
-isNoVersion :: VersionRange -> Bool
-isNoVersion vr = case asVersionIntervals vr of
- [] -> True
- _ -> False
-
--- | Is this version range in fact just a specific version?
---
--- For example the version range @\">= 3 && <= 3\"@ contains only the version
--- @3@.
---
-isSpecificVersion :: VersionRange -> Maybe Version
-isSpecificVersion vr = case asVersionIntervals vr of
- [(LowerBound v InclusiveBound
- ,UpperBound v' InclusiveBound)]
- | v == v' -> Just v
- _ -> Nothing
-
--- | Simplify a 'VersionRange' expression into a canonical form.
---
--- It just uses @fromVersionIntervals . toVersionIntervals@
---
--- It satisfies the following properties:
---
--- > withinRange v (simplifyVersionRange r) = withinRange v r
---
--- > withinRange v r = withinRange v r'
--- > ==> simplifyVersionRange r = simplifyVersionRange r'
---
-simplifyVersionRange :: VersionRange -> VersionRange
-simplifyVersionRange = fromVersionIntervals . toVersionIntervals
-
-----------------------------
--- Wildcard range utilities
---
-
-wildcardUpperBound :: Version -> Version
-wildcardUpperBound (Version lowerBound ts) = (Version upperBound ts)
- where
- upperBound = init lowerBound ++ [last lowerBound + 1]
-
-isWildcardRange :: Version -> Version -> Bool
-isWildcardRange (Version branch1 _) (Version branch2 _) = check branch1 branch2
- where check (n:[]) (m:[]) | n+1 == m = True
- check (n:ns) (m:ms) | n == m = check ns ms
- check _ _ = False
-
-------------------
--- Intervals view
---
-
--- | A complementary representation of a 'VersionRange'. Instead of a boolean
--- version predicate it uses an increasing sequence of non-overlapping,
--- non-empty intervals.
---
--- The key point is that this representation gives a canonical representation
--- for the semantics of 'VersionRange's. This makes it easier to check things
--- like whether a version range is empty, covers all versions, or requires a
--- certain minimum or maximum version. It also makes it easy to check equality
--- or containment. It also makes it easier to identify \'simple\' version
--- predicates for translation into foreign packaging systems that do not
--- support complex version range expressions.
---
-newtype VersionIntervals = VersionIntervals [VersionInterval]
- deriving (Eq, Show)
-
--- | Inspect the list of version intervals.
---
-versionIntervals :: VersionIntervals -> [VersionInterval]
-versionIntervals (VersionIntervals is) = is
-
-type VersionInterval = (LowerBound, UpperBound)
-data LowerBound = LowerBound Version !Bound deriving (Eq, Show)
-data UpperBound = NoUpperBound | UpperBound Version !Bound deriving (Eq, Show)
-data Bound = ExclusiveBound | InclusiveBound deriving (Eq, Show)
-
-minLowerBound :: LowerBound
-minLowerBound = LowerBound (Version [0] []) InclusiveBound
-
-isVersion0 :: Version -> Bool
-isVersion0 (Version [0] _) = True
-isVersion0 _ = False
-
-instance Ord LowerBound where
- LowerBound ver bound <= LowerBound ver' bound' = case compare ver ver' of
- LT -> True
- EQ -> not (bound == ExclusiveBound && bound' == InclusiveBound)
- GT -> False
-
-instance Ord UpperBound where
- _ <= NoUpperBound = True
- NoUpperBound <= UpperBound _ _ = False
- UpperBound ver bound <= UpperBound ver' bound' = case compare ver ver' of
- LT -> True
- EQ -> not (bound == InclusiveBound && bound' == ExclusiveBound)
- GT -> False
-
-invariant :: VersionIntervals -> Bool
-invariant (VersionIntervals intervals) = all validInterval intervals
- && all doesNotTouch' adjacentIntervals
- where
- doesNotTouch' :: (VersionInterval, VersionInterval) -> Bool
- doesNotTouch' ((_,u), (l',_)) = doesNotTouch u l'
-
- adjacentIntervals :: [(VersionInterval, VersionInterval)]
- adjacentIntervals
- | null intervals = []
- | otherwise = zip intervals (tail intervals)
-
-checkInvariant :: VersionIntervals -> VersionIntervals
-checkInvariant is = assert (invariant is) is
-
--- | Directly construct a 'VersionIntervals' from a list of intervals.
---
--- Each interval must be non-empty. The sequence must be in increasing order
--- and no invervals may overlap or touch. If any of these conditions are not
--- satisfied the function returns @Nothing@.
---
-mkVersionIntervals :: [VersionInterval] -> Maybe VersionIntervals
-mkVersionIntervals intervals
- | invariant (VersionIntervals intervals) = Just (VersionIntervals intervals)
- | otherwise = Nothing
-
-validVersion :: Version -> Bool
-validVersion (Version [] _) = False
-validVersion (Version vs _) = all (>=0) vs
-
-validInterval :: (LowerBound, UpperBound) -> Bool
-validInterval i@(l, u) = validLower l && validUpper u && nonEmpty i
- where
- validLower (LowerBound v _) = validVersion v
- validUpper NoUpperBound = True
- validUpper (UpperBound v _) = validVersion v
-
--- Check an interval is non-empty
---
-nonEmpty :: VersionInterval -> Bool
-nonEmpty (_, NoUpperBound ) = True
-nonEmpty (LowerBound l lb, UpperBound u ub) =
- (l < u) || (l == u && lb == InclusiveBound && ub == InclusiveBound)
-
--- Check an upper bound does not intersect, or even touch a lower bound:
---
--- ---| or ---) but not ---] or ---) or ---]
--- |--- (--- (--- [--- [---
---
-doesNotTouch :: UpperBound -> LowerBound -> Bool
-doesNotTouch NoUpperBound _ = False
-doesNotTouch (UpperBound u ub) (LowerBound l lb) =
- u < l
- || (u == l && ub == ExclusiveBound && lb == ExclusiveBound)
-
--- | Check an upper bound does not intersect a lower bound:
---
--- ---| or ---) or ---] or ---) but not ---]
--- |--- (--- (--- [--- [---
---
-doesNotIntersect :: UpperBound -> LowerBound -> Bool
-doesNotIntersect NoUpperBound _ = False
-doesNotIntersect (UpperBound u ub) (LowerBound l lb) =
- u < l
- || (u == l && not (ub == InclusiveBound && lb == InclusiveBound))
-
--- | Test if a version falls within the version intervals.
---
--- It exists mostly for completeness and testing. It satisfies the following
--- properties:
---
--- > withinIntervals v (toVersionIntervals vr) = withinRange v vr
--- > withinIntervals v ivs = withinRange v (fromVersionIntervals ivs)
---
-withinIntervals :: Version -> VersionIntervals -> Bool
-withinIntervals v (VersionIntervals intervals) = any withinInterval intervals
- where
- withinInterval (lowerBound, upperBound) = withinLower lowerBound
- && withinUpper upperBound
- withinLower (LowerBound v' ExclusiveBound) = v' < v
- withinLower (LowerBound v' InclusiveBound) = v' <= v
-
- withinUpper NoUpperBound = True
- withinUpper (UpperBound v' ExclusiveBound) = v' > v
- withinUpper (UpperBound v' InclusiveBound) = v' >= v
-
--- | Convert a 'VersionRange' to a sequence of version intervals.
---
-toVersionIntervals :: VersionRange -> VersionIntervals
-toVersionIntervals = foldVersionRange
- ( chkIvl (minLowerBound, NoUpperBound))
- (\v -> chkIvl (LowerBound v InclusiveBound, UpperBound v InclusiveBound))
- (\v -> chkIvl (LowerBound v ExclusiveBound, NoUpperBound))
- (\v -> if isVersion0 v then VersionIntervals [] else
- chkIvl (minLowerBound, UpperBound v ExclusiveBound))
- (\v v' -> chkIvl (LowerBound v InclusiveBound, UpperBound v' ExclusiveBound))
- unionVersionIntervals
- intersectVersionIntervals
- where
- chkIvl interval = checkInvariant (VersionIntervals [interval])
-
--- | Convert a 'VersionIntervals' value back into a 'VersionRange' expression
--- representing the version intervals.
---
-fromVersionIntervals :: VersionIntervals -> VersionRange
-fromVersionIntervals (VersionIntervals []) = noVersion
-fromVersionIntervals (VersionIntervals intervals) =
- foldr1 UnionVersionRanges [ interval l u | (l, u) <- intervals ]
-
- where
- interval (LowerBound v InclusiveBound)
- (UpperBound v' InclusiveBound) | v == v'
- = ThisVersion v
- interval (LowerBound v InclusiveBound)
- (UpperBound v' ExclusiveBound) | isWildcardRange v v'
- = withinVersion v
- -- = WildcardVersion v
- interval l u = lowerBound l `intersectVersionRanges'` upperBound u
-
- lowerBound (LowerBound v InclusiveBound)
- | isVersion0 v = AnyVersion
- | otherwise = orLaterVersion v
- lowerBound (LowerBound v ExclusiveBound) = LaterVersion v
-
- upperBound NoUpperBound = AnyVersion
- upperBound (UpperBound v InclusiveBound) = orEarlierVersion v
- upperBound (UpperBound v ExclusiveBound) = EarlierVersion v
-
- intersectVersionRanges' vr AnyVersion = vr
- intersectVersionRanges' AnyVersion vr = vr
- intersectVersionRanges' vr vr' = IntersectVersionRanges vr vr'
-
-unionVersionIntervals :: VersionIntervals -> VersionIntervals
- -> VersionIntervals
-unionVersionIntervals (VersionIntervals is0) (VersionIntervals is'0) =
- checkInvariant (VersionIntervals (union is0 is'0))
- where
- union is [] = is
- union [] is' = is'
- union (i:is) (i':is') = case unionInterval i i' of
- Left Nothing -> i : union is (i' :is')
- Left (Just i'') -> union is (i'':is')
- Right Nothing -> i' : union (i :is) is'
- Right (Just i'') -> union (i'':is) is'
-
-unionInterval :: VersionInterval -> VersionInterval
- -> Either (Maybe VersionInterval) (Maybe VersionInterval)
-unionInterval (lower , upper ) (lower', upper')
-
- -- Non-intersecting intervals with the left interval ending first
- | upper `doesNotTouch` lower' = Left Nothing
-
- -- Non-intersecting intervals with the right interval first
- | upper' `doesNotTouch` lower = Right Nothing
-
- -- Complete or partial overlap, with the left interval ending first
- | upper <= upper' = lowerBound `seq`
- Left (Just (lowerBound, upper'))
-
- -- Complete or partial overlap, with the left interval ending first
- | otherwise = lowerBound `seq`
- Right (Just (lowerBound, upper))
- where
- lowerBound = min lower lower'
-
-intersectVersionIntervals :: VersionIntervals -> VersionIntervals
- -> VersionIntervals
-intersectVersionIntervals (VersionIntervals is0) (VersionIntervals is'0) =
- checkInvariant (VersionIntervals (intersect is0 is'0))
- where
- intersect _ [] = []
- intersect [] _ = []
- intersect (i:is) (i':is') = case intersectInterval i i' of
- Left Nothing -> intersect is (i':is')
- Left (Just i'') -> i'' : intersect is (i':is')
- Right Nothing -> intersect (i:is) is'
- Right (Just i'') -> i'' : intersect (i:is) is'
-
-intersectInterval :: VersionInterval -> VersionInterval
- -> Either (Maybe VersionInterval) (Maybe VersionInterval)
-intersectInterval (lower , upper ) (lower', upper')
-
- -- Non-intersecting intervals with the left interval ending first
- | upper `doesNotIntersect` lower' = Left Nothing
-
- -- Non-intersecting intervals with the right interval first
- | upper' `doesNotIntersect` lower = Right Nothing
-
- -- Complete or partial overlap, with the left interval ending first
- | upper <= upper' = lowerBound `seq`
- Left (Just (lowerBound, upper))
-
- -- Complete or partial overlap, with the right interval ending first
- | otherwise = lowerBound `seq`
- Right (Just (lowerBound, upper'))
- where
- lowerBound = max lower lower'
View
10 Diff.hs
@@ -23,7 +23,7 @@ import qualified Data.Version as Cabal
import Distribution.Verbosity
import Distribution.Text(display)
import qualified Distribution.Package as Cabal
-import qualified Distribution.Simple.PackageIndex as Cabal
+import qualified Distribution.Client.PackageIndex as Index
-- import qualified Distribution.InstalledPackageInfo as Cabal
import Distribution.Simple.Utils (equating)
@@ -76,11 +76,11 @@ runDiff verbosity overlayPath dm repo = do
let (subHackage, subOverlay)
= case dm of
ShowPackages pkgs ->
- (concatMap (Cabal.searchByNameSubstring hackageIndex) pkgs
- ,concatMap (Cabal.searchByNameSubstring overlayIndex) pkgs)
+ (concatMap (Index.searchByNameSubstring hackageIndex) pkgs
+ ,concatMap (Index.searchByNameSubstring overlayIndex) pkgs)
_ ->
- (Cabal.allPackages hackageIndex
- ,Cabal.allPackages overlayIndex)
+ (Index.allPackages hackageIndex
+ ,Index.allPackages overlayIndex)
diff subHackage subOverlay dm
data PackageCompareInfo = PackageCompareInfo {
View
7 Main.hs
@@ -22,12 +22,13 @@ import Distribution.Simple.Utils ( die, cabalVersion )
-- import qualified Distribution.PackageDescription as Cabal
import qualified Distribution.PackageDescription.Parse as Cabal
import qualified Distribution.Package as Cabal
-import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Verbosity (Verbosity, normal)
import Distribution.Text (display)
import Distribution.Client.Types
import Distribution.Client.Update
+
+import qualified Distribution.Client.PackageIndex as Index
import qualified Distribution.Client.IndexUtils as Index
import Portage.Overlay as Overlay ( loadLazy, inOverlay )
@@ -108,8 +109,8 @@ listAction flags extraArgs globalFlags = do
let repo = defaultRepo overlayPath
index <- fmap packageIndex (Index.getAvailablePackages verbosity [ repo ])
overlay <- Overlay.loadLazy overlayPath
- let pkgs | null extraArgs = PackageIndex.allPackages index
- | otherwise = concatMap (PackageIndex.searchByNameSubstring index) extraArgs
+ let pkgs | null extraArgs = Index.allPackages index
+ | otherwise = concatMap (Index.searchByNameSubstring index) extraArgs
normalized = map (normalizeCabalPackageId . packageInfoId) pkgs
let decorated = map (\p -> (Overlay.inOverlay overlay p, p)) normalized
mapM_ (putStrLn . pretty) decorated
View
19 Merge.hs
@@ -54,8 +54,6 @@ import Distribution.PackageDescription ( PackageDescription(..)
, buildTools )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
--- import Distribution.PackageDescription.Parse ( showPackageDescription )
-import Distribution.Simple.PackageIndex (PackageIndex)
import Distribution.Text (display)
import System.Directory ( getCurrentDirectory
@@ -73,7 +71,7 @@ import Error as E
import qualified Distribution.Package as Cabal
import qualified Distribution.Version as Cabal
-import Distribution.System (buildOS, buildArch)
+import Distribution.System (buildPlatform)
import Distribution.Verbosity
import Distribution.Simple.Utils
@@ -83,7 +81,7 @@ import Network.HTTP
import Cabal2Ebuild
import Distribution.Client.IndexUtils ( getAvailablePackages )
-import qualified Distribution.Simple.PackageIndex as Index
+import qualified Distribution.Client.PackageIndex as Index
import Distribution.Client.Types
import qualified Portage.PackageId as Portage
@@ -95,11 +93,6 @@ import Cabal2Ebuild
import Debug.Trace
--- This is just a hack to simplify version ranges.
--- Backported from Cabal HEAD to work with Cabal 1.6.
--- Replace this module once it's included in a cabal release.
-import CabalDistributionVersion (simplifyVersionRange)
-
(<->) :: String -> String -> String
a <-> b = a ++ '-':b
@@ -255,11 +248,12 @@ merge verbosity repo serverURI args overlayPath = do
-- (FlagName "small_base", True) -- try to use small base
(FlagName "cocoa", False)
]
- (Nothing :: Maybe (PackageIndex PackageIdentifier))
- buildOS buildArch
+ (\dependency -> True)
+ -- (Nothing :: Maybe (Index.PackageIndex PackageIdentifier))
+ buildPlatform
(CompilerId GHC (Cabal.Version [6,10,4] []))
[] pkgGenericDesc
- pkgDesc = let deps = [ Dependency pn (simplifyVersionRange vr)
+ pkgDesc = let deps = [ Dependency pn (Cabal.simplifyVersionRange vr)
| Dependency pn vr <- buildDepends pkgDesc0
]
in pkgDesc0 { buildDepends = deps }
@@ -274,6 +268,7 @@ merge verbosity repo serverURI args overlayPath = do
<- resolveFullPortageName portage (Cabal.PackageName s)
return $ E.AnyVersionOf (p_cat </> pn)
+ -- calculate extra-libs
extra <- findCLibs verbosity packageNameResolver pkgDesc
debug verbosity ("Selected flags: " ++ show flags)
View
2 Portage/Cabal.hs
@@ -3,7 +3,7 @@ module Portage.Cabal
import qualified Data.Map as Map
-import qualified Distribution.Simple.PackageIndex as Cabal
+import qualified Distribution.Client.PackageIndex as Cabal
import qualified Portage.Overlay as Portage
View
9 hackport.cabal
@@ -1,5 +1,5 @@
Name: hackport
-Version: 0.2.3
+Version: 0.2.4
License: GPL
Author: Henning Günther, Duncan Coutts, Lennart Kolmodin
Maintainer: Gentoo Haskell team <haskell@gentoo.org>
@@ -8,13 +8,13 @@ Synopsis: Hackage and Portage integration tool
Description: A command line tool to manage an overlay of Gentoo ebuilds
that are generated from a hackage repo of Cabal packages.
Build-Type: Simple
-Cabal-Version: >=1.2
+Cabal-Version: >=1.8
Flag split-base
Executable hackport
Main-Is: Main.hs
- Hs-Source-Dirs: ., cabal-install-0.6.2
+ Hs-Source-Dirs: ., cabal-install-0.7.5
Build-Depends:
base >= 2.0 && < 4,
filepath,
@@ -23,7 +23,7 @@ Executable hackport
network,
pretty,
regex-compat,
- Cabal >= 1.6 && < 1.7,
+ Cabal == 1.8.*,
HTTP >= 4000.0.3,
zlib,
tar,
@@ -48,7 +48,6 @@ Executable hackport
AnsiColor
BlingBling
Cabal2Ebuild
- CabalDistributionVersion
CacheFile
Diff
Error

0 comments on commit 60d04de

Please sign in to comment.