File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
cabal-install/src/Distribution/Client Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ import Distribution.Verbosity
66
66
import Distribution.Client.Compat.Prelude
67
67
import Prelude ()
68
68
69
+ import Control.Monad ((<=<) )
70
+
69
71
import qualified Data.ByteString.Builder as BB
70
72
import qualified Data.ByteString.Lazy as BS
71
73
import qualified Data.Map as Map
@@ -259,13 +261,24 @@ encodePlanAsJson distDirLayout elaboratedInstallPlan elaboratedSharedConfig =
259
261
J. object
260
262
[ " type" J. .= J. String " remote-repo"
261
263
, " uri" J. .= J. String (show (remoteRepoURI repoRemote))
264
+ , -- The x-revision field is a feature of remote repos,
265
+ -- so we only output it for remote/secure repos, in the "repo" object.
266
+ " pkg-revision" J. .= J. Number (elaboratedPackageToRevision elab)
262
267
]
263
268
RepoSecure {.. } ->
264
269
J. object
265
270
[ " type" J. .= J. String " secure-repo"
266
271
, " uri" J. .= J. String (show (remoteRepoURI repoRemote))
272
+ , " pkg-revision" J. .= J. Number (elaboratedPackageToRevision elab)
267
273
]
268
274
275
+ elaboratedPackageToRevision :: ElaboratedConfiguredPackage -> Double
276
+ elaboratedPackageToRevision =
277
+ fromMaybe 0
278
+ . (readMaybe <=< lookup " x-revision" )
279
+ . PD. customFieldsPD
280
+ . elabPkgDescription
281
+
269
282
sourceRepoToJ :: SourceRepoMaybe -> J. Value
270
283
sourceRepoToJ SourceRepositoryPackage {.. } =
271
284
J. object $
You can’t perform that action at this time.
0 commit comments