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.
This commit is contained in:
John Ericson 2021-04-19 22:23:30 +00:00
parent 53072cc066
commit 75db7f8eb0
2 changed files with 19 additions and 16 deletions

View file

@ -7,6 +7,8 @@
}: }:
let let
inherit (buildPackages.buildPackages) rsync;
fetchNetBSD = path: version: sha256: fetchcvs { fetchNetBSD = path: version: sha256: fetchcvs {
cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot"; cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
module = "src/${path}"; module = "src/${path}";
@ -60,7 +62,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install tsort lorder mandoc groff statHook install tsort lorder mandoc groff statHook rsync
]; ];
buildInputs = with self; compatIfNeeded; buildInputs = with self; compatIfNeeded;
@ -116,7 +118,7 @@ in lib.makeScopeWithSplicing
version = "9.2"; version = "9.2";
buildInputs = with self; []; buildInputs = with self; [];
nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook ]; nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook rsync ];
skipIncludesPhase = true; skipIncludesPhase = true;
@ -165,6 +167,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; commonDeps ++ [ nativeBuildInputs = with buildPackages.netbsd; commonDeps ++ [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
rsync
]; ];
buildInputs = with self; commonDeps; buildInputs = with self; commonDeps;
@ -237,7 +240,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
mandoc groff mandoc groff rsync
]; ];
skipIncludesPhase = true; skipIncludesPhase = true;
buildInputs = with self; compatIfNeeded ++ [ fts ]; buildInputs = with self; compatIfNeeded ++ [ fts ];
@ -259,7 +262,7 @@ in lib.makeScopeWithSplicing
sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77"; sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
version = "9.2"; version = "9.2";
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook rsync
]; ];
propagatedBuildInputs = with self; compatIfNeeded; propagatedBuildInputs = with self; compatIfNeeded;
extraPaths = with self; [ extraPaths = with self; [
@ -297,7 +300,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff install mandoc groff rsync
]; ];
}; };
@ -319,7 +322,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff install mandoc groff rsync
]; ];
}; };
@ -330,7 +333,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff install mandoc groff rsync
]; ];
}; };
## ##
@ -463,7 +466,7 @@ in lib.makeScopeWithSplicing
NIX_CFLAGS_COMPILE = [ "-DMAKE_BOOTSTRAP" ]; NIX_CFLAGS_COMPILE = [ "-DMAKE_BOOTSTRAP" ];
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal install mandoc byacc flex makeMinimal install mandoc byacc flex rsync
]; ];
buildInputs = with self; compatIfNeeded; buildInputs = with self; compatIfNeeded;
extraPaths = with self; [ cksum.src ]; extraPaths = with self; [ cksum.src ];
@ -482,7 +485,7 @@ in lib.makeScopeWithSplicing
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff nbperf rpcgen install mandoc groff rsync nbperf rpcgen
]; ];
extraPaths = with self; [ common ]; extraPaths = with self; [ common ];
headersOnly = true; headersOnly = true;
@ -508,7 +511,7 @@ in lib.makeScopeWithSplicing
propagatedBuildInputs = with self; [ include ]; propagatedBuildInputs = with self; [ include ];
nativeBuildInputs = with buildPackages.netbsd; [ nativeBuildInputs = with buildPackages.netbsd; [
bsdSetupHook bsdSetupHook
makeMinimal install tsort lorder statHook uudecode config genassym makeMinimal install tsort lorder statHook rsync uudecode config genassym
]; ];
postConfigure = '' postConfigure = ''
@ -748,7 +751,7 @@ in lib.makeScopeWithSplicing
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff flex install mandoc groff flex
byacc genassym gencat lorder tsort statHook byacc genassym gencat lorder tsort statHook rsync
]; ];
buildInputs = with self; [ headers ]; buildInputs = with self; [ headers ];
extraPaths = with self; [ sys.src ld_elf_so.src ]; extraPaths = with self; [ sys.src ld_elf_so.src ];
@ -786,7 +789,7 @@ in lib.makeScopeWithSplicing
bsdSetupHook bsdSetupHook
makeMinimal makeMinimal
install mandoc groff flex install mandoc groff flex
byacc genassym gencat lorder tsort statHook rpcgen byacc genassym gencat lorder tsort statHook rsync rpcgen
]; ];
buildInputs = with self; [ headers csu ]; buildInputs = with self; [ headers csu ];
NIX_CFLAGS_COMPILE = "-B${self.csu}/lib"; NIX_CFLAGS_COMPILE = "-B${self.csu}/lib";

View file

@ -70,10 +70,7 @@ setBSDSourceDir() {
export _SRC_TOP_=$BSDSRCDIR export _SRC_TOP_=$BSDSRCDIR
chmod -R u+w $sourceRoot chmod -R u+w $sourceRoot
for path in $extraPaths; do for path in $extraPaths; do
cd $path rsync -Er --chmod u+w $path/ $sourceRoot/
find . -type d -exec mkdir -p $sourceRoot/\{} \;
find . -type f -exec cp -pr \{} $sourceRoot/\{} \;
chmod -R u+w $sourceRoot
done done
cd $sourceRoot cd $sourceRoot
@ -104,6 +101,9 @@ moveUsrDir() {
if [ -d $prefix ]; then if [ -d $prefix ]; then
# Remove lingering /usr references # Remove lingering /usr references
if [ -d $prefix/usr ]; then 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 pushd $prefix/usr
find . -type d -exec mkdir -p $out/\{} \; find . -type d -exec mkdir -p $out/\{} \;
find . \( -type f -o -type l \) -exec mv \{} $out/\{} \; find . \( -type f -o -type l \) -exec mv \{} $out/\{} \;