Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

port to (bundled) Cabal-1.12

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
commit ac5deac3a5fc35bb8a30727ace55f682864cbc2e 1 parent c350d7a
@trofi trofi authored
View
12 Diff.hs
@@ -23,7 +23,7 @@ import qualified Distribution.Client.PackageIndex as Index
import Distribution.Simple.Utils (equating)
-- cabal-install
-import qualified Distribution.Client.IndexUtils as Index (getAvailablePackages )
+import qualified Distribution.Client.IndexUtils as Index (getSourcePackages)
import qualified Distribution.Client.Types as Cabal
import Distribution.Client.Utils (mergeBy, MergeResult(..))
@@ -61,8 +61,8 @@ showDiffState pkg st = (tabs (display pkg)) ++ " [" ++ (case st of
runDiff :: Verbosity -> FilePath -> DiffMode -> Cabal.Repo -> IO ()
runDiff verbosity overlayPath dm repo = do
-- get package list from hackage
- pkgDB <- Index.getAvailablePackages verbosity [ repo ]
- let (Cabal.AvailablePackageDb hackageIndex _) = pkgDB
+ pkgDB <- Index.getSourcePackages verbosity [ repo ]
+ let (Cabal.SourcePackageDb hackageIndex _) = pkgDB
-- get package list from the overlay
overlay0 <- (Portage.loadLazy overlayPath)
@@ -71,8 +71,8 @@ runDiff verbosity overlayPath dm repo = do
let (subHackage, subOverlay)
= case dm of
ShowPackages pkgs ->
- (concatMap (Index.searchByNameSubstring hackageIndex) pkgs
- ,concatMap (Index.searchByNameSubstring overlayIndex) pkgs)
+ (concatMap (concatMap snd . Index.searchByNameSubstring hackageIndex) pkgs
+ ,concatMap (concatMap snd . Index.searchByNameSubstring overlayIndex) pkgs)
_ ->
(Index.allPackages hackageIndex
,Index.allPackages overlayIndex)
@@ -100,7 +100,7 @@ showPackageCompareInfo pkgCmpInfo =
GT -> ">"
LT -> "<"
-diff :: [Cabal.AvailablePackage]
+diff :: [Cabal.SourcePackage]
-> [Portage.ExistingEbuild]
-> DiffMode
-> IO ()
View
6 DistroMap.hs
@@ -46,7 +46,7 @@ import Data.Maybe ( fromJust )
import Distribution.Verbosity
import Distribution.Text ( display )
-import Distribution.Client.Types ( Repo, AvailablePackageDb(..), AvailablePackage(..) )
+import Distribution.Client.Types ( Repo, SourcePackageDb(..), SourcePackage(..) )
import Distribution.Simple.Utils ( info )
import qualified Data.Version as Cabal
@@ -83,8 +83,8 @@ distroMap verbosity repo portagePath overlayPath args = do
info verbosity ("overlay map: " ++ show (Map.size overlayMap))
info verbosity ("complete map: " ++ show (Map.size completeMap))
- AvailablePackageDb { packageIndex = packageIndex } <-
- CabalInstall.getAvailablePackages verbosity [repo]
+ SourcePackageDb { packageIndex = packageIndex } <-
+ CabalInstall.getSourcePackages verbosity [repo]
let pkgs0 = map (map packageInfoId) (CabalInstall.allPackagesByName packageIndex)
hackagePkgs = [ (Cabal.pkgName (head p), map Cabal.pkgVersion p) | p <- pkgs0 ]
View
4 Main.hs
@@ -102,10 +102,10 @@ listAction flags extraArgs globalFlags = do
let verbosity = fromFlag (listVerbosity flags)
overlayPath <- getOverlayPath verbosity (fromFlag $ globalPathToOverlay globalFlags)
let repo = defaultRepo overlayPath
- index <- fmap packageIndex (Index.getAvailablePackages verbosity [ repo ])
+ index <- fmap packageIndex (Index.getSourcePackages verbosity [ repo ])
overlay <- Overlay.loadLazy overlayPath
let pkgs | null extraArgs = Index.allPackages index
- | otherwise = concatMap (Index.searchByNameSubstring index) extraArgs
+ | otherwise = concatMap (concatMap snd . Index.searchByNameSubstring index) extraArgs
normalized = map (normalizeCabalPackageId . packageInfoId) pkgs
let decorated = map (\p -> (Overlay.inOverlay overlay p, p)) normalized
mapM_ (putStrLn . pretty) decorated
View
14 Merge.hs
@@ -38,7 +38,7 @@ import Distribution.Simple.Utils
import Network.URI
-import Distribution.Client.IndexUtils ( getAvailablePackages )
+import Distribution.Client.IndexUtils ( getSourcePackages )
import Distribution.Client.HttpUtils ( downloadURI )
import qualified Distribution.Client.PackageIndex as Index
import Distribution.Client.Types
@@ -92,7 +92,7 @@ readPackageString args = do
-- | Given a list of available packages, and maybe a preferred version,
-- return the available package with that version. Latest version is chosen
-- if no preference.
-resolveVersion :: [AvailablePackage] -> Maybe Cabal.Version -> Maybe AvailablePackage
+resolveVersion :: [SourcePackage] -> Maybe Cabal.Version -> Maybe SourcePackage
resolveVersion avails Nothing = Just $ maximumBy (comparing packageInfoId) avails
resolveVersion avails (Just ver) = listToMaybe (filter match avails)
where
@@ -119,14 +119,14 @@ merge verbosity repo serverURI args overlayPath = do
overlay <- Overlay.loadLazy overlayPath
-- portage_path <- Host.portage_dir `fmap` Host.getInfo
-- portage <- Overlay.loadLazy portage_path
- index <- fmap packageIndex $ getAvailablePackages verbosity [ repo ]
+ index <- fmap packageIndex $ getSourcePackages verbosity [ repo ]
-- find all packages that maches the user specified package name
availablePkgs <-
- case Index.searchByName index user_pname_str of
- Index.None -> throwEx (PackageNotFound user_pname_str)
- Index.Ambiguous pkgs -> throwEx (ArgumentError ("Ambiguous name: " ++ unwords (map show pkgs)))
- Index.Unambiguous pkg -> return pkg
+ case map snd (Index.searchByName index user_pname_str) of
+ [] -> throwEx (PackageNotFound user_pname_str)
+ [pkg] -> return pkg
+ pkgs -> throwEx (ArgumentError ("Ambiguous name: " ++ unwords (map show pkgs)))
-- select a single package taking into account the user specified version
selectedPkg <-
View
10 hackport.cabal
@@ -20,7 +20,7 @@ Flag split-base
Executable hackport
Main-Is: Main.hs
Default-Language: Haskell98
- Hs-Source-Dirs: ., cabal-install-0.9.5_rc20101226
+ Hs-Source-Dirs: ., cabal/cabal, cabal/cabal-install
Build-Depends:
base >= 2.0 && < 5,
filepath,
@@ -29,15 +29,14 @@ Executable hackport
network,
pretty,
regex-compat,
- Cabal == 1.10.*,
HTTP >= 4000.0.3,
zlib,
tar,
xml>1.3.5,
array,
- -- array is inherited from cabal-install
- -- tar >= 0.3.0.0 && < 0.4
- extensible-exceptions
+ extensible-exceptions,
+ -- cabal depends
+ unix
-- extensions due to hackport
other-extensions:
@@ -100,7 +99,6 @@ Executable hackport-guess-ghc-version
network,
pretty,
regex-compat,
- Cabal > 1.8 && < 1.11,
HTTP >= 4000.0.3,
zlib,
tar,
Please sign in to comment.
Something went wrong with that request. Please try again.