From 413a50ede61e06e17e160417bf743c881a48011e Mon Sep 17 00:00:00 2001 From: Tom Fitzhenry Date: Sat, 26 Feb 2022 17:53:14 +1100 Subject: [PATCH 1/3] fwupd: 1.7.2 -> 1.7.6 https://github.com/fwupd/fwupd/releases/tag/1.7.3 https://github.com/fwupd/fwupd/releases/tag/1.7.4 https://github.com/fwupd/fwupd/releases/tag/1.7.5 https://github.com/fwupd/fwupd/releases/tag/1.7.6 --- ...d-option-for-installation-sysconfdir.patch | 48 ++++++++++++------- .../linux/firmware/fwupd/default.nix | 16 ++++++- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch b/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch index 66194430b251..bdb2fc34728a 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch +++ b/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch @@ -1,28 +1,27 @@ diff --git a/data/meson.build b/data/meson.build -index f10d4ff6..2dc66fb6 100644 +index 2ae29ce5..342cac92 100644 --- a/data/meson.build +++ b/data/meson.build -@@ -21,7 +21,7 @@ endif +@@ -26,7 +26,7 @@ endif if build_standalone install_data(['daemon.conf'], - install_dir : join_paths(sysconfdir, 'fwupd') + install_dir : join_paths(sysconfdir_install, 'fwupd') ) - install_data(['power.quirk'], + install_data(['power.quirk', 'cfi.quirk'], install_dir: join_paths(datadir, 'fwupd', 'quirks.d')) diff --git a/data/pki/meson.build b/data/pki/meson.build -index dcd9e128..ff137f3a 100644 +index 2a7d0f24..091981f7 100644 --- a/data/pki/meson.build +++ b/data/pki/meson.build -@@ -2,24 +2,23 @@ install_data([ +@@ -12,13 +12,13 @@ install_data([ 'GPG-KEY-Linux-Foundation-Firmware', 'GPG-KEY-Linux-Vendor-Firmware-Service', ], - install_dir : join_paths(sysconfdir, 'pki', 'fwupd') + install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd') ) - install_data([ 'GPG-KEY-Linux-Foundation-Metadata', 'GPG-KEY-Linux-Vendor-Firmware-Service', @@ -30,7 +29,9 @@ index dcd9e128..ff137f3a 100644 - install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata') + install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd-metadata') ) + endif +@@ -26,11 +26,11 @@ if supported_pkcs7 == '1' install_data([ 'LVFS-CA.pem', ], @@ -43,7 +44,7 @@ index dcd9e128..ff137f3a 100644 - install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata') + install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd-metadata') ) -- + endif diff --git a/data/remotes.d/meson.build b/data/remotes.d/meson.build index 02d8777b..2c89d593 100644 --- a/data/remotes.d/meson.build @@ -82,10 +83,10 @@ index 02d8777b..2c89d593 100644 + install_dir: join_paths(sysconfdir_install, 'fwupd', 'remotes.d'), ) diff --git a/meson.build b/meson.build -index 7557cd4a..4c98de6d 100644 +index 394f40fa..7b602c73 100644 --- a/meson.build +++ b/meson.build -@@ -190,6 +190,12 @@ endif +@@ -187,6 +187,12 @@ endif mandir = join_paths(prefix, get_option('mandir')) localedir = join_paths(prefix, get_option('localedir')) @@ -99,14 +100,14 @@ index 7557cd4a..4c98de6d 100644 gio = dependency('gio-2.0', version : '>= 2.45.8') giounix = dependency('gio-unix-2.0', version : '>= 2.45.8', required: false) diff --git a/meson_options.txt b/meson_options.txt -index 94f73898..5de6cc7b 100644 +index c1b483cb..047dbdd8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ +option('sysconfdir_install', type: 'string', value: '', description: 'sysconfdir to use during installation') option('build', type : 'combo', choices : ['all', 'standalone', 'library'], value : 'all', description : 'build type') option('consolekit', type : 'boolean', value : true, description : 'enable ConsoleKit support') - option('firmware-packager', type : 'boolean', value : true, description : 'enable firmware-packager installation') + option('static_analysis', type : 'boolean', value : false, description : 'enable GCC static analysis support') diff --git a/plugins/dell-esrt/meson.build b/plugins/dell-esrt/meson.build index e9f12879..a0126dbb 100644 --- a/plugins/dell-esrt/meson.build @@ -119,8 +120,21 @@ index e9f12879..a0126dbb 100644 + install_dir: join_paths(sysconfdir_install, 'fwupd', 'remotes.d'), ) endif +diff --git a/plugins/msr/meson.build b/plugins/msr/meson.build +index 3ea47456..40dbd116 100644 +--- a/plugins/msr/meson.build ++++ b/plugins/msr/meson.build +@@ -12,7 +12,7 @@ install_data(['fwupd-msr.conf'], + endif + + install_data(['msr.conf'], +- install_dir: join_paths(sysconfdir, 'fwupd') ++ install_dir: join_paths(sysconfdir_install, 'fwupd') + ) + shared_module('fu_plugin_msr', + fu_hash, diff --git a/plugins/redfish/meson.build b/plugins/redfish/meson.build -index 5263048c..c46fac64 100644 +index 4a0a8664..7d9ba77d 100644 --- a/plugins/redfish/meson.build +++ b/plugins/redfish/meson.build @@ -53,7 +53,7 @@ shared_module('fu_plugin_redfish', @@ -129,14 +143,14 @@ index 5263048c..c46fac64 100644 install_data(['redfish.conf'], - install_dir: join_paths(sysconfdir, 'fwupd'), + install_dir: join_paths(sysconfdir_install, 'fwupd'), - install_mode: 'rw-r-----', ) + if get_option('tests') diff --git a/plugins/thunderbolt/meson.build b/plugins/thunderbolt/meson.build -index 646ed6cb..8d7c59aa 100644 +index 1ba9562f..c074f770 100644 --- a/plugins/thunderbolt/meson.build +++ b/plugins/thunderbolt/meson.build -@@ -35,7 +35,7 @@ fu_plugin_thunderbolt = shared_module('fu_plugin_thunderbolt', +@@ -37,7 +37,7 @@ fu_plugin_thunderbolt = shared_module('fu_plugin_thunderbolt', ) install_data(['thunderbolt.conf'], @@ -146,7 +160,7 @@ index 646ed6cb..8d7c59aa 100644 # we use functions from 2.52 in the tests if get_option('tests') and umockdev.found() and gio.version().version_compare('>= 2.52') diff --git a/plugins/uefi-capsule/meson.build b/plugins/uefi-capsule/meson.build -index 708586b0..f29536b1 100644 +index 04cbd51a..9a8c43de 100644 --- a/plugins/uefi-capsule/meson.build +++ b/plugins/uefi-capsule/meson.build @@ -21,7 +21,7 @@ if host_machine.system() == 'linux' @@ -158,7 +172,7 @@ index 708586b0..f29536b1 100644 ) elif host_machine.system() == 'freebsd' backend_srcs += 'fu-uefi-backend-freebsd.c' -@@ -116,7 +116,7 @@ if get_option('man') +@@ -114,7 +114,7 @@ if get_option('compat_cli') and get_option('man') endif install_data(['uefi_capsule.conf'], diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix index 077c37a72cb3..e11543fe94ca 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/default.nix +++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix @@ -12,6 +12,7 @@ , libgudev , polkit , libxmlb +, glib , gusb , sqlite , libarchive @@ -112,7 +113,7 @@ let self = stdenv.mkDerivation rec { pname = "fwupd"; - version = "1.7.2"; + version = "1.7.6"; # libfwupd goes to lib # daemon, plug-ins and libfwupdplugin go to out @@ -121,7 +122,7 @@ let src = fetchurl { url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz"; - sha256 = "sha256-hjLfacO6/Fk4fNy1F8POMaWXoJAm5E9ZB9g4RnG5+DQ="; + sha256 = "sha256-fr4VFKy2iNJknOzDktuSkJTaPwPPyYqcD6zKuwhJEvo="; }; patches = [ @@ -145,6 +146,13 @@ let # EFI capsule is located in fwupd-efi now. ./efi-app-path.patch + + # Drop hard-coded FHS path + # https://github.com/fwupd/fwupd/issues/4360 + (fetchpatch { + url = "https://github.com/fwupd/fwupd/commit/14cc2e7ee471b66ee2ef54741f4bec1f92204620.patch"; + sha256 = "47682oqE66Y6QKPtN2mYpnb2+TIJFqBgsgx60LmC3FM="; + }) ]; nativeBuildInputs = [ @@ -250,6 +258,9 @@ let contrib/generate-version-script.py \ meson_post_install.sh \ po/test-deps + + substituteInPlace data/installed-tests/fwupdmgr-p2p.sh \ + --replace "gdbus" ${glib.bin}/bin/gdbus ''; preCheck = '' @@ -301,6 +312,7 @@ let passthru = { filesInstalledToEtc = [ "fwupd/daemon.conf" + "fwupd/msr.conf" "fwupd/remotes.d/lvfs-testing.conf" "fwupd/remotes.d/lvfs.conf" "fwupd/remotes.d/vendor.conf" From b3c966ce077ea5c2108ea50b4a9f07a673c71701 Mon Sep 17 00:00:00 2001 From: Tom Fitzhenry Date: Sun, 27 Feb 2022 00:13:52 +1100 Subject: [PATCH 2/3] fwupd: enable modemmanager plugin --- pkgs/os-specific/linux/firmware/fwupd/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix index e11543fe94ca..2c99232253ff 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/default.nix +++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix @@ -51,6 +51,9 @@ , nixosTests , runCommand , unstableGitUpdater +, modemmanager +, libqmi +, libmbim }: let @@ -195,6 +198,9 @@ let efivar fwupd-efi protobufc + modemmanager + libmbim + libqmi ] ++ lib.optionals haveDell [ libsmbios ]; @@ -214,6 +220,7 @@ let "--sysconfdir=/etc" "-Dsysconfdir_install=${placeholder "out"}/etc" "-Defi_os_dir=nixos" + "-Dplugin_modem_manager=true" # We do not want to place the daemon into lib (cyclic reference) "--libexecdir=${placeholder "out"}/libexec" From 3d59b0a50dcb540c0508474d4ec9fac2ce21298b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 8 Mar 2022 17:39:30 +0100 Subject: [PATCH 3/3] 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