Fix cross eval issues (#362546)

This commit is contained in:
sternenseemann 2024-12-14 22:14:52 +01:00 committed by GitHub
commit a0a35b6c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 33 additions and 33 deletions

View file

@ -95,7 +95,7 @@ stdenvNoCC.mkDerivation {
fileset = ../../lib; fileset = ../../lib;
}; };
buildInputs = [ nativeBuildInputs = [
nixdoc nixdoc
nix nix
]; ];

View file

@ -17,7 +17,7 @@ invalidateFetcherByDrvHash (
{ {
nativeBuildInputs = [ nativeBuildInputs = [
cacert cacert
(python3.withPackages (p: [ (python3.pythonOnBuildForHost.withPackages (p: [
p.aiohttp p.aiohttp
p.rich p.rich
p.structlog p.structlog

View file

@ -1,18 +1,23 @@
{ # The pkgs used for dependencies for the testing itself { # The pkgs used for dependencies for the testing itself
# Don't test properties of pkgs.lib, but rather the lib in the parent directory # Don't test properties of pkgs.lib, but rather the lib in the parent directory
pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }, pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; },
# For testing someone may edit impure.nix to return cross pkgs, use `pkgsBuildBuild` directly so everything here works.
pkgsBB ? pkgs.pkgsBuildBuild,
nix ? pkgs-nixVersions.stable, nix ? pkgs-nixVersions.stable,
nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ], nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ],
pkgs-nixVersions ? import ./nix-for-tests.nix { inherit pkgs; }, pkgs-nixVersions ? import ./nix-for-tests.nix { pkgs = pkgsBB; },
}: }:
let let
lib = import ../.; lib = import ../.;
testWithNix = nix: testWithNix = nix:
import ./test-with-nix.nix { inherit lib nix pkgs; }; import ./test-with-nix.nix {
inherit lib nix;
pkgs = pkgsBB;
};
in in
pkgs.symlinkJoin { pkgsBB.symlinkJoin {
name = "nixpkgs-lib-tests"; name = "nixpkgs-lib-tests";
paths = map testWithNix nixVersions; paths = map testWithNix nixVersions;
} }

View file

@ -138,7 +138,7 @@ let
s: s:
mutFirstChar lib.toLower (lib.concatMapStrings (mutFirstChar lib.toUpper) (lib.splitString "-" s)); mutFirstChar lib.toLower (lib.concatMapStrings (mutFirstChar lib.toUpper) (lib.splitString "-" s));
# finds the images archive for the desired architecture, aborts in case no suitable archive is found # finds the images archive for the desired architecture, throws in case no suitable archive is found
findImagesArchive = findImagesArchive =
arch: arch:
let let
@ -146,17 +146,17 @@ let
in in
lib.findFirst ( lib.findFirst (
n: lib.hasInfix arch n n: lib.hasInfix arch n
) (abort "k3s: no airgap images for ${arch} available") imagesVersionsNames; ) (throw "k3s: no airgap images for ${arch} available") imagesVersionsNames;
# a shortcut that provides the images archive for the host platform. Currently only supports # a shortcut that provides the images archive for the host platform. Currently only supports
# aarch64 (arm64) and x86_64 (amd64), aborts on other architectures. # aarch64 (arm64) and x86_64 (amd64), throws on other architectures.
airgapImages = fetchurl ( airgapImages = fetchurl (
if stdenv.hostPlatform.isAarch64 then if stdenv.hostPlatform.isAarch64 then
imagesVersions.${findImagesArchive "arm64"} imagesVersions.${findImagesArchive "arm64"}
else if stdenv.hostPlatform.isx86_64 then else if stdenv.hostPlatform.isx86_64 then
imagesVersions.${findImagesArchive "amd64"} imagesVersions.${findImagesArchive "amd64"}
else else
abort "k3s: airgap images cannot be found automatically for architecture ${stdenv.hostPlatform.linuxArch}, consider using an image archive with an explicit architecture." throw "k3s: airgap images cannot be found automatically for architecture ${stdenv.hostPlatform.linuxArch}, consider using an image archive with an explicit architecture."
); );
# so, k3s is a complicated thing to package # so, k3s is a complicated thing to package

View file

@ -72,7 +72,7 @@ stdenv.mkDerivation rec {
else if stdenv.hostPlatform.isAarch64 then else if stdenv.hostPlatform.isAarch64 then
"arm64" "arm64"
else else
abort "unsupported system: ${stdenv.system}" throw "unsupported system: ${stdenv.system}"
}" }"
]; ];

View file

@ -33,15 +33,9 @@
, nettools , nettools
, nixosTests , nixosTests
# FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host
# This leads to compilation errors when cross compiling.
# E.g. net-snmp-config for x86_64 does not return the ARM64 paths.
#
# SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
# SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
, snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
# other general options besides snmp support # general options
, snmpSupport ? true
, rpkiSupport ? true , rpkiSupport ? true
, numMultipath ? 64 , numMultipath ? 64
, watchfrrSupport ? true , watchfrrSupport ? true
@ -81,9 +75,6 @@
, ospfApi ? true , ospfApi ? true
}: }:
lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform))
"cannot enable SNMP support due to cross-compilation issues with net-snmp-config"
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "frr"; pname = "frr";
version = "10.1"; version = "10.1";
@ -194,6 +185,9 @@ stdenv.mkDerivation (finalAttrs: {
(lib.strings.enableFeature ospfApi "ospfapi") (lib.strings.enableFeature ospfApi "ospfapi")
# Cumulus options # Cumulus options
(lib.strings.enableFeature cumulusSupport "cumulus") (lib.strings.enableFeature cumulusSupport "cumulus")
] ++ lib.optionals snmpSupport [
# Used during build for paths, `dev` has build shebangs so can be run during build.
"NETSNMP_CONFIG=${lib.getDev net-snmp}/bin/net-snmp-config"
]; ];
postPatch = '' postPatch = ''

View file

@ -45,7 +45,7 @@ let
else if isx86_64 then else if isx86_64 then
"amd64" "amd64"
else else
abort "no Nim CPU support known for ${config}"; throw "no Nim CPU support known for ${config}";
parseOs = parseOs =
platform: platform:
@ -72,7 +72,7 @@ let
else if isiOS then else if isiOS then
"iOS" "iOS"
else else
abort "no Nim OS support known for ${config}"; throw "no Nim OS support known for ${config}";
parsePlatform = p: { parsePlatform = p: {
cpu = parseCpu p; cpu = parseCpu p;

View file

@ -3,7 +3,7 @@
makeScopeWithSplicing', makeScopeWithSplicing',
}: }:
makeScopeWithSplicing' { makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope; otherSplices = generateSplicesForMkScope "reposilitePlugins";
f = f =
self: self:
{ {

View file

@ -22,8 +22,6 @@ let
in in
assert stdenv.hostPlatform.system == "x86_64-linux";
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "saleae-logic"; pname = "saleae-logic";
version = "1.2.18"; version = "1.2.18";
@ -92,7 +90,7 @@ stdenv.mkDerivation rec {
homepage = "https://www.saleae.com/"; homepage = "https://www.saleae.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree; license = licenses.unfree;
platforms = platforms.linux; platforms = intersectLists platforms.x86_64 platforms.linux;
maintainers = [ maintainers.bjornfor ]; maintainers = [ maintainers.bjornfor ];
}; };
} }

View file

@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
startScript = if stdenv.hostPlatform.isx86_32 then "START_LINUX_X86" startScript = if stdenv.hostPlatform.isx86_32 then "START_LINUX_X86"
else if stdenv.hostPlatform.isx86_64 then "START_LINUX_X86_64" else if stdenv.hostPlatform.isx86_64 then "START_LINUX_X86_64"
#else if stdenv.hostPlatform.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin #else if stdenv.hostPlatform.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin
else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; else throw "Unsupported platform: ${stdenv.hostPlatform.linuxArch}.";
linuxExecutable = if stdenv.hostPlatform.isx86_32 then "pixilang_linux_x86" linuxExecutable = if stdenv.hostPlatform.isx86_32 then "pixilang_linux_x86"
else if stdenv.hostPlatform.isx86_64 then "pixilang_linux_x86_64" else if stdenv.hostPlatform.isx86_64 then "pixilang_linux_x86_64"

View file

@ -541,7 +541,7 @@ in stdenv.mkDerivation {
"; ";
buildProject lldb llvm-project/lldb buildProject lldb llvm-project/lldb
${lib.optionalString stdenv.hostPlatform.isDarwin '' ${lib.optionalString stdenv.targetPlatform.isDarwin ''
# Need to do a standalone build of concurrency for Darwin back deployment. # Need to do a standalone build of concurrency for Darwin back deployment.
# Based on: utils/swift_build_support/swift_build_support/products/backdeployconcurrency.py # Based on: utils/swift_build_support/swift_build_support/products/backdeployconcurrency.py
cmakeFlags=" cmakeFlags="

View file

@ -802,7 +802,7 @@ stdenv.mkDerivation ({
buildInputs = buildInputs =
otherBuildInputsSystem; otherBuildInputsSystem;
LANG = "en_US.UTF-8"; LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = lib.optionalString (stdenv.buildPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive";
"NIX_${ghcCommandCaps}" = "${ghcEnv}/bin/${ghcCommand}"; "NIX_${ghcCommandCaps}" = "${ghcEnv}/bin/${ghcCommand}";
"NIX_${ghcCommandCaps}PKG" = "${ghcEnv}/bin/${ghcCommand}-pkg"; "NIX_${ghcCommandCaps}PKG" = "${ghcEnv}/bin/${ghcCommand}-pkg";
# TODO: is this still valid? # TODO: is this still valid?

View file

@ -204,7 +204,7 @@ let
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"--disable-toolbox-glue" "--disable-toolbox-glue"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"PYTHON_FOR_BUILD=${lib.getBin buildPackages.python}/bin/python" "PYTHON_FOR_BUILD=${lib.getBin buildPackages.python27}/bin/python"
"ac_cv_buggy_getaddrinfo=no" "ac_cv_buggy_getaddrinfo=no"
# Assume little-endian IEEE 754 floating point when cross compiling # Assume little-endian IEEE 754 floating point when cross compiling
"ac_cv_little_endian_double=yes" "ac_cv_little_endian_double=yes"
@ -239,7 +239,7 @@ let
nativeBuildInputs = nativeBuildInputs =
[ autoreconfHook ] [ autoreconfHook ]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform)
[ buildPackages.stdenv.cc buildPackages.python ]; [ buildPackages.stdenv.cc buildPackages.python27 ];
mkPaths = paths: { mkPaths = paths: {
C_INCLUDE_PATH = lib.makeSearchPathOutput "dev" "include" paths; C_INCLUDE_PATH = lib.makeSearchPathOutput "dev" "include" paths;

View file

@ -14,6 +14,7 @@
}: }:
assert stdenv.cc.isGNU; assert stdenv.cc.isGNU;
with pkgs; with pkgs;
# rebuild gcc using the "final" stdenv # rebuild gcc using the "final" stdenv
let gcc-stageCompare = (gcc-unwrapped.override { let gcc-stageCompare = (gcc-unwrapped.override {
@ -25,7 +26,9 @@ let gcc-stageCompare = (gcc-unwrapped.override {
}).overrideAttrs(_: { }).overrideAttrs(_: {
NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out; NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out;
}); });
in (runCommand "gcc-stageCompare" {} '' in
assert lib.assertMsg (gcc-stageCompare ? checksum) "tests-stdenv-gcc-stageCompare: No `checksum` output in `gcc-stageCompare` see conditional in `gcc/common/checksum.nix`";
(runCommand "gcc-stageCompare" {} ''
diff -sr ${pkgs.gcc-unwrapped.checksum}/checksums ${gcc-stageCompare.checksum}/checksums && touch $out diff -sr ${pkgs.gcc-unwrapped.checksum}/checksums ${gcc-stageCompare.checksum}/checksums && touch $out
'').overrideAttrs (a: { '').overrideAttrs (a: {
meta = (a.meta or { }) // { platforms = lib.platforms.linux; }; meta = (a.meta or { }) // { platforms = lib.platforms.linux; };