Merge pull request #255403 from RaitoBezarius/uboot

buildUBoot: supports Python scripts with their own environment
This commit is contained in:
Samuel Dionne-Riel 2024-02-08 21:28:04 -05:00 committed by GitHub
commit 9b5d456802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,7 @@
, openssl , openssl
, swig , swig
, which , which
, python3
, armTrustedFirmwareAllwinner , armTrustedFirmwareAllwinner
, armTrustedFirmwareAllwinnerH6 , armTrustedFirmwareAllwinnerH6
, armTrustedFirmwareAllwinnerH616 , armTrustedFirmwareAllwinnerH616
@ -44,6 +45,7 @@ let
version ? null version ? null
, src ? null , src ? null
, filesToInstall , filesToInstall
, pythonScriptsToInstall ? { }
, installDir ? "$out" , installDir ? "$out"
, defconfig , defconfig
, extraConfig ? "" , extraConfig ? ""
@ -63,6 +65,10 @@ let
] ++ extraPatches; ] ++ extraPatches;
postPatch = '' postPatch = ''
${lib.concatMapStrings (script: ''
substituteInPlace ${script} \
--replace "#!/usr/bin/env python3" "#!${pythonScriptsToInstall.${script}}/bin/python3"
'') (builtins.attrNames pythonScriptsToInstall)}
patchShebangs tools patchShebangs tools
patchShebangs scripts patchShebangs scripts
''; '';
@ -110,12 +116,12 @@ let
runHook preInstall runHook preInstall
mkdir -p ${installDir} mkdir -p ${installDir}
cp ${lib.concatStringsSep " " filesToInstall} ${installDir} cp ${lib.concatStringsSep " " (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)} ${installDir}
mkdir -p "$out/nix-support" mkdir -p "$out/nix-support"
${lib.concatMapStrings (file: '' ${lib.concatMapStrings (file: ''
echo "file binary-dist ${installDir}/${builtins.baseNameOf file}" >> "$out/nix-support/hydra-build-products" echo "file binary-dist ${installDir}/${builtins.baseNameOf file}" >> "$out/nix-support/hydra-build-products"
'') filesToInstall} '') (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)}
runHook postInstall runHook postInstall
''; '';
@ -128,7 +134,7 @@ let
license = licenses.gpl2; license = licenses.gpl2;
maintainers = with maintainers; [ bartsch dezgeg samueldr lopsided98 ]; maintainers = with maintainers; [ bartsch dezgeg samueldr lopsided98 ];
} // extraMeta; } // extraMeta;
} // removeAttrs args [ "extraMeta" ])); } // removeAttrs args [ "extraMeta" "pythonScriptsToInstall" ]));
in { in {
inherit buildUBoot; inherit buildUBoot;
@ -154,6 +160,10 @@ in {
"tools/mkenvimage" "tools/mkenvimage"
"tools/mkimage" "tools/mkimage"
]; ];
pythonScriptsToInstall = {
"tools/efivar.py" = (python3.withPackages (ps: [ ps.pyopenssl ]));
};
}; };
ubootA20OlinuxinoLime = buildUBoot { ubootA20OlinuxinoLime = buildUBoot {