ingest when --unreproducible is used without --fast

This commit is contained in:
Joey Hess 2025-02-25 17:00:00 -04:00
parent 16f529c05f
commit 233a6954b9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -21,6 +21,7 @@ import Types.RemoteConfig
import Types.KeySource import Types.KeySource
import Messages.Progress import Messages.Progress
import Logs.Location import Logs.Location
import Utility.Metered
import Utility.MonotonicClock import Utility.MonotonicClock
import Backend.URL (fromUrl) import Backend.URL (fromUrl)
@ -136,23 +137,29 @@ perform o r program = do
logChange NoLiveUpdate k (Remote.uuid r) InfoPresent logChange NoLiveUpdate k (Remote.uuid r) InfoPresent
addfile fast state tmpdir outputfile addfile fast state tmpdir outputfile
| fast || not isreproducible = do | fast = do
let stateurl = Remote.Compute.computeStateUrl state outputfile addSymlink outputfile stateurlk Nothing
let k = fromUrl stateurl Nothing isreproducible return stateurlk
addSymlink outputfile k Nothing | isreproducible = do
return k sz <- liftIO $ getFileSize outputfile'
| otherwise = do metered Nothing sz Nothing $ \_ p ->
let outputfile' = tmpdir </> outputfile ingestwith $ ingestAdd p (Just ld)
let ld = LockedDown ldc $ KeySource | otherwise = ingestwith $
ingestAdd' nullMeterUpdate (Just ld) (Just stateurlk)
where
stateurl = Remote.Compute.computeStateUrl state outputfile
stateurlk = fromUrl stateurl Nothing True
outputfile' = tmpdir </> outputfile
ld = LockedDown ldc $ KeySource
{ keyFilename = outputfile { keyFilename = outputfile
, contentLocation = outputfile' , contentLocation = outputfile'
, inodeCache = Nothing , inodeCache = Nothing
} }
sz <- liftIO $ getFileSize outputfile' ingestwith a = a >>= \case
metered Nothing sz Nothing $ \_ p -> Nothing -> giveup "key generation failed"
ingestAdd p (Just ld) >>= \case Just k -> do
Nothing -> giveup "key generation failed" logStatus NoLiveUpdate k InfoPresent
Just k -> return k return k
ldc = LockDownConfig ldc = LockDownConfig
{ lockingFile = True { lockingFile = True