From 8efcdcd25dec873a35496649834ef585951473df Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Tue, 22 Jul 2025 16:47:32 +0200 Subject: [PATCH] snapcraft: fix broken test from mismatched dep We're using a later version of `craft-cli` than snapcraft is expecting, and thus one of the error message strings that is tested for has changed slightly - this patch corrects that and can be dropped when snapcraft adopts a later version of `craft-cli`. --- pkgs/by-name/sn/snapcraft/esm-test.patch | 14 ++++++++++++++ pkgs/by-name/sn/snapcraft/package.nix | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 pkgs/by-name/sn/snapcraft/esm-test.patch diff --git a/pkgs/by-name/sn/snapcraft/esm-test.patch b/pkgs/by-name/sn/snapcraft/esm-test.patch new file mode 100644 index 000000000000..e2c3e4d32815 --- /dev/null +++ b/pkgs/by-name/sn/snapcraft/esm-test.patch @@ -0,0 +1,14 @@ +diff --git i/tests/unit/test_application.py w/tests/unit/test_application.py +index d5da2454c..2a9bcd6f9 100644 +--- i/tests/unit/test_application.py ++++ w/tests/unit/test_application.py +@@ -391,7 +391,8 @@ def test_esm_error(snapcraft_yaml, base, monkeypatch, capsys): + _, err = capsys.readouterr() + + assert re.match( +- rf"^Base {base!r} is not supported by this version of Snapcraft.\n" ++ rf"^Running snapcraft without a command will not be possible in future releases. Use 'snapcraft pack' instead.\n" ++ rf"Base {base!r} is not supported by this version of Snapcraft.\n" + rf"Recommended resolution: Use Snapcraft .* from the '.*' channel of snapcraft where {base!r} was last supported.\n" + r"For more information, check out: .*/reference/bases\n", + err, diff --git a/pkgs/by-name/sn/snapcraft/package.nix b/pkgs/by-name/sn/snapcraft/package.nix index 9e5043d159c9..91053416956d 100644 --- a/pkgs/by-name/sn/snapcraft/package.nix +++ b/pkgs/by-name/sn/snapcraft/package.nix @@ -26,6 +26,12 @@ python312Packages.buildPythonApplication rec { }; patches = [ + # We're using a later version of `craft-cli` than expected, which + # adds an extra deprecation warning to the CLI output, meaning that + # an expected error message looks slightly different. This patch corrects + # that by checking for the updated error message and can be dropped in a + # later release of snapcraft. + ./esm-test.patch # Snapcraft is only officially distributed as a snap, as is LXD. The socket # path for LXD must be adjusted so that it's at the correct location for LXD # on NixOS. This patch will likely never be accepted upstream.