Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 378 lines (321 sloc) 13.859 kb
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
1 {-# OPTIONS -XPatternGuards #-}
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
2 {- | Merge a package from hackage to an ebuild.
3
4 Merging a library
5 =================
6
7 Compile time:
8 ghc
9 cabal
10 build tools
62a881a4 »
2009-11-24 Update docs about what needs to be merged wrt DEPEND/RDEPEND
11 deps (haskell dependencies)
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
12 extra-libs (c-libs)
13
14 Run time:
62a881a4 »
2009-11-24 Update docs about what needs to be merged wrt DEPEND/RDEPEND
15 ghc
16 deps (haskell dependencies)
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
17 extra-libs (c-libs)
18
62a881a4 »
2009-11-24 Update docs about what needs to be merged wrt DEPEND/RDEPEND
19 RDEPEND="ghc ${DEPS} ${EXTRALIBS}"
20 DEPEND="${RDEPEND} cabal ${BUILDTOOLS}"
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
21
22 Merging an executable
23 =====================
24 Packages with both executable and library must be treated as libraries, as it will impose a stricter DEPEND.
25
26 Compile time:
27 ghc
28 cabal
29 build tools
30 deps
31 extra-libs (c-libs)
32
33 Run time:
34 extra-libs (c-libs)
35
36 RDEPEND="${EXTRALIBS}"
4475bd7c »
2009-11-24 Add deps to docs about building an executable
37 DEPEND="${RDEPEND} ghc cabal ${DEPS} ${BUILDTOOLS}"
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
38
39 -}
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
40 module Merge
41 ( merge ) where
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
42
43 import Control.Monad.Error
8135c0c7 »
2008-10-01 Implement fetching and creation of digests for new ebuilds
44 import Control.Exception
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
45 import Data.Maybe
46 import Data.List
47 import Distribution.Package
48 import Distribution.Compiler (CompilerId(..), CompilerFlavor(GHC))
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
49 import Distribution.PackageDescription ( PackageDescription(..)
34e78423 »
2009-03-12 Set --flags=-cocoa when finalizing a PackageDescription
50 , FlagName(..)
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
51 , libBuildInfo
52 , buildInfo
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
53 , buildable
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
54 , extraLibs
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
55 , buildTools
56 , hasLibs )
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
57 import Distribution.PackageDescription.Configuration
58 ( finalizePackageDescription )
59 import Distribution.Text (display)
60
f3093658 »
2009-02-19 Reimplement 'hackport merge'
61 import System.Directory ( getCurrentDirectory
62 , setCurrentDirectory
63 , createDirectoryIfMissing
64 )
8135c0c7 »
2008-10-01 Implement fetching and creation of digests for new ebuilds
65 import System.Cmd (system)
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
66 import System.FilePath ((</>))
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
67
68 import qualified Cabal2Ebuild as E
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
69 import Cabal2Ebuild
f3093658 »
2009-02-19 Reimplement 'hackport merge'
70 import Error as E
71
72 import qualified Distribution.Package as Cabal
73 import qualified Distribution.Version as Cabal
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
74
60d04de6 »
2009-11-29 adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)
75 import Distribution.System (buildPlatform)
a1730ad8 »
2008-08-31 Switch to using Cabal's CLI API
76 import Distribution.Verbosity
77 import Distribution.Simple.Utils
78
79 import Network.URI
80
f3093658 »
2009-02-19 Reimplement 'hackport merge'
81 import Distribution.Client.IndexUtils ( getAvailablePackages )
4b2a1d28 »
2010-05-11 Upgrade bundled cabal-install from 0.8.0 to 0.8.2
82 import Distribution.Client.HttpUtils ( downloadURI )
60d04de6 »
2009-11-29 adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)
83 import qualified Distribution.Client.PackageIndex as Index
f3093658 »
2009-02-19 Reimplement 'hackport merge'
84 import Distribution.Client.Types
85
86 import qualified Portage.PackageId as Portage
87 import qualified Portage.Version as Portage
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
88 import qualified Portage.Dependency as Portage
27f08f37 »
2009-03-23 Move host information code into Portage.Host
89 import qualified Portage.Host as Host
f3093658 »
2009-02-19 Reimplement 'hackport merge'
90 import qualified Portage.Overlay as Overlay
033ff9b1 »
2009-12-16 move package resolving functions to Portage.Resolve
91 import qualified Portage.Resolve as Portage
f3093658 »
2009-02-19 Reimplement 'hackport merge'
92
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
93 import Debug.Trace ( trace )
94
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
95 (<->) :: String -> String -> String
f56d5083 »
2008-10-02 Cleanup in merge
96 a <-> b = a ++ '-':b
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
97
98 (<.>) :: String -> String -> String
f56d5083 »
2008-10-02 Cleanup in merge
99 a <.> b = a ++ '.':b
100
22e0fbc9 »
2009-02-08 Add requests for 'hackport merge'
101 {-
102 Requested features:
c2b83676 »
2009-03-01 Update TODOs
103 * Copy the old keywords and ~arch them
22e0fbc9 »
2009-02-08 Add requests for 'hackport merge'
104 * Add files to darcs?
105 * Print diff with the next latest version?
96a64770 »
2009-02-19 Add some todos
106 BUGS:
107 * Dependencies are always expected to be in dev-haskell
22e0fbc9 »
2009-02-08 Add requests for 'hackport merge'
108 -}
109
f3093658 »
2009-02-19 Reimplement 'hackport merge'
110 readPackageString :: [String]
111 -> Either HackPortError ( Maybe Portage.Category
112 , Cabal.PackageName
113 , Maybe Portage.Version
114 )
115 readPackageString args = do
116 packageString <-
117 case args of
7ab62d59 »
2009-02-19 Tried hlint, nice.
118 [] -> Left (ArgumentError "Need an argument, [category/]package[-version]")
f3093658 »
2009-02-19 Reimplement 'hackport merge'
119 [pkg] -> return pkg
120 _ -> Left (ArgumentError ("Too many arguments: " ++ unwords args))
121 case Portage.parseFriendlyPackage packageString of
122 Just v@(_,_,Nothing) -> return v
123 -- we only allow versions we can convert into cabal versions
124 Just v@(_,_,Just (Portage.Version _ Nothing [] 0)) -> return v
125 _ -> Left (ArgumentError ("Could not parse [category/]package[-version]: " ++ packageString))
126
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
127
128
f3093658 »
2009-02-19 Reimplement 'hackport merge'
129 -- | Given a list of available packages, and maybe a preferred version,
130 -- return the available package with that version. Latest version is chosen
131 -- if no preference.
132 resolveVersion :: [AvailablePackage] -> Maybe Cabal.Version -> Maybe AvailablePackage
133 resolveVersion avails Nothing = Just $ maximumBy (comparing packageInfoId) avails
134 resolveVersion avails (Just ver) = listToMaybe (filter match avails)
135 where
7ab62d59 »
2009-02-19 Tried hlint, nice.
136 match avail = ver == pkgVersion (packageInfoId avail)
f3093658 »
2009-02-19 Reimplement 'hackport merge'
137
df59c138 »
2009-03-29 resurrected support of global '-p' (aka --overlay-path' flag
138 merge :: Verbosity -> Repo -> URI -> [String] -> FilePath -> IO ()
139 merge verbosity repo serverURI args overlayPath = do
f3093658 »
2009-02-19 Reimplement 'hackport merge'
140 (m_category, user_pName, m_version) <-
141 case readPackageString args of
142 Left err -> throwEx err
143 Right (c,p,m_v) ->
144 case m_v of
145 Nothing -> return (c,p,Nothing)
146 Just v -> case Portage.toCabalVersion v of
147 Nothing -> throwEx (ArgumentError "illegal version")
148 Just ver -> return (c,p,Just ver)
149
150 debug verbosity $ "Category: " ++ show m_category
151 debug verbosity $ "Package: " ++ show user_pName
152 debug verbosity $ "Version: " ++ show m_version
153
154 let (Cabal.PackageName user_pname_str) = user_pName
155
156 overlay <- Overlay.loadLazy overlayPath
27f08f37 »
2009-03-23 Move host information code into Portage.Host
157 portage_path <- Host.portage_dir `fmap` Host.getInfo
e203713b »
2009-03-23 added support for nonstandard PORTDIR(emerge) location::gentoo(paludis)
158 portage <- Overlay.loadLazy portage_path
f3093658 »
2009-02-19 Reimplement 'hackport merge'
159 index <- fmap packageIndex $ getAvailablePackages verbosity [ repo ]
160
161 -- find all packages that maches the user specified package name
162 availablePkgs <-
163 case Index.searchByName index user_pname_str of
164 Index.None -> throwEx (PackageNotFound user_pname_str)
165 Index.Ambiguous pkgs -> throwEx (ArgumentError ("Ambiguous name: " ++ unwords (map show pkgs)))
166 Index.Unambiguous pkg -> return pkg
167
168 -- select a single package taking into account the user specified version
169 selectedPkg <-
170 case resolveVersion availablePkgs m_version of
171 Nothing -> do
172 putStrLn "No such version for that package, available versions:"
7ab62d59 »
2009-02-19 Tried hlint, nice.
173 forM_ availablePkgs $ \ avail ->
f3093658 »
2009-02-19 Reimplement 'hackport merge'
174 putStrLn (display . packageInfoId $ avail)
175 throwEx (ArgumentError "no such version for that package")
176 Just avail -> return avail
177
178 -- print some info
179 info verbosity "Selecting package:"
180 forM_ availablePkgs $ \ avail -> do
181 let match_text | packageInfoId avail == packageInfoId selectedPkg = "* "
182 | otherwise = "- "
183 info verbosity $ match_text ++ (display . packageInfoId $ avail)
184
185 let cabal_pkgId = packageInfoId selectedPkg
186 norm_pkgId = Portage.normalizeCabalPackageId cabal_pkgId
187 norm_pkgName = packageName norm_pkgId
033ff9b1 »
2009-12-16 move package resolving functions to Portage.Resolve
188 cat <- Portage.resolveCategory verbosity overlay norm_pkgName
f3093658 »
2009-02-19 Reimplement 'hackport merge'
189
190 let pkgGenericDesc = packageDescription selectedPkg
191 Right (pkgDesc0, flags) =
192 finalizePackageDescription
193 [ -- XXX: common things we should enable/disable?
194 -- (FlagName "small_base", True) -- try to use small base
34e78423 »
2009-03-12 Set --flags=-cocoa when finalizing a PackageDescription
195 (FlagName "cocoa", False)
f3093658 »
2009-02-19 Reimplement 'hackport merge'
196 ]
2775da02 »
2010-01-24 -Wall cleanups
197 (\dep -> trace ("accepting dep(?): " ++ display dep) True)
60d04de6 »
2009-11-29 adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)
198 -- (Nothing :: Maybe (Index.PackageIndex PackageIdentifier))
199 buildPlatform
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
200 (CompilerId GHC (Cabal.Version [6,10,4] []))
f3093658 »
2009-02-19 Reimplement 'hackport merge'
201 [] pkgGenericDesc
60d04de6 »
2009-11-29 adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)
202 pkgDesc = let deps = [ Dependency pn (Cabal.simplifyVersionRange vr)
f3093658 »
2009-02-19 Reimplement 'hackport merge'
203 | Dependency pn vr <- buildDepends pkgDesc0
204 ]
205 in pkgDesc0 { buildDepends = deps }
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
206
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
207 hasBuildableExes p =
208 any (buildable . buildInfo)
209 . executables $ p
210 treatAsLibrary = (not . hasBuildableExes) pkgDesc && hasLibs pkgDesc
211
212 -- calculate build tools
213 bt = [ pkg' -- TODO: currently ignoring version range
2775da02 »
2010-01-24 -Wall cleanups
214 | Cabal.Dependency (Cabal.PackageName pkg ) _range <- buildToolsDeps pkgDesc
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
215 , Just pkg' <- return (lookup pkg buildToolsTable)
216 ]
217
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
218 packageNameResolver s = do
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
219 (Portage.PackageName (Portage.Category p_cat) (Cabal.PackageName pn))
033ff9b1 »
2009-12-16 move package resolving functions to Portage.Resolve
220 <- Portage.resolveFullPortageName portage (Cabal.PackageName s)
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
221 return $ E.AnyVersionOf (p_cat </> pn)
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
222
60d04de6 »
2009-11-29 adapt to cabal-1.8 and cabal-install-0.7.5 (HEADs)
223 -- calculate extra-libs
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
224 extra <- findCLibs verbosity packageNameResolver pkgDesc
f3093658 »
2009-02-19 Reimplement 'hackport merge'
225
226 debug verbosity ("Selected flags: " ++ show flags)
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
227 debug verbosity ("extra-libs: ")
228 mapM_ (debug verbosity . show) extra
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
229
230 debug verbosity ("build-tools:")
231 mapM_ (debug verbosity . show) bt
232
f3093658 »
2009-02-19 Reimplement 'hackport merge'
233 -- debug verbosity ("Finalized package:\n" ++ showPackageDescription pkgDesc)
234
235 -- TODO: more fixes
96a64770 »
2009-02-19 Add some todos
236 -- * inherit keywords from previous ebuilds
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
237 let d e = if treatAsLibrary
238 then Portage.showDepend (cabal_dep e)
239 : "${RDEPEND}"
240 : [ "${BUILDTOOLS}" | not . null $ build_tools e ]
241 else Portage.showDepend (cabal_dep e)
242 : Portage.showDepend (ghc_dep e)
243 : "${RDEPEND}"
244 : [ "${BUILDTOOLS}" | not . null $ build_tools e ]
245 ++ [ "${HASKELLDEPS}" | not . null $ haskell_deps e ]
246 rd e = if treatAsLibrary
247 then Portage.showDepend (ghc_dep e)
248 : [ "${HASKELLDEPS}" | not . null $ haskell_deps e ]
249 ++ [ "${EXTRALIBS}" | not . null $ extra_libs e ]
250 else [ "${EXTRALIBS}" | not . null $ extra_libs e ]
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
251 let ebuild = fixSrc serverURI (packageId pkgDesc)
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
252 . (\e -> e { depend = d e } )
253 . (\e -> e { rdepend = rd e } )
254 . (\e -> e { extra_libs = extra_libs e ++ extra } )
255 . (\e -> e { build_tools = build_tools e ++ bt } )
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
256 $ E.cabal2ebuild pkgDesc
f3093658 »
2009-02-19 Reimplement 'hackport merge'
257
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
258 debug verbosity ("Treat as library: " ++ show treatAsLibrary)
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
259 mergeEbuild verbosity overlayPath (Portage.unCategory cat) ebuild
f3093658 »
2009-02-19 Reimplement 'hackport merge'
260 fetchAndDigest
261 verbosity
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
262 (overlayPath </> display cat </> display norm_pkgName)
f3093658 »
2009-02-19 Reimplement 'hackport merge'
263 (display cabal_pkgId <.> "tar.gz")
264 (mkUri cabal_pkgId)
265
36431fea »
2009-03-01 Further cleanup
266 findCLibs :: Verbosity -> (String -> Maybe E.Dependency) -> PackageDescription -> IO [E.Dependency]
267 findCLibs verbosity portageResolver (PackageDescription { library = lib, executables = exes }) = do
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
268 debug verbosity "Mapping extra-libraries into portage packages..."
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
269 -- for extra libs we don't find, maybe look into into installed packages?
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
270 when (not . null $ notFound) $
87489f18 »
2009-03-01 Clean up the extra-libraries resolving a bit
271 warn verbosity ("Could not find portage packages for extra-libraries: " ++ unwords notFound)
823b6ef6 »
2009-03-01 Look into portage dir when resolving extra-libraries
272 when (not . null $ found) $
273 debug verbosity ("Found c-libraries deps: " ++ show found)
274 return found
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
275 where
87489f18 »
2009-03-01 Clean up the extra-libraries resolving a bit
276 resolvers = [ staticTranslateExtraLib, portageResolver ]
277
278 resolved = [ chain p resolvers
279 | p <- libE ++ exeE
280 ] :: [Either String E.Dependency]
281
282 notFound = [ p | Left p <- resolved ]
283 found = [ p | Right p <- resolved ]
284
285 chain v [] = Left v
286 chain v (f:fs) = case f v of
287 Nothing -> chain v fs
288 Just x -> Right x
289
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
290 libE = maybe [] (extraLibs.libBuildInfo) lib
291 exeE = concatMap (extraLibs.buildInfo) exes
292
87489f18 »
2009-03-01 Clean up the extra-libraries resolving a bit
293 staticTranslateExtraLib :: String -> Maybe E.Dependency
294 staticTranslateExtraLib lib = lookup lib m
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
295 where
296 m = [ ("z", E.AnyVersionOf "sys-libs/zlib")
297 , ("bz2", E.AnyVersionOf "sys-libs/bzlib")
6956e2f0 »
2009-08-03 Tiny cleanup about different Version structures. Add rdepend to ebuild.
298 , ("mysqlclient", E.LaterVersionOf (Portage.Version [4,0] Nothing [] 0) "virtual/mysql")
299 , ("pq", E.LaterVersionOf (Portage.Version [7] Nothing [] 0) "virtual/postgresql-base")
cb4a7bb9 »
2009-03-01 Start on translating extra-libraries into ebuild deps
300 ]
301
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
302 buildToolsDeps :: PackageDescription -> [Cabal.Dependency]
303 buildToolsDeps (PackageDescription { library = lib, executables = exes }) = cabalDeps
304 where
305 cabalDeps = depL ++ depE
306 depL = maybe [] (buildTools.libBuildInfo) lib
307 depE = concatMap (buildTools.buildInfo) exes
308
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
309 buildToolsTable :: [(String, E.Dependency)]
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
310 buildToolsTable =
bd75ad03 »
2009-12-22 first stab at DEPEND / RDEPEND tracking
311 [ ("happy", E.AnyVersionOf "dev-haskell/happy")
312 , ("alex", E.AnyVersionOf "dev-haskell/alex")
313 , ("c2hs", E.AnyVersionOf "dev-haskell/c2hs")
1de80479 »
2009-03-03 Add build-tools deps as well, using a static table
314 ]
315
f3093658 »
2009-02-19 Reimplement 'hackport merge'
316 mkUri :: Cabal.PackageIdentifier -> URI
317 mkUri pid =
318 -- example:
319 -- http://hackage.haskell.org/packages/archive/Cabal/1.4.0.2/Cabal-1.4.0.2.tar.gz
320 fromJust $ parseURI $
321 "http://hackage.haskell.org/packages/archive/"
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
322 </> p_name </> p_ver </> p_name <-> p_ver <.> "tar.gz"
f3093658 »
2009-02-19 Reimplement 'hackport merge'
323 where
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
324 p_ver = display (packageVersion pid)
325 p_name = display (packageName pid)
8135c0c7 »
2008-10-01 Implement fetching and creation of digests for new ebuilds
326
327 fetchAndDigest :: Verbosity
328 -> FilePath -- ^ directory of ebuild
329 -> String -- ^ tarball name
330 -> URI -- ^ tarball uri
6ec3592d »
2008-11-12 Hackport now uses Cabal-1.6
331 -> IO ()
7ab62d59 »
2009-02-19 Tried hlint, nice.
332 fetchAndDigest verbosity ebuildDir tarballName tarballURI =
8135c0c7 »
2008-10-01 Implement fetching and creation of digests for new ebuilds
333 withWorkingDirectory ebuildDir $ do
821330fb »
2009-12-17 use cabal package tarball downloading code from cabal-install
334 repo_info <- Host.getInfo
335 let tarDestination = (Host.distfiles_dir repo_info) </> tarballName
4b2a1d28 »
2010-05-11 Upgrade bundled cabal-install from 0.8.0 to 0.8.2
336 downloadURI verbosity tarballURI tarDestination
337 -- Just err -> throwEx (E.DownloadFailed (show tarballURI) (show err))
338 -- TODO: downloadURI will throw a non-hackport exception if the
339 -- download fails
340 notice verbosity $ "Saved to " ++ tarDestination
341 notice verbosity "Recalculating digests..."
342 _ <- system "repoman manifest"
343 return ()
8135c0c7 »
2008-10-01 Implement fetching and creation of digests for new ebuilds
344
345 withWorkingDirectory :: FilePath -> IO a -> IO a
346 withWorkingDirectory newDir action = do
347 oldDir <- getCurrentDirectory
348 bracket
349 (setCurrentDirectory newDir)
350 (\_ -> setCurrentDirectory oldDir)
351 (\_ -> action)
f3093658 »
2009-02-19 Reimplement 'hackport merge'
352
353 mergeEbuild :: Verbosity -> FilePath -> String -> EBuild -> IO ()
deff8895 »
2009-03-07 Some fixes for -Wall (name colisions, redundant imports)
354 mergeEbuild verbosity target cat ebuild = do
355 let edir = target </> cat </> name ebuild
f3093658 »
2009-02-19 Reimplement 'hackport merge'
356 elocal = name ebuild ++"-"++ version ebuild <.> "ebuild"
357 epath = edir </> elocal
358 createDirectoryIfMissing True edir
359 info verbosity $ "Writing " ++ elocal
360 writeFile epath (showEBuild ebuild)
361
362 fixSrc :: URI -> PackageIdentifier -> EBuild -> EBuild
363 fixSrc serverURI p ebuild =
364 ebuild {
365 src_uri = show $ serverURI {
366 uriPath =
7ab62d59 »
2009-02-19 Tried hlint, nice.
367 uriPath serverURI
f3093658 »
2009-02-19 Reimplement 'hackport merge'
368 </> display (pkgName p)
369 </> display (pkgVersion p)
370 </> display (pkgName p) ++ "-" ++ display (pkgVersion p)
371 <.> "tar.gz"
175e7533 »
2009-03-01 Set a default homepage to hackport if none is set
372 },
373 E.homepage = case E.homepage ebuild of
374 "" -> "http://hackage.haskell.org/cgi-bin/hackage-scripts/package/"
375 ++ display (pkgName p)
376 x -> x
f3093658 »
2009-02-19 Reimplement 'hackport merge'
377 }
Something went wrong with that request. Please try again.