From 498c2d6827ddedb75924af2c8d3f077a3bcb3849 Mon Sep 17 00:00:00 2001 From: Matei Dibu Date: Mon, 30 Dec 2024 14:16:28 +0200 Subject: [PATCH] rasdaemon: 0.8.0 -> 0.8.2 --- nixos/tests/rasdaemon.nix | 2 +- pkgs/by-name/ra/rasdaemon/package.nix | 109 ++++++++++++-------------- 2 files changed, 52 insertions(+), 59 deletions(-) diff --git a/nixos/tests/rasdaemon.nix b/nixos/tests/rasdaemon.nix index 7eeb8b0aa6a1..c7b147a1ca52 100644 --- a/nixos/tests/rasdaemon.nix +++ b/nixos/tests/rasdaemon.nix @@ -29,7 +29,7 @@ import ./make-test-python.nix ( machine.wait_for_unit("multi-user.target") # confirm rasdaemon is running and has a valid database # some disk errors detected in qemu for some reason ¯\_(ツ)_/¯ - machine.succeed("ras-mc-ctl --errors | tee /dev/stderr | grep -q 'No .* errors.'") + machine.wait_until_succeeds("ras-mc-ctl --errors | tee /dev/stderr | grep -q 'No .* errors.'") # confirm the supplied labels text made it into the system machine.succeed("grep -q 'vendor: none' /etc/ras/dimm_labels.d/labels >&2") machine.shutdown() diff --git a/pkgs/by-name/ra/rasdaemon/package.nix b/pkgs/by-name/ra/rasdaemon/package.nix index 3bf564a6e499..27f80748b727 100644 --- a/pkgs/by-name/ra/rasdaemon/package.nix +++ b/pkgs/by-name/ra/rasdaemon/package.nix @@ -1,65 +1,56 @@ { - lib, - stdenv, - fetchFromGitHub, autoreconfHook, - pkg-config, - glibcLocales, - kmod, - coreutils, - perl, - dmidecode, - hwdata, - sqlite, + fetchFromGitHub, + lib, libtraceevent, - fetchpatch, + nix-update-script, nixosTests, + perl, + pkg-config, + sqlite, + stdenv, + # Options + enableDmidecode ? stdenv.hostPlatform.isx86_64, + dmidecode, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "rasdaemon"; - version = "0.8.0"; + version = "0.8.2"; src = fetchFromGitHub { owner = "mchehab"; repo = "rasdaemon"; - rev = "v${version}"; - sha256 = "sha256-BX3kc629FOh5cnD6Sa/69wKdhmhT3Rpz5ZvhnD4MclQ="; + tag = "v${finalAttrs.version}"; + hash = "sha256-veaqAbSJvoUzkn1OLYY3t3y9Bh8dzuenpLGO2yz/yaM="; }; - patches = [ - (fetchpatch { - # fix #295002 (segfault on AMD), will be in the release after 0.8.0 - name = "fix crash on AMD"; - url = "https://github.com/mchehab/rasdaemon/commit/f1ea76375281001cdf4a048c1a4a24d86c6fbe48.patch"; - hash = "sha256-1VPDTrAsvZGiGbh52EUdG6tYV/n6wUS0mphOSXzran0="; - }) - ]; + strictDeps = true; + + enableParallelBuilding = true; nativeBuildInputs = [ autoreconfHook pkg-config ]; - buildInputs = [ - coreutils - glibcLocales - hwdata - kmod - sqlite - libtraceevent - (perl.withPackages ( - ps: with ps; [ - DBI - DBDSQLite - ] - )) - ] ++ lib.optionals (!stdenv.hostPlatform.isAarch64) [ dmidecode ]; + buildInputs = + [ + libtraceevent + (perl.withPackages ( + ps: with ps; [ + DBDSQLite + ] + )) + sqlite + ] + ++ lib.optionals enableDmidecode [ + dmidecode + ]; configureFlags = [ "--sysconfdir=/etc" "--localstatedir=/var" - "--with-sysconfdefdir=${placeholder "out"}/etc/sysconfig" "--enable-all" ]; @@ -83,9 +74,15 @@ stdenv.mkDerivation rec { # easy way out, ends up installing /nix/store/...rasdaemon/bin in $out - postConfigure = '' - substituteInPlace Makefile \ - --replace '"$(DESTDIR)/etc/ras/dimm_labels.d"' '"$(prefix)/etc/ras/dimm_labels.d"' + postPatch = '' + patchShebangs contrib/ + ''; + + preConfigure = '' + substituteInPlace Makefile.am \ + --replace-fail '"$(DESTDIR)@sysconfdir@/ras/dimm_labels.d"' '"$(prefix)@sysconfdir@/ras/dimm_labels.d"' \ + --replace-fail '"$(DESTDIR)@SYSCONFDEFDIR@/rasdaemon"' '"$(prefix)@SYSCONFDEFDIR@/rasdaemon"' \ + --replace-fail '"$(DESTDIR)@sysconfdir@/ras/triggers' '"$(prefix)@sysconfdir@/ras/triggers' ''; outputs = [ @@ -100,20 +97,16 @@ stdenv.mkDerivation rec { install -Dm 0755 contrib/edac-tests $inject/bin/edac-tests ''; - postFixup = - '' - # Fix dmidecode and modprobe paths - substituteInPlace $out/bin/ras-mc-ctl \ - --replace 'find_prog ("modprobe") or exit (1)' '"${kmod}/bin/modprobe"' - '' - + lib.optionalString (!stdenv.hostPlatform.isAarch64) '' - substituteInPlace $out/bin/ras-mc-ctl \ - --replace 'find_prog ("dmidecode")' '"${dmidecode}/bin/dmidecode"' - ''; + postFixup = lib.optionalString enableDmidecode '' + substituteInPlace $out/bin/ras-mc-ctl \ + --replace-fail 'find_prog ("dmidecode")' '"${dmidecode}/bin/dmidecode"' + ''; passthru.tests = nixosTests.rasdaemon; - meta = with lib; { + passthru.updateScript = nix-update-script { }; + + meta = { description = '' A Reliability, Availability and Serviceability (RAS) logging tool using EDAC kernel tracing events ''; @@ -125,9 +118,9 @@ stdenv.mkDerivation rec { drivers for other architectures like arm also exists. ''; homepage = "https://github.com/mchehab/rasdaemon"; - license = licenses.gpl2Plus; - platforms = platforms.linux; - changelog = "https://github.com/mchehab/rasdaemon/blob/v${version}/ChangeLog"; - maintainers = with maintainers; [ evils ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.linux; + changelog = "${finalAttrs.meta.homepage}/releases/tag/v${finalAttrs.version}"; + maintainers = with lib.maintainers; [ evils ]; }; -} +})