forked from lix-project/lix
nix path-info --json: Print hash in SRI format
(cherry picked from commit 442e665d6d
)
This commit is contained in:
parent
7a8de57d3e
commit
777e21e596
|
@ -441,7 +441,9 @@ string Store::makeValidityRegistration(const StorePathSet & paths,
|
||||||
|
|
||||||
|
|
||||||
void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
|
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();
|
auto jsonList = jsonOut.list();
|
||||||
|
|
||||||
|
@ -453,7 +455,7 @@ void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & store
|
||||||
auto info = queryPathInfo(storePath);
|
auto info = queryPathInfo(storePath);
|
||||||
|
|
||||||
jsonPath
|
jsonPath
|
||||||
.attr("narHash", info->narHash.to_string())
|
.attr("narHash", info->narHash.to_string(hashBase))
|
||||||
.attr("narSize", info->narSize);
|
.attr("narSize", info->narSize);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -561,6 +561,7 @@ public:
|
||||||
each path is included. */
|
each path is included. */
|
||||||
void pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
|
void pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
|
||||||
bool includeImpureInfo, bool showClosureSize,
|
bool includeImpureInfo, bool showClosureSize,
|
||||||
|
Base hashBase = Base32,
|
||||||
AllowInvalidFlag allowInvalid = DisallowInvalid);
|
AllowInvalidFlag allowInvalid = DisallowInvalid);
|
||||||
|
|
||||||
/* Return the size of the closure of the specified path, that is,
|
/* Return the size of the closure of the specified path, that is,
|
||||||
|
|
|
@ -89,7 +89,7 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||||
store->pathInfoToJSON(jsonRoot,
|
store->pathInfoToJSON(jsonRoot,
|
||||||
// FIXME: preserve order?
|
// FIXME: preserve order?
|
||||||
storePathsToSet(storePaths),
|
storePathsToSet(storePaths),
|
||||||
true, showClosureSize, AllowInvalid);
|
true, showClosureSize, SRI, AllowInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue