packages feed

cabal-rpm 0.6.4 → 0.6.5

raw patch · 6 files changed

+94/−87 lines, 6 files

Files

NEWS view
@@ -1,3 +1,10 @@+* 0.6.5+- drop hscolour BuildRequires+- simplify generated BuildRequires: drop version ranges for now,+  exclude pkg self, base libs, and Cabal+- use ExclusiveArch ghc_arches_with_ghci for template-haskell dep+- replace --name option with --library to force Lib+ * 0.6.4 (2012-09-25) - add cabal-rpm-diff - fix manpage generation
cabal-rpm.cabal view
@@ -1,10 +1,12 @@ Name:                cabal-rpm-Version:             0.6.4+Version:             0.6.5 Synopsis:            RPM package creator for Haskell Cabal-based packages Description:     This package generates RPM spec files from Haskell Cabal packages.     .     Recent changes:+    .+    * 0.6.5: simplify BuildRequires without versions and drop explicit hscolour     .     * 0.6.4: add manpage and cabal-rpm-diff wrapper     .
man/cabal-rpm.1 view
@@ -1,4 +1,4 @@-.TH CABAL-RPM 1 "2012-09-24" +.TH CABAL-RPM 1 "2012-11-01"  .SH NAME .PP cabal-rpm - generates RPM .spec files from Cabal packages@@ -24,25 +24,31 @@ .PP 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.+.PP+The cabal-rpm-diff command can be used in the same way to output a diff+of .spec and .spec.cabal-rpm directly. .SH OPTIONS .TP-.B -h+.B -h, --help Show the help text. .RS .RE .TP-.B --name \f[I]NAME\f[]-Override the RPM package name to be \f[I]NAME\f[]+.B -l, --library+Force a BinLib package with executable(s) to be considered a Lib+package. .RS .RE .PP--f \f[I]FLAGS\f[] : Override one or more Cabal build configuration-flags.+-f \f[I]FLAGS\f[], --flags=\f[I]FLAGS\f[] : Override one or more Cabal+build configuration flags. .PP --release=\f[I]RELEASE\f[] : Override the release number in the .spec file. .PP--v \f[I]N\f[] : Set verbosity to \f[I]N\f[].+-v \f[I]N\f[], --verbose=\f[I]N\f[] : Set verbosity to \f[I]N\f[]. .PP --version=\f[I]VERSION\f[] : Override the version number in the .spec file.
man/cabal-rpm.1.md view
@@ -1,6 +1,6 @@ % CABAL-RPM(1) % This manpage was written by Jens Petersen-% 2012-09-24+% 2012-11-01  # NAME cabal-rpm - generates RPM .spec files from Cabal packages@@ -22,21 +22,25 @@ 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. +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.+ # OPTIONS--h+-h, --help :   Show the help text. ---name *NAME*-:   Override the RPM package name to be *NAME*+-l, --library+:   Force a BinLib package with executable(s) to be considered a Lib package. --f *FLAGS*+-f *FLAGS*, --flags=*FLAGS* : Override one or more Cabal build configuration flags.  --release=*RELEASE* : Override the release number in the .spec file. --v *N*+-v *N*, --verbose=*N* : Set verbosity to *N*.  --version=*VERSION*
src/Distribution/Package/Rpm.hs view
@@ -19,49 +19,49 @@     ) where  --import Control.Exception (bracket)-import Control.Monad (when, unless)-import Data.Char (toLower)-import Data.List (intercalate, isPrefixOf, isSuffixOf, nub)-import Data.Maybe (fromMaybe)-import Data.Time.Clock (UTCTime, getCurrentTime)+import Control.Monad    (unless, when)+import Data.Char        (toLower)+import Data.List        (intercalate, isPrefixOf, isSuffixOf, nub)+import Data.Maybe       (fromMaybe)+import Data.Time.Clock  (UTCTime, getCurrentTime) import Data.Time.Format (formatTime)-import Data.Version (showVersion)+import Data.Version     (showVersion)+ --import System.Cmd (system) import System.Directory (doesDirectoryExist, doesFileExist,                          getDirectoryContents) --import System.Exit (ExitCode(..))-import System.IO (IOMode(..), hClose, hPutStrLn, openFile)+import System.IO     (IOMode (..), hClose, hPutStrLn, openFile) import System.Locale (defaultTimeLocale) --import System.Process (runInteractiveCommand, waitForProcess)+import System.FilePath (dropFileName)+--import System.Posix.Files (setFileCreationMask) -import System.FilePath (dropFileName) --(</>)-import Distribution.Compiler (CompilerFlavor(..))-import Distribution.Simple.Compiler (Compiler(..))-import Distribution.System (Platform(..), buildOS, buildArch)-import Distribution.License (License(..))-import Distribution.Package (Dependency(..), PackageIdentifier(..), PackageName(..))+import Distribution.Compiler (CompilerFlavor (..))+import Distribution.License  (License (..))+import Distribution.Package  (Dependency (..), PackageIdentifier (..),+                              PackageName (..))++import Distribution.Simple.Compiler (Compiler (..)) --import Distribution.Simple.PreProcess (knownSuffixHandlers)-import Distribution.Simple.Program (defaultProgramConfiguration) import Distribution.Simple.Configure (configCompiler)+import Distribution.Simple.Program   (defaultProgramConfiguration) --import Distribution.Simple.LocalBuildInfo (LocalBuildInfo) --import Distribution.Simple.SrcDist (createArchive, prepareTree) import Distribution.Simple.Utils (die, warn)-import Distribution.PackageDescription (-- BuildInfo(..),-                                        GenericPackageDescription(..),-                                        PackageDescription(..),-                                        exeName,-                                        hasExes,-                                        hasLibs,-                                        withExe,---                                        withLib-                                       )++import Distribution.PackageDescription (GenericPackageDescription (..),+                                        PackageDescription (..), exeName,+                                        hasExes, hasLibs, withExe)+ import Distribution.PackageDescription.Configuration (finalizePackageDescription)+ import Distribution.PackageDescription.Parse (readPackageDescription) --import Distribution.Verbosity (Verbosity)-import Distribution.Version (VersionRange, foldVersionRange')+--import Distribution.Version (VersionRange, foldVersionRange') --import Distribution.Simple.Setup (configConfigurationsFlags, emptyConfigFlags)-import Distribution.Package.Rpm.Setup (RpmFlags(..))---import System.Posix.Files (setFileCreationMask)+import Distribution.Package.Rpm.Setup (RpmFlags (..))+import Distribution.System            (Platform (..), buildArch, buildOS)  import qualified Paths_cabal_rpm (version) @@ -164,12 +164,12 @@     defRelease <- defaultRelease now     let pkg = package pkgDesc         PackageName packageName = pkgName pkg-        name = fromMaybe (if isExec then packageName else "ghc-" ++ packageName) (rpmName flags)+        name = if isExec then packageName else "ghc-" ++ packageName         pkg_name = if isExec then "%{name}" else "%{pkg_name}"         version = fromMaybe ((showVersion . pkgVersion) pkg) (rpmVersion flags)         release = fromMaybe defRelease (rpmRelease flags)         specPath = name ++ ".spec"-        isExec = hasExes pkgDesc+        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@@ -182,6 +182,7 @@         putDef v s = put $ "%global" +-+ v +-+ s         date = formatTime defaultTimeLocale "%a %b %e %Y" now +    put "# https://fedoraproject.org/wiki/Packaging:Haskell"     put "# https://fedoraproject.org/wiki/PackagingDrafts/Haskell"     putNewline @@ -224,11 +225,16 @@     putHdr "Source0" $ "http://hackage.haskell.org/packages/archive/" ++ pkg_name ++ "/%{version}/" ++ pkg_name ++ "-%{version}.tar.gz"     putNewline     putHdr "BuildRequires" "ghc-Cabal-devel"-    putHdr "BuildRequires" $ "ghc-rpm-macros" ++ (if isLib then " %{!?without_hscolour:hscolour}" else "")+    putHdr "BuildRequires" $ "ghc-rpm-macros"      put "# Begin cabal-rpm deps:"-    let  extDeps = map (nub . showDep) (buildDepends pkgDesc)-    mapM_ (putHdr "BuildRequires" . intercalate ", ") extDeps+    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"      putNewline@@ -341,25 +347,6 @@ --     let externalDeps = (buildDepends pkgDesc) --     clauses <- mapM (showRpmReq verbose) externalDeps --     return $ (commaSep . concat) clauses---- | Represent a dependency in a form suitable for an RPM spec file.-showDep :: Dependency -> [String]-showDep (Dependency (PackageName pkg) range) =-  map (ghc_devel +-+) (renderVersion range)-  where-    renderVersion :: VersionRange -> [String]-    renderVersion = foldVersionRange'-          [""] -- any-          (\ v -> ["=" +-+ showVersion v])-          (\ v -> [">" +-+ showVersion v])-          (\ v -> ["<" +-+ showVersion v])-          (\ v -> [">=" +-+ showVersion v])-          (\ v -> ["<=" +-+ showVersion v])-          (\ x y -> [">=" +-+ showVersion x , "<" +-+ showVersion y])-          (\ _ _ -> [""]) -- rpm can't handle ||-          (++)-          id-    ghc_devel = "ghc-" ++ pkg ++ "-devel"  -- -- | Find the paths to all "extra" libraries specified in the package -- -- config.  Prefer shared libraries, since that's what gcc prefers.
src/Distribution/Package/Rpm/Setup.hs view
@@ -17,30 +17,31 @@     , parseArgs     ) where -import Control.Monad (when, unless)-import Data.Char (toLower)--- import Distribution.Simple.Setup-import Distribution.PackageDescription (FlagName(..))-import Distribution.ReadE (readEOrFail)-import Distribution.Verbosity (Verbosity, normal, flagToVerbosity)+import Control.Monad (unless, when)+import Data.Char     (toLower)++import Distribution.PackageDescription (FlagName (..))+import Distribution.ReadE              (readEOrFail)+import Distribution.Verbosity          (Verbosity, flagToVerbosity, normal)+ import System.Console.GetOpt (ArgDescr (..), ArgOrder (..), OptDescr (..),-                              usageInfo, getOpt')-import System.Environment (getProgName)-import System.Exit (exitWith, ExitCode (..), exitSuccess)-import System.IO (Handle, hPutStrLn, hPutStr, stderr, stdout)+                              getOpt', usageInfo)+import System.Environment    (getProgName)+import System.Exit           (ExitCode (..), exitSuccess, exitWith)+import System.IO             (Handle, hPutStr, hPutStrLn, stderr, stdout)  data RpmFlags = RpmFlags     { rpmConfigurationsFlags :: [(FlagName, Bool)]-    , rpmGenSpec :: Bool-    , rpmHaddock :: Bool-    , rpmHelp :: Bool-    , rpmLibProf :: Bool-    , rpmName :: Maybe String-    , rpmOptimisation :: Bool-    , rpmRelease :: Maybe String-    , rpmTopDir :: Maybe FilePath-    , rpmVerbosity :: Verbosity-    , rpmVersion :: Maybe String+    , rpmGenSpec             :: Bool+    , rpmHaddock             :: Bool+    , rpmHelp                :: Bool+    , rpmLibProf             :: Bool+    , rpmLibrary             :: Bool+    , rpmOptimisation        :: Bool+    , rpmRelease             :: Maybe String+    , rpmTopDir              :: Maybe FilePath+    , rpmVerbosity           :: Verbosity+    , rpmVersion             :: Maybe String     }     deriving (Eq, Show) @@ -52,7 +53,7 @@     , rpmHaddock = True     , rpmHelp = False     , rpmLibProf = True-    , rpmName = Nothing+    , rpmLibrary = False     , rpmOptimisation = True     , rpmRelease = Nothing     , rpmTopDir = Nothing@@ -68,8 +69,8 @@              "Generate a spec file, nothing more",       Option "h?" ["help"] (NoArg (\x -> x { rpmHelp = True }))              "Show this help text",-      Option "" ["name"] (ReqArg (\name x -> x { rpmName = Just name }) "NAME")-             "Override the default package name",+      Option "l" ["library"] (NoArg (\x -> x { rpmLibrary = True }))+             "Ignore executables and force package to be a library",       Option "" ["disable-haddock"] (NoArg (\x -> x { rpmHaddock = False }))              "Don't generate API docs",       Option "" ["disable-library-profiling"] (NoArg (\x -> x { rpmLibProf = False }))