Skip to content
Browse files

Add stub for supporting overlays defined in paludis

  • Loading branch information...
1 parent 87d875b commit 47991e57371b9d488128f9608ad234a12a97b4b0 @kolmodin kolmodin committed Apr 18, 2008
Showing with 63 additions and 48 deletions.
  1. +0 −29 Bash.hs
  2. +1 −1 Cache.hs
  3. +1 −1 Diff.hs
  4. +1 −1 Main.hs
  5. +59 −0 Overlays.hs
  6. +0 −15 Portage.hs
  7. +1 −1 Status.hs
View
29 Bash.hs
@@ -9,35 +9,6 @@ import System.Exit
import Action
import Config
import Error
-import CacheFile
-
-getOverlay :: HPAction String
-getOverlay = do
- overlays <- getOverlays
- case overlays of
- [] -> throwError NoOverlay
- [x] -> return x
- mul -> search mul
- where
- search :: [String] -> HPAction String
- search mul = do
- let loop [] = throwError $ MultipleOverlays mul
- loop (x:xs) = (do
- found <- liftIO (doesFileExist (cacheFile x))
- `sayDebug` ("Checking '"++x++"'...\n",\res->if res then "found.\n" else "not found.")
- if found
- then return x
- else loop xs)
- whisper "There are several overlays in your /etc/make.conf"
- mapM (\x-> whisper (" * " ++x)) mul
- whisper "Looking for one with a HackPort cache..."
- overlay <- loop mul
- whisper ("I choose " ++ overlay)
- whisper "Override my decision with hackport -p /my/overlay"
- return overlay
-
-getOverlays :: HPAction [String]
-getOverlays = runBash "source /etc/make.conf;echo -n $PORTDIR_OVERLAY" >>= (return.words)
getSystemPortdir :: HPAction String
getSystemPortdir = do
View
2 Cache.hs
@@ -1,13 +1,13 @@
module Cache where
import Action
-import Portage
import CacheFile
import Config
import Error
import Index
import P2
import Version
+import Overlays
import Control.Arrow
import Data.Char
View
2 Diff.hs
@@ -11,8 +11,8 @@ import Action
import Cache
import Config (DiffMode(..))
import P2
-import Portage
import Version
+import Overlays
data DiffState a
= OnlyLeft a
View
2 Main.hs
@@ -23,7 +23,7 @@ import GenerateEbuild
import Index
import Status
import Package
-import Portage
+import Overlays
import P2
list :: String -> HPAction ()
View
59 Overlays.hs
@@ -0,0 +1,59 @@
+module Overlays where
+
+import Control.Monad.Error
+import System.Directory
+import Data.Maybe
+import Data.List (nub)
+
+import Bash
+import Action
+import Config
+import Error
+import CacheFile
+
+getOverlayPath :: HPAction String
+getOverlayPath = do
+ cfg <- getCfg
+ case overlayPath cfg of
+ Nothing -> do
+ tree <- getOverlay `sayDebug` ("Guessing overlay...\n",\tree->"Found '"++tree++"'")
+ setOverlayPath $ Just tree
+ return tree
+ Just tree -> return tree
+
+getOverlay :: HPAction String
+getOverlay = do
+ overlays <- getOverlays
+ case overlays of
+ [] -> throwError NoOverlay
+ [x] -> return x
+ mul -> search mul
+ where
+ search :: [String] -> HPAction String
+ search mul = do
+ let loop [] = throwError $ MultipleOverlays mul
+ loop (x:xs) = (do
+ found <- liftIO (doesFileExist (cacheFile x))
+ `sayDebug` ("Checking '"++x++"'...\n",\res->if res then "found.\n" else "not found.")
+ if found
+ then return x
+ else loop xs)
+ whisper "There are several overlays in your /etc/make.conf"
+ mapM (\x-> whisper (" * " ++x)) mul
+ whisper "Looking for one with a HackPort cache..."
+ overlay <- loop mul
+ whisper ("I choose " ++ overlay)
+ whisper "Override my decision with hackport -p /my/overlay"
+ return overlay
+
+portageOverlays :: HPAction [String]
+portageOverlays = runBash "source /etc/make.conf;echo -n $PORTDIR_OVERLAY" >>= (return.words)
+
+paludisOverlays :: HPAction [String]
+paludisOverlays = return []
+
+getOverlays :: HPAction [String]
+getOverlays = do
+ portage <- portageOverlays
+ paludis <- paludisOverlays
+ return (nub (portage ++ paludis))
View
15 Portage.hs
@@ -4,10 +4,6 @@ import System.Directory
import Text.Regex
import Data.Maybe
-import Bash
-import Action
-import Config
-
ebuildVersionRegex :: String -> Regex
ebuildVersionRegex name = mkRegex ("^"++name++"-(.*)\\.ebuild$")
@@ -22,14 +18,3 @@ filterPackages base (x:xs) = do
return (if exists then Just dir else Nothing)
rest <- filterPackages base xs
return (maybe rest (:rest) ak)
-
-getOverlayPath :: HPAction String
-getOverlayPath = do
- cfg <- getCfg
- case overlayPath cfg of
- Nothing -> do
- tree <- getOverlay `sayDebug` ("Guessing overlay from /etc/make.conf...\n",\tree->"Found '"++tree++"'")
- setOverlayPath $ Just tree
- return tree
- Just tree -> return tree
-
View
2 Status.hs
@@ -3,9 +3,9 @@ module Status where
import Action
import AnsiColor
import Bash
-import Portage
import P2
import Utils
+import Overlays
import Control.Arrow
import Control.Monad.State

0 comments on commit 47991e5

Please sign in to comment.
Something went wrong with that request. Please try again.