more MTL cleanup

This commit is contained in:
Ryan Mulligan 2018-12-22 14:52:53 -08:00
parent 4ead506dc7
commit f2a08d24a1
2 changed files with 11 additions and 12 deletions

View File

@ -18,7 +18,7 @@ module Nix
, cachix
, numberOfFetchers
, getHashFromBuild
, oldVersionOn
, assertOldVersionOn
, resultLink
, sha256Zero
) where
@ -197,12 +197,11 @@ numberOfFetchers derivationContents =
where
count x = T.count x derivationContents
oldVersionOn :: MonadIO m => UpdateEnv -> Text -> Text -> m (Either Text ())
oldVersionOn updateEnv branchName contents =
pure
(assertErr
("Old version not present in " <> branchName <> " derivation file.")
(oldVersion updateEnv `T.isInfixOf` contents))
assertOldVersionOn :: MonadIO m => UpdateEnv -> Text -> Text -> ExceptT Text m ()
assertOldVersionOn updateEnv branchName contents =
tryAssert
("Old version not present in " <> branchName <> " derivation file.")
(oldVersion updateEnv `T.isInfixOf` contents)
resultLink :: MonadIO m => ExceptT Text m FilePath
resultLink =

View File

@ -128,9 +128,9 @@ updatePackage log updateEnv mergeBaseOutpathsContext =
Blacklist.packageName (packageName updateEnv)
-- Check whether requested version is newer than the current one
Nix.compareVersions updateEnv
liftIO $ Git.fetchIfStale
Git.fetchIfStale
Git.checkAutoUpdateBranchDoesn'tExist (packageName updateEnv)
liftIO Git.cleanAndResetToMaster
Git.cleanAndResetToMaster
attrPath <- ExceptT $ Nix.lookupAttrPath updateEnv
ensureVersionCompatibleWithPathPin updateEnv attrPath
srcUrls <- Nix.getSrcUrls attrPath
@ -143,13 +143,13 @@ updatePackage log updateEnv mergeBaseOutpathsContext =
-- Make sure it hasn't been updated on master
do
masterDerivationContents <- lift $ readfile derivationFile
ExceptT $ Nix.oldVersionOn updateEnv "master" masterDerivationContents
Nix.assertOldVersionOn updateEnv "master" masterDerivationContents
-- Make sure it hasn't been updated on staging
liftIO Git.cleanAndResetToStaging
Git.cleanAndResetToStaging
masterShowRef <- lift $ Git.showRef "staging"
lift $ log masterShowRef
stagingDerivationContents <- lift $ readfile derivationFile
ExceptT $ Nix.oldVersionOn updateEnv "staging" stagingDerivationContents
Nix.assertOldVersionOn updateEnv "staging" stagingDerivationContents
lift $ Git.checkoutAtMergeBase (branchName updateEnv)
oneHourAgo <-
liftIO $ addUTCTime (fromInteger $ -60 * 60) <$> getCurrentTime