diff --git a/Command/AddComputed.hs b/Command/AddComputed.hs index 20eacf954f..857e495ad0 100644 --- a/Command/AddComputed.hs +++ b/Command/AddComputed.hs @@ -19,8 +19,10 @@ import Annex.CatFile import Annex.Content.Presence import Annex.Ingest import Types.KeySource +import Types.Key import Messages.Progress import Logs.Location +import Logs.EquivilantKeys import Utility.Metered import Backend.URL (fromUrl) @@ -174,6 +176,10 @@ addComputed addaction stagefiles r reproducibleconfig choosebackend destfile fas Nothing -> giveup "ingestion failed" Just k -> do logStatus NoLiveUpdate k InfoPresent + when (fromKey keyVariety k == VURLKey) $ do + hb <- hashBackend + void $ addEquivilantKey hb k + =<< calcRepo (gitAnnexLocation k) return k ldc = LockDownConfig diff --git a/Logs/EquivilantKeys.hs b/Logs/EquivilantKeys.hs index 32accda777..b238675724 100644 --- a/Logs/EquivilantKeys.hs +++ b/Logs/EquivilantKeys.hs @@ -11,6 +11,7 @@ module Logs.EquivilantKeys ( getEquivilantKeys, setEquivilantKey, updateEquivilantKeys, + addEquivilantKey, generateEquivilantKey, ) where @@ -37,8 +38,6 @@ setEquivilantKey key equivkey = do addLog (Annex.Branch.RegardingUUID []) (equivilantKeysLogFile config key) InfoPresent (LogInfo (serializeKey' equivkey)) --- The Backend must use a cryptographically secure hash. --- -- This returns Verified when when an equivilant key has been added to the -- log (or was already in the log). This is to avoid hashing the object -- again later. @@ -50,6 +49,12 @@ updateEquivilantKeys b obj key eks = generateEquivilantKey b obj >>= \case setEquivilantKey key ek return (Just Verified) +addEquivilantKey :: Backend -> Key -> OsPath -> Annex (Maybe Verification) +addEquivilantKey b key obj = + updateEquivilantKeys b obj key + =<< getEquivilantKeys key + +-- The Backend must use a cryptographically secure hash. generateEquivilantKey :: Backend -> OsPath -> Annex (Maybe Key) generateEquivilantKey b obj = case genKey b of diff --git a/Remote/Compute.hs b/Remote/Compute.hs index 84170fc5dd..eaef6d44fb 100644 --- a/Remote/Compute.hs +++ b/Remote/Compute.hs @@ -482,10 +482,7 @@ computeKey rs (ComputeProgram program) k _af dest p vc = hb <- hashBackend let updatevurl key getobj = if (fromKey keyVariety key == VURLKey) - then do - obj <- getobj - updateEquivilantKeys hb obj key - =<< getEquivilantKeys key + then addEquivilantKey hb key =<< getobj else return Nothing let keyfile' = tmpdir keyfile diff --git a/TODO-compute b/TODO-compute index 1f3ac6c9d5..dfa629ab8b 100644 --- a/TODO-compute +++ b/TODO-compute @@ -1,6 +1,3 @@ -* VURL keys don't currently have the hash key recorded in the equivilant - key log by addcompute - * need progress bars for computations and implement PROGRESS message * get input files for a computation (so `git-annex get .` gets every file,