cabal2spec 2.1.1 → 2.2.0
raw patch · 5 files changed
+70/−67 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Cabal2Spec: type RunTests = Bool
- Cabal2Spec: cabal2spec :: Platform -> CompilerId -> FlagAssignment -> ForceBinary -> FilePath -> FilePath -> IO ()
+ Cabal2Spec: cabal2spec :: Platform -> CompilerId -> FlagAssignment -> ForceBinary -> RunTests -> FilePath -> FilePath -> IO ()
- Cabal2Spec: createSpecFile :: FilePath -> PackageDescription -> ForceBinary -> FlagAssignment -> IO ()
+ Cabal2Spec: createSpecFile :: FilePath -> PackageDescription -> ForceBinary -> RunTests -> FlagAssignment -> IO ()
Files
- README.md +5/−0
- cabal2spec.cabal +49/−57
- cabal2spec/Main.hs +4/−2
- src/Cabal2Spec.hs +11/−7
- test/Main.hs +1/−1
README.md view
@@ -1,6 +1,11 @@ cabal2spec ========== +[](http://hackage.haskell.org/package/cabal2spec)+[](http://stackage.org/lts/package/cabal2spec)+[](http://stackage.org/nightly/package/cabal2spec)+[](https://travis-ci.org/peti/cabal2spec)+ The `cabal2spec` utility converts a given Cabal file into an [RPM spec file](http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html) that builds that package with the RPM package manager. This tool is used to generate
cabal2spec.cabal view
@@ -1,65 +1,57 @@-name: cabal2spec-version: 2.1.1-synopsis: Convert Cabal files into rpm spec files-homepage: https://github.com/peti/cabal2spec-license: GPL-3-license-file: LICENSE-author: Peter Simons, Bryan O'Sullivan, Jens Petersen-maintainer: simons@cryp.to-category: Distribution-build-type: Simple-cabal-version: >=1.10-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.2--extra-source-files:- README.md- test/golden-test-cases/*.cabal- test/golden-test-cases/*.spec.golden--description:- Convert Cabal files into a- <http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html spec file>- suitable for building the package with the RPM package manager. This tool- primarily targets the <http://www.suse.com/ SUSE> and- <http://www.opensuse.org openSUSE> familiy of distributions. Support for- other RPM-based distributions is currently not available. Check out- <http://hackage.haskell.org/package/cabal-rpm cabal-rpm> if you need this.+name: cabal2spec+version: 2.2.0+synopsis: Convert Cabal files into rpm spec files+description: Convert+ Cabal files into a+ <http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html spec file>+ suitable for building the package with the RPM package manager. This+ tool primarily targets the <http://www.suse.com/ SUSE> and+ <http://www.opensuse.org openSUSE> familiy of distributions. Support+ for other RPM-based distributions is currently not available. Check+ out <http://hackage.haskell.org/package/cabal-rpm cabal-rpm> if you+ need this.+license: GPL-3+license-file: LICENSE+author: Peter Simons, Bryan O'Sullivan, Jens Petersen+maintainer: simons@cryp.to+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3+category: Distribution+homepage: https://github.com/peti/cabal2spec+build-type: Simple+extra-source-files: README.md+ test/golden-test-cases/*.cabal+ test/golden-test-cases/*.spec.golden+cabal-version: >= 1.10 source-repository head- type: git- location: git://github.com/peti/cabal2spec.git+ type: git+ location: git://github.com/peti/cabal2spec.git library- hs-source-dirs: src- ghc-options: -Wall- build-depends: base < 5- , Cabal > 2.2- , filepath- , time >= 1.5- exposed-modules: Cabal2Spec- default-language: Haskell2010+ exposed-modules: Cabal2Spec+ hs-source-dirs: src+ build-depends: base < 5, Cabal > 2.2, filepath, time >= 1.5+ default-language: Haskell2010+ default-extensions: MonadFailDesugaring+ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints executable cabal2spec- main-is: Main.hs- hs-source-dirs: cabal2spec- other-modules: Paths_cabal2spec- build-depends: base < 5- , Cabal > 2.2- , cabal2spec- , filepath- , optparse-applicative- default-language: Haskell2010- ghc-options: -Wall+ main-is: Main.hs+ other-modules: Paths_cabal2spec+ hs-source-dirs: cabal2spec+ build-depends: base < 5, Cabal > 2.2, cabal2spec, filepath, optparse-applicative+ default-language: Haskell2010+ default-extensions: MonadFailDesugaring+ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints test-suite regression-test- type: exitcode-stdio-1.0- main-is: Main.hs- hs-source-dirs: test- build-depends: base- , Cabal > 2.2- , cabal2spec- , filepath- , tasty- , tasty-golden- ghc-options: -Wall- default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Main.hs+ hs-source-dirs: test+ build-depends: base, Cabal > 2.2, cabal2spec, filepath, tasty, tasty-golden+ default-language: Haskell2010+ default-extensions: MonadFailDesugaring+ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints
cabal2spec/Main.hs view
@@ -18,6 +18,7 @@ { optPlatform :: Platform , optCompiler :: CompilerId , optForceExe :: ForceBinary+ , optRunTests :: RunTests , optFlags :: [(FlagName, Bool)] , optOutputFile :: Maybe FilePath , optCabalFile :: FilePath@@ -29,7 +30,8 @@ <$> option (maybeReader simpleParse) (long "platform" <> help "target build platform" <> value buildPlatform <> showDefaultWith (show . display)) <*> option (maybeReader simpleParse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith (show . display)) <*> switch (long "force-exe" <> help "treat this package as a executable-only build even if it defined a library")- <*> many (option (parseFlag) (short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)"))+ <*> switch (long "enable-tests" <> help "enable the test suite in the generated build")+ <*> many (option parseFlag (short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")) <*> optional (strOption (short 'o' <> long "output" <> metavar "FILE" <> help "write generated spec file to this path")) <*> strArgument (metavar "CABAL-FILE") @@ -55,4 +57,4 @@ Options {..} <- execParser pinfo let specFile = fromMaybe (optCabalFile `replaceExtension` "spec") optOutputFile putStrLn $ "Writing spec file to " ++ show specFile ++ " ..."- cabal2spec buildPlatform buildCompilerId (mkFlagAssignment optFlags) True optCabalFile specFile+ cabal2spec buildPlatform buildCompilerId (mkFlagAssignment optFlags) optForceExe optRunTests optCabalFile specFile
src/Cabal2Spec.hs view
@@ -1,4 +1,4 @@-module Cabal2Spec ( cabal2spec, createSpecFile, ForceBinary ) where+module Cabal2Spec ( cabal2spec, createSpecFile, ForceBinary, RunTests ) where import Control.Monad import Data.Char@@ -25,13 +25,15 @@ import System.IO type ForceBinary = Bool+type RunTests = Bool -cabal2spec :: Platform -> CompilerId -> FlagAssignment -> ForceBinary -> FilePath -> FilePath -> IO ()-cabal2spec platform compilerId flags forceBinary cabalFile specFile = do+cabal2spec :: Platform -> CompilerId -> FlagAssignment -> ForceBinary -> RunTests+ -> FilePath -> FilePath -> IO ()+cabal2spec platform compilerId flags forceBinary runTests cabalFile specFile = do gpd <- readGenericPackageDescription silent cabalFile case finalizePD flags requestedComponents (const True) platform (unknownCompilerInfo compilerId NoAbiTag) [] gpd of Left missing -> fail ("finalizePD: " ++ show missing)- Right (pd,_) -> createSpecFile specFile pd forceBinary flags+ Right (pd,_) -> createSpecFile specFile pd forceBinary runTests flags requestedComponents :: ComponentRequestedSpec requestedComponents = defaultComponentRequestedSpec@@ -48,8 +50,8 @@ mapTools "gtk2hsTypeGen" = "gtk2hs-buildtools" mapTools tool = tool -createSpecFile :: FilePath -> PackageDescription -> ForceBinary -> FlagAssignment -> IO ()-createSpecFile specFile pkgDesc forceBinary flagAssignment = do+createSpecFile :: FilePath -> PackageDescription -> ForceBinary -> RunTests -> FlagAssignment -> IO ()+createSpecFile specFile pkgDesc forceBinary runTests flagAssignment = do let deps :: [String] deps = map showDep deps' deps' :: [String]@@ -139,7 +141,9 @@ putDef "has_internal_sub_libraries" "1" unless (null testsuiteDeps) $- put "%bcond_with tests"+ if runTests+ then put "%bcond_without tests"+ else put "%bcond_with tests" let version = packageVersion pkg revision = show $ maybe (0::Int) read (lookup "x-revision" (customFieldsPD pkgDesc))
test/Main.hs view
@@ -24,4 +24,4 @@ (\ref new -> ["diff", "-u", ref, new]) goldenFile specFile- (cabal2spec pid cid mempty True cabalFile specFile)+ (cabal2spec pid cid mempty True False cabalFile specFile)