openvswitch: add updateScript

This commit is contained in:
Adam Stephens
2023-12-14 20:53:55 -05:00
parent b29ed109fc
commit ed923dc077
3 changed files with 26 additions and 0 deletions
@@ -1,5 +1,6 @@
{ version
, hash
, updateScriptArgs ? ""
}:
{ lib
@@ -20,6 +21,7 @@
, sphinxHook
, util-linux
, which
, writeScript
}:
let
@@ -105,6 +107,10 @@ in stdenv.mkDerivation rec {
pytest
]);
passthru.updateScript = writeScript "ovs-update.nu" ''
${./update.nu} ${updateScriptArgs}
'';
meta = with lib; {
changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
description = "A multilayer virtual switch";
@@ -1,4 +1,5 @@
import ./generic.nix {
version = "2.17.6";
hash = "sha256-dNqvK+c0iuXdQBe6RbjaxlNB8Vn0+0paecVC/tQQENk=";
updateScriptArgs = "--lts=true --regex '2\.17.*'";
}
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env nix-shell
#!nix-shell -i nu -p nushell common-updater-scripts
def main [--lts: bool = false, --regex: string] {
let tags = list-git-tags --url=https://github.com/openvswitch/ovs | lines | sort --natural | str replace v ''
let latest_tag = if $regex == null { $tags } else { $tags | find --regex $regex } | last
let current_version = nix eval --raw -f default.nix $"openvswitch(if $lts {"-lts"}).version" | str trim
if $latest_tag != $current_version {
if $lts {
update-source-version openvswitch-lts $latest_tag $"--file=(pwd)/pkgs/os-specific/linux/openvswitch/lts.nix"
} else {
update-source-version openvswitch $latest_tag $"--file=(pwd)/pkgs/os-specific/linux/openvswitch/default.nix"
}
}
{"lts?": $lts, before: $current_version, after: $latest_tag}
}