nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# This test *must* be run prior to releasing any build of either stdenv or the
2# gcc that it exports! This check should also be part of CI for any PR that
3# causes a rebuild of `stdenv.cc`.
4#
5# When we used gcc's internal bootstrap it did this check as part of (and
6# serially with) the gcc derivation. Now that we bootstrap externally this
7# check can be done in parallel with any/all of stdenv's referrers. But we
8# must remember to do the check.
9#
10
11{
12 stdenv,
13 pkgs,
14 lib,
15}:
16
17with pkgs;
18# rebuild gcc using the "final" stdenv
19let
20 gcc-stageCompare =
21 (gcc-unwrapped.override {
22 reproducibleBuild = true;
23 profiledCompiler = false;
24 stdenv = overrideCC stdenv (wrapCCWith {
25 cc = stdenv.cc;
26 });
27 }).overrideAttrs
28 (_: {
29 NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out;
30 });
31in
32
33(runCommand "gcc-stageCompare"
34 {
35 checksumCompare =
36 assert lib.assertMsg (gcc-stageCompare ? checksum)
37 "tests-stdenv-gcc-stageCompare: No `checksum` output in `gcc-stageCompare` see conditional in `gcc/common/checksum.nix`";
38 gcc-stageCompare.checksum;
39
40 checksumUnwrapped =
41 assert lib.assertMsg (pkgs.gcc-unwrapped ? checksum)
42 "tests-stdenv-gcc-stageCompare: No `checksum` output in `gcc-stageCompare` see conditional in `gcc/common/checksum.nix`";
43 pkgs.gcc-unwrapped.checksum;
44 }
45 ''
46 diff -sr "$checksumUnwrapped"/checksums "$checksumCompare"/checksums && touch $out
47 ''
48).overrideAttrs
49 (a: {
50 meta = (a.meta or { }) // {
51 platforms = lib.platforms.linux;
52 };
53 })