Merge pull request #20518 from rasendubi/fetchFromGitHub
fetchFromGitHub: add fetchSubmodules option
This commit is contained in:
commit
e8bb0a5ef7
|
@ -26,7 +26,7 @@ in
|
||||||
Cloning branches will make the hash check fail when there is an update.
|
Cloning branches will make the hash check fail when there is an update.
|
||||||
But not all patches we want can be accessed by tags.
|
But not all patches we want can be accessed by tags.
|
||||||
|
|
||||||
The workaround is getting the last n commits so that it's likly that they
|
The workaround is getting the last n commits so that it's likely that they
|
||||||
still contain the hash we want.
|
still contain the hash we want.
|
||||||
|
|
||||||
for now : increase depth iteratively (TODO)
|
for now : increase depth iteratively (TODO)
|
||||||
|
|
|
@ -203,12 +203,25 @@ in
|
||||||
|
|
||||||
fetchFromGitHub = {
|
fetchFromGitHub = {
|
||||||
owner, repo, rev, name ? "${repo}-${rev}-src",
|
owner, repo, rev, name ? "${repo}-${rev}-src",
|
||||||
|
fetchSubmodules ? false,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args:
|
||||||
inherit name;
|
let
|
||||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
baseUrl = "https://github.com/${owner}/${repo}";
|
||||||
meta.homepage = "https://github.com/${owner}/${repo}/";
|
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" ];
|
||||||
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; };
|
in if fetchSubmodules then
|
||||||
|
fetchgit ({
|
||||||
|
inherit name rev fetchSubmodules;
|
||||||
|
url = "${baseUrl}.git";
|
||||||
|
} // passthruAttrs)
|
||||||
|
else
|
||||||
|
# We prefer fetchzip in cases we don't need submodules as the hash
|
||||||
|
# is more stable in that case.
|
||||||
|
fetchzip ({
|
||||||
|
inherit name;
|
||||||
|
url = "${baseUrl}/archive/${rev}.tar.gz";
|
||||||
|
meta.homepage = "${baseUrl}/";
|
||||||
|
} // passthruAttrs) // { inherit rev; };
|
||||||
|
|
||||||
fetchFromBitbucket = {
|
fetchFromBitbucket = {
|
||||||
owner, repo, rev, name ? "${repo}-${rev}-src",
|
owner, repo, rev, name ? "${repo}-${rev}-src",
|
||||||
|
|
Loading…
Reference in New Issue