packages feed

cabal-rpm 0.8.0 → 0.8.1

raw patch · 3 files changed

+51/−33 lines, 3 files

Files

NEWS view
@@ -1,3 +1,8 @@+* 0.8.1 (2013-06-14)+- word wrapping of descriptions+- use generic description for shared subpackage+- simplify logic for summary and description processing+ * 0.8.0 (2013-05-31) - new simplier revision to Fedora Packaging   - drop %common_summary and %common_description
cabal-rpm.cabal view
@@ -1,30 +1,20 @@ Name:                cabal-rpm-Version:             0.8.0+Version:             0.8.1 Synopsis:            RPM package creator for Haskell Cabal-based packages Description:-    This package generates RPM spec files from Haskell Cabal packages.+    This package generates RPM packages from Haskell Cabal packages.     .     Recent changes:     .+    * 0.8.1: word wrapping of descriptions+    .     * 0.8.0: new simpler revised Fedora packaging; check external commands available     .     * 0.7.1: various bugfixes and minor improvments     .     * 0.7.0: command arg for spec, srpm, or build; installs existing packaged depends with sudo yum     .-    * 0.6.6: generate depends for extra-libraries, build-tools, and pkgconfig-depends-    .-    * 0.6.5: simplify BuildRequires without versions and drop explicit hscolour-    .-    * 0.6.4: add manpage and cabal-rpm-diff wrapper-    .-    * 0.6.3: accept tarball arg, use temporary working directory, and add manpage-    .-    * 0.6.2: fix L/GPL version output-    .-    * 0.6.1: fix bugs for 'cabal-rpm pkg' unpacking and extra docs-    .-    * 0.6.0: new update and release for Cabal >= 1.10+    See <https://github.com/juhp/cabal-rpm/blob/master/NEWS> for more details. Homepage:            https://github.com/juhp/cabal-rpm Bug-reports:         https://github.com/juhp/cabal-rpm/issues License:             GPL-3
src/Distribution/Package/Rpm.hs view
@@ -21,7 +21,7 @@ --import Control.Exception (bracket) import Control.Monad    (unless, void, when) import Data.Char        (toLower)-import Data.List        (isPrefixOf, isSuffixOf, nub, sort)+import Data.List        (groupBy, isPrefixOf, isSuffixOf, nub, sort) import Data.Maybe       (fromMaybe) import Data.Time.Clock  (UTCTime, getCurrentTime) import Data.Time.Format (formatTime)@@ -183,22 +183,20 @@      -- Some packages conflate the synopsis and description fields.  Ugh.     let syn = synopsis pkgDesc-    (syn', synTooLong) <- case lines syn of-              (x:_) -> return (x, x /= syn)-              _ -> do warn verbose "This package has no synopsis."-                      return ("Haskell" +-+ name +-+ "package", False)-    let summary = if synTooLong-                         then syn' +-+ "[...]"-                         else rstrip (== '.') syn'-    when synTooLong $+    when (null syn) $+      warn verbose "This package has no synopsis."+    let syn' = if (null syn)+              then ("Haskell" +-+ name +-+ "package")+              else (unwords $ lines syn)+    let summary = rstrip (== '.') syn'+    when ((length . lines) syn > 1) $       warn verbose "The synopsis for this package spans multiple lines." -    let common_description = (lines . finalPeriod) $-          if (null . description) pkgDesc-              then if synTooLong-                   then syn-                   else "This package does not have a description."-              else description pkgDesc+    let descr = description pkgDesc+    when (null descr) $+      warn verbose "This package has no description."+    let common_description = (formatParagraphs . lines . finalPeriod) $+          if (null descr) then syn' else descr         finalPeriod cs = if (last cs == '.') then cs else cs ++ "."     when isLib $ do       putDef "pkg_name" name@@ -249,7 +247,6 @@      put "%description"     put $ unlines common_description-    putNewline      when isLib $ do       when isExec $ do@@ -257,8 +254,9 @@         putHdr "Summary" $ "Haskell" +-+ pkg_name +-+ "library"         putNewline         put $ "%description" +-+ ghcPkg-        put $ unlines common_description+        put $ "This package provides the Haskell" +-+ pkg_name +-+ "shared library."         putNewline+        putNewline       put $ "%package" +-+ ghcPkgDevel       putHdr "Summary" $ "Haskell" +-+ pkg_name +-+ "library development files"       putHdr "Requires" "ghc-compiler = %{ghc_version}"@@ -272,8 +270,14 @@         put "# End cabal-rpm deps"       putNewline       put $ "%description" +-+ ghcPkgDevel-      put $ "This package provides the Haskell" +-+ name +-+ "library development files."+      let devel_descr_start = "This package provides the development files for"+          devel_descr_middle = "the Haskell"+          devel_descr_end = "library."+          devel_descr_long = (length $ devel_descr_start +-+ devel_descr_middle +-+ name +-+ devel_descr_end) > 79+      put $ "This package provides the development files for" +++        (if devel_descr_long then "\n" else " ") ++ "the Haskell" +-+ pkg_name +-+ "library."       putNewline+      putNewline      put "%prep"     put $ "%setup -q" ++ (if pkgname /= name then " -n %{pkg_name}-%{version}" else "")@@ -369,3 +373,22 @@ showLicense (Apache Nothing) = "ASL ?" showLicense (Apache (Just ver)) = "ASL" +-+ showVersion ver #endif++-- from http://stackoverflow.com/questions/930675/functional-paragraphs+-- using split would be: map unlines . (Data.List.Split.splitWhen null)+paragraphs :: [String] -> [String]+paragraphs = map unlines . map (filter $ not . null) . groupBy (const $ not . null)++-- http://rosettacode.org/wiki/Word_wrap#Haskell+wordwrap :: Int -> String -> String+wordwrap maxlen = (wrap_ 0) . words where+	wrap_ _ [] = "\n"+	wrap_ pos (w:ws)+		-- at line start: put down the word no matter what+		| pos == 0 = w ++ wrap_ (pos + lw) ws+		| pos + lw + 1 > maxlen = '\n':wrap_ 0 (w:ws)+		| otherwise = " " ++ w ++ wrap_ (pos + lw + 1) ws+		where lw = length w++formatParagraphs :: [String] -> [String]+formatParagraphs = map (wordwrap 79) . paragraphs