diff --git a/modules/settings/upgrade.nix b/modules/settings/upgrade.nix index c049255..823045a 100644 --- a/modules/settings/upgrade.nix +++ b/modules/settings/upgrade.nix @@ -119,11 +119,15 @@ let def lines: split("\n") | map(select(. != "" and (test("\\.(tar|patch|diff|zip|tgz|tbz2?|txz|gz|xz|bz2|sh|py|nix|json|conf|asc|sig|lock)$") | not))); def strip: sub("-(bin|dev|lib|out|man|doc|info|devdoc|static|lib32|modules|modules-shrunk|libgcc|getent|debug)$"; ""); def parse: capture("^(?.*?)-(?[0-9].*)$") // {n: ., v: ""}; + # Among the new versions of a package, one that continues another (5.6.0-go next + # to 5.6.0) belongs to a build-time part of it (lego-5.6.0-go-modules). + def own: . as $all | map(select(. as $v | $all | any(. as $p | $p != $v and ($v | startswith($p + "-"))) | not)); def table: map(strip | parse) | group_by(.n) | map({key: .[0].n, value: (map(.v) | unique)}) | from_entries; ($old | lines | table) as $o | ($new | lines | table) as $n | [ $o | to_entries[] | select($n[.key] != null and .value != [""]) | select(((.value - $n[.key]) | length) == (.value | length) and (($n[.key] - .value) | length) > 0) - | {name: .key, from: (.value | join(", ")), to: ($n[.key] - .value | join(", "))} ] + | {name: .key, from: (.value | join(", ")), to: ($n[.key] - .value | own | join(", "))} ] + | map(select(.name | startswith("nixos-system-") | not)) | sort_by(.name)' } diff --git a/pkgs/router-webui/templates/upgrade.html b/pkgs/router-webui/templates/upgrade.html index 377f244..43f758e 100644 --- a/pkgs/router-webui/templates/upgrade.html +++ b/pkgs/router-webui/templates/upgrade.html @@ -60,7 +60,7 @@

Works it out from the new revision's description: no package is downloaded.

{{with $d.Preview}} -

{{.Version}} {{printf "%.7s" .Rev}}, previewed {{.Time}}

+

{{$d.Version}} → {{.Version}} {{printf "%.7s" .Rev}}, previewed {{.Time}}

{{if .Changes}} diff --git a/tests/apply.nix b/tests/apply.nix index 7acfa7e..b214689 100644 --- a/tests/apply.nix +++ b/tests/apply.nix @@ -395,11 +395,11 @@ pkgs.testers.runNixOSTest { target.succeed("test ! -e /var/lib/router/config/nixpkgs-pin.json") with subtest("the package list names what changes in version, and only that"): - target.succeed("printf '%s\\n' linux-6.12.5 openssl-3.4.1 openssl-3.4.1-bin zlib-1.3.1 frr-10.1 ripgrep-14.1 rg-1.0 glibc-2.40-66 glibc-2.40-66-getent > /tmp/old") - target.succeed("printf '%s\\n' linux-6.12.8 openssl-3.4.2 zlib-1.3.1 zlib-1.3.2 frr-10.2 cmake-4.0 bash-5.3 glibc-2.40-66 foo-1.tar.gz > /tmp/new") + target.succeed("printf '%s\\n' linux-6.12.5 openssl-3.4.1 openssl-3.4.1-bin zlib-1.3.1 frr-10.1 ripgrep-14.1 rg-1.0 glibc-2.40-66 glibc-2.40-66-getent lego-5.5.1 nixos-system-router-26.11.20261107.f4a03c0 > /tmp/old") + target.succeed("printf '%s\\n' linux-6.12.8 openssl-3.4.2 zlib-1.3.1 zlib-1.3.2 frr-10.2 cmake-4.0 bash-5.3 glibc-2.40-66 foo-1.tar.gz lego-5.6.0 lego-5.6.0-go-modules nixos-system-router-26.11.20261113.d5cc683 > /tmp/new") target.succeed("sed -n '/^changes() {/,/^}/p' /run/current-system/sw/bin/router-upgrade > /tmp/changes.sh && test -s /tmp/changes.sh") out = target.succeed("bash -c 'source /tmp/changes.sh; changes /tmp/old /tmp/new' | jq -c 'map(.name + \":\" + .from + \">\" + .to)'") - assert json.loads(out) == ["frr:10.1>10.2", "linux:6.12.5>6.12.8", "openssl:3.4.1>3.4.2"], out + assert json.loads(out) == ["frr:10.1>10.2", "lego:5.5.1>5.6.0", "linux:6.12.5>6.12.8", "openssl:3.4.1>3.4.2"], out with subtest("an upgrade that is not confirmed is rolled back, the lock and the pin included"): lock = target.succeed("cat /var/lib/router/config/flake.lock")
PackageNowNew