nix path-info --json: Print hash in SRI format

This commit is contained in:
Eelco Dolstra 2020-02-11 23:50:16 +01:00
parent d2032edb2f
commit 442e665d6d
3 changed files with 6 additions and 3 deletions

View file

@ -442,7 +442,9 @@ string Store::makeValidityRegistration(const StorePathSet & paths,
void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
bool includeImpureInfo, bool showClosureSize, AllowInvalidFlag allowInvalid)
bool includeImpureInfo, bool showClosureSize,
Base hashBase,
AllowInvalidFlag allowInvalid)
{
auto jsonList = jsonOut.list();
@ -454,7 +456,7 @@ void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & store
auto info = queryPathInfo(storePath);
jsonPath
.attr("narHash", info->narHash.to_string())
.attr("narHash", info->narHash.to_string(hashBase))
.attr("narSize", info->narSize);
{

View file

@ -541,6 +541,7 @@ public:
each path is included. */
void pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
bool includeImpureInfo, bool showClosureSize,
Base hashBase = Base32,
AllowInvalidFlag allowInvalid = DisallowInvalid);
/* Return the size of the closure of the specified path, that is,

View file

@ -89,7 +89,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
store->pathInfoToJSON(jsonRoot,
// FIXME: preserve order?
storePathsToSet(storePaths),
true, showClosureSize, AllowInvalid);
true, showClosureSize, SRI, AllowInvalid);
}
else {