Fall back to old behaviour for git references, prefer resolved_reference

This commit is contained in:
adisbladis 2020-10-06 14:44:26 +02:00
parent ef9935c98c
commit 74d3b4ff1c
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
2 changed files with 7 additions and 2 deletions

View file

@ -23,6 +23,11 @@ parser_lock.add_argument(
def fetch_git(pkg): def fetch_git(pkg):
try:
reference = pkg["source"]["resolved_reference"]
except KeyError:
reference = pkg["source"]["reference"]
return ( return (
pkg["name"], pkg["name"],
subprocess.run( subprocess.run(
@ -32,7 +37,7 @@ def fetch_git(pkg):
"--url", "--url",
pkg["source"]["url"], pkg["source"]["url"],
"--rev", "--rev",
pkg["source"]["resolved_reference"], reference,
], ],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,

View file

@ -157,7 +157,7 @@ pythonPackages.callPackage
( (
builtins.fetchGit { builtins.fetchGit {
inherit (source) url; inherit (source) url;
rev = source.resolved_reference; rev = source.resolved_reference or source.reference;
ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD"; ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD";
} }
) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else ) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else