diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2017-03-25 00:35:20 +0100 |
---|---|---|
committer | Daiderd Jordan <daiderd@gmail.com> | 2017-03-25 00:35:20 +0100 |
commit | 00f472a563c030d0232bfd39af8b3f5411169a5d (patch) | |
tree | 2b992d1a3fab113175c3610a8829fca36811e700 /pkgs/build-support/fetchrepoproject/default.nix | |
parent | 2078c34dad8ecdb8955572e2662ecb4eef750d70 (diff) |
fetchrepoproject: cleanup extra flags
Diffstat (limited to 'pkgs/build-support/fetchrepoproject/default.nix')
-rw-r--r-- | pkgs/build-support/fetchrepoproject/default.nix | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix index 33adb5ab1dd46..78a46d4ac9bda 100644 --- a/pkgs/build-support/fetchrepoproject/default.nix +++ b/pkgs/build-support/fetchrepoproject/default.nix @@ -1,25 +1,34 @@ -{stdenv, git, gitRepo, gnupg ? null, cacert}: +{ stdenv, git, gitRepo, gnupg ? null, cacert }: -{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "", -localManifests ? [] }: +{ name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "" +, localManifests ? [] +}: assert repoRepoRev != "" -> repoRepoURL != ""; +with stdenv.lib; + +let + extraRepoInitFlags = [ + (optionalString (repoRepoURL != "") "--repo-url=${repoRepoURL}") + (optionalString (repoRepoRev != "") "--repo-branch=${repoRepoRev}") + (optionalString (referenceDir != "") "--reference=${referenceDir}") + ]; +in + stdenv.mkDerivation { - buildCommand = with stdenv.lib; '' + buildCommand = '' mkdir ./.repo mkdir ./.repo/local_manifests - for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests} + for local_manifest in ${concatMapStringsSep " " toString 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 init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle \ + ${concatStringsSep " " extraRepoInitFlags} + repo sync --jobs=$NIX_BUILD_CORES --current-branch rm -rf $out/.repo ''; @@ -30,7 +39,7 @@ stdenv.mkDerivation { "GIT_PROXY_COMMAND" "SOCKS_SERVER" ]; - buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ; + buildInputs = [git gitRepo cacert] ++ optional (gnupg != null) [gnupg] ; outputHashAlgo = "sha256"; outputHashMode = "recursive"; |