diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
+* 0.8.10 (2014-03-03)
+- diff command replaces cblrpm-diff script
+- new missingdeps command
+- replace use of rpmspec: no "rpmspec --srpm" on RHEL 5 and 6
+
 * 0.8.9 (2014-02-10)
-- bugfix for handling dir with spec file
+- bugfix for error handling dir with spec file
 - cblrpm-diff arg is now optional
 
 * 0.8.8 (2014-02-09)
diff --git a/cabal-rpm.cabal b/cabal-rpm.cabal
--- a/cabal-rpm.cabal
+++ b/cabal-rpm.cabal
@@ -1,6 +1,6 @@
 Name:                cabal-rpm
-Version:             0.8.9
-Synopsis:            RPM package creator for Haskell Cabal-based packages
+Version:             0.8.10
+Synopsis:            RPM packaging tool for Haskell Cabal-based packages
 Description:
     This package generates RPM packages from Haskell Cabal packages.
     .
@@ -19,6 +19,10 @@
     * cblrpm depends: list hackage dependencies
     .
     * cblrpm requires: list package dependencies
+    .
+    * cblrpm missingdeps: list uninstalled dependencies
+    .
+    * cblrpm diff: diff of current spec file with newly generated one
 Homepage:            https://github.com/juhp/cabal-rpm
 Bug-reports:         https://github.com/juhp/cabal-rpm/issues
 License:             GPL-3
@@ -29,7 +33,7 @@
                      2012-2014 Jens Petersen <petersen@fedoraproject.org>
 Category:            Distribution
 Build-type:          Simple
-Extra-source-files:  README.md ChangeLog man/cblrpm.1.md man/cblrpm.1 cblrpm-diff
+Extra-source-files:  README.md ChangeLog man/cblrpm.1.md man/cblrpm.1
 Cabal-version:       >=1.6
 
 source-repository head
@@ -49,10 +53,12 @@
                    unix
     Other-modules:
         Commands.Depends,
+        Commands.Diff,
         Commands.Install,
         Commands.RpmBuild,
         Commands.Spec,
         Dependencies,
+        FileUtils,
         PackageUtils,
         Setup,
         SysCmd
diff --git a/cblrpm-diff b/cblrpm-diff
deleted file mode 100644
--- a/cblrpm-diff
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2008-2013 Red Hat, Inc
-# Author: Jens Petersen <petersen@redhat.com>
-#
-# 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# use -l to force lib package
-if getopts l opt; then
-  shift
-  case $opt in
-      l) FORCE_LIB=-l
-	  ;;
-      h)
-          echo "Usage: $(basename $0) [-l] [hackage|hackage.tar.gz|hackage.cabal|pkg.spec]"
-          echo "  -l      assume BinLib package is Lib"
-          exit
-          ;;
-  esac
-fi
-
-case $0 in
-    /*) CBLRPM=$(dirname $0)/dist/build/cblrpm/cblrpm ;;
-    *) CBLRPM=cblrpm ;;
-esac
-
-PKG=$1
-
-WORKDIR=$(mktemp --tmpdir=. -d)
-
-cd $WORKDIR
-
-if [ -n "$PKG" -a ! -r ../$PKG ]; then
-    $CBLRPM -v0 $FORCE_LIB spec $PKG
-elif ! $CBLRPM -v0 $FORCE_LIB spec ../$PKG; then
-    cd ..
-    rm -r $WORKDIR
-    exit 1
-fi
-
-SPECFILE=$(ls *.spec)
-
-cd ..
-
-if [ ! -r "$SPECFILE" ]; then
-  echo "No $SPECFILE file found in current directory"
-  rm -r $WORKDIR
-  exit 1
-fi
-
-diff -uw $WORKDIR/$SPECFILE $SPECFILE | sed -e "s%$WORKDIR/$SPECFILE%$SPECFILE.cblrpm%"
-
-[ -d "$WORKDIR" ] && rm -r $WORKDIR
diff --git a/man/cblrpm.1 b/man/cblrpm.1
--- a/man/cblrpm.1
+++ b/man/cblrpm.1
@@ -11,7 +11,9 @@
 [\f[I]options\f[]] builddep [\f[I]path\-or\-pkg\f[]] cblrpm
 [\f[I]options\f[]] install [\f[I]path\-or\-pkg\f[]] cblrpm
 [\f[I]options\f[]] depends [\f[I]path\-or\-pkg\f[]] cblrpm
-[\f[I]options\f[]] requires [\f[I]path\-or\-pkg\f[]]
+[\f[I]options\f[]] requires [\f[I]path\-or\-pkg\f[]] cblrpm
+[\f[I]options\f[]] missingdeps [\f[I]path\-or\-pkg\f[]] cblrpm
+[\f[I]options\f[]] diff [\f[I]path\-or\-pkg\f[]]
 .SH DESCRIPTION
 .PP
 cblrpm generates RPM packages and .spec files from Haskell Cabal
@@ -33,9 +35,6 @@
 generate a .spec file that can be built.
 .PP
 If a .spec already exists, cblrpm output to .spec.cblrpm instead.
-.PP
-The cblrpm\-diff command can be used in the same way to output a diff of
-.spec and .spec.cblrpm directly.
 .SH OPTIONS
 .TP
 .B \-h, \-\-help
diff --git a/man/cblrpm.1.md b/man/cblrpm.1.md
--- a/man/cblrpm.1.md
+++ b/man/cblrpm.1.md
@@ -14,6 +14,8 @@
 cblrpm [*options*] install [*path-or-pkg*]
 cblrpm [*options*] depends [*path-or-pkg*]
 cblrpm [*options*] requires [*path-or-pkg*]
+cblrpm [*options*] missingdeps [*path-or-pkg*]
+cblrpm [*options*] diff [*path-or-pkg*]
 
 # DESCRIPTION
 cblrpm generates RPM packages and .spec files from Haskell Cabal package.
@@ -30,9 +32,6 @@
 uses it to generate a .spec file that can be built.
 
 If a <PKG>.spec already exists, cblrpm output to <PKG>.spec.cblrpm instead.
-
-The cblrpm-diff command can be used in the same way to output a diff
-of <PKG>.spec and <PKG>.spec.cblrpm directly.
 
 # OPTIONS
 -h, --help
diff --git a/src/Commands/Depends.hs b/src/Commands/Depends.hs
--- a/src/Commands/Depends.hs
+++ b/src/Commands/Depends.hs
@@ -14,29 +14,33 @@
 
 module Commands.Depends (
     depends,
+    missingDeps,
     requires
     ) where
 
 import Dependencies (dependencies, packageDependencies )
-import PackageUtils (packageName, simplePackageDescription)
-import Setup (RpmFlags (..))
+import PackageUtils (missingPackages, packageName)
 
 import Data.List (sort)
-import Distribution.PackageDescription (GenericPackageDescription (..),
-                                        PackageDescription (..))
+import Distribution.PackageDescription (PackageDescription (..))
 
-depends :: GenericPackageDescription -> RpmFlags -> IO ()
-depends genPkgDesc flags = do
-    pkgDesc <- simplePackageDescription genPkgDesc flags
+depends :: PackageDescription -> IO ()
+depends pkgDesc = do
     let pkg = package pkgDesc
         name = packageName pkg
     (deps, tools, clibs, pkgcfgs, _) <- dependencies pkgDesc name
     mapM_ putStrLn $ deps ++ tools ++ clibs ++ pkgcfgs
 
-requires :: GenericPackageDescription -> RpmFlags -> IO ()
-requires genPkgDesc flags = do
-    pkgDesc <- simplePackageDescription genPkgDesc flags
+requires :: PackageDescription -> IO ()
+requires pkgDesc = do
     let pkg = package pkgDesc
         name = packageName pkg
     (deps, tools, clibs, pkgcfgs, _) <- packageDependencies pkgDesc name
     mapM_ putStrLn $ sort $ deps ++ tools ++ clibs ++ pkgcfgs
+
+missingDeps :: PackageDescription -> IO ()
+missingDeps pkgDesc = do
+    let pkg = package pkgDesc
+        name = packageName pkg
+    missing <- missingPackages pkgDesc name
+    mapM_ putStrLn missing
diff --git a/src/Commands/Diff.hs b/src/Commands/Diff.hs
new file mode 100644
--- /dev/null
+++ b/src/Commands/Diff.hs
@@ -0,0 +1,45 @@
+-- |
+-- Module      :  Commands.Diff
+-- Copyright   :  (C) 2014  Jens Petersen
+--
+-- Maintainer  :  Jens Petersen <petersen@fedoraproject.org>
+-- Stability   :  alpha
+-- Portability :  portable
+--
+-- Explanation: diff current spec file with cblrpm spec output
+
+-- 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
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+
+module Commands.Diff (
+  diff
+  ) where
+
+import Commands.Spec (createSpecFile)
+import FileUtils (fileWithExtension, mktempdir)
+import Setup (RpmFlags (..))
+import SysCmd ((+-+), trySystem)
+
+import Control.Applicative ((<$>))
+import Data.Maybe (fromJust)
+import Distribution.PackageDescription (PackageDescription (..))
+import Distribution.Simple.Utils (die)
+
+import System.Directory (removeDirectoryRecursive)
+
+diff ::    FilePath            -- ^cabal path
+        -> PackageDescription  -- ^pkg description
+        -> RpmFlags            -- ^rpm flags
+        -> IO ()
+diff cabalPath pkgDesc flags = do
+  mspcfile <- fileWithExtension "." ".spec"
+  case mspcfile of
+    Nothing -> die "No (unique) .spec file in directory."
+    Just spec -> do
+      tmpdir <- mktempdir
+      createSpecFile cabalPath pkgDesc flags (Just tmpdir)
+      speccblrpm <- fromJust <$> fileWithExtension tmpdir ".spec"
+      trySystem $ "diff" +-+ "-u" +-+ spec +-+ speccblrpm +-+ "| sed -e s%" ++ speccblrpm ++ "%" ++ spec ++ ".cblrpm" ++ "%"
+      removeDirectoryRecursive tmpdir
diff --git a/src/Commands/Install.hs b/src/Commands/Install.hs
--- a/src/Commands/Install.hs
+++ b/src/Commands/Install.hs
@@ -17,33 +17,19 @@
     install
     ) where
 
-import Dependencies (dependencies)
-import PackageUtils (packageName, simplePackageDescription)
-import Setup (RpmFlags (..))
-import SysCmd (runSystem, systemBool, yumInstall, (+-+))
-
-import Control.Monad    (filterM, liftM)
+import PackageUtils (missingPackages, packageName)
+import SysCmd (runSystem, yumInstall)
 
-import Distribution.PackageDescription (GenericPackageDescription (..),
-                                        PackageDescription (..))
+import Distribution.PackageDescription (PackageDescription (..))
 import System.Directory (setCurrentDirectory)
-import System.FilePath.Posix (takeDirectory)
+import System.FilePath (takeDirectory)
 
-install :: FilePath -> GenericPackageDescription -> RpmFlags -> IO ()
-install cabalPath genPkgDesc flags = do
-    pkgDesc <- simplePackageDescription genPkgDesc flags
+install :: FilePath -> PackageDescription -> IO ()
+install cabalPath pkgDesc = do
     let pkg = package pkgDesc
         name = packageName pkg
-    (deps, tools, clibs, pkgcfgs, _) <- dependencies pkgDesc name
-    missing <- filterM notInstalled $ deps ++ tools ++ clibs ++ pkgcfgs
+    missing <- missingPackages pkgDesc name
     yumInstall missing False
     let pkgDir = takeDirectory cabalPath
     setCurrentDirectory pkgDir
     runSystem "cabal install"
-  where
-    notInstalled :: String -> IO Bool
-    notInstalled br =
-      liftM not $ systemBool $ "rpm -q --whatprovides" +-+ shellQuote br
-    shellQuote :: String -> String
-    shellQuote (c:cs) = (if c `elem` "()" then (['\\', c] ++) else (c:)) (shellQuote cs)
-    shellQuote "" = ""
diff --git a/src/Commands/RpmBuild.hs b/src/Commands/RpmBuild.hs
--- a/src/Commands/RpmBuild.hs
+++ b/src/Commands/RpmBuild.hs
@@ -20,27 +20,22 @@
     ) where
 
 import Commands.Spec (createSpecFile)
-import PackageUtils (isScmDir, packageName, packageVersion,
-                                      simplePackageDescription)
+import FileUtils (getDirectoryContents_)
+import PackageUtils (isScmDir, missingPackages, packageName, packageVersion)
 import Setup (RpmFlags (..))
-import SysCmd (runSystem, systemBool, tryReadProcess, yumInstall, (+-+))
+import SysCmd (runSystem, yumInstall, (+-+))
 
 --import Control.Exception (bracket)
-import Control.Applicative ((<$>))
-import Control.Monad    (filterM, liftM, unless, when)
-
-import Data.List (isPrefixOf)
+import Control.Monad    (filterM, unless, when)
 
-import Distribution.PackageDescription (GenericPackageDescription (..),
-                                        PackageDescription (..),
+import Distribution.PackageDescription (PackageDescription (..),
                                         hasExes)
 
 --import Distribution.Version (VersionRange, foldVersionRange')
 
-import System.Directory (copyFile, doesFileExist,
-                         getCurrentDirectory, getDirectoryContents)
+import System.Directory (copyFile, doesFileExist, getCurrentDirectory)
 import System.Environment (getEnv)
-import System.FilePath.Posix (takeDirectory, (</>))
+import System.FilePath (takeDirectory, (</>))
 
 -- autoreconf :: Verbosity -> PackageDescription -> IO ()
 -- autoreconf verbose pkgDesc = do
@@ -53,22 +48,20 @@
 
 data RpmStage = Binary | Source | Prep | BuildDep deriving Eq
 
-rpmBuild :: FilePath -> GenericPackageDescription -> RpmFlags -> RpmStage -> IO ()
-rpmBuild cabalPath genPkgDesc flags stage = do
+rpmBuild :: FilePath -> PackageDescription -> RpmFlags -> RpmStage -> IO ()
+rpmBuild cabalPath pkgDesc flags stage = do
 --    let verbose = rpmVerbosity flags
-    pkgDesc <- simplePackageDescription genPkgDesc flags
 --    bracket (setFileCreationMask 0o022) setFileCreationMask $ \ _ -> do
 --      autoreconf verbose pkgDesc
     specFile <- specFileName pkgDesc flags
     specFileExists <- doesFileExist specFile
     if specFileExists
       then putStrLn $ "Using existing" +-+ specFile
-      else createSpecFile cabalPath genPkgDesc flags
+      else createSpecFile cabalPath pkgDesc flags Nothing
     let pkg = package pkgDesc
         name = packageName pkg
     when (stage `elem` [Binary,BuildDep]) $ do
-      br_out <- tryReadProcess "rpmspec" ["-q", "--buildrequires", specFile]
-      missing <- filterM notInstalled $ lines br_out
+      missing <- missingPackages pkgDesc name
       yumInstall missing True
 
     unless (stage == BuildDep) $ do
@@ -95,12 +88,6 @@
                  "--define \"_sourcedir" +-+ cwd ++ "\"" +-+
                  specFile)
   where
-    notInstalled :: String -> IO Bool
-    notInstalled br =
-      liftM not $ systemBool $ "rpm -q --whatprovides" +-+ shellQuote br
-    shellQuote :: String -> String
-    shellQuote (c:cs) = (if c `elem` "()" then (['\\', c] ++) else (c:)) (shellQuote cs)
-    shellQuote "" = ""
     copyTarball :: String -> String -> Bool -> FilePath -> IO ()
     copyTarball n v ranFetch dest = do
       let tarfile = n ++ "-" ++ v ++ ".tar.gz"
@@ -109,7 +96,7 @@
         home <- getEnv "HOME"
         let cacheparent = home </> ".cabal" </> "packages"
             tarpath = n </> v </> tarfile
-        remotes <- filter (not . isPrefixOf ".") <$> getDirectoryContents cacheparent
+        remotes <- getDirectoryContents_ cacheparent
         let paths = map (\ repo -> cacheparent </> repo </> tarpath) remotes
         -- if more than one tarball, should maybe warn if they are different
         tarballs <- filterM doesFileExist paths
diff --git a/src/Commands/Spec.hs b/src/Commands/Spec.hs
--- a/src/Commands/Spec.hs
+++ b/src/Commands/Spec.hs
@@ -21,8 +21,7 @@
   ) where
 
 import Dependencies (packageDependencies, showDep)
-import PackageUtils (isScmDir, packageName, packageVersion,
-                     simplePackageDescription)
+import PackageUtils (isScmDir, packageName, packageVersion)
 import Setup (RpmFlags (..))
 import SysCmd ((+-+))
 
@@ -40,16 +39,14 @@
 import Distribution.Simple.Utils (notice, warn)
 
 import Distribution.PackageDescription (PackageDescription (..), exeName,
-                                        hasExes, hasLibs, withExe,
-                                        GenericPackageDescription (..))
+                                        hasExes, hasLibs, withExe)
 
 --import Distribution.Version (VersionRange, foldVersionRange')
 
-
 import System.Directory (doesFileExist, getDirectoryContents)
 import System.IO     (IOMode (..), hClose, hPutStrLn, openFile)
 import System.Locale (defaultTimeLocale)
-import System.FilePath (dropFileName, takeDirectory)
+import System.FilePath (dropFileName, takeDirectory, (</>))
 
 import qualified Paths_cabal_rpm (version)
 
@@ -72,22 +69,22 @@
 -- packageVersion :: PackageIdentifier -> String
 -- packageVersion pkg = (showVersion . pkgVersion) pkg
 
-createSpecFile :: FilePath            -- ^pkg spec file
-               -> GenericPackageDescription  -- ^pkg description
+createSpecFile :: FilePath            -- ^pkg cabal file
+               -> PackageDescription  -- ^pkg description
                -> RpmFlags            -- ^rpm flags
+               -> Maybe FilePath      -- ^optional destdir
                -> IO ()
-createSpecFile cabalPath genPkgDesc flags = do
+createSpecFile cabalPath pkgDesc flags mdest = do
     let verbose = rpmVerbosity flags
     now <- getCurrentTime
     defRelease <- defaultRelease cabalPath now
-    pkgDesc <- simplePackageDescription genPkgDesc flags
     let pkg = package pkgDesc
         name = packageName pkg
         pkgname = if isExec then name else "ghc-" ++ name
         pkg_name = if isExec then "%{name}" else "%{pkg_name}"
         version = packageVersion pkg
         release = fromMaybe defRelease (rpmRelease flags)
-        specFile = pkgname ++ ".spec"
+        specFile = (fromMaybe "" mdest) </> pkgname ++ ".spec"
         isExec = not (rpmLibrary flags) && hasExes pkgDesc
         isLib = hasLibs pkgDesc
         isBinLib = isExec && isLib
diff --git a/src/FileUtils.hs b/src/FileUtils.hs
new file mode 100644
--- /dev/null
+++ b/src/FileUtils.hs
@@ -0,0 +1,53 @@
+-- |
+-- Module      :  FileUtils
+-- Copyright   :  (C) 2014  Jens Petersen
+--
+-- Maintainer  :  Jens Petersen <petersen@fedoraproject.org>
+-- Stability   :  alpha
+-- Portability :  portable
+--
+-- Explanation: Command line option processing for building RPM
+-- packages.
+
+-- 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
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+
+module FileUtils (
+  fileWithExtension,
+  fileWithExtension_,
+  getDirectoryContents_,
+  mktempdir) where
+
+import SysCmd (tryReadProcess)
+
+import Control.Applicative ((<$>))
+import Data.List (isPrefixOf)
+import Data.Maybe (isJust)
+import System.Directory (getDirectoryContents)
+import System.FilePath (takeExtension, (</>))
+
+-- looks in current dir for a unique file with given extension
+fileWithExtension :: FilePath -> String -> IO (Maybe FilePath)
+fileWithExtension dir ext = do
+  files <- filter (\ f -> takeExtension f == ext) <$> getDirectoryContents dir
+  case files of
+       [file] -> return $ Just $ dir </> file
+       [] -> return Nothing
+       _ -> putStrLn ("More than one " ++ ext ++ " file found!") >> return Nothing
+
+-- looks in current dir for a unique file with given extension
+fileWithExtension_ :: FilePath -> String -> IO Bool
+fileWithExtension_ dir ext =
+  isJust <$> fileWithExtension dir ext
+
+mktempdir :: IO FilePath
+mktempdir = do
+  mktempOut <- tryReadProcess "mktemp" ["-d"]
+  return $ init mktempOut
+
+-- getDirectoryContents without hidden files
+getDirectoryContents_ :: FilePath -> IO [FilePath]
+getDirectoryContents_ dir =
+  filter (not . isPrefixOf ".") <$> getDirectoryContents dir
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -16,25 +16,29 @@
 
 module Main where
 
-import Commands.Depends (depends, requires)
+import Commands.Depends (depends, missingDeps, requires)
+import Commands.Diff (diff)
 import Commands.Install (install)
 import Commands.RpmBuild (rpmBuild, RpmStage (..))
 import Commands.Spec (createSpecFile)
+
+import FileUtils (fileWithExtension, fileWithExtension_,
+                  getDirectoryContents_, mktempdir)
+import PackageUtils (simplePackageDescription)
 import Setup (RpmFlags (..), parseArgs)
 import SysCmd (runSystem, tryReadProcess)
 
 import Control.Applicative ((<$>))
-import Control.Monad (unless)
 import Data.List (isSuffixOf, stripPrefix)
 import Data.Maybe (isJust, listToMaybe, fromMaybe)
 import Distribution.PackageDescription.Parse (readPackageDescription)
 import Distribution.Simple.Utils (die, findPackageDesc)
-import Distribution.Verbosity (Verbosity, silent)
+import Distribution.Verbosity (Verbosity)
 import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory,
-                         getDirectoryContents, removeDirectoryRecursive,
+                         removeDirectoryRecursive,
                          setCurrentDirectory)
 import System.Environment (getArgs)
-import System.FilePath.Posix (takeExtension, (</>))
+import System.FilePath (takeExtension)
 
 import Text.Regex (matchRegex, mkRegex)
 
@@ -42,17 +46,21 @@
 main = do (opts, args) <- getArgs >>= parseArgs
           let verbose = rpmVerbosity opts
               (cmd:args') = args
-          (cabalPath, mtmp) <- findCabalFile verbose $ fromMaybe "." $ listToMaybe args'
+              path = fromMaybe "." $ listToMaybe args'
+          (cabalPath, mtmp) <- findCabalFile verbose path
           genPkgDesc <- readPackageDescription verbose cabalPath
+          pkgDesc <- simplePackageDescription genPkgDesc opts
           case cmd of
-               "spec" ->  createSpecFile cabalPath genPkgDesc opts
-               "srpm" ->  rpmBuild cabalPath genPkgDesc opts Source
-               "prep" ->  rpmBuild cabalPath genPkgDesc opts Prep
-               "rpm" ->   rpmBuild cabalPath genPkgDesc opts Binary
-               "builddep" -> rpmBuild cabalPath genPkgDesc opts BuildDep
-               "install" -> install cabalPath genPkgDesc opts
-               "depends" -> depends genPkgDesc opts
-               "requires" -> requires genPkgDesc opts
+               "spec" ->  createSpecFile cabalPath pkgDesc opts Nothing
+               "srpm" ->  rpmBuild cabalPath pkgDesc opts Source
+               "prep" ->  rpmBuild cabalPath pkgDesc opts Prep
+               "rpm" ->   rpmBuild cabalPath pkgDesc opts Binary
+               "builddep" -> rpmBuild cabalPath pkgDesc opts BuildDep
+               "install" -> install cabalPath pkgDesc
+               "depends" -> depends pkgDesc
+               "requires" -> requires pkgDesc
+               "missingdeps" -> missingDeps pkgDesc
+               "diff" -> diff cabalPath pkgDesc opts
                c -> error $ "Unknown cmd: " ++ c
           maybe (return ()) removeDirectoryRecursive mtmp
 
@@ -78,7 +86,6 @@
       cblfile <- fileWithExtension_ path ".cabal"
       if cblfile
         then do
-          unless (vb == silent) $ putStrLn $ "trying " ++ path ++ "/"
           file <- findPackageDesc path
           return (file, Nothing)
         else do
@@ -99,30 +106,17 @@
                        then do
                          tmpdir <- mktempdir
                          runSystem $ "tar zxf " ++ path ++ " -C " ++ tmpdir ++ " *.cabal"
-                         subdir <- tryReadProcess "ls" [tmpdir]
-                         file <- findPackageDesc $ tmpdir ++ "/" ++ init subdir
+                         subdir <- getDirectoryContents_ tmpdir
+                         file <- findPackageDesc $ tmpdir ++ "/" ++ head subdir
                          return (file, Just tmpdir)
                        else error $ path ++ ": file should be a .cabal, .spec or .tar.gz file."
   where pkg_re = mkRegex "^([A-Za-z0-9-]+)(-([0-9.]+))?$"
 
--- looks in current dir for a unique file with given extension
-fileWithExtension :: FilePath -> String -> IO (Maybe FilePath)
-fileWithExtension dir ext = do
-  files <- filter (\ f -> takeExtension f == ext) <$> getDirectoryContents dir
-  case files of
-       [file] -> return $ Just $ dir </> file
-       [] -> return Nothing
-       _ -> putStrLn ("More than one " ++ ext ++ " file found!") >> return Nothing
-
--- looks in current dir for a unique file with given extension
-fileWithExtension_ :: FilePath -> String -> IO Bool
-fileWithExtension_ dir ext =
-  isJust <$> fileWithExtension dir ext
-
 cabalFromSpec :: Verbosity -> FilePath -> IO (FilePath, Maybe FilePath)
 cabalFromSpec vrb spcfile = do
-  namever <- removePrefix "ghc-" <$> tryReadProcess "rpmspec" ["-q", "--srpm", "--qf", "%{name}-%{version}", spcfile]
-  findCabalFile vrb namever
+  -- no rpmspec command in RHEL 5 and 6
+  namever <- removePrefix "ghc-" <$> tryReadProcess "rpm" ["-q", "--qf", "%{name}-%{version}\n", "--specfile", spcfile]
+  findCabalFile vrb (head $ lines namever)
 
 removePrefix :: String -> String-> String
 removePrefix pref str =
@@ -150,8 +144,3 @@
     pth <- findPackageDesc pkgver
     setCurrentDirectory cwd
     return (tmpdir ++ "/" ++ pth, Just tmpdir)
-
-mktempdir :: IO FilePath
-mktempdir = do
-  mktempOut <- tryReadProcess "mktemp" ["-d"]
-  return $ init mktempOut
diff --git a/src/PackageUtils.hs b/src/PackageUtils.hs
--- a/src/PackageUtils.hs
+++ b/src/PackageUtils.hs
@@ -15,17 +15,20 @@
 
 module PackageUtils (
   isScmDir,
+  missingPackages,
   packageName,
   packageVersion,
   simplePackageDescription
     ) where
 
+import Dependencies (packageDependencies)
 import Setup (RpmFlags (..))
+import SysCmd (systemBool, (+-+))
 
+import Control.Monad    (filterM, liftM)
 import Data.Version     (showVersion)
 
 import Distribution.Compiler (CompilerFlavor (..))
-
 import Distribution.Package  (PackageIdentifier (..),
                               PackageName (..))
 import Distribution.PackageDescription (GenericPackageDescription (..),
@@ -34,14 +37,13 @@
 
 import Distribution.Simple.Compiler (Compiler (..))
 import Distribution.Simple.Configure (configCompiler)
---import qualified Distribution.Simple.PackageIndex as PackageIndex
 import Distribution.Simple.Program   (defaultProgramConfiguration)
 import Distribution.Simple.Utils (die)
 
-import Distribution.System            (Platform (..), buildArch, buildOS)
+import Distribution.System (Platform (..), buildArch, buildOS)
 
 import System.Directory (doesDirectoryExist)
-import System.FilePath.Posix ((</>))
+import System.FilePath ((</>))
 
 simplePackageDescription :: GenericPackageDescription -> RpmFlags
                          -> IO PackageDescription
@@ -70,3 +72,16 @@
 isScmDir :: FilePath -> IO Bool
 isScmDir dir =
   doesDirectoryExist (dir </> ".git") <||> doesDirectoryExist (dir </> "_darcs")
+
+notInstalled :: String -> IO Bool
+notInstalled br =
+  liftM not $ systemBool $ "rpm -q --whatprovides" +-+ shellQuote br
+  where
+    shellQuote :: String -> String
+    shellQuote (c:cs) = (if c `elem` "()" then (['\\', c] ++) else (c:)) (shellQuote cs)
+    shellQuote "" = ""
+
+missingPackages :: PackageDescription -> String -> IO [String]
+missingPackages pkgDesc name = do
+  (deps, tools, clibs, pkgcfgs, _) <- packageDependencies pkgDesc name
+  filterM notInstalled $ deps ++ tools ++ clibs ++ pkgcfgs
diff --git a/src/Setup.hs b/src/Setup.hs
--- a/src/Setup.hs
+++ b/src/Setup.hs
@@ -91,22 +91,24 @@
     let info = "Usage: " ++ progName ++ " [OPTION]... [COMMAND] [PKGDIR|PKG|PKG-VERSION|CABALFILE|TARBALL]\n"
             ++ "\n"
             ++ "Commands:\n"
-            ++ "  spec\t generate a spec file\n"
-            ++ "  srpm\t generate a src rpm file\n"
-            ++ "  prep\t unpack source\n"
-            ++ "  rpm\t build rpm package\n"
-            ++ "  builddep install dependencies\n"
-            ++ "  install user install package\n"
-            ++ "  depends list Cabal depends\n"
-            ++ "  requires list package buildrequires\n"
---             ++ "  mock\t mock build package\n"
+            ++ "  spec\t\t- generate a spec file\n"
+            ++ "  srpm\t\t- generate a src rpm file\n"
+            ++ "  prep\t\t- unpack source\n"
+            ++ "  rpm\t\t- build rpm package\n"
+            ++ "  builddep\t- install dependencies\n"
+            ++ "  install\t- user install package\n"
+            ++ "  depends\t- list Cabal depends\n"
+            ++ "  requires\t- list package buildrequires\n"
+            ++ "  missingdeps\t- list missing buildrequires\n"
+            ++ "  diff\t\t- diff current spec file\n"
+--             ++ "  mock\t\t- mock build package\n"
             ++ "\n"
             ++ "Options:"
     hPutStrLn h (usageInfo info options)
 
 parseArgs :: [String] -> IO (RpmFlags, [String])
 parseArgs args = do
-     let (os, args', unknown, errs) = getOpt' RequireOrder options args
+     let (os, args', unknown, errs) = getOpt' Permute options args
          opts = foldl (flip ($)) emptyRpmFlags os
      when (rpmHelp opts) $ do
        printHelp stdout
@@ -122,7 +124,7 @@
        hPutStr stderr "Unrecognised options: "
        hPutStrLn stderr $ unwords unknown
        exitWith (ExitFailure 1)
-     when (null args' || notElem (head args') ["builddep", "depends", "install", "prep", "requires", "spec", "srpm", "rpm"]) $ do
+     when (null args' || notElem (head args') ["builddep", "depends", "diff", "install", "missingdeps", "prep", "requires", "spec", "srpm", "rpm"]) $ do
        printHelp stderr
        exitWith (ExitFailure 1)
      when (length args' > 2) $ do
diff --git a/src/SysCmd.hs b/src/SysCmd.hs
--- a/src/SysCmd.hs
+++ b/src/SysCmd.hs
@@ -18,6 +18,7 @@
   requireProgram,
   runSystem,
   tryReadProcess,
+  trySystem,
   systemBool,
   yumInstall,
   (+-+)) where
