cabal-rpm 2.0.0 → 2.0.1
raw patch · 5 files changed
+69/−26 lines, 5 files
Files
- ChangeLog +7/−2
- TODO +13/−0
- cabal-rpm.cabal +1/−1
- src/Commands/Install.hs +1/−1
- src/Commands/Spec.hs +47/−22
ChangeLog view
@@ -1,4 +1,9 @@-# 2.0.0 (2020-01-15)+# 2.0.1 (2020-02-06)+- quote macros in commented fields+- read --subpackage from spec header+- generate BRs for subpackages++# 2.0.0 (2020-01-16) - major refactor to handle stream/pkgid more precisely and correctly (hence major version bump due to behavior changes) - eg can no longer specify both stream and pkg-ver@@ -7,7 +12,7 @@ - respect and read/write --standalone and --stream in spec header consistently (note default LTS stream is not written to header) - fix infinite loop for 'install'-- optioanlly use libcurl binding instead of former stackage-query fallback+- optionally use libcurl binding instead of former stackage-query fallback # 1.0.3 (2019-12-31) - define %_devel for f30 packaging compatibility
TODO view
@@ -1,11 +1,24 @@+- refresh: avoid checking subpackaging versions+- spec: avoid rechecking subpackage versions (when checking for their deps)++- --subpackage should add missing (Prof) deps+ (testcase (git-annex) add subpackage to non-lib package needs base-prof etc)++- builddep repeats looking for versions of missing packages+ https://github.com/juhp/cabal-rpm/issues/60+ - --without-tests/--disable-tests for install etc - don't install prof deps for --standalone: use rpmspec to read BRs? +- `cblrpm update -s lts` runs cabal update, even when already latest!+ * filter dummy pkgs like fail, bytestring-builder and mtl-compat - switch to Cabal 2 for better License handling - check/warn about executable doc files! - add rpmlint command++- only "cabal update" when needed - spec --bounds - rework "BR: ghc-*-static" with %{?_isa}
cabal-rpm.cabal view
@@ -1,5 +1,5 @@ Name: cabal-rpm-Version: 2.0.0+Version: 2.0.1 Synopsis: RPM packaging tool for Haskell Cabal-based packages Description: This package provides a RPM packaging tool for Haskell Cabal-based packages.
src/Commands/Install.hs view
@@ -8,7 +8,7 @@ -- Stability : alpha -- Portability : portable ----- Explanation: cabal wrapper which installs rpm dependencies+-- Explanation: installs rpms of package and dependencies -- 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
src/Commands/Spec.hs view
@@ -93,7 +93,7 @@ createSpecFile :: Verbosity -> Flags -> Bool -> PackageType -> Bool -> Maybe FilePath -> Maybe PackageVersionSpecifier -> IO FilePath-createSpecFile verbose flags force pkgtype subpackage mdest mpvs = do+createSpecFile verbose flags force pkgtype subpkgOpt mdest mpvs = do pkgdata <- prepare flags mpvs True let mspec = case pkgtype of SpecFile f -> Just f@@ -104,16 +104,34 @@ pkgid = package pkgDesc name = display $ pkgName pkgid - standalone <- if pkgtype == StandalonePkg then return True- else- case mspec of- Nothing -> return False- Just spec -> do- specExists <- doesFileExist spec- if specExists then- withSpecHead spec $ return . ("--standalone" `elem`)- else return False+ standalone <-+ if pkgtype == StandalonePkg then return True+ else+ case mspec of+ Nothing -> return False+ Just spec -> do+ specExists <- doesFileExist spec+ if specExists then+ withSpecHead spec $ return . ("--standalone" `elem`)+ else return False + subpackage <-+ if subpkgOpt+ then+ if pkgtype == StandalonePkg+ then do+ warn verbose "ignoring --subpackage for --standalone"+ return False+ else return True+ else+ case mspec of+ Nothing -> return False+ Just spec -> do+ specExists <- doesFileExist spec+ if specExists then+ withSpecHead spec $ return . ("--subpackage" `elem`)+ else return False+ let hasExec = hasExes pkgDesc hasLib = hasLibs pkgDesc hasLibPkg = hasLib && not standalone@@ -151,7 +169,7 @@ h <- openFile outputFile WriteMode let putHdr hdr val = hPutStrLn h (hdr ++ ":" ++ padding hdr ++ val) padding hdr = replicate (14 - length hdr) ' ' ++ " "- putHdrComment hdr val = putHdr ('#':hdr) (' ':val)+ putHdrComment hdr val = putHdr ('#':hdr) (' ':quoteMacros val) putNewline = hPutStrLn h "" sectionNewline = putNewline >> putNewline put = hPutStrLn h@@ -231,9 +249,10 @@ putNewline let testsuiteDeps = testsuiteDependencies' pkgDesc- unless (null testsuiteDeps) $ do- missTestDeps <- filterM notSrcOrInst $ map (RpmHsLib Devel) testsuiteDeps- put $ "%bcond_" ++ (if null missTestDeps then "without" else "with") +-+ "tests"+ missTestDeps <- filterM notSrcOrInst $ map (RpmHsLib Devel) testsuiteDeps+ let testable = not (null testsuiteDeps) && null missTestDeps+ when testable $ do+ put "%bcond_without tests" putNewline let version = display $ pkgVersion pkgid@@ -280,7 +299,7 @@ -- any (\ d -> d `elem` map showDep ["template-haskell", "hamlet"]) deps) $ -- putHdr "ExclusiveArch" "%{ghc_arches_with_ghci}" let testDeps = sort $ testsuiteDeps \\ (mkPackageName "Cabal" : (deps ++ setupDeps))- unless (null testDeps) $ do+ when (testable && not (null testDeps)) $ do put "%if %{with tests}" mapM_ (putHdr "BuildRequires" . showRpm . RpmHsLib Devel) testDeps put "%endif"@@ -289,18 +308,20 @@ versionRelease = " = %{version}-%{release}" when common $ putHdr "Requires" $ "%{name}-common" ++ versionRelease- put "# End cabal-rpm deps"- when standalone $ do- putHdr "BuildRequires" "cabal-install > 1.18"+ when (standalone || subpackage) $ do+ when standalone $+ putHdr "BuildRequires" "cabal-install > 1.18" unless (null missingLibs) $ do putStrLn "checking for deps of missing dependencies:"- let putPkgDeps pkg = do+ let deptype = if standalone then Devel else Prof+ putPkgDeps pkg = do more <- packageDeps flags Nothing pkg let moredeps = more \\ (deps ++ missingLibs) unless (null moredeps) $ do- put $ "# for missing dep:" +-+ display pkg ++ ":"- mapM_ (\ d -> (if d `elem` missingLibs then putHdrComment else putHdr) "BuildRequires" (showRpm (RpmHsLib Devel d))) moredeps+ put $ "# for missing dep '" ++ display pkg ++ "':"+ mapM_ (\ d -> (if d `elem` missingLibs then putHdrComment else putHdr) "BuildRequires" (showRpm (RpmHsLib deptype d))) moredeps mapM_ putPkgDeps missingLibs+ put "# End cabal-rpm deps" putNewline put "%description"@@ -440,7 +461,7 @@ put "# End cabal-rpm install" sectionNewline - unless (null testsuiteDeps) $ do+ when testable $ do put "%check" put "%cabal_test" sectionNewline@@ -614,3 +635,7 @@ hasExec = hasExes pkgDesc hasLib = hasLibs pkgDesc return $ if binary || hasExec && not hasLib then (name, hasLib) else ("ghc-" ++ name, False)++quoteMacros :: String -> String+quoteMacros "" = ""+quoteMacros (c:cs) = (if c == '%' then "%%" else [c]) ++ quoteMacros cs