more ExceptT conversions

This commit is contained in:
Ryan Mulligan 2018-12-23 09:15:12 -08:00
parent f2a08d24a1
commit b354349795
2 changed files with 8 additions and 10 deletions

View File

@ -68,7 +68,7 @@ compareVersions updateEnv = do
a)
-- This is extremely slow but gives us the best results we know of
lookupAttrPath :: MonadIO m => UpdateEnv -> m (Either Text Text)
lookupAttrPath :: MonadIO m => UpdateEnv -> ExceptT Text m Text
lookupAttrPath updateEnv =
cmd
"nix-env"
@ -81,17 +81,15 @@ lookupAttrPath updateEnv =
"config"
"{ allowBroken = true; allowUnfree = true; allowAliases = false; }" &
(fmap (T.lines >>> head >>> T.words >>> head)) &
shE &
rewriteError "nix-env -q failed to find package name with old version" &
shelly
shellyET &
overwriteErrorT "nix-env -q failed to find package name with old version"
getDerivationFile :: MonadIO m => UpdateEnv -> Text -> m (Either Text FilePath)
getDerivationFile :: MonadIO m => UpdateEnv -> Text -> ExceptT Text m FilePath
getDerivationFile updateEnv attrPath =
cmd "env" "EDITOR=echo" "nix" "edit" attrPath "-f" "." & fmap T.strip &
fmap fromText &
shE &
rewriteError "Couldn't find derivation file." &
shelly
shellyET &
overwriteErrorT "Couldn't find derivation file."
getHash :: MonadIO m => Text -> ExceptT Text m Text
getHash attrPath =

View File

@ -131,14 +131,14 @@ updatePackage log updateEnv mergeBaseOutpathsContext =
Git.fetchIfStale
Git.checkAutoUpdateBranchDoesn'tExist (packageName updateEnv)
Git.cleanAndResetToMaster
attrPath <- ExceptT $ Nix.lookupAttrPath updateEnv
attrPath <- Nix.lookupAttrPath updateEnv
ensureVersionCompatibleWithPathPin updateEnv attrPath
srcUrls <- Nix.getSrcUrls attrPath
Blacklist.srcUrl srcUrls
Blacklist.attrPath attrPath
masterShowRef <- lift $ Git.showRef "master"
lift $ log masterShowRef
derivationFile <- ExceptT $ Nix.getDerivationFile updateEnv attrPath
derivationFile <- Nix.getDerivationFile updateEnv attrPath
flip catches [Handler (\(ex :: SomeException) -> throwE (T.pack (show ex)))] $
-- Make sure it hasn't been updated on master
do