skip updateScript rewriter if there is no updateScript

This commit is contained in:
Ryan Mulligan 2020-08-01 10:02:38 -07:00
parent f07e4069cc
commit a2a9bcafc1

View File

@ -243,8 +243,10 @@ golangModuleVersion log args@Args {..} = do
--------------------------------------------------------------------------------
-- Calls passthru.updateScript
updateScript :: MonadIO m => (Text -> m ()) -> Args -> ExceptT Text m (Maybe Text)
updateScript log args = do
(exitCode, msg) <- Nix.runUpdateScript (attrPath args)
updateScript log Args {..} = do
if hasUpdateScript
then do
(exitCode, msg) <- Nix.runUpdateScript attrPath
case exitCode of
ExitSuccess -> do
lift $ log "Success"
@ -252,7 +254,9 @@ updateScript log args = do
return $ Just "Ran passthru.UpdateScript"
ExitFailure num -> do
throwE $ "[updateScript] Failed with exit code " <> tshow num <> "\n" <> msg
else do
lift $ log "skipping because derivation has no updateScript"
return Nothing
--------------------------------------------------------------------------------
-- Common helper functions and utilities
-- Helper to update version and src attributes, re-computing the sha256.