aboutsummaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchrepoproject
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2017-09-17 23:16:33 +0200
committerMichael Weiss <dev.primeos@gmail.com>2017-09-17 23:16:33 +0200
commit018a5ae2f4e01c0e7ccd63a58c308082387fc73b (patch)
tree87433b984544265588a10a174de386ce8da4820b /pkgs/build-support/fetchrepoproject
parent7db2916648ba8184bf619fc895e8d3fe2de84db3 (diff)
fetchRepoProject: Fetch into $out and make it deterministic
Fetch into $out and remove all version control files to make it deterministic (.repo and all .git subdirectories - e.g. the .git/index files change every time). Additionally I've changed the default of "useArchive" to false because fetching with "--archive" will fail for some projects (e.g. "platform/external/iosched" from the AOSP). Now, this function should hopefully work for every tag of the AOSP.
Diffstat (limited to 'pkgs/build-support/fetchrepoproject')
-rw-r--r--pkgs/build-support/fetchrepoproject/default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix
index 2e5fbe79435..199c029d3b6 100644
--- a/pkgs/build-support/fetchrepoproject/default.nix
+++ b/pkgs/build-support/fetchrepoproject/default.nix
@@ -1,8 +1,9 @@
{ stdenv, gitRepo, cacert, copyPathsToStore }:
{ name, manifest, rev ? "HEAD", sha256
+# Optional parameters:
, repoRepoURL ? "", repoRepoRev ? "", referenceDir ? ""
-, localManifests ? [], createMirror ? false, useArchive ? !createMirror
+, localManifests ? [], createMirror ? false, useArchive ? false
}:
assert repoRepoRev != "" -> repoRepoURL != "";
@@ -51,6 +52,9 @@ in stdenv.mkDerivation {
# Path must be absolute (e.g. for GnuPG: ~/.repoconfig/gnupg/pubring.kbx)
export HOME="$(pwd)"
+ mkdir $out
+ cd $out
+
mkdir .repo
${optionalString (local_manifests != []) ''
mkdir .repo/local_manifests
@@ -61,6 +65,13 @@ in stdenv.mkDerivation {
repo init ${concatStringsSep " " repoInitFlags}
repo sync --jobs=$NIX_BUILD_CORES --current-branch
- ${optionalString (!createMirror) "rm -rf $out/.repo"}
+
+ # TODO: The git-index files (and probably the files in .repo as well) have
+ # different contents each time and will therefore change the final hash
+ # (i.e. creating a mirror probably won't work).
+ ${optionalString (!createMirror) ''
+ rm -rf .repo
+ find -type d -name '.git' -prune -exec rm -rf {} +
+ ''}
'';
}