mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
fix combined hashing mode
This commit is contained in:
parent
72c435b8a8
commit
8a5108a602
@ -276,7 +276,6 @@ class PackageCommand(Command):
|
||||
if not mainSource:
|
||||
mainSource = dict(
|
||||
type="unknown",
|
||||
version="unknown",
|
||||
)
|
||||
lock['sources'][mainPackageName] = {
|
||||
mainPackageVersion: mainSource
|
||||
|
@ -111,6 +111,7 @@ def order_dict(d):
|
||||
for k, v in sorted(d.items())}
|
||||
|
||||
def strip_hashes_from_lock(lock):
|
||||
for source in lock['sources'].values():
|
||||
if 'hash' in source:
|
||||
del source['hash']
|
||||
for name, versions in lock['sources'].items():
|
||||
for source in versions.values():
|
||||
if 'hash' in source:
|
||||
del source['hash']
|
||||
|
@ -30,15 +30,11 @@ rec {
|
||||
}@args:
|
||||
let
|
||||
fetcher = fetchers."${type}";
|
||||
namesKeep = fetcher.inputs ++ [ "version" "type" "hash" ];
|
||||
namesKeep = fetcher.inputs ++ [ "type" "hash" ];
|
||||
argsKeep = lib.filterAttrs (n: v: b.elem n namesKeep) args;
|
||||
fetcherOutputs = fetcher.outputs args;
|
||||
in
|
||||
argsKeep
|
||||
# if version was not provided, use the default version field
|
||||
// (lib.optionalAttrs (! args ? version) {
|
||||
version = args."${fetcher.versionField}";
|
||||
})
|
||||
# if the hash was not provided, calculate hash on the fly (impure)
|
||||
// (lib.optionalAttrs reComputeHash {
|
||||
hash = fetcherOutputs.calcHash "sha256";
|
||||
@ -56,7 +52,6 @@ rec {
|
||||
argsKeep = b.removeAttrs source [ "hash" ];
|
||||
in
|
||||
constructSource (argsKeep // {
|
||||
version = newVersion;
|
||||
reComputeHash = true;
|
||||
} // {
|
||||
"${fetcher.versionField}" = newVersion;
|
||||
|
@ -38,9 +38,11 @@
|
||||
"then": {
|
||||
"properties": {
|
||||
"url": { "type": "string" },
|
||||
"version": { "type": "string" }
|
||||
"hash": { "type": "string" },
|
||||
"type": { "type": "string" }
|
||||
},
|
||||
"required": ["url", "version"]
|
||||
"required": ["type", "url"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -51,9 +53,10 @@
|
||||
"properties": {
|
||||
"url": { "type": "string" },
|
||||
"rev": { "type": "string" },
|
||||
"version": { "type": "string" }
|
||||
"type": { "type": "string" }
|
||||
},
|
||||
"required": ["url", "rev", "version"]
|
||||
"required": ["type", "url", "rev"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -65,9 +68,11 @@
|
||||
"owner": { "type": "string" },
|
||||
"repo": { "type": "string" },
|
||||
"rev": { "type": "string" },
|
||||
"version": { "type": "string" }
|
||||
"hash": { "type": "string" },
|
||||
"type": { "type": "string" }
|
||||
},
|
||||
"required": ["owner", "repo", "rev", "hash", "version"]
|
||||
"required": ["type", "owner", "repo", "rev"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -77,9 +82,12 @@
|
||||
"then": {
|
||||
"properties": {
|
||||
"pname": { "type": "string" },
|
||||
"version": { "type": "string" }
|
||||
"version": { "type": "string" },
|
||||
"hash": { "type": "string" },
|
||||
"type": { "type": "string" }
|
||||
},
|
||||
"required": ["pname", "version"]
|
||||
"required": ["type", "pname"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user