cabal-rpm 0.6.5 → 0.6.6
raw patch · 7 files changed
+59/−18 lines, 7 files
Files
- NEWS +10/−0
- README.md +3/−1
- cabal-rpm.cabal +3/−1
- man/cabal-rpm.1 +2/−2
- man/cabal-rpm.1.md +2/−2
- src/Distribution/Package/Rpm.hs +38/−11
- src/Distribution/Package/Rpm/Main.hs +1/−1
NEWS view
@@ -1,3 +1,13 @@+* 0.6.6+- generate BRs and Req's for C libraries (extra-libraries)+- initial map for some C libs: libglut, libiw, libz, libX*+- generate BRs and Req's for pkgconfig-depends+- generate BRs for build-tools+- initial map for build-tools: gtk2hs-buildtools+- map LGPL-2.1 license to LGPLv2+ tag+- backup suffix changed from .cabal-rpm to .cblrpm+- don't mistake non-existent file in cwd for a package+ * 0.6.5 - drop hscolour BuildRequires - simplify generated BuildRequires: drop version ranges for now,
README.md view
@@ -1,3 +1,5 @@+[](https://travis-ci.org/juhp/cabal-rpm)+ # cabal-rpm cabal-rpm creates RPM spec files for packaging Haskell Cabal-based packages.@@ -47,7 +49,7 @@ and create a spec file for it. cabal-rpm always creates `.spec` files in the current dir-and if a `.spec` file already exists it will append `.cabal-rpm`+and if a `.spec` file already exists it will append `.cblrpm` to the generated filename to avoid overwriting an existing file. ## Development
cabal-rpm.cabal view
@@ -1,10 +1,12 @@ Name: cabal-rpm-Version: 0.6.5+Version: 0.6.6 Synopsis: RPM package creator for Haskell Cabal-based packages Description: This package generates RPM spec files from Haskell Cabal packages. . Recent changes:+ .+ * 0.6.6: generate depends for extra-libraries, build-tools, and pkgconfig-depends . * 0.6.5: simplify BuildRequires without versions and drop explicit hscolour .
man/cabal-rpm.1 view
@@ -25,10 +25,10 @@ Cabal-rpm then parses the above specified .cabal file and uses it to generate a .spec file that can be built. .PP-If a .spec already exists, cabal-rpm output to .spec.cabal-rpm instead.+If a .spec already exists, cabal-rpm output to .spec.cblrpm instead. .PP The cabal-rpm-diff command can be used in the same way to output a diff-of .spec and .spec.cabal-rpm directly.+of .spec and .spec.cblrpm directly. .SH OPTIONS .TP .B -h, --help
man/cabal-rpm.1.md view
@@ -22,10 +22,10 @@ Cabal-rpm then parses the above specified .cabal file and uses it to generate a .spec file that can be built. -If a <PKG>.spec already exists, cabal-rpm output to <PKG>.spec.cabal-rpm instead.+If a <PKG>.spec already exists, cabal-rpm output to <PKG>.spec.cblrpm instead. The cabal-rpm-diff command can be used in the same way to output a diff-of <PKG>.spec and <PKG>.spec.cabal-rpm directly.+of <PKG>.spec and <PKG>.spec.cblrpm directly. # OPTIONS -h, --help
src/Distribution/Package/Rpm.hs view
@@ -52,7 +52,8 @@ import Distribution.PackageDescription (GenericPackageDescription (..), PackageDescription (..), exeName,- hasExes, hasLibs, withExe)+ hasExes, hasLibs, withExe, allBuildInfo,+ BuildInfo (..)) import Distribution.PackageDescription.Configuration (finalizePackageDescription) @@ -172,7 +173,7 @@ isExec = if (rpmLibrary flags) then False else hasExes pkgDesc isLib = hasLibs pkgDesc specAlreadyExists <- doesFileExist specPath- h <- openFile (specPath ++ if specAlreadyExists then ".cabal-rpm" else "") WriteMode+ h <- openFile (specPath ++ if specAlreadyExists then ".cblrpm" else "") WriteMode let putHdr hdr val = hPutStrLn h (hdr ++ ":" ++ padding hdr ++ val) padding hdr = replicate (15 - length hdr) ' ' putHdr_ hdr val = unless (null val) $ putHdr hdr val@@ -198,7 +199,7 @@ when synTooLong $ warn verbose "The synopsis for this package spans multiple lines." - let common_description = intercalate "\\\n" $ lines $+ let common_description = lines $ if (null . description) pkgDesc then if synTooLong then syn@@ -210,7 +211,7 @@ putNewline putDef "common_summary" common_summary putNewline- putDef "common_description" common_description+ putDef "common_description" $ intercalate "\\\n" common_description putNewline putHdr "Name" (if isExec then (if isLib then "%{pkg_name}" else name) else "ghc-%{pkg_name}")@@ -227,20 +228,41 @@ putHdr "BuildRequires" "ghc-Cabal-devel" putHdr "BuildRequires" $ "ghc-rpm-macros" - put "# Begin cabal-rpm deps:" let excludedPkgs n = notElem n [packageName, "Cabal", "base", "ghc-prim", "integer-gmp"] depName (Dependency (PackageName n) _) = n deps = filter excludedPkgs $ nub $ map depName (buildDepends pkgDesc) showDep p = "ghc-" ++ p ++ "-devel"- mapM_ (putHdr "BuildRequires") $ map showDep deps- when (elem "template-haskell" deps) $- putHdr "ExclusiveArch" "%{ghc_arches_with_ghci}"- put "# End cabal-rpm deps"+ buildinfo = allBuildInfo pkgDesc+ excludedTools n = notElem n ["ghc", "perl"]+ mapTools "gtk2hsC2hs" = "gtk2hs-buildtools"+ mapTools "gtk2hsHookGenerator" = "gtk2hs-buildtools"+ mapTools "gtk2hsTypeGen" = "gtk2hs-buildtools"+ mapTools tool = tool+ tools = filter excludedTools $ nub $ map (mapTools . depName) $ concat (map buildTools buildinfo)+ excludedCLibs n = notElem n []+ mapCLibs "glut" = "freeglut"+ mapCLibs "iw" = "wireless-tools"+ mapCLibs "z" = "zlib"+ mapCLibs ('X':lib) = "libX" ++ lib+ mapCLibs lib = lib+ clibs = filter excludedCLibs $ nub $ map mapCLibs $ concat (map extraLibs buildinfo)+ pkgcfgs = nub $ map depName $ concat (map pkgconfigDepends buildinfo)+ showPkgCfg p = "pkgconfig(" ++ p ++ ")" + when (not . null $ deps ++ tools ++ clibs ++ pkgcfgs) $ do+ put "# Begin cabal-rpm deps:"+ mapM_ (putHdr "BuildRequires") $ map showDep deps+ when (elem "template-haskell" deps) $+ putHdr "ExclusiveArch" "%{ghc_arches_with_ghci}"+ mapM_ (putHdr "BuildRequires") tools+ mapM_ (putHdr "BuildRequires") $ map (++ "-devel%{?_isa}") clibs+ mapM_ (putHdr "BuildRequires") $ map showPkgCfg pkgcfgs+ put "# End cabal-rpm deps"+ putNewline put "%description"- put $ if isLib then "%{common_description}" else common_description+ put $ if isLib then "%{common_description}" else unlines common_description putNewline putNewline @@ -269,6 +291,11 @@ when isLib $ do put "%ghc_devel_package"+ when (not . null $ clibs ++ pkgcfgs) $ do+ put "# Begin cabal-rpm deps:"+ mapM_ (putHdr "Requires") $ map (++ "-devel%{?_isa}") clibs+ mapM_ (putHdr "Requires") $ map showPkgCfg pkgcfgs+ put "# End cabal-rpm deps" putNewline put "%ghc_devel_description" putNewline@@ -328,7 +355,7 @@ showLicense (GPL Nothing) = "GPL+" showLicense (GPL (Just ver)) = "GPLv" ++ showVersion ver ++ "+" showLicense (LGPL Nothing) = "LGPLv2+"-showLicense (LGPL (Just ver)) = "LGPLv" ++ showVersion ver ++ "+"+showLicense (LGPL (Just ver)) = "LGPLv" ++ [head $ showVersion ver] ++ "+" showLicense BSD3 = "BSD" showLicense BSD4 = "BSD" showLicense MIT = "MIT"
src/Distribution/Package/Rpm/Main.hs view
@@ -47,7 +47,7 @@ else do isfile <- doesFileExist path if not isfile- then if '/' `notElem` path+ then if (all (\ p -> p `notElem` path) "/.") then do tryUnpack path else error $ path ++ ": No such file or directory"