cabal-rpm 2.0.7 → 2.0.8
raw patch · 9 files changed
+56/−36 lines, 9 files
Files
- ChangeLog +11/−0
- README.md +3/−3
- TODO +2/−1
- cabal-rpm.cabal +2/−2
- src/Commands/Spec.hs +18/−23
- src/Commands/Update.hs +14/−1
- src/Dependencies.hs +2/−1
- src/PackageUtils.hs +1/−2
- src/Stackage.hs +3/−3
ChangeLog view
@@ -1,3 +1,14 @@+# 2.0.8 (2021-03-27)+- update: make sure krb ticket exists before uploading source+- spec: executable doc files now handled by ghc-rpm-macros+- move dos2unix for revised DOS .cabal from download to spec build time+- spec: do not enable testsuite for standalone package+- spec: also bash-completion for simple-cmd-args+- spec: for bash-completions use default not filenames+- Stackage: use lts-17+- pkgInstallMissing: also install ghc-rpm-macros+- spec: make %cabal_test conditional explicit+ # 2.0.7 (2020-10-07) - spec: setup bash completions for optparse-applicative - spec: --ignore-missing to ignore deps not yet in hackage
README.md view
@@ -1,10 +1,10 @@-[](https://travis-ci.org/juhp/cabal-rpm)+# cabal-rpm++[](https://github.com/juhp/cabal-rpm/actions) [](https://hackage.haskell.org/package/cabal-rpm) [](https://stackage.org/lts/package/cabal-rpm) [](https://stackage.org/nightly/package/cabal-rpm) [](https://www.gnu.org/licenses/gpl.html)--# cabal-rpm cabal-rpm is a tool for RPM packaging of Haskell Cabal-based packages. Firstly it creates RPM spec files from the .cabal files of Haskell packages.
TODO view
@@ -1,3 +1,5 @@+- spec: hardcode list of dummy packages (mtl-compat, etc)+ - update prints package name twice (due to spec generation?) - in container/clean install: cblrpm local HsOpenSSL fails: cabal-rpm: HsOpenSSL-0.11.4.17: getDirectoryContents:openDirStream: does not exist (No such file or directory)@@ -27,7 +29,6 @@ - update --stream should add --stream to header - cleanup .Cblrpm - update/diff should remove dropped subpackages-- check krb5 ticket before attempting source upload - --without-tests/--disable-tests/--no-tests (also for install etc) - or default to no tests and explicitly enable with --tests
cabal-rpm.cabal view
@@ -1,5 +1,5 @@ Name: cabal-rpm-Version: 2.0.7+Version: 2.0.8 Synopsis: RPM packaging tool for Haskell Cabal-based packages Description: This package provides a RPM packaging tool for Haskell Cabal-based packages.@@ -19,7 +19,7 @@ Author: Jens Petersen <juhpetersen@gmail.com>, Bryan O'Sullivan <bos@serpentine.com> Maintainer: Jens Petersen <petersen@fedoraproject.org> Copyright: 2007-2008 Bryan O'Sullivan <bos@serpentine.com>,- 2012-2020 Jens Petersen <juhpetersen@gmail.com>+ 2012-2021 Jens Petersen <juhpetersen@gmail.com> Category: Distribution Build-type: Simple Extra-doc-files: ChangeLog README.md TODO
src/Commands/Spec.hs view
@@ -32,6 +32,7 @@ #if MIN_VERSION_simple_cmd(0,2,2) grep, #endif+ cmd, cmdMaybe, grep_, removePrefix) import Stackage (defaultLTS)@@ -73,7 +74,7 @@ #endif import Distribution.Verbosity (Verbosity) -import System.Directory (doesDirectoryExist, doesFileExist, executable, getPermissions)+import System.Directory (doesFileExist) import System.IO (IOMode (..), hClose, hPutStrLn, openFile) #if defined(MIN_VERSION_time) && MIN_VERSION_time(1,5,0) import Data.Time.Format (defaultTimeLocale)@@ -267,11 +268,11 @@ let (testsuiteDeps,testsuiteTools) = testsuiteDependencies' pkgDesc missTestDeps <- filterM (notSrcOrInst . RpmHsLib Devel) testsuiteDeps- let testable = notNull testsuiteDeps && (null missTestDeps || testsuite)+ let testable = notNull testsuiteDeps && not standalone && (null missTestDeps || testsuite) if testable then do put "%bcond_without tests" putNewline- else unless (null testsuiteDeps) $ do+ else unless (null testsuiteDeps || standalone) $ do put $ "# testsuite missing deps: " ++ unwords (map display missTestDeps) putNewline let version = display $ pkgVersion pkgid@@ -285,6 +286,11 @@ have <- doesFileExist local if have then grep_ "x-revision" local else return False else return False+ revisedDOS <- if revised then do+ filetype <- cmd "file" ["-b", display pkgid <.> "cabal"]+ return $ "CRLF" `isInfixOf` filetype+ else return False+ putHdr "Name" (if binlib then "%{pkg_name}" else basename) putHdr "Version" version when hasSubpkgs $@@ -306,6 +312,7 @@ put "# End cabal-rpm sources" putNewline put "# Begin cabal-rpm deps:"+ when revisedDOS $ putHdr "BuildRequires" "dos2unix" when (mkPackageName "Cabal" `notElem` buildDeps pkgdeps || not hasLib || notNull (setupDeps pkgdeps)) $ do -- put "# Setup" when (mkPackageName "Cabal" `notElem` buildDeps pkgdeps) $@@ -441,23 +448,9 @@ put $ "%setup -q" ++ (if pkgname /= name then " -n" +-+ pkgver else "") +-+ (if hasSubpkgs then unwords (map (("-a" ++) . fst) $ number subpkgs) else "") when revised $- put $ "cp -bp %{SOURCE" ++ show (1 + length subpkgs) ++ "}" +-+ pkg_name <.> "cabal"- let extrasourcedocs = sort $ filter (`elem` docs) $ extraSrcFiles pkgDesc- unless (null extrasourcedocs) $ do- let pkgdir = display pkgid- havePrep <- doesDirectoryExist pkgdir- if havePrep then do- executabledocs <- do- exedocs <- filterM (fmap executable . getPermissions . (pkgdir </>)) extrasourcedocs- if notNull exedocs then- return exedocs- else do- if topSpecExists then do- ((words . removePrefix "chmod a-x ") =<<) <$> grep "^chmod a-x " topSpecFile- else return []- unless (null executabledocs) $- put $ "chmod a-x" +-+ unwords executabledocs- else warn verbose $ "Check file permissions of" +-+ unwords extrasourcedocs+ put $ (if revisedDOS+ then "dos2unix -k -n" else "cp -bp")+ +-+ "%{SOURCE" ++ show (1 + length subpkgs) ++ "}" +-+ pkg_name <.> "cabal" put "# End cabal-rpm setup" sectionNewline @@ -515,10 +508,11 @@ let execs = sort $ map exeName $ filter isBuildable $ executables pkgDesc execNaming p = let pn = unUnqualComponentName p in if pn == name then "%{name}" else pn+ bashCompletions = hasExecPkg && any ((`elem` buildDeps pkgdeps) . mkPackageName) ["optparse-applicative","simple-cmd-args"] - when (hasExecPkg && mkPackageName "optparse-applicative" `elem` buildDeps pkgdeps) $ do+ when bashCompletions $ do put "mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/"- mapM_ (\ ex -> let exn = execNaming ex in put ("%{buildroot}%{_bindir}" </> exn ++ " --bash-completion-script " ++ exn ++ " > %{buildroot}%{_datadir}/bash-completion/completions" </> exn)) execs+ mapM_ (\ ex -> let exn = execNaming ex in put ("%{buildroot}%{_bindir}" </> exn ++ " --bash-completion-script " ++ exn ++ " | sed s/filenames/default/ > %{buildroot}%{_datadir}/bash-completion/completions" </> exn)) execs put "# End cabal-rpm install" sectionNewline@@ -542,7 +536,8 @@ mapM_ (put . ("%{_bindir}" </>) . execNaming) execs unless (common || null datafiles) $ put $ "%{_datadir}" </> pkgver- when (hasExecPkg && mkPackageName "optparse-applicative" `elem` buildDeps pkgdeps) $ mapM_ (put . ("%{_datadir}/bash-completion/completions" </>) . execNaming) execs+ when bashCompletions $+ mapM_ (put . ("%{_datadir}/bash-completion/completions" </>) . execNaming) execs put "# End cabal-rpm files" sectionNewline
src/Commands/Update.hs view
@@ -42,7 +42,8 @@ import Control.Applicative ((<$>)) #endif import Control.Monad.Extra-import Data.Maybe (isJust)+import Data.List+import Data.Maybe import Distribution.Text (display) import Distribution.Verbosity (silent) import System.Directory (createDirectoryIfMissing, doesDirectoryExist,@@ -127,6 +128,7 @@ distgit <- grepGitConfig "\\(pkgs\\|src\\)." when (rwGit && distgit) $ do when updated $ do+ krbTicket cmd_ "fedpkg" ["new-sources", display newPkgId <.> "tar.gz"] when subpkg $ do shell_ $ "cat sources >>" +-+ "sources.cblrpm"@@ -160,3 +162,14 @@ gitBool c args = cmdBool "git" (c:args) #endif++krbTicket :: IO ()+krbTicket = do+ krb <- words . fromMaybe "" . find ("@FEDORAPROJECT.ORG" `isInfixOf`) . lines <$> cmd "klist" ["-l"]+ if null krb+ then error' "No krb5 ticket found for FEDORAPROJECT.ORG"+ else+ when (last krb == "(Expired)") $ do+ putStrLn $ unwords krb+ cmd_ "kinit" [head krb]+ putStrLn ""
src/Dependencies.hs view
@@ -270,7 +270,8 @@ mapM_ (putStrLn . display) repopkgs -- fedora <- rpmEval "%fedora" -- let nogpgcheck = ["--nogpgcheck" | fedora `elem` []]- rpmInstall True $ map (showRpm . RpmHsLib Prof) repopkgs+ noMacros <- notInstalled (RpmOther "ghc-rpm-macros")+ rpmInstall True $ (map (showRpm . RpmHsLib Prof) repopkgs) ++ ["ghc-rpm-macros" | noMacros] return missing' where repoqueryPackageConf :: String -> PackageName -> IO (Maybe PackageName)
src/PackageUtils.hs view
@@ -190,8 +190,7 @@ then return False else do revised <- grep_ "x-revision" file- when revised $ do- cmd_ "dos2unix" ["--keepdate", file]+ when revised $ renameFile file $ dir </> display pkgid <.> "cabal" return revised
src/Stackage.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Stackage--- Copyright : (C) 2017-2020 Jens Petersen+-- Copyright : (C) 2017-2021 Jens Petersen -- -- Maintainer : Jens Petersen <petersen@fedoraproject.org> -- Stability : alpha@@ -41,10 +41,10 @@ import Types defaultLTS :: Stream-defaultLTS = LTS 16+defaultLTS = LTS 17 latestLTS :: Stream-latestLTS = LTS 16+latestLTS = LTS 17 stackageList :: Stream -> PackageName -> IO (Maybe PackageIdentifier) stackageList stream pkg = do