cabal2arch 0.3.1 → 0.3.2
raw patch · 2 files changed
+43/−10 lines, 2 filesdep +containersdep ~pureMD5
Dependencies added: containers
Dependency ranges changed: pureMD5
Files
- Main.hs +40/−8
- cabal2arch.cabal +3/−2
Main.hs view
@@ -37,6 +37,7 @@ import Data.List import Data.Maybe+import qualified Data.Map as M import Data.Monoid import Data.Char import Debug.Trace@@ -157,8 +158,8 @@ -- not actuall correct, since it doesn't take any version -- info into account. ----- Really need to use satisfyDep or friends.--- TODO do this properly+-- TODO this should use configDependency to find the precise+-- versions we have available on Arch. -- removeCoreFrom :: [Dependency] -> [Dependency] removeCoreFrom [] = []@@ -272,6 +273,29 @@ then die $ "directory doesn't exist: " ++ show dir else findPackageDesc dir +findCLibs :: PackageDescription -> [String]+findCLibs (PackageDescription { library = lib, executables = exe }) =+ -- warn for packages not in list.+ map canonicalise (some ++ rest)+ where+ some = concatMap (extraLibs.buildInfo) exe+ rest = case lib of+ Nothing -> []+ Just l -> extraLibs (libBuildInfo l)++ canonicalise k = case M.lookup k translationTable of+ Nothing -> trace "WARNING: this library depends on a C library we do not know the pacman name for. Check the C library names in the generated PKGBUILD File" $ k+ Just s -> s++ -- known pacman packages for C libraries we use:+ translationTable = M.fromList+ [("curses", "ncurses")+ ,("bz2", "bzip2")+ ,("z", "zlib")+ ]+++ ------------------------------------------------------------------------ -- Parsing and pretty printing: @@ -322,15 +346,13 @@ -- handle mullltipackages -- extract C dependencies --- = trace (show _cabal_condExecutables ) $+-- = trace (show cabal) $ = (emptyPkgBuild { arch_pkgname = archName , arch_pkgver = vers- , arch_url =- if null (homepage cabal)- then "http://hackage.haskell.org/cgi-bin/hackage-scripts/package/"++name- else homepage cabal+ , arch_url = "http://hackage.haskell.org/cgi-bin/hackage-scripts/package/"++name+ -- else homepage cabal , arch_pkgdesc = synopsis cabal , arch_license = ArchList . return $@@ -343,9 +365,14 @@ -- All Haskell libraries are prefixed with "haskell-" , arch_makedepends = (arch_makedepends emptyPkgBuild) `mappend`+ -- Haskell libraries+ -- TODO: use a real package spec to compute these names+ -- based on what is in Arch. ArchList [ ArchDep (Dependency ("haskell" <-> map toLower d) v) | Dependency d v <- buildDepends cabal ]+ `mappend`+ anyClibraries -- need the dependencies of all flags that are on by default, for all libraries and executables @@ -394,6 +421,11 @@ hasLibrary = isJust (library cabal) isLibrary = isJust (library cabal) && null (executables cabal) + anyClibraries | null libs = ArchList []+ | otherwise = ArchList libs+ where+ libs = [ ArchDep (Dependency s AnyVersion) | s <- findCLibs cabal ]+ -- -- post install, and pre-remove hooks to run, to sync up ghc-pkg --@@ -573,7 +605,7 @@ = disp r1 <+> text "&&" <+> disp r2 -} - mydisp x = trace ("Can't handle this version format yet: " ++ show x) $ empty+ mydisp x = trace ("WARNING: Can't handle this version format yet: " ++ show x ++ "\ncheck the dependencies by hand.")$ empty parse = undefined
cabal2arch.cabal view
@@ -1,5 +1,5 @@ name: cabal2arch-version: 0.3.1+version: 0.3.2 homepage: http://code.haskell.org/~dons/code/cabal2arch synopsis: Create Arch Linux packages from Cabal packages description: Create Arch Linux packages from Cabal packages@@ -24,6 +24,7 @@ pretty, process, directory,+ containers, bytestring else build-depends: @@ -31,6 +32,6 @@ build-depends: Cabal >= 1.3.11 && < 1.5,- pureMD5 >= 0.2.0,+ pureMD5 >= 0.2.1, filepath