mirror of
https://github.com/ryantm/nixpkgs-update.git
synced 2024-11-10 13:24:58 +03:00
more MTL cleanup
This commit is contained in:
parent
4ead506dc7
commit
f2a08d24a1
13
src/Nix.hs
13
src/Nix.hs
@ -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 =
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user