mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
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.
This commit is contained in:
parent
7db2916648
commit
018a5ae2f4
@ -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 {} +
|
||||
''}
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user