3
0
Fork 0
forked from mirrors/nixpkgs

fetchRepoProject: init.

Added to grab projects added by git-repo.

Contains some problems still reguarding purity and clone.bundle,
but good enough for now.
This commit is contained in:
Sophie Taylor 2017-03-23 13:22:44 +10:00
parent 94ab4932ae
commit 76e095c6c5
No known key found for this signature in database
GPG key ID: 1643E5C15AD25706
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,42 @@
{stdenv, git, gitRepo, gnupg ? null, cacert}:
{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "",
localManifests ? [] }:
assert repoRepoRev != "" -> repoRepoURL != "";
stdenv.mkDerivation {
buildCommand = with stdenv.lib; ''
mkdir ./.repo
mkdir ./.repo/local_manifests
for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests}
do
cp $local_manifest ./.repo/local_manifests/$(stripHash $local_manifest; echo $strippedName)
done
export HOME=.repo
repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle''
+ ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"}
+ ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"}
+ ${optionalString (referenceDir != "") " --reference=${referenceDir}"}
+ ''
repo sync --jobs=$NIX_BUILD_CORES --current-branch
rm -rf $out/.repo
'';
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
];
buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;
preferLocalBuild = true;
enableParallelBuilding = true;
inherit name cacert manifest rev repoRepoURL repoRepoRev referenceDir;
}

View file

@ -170,6 +170,8 @@ with pkgs;
inherit curl stdenv; inherit curl stdenv;
}; };
fetchRepoProject = callPackage ../build-support/fetchrepoproject { };
# fetchurlBoot is used for curl and its dependencies in order to # fetchurlBoot is used for curl and its dependencies in order to
# prevent a cyclic dependency (curl depends on curl.tar.bz2, # prevent a cyclic dependency (curl depends on curl.tar.bz2,
# curl.tar.bz2 depends on fetchurl, fetchurl depends on curl). It # curl.tar.bz2 depends on fetchurl, fetchurl depends on curl). It