···3535};
3636```
37373838+## `testBuildFailure` {#tester-testBuildFailure}
3939+4040+Make sure that a build does not succeed. This is useful for testing testers.
4141+4242+This returns a derivation with an override on the builder, with the following effects:
4343+4444+ - Fail the build when the original builder succeeds
4545+ - Move `$out` to `$out/result`, if it exists (assuming `out` is the default output)
4646+ - Save the build log to `$out/testBuildFailure.log` (same)
4747+4848+Example:
4949+5050+```nix
5151+runCommand "example" {
5252+ failed = testers.testBuildFailure (runCommand "fail" {} ''
5353+ echo ok-ish >$out
5454+ echo failing though
5555+ exit 3
5656+ '');
5757+} ''
5858+ grep -F 'ok-ish' $failed/result
5959+ grep -F 'failing though' $failed/testBuildFailure.log
6060+ [[ 3 = $(cat $failed/testBuildFailure.exit) ]]
6161+ touch $out
6262+'';
6363+```
6464+6565+While `testBuildFailure` is designed to keep changes to the original builder's
6666+environment to a minimum, some small changes are inevitable.
6767+6868+ - The file `$TMPDIR/testBuildFailure.log` is present. It should not be deleted.
6969+ - `stdout` and `stderr` are a pipe instead of a tty. This could be improved.
7070+ - One or two extra processes are present in the sandbox during the original
7171+ builder's execution.
7272+ - The derivation and output hashes are different, but not unusual.
7373+ - The derivation includes a dependency on `buildPackages.bash` and
7474+ `expect-failure.sh`, which is built to include a transitive dependency on
7575+ `buildPackages.coreutils` and possibly more. These are not added to `PATH`
7676+ or any other environment variable, so they should be hard to observe.
7777+7878+## `testEqualContents` {#tester-equalContents}
7979+8080+Check that two paths have the same contents.
8181+8282+Example:
8383+8484+```nix
8585+testers.testEqualContents {
8686+ assertion = "sed -e performs replacement";
8787+ expected = writeText "expected" ''
8888+ foo baz baz
8989+ '';
9090+ actual = runCommand "actual" {
9191+ # not really necessary for a package that's in stdenv
9292+ nativeBuildInputs = [ gnused ];
9393+ base = writeText "base" ''
9494+ foo bar baz
9595+ '';
9696+ } ''
9797+ sed -e 's/bar/baz/g' $base >$out
9898+ '';
9999+}
100100+```
101101+38102## `testEqualDerivation` {#tester-testEqualDerivation}
3910340104Checks that two packages produce the exact same build instructions.
···11-{ pkgs, lib, callPackage, runCommand, stdenv }:
11+{ pkgs, buildPackages, lib, callPackage, runCommand, stdenv, substituteAll, }:
22# Documentation is in doc/builders/testers.chapter.md
33{
44+ # See https://nixos.org/manual/nixpkgs/unstable/#tester-testBuildFailure
55+ # or doc/builders/testers.chapter.md
66+ testBuildFailure = drv: drv.overrideAttrs (orig: {
77+ builder = buildPackages.bash;
88+ args = [
99+ (substituteAll { coreutils = buildPackages.coreutils; src = ./expect-failure.sh; })
1010+ orig.realBuilder or stdenv.shell
1111+ ] ++ orig.args or ["-e" (orig.builder or ../../stdenv/generic/default-builder.sh)];
1212+ });
1313+1414+ # See https://nixos.org/manual/nixpkgs/unstable/#tester-testEqualDerivation
1515+ # or doc/builders/testers.chapter.md
416 testEqualDerivation = callPackage ./test-equal-derivation.nix { };
5171818+ # See https://nixos.org/manual/nixpkgs/unstable/#tester-testEqualContents
1919+ # or doc/builders/testers.chapter.md
2020+ testEqualContents = {
2121+ assertion,
2222+ actual,
2323+ expected,
2424+ }: runCommand "equal-contents-${lib.strings.toLower assertion}" {
2525+ inherit assertion actual expected;
2626+ } ''
2727+ echo "Checking:"
2828+ echo "$assertion"
2929+ if ! diff -U5 -r "$actual" "$expected" --color=always
3030+ then
3131+ echo
3232+ echo 'Contents must be equal, but were not!'
3333+ echo
3434+ echo "+: expected, at $expected"
3535+ echo "-: unexpected, at $actual"
3636+ exit 1
3737+ else
3838+ find "$expected" -type f -executable > expected-executables | sort
3939+ find "$actual" -type f -executable > actual-executables | sort
4040+ if ! diff -U0 actual-executables expected-executables --color=always
4141+ then
4242+ echo
4343+ echo "Contents must be equal, but some files' executable bits don't match"
4444+ echo
4545+ echo "+: make this file executable in the actual contents"
4646+ echo "-: make this file non-executable in the actual contents"
4747+ exit 1
4848+ else
4949+ echo "expected $expected and actual $actual match."
5050+ echo 'OK'
5151+ touch $out
5252+ fi
5353+ fi
5454+ '';
5555+5656+ # See https://nixos.org/manual/nixpkgs/unstable/#tester-testVersion
5757+ # or doc/builders/testers.chapter.md
658 testVersion =
759 { package,
860 command ? "${package.meta.mainProgram or package.pname or package.name} --version",
+62
pkgs/build-support/testers/expect-failure.sh
···11+# Run a builder, flip exit code, save log and fix outputs
22+#
33+# Sub-goals:
44+# - Delegate to another original builder passed via args
55+# - Save the build log to output for further checks
66+# - Make the derivation succeed if the original builder fails
77+# - Make the derivation fail if the original builder returns exit code 0
88+#
99+# Requirements:
1010+# This runs before, without and after stdenv. Do not modify the environment;
1111+# especially not before invoking the original builder. For example, use
1212+# "@" substitutions instead of PATH.
1313+# Do not export any variables.
1414+1515+# Stricter bash
1616+set -eu
1717+1818+# ------------------------
1919+# Run the original builder
2020+2121+echo "testBuildFailure: Expecting non-zero exit from builder and args: ${*@Q}"
2222+2323+("$@" 2>&1) | @coreutils@/bin/tee $TMPDIR/testBuildFailure.log \
2424+ | while read ln; do
2525+ echo "original builder: $ln"
2626+ done
2727+2828+r=${PIPESTATUS[0]}
2929+if [[ $r = 0 ]]; then
3030+ echo "testBuildFailure: The builder did not fail, but a failure was expected!"
3131+ exit 1
3232+fi
3333+echo "testBuildFailure: Original builder produced exit code: $r"
3434+3535+# -----------------------------------------
3636+# Write the build log to the default output
3737+3838+outs=( $outputs )
3939+defOut=${outs[0]}
4040+defOutPath=${!defOut}
4141+4242+if [[ ! -d $defOutPath ]]; then
4343+ if [[ -e $defOutPath ]]; then
4444+ @coreutils@/bin/mv $defOutPath $TMPDIR/out-node
4545+ @coreutils@/bin/mkdir $defOutPath
4646+ @coreutils@/bin/mv $TMPDIR/out-node $defOutPath/result
4747+ fi
4848+fi
4949+5050+@coreutils@/bin/mkdir -p $defOutPath
5151+@coreutils@/bin/mv $TMPDIR/testBuildFailure.log $defOutPath/testBuildFailure.log
5252+echo $r >$defOutPath/testBuildFailure.exit
5353+5454+# ------------------------------------------------------
5555+# Put empty directories in place for any missing outputs
5656+5757+for outputName in ${outputs:-out}; do
5858+ outputPath="${!outputName}"
5959+ if [[ ! -e "${outputPath}" ]]; then
6060+ @coreutils@/bin/mkdir "${outputPath}";
6161+ fi
6262+done
+164-1
pkgs/build-support/testers/test/default.nix
···11-{ testers, lib, pkgs, ... }:
11+{ testers, lib, pkgs, hello, runCommand, ... }:
22let
33 pkgs-with-overlay = pkgs.extend(final: prev: {
44 proof-of-overlay-hello = prev.hello;
···2424 machine.succeed("hello | figlet >/dev/console")
2525 '';
2626 });
2727+2828+ testBuildFailure = lib.recurseIntoAttrs {
2929+ happy = runCommand "testBuildFailure-happy" {
3030+ failed = testers.testBuildFailure (runCommand "fail" {} ''
3131+ echo ok-ish >$out
3232+ echo failing though
3333+ echo also stderr 1>&2
3434+ exit 3
3535+ '');
3636+ } ''
3737+ grep -F 'failing though' $failed/testBuildFailure.log
3838+ grep -F 'also stderr' $failed/testBuildFailure.log
3939+ grep -F 'ok-ish' $failed/result
4040+ [[ 3 = $(cat $failed/testBuildFailure.exit) ]]
4141+ touch $out
4242+ '';
4343+4444+ helloDoesNotFail = runCommand "testBuildFailure-helloDoesNotFail" {
4545+ failed = testers.testBuildFailure (testers.testBuildFailure hello);
4646+4747+ # Add hello itself as a prerequisite, so we don't try to run this test if
4848+ # there's an actual failure in hello.
4949+ inherit hello;
5050+ } ''
5151+ echo "Checking $failed/testBuildFailure.log"
5252+ grep -F 'testBuildFailure: The builder did not fail, but a failure was expected' $failed/testBuildFailure.log
5353+ [[ 1 = $(cat $failed/testBuildFailure.exit) ]]
5454+ touch $out
5555+ '';
5656+5757+ multiOutput = runCommand "testBuildFailure-multiOutput" {
5858+ failed = testers.testBuildFailure (runCommand "fail" {
5959+ # dev will be the default output
6060+ outputs = ["dev" "doc" "out"];
6161+ } ''
6262+ echo i am failing
6363+ exit 1
6464+ '');
6565+ } ''
6666+ grep -F 'i am failing' $failed/testBuildFailure.log >/dev/null
6767+ [[ 1 = $(cat $failed/testBuildFailure.exit) ]]
6868+6969+ # Checking our note that dev is the default output
7070+ echo $failed/_ | grep -- '-dev/_' >/dev/null
7171+ echo 'All good.'
7272+ touch $out
7373+ '';
7474+ };
7575+7676+ testEqualContents = lib.recurseIntoAttrs {
7777+ happy = testers.testEqualContents {
7878+ assertion = "The same directory contents at different paths are recognized as equal";
7979+ expected = runCommand "expected" {} ''
8080+ mkdir -p $out/c
8181+ echo a >$out/a
8282+ echo b >$out/b
8383+ echo d >$out/c/d
8484+ '';
8585+ actual = runCommand "actual" {} ''
8686+ mkdir -p $out/c
8787+ echo a >$out/a
8888+ echo b >$out/b
8989+ echo d >$out/c/d
9090+ '';
9191+ };
9292+9393+ unequalExe =
9494+ runCommand "testEqualContents-unequalExe" {
9595+ log = testers.testBuildFailure (testers.testEqualContents {
9696+ assertion = "The same directory contents at different paths are recognized as equal";
9797+ expected = runCommand "expected" {} ''
9898+ mkdir -p $out/c
9999+ echo a >$out/a
100100+ chmod a+x $out/a
101101+ echo b >$out/b
102102+ echo d >$out/c/d
103103+ '';
104104+ actual = runCommand "actual" {} ''
105105+ mkdir -p $out/c
106106+ echo a >$out/a
107107+ echo b >$out/b
108108+ chmod a+x $out/b
109109+ echo d >$out/c/d
110110+ '';
111111+ });
112112+ } ''
113113+ (
114114+ set -x
115115+ grep -F -- "executable bits don't match" $log/testBuildFailure.log
116116+ grep -E -- '+.*-actual/a' $log/testBuildFailure.log
117117+ grep -E -- '-.*-actual/b' $log/testBuildFailure.log
118118+ grep -F -- "--- actual-executables" $log/testBuildFailure.log
119119+ grep -F -- "+++ expected-executables" $log/testBuildFailure.log
120120+ ) || {
121121+ echo "Test failed: could not find pattern in build log $log"
122122+ exit 1
123123+ }
124124+ echo 'All good.'
125125+ touch $out
126126+ '';
127127+128128+ fileDiff =
129129+ runCommand "testEqualContents-fileDiff" {
130130+ log = testers.testBuildFailure (testers.testEqualContents {
131131+ assertion = "The same directory contents at different paths are recognized as equal";
132132+ expected = runCommand "expected" {} ''
133133+ mkdir -p $out/c
134134+ echo a >$out/a
135135+ echo b >$out/b
136136+ echo d >$out/c/d
137137+ '';
138138+ actual = runCommand "actual" {} ''
139139+ mkdir -p $out/c
140140+ echo a >$out/a
141141+ echo B >$out/b
142142+ echo d >$out/c/d
143143+ '';
144144+ });
145145+ } ''
146146+ (
147147+ set -x
148148+ grep -F -- "Contents must be equal but were not" $log/testBuildFailure.log
149149+ grep -E -- '+++ .*-actual/b' $log/testBuildFailure.log
150150+ grep -E -- '--- .*-actual/b' $log/testBuildFailure.log
151151+ grep -F -- "-B" $log/testBuildFailure.log
152152+ grep -F -- "+b" $log/testBuildFailure.log
153153+ ) || {
154154+ echo "Test failed: could not find pattern in build log $log"
155155+ exit 1
156156+ }
157157+ echo 'All good.'
158158+ touch $out
159159+ '';
160160+161161+ fileMissing =
162162+ runCommand "testEqualContents-fileMissing" {
163163+ log = testers.testBuildFailure (testers.testEqualContents {
164164+ assertion = "The same directory contents at different paths are recognized as equal";
165165+ expected = runCommand "expected" {} ''
166166+ mkdir -p $out/c
167167+ echo a >$out/a
168168+ echo b >$out/b
169169+ echo d >$out/c/d
170170+ '';
171171+ actual = runCommand "actual" {} ''
172172+ mkdir -p $out/c
173173+ echo a >$out/a
174174+ echo d >$out/c/d
175175+ '';
176176+ });
177177+ } ''
178178+ (
179179+ set -x
180180+ grep -F -- "Contents must be equal but were not" $log/testBuildFailure.log
181181+ grep -E -- 'Only in .*-expected: b' $log/testBuildFailure.log
182182+ ) || {
183183+ echo "Test failed: could not find pattern in build log $log"
184184+ exit 1
185185+ }
186186+ echo 'All good.'
187187+ touch $out
188188+ '';
189189+ };
27190}
+14-9
pkgs/data/fonts/b612/default.nix
···11{ lib, fetchFromGitHub }:
2233-let
44- version = "1.008";
33+fetchFromGitHub rec {
54 pname = "b612";
66-in fetchFromGitHub {
77- name = "${pname}-font-${version}";
55+ version = "1.008";
66+87 owner = "polarsys";
98 repo = "b612";
109 rev = version;
1010+1111 postFetch = ''
1212- tar xf $downloadedFile --strip=1
1313- mkdir -p $out/share/fonts/truetype/${pname}
1414- cp fonts/ttf/*.ttf $out/share/fonts/truetype/${pname}
1212+ mkdir -p $out/share/fonts/truetype
1313+1414+ mv $out/fonts/ttf/*.ttf $out/share/fonts/truetype
1515+1616+ shopt -s extglob dotglob
1717+ rm -rf $out/!(share)
1818+ shopt -u extglob dotglob
1519 '';
1616- sha256 = "0r3lana1q9w3siv8czb3p9rrb5d9svp628yfbvvmnj7qvjrmfsiq";
2020+2121+ hash = "sha256-aJ3XzWQauPsWwEDAHT2rD9a8RvLv1kqU3krFXprmypk=";
17221823 meta = with lib; {
1919- homepage = "http://b612-font.com/";
2424+ homepage = "https://b612-font.com/";
2025 description = "Highly legible font family for use on aircraft cockpit screens";
2126 longDescription = ''
2227 B612 is the result of a research project initiated by Airbus. The font
···11-WGET_ARGS=( https://download.qt.io/official_releases/qt/6.4/6.4.0/submodules/ -A '*.tar.xz' )
11+WGET_ARGS=( https://download.qt.io/official_releases/qt/6.4/6.4.1/submodules/ -A '*.tar.xz' )
···9494 # which cannot be set at the same time as -Wformat-security
9595 hardeningDisable = [ "format" ];
96969797- patches = [
9898- # fixes consistent crashing in github on 6.4.0, can probably remove when there is a patch release
9999- # https://codereview.qt-project.org/c/qt/qtwebengine/+/436316
100100- ../patches/qtwebengine-fix.patch
101101- ];
102102-10397 postPatch = ''
10498 # Patch Chromium build tools
10599 (
···4040 description = "Unittest-compatible framework for repeating a test function over many fixtures";
4141 homepage = "https://github.com/epsy/repeated_test";
4242 license = licenses.mit;
4343- maintainers = with maintainers; [ ];
4343+ maintainers = with maintainers; [ tjni ];
4444 };
4545}
···137137 pydrive = throw "pydrive is broken and deprecated and has been replaced with pydrive2."; # added 2022-06-01
138138 pyGtkGlade = throw "Glade support for pygtk has been removed"; # added 2022-01-15
139139 pycallgraph = throw "pycallgraph has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-01-18
140140+ pychef = throw "pychef has been removed because it's been archived upstream and abandoned since 2017."; # added 2022-11-14
140141 pycryptodome-test-vectors = throw "pycryptodome-test-vectors has been removed because it is an internal package to pycryptodome"; # added 2022-05-28
141142 pyialarmxr = pyialarmxr-homeassistant; # added 2022-06-07
142143 pyialarmxr-homeassistant = throw "The package was removed together with the component support in home-assistant 2022.7.0"; # added 2022-07-07
···206207 tensorflow-estimator_2 = tensorflow-estimator; # added 2021-11-25
207208 tensorflow-tensorboard = tensorboard; # added 2022-03-06
208209 tensorflow-tensorboard_2 = tensorflow-tensorboard; # added 2021-11-25
210210+ tumpa = throw "tumpa was promoted to a top-level attribute"; # added 2022-11-19
209211 tvnamer = throw "tvnamer was moved to pkgs.tvnamer"; # added 2021-07-05
210212 types-cryptography = throw "types-cryptography has been removed because it is obsolete since cryptography version 3.4.4."; # added 2022-05-30
211213 types-paramiko = throw "types-paramiko has been removed because it was unused."; # added 2022-05-30