mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-09 12:09:08 +00:00
builder: Use rsync for copying vendor environment
cp will fail on dangling symlinks and it's errors can't be ignored. rsync gives us a greater degree of control so let's use that.
This commit is contained in:
parent
cc75990c60
commit
3b4076283d
1 changed files with 7 additions and 3 deletions
|
@ -11,6 +11,7 @@
|
||||||
, runtimeShell
|
, runtimeShell
|
||||||
, writeScript
|
, writeScript
|
||||||
, gomod2nix
|
, gomod2nix
|
||||||
|
, rsync
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
||||||
|
@ -181,6 +182,8 @@ let
|
||||||
|
|
||||||
CGO_ENABLED = attrs.CGO_ENABLED or go.CGO_ENABLED;
|
CGO_ENABLED = attrs.CGO_ENABLED or go.CGO_ENABLED;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ rsync ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ go ];
|
propagatedBuildInputs = [ go ];
|
||||||
|
|
||||||
GO_NO_VENDOR_CHECKS = "1";
|
GO_NO_VENDOR_CHECKS = "1";
|
||||||
|
@ -204,7 +207,8 @@ let
|
||||||
cp ${pwd + "/go.sum"} source/go.sum
|
cp ${pwd + "/go.sum"} source/go.sum
|
||||||
cp ${pwd + "/tools.go"} source/tools.go
|
cp ${pwd + "/tools.go"} source/tools.go
|
||||||
cd source
|
cd source
|
||||||
cp -rL ${vendorEnv} vendor
|
|
||||||
|
rsync -a -K --ignore-errors ${vendorEnv}/ vendor
|
||||||
|
|
||||||
${internal.install}
|
${internal.install}
|
||||||
'';
|
'';
|
||||||
|
@ -259,7 +263,7 @@ let
|
||||||
} // optionalAttrs (hasAttr "subPackages" modulesStruct) {
|
} // optionalAttrs (hasAttr "subPackages" modulesStruct) {
|
||||||
subPackages = modulesStruct.subPackages;
|
subPackages = modulesStruct.subPackages;
|
||||||
} // attrs // {
|
} // attrs // {
|
||||||
nativeBuildInputs = [ go ] ++ nativeBuildInputs;
|
nativeBuildInputs = [ rsync go ] ++ nativeBuildInputs;
|
||||||
|
|
||||||
inherit (go) GOOS GOARCH;
|
inherit (go) GOOS GOARCH;
|
||||||
|
|
||||||
|
@ -281,7 +285,7 @@ let
|
||||||
${optionalString (modulesStruct != { }) ''
|
${optionalString (modulesStruct != { }) ''
|
||||||
if [ -n "${vendorEnv}" ]; then
|
if [ -n "${vendorEnv}" ]; then
|
||||||
rm -rf vendor
|
rm -rf vendor
|
||||||
cp -rL ${vendorEnv} vendor
|
rsync -a -K --ignore-errors ${vendorEnv}/ vendor
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue