fbrnch 1.3 → 1.3.1
raw patch · 6 files changed
+34/−13 lines, 6 files
Files
- CHANGELOG.md +5/−0
- fbrnch.cabal +1/−1
- src/Cmd/Bump.hs +1/−1
- src/Cmd/Scratch.hs +2/−2
- src/Package.hs +9/−2
- src/RpmBuild.hs +16/−7
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Changelog +## 1.3.1 (2023-04-09)+- check for %autorelease more carefully+- buildRequires: fix dynamic BRs with getSources and space after %_srcrpmdir+ (reported by kiilerix)+ ## 1.3 (2023-04-08) - new 'autospec' command converts packages to use rpmautospec - new 'move-artifacts' command moves rpmbuild artifacts into dirs (--delete)
fbrnch.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: fbrnch-version: 1.3+version: 1.3.1 synopsis: Fedora packager tool to build package branches description: fbrnch (fedora branch) is a convenient packaging tool for
src/Cmd/Bump.hs view
@@ -55,7 +55,7 @@ case mopt of Just (CommitMsg msg) -> msg _ -> "rebuild"- autorelease <- grep_ " %autorelease" spec+ autorelease <- isAutoRelease spec unless autorelease $ cmd_ "rpmdev-bumpspec" ["-c", clmsg, spec] let copts =
src/Cmd/Scratch.hs view
@@ -72,7 +72,7 @@ return $ nub $ priorityArchs ++ tagArchs else return $ nub $ filter (`elem` archs) priorityArchs ++ archs forM_ archlist $ \arch -> do- putStrLn $ arch ++ " scratch build"+ putStrLn $ arch +-+ "scratch build" doScratchBuild pkggit spec target [arch] else doScratchBuild pkggit spec target archs where@@ -99,7 +99,7 @@ else return False rbr <- anyBranchToRelease br nvr <- pkgNameVerRel' rbr spec- putStrLn $ target ++ " scratch build of " ++ showScratchSource pushed nvr msource+ putStrLn $ target +-+ "scratch build of" +-+ showScratchSource pushed nvr msource unless dryrun $ case msource of Just (ScratchSRPM srpm) ->
src/Package.hs view
@@ -40,7 +40,8 @@ pkgNameVerRel, pkgNameVerRel', equivNVR,- editSpecField+ editSpecField,+ isAutoRelease ) where import Distribution.Fedora hiding (Fedora,EPEL,EPELNext)@@ -345,16 +346,22 @@ msgout = putStrLn $ if quiet then "cloning..." else "Cloning: " ++ pkg +isAutoRelease :: FilePath -> IO Bool+isAutoRelease spec = do+ matches <- filter ("Release:" `isPrefixOf`) <$> grep "%autorelease" spec+ return $ not (null matches)+ pkgNameVerRel :: Branch -> FilePath -> IO (Maybe String) pkgNameVerRel br spec = do disttag <- rpmDistTag <$> branchDist br -- workaround dist with bootstrap hostdist <- cmd "rpm" ["--eval", "%{dist}"] -- FIXME more precise regexp with "Release:"- autorelease <- grep_ " %autorelease" spec+ autorelease <- isAutoRelease spec nvrs <- if autorelease then do+ --putStrLn "%autorelease detected" mautospec <- findExecutable "rpmautospec" when (isNothing mautospec) $ error' "requires rpmautospec.."
src/RpmBuild.hs view
@@ -294,19 +294,28 @@ -- from fedora-haskell-tools buildRequires :: FilePath -> IO [String] buildRequires spec = do- autorelease <- grep_ " %autorelease" spec+ autorelease <- isAutoRelease spec dynbr <- grep_ "^%generate_buildrequires" spec brs <- mapMaybe primary <$> if dynbr then do installMissingMacros spec+ void $ getSources spec withTempDir $ \tmpdir -> do- let srpmdiropt = ["--define", "_srcrpmdir" ++ tmpdir]- out <- cmdIgnoreErr "rpmbuild" (["-br", "--nodeps", spec] ++ srpmdiropt) ""- -- Wrote: /current/dir/SRPMS/name-version-release.buildreqs.nosrc.rpm- case words out of- [] -> error' $ spec +-+ "could not generate source rpm for dynamic buildrequires"- ws -> cmdLines "rpm" ["-qp", "--requires", last ws]+ let srpmdiropt = ["--define", "_srcrpmdir" +-+ tmpdir]+ (ok, out, err) <- cmdFull "rpmbuild" (["-br", "--nodeps", spec] ++ srpmdiropt) ""+ if ok+ then do+ -- Wrote: /current/dir/SRPMS/name-version-release.buildreqs.nosrc.rpm+ case words out of+ [] -> error' $ spec +-+ "could not generate source rpm for dynamic buildrequires"+ ws -> do+ let srpm = last ws+ exists <- doesFileExist srpm+ if exists+ then cmdLines "rpm" ["-qp", "--requires", last ws]+ else error' err+ else error' err else -- FIXME should resolve meta rpmspec ["--buildrequires"] Nothing spec