diff --git a/src/Bodhi.hs b/src/Bodhi.hs index eaf25100..e2743ed5 100644 --- a/src/Bodhi.hs +++ b/src/Bodhi.hs @@ -6,6 +6,7 @@ module Bodhi ( checkAutoBodhiUpdate, UpdateType(..), UpdateSeverity(..), + UpdateNotes(..), bodhiUpdate, bodhiBuildExists ) @@ -102,12 +103,14 @@ bodhiTestingRepo Rawhide = return Nothing bodhiTestingRepo br = releaseTestingRepo <$> branchRelease br +data UpdateNotes = NotesChangelog | NotesText String + -- FIXME support --no-close-bugs -- push comma separated list of builds for a package to bodhi bodhiUpdate :: Bool -> (Maybe UpdateType, UpdateSeverity) -> Maybe BugId - -> Bool -> FilePath -> String -> IO () + -> Maybe UpdateNotes -> FilePath -> String -> IO () bodhiUpdate _ _ _ _ _ [] = putStrLn "no package to push" -bodhiUpdate dryrun (mupdate,severity) mreview usechangelog spec nvrs = do +bodhiUpdate dryrun (mupdate,severity) mreview mnotes spec nvrs = do case mupdate of Nothing -> return () Just updateType -> @@ -124,11 +127,14 @@ bodhiUpdate dryrun (mupdate,severity) mreview usechangelog spec nvrs = do changelog <- if isJust mreview then getSummaryURL spec else - if usechangelog - then cleanChangelog True spec - else - -- FIXME list open bugs - changeLogPrompt ChangeBodhi spec + case mnotes of + Just NotesChangelog -> + cleanChangelog True spec + Just (NotesText notes) -> + return notes + Nothing -> + -- FIXME list open bugs + changeLogPrompt ChangeBodhi spec if trim (lower changelog) `elem` ["no","n"] then return False else do @@ -156,7 +162,7 @@ bodhiUpdate dryrun (mupdate,severity) mreview usechangelog spec nvrs = do then do putStrLn $ "bodhi submission failed for" +-+ nvrs promptEnter "Press Enter to resubmit to Bodhi" - bodhiUpdate dryrun (mupdate,severity) mreview usechangelog spec nvrs + bodhiUpdate dryrun (mupdate,severity) mreview mnotes spec nvrs else forM_ updates $ \update -> case lookupKey "url" update of diff --git a/src/Cmd/Build.hs b/src/Cmd/Build.hs index d629a53a..b79912bb 100644 --- a/src/Cmd/Build.hs +++ b/src/Cmd/Build.hs @@ -30,7 +30,7 @@ data BuildOpts = BuildOpts , buildoptDryrun :: Bool , buildoptSkipFetch :: Bool , buildoptUpdate :: (Maybe UpdateType, UpdateSeverity) - , buildoptUseChangelog :: Bool + , buildoptNotes :: Maybe UpdateNotes , buildoptByPackage :: Bool , buildoptStash :: Bool } @@ -147,7 +147,7 @@ buildBranch mlastpkg opts pkg rbr@(RelBranch br) = do then putStrLn "update exists" else do mbug <- bzReviewAnon - bodhiUpdate dryrun (buildoptUpdate opts) mbug (buildoptUseChangelog opts) spec $ showNVR nvr + bodhiUpdate dryrun (buildoptUpdate opts) mbug (buildoptNotes opts) spec $ showNVR nvr whenJust moverride $ \days -> do tags <- maybeTimeout 30 $ kojiNVRTags nvr unless (any (`elem` tags) [showBranch br, showBranch br ++ "-updates", showBranch br ++ "-override"]) $ @@ -228,7 +228,7 @@ buildBranch mlastpkg opts pkg rbr@(RelBranch br) = do whenJust (fmap fst mBugSess) $ \bid -> putStr "review bug: " >> putBugId bid -- FIXME diff previous changelog? - bodhiUpdate dryrun (buildoptUpdate opts) (fmap fst mBugSess) (buildoptUseChangelog opts) spec $ showNVR nvr + bodhiUpdate dryrun (buildoptUpdate opts) (fmap fst mBugSess) (buildoptNotes opts) spec $ showNVR nvr -- FIXME prompt for override note whenJust moverride $ \days -> bodhiCreateOverride dryrun (Just days) nvr diff --git a/src/Cmd/Parallel.hs b/src/Cmd/Parallel.hs index b30b8644..9738530a 100644 --- a/src/Cmd/Parallel.hs +++ b/src/Cmd/Parallel.hs @@ -139,7 +139,7 @@ parallelBuildCmd dryrun mmerge firstlayer msidetagTarget mustpush delay mupdate unless okay $ error' "Quitting" when (isNothing msidetagTarget) $ do let spec = packageSpec pkg - bodhiUpdate dryrun mupdate Nothing False spec $ + bodhiUpdate dryrun mupdate Nothing Nothing spec $ intercalate "," . map (showNVR . jobNvr) $ filter ((/= Rawhide) . jobBranch) nvrclogs where diff --git a/src/Main.hs b/src/Main.hs index 97a5526f..825128b5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -53,7 +53,7 @@ import Cmd.Update import Cmd.UpdateReview import Cmd.WaitRepo -import Bodhi (UpdateType(..),UpdateSeverity(..)) +import Bodhi (UpdateType(..), UpdateSeverity(..), UpdateNotes(..)) import Branches import Common.System import Git (CommitOpt(..)) @@ -548,7 +548,7 @@ main = do <*> dryrunOpt "Dry run: do not merge/push/build" <*> skipFetchOpt <*> updateOpt - <*> useChangelogOpt + <*> optional notesOpt <*> switchWith 'p' "by-package" "Build by each package across brs" <*> switchLongWith "stash" "git stash before fetching and building" where @@ -557,8 +557,9 @@ main = do waitrepoOpt = optional (flagWith' True 'w' "waitrepo" "Waitrepo for each build" <|> flagWith' False 'W' "no-waitrepo" "Do not waitrepo for each build") - useChangelogOpt = - switchWith 'c' "changelog-notes" "Use spec changelog for Bodhi notes" + notesOpt = + flagWith' NotesChangelog 'c' "changelog-notes" "Use spec changelog for Bodhi notes" <|> + NotesText <$> strOptionLongWith "notes" "NOTES" "Bodhi update notes" -- yesOpt = switchWith 'y' "yes" "Assume yes for questions"