packages feed

cabal-rpm 0.8.4 → 0.8.5

raw patch · 5 files changed

+31/−20 lines, 5 files

Files

NEWS view
@@ -1,3 +1,7 @@+* 0.8.5 (2013-09-28)+- fix repoquery when a package update exists for C lib+- make cblrpm-diff quieter+ * 0.8.4 (2013-09-28) - use repoquery to determine extra C library dependencies - quote "pkgconfig(foo)" for rpm query and yum install@@ -5,7 +9,7 @@ - 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+- do not try to fetch tarball for a darcs or git source dir  * 0.8.3 (2013-07-12) - only try to install missing dependencies
cabal-rpm.cabal view
@@ -1,11 +1,13 @@ Name:                cabal-rpm-Version:             0.8.4+Version:             0.8.5 Synopsis:            RPM package creator for Haskell Cabal-based packages Description:     This package generates RPM packages from Haskell Cabal packages.     .     Recent changes:     .+    * 0.8.5: fix repoquery when a package update exists for C lib; make cblrpm-diff quieter+    .     * 0.8.4: use repoquery for C deps, pkgconfig quoting, devel provides static     .     * 0.8.3: only install missing dependencies, word-wrap generic descriptions@@ -16,7 +18,7 @@     .     * 0.8.0: new simpler revised Fedora packaging; check external commands available     .-    See <https://github.com/juhp/cabal-rpm/blob/master/NEWS> for more details and history.+    See <https://github.com/juhp/cabal-rpm/blob/master/NEWS> for more history and details. Homepage:            https://github.com/juhp/cabal-rpm Bug-reports:         https://github.com/juhp/cabal-rpm/issues License:             GPL-3
cblrpm-diff view
@@ -39,7 +39,7 @@  cd $WORKDIR -if ! cblrpm $FORCE_LIB spec ../$FILE; then+if ! cblrpm -v0 $FORCE_LIB spec ../$FILE; then     cd ..     rm -r $WORKDIR     exit 1@@ -47,7 +47,7 @@  SPECFILE=$(ls *.spec) -cd -+cd ..  if [ ! -r "$SPECFILE" ]; then   echo No $SPECFILE file found for $FILE
src/Commands/Spec.hs view
@@ -151,7 +151,7 @@         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)+    clibs <- mapM repoqueryLib $ 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 (++ "%{?_isa}") clibs ++ map showPkgCfg pkgcfgs@@ -313,8 +313,12 @@ 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+repoqueryLib :: String -> IO String+repoqueryLib lib = do+  let lib_path = "/usr/lib/lib" ++ lib ++ ".so"+  out <- tryReadProcess "repoquery" ["--qf=%{name}", "-qf", lib_path]+  let pkgs = nub $ words out+  case pkgs of+    [pkg] -> return pkg+    [] -> error $ "Could not resolve package that provides lib" ++ lib_path+    _ -> error $ "More than one package seems to provide lib" ++ lib_path ++ ": " ++ (show pkgs)
src/Main.hs view
@@ -19,10 +19,12 @@ import Setup (RpmFlags (..), parseArgs) import SysCmd (tryReadProcess, trySystem) -import Distribution.PackageDescription.Parse (readPackageDescription)-import Distribution.Simple.Utils (defaultPackageDesc, findPackageDesc)+import Control.Monad (unless) import Data.List (isSuffixOf) import Data.Maybe (isJust)+import Distribution.PackageDescription.Parse (readPackageDescription)+import Distribution.Simple.Utils (defaultPackageDesc, findPackageDesc)+import Distribution.Verbosity (Verbosity, silent) import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory,                          removeDirectoryRecursive, setCurrentDirectory) import System.Environment (getArgs)@@ -32,14 +34,13 @@  main :: IO () main = do (opts, args) <- getArgs >>= parseArgs-          let verbosity = rpmVerbosity opts+          let verbose = rpmVerbosity opts               (cmd:args') = args           (cabalPath, mtmp) <- if null args'                                then do-                                 pth <- defaultPackageDesc verbosity+                                 pth <- defaultPackageDesc verbose                                  return (pth, Nothing)-                               else findCabalFile $ head args'-          let verbose = rpmVerbosity opts+                               else findCabalFile verbose $ head args'           genPkgDesc <- readPackageDescription verbose cabalPath           case cmd of                "spec" ->  createSpecFile cabalPath genPkgDesc opts@@ -65,12 +66,12 @@   --           internalPackageSet = PackageIndex.fromList [internalPackage]  -- returns path to .cabal file and possibly tmpdir to be removed-findCabalFile :: FilePath -> IO (FilePath, Maybe FilePath)-findCabalFile path = do+findCabalFile :: Verbosity -> FilePath -> IO (FilePath, Maybe FilePath)+findCabalFile vb path = do   isdir <- doesDirectoryExist path   if isdir     then do-      putStrLn $ "Using " ++ path ++ "/"+      unless (vb == silent) $ putStrLn $ "Using " ++ path ++ "/"       file <- findPackageDesc path       return (file, Nothing)     else do