packages feed

cabal-rpm 0.8.3 → 0.8.4

raw patch · 6 files changed

+52/−32 lines, 6 files

Files

NEWS view
@@ -1,3 +1,12 @@+* 0.8.4 (2013-09-28)+- use repoquery to determine extra C library dependencies+- quote "pkgconfig(foo)" for rpm query and yum install+- show sudo command before sudo password prompt appears+- exclude hsc2hs from build tool deps+- devel provides ghc-<pkg>-static+- drop release from initial changelog entry for packager to add an entry+- do not try to fetch tarball when in a darcs or git source dir+ * 0.8.3 (2013-07-12) - only try to install missing dependencies - for executables depending on own lib add BR chrpath and %ghc_fix_dynamic_rpath
cabal-rpm.cabal view
@@ -1,28 +1,28 @@ Name:                cabal-rpm-Version:             0.8.3+Version:             0.8.4 Synopsis:            RPM package creator for Haskell Cabal-based packages Description:     This package generates RPM packages from Haskell Cabal packages.     .     Recent changes:     .+    * 0.8.4: use repoquery for C deps, pkgconfig quoting, devel provides static+    .     * 0.8.3: only install missing dependencies, word-wrap generic descriptions     .-    * 0.8.2: wrap sentences at end of line, handle pkg-ver arg, sort deps +    * 0.8.2: wrap after sentences near end of line, handle pkg-ver arg, sort deps     .     * 0.8.1: word wrapping of descriptions     .     * 0.8.0: new simpler revised Fedora packaging; check external commands available     .-    * 0.7.0: command arg for spec, srpm, or build; installs existing packaged depends with sudo yum-    .-    See <https://github.com/juhp/cabal-rpm/blob/master/NEWS> for more details.+    See <https://github.com/juhp/cabal-rpm/blob/master/NEWS> for more details and history. Homepage:            https://github.com/juhp/cabal-rpm Bug-reports:         https://github.com/juhp/cabal-rpm/issues License:             GPL-3 License-file:        COPYING-Author:              Bryan O'Sullivan <bos@serpentine.com>-Maintainer:          Jens Petersen <juhp@community.haskell.org>+Author:              Bryan O'Sullivan <bos@serpentine.com>, Jens Petersen <juhp@community.haskell.org>+Maintainer:          Jens Petersen <petersen@fedoraproject.org> Copyright:           2007-2008 Bryan O'Sullivan <bos@serpentine.com>,                      2012-2013 Jens Petersen <petersen@fedoraproject.org> Category:            Distribution
src/Commands/Build.hs view
@@ -32,7 +32,7 @@  --import Distribution.Version (VersionRange, foldVersionRange') -import System.Directory (copyFile, doesFileExist,+import System.Directory (copyFile, doesFileExist, doesDirectoryExist,                          getCurrentDirectory) import System.Environment (getEnv) import System.FilePath.Posix ((</>))@@ -65,7 +65,7 @@       unless (null missing) $ do         putStrLn $ "Installing dependencies:"         mapM_ putStrLn missing-        optionalSudo ("yum install" +-+ unwords missing)+        optionalSudo $ "yum install" +-+ (unwords $ map show missing)      cwd <- getCurrentDirectory     home <- getEnv "HOME"@@ -75,17 +75,27 @@         rpmCmd = if binary then "a" else "s"     tarFileExists <- doesFileExist tarFile     unless tarFileExists $ do-      trySystem ("cabal fetch -v0 --no-dependencies" +-+ name ++ "-" ++ version)-      copyFile (cachedir </> tarFile) (cwd </> tarFile)-    trySystem ("rpmbuild -b" ++ rpmCmd +-+-                     "--define \"_rpmdir" +-+ cwd ++ "\"" +-+-                     "--define \"_srcrpmdir" +-+ cwd ++ "\"" +-+-                     "--define \"_sourcedir" +-+ cwd ++ "\"" +-+-                     specFile)+      darcsRepo <- doesDirectoryExist "_darcs"+      unless darcsRepo $ do+        gitRepo <- doesDirectoryExist ".git"+        unless (darcsRepo || gitRepo) $ do+          trySystem ("cabal fetch -v0 --no-dependencies" +-+ name ++ "-" ++ version)+          copyFile (cachedir </> tarFile) (cwd </> tarFile)+    tarFileExists' <- doesFileExist tarFile+    if tarFileExists'+      then trySystem ("rpmbuild -b" ++ rpmCmd +-++                      "--define \"_rpmdir" +-+ cwd ++ "\"" +-++                      "--define \"_srcrpmdir" +-+ cwd ++ "\"" +-++                      "--define \"_sourcedir" +-+ cwd ++ "\"" +-++                      specFile)+      else error $ "No" +-+ tarFile +-+ "found"   where     notInstalled :: String -> IO Bool     notInstalled br = do-      liftM not $ systemBool $ "rpm -q" +-+ br+      liftM not $ systemBool $ "rpm -q --whatprovides" +-+ (shellQuote br)+    shellQuote :: String -> String+    shellQuote (c:cs) = (if (elem c "()") then (['\\', c] ++) else (c:)) (shellQuote cs)+    shellQuote "" = ""  specFileName :: PackageDescription    -- ^pkg description                -> RpmFlags            -- ^rpm flags
src/Commands/Spec.hs view
@@ -22,7 +22,7 @@                      depName, packageName, packageVersion,                      simplePackageDescription, showDep) import Setup (RpmFlags (..))-import SysCmd ((+-+))+import SysCmd ((+-+), tryReadProcess)  --import Control.Exception (bracket) import Control.Monad    (unless, when)@@ -99,7 +99,6 @@         putNewline = hPutStrLn h ""         put = hPutStrLn h         putDef v s = put $ "%global" +-+ v +-+ s-        date = formatTime defaultTimeLocale "%a %b %e %Y" now         ghcPkg = if isBinLib then "-n ghc-%{name}" else ""         ghcPkgDevel = if isBinLib then "-n ghc-%{name}-devel" else "devel" @@ -142,28 +141,20 @@      let (deps, selfdep) = buildDependencies pkgDesc name         buildinfo = allBuildInfo pkgDesc-        excludedTools n = notElem n ["ghc", "perl"]+        excludedTools n = notElem n ["ghc", "hsc2hs", "perl"]         mapTools "gtk2hsC2hs" = "gtk2hs-buildtools"         mapTools "gtk2hsHookGenerator" = "gtk2hs-buildtools"         mapTools "gtk2hsTypeGen" = "gtk2hs-buildtools"         mapTools tool = tool         chrpath = if selfdep then ["chrpath"] else []         tools = filter excludedTools $ nub $ (map (mapTools . depName) $ concat (map buildTools buildinfo)) ++ chrpath-        excludedCLibs n = notElem n []-        mapCLibs "curl" = "libcurl"-        mapCLibs "ffi" = "libffi"-        mapCLibs "glut" = "freeglut"-        mapCLibs "iw" = "wireless-tools"-        mapCLibs "z" = "zlib"-        mapCLibs ('X':lib) = "libX" ++ lib-        mapCLibs lib = lib-        clibs = sort $ filter excludedCLibs $ nub $ map mapCLibs $ concat (map extraLibs buildinfo)         pkgcfgs = nub $ map depName $ concat (map pkgconfigDepends buildinfo)         showPkgCfg p = "pkgconfig(" ++ p ++ ")" +    clibs <- mapM (\ lib -> repoquery ["--qf=%{name}", "-qf", "/usr/lib/lib" ++ lib ++ ".so"]) $ concat (map extraLibs buildinfo)     when (not . null $ deps ++ tools ++ clibs ++ pkgcfgs) $ do       put "# Begin cabal-rpm deps:"-      let pkgdeps = sort $ map showDep deps ++ tools ++ map (++ "-devel%{?_isa}") clibs ++ map showPkgCfg pkgcfgs+      let pkgdeps = sort $ map showDep deps ++ tools ++ map (++ "%{?_isa}") clibs ++ map showPkgCfg pkgcfgs       mapM_ (putHdr "BuildRequires") pkgdeps       when (any (\ d -> elem d ["template-haskell", "hamlet"]) deps) $         putHdr "ExclusiveArch" "%{ghc_arches_with_ghci}"@@ -187,13 +178,14 @@         putNewline       put $ "%package" +-+ ghcPkgDevel       putHdr "Summary" $ "Haskell" +-+ pkg_name +-+ "library development files"+      putHdr "Provides" $ (if isExec then "ghc-%{name}" else "%{name}") ++ "-static = %{version}-%{release}"       putHdr "Requires" "ghc-compiler = %{ghc_version}"       putHdr "Requires(post)" "ghc-compiler = %{ghc_version}"       putHdr "Requires(postun)" "ghc-compiler = %{ghc_version}"       putHdr "Requires" $ (if isExec then "ghc-%{name}" else "%{name}") ++ "%{?_isa} = %{version}-%{release}"       when (not . null $ clibs ++ pkgcfgs) $ do         put "# Begin cabal-rpm deps:"-        mapM_ (putHdr "Requires") $ map (++ "-devel%{?_isa}") clibs+        mapM_ (putHdr "Requires") $ map (++ "%{?_isa}") clibs         mapM_ (putHdr "Requires") $ map showPkgCfg pkgcfgs         put "# End cabal-rpm deps"       putNewline@@ -263,8 +255,9 @@       putNewline       putNewline +    let date = formatTime defaultTimeLocale "%a %b %e %Y" now     put "%changelog"-    put $ "*" +-+ date +-+ "Fedora Haskell SIG <haskell@lists.fedoraproject.org> - " ++ version ++ "-" ++ release+    put $ "*" +-+ date +-+ "Fedora Haskell SIG <haskell@lists.fedoraproject.org> - " ++ version     put $ "- spec file generated by cabal-rpm-" ++ showVersion Paths_cabal_rpm.version     hClose h @@ -319,3 +312,9 @@  formatParagraphs :: [String] -> [String] formatParagraphs = map (wordwrap 79) . paragraphs++repoquery :: [String] -> IO String+repoquery args = do+  out <- tryReadProcess "repoquery" args+  -- repoquery ends with a newline+  return $ init out
src/Main.hs view
@@ -91,6 +91,7 @@                     return (file, Just tmpdir)                   else error $ path ++ ": file should be a .cabal or .tar.gz file."   where pkg_re = mkRegex "^([A-Za-z0-9-]+)(-([0-9.]+))?$"+ tryUnpack :: String -> IO (FilePath, Maybe FilePath) tryUnpack pkg = do   pkgver <- if elem '.' pkg then return pkg
src/SysCmd.hs view
@@ -50,6 +50,7 @@       case mavail of         Nothing -> warn normal $ cmd0 ++ ": command not found"         Just _ -> do+          putStrLn $ "Running:" +-+ "sudo" +-+ cmd           ret <- system $ "sudo" +-+ cmd           case ret of             ExitSuccess -> return ()