xen: fix broken version comparisons

string compare breaks with xen 4.10 (because "4.10" < "4.8")
This commit is contained in:
xeji 2018-03-04 13:35:20 +01:00
parent 1deb779a7a
commit fbc0b8282e
2 changed files with 5 additions and 5 deletions

View File

@ -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"}
'';
};

View File

@ -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