From fbc0b8282e5bca77f9bfcdf27190a7a63d0a65df Mon Sep 17 00:00:00 2001 From: xeji Date: Sun, 4 Mar 2018 13:35:20 +0100 Subject: [PATCH] xen: fix broken version comparisons string compare breaks with xen 4.10 (because "4.10" < "4.8") --- nixos/modules/virtualisation/xen-dom0.nix | 6 +++--- pkgs/applications/virtualization/xen/generic.nix | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix index afc5a42f8b4e..11aeb31730e9 100644 --- a/nixos/modules/virtualisation/xen-dom0.nix +++ b/nixos/modules/virtualisation/xen-dom0.nix @@ -262,7 +262,7 @@ in mkdir -p /var/lib/xen # so we create them here unconditionally. grep -q control_d /proc/xen/capabilities ''; - serviceConfig = if cfg.package.version < "4.8" then + serviceConfig = if (builtins.compareVersions cfg.package.version "4.8" < 0) then { ExecStart = '' ${cfg.stored}${optionalString cfg.trace " -T /var/log/xen/xenstored-trace.log"} --no-fork ''; @@ -275,7 +275,7 @@ in NotifyAccess = "all"; }; postStart = '' - ${optionalString (cfg.package.version < "4.8") '' + ${optionalString (builtins.compareVersions cfg.package.version "4.8" < 0) '' time=0 timeout=30 # Wait for xenstored to actually come up, timing out after 30 seconds @@ -320,7 +320,7 @@ in serviceConfig = { ExecStart = '' ${cfg.package}/bin/xenconsoled\ - ${optionalString ((cfg.package.version >= "4.8")) " -i"}\ + ${optionalString ((builtins.compareVersions cfg.package.version "4.8" >= 0)) " -i"}\ ${optionalString cfg.trace " --log=all --log-dir=/var/log/xen"} ''; }; diff --git a/pkgs/applications/virtualization/xen/generic.nix b/pkgs/applications/virtualization/xen/generic.nix index 9efcc45be359..20033276fc88 100644 --- a/pkgs/applications/virtualization/xen/generic.nix +++ b/pkgs/applications/virtualization/xen/generic.nix @@ -154,12 +154,12 @@ stdenv.mkDerivation (rec { substituteInPlace tools/xenstat/Makefile \ --replace /usr/include/curses.h ${ncurses.dev}/include/curses.h - ${optionalString (config.version >= "4.8") '' + ${optionalString (builtins.compareVersions config.version "4.8" >= 0) '' substituteInPlace tools/hotplug/Linux/launch-xenstore.in \ --replace /bin/mkdir mkdir ''} - ${optionalString (config.version < "4.6") '' + ${optionalString (builtins.compareVersions config.version "4.6" < 0) '' # TODO: use this as a template and support our own if-up scripts instead? substituteInPlace tools/hotplug/Linux/xen-backend.rules.in \ --replace "@XEN_SCRIPT_DIR@" $out/etc/xen/scripts