Skip to content

Commit

Permalink
Merge pull request #20518 from rasendubi/fetchFromGitHub
Browse files Browse the repository at this point in the history
fetchFromGitHub: add fetchSubmodules option
  • Loading branch information
copumpkin authored Nov 18, 2016
2 parents e985c5a + a80cacd commit e8bb0a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkgs/build-support/fetchgit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in
Cloning branches will make the hash check fail when there is an update.
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.
for now : increase depth iteratively (TODO)
Expand Down
23 changes: 18 additions & 5 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,25 @@ in

fetchFromGitHub = {
owner, repo, rev, name ? "${repo}-${rev}-src",
fetchSubmodules ? false,
... # For hash agility
}@args: fetchzip ({
inherit name;
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
meta.homepage = "https://github.com/${owner}/${repo}/";
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; };
}@args:
let
baseUrl = "https://github.com/${owner}/${repo}";
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" ];
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 = {
owner, repo, rev, name ? "${repo}-${rev}-src",
Expand Down

0 comments on commit e8bb0a5

Please sign in to comment.