Hello community,

here is the log from the commit of package cabal-rpm for openSUSE:Factory 
checked in at 2015-02-20 12:01:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cabal-rpm (Old)
 and      /work/SRC/openSUSE:Factory/.cabal-rpm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cabal-rpm"

Changes:
--------
--- /work/SRC/openSUSE:Factory/cabal-rpm/cabal-rpm.changes      2015-02-16 
22:12:45.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.cabal-rpm.new/cabal-rpm.changes 2015-02-20 
12:01:23.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Feb 18 18:36:09 UTC 2015 - [email protected]
+
+- Bump to version 0.9.4
++ remove requires-space.patch
+* use dnf if installed instead of yum for install and repoquery
+* update now only commits changes and new source if git origin is ssh
+* allow Cabal-1.22
+
+-------------------------------------------------------------------

Old:
----
  cabal-rpm-0.9.3.tar.gz
  requires-space.patch

New:
----
  cabal-rpm-0.9.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cabal-rpm.spec ++++++
--- /var/tmp/diff_new_pack.CntBTk/_old  2015-02-20 12:01:24.000000000 +0100
+++ /var/tmp/diff_new_pack.CntBTk/_new  2015-02-20 12:01:24.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           cabal-rpm
-Version:        0.9.3
+Version:        0.9.4
 Release:        0
 Summary:        RPM packaging tool for Haskell Cabal-based packages
 License:        GPL-3.0+
@@ -25,8 +25,6 @@
 Url:            https://hackage.haskell.org/package/%{name}
 Source0:        
https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
 Source2:        cabal-rpm.1
-# PATCH-FIX-UPSTREAM requires-space.patch - fix missed space in Requires - 
Ondřej Súkup [email protected]
-Patch0:         requires-space.patch
 BuildRequires:  ghc-Cabal-devel
 # Begin cabal-rpm deps:
 BuildRequires:  ghc-directory-devel
@@ -52,7 +50,6 @@
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 %{ghc_bin_build}

++++++ cabal-rpm-0.9.3.tar.gz -> cabal-rpm-0.9.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/ChangeLog 
new/cabal-rpm-0.9.4/ChangeLog
--- old/cabal-rpm-0.9.3/ChangeLog       2015-02-05 16:50:49.000000000 +0100
+++ new/cabal-rpm-0.9.4/ChangeLog       2015-02-17 14:43:22.000000000 +0100
@@ -1,3 +1,8 @@
+* 0.9.4 (2015-02-17)
+- use dnf if installed instead of yum for install and repoquery
+- update now only commits changes and new source if git origin is ssh
+- allow Cabal-1.22
+
 * 0.9.3 (2015-02-05)
 - make sure tarball destdir exists before copying
 - improve output for listing missing packages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/README.md 
new/cabal-rpm-0.9.4/README.md
--- old/cabal-rpm-0.9.3/README.md       2015-02-05 16:50:49.000000000 +0100
+++ new/cabal-rpm-0.9.4/README.md       2015-02-17 14:43:22.000000000 +0100
@@ -4,7 +4,7 @@
 # cabal-rpm
 
 cabal-rpm is a tool for RPM packaging of Haskell Cabal-based packages.
-It interacts with yum to install build dependencies and can also act as
+It interacts with yum/dnf to install build dependencies and can also act as
 a cabal-install wrapper installing dependencies packaged in Fedora before
 running "cabal install".
 
@@ -58,7 +58,7 @@
 
     $ cblrpm install [pkg][-ver]
 
-will yum install available missing dependencies and
+will yum/dnf install available missing dependencies and
 run "cabal install" to build the package.
 
 ## Development
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/cabal-rpm.cabal 
new/cabal-rpm-0.9.4/cabal-rpm.cabal
--- old/cabal-rpm-0.9.3/cabal-rpm.cabal 2015-02-05 16:50:49.000000000 +0100
+++ new/cabal-rpm-0.9.4/cabal-rpm.cabal 2015-02-17 14:43:22.000000000 +0100
@@ -1,11 +1,11 @@
 Name:                cabal-rpm
-Version:             0.9.3
+Version:             0.9.4
 Synopsis:            RPM packaging tool for Haskell Cabal-based packages
 Description:
     This package provides a RPM packaging tool for Haskell Cabal-based 
packages.
     .
     cblrpm has commands to generate a RPM spec file and srpm for a package.
-    It can rpmbuild packages, yum install their dependencies, prep packages,
+    It can rpmbuild packages, yum/dnf install their dependencies, prep 
packages,
     and install them. There are commands to list package dependencies and
     missing dependencies. The diff command compares the current spec file
     with a freshly generated one and the update command updates the spec file
@@ -30,7 +30,7 @@
 Executable cblrpm
     Main-is:            Main.hs
     Build-depends: base < 5,
-                   Cabal > 1.10 && < 1.21,
+                   Cabal > 1.10 && < 1.23,
                    directory,
                    filepath,
                    old-locale,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/Commands/Depends.hs 
new/cabal-rpm-0.9.4/src/Commands/Depends.hs
--- old/cabal-rpm-0.9.3/src/Commands/Depends.hs 2015-02-05 16:50:49.000000000 
+0100
+++ new/cabal-rpm-0.9.4/src/Commands/Depends.hs 2015-02-17 14:43:22.000000000 
+0100
@@ -5,7 +5,7 @@
 -- Maintainer  :  Jens Petersen <[email protected]>
 -- Stability   :  alpha
 --
--- Explanation: cabal wrapper which yum installs dependencies
+-- Explanation: determines dependencies
 
 -- This program is free software: you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 import Dependencies (dependencies, missingPackages, packageDependencies)
 import PackageUtils (PackageData (..), prepare, stripPkgDevel)
 import Setup (quiet)
-import SysCmd (cmd, (+-+))
+import SysCmd (repoquery, (+-+))
 
 import Control.Applicative ((<$>))
 import Control.Monad (filterM, unless, void)
@@ -61,7 +61,7 @@
   return $ nub $ accum2 ++ more
 
 notAvail :: String -> IO Bool
-notAvail pkg = null <$> cmd "repoquery" [pkg]
+notAvail pkg = null <$> repoquery [] pkg
 
 missingDepsPkg :: String -> IO [String]
 missingDepsPkg pkg = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/Commands/Install.hs 
new/cabal-rpm-0.9.4/src/Commands/Install.hs
--- old/cabal-rpm-0.9.3/src/Commands/Install.hs 2015-02-05 16:50:49.000000000 
+0100
+++ new/cabal-rpm-0.9.4/src/Commands/Install.hs 2015-02-17 14:43:22.000000000 
+0100
@@ -6,7 +6,7 @@
 -- Stability   :  alpha
 -- Portability :  portable
 --
--- Explanation: cabal wrapper which yum installs dependencies
+-- Explanation: cabal wrapper which installs rpm dependencies
 
 -- This program is free software: you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 import Dependencies (missingPackages, notInstalled)
 import PackageUtils (PackageData (..), RpmStage (..), stripPkgDevel)
 import Setup (RpmFlags (..))
-import SysCmd (cmd, cmd_, sudo, yumInstall, (+-+))
+import SysCmd (cmd, cmd_, pkgInstall, rpmInstall, (+-+))
 
 import Control.Applicative ((<$>))
 import Control.Monad (unless, when)
@@ -32,7 +32,7 @@
   let pkgDesc = packageDesc pkgdata
   missing <- missingPackages pkgDesc
   unless (null missing) $ do
-    yumInstall missing False
+    pkgInstall missing False
     stillMissing <- missingPackages pkgDesc
     unless (null stillMissing) $ do
       putStrLn $ "Missing:" +-+ unwords stillMissing
@@ -42,7 +42,7 @@
   rpmdir <- cmd "rpm" ["--eval", "%{_rpmdir}"]
   rpms <- (map (\ p -> rpmdir </> arch </> p ++ ".rpm") . lines) <$>
           cmd "rpmspec" ["-q", spec]
-  sudo "yum" $ ["-y", "localinstall"] ++ rpms
+  rpmInstall rpms
 
 installMissing :: String -> IO ()
 installMissing pkg = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/Commands/RpmBuild.hs 
new/cabal-rpm-0.9.4/src/Commands/RpmBuild.hs
--- old/cabal-rpm-0.9.3/src/Commands/RpmBuild.hs        2015-02-05 
16:50:49.000000000 +0100
+++ new/cabal-rpm-0.9.4/src/Commands/RpmBuild.hs        2015-02-17 
14:43:22.000000000 +0100
@@ -24,7 +24,7 @@
 import PackageUtils (copyTarball, isScmDir, PackageData (..), packageName,
                      packageVersion, rpmbuild, RpmStage (..))
 import Setup (RpmFlags (..))
-import SysCmd (cmd, yumInstall, (+-+))
+import SysCmd (cmd, pkgInstall, (+-+))
 
 --import Control.Exception (bracket)
 import Control.Monad    (unless, void, when)
@@ -62,7 +62,7 @@
       name = packageName pkg
   when (stage `elem` [Binary,BuildDep]) $ do
     missing <- missingPackages pkgDesc
-    yumInstall missing (stage == Binary)
+    pkgInstall missing (stage == Binary)
 
   unless (stage == BuildDep) $ do
     srcdir <- cmd "rpm" ["--eval", "%{_sourcedir}"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/Commands/Update.hs 
new/cabal-rpm-0.9.4/src/Commands/Update.hs
--- old/cabal-rpm-0.9.3/src/Commands/Update.hs  2015-02-05 16:50:49.000000000 
+0100
+++ new/cabal-rpm-0.9.4/src/Commands/Update.hs  2015-02-17 14:43:22.000000000 
+0100
@@ -18,10 +18,10 @@
 
 import Commands.Spec (createSpecFile)
 import FileUtils (withTempDirectory)
-import PackageUtils (PackageData (..), bringTarball, isGitDir, latestPkg,
+import PackageUtils (PackageData (..), bringTarball, latestPkg,
                      packageName, packageVersion, prepare, removePrefix)
 import Setup (RpmFlags (..))
-import SysCmd (cmd_, shell, (+-+))
+import SysCmd (cmd_, cmdBool, shell, (+-+))
 
 import Control.Monad (when)
 import Distribution.PackageDescription (PackageDescription (..))
@@ -43,9 +43,9 @@
         then error $ current +-+ "is latest version."
         else do
         bringTarball latest
-        pkgGit <- isGitDir "."
-        when pkgGit $
-          cmd_ "fedpkg" ["new-sources", latest ++ ".tar.gz"]
+        rwGit <- cmdBool "grep -q 'url = ssh://' .git/config"
+        when rwGit $
+            cmd_ "fedpkg" ["new-sources", latest ++ ".tar.gz"]
         withTempDirectory $ \cwd -> do
           curspec <- createSpecVersion current spec
           newspec <- createSpecVersion latest spec
@@ -54,7 +54,7 @@
           cmd_ "sed" ["-i", "-e s/^\\(Release:        \\).*/\\10%{?dist}/", 
spec]
           let newver = removePrefix (name ++ "-") latest
           cmd_ "rpmdev-bumpspec" ["-c", "update to" +-+ newver, spec]
-          when pkgGit $
+          when rwGit $
             cmd_ "git" ["commit", "-a", "-m", "update to" +-+ newver]
   where
     createSpecVersion :: String -> String -> IO FilePath
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/Dependencies.hs 
new/cabal-rpm-0.9.4/src/Dependencies.hs
--- old/cabal-rpm-0.9.3/src/Dependencies.hs     2015-02-05 16:50:49.000000000 
+0100
+++ new/cabal-rpm-0.9.4/src/Dependencies.hs     2015-02-17 14:43:22.000000000 
+0100
@@ -23,7 +23,7 @@
   ) where
 
 import PackageUtils (packageName)
-import SysCmd (cmd, cmdBool, optionalProgram, (+-+))
+import SysCmd (cmd, cmdBool, repoquery, (+-+))
 
 import Control.Applicative ((<$>))
 import Control.Monad (filterM, liftM)
@@ -67,6 +67,8 @@
         clibs = concatMap extraLibs buildinfo
     return (deps, tools, nub clibs, pkgcfgs, selfdep)
 
+data RepoQueryType = Rpm | Repoquery deriving Eq
+
 resolveLib :: String -> IO (Maybe String)
 resolveLib lib = do
   lib64 <- doesDirectoryExist "/usr/lib64"
@@ -74,21 +76,16 @@
   let lib_path = "/usr/lib" ++ libsuffix ++ "/lib" ++ lib ++ ".so"
   libInst <- doesFileExist lib_path
   if libInst
-    then rpmqueryFile "rpm" lib_path
+    then rpmqueryFile Rpm lib_path
     else do
-    haveRpqry <- optionalProgram "repoquery"
-    if haveRpqry
-      then do
-      putStrLn $ "Running repoquery on" +-+ "lib" ++ lib
-      rpmqueryFile "repoquery" lib_path
-      else do
-      warning $ "Install yum-utils to resolve package that provides 
uninstalled" +-+ lib_path
-      return Nothing
+    putStrLn $ "Running repoquery on" +-+ "lib" ++ lib
+    rpmqueryFile Repoquery lib_path
 
 -- use repoquery or rpm -q to query which package provides file
-rpmqueryFile :: String -> FilePath -> IO (Maybe String)
-rpmqueryFile qc file = do
-  out <- cmd qc ["-q", "--qf=%{name}", "-f", file]
+rpmqueryFile :: RepoQueryType -> FilePath -> IO (Maybe String)
+rpmqueryFile qt file = do
+  let args =  ["-q", "--qf=%{name}", "-f"]
+  out <- if qt == Rpm then cmd "rpm" (args ++ [file]) else repoquery args file
   let pkgs = nub $ words out
       -- EL5 repoquery can return "No package provides <file>"
   case pkgs of
@@ -141,7 +138,7 @@
 
 derefPkg :: String -> IO String
 derefPkg req = do
-  res <- singleLine <$> cmd "repoquery" ["--qf", "%{name}", "--whatprovides", 
req]
+  res <- singleLine <$> repoquery ["--qf", "%{name}", "--whatprovides"] req
   if null res
     then error $ req +-+ "provider not found by repoquery"
     else return res
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabal-rpm-0.9.3/src/SysCmd.hs 
new/cabal-rpm-0.9.4/src/SysCmd.hs
--- old/cabal-rpm-0.9.3/src/SysCmd.hs   2015-02-05 16:50:49.000000000 +0100
+++ new/cabal-rpm-0.9.4/src/SysCmd.hs   2015-02-17 14:43:22.000000000 +0100
@@ -22,16 +22,18 @@
   cmdBool,
   cmdQuiet,
   cmdSilent,
+  pkgInstall,
+  repoquery,
+  rpmInstall,
   trySystem,
   shell,
   sudo,
-  yumInstall,
   (+-+)) where
 
 import Control.Monad    (unless, void, when)
 import Data.Functor     ((<$>))
 import Data.List        ((\\))
-import Data.Maybe       (fromMaybe, isJust, isNothing)
+import Data.Maybe       (fromMaybe, isJust, isNothing, maybeToList)
 
 import Distribution.Simple.Utils (die, warn, findProgramLocation)
 import Distribution.Verbosity (normal)
@@ -114,16 +116,31 @@
   then init str
   else str
 
+infixr 4 +-+
 (+-+) :: String -> String -> String
 "" +-+ s = s
 s +-+ "" = s
 s +-+ t = s ++ " " ++ t
 
-yumInstall :: [String] -> Bool -> IO ()
-yumInstall [] _ = return ()
-yumInstall pkgs hard = do
+packageManager :: IO String
+packageManager = do
+  havednf <- optionalProgram "dnf"
+  if havednf
+    then return "dnf"
+    else requireProgram "yum" >> return "yum"
+
+repoquery :: [String] -> String -> IO String
+repoquery args key = do
+  havednf <- optionalProgram "dnf"
+  let (prog, subcmd) = if havednf then ("dnf", Just "repoquery") else 
("repoquery", Nothing)
+  cmd prog (maybeToList subcmd ++ args ++ [key])
+
+pkgInstall :: [String] -> Bool -> IO ()
+pkgInstall [] _ = return ()
+pkgInstall pkgs hard = do
+  pkginstaller <- packageManager
   putStrLn $ "Running repoquery" +-+ unwords pkgs
-  repopkgs <- lines <$> readProcess "repoquery" (["--qf", "%{name}"] ++ pkgs) 
[]
+  repopkgs <- mapM (repoquery ["--qf", "%{name}"]) pkgs
   let missing = pkgs \\ repopkgs
   if not (null missing) && hard
     then error $ unwords missing +-+ "not available."
@@ -141,13 +158,18 @@
         else do
           havesudo <- optionalProgram "sudo"
           return $ if havesudo then Just "sudo" else Nothing
-      requireProgram "yum"
       let args = map showPkg repopkgs
-      putStrLn $ "Running:" +-+ fromMaybe "" maybeSudo +-+ "yum install" +-+ 
unwords args
+      putStrLn $ "Running:" +-+ fromMaybe "" maybeSudo +-+ pkginstaller +-+ 
"install" +-+ unwords args
       let exec = if hard then cmd_ else trySystem
       fedora <- cmd "rpm" ["--eval", "%fedora"]
       let nogpgcheck = ["--nogpgcheck" | fedora `elem` ["21", "22"]]
-      exec (fromMaybe "yum" maybeSudo) $ maybe [] (const "yum") maybeSudo : 
"install" : args ++ nogpgcheck
+      exec (fromMaybe pkginstaller maybeSudo) $ maybe [] (const pkginstaller) 
maybeSudo : "install" : args ++ nogpgcheck
 
 showPkg :: String -> String
 showPkg p = if '(' `elem` p then show p else p
+
+rpmInstall :: [String] -> IO ()
+rpmInstall rpms = do
+  pkginstaller <- packageManager
+  let (inst, arg) = if pkginstaller == "dnf" then ("dnf", "install") else 
("yum", "localinstall")
+  sudo inst $ ["-y", arg] ++ rpms

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to