Merge pull request #331855 from pbsds/fix-nix-build-top-1722623704

treewide: remove hardcoded /build
This commit is contained in:
Atemu 2024-08-07 00:54:44 +02:00 committed by GitHub
commit c9dd3fb1a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 23 additions and 17 deletions

View File

@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
];
postPatch = ''
patchShebangs /build/source/build-aux/meson/postinstall.py
patchShebangs build-aux/meson/postinstall.py
'';
meta = with lib; {

View File

@ -29,7 +29,7 @@ buildKodiAddon rec {
'';
postInstall = ''
mv /build/source/addon.xml $out${addonDir}/${namespace}/
cp -v addon.xml $out${addonDir}/$namespace/
'';
propagatedBuildInputs = [

View File

@ -36,7 +36,7 @@ buildKodiAddon rec {
'';
postInstall = ''
mv /build/source/addon.xml $out${addonDir}/${namespace}/
cp -v addon.xml $out${addonDir}/$namespace/
'';
propagatedBuildInputs = [

View File

@ -52,8 +52,8 @@ python3Packages.buildPythonApplication rec {
];
# wrapGAppsHook4 propogates gtk4 -- which provides gtk4-update-icon-cache instead
preInstall = ''
substituteInPlace /build/source/meson_post_install.py \
postPatch = ''
substituteInPlace meson_post_install.py \
--replace-fail gtk-update-icon-cache gtk4-update-icon-cache
'';

View File

@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
patchPhase = ''
runHook prePatch
patchShebangs --build /build/source/scripts/*
patchShebangs --build scripts/*
runHook postPatch
'';

View File

@ -47,16 +47,19 @@ stdenv.mkDerivation rec {
"-DCMAKE_RANLIB=${stdenv.cc.cc}/bin/gcc-ranlib"
];
postBuild = ''
cd .. # move out of cmakeBuildDir
'';
doCheck = cliSupport;
preCheck = ''
cd ..
sed -i tests/runTests.du \
-e '/http/d'
sed -i tests/path/realpath.du \
-e 's/usr/build/g'
sed -i tests/path/isDir.du \
-e 's,/usr/bin,/build/source,' \
-e "s,/usr/bin,$PWD," \
-e '/home/d'
'';
@ -67,11 +70,11 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out
cp -r /build/source/src/include $out/include
cp -r src/include $out/include
mkdir -p $out/lib
cp /build/source/build/src/libdictu_api* $out/lib
cp build/src/libdictu_api* $out/lib
'' + lib.optionalString cliSupport ''
install -Dm755 /build/source/dictu $out/bin/dictu
install -Dm755 dictu $out/bin/dictu
'';
meta = with lib; {

View File

@ -1,5 +1,6 @@
{
buildPythonPackage,
python,
fetchFromGitHub,
lib,
requests,
@ -25,8 +26,10 @@ buildPythonPackage rec {
postPatch = ''
# fix hardcoded absolute paths
substituteInPlace **/*.* \
--replace /Users/ces/Desktop/code/naked /build/source
substituteInPlace tests/test_SYSTEM*.py \
--replace-fail /Users/ces/Desktop/code/naked/tests/ "$PWD"/tests/
substituteInPlace lib/Naked/toolshed/c/*.c \
--replace-fail /Users/ces/Desktop/code/naked/lib/ $out/${python.sitePackages}/
'';
nativeBuildInputs = [

View File

@ -178,7 +178,7 @@ buildPythonPackage rec {
preCheck = ''
# build/temp* refers to build_ext.build_temp (looked up in the build logs)
(cd /build/source/python/build/temp* ; ctest)
(cd ./build/temp* ; ctest)
# For pytestCheckHook
cd test/unit

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
cp ./bin/bm $out/bin/
substituteInPlace $out/bin/bm \
--replace /build/source $out/share/bonnmotion
--replace-fail "$PWD" $out/share/bonnmotion
runHook postInstall
'';

View File

@ -546,7 +546,7 @@ in python.pkgs.buildPythonApplication rec {
];
postPatch = ''
substituteInPlace tests/test_config.py --replace-fail '"/usr"' '"/build/media"'
substituteInPlace tests/test_config.py --replace-fail '"/usr"' "\"$NIX_BUILD_TOP/media\""
substituteInPlace pyproject.toml --replace-fail "wheel~=0.43.0" wheel
@ -676,7 +676,7 @@ in python.pkgs.buildPythonApplication rec {
export HOME="$TEMPDIR"
# the tests require the existance of a media dir
mkdir /build/media
mkdir "$NIX_BUILD_TOP"/media
# put ping binary into PATH, e.g. for wake_on_lan tests
export PATH=${inetutils}/bin:$PATH