record VURL key hashes in addcomputed and recompute

This commit is contained in:
Joey Hess 2025-03-03 10:57:56 -04:00
parent 2bd64059f1
commit 63d73d8d1b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,