summary refs log tree commit diff
path: root/pkgs/os-specific/bsd
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-04-19 22:23:30 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-07-10 21:20:29 +0000
commit75db7f8eb049e825ca2a5e201180aa45dd82709a (patch)
tree1ec3fa214c5ce835b47519134c4f9c9e48382d37 /pkgs/os-specific/bsd
parent53072cc0666112eebe9bc5d18dd46abb12f0dcbe (diff)
downloadnixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar.gz
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar.bz2
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar.lz
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar.xz
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.tar.zst
nixpkgs-75db7f8eb049e825ca2a5e201180aa45dd82709a.zip
netbsd: Use rsync to speed up source merging
The find -exec that was there before is quite slow on my machine. This
is much faster.
Diffstat (limited to 'pkgs/os-specific/bsd')
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix27
-rw-r--r--pkgs/os-specific/bsd/setup-hook.sh8
2 files changed, 19 insertions, 16 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index bb0984d9738..1e933148000 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -7,6 +7,8 @@
 }:
 
 let
+  inherit (buildPackages.buildPackages) rsync;
+
   fetchNetBSD = path: version: sha256: fetchcvs {
     cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
     module = "src/${path}";
@@ -60,7 +62,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      install tsort lorder mandoc groff statHook
+      install tsort lorder mandoc groff statHook rsync
     ];
     buildInputs = with self; compatIfNeeded;
 
@@ -116,7 +118,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
 
     buildInputs = with self; [];
-    nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook ];
+    nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook rsync ];
 
     skipIncludesPhase = true;
 
@@ -165,6 +167,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; commonDeps ++ [
       bsdSetupHook
       makeMinimal
+      rsync
     ];
 
     buildInputs = with self; commonDeps;
@@ -237,7 +240,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      mandoc groff
+      mandoc groff rsync
     ];
     skipIncludesPhase = true;
     buildInputs = with self; compatIfNeeded ++ [ fts ];
@@ -259,7 +262,7 @@ in lib.makeScopeWithSplicing
     sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
     version = "9.2";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook rsync
     ];
     propagatedBuildInputs = with self; compatIfNeeded;
     extraPaths = with self; [
@@ -297,7 +300,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      install mandoc groff
+      install mandoc groff rsync
     ];
   };
 
@@ -319,7 +322,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      install mandoc groff
+      install mandoc groff rsync
     ];
   };
 
@@ -330,7 +333,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      install mandoc groff
+      install mandoc groff rsync
     ];
   };
   ##
@@ -463,7 +466,7 @@ in lib.makeScopeWithSplicing
     NIX_CFLAGS_COMPILE = [ "-DMAKE_BOOTSTRAP" ];
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
-      makeMinimal install mandoc byacc flex
+      makeMinimal install mandoc byacc flex rsync
     ];
     buildInputs = with self; compatIfNeeded;
     extraPaths = with self; [ cksum.src ];
@@ -482,7 +485,7 @@ in lib.makeScopeWithSplicing
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
       makeMinimal
-      install mandoc groff nbperf rpcgen
+      install mandoc groff rsync nbperf rpcgen
     ];
     extraPaths = with self; [ common ];
     headersOnly = true;
@@ -508,7 +511,7 @@ in lib.makeScopeWithSplicing
     propagatedBuildInputs = with self; [ include ];
     nativeBuildInputs = with buildPackages.netbsd; [
       bsdSetupHook
-      makeMinimal install tsort lorder statHook uudecode config genassym
+      makeMinimal install tsort lorder statHook rsync uudecode config genassym
     ];
 
     postConfigure = ''
@@ -748,7 +751,7 @@ in lib.makeScopeWithSplicing
       bsdSetupHook
       makeMinimal
       install mandoc groff flex
-      byacc genassym gencat lorder tsort statHook
+      byacc genassym gencat lorder tsort statHook rsync
     ];
     buildInputs = with self; [ headers ];
     extraPaths = with self; [ sys.src ld_elf_so.src ];
@@ -786,7 +789,7 @@ in lib.makeScopeWithSplicing
       bsdSetupHook
       makeMinimal
       install mandoc groff flex
-      byacc genassym gencat lorder tsort statHook rpcgen
+      byacc genassym gencat lorder tsort statHook rsync rpcgen
     ];
     buildInputs = with self; [ headers csu ];
     NIX_CFLAGS_COMPILE = "-B${self.csu}/lib";
diff --git a/pkgs/os-specific/bsd/setup-hook.sh b/pkgs/os-specific/bsd/setup-hook.sh
index 45babc38d7a..98fee66f5df 100644
--- a/pkgs/os-specific/bsd/setup-hook.sh
+++ b/pkgs/os-specific/bsd/setup-hook.sh
@@ -70,10 +70,7 @@ setBSDSourceDir() {
   export _SRC_TOP_=$BSDSRCDIR
   chmod -R u+w $sourceRoot
   for path in $extraPaths; do
-    cd $path
-    find . -type d -exec mkdir -p $sourceRoot/\{} \;
-    find . -type f -exec cp -pr \{} $sourceRoot/\{} \;
-    chmod -R u+w $sourceRoot
+    rsync -Er --chmod u+w $path/ $sourceRoot/
   done
 
   cd $sourceRoot
@@ -104,6 +101,9 @@ moveUsrDir() {
   if [ -d $prefix ]; then
     # Remove lingering /usr references
     if [ -d $prefix/usr ]; then
+      # Didn't try using rsync yet because per
+      # https://unix.stackexchange.com/questions/127712/merging-folders-with-mv,
+      # it's not neessarily better.
       pushd $prefix/usr
       find . -type d -exec mkdir -p $out/\{} \;
       find . \( -type f -o -type l \) -exec mv \{} $out/\{} \;