From 3d59b0a50dcb540c0508474d4ec9fac2ce21298b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 8 Mar 2022 17:39:30 +0100 Subject: [PATCH] fwupd: use upstream install detection patch https://github.com/fwupd/fwupd/commit/5bc546221331feae9cedc1892219a25d8837955f attempts to fix the need to patch the redfish test ourselves. But it is actually not sufficient since we install the installed tests into a separate prefix, so we need to adjust the installed tests patch. --- .../linux/firmware/fwupd/default.nix | 10 +++++-- .../fwupd/fix-install-detection.patch | 13 --------- .../firmware/fwupd/installed-tests-path.patch | 29 ++++++++++++++++--- 3 files changed, 32 insertions(+), 20 deletions(-) delete mode 100644 pkgs/os-specific/linux/firmware/fwupd/fix-install-detection.patch diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix index 2c99232253ff..272bd6dbe8fc 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/default.nix +++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix @@ -140,13 +140,17 @@ let # they are not really part of the library. ./install-fwupdplugin-to-out.patch + # Fix detection of installed tests + # https://github.com/fwupd/fwupd/issues/3880 + (fetchpatch { + url = "https://github.com/fwupd/fwupd/commit/5bc546221331feae9cedc1892219a25d8837955f.patch"; + sha256 = "XcLhcDrB2/MFCXjKAyhftQgvJG4BBkp07geM9eK3q1g="; + }) + # Installed tests are installed to different output # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle. ./installed-tests-path.patch - # Tests detect fwupd is installed when prefix is /usr. - ./fix-install-detection.patch - # EFI capsule is located in fwupd-efi now. ./efi-app-path.patch diff --git a/pkgs/os-specific/linux/firmware/fwupd/fix-install-detection.patch b/pkgs/os-specific/linux/firmware/fwupd/fix-install-detection.patch deleted file mode 100644 index 56d7def5c16a..000000000000 --- a/pkgs/os-specific/linux/firmware/fwupd/fix-install-detection.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/plugins/redfish/fu-self-test.c b/plugins/redfish/fu-self-test.c -index 4710c769..1c68fdb9 100644 ---- a/plugins/redfish/fu-self-test.c -+++ b/plugins/redfish/fu-self-test.c -@@ -27,7 +27,7 @@ fu_test_is_installed_test(void) - const gchar *builddir = g_getenv("G_TEST_BUILDDIR"); - if (builddir == NULL) - return FALSE; -- return g_str_has_prefix(builddir, "/usr"); -+ return g_str_has_prefix(builddir, "/nix"); - } - - static void diff --git a/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch b/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch index 2024e84b0a83..ea50d88dfed6 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch +++ b/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch @@ -1,8 +1,8 @@ diff --git a/data/installed-tests/meson.build b/data/installed-tests/meson.build -index adadbcdd..1b51bb9c 100644 +index b8ec916f0..38209b363 100644 --- a/data/installed-tests/meson.build +++ b/data/installed-tests/meson.build -@@ -65,5 +65,5 @@ configure_file( +@@ -83,5 +83,5 @@ configure_file( output : 'fwupd-tests.conf', configuration : con2, install: true, @@ -10,10 +10,10 @@ index adadbcdd..1b51bb9c 100644 + install_dir: join_paths(get_option('installed_test_prefix'), 'etc', 'fwupd', 'remotes.d'), ) diff --git a/meson.build b/meson.build -index 772b7bbe..f59302cd 100644 +index 32fe6e408..b35d741e0 100644 --- a/meson.build +++ b/meson.build -@@ -177,8 +177,8 @@ else +@@ -183,8 +183,8 @@ else datadir = join_paths(prefix, get_option('datadir')) sysconfdir = join_paths(prefix, get_option('sysconfdir')) localstatedir = join_paths(prefix, get_option('localstatedir')) @@ -24,6 +24,14 @@ index 772b7bbe..f59302cd 100644 endif mandir = join_paths(prefix, get_option('mandir')) localedir = join_paths(prefix, get_option('localedir')) +@@ -484,6 +484,7 @@ gnome = import('gnome') + i18n = import('i18n') + + conf.set_quoted('FWUPD_PREFIX', prefix) ++conf.set_quoted('FWUPD_INSTALLED_TEST_PREFIX', get_option('installed_test_prefix')) + conf.set_quoted('FWUPD_BINDIR', bindir) + conf.set_quoted('FWUPD_LIBDIR', libdir) + conf.set_quoted('FWUPD_LIBEXECDIR', libexecdir) diff --git a/meson_options.txt b/meson_options.txt index 0a0e2853..5f68d78b 100644 --- a/meson_options.txt @@ -36,3 +44,16 @@ index 0a0e2853..5f68d78b 100644 option('tests', type : 'boolean', value : true, description : 'enable tests') option('tpm', type : 'boolean', value : true, description : 'enable TPM support') option('udevdir', type: 'string', value: '', description: 'Directory for udev rules') +diff --git a/plugins/redfish/fu-self-test.c b/plugins/redfish/fu-self-test.c +index c507fabc8..0cddc3248 100644 +--- a/plugins/redfish/fu-self-test.c ++++ b/plugins/redfish/fu-self-test.c +@@ -27,7 +27,7 @@ fu_test_is_installed_test(void) + const gchar *builddir = g_getenv("G_TEST_BUILDDIR"); + if (builddir == NULL) + return FALSE; +- return g_str_has_prefix(builddir, FWUPD_PREFIX); ++ return g_str_has_prefix(builddir, FWUPD_INSTALLED_TEST_PREFIX); + } + + static void