From 7d2dbbd3aa6166927b6c5ad38ab19c4c4e810433 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 2 Jun 2025 09:21:34 -0400 Subject: [PATCH 1/4] =?UTF-8?q?Rename=20=CE=B5=20to=20"(no=20version)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/manual/source/glossary.md | 4 ---- src/nix/diff-closures.cc | 2 +- src/nix/diff-closures.md | 2 +- tests/functional/nix-profile.sh | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/manual/source/glossary.md b/doc/manual/source/glossary.md index 94a6b5825..592317c12 100644 --- a/doc/manual/source/glossary.md +++ b/doc/manual/source/glossary.md @@ -347,10 +347,6 @@ The empty set symbol. In the context of profile history, this denotes a package is not present in a particular version of the profile. -- [`ε`]{#gloss-epsilon} - - The epsilon symbol. In the context of a package, this means the version is empty. More precisely, the derivation does not have a version attribute. - - [package]{#package} A software package; files that belong together for a particular purpose, and metadata. diff --git a/src/nix/diff-closures.cc b/src/nix/diff-closures.cc index ff9f9db40..984190391 100644 --- a/src/nix/diff-closures.cc +++ b/src/nix/diff-closures.cc @@ -52,7 +52,7 @@ std::string showVersions(const StringSet & versions) if (versions.empty()) return "∅"; StringSet versions2; for (auto & version : versions) - versions2.insert(version.empty() ? "ε" : version); + versions2.insert(version.empty() ? "(no version)" : version); return concatStringsSep(", ", versions2); } diff --git a/src/nix/diff-closures.md b/src/nix/diff-closures.md index 0294c0d8d..dfacb6ab0 100644 --- a/src/nix/diff-closures.md +++ b/src/nix/diff-closures.md @@ -36,7 +36,7 @@ No size change is shown if it's below the threshold. If the package does not exist in either the *before* or *after* closures, it is represented using `∅` (empty set) on the appropriate side of the arrow. If a package has an empty version string, the version is -rendered as `ε` (epsilon). +rendered as `(no version)`. There may be multiple versions of a package in each closure. In that case, only the changed versions are shown. Thus, diff --git a/tests/functional/nix-profile.sh b/tests/functional/nix-profile.sh index b1cfef6b0..dc56752ee 100755 --- a/tests/functional/nix-profile.sh +++ b/tests/functional/nix-profile.sh @@ -59,7 +59,7 @@ nix profile list | grep -A4 'Name:.*flake1' | grep 'Locked flake URL:.*narHash' (! [ -e $TEST_HOME/.nix-profile/include ]) nix profile history nix profile history | grep "packages.$system.default: ∅ -> 1.0" -nix profile diff-closures | grep 'env-manifest.nix: ε → ∅' +nix profile diff-closures | grep 'env-manifest.nix: (no version) → ∅' # Test XDG Base Directories support export NIX_CONFIG="use-xdg-base-directories = true" From 039d19159f36975bb0bb4d08bed738ac09a94690 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 2 Jun 2025 09:28:59 -0400 Subject: [PATCH 2/4] =?UTF-8?q?Replace=20=E2=88=85=20with=20(absent)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/manual/source/glossary.md | 4 ---- src/nix/diff-closures.cc | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/manual/source/glossary.md b/doc/manual/source/glossary.md index 592317c12..e18324ad9 100644 --- a/doc/manual/source/glossary.md +++ b/doc/manual/source/glossary.md @@ -343,10 +343,6 @@ See [Nix Archive](store/file-system-object/content-address.html#serial-nix-archive) for details. -- [`∅`]{#gloss-empty-set} - - The empty set symbol. In the context of profile history, this denotes a package is not present in a particular version of the profile. - - [package]{#package} A software package; files that belong together for a particular purpose, and metadata. diff --git a/src/nix/diff-closures.cc b/src/nix/diff-closures.cc index 984190391..ecfc907be 100644 --- a/src/nix/diff-closures.cc +++ b/src/nix/diff-closures.cc @@ -49,7 +49,7 @@ GroupedPaths getClosureInfo(ref store, const StorePath & toplevel) std::string showVersions(const StringSet & versions) { - if (versions.empty()) return "∅"; + if (versions.empty()) return "(absent)"; StringSet versions2; for (auto & version : versions) versions2.insert(version.empty() ? "(no version)" : version); From 724d552b6432d8cf8fc23450c924430e69b917cb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 2 Jun 2025 09:28:59 -0400 Subject: [PATCH 3/4] Use words like added / removed --- src/nix/diff-closures.md | 8 ++++---- src/nix/profile-history.md | 6 +++--- src/nix/profile.cc | 4 ++-- tests/functional/nix-profile.sh | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/nix/diff-closures.md b/src/nix/diff-closures.md index dfacb6ab0..6b07af28f 100644 --- a/src/nix/diff-closures.md +++ b/src/nix/diff-closures.md @@ -11,8 +11,8 @@ R""( baloo-widgets: 20.08.1 → 20.08.2 bluez-qt: +12.6 KiB dolphin: 20.08.1 → 20.08.2, +13.9 KiB - kdeconnect: 20.08.2 → ∅, -6597.8 KiB - kdeconnect-kde: ∅ → 20.08.2, +6599.7 KiB + kdeconnect: 20.08.2 removed, -6597.8 KiB + kdeconnect-kde: 20.08.2 added, +6599.7 KiB … ``` @@ -34,8 +34,8 @@ dolphin: 20.08.1 → 20.08.2, +13.9 KiB No size change is shown if it's below the threshold. If the package does not exist in either the *before* or *after* closures, it is -represented using `∅` (empty set) on the appropriate side of the -arrow. If a package has an empty version string, the version is +represented using `added` or `removed`. +If a package has an empty version string, the version is rendered as `(no version)`. There may be multiple versions of a package in each closure. In that diff --git a/src/nix/profile-history.md b/src/nix/profile-history.md index f0bfe5037..0c9a340dd 100644 --- a/src/nix/profile-history.md +++ b/src/nix/profile-history.md @@ -7,7 +7,7 @@ R""( ```console # nix profile history Version 508 (2020-04-10): - flake:nixpkgs#legacyPackages.x86_64-linux.awscli: ∅ -> 1.17.13 + flake:nixpkgs#legacyPackages.x86_64-linux.awscli: 1.17.13 added Version 509 (2020-05-16) <- 508: flake:nixpkgs#legacyPackages.x86_64-linux.awscli: 1.17.13 -> 1.18.211 @@ -20,7 +20,7 @@ between subsequent versions of a profile. It only shows top-level packages, not dependencies; for that, use [`nix profile diff-closures`](./nix3-profile-diff-closures.md). -The addition of a package to a profile is denoted by the string `∅ ->` -*version*, whereas the removal is denoted by *version* `-> ∅`. +The addition of a package to a profile is denoted by the string +*version* `added`, whereas the removal is denoted by *version* ` removed`. )"" diff --git a/src/nix/profile.cc b/src/nix/profile.cc index 2c593729f..5aa7013c5 100644 --- a/src/nix/profile.cc +++ b/src/nix/profile.cc @@ -289,12 +289,12 @@ struct ProfileManifest while (i != prev.elements.end() || j != cur.elements.end()) { if (j != cur.elements.end() && (i == prev.elements.end() || i->first > j->first)) { - logger->cout("%s%s: ∅ -> %s", indent, j->second.identifier(), j->second.versions()); + logger->cout("%s%s: %s added", indent, j->second.identifier(), j->second.versions()); changes = true; ++j; } else if (i != prev.elements.end() && (j == cur.elements.end() || i->first < j->first)) { - logger->cout("%s%s: %s -> ∅", indent, i->second.identifier(), i->second.versions()); + logger->cout("%s%s: %s removed", indent, i->second.identifier(), i->second.versions()); changes = true; ++i; } diff --git a/tests/functional/nix-profile.sh b/tests/functional/nix-profile.sh index dc56752ee..7afde40a7 100755 --- a/tests/functional/nix-profile.sh +++ b/tests/functional/nix-profile.sh @@ -58,8 +58,8 @@ nix profile list | grep -A4 'Name:.*flake1' | grep 'Locked flake URL:.*narHash' [ -e $TEST_HOME/.nix-profile/share/man ] (! [ -e $TEST_HOME/.nix-profile/include ]) nix profile history -nix profile history | grep "packages.$system.default: ∅ -> 1.0" -nix profile diff-closures | grep 'env-manifest.nix: (no version) → ∅' +nix profile history | grep "packages.$system.default: 1.0 added" +nix profile diff-closures | grep 'env-manifest.nix: (no version) removed' # Test XDG Base Directories support export NIX_CONFIG="use-xdg-base-directories = true" @@ -128,7 +128,7 @@ nix profile rollback [ -e $TEST_HOME/.nix-profile/bin/foo ] nix profile remove foo 2>&1 | grep 'removed 1 packages' (! [ -e $TEST_HOME/.nix-profile/bin/foo ]) -nix profile history | grep 'foo: 1.0 -> ∅' +nix profile history | grep 'foo: 1.0 removed' nix profile diff-closures | grep 'Version 3 -> 4' # Test installing a non-flake package. From 1500e541f2cfab89e2fb847411e056df1e8e50fb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 2 Jun 2025 11:13:03 -0400 Subject: [PATCH 4/4] diff-closures: use removed / added words --- src/nix/diff-closures.cc | 7 ++++++- tests/functional/nix-profile.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nix/diff-closures.cc b/src/nix/diff-closures.cc index ecfc907be..fa3d51ae7 100644 --- a/src/nix/diff-closures.cc +++ b/src/nix/diff-closures.cc @@ -97,8 +97,13 @@ void printClosureDiff( if (showDelta || !removed.empty() || !added.empty()) { std::vector items; - if (!removed.empty() || !added.empty()) + if (!removed.empty() && !added.empty()) { items.push_back(fmt("%s → %s", showVersions(removed), showVersions(added))); + } else if (!removed.empty()) { + items.push_back(fmt("%s removed", showVersions(removed))); + } else if (!added.empty()) { + items.push_back(fmt("%s added", showVersions(added))); + } if (showDelta) items.push_back(fmt("%s%+.1f KiB" ANSI_NORMAL, sizeDelta > 0 ? ANSI_RED : ANSI_GREEN, sizeDelta / 1024.0)); logger->cout("%s%s: %s", indent, name, concatStringsSep(", ", items)); diff --git a/tests/functional/nix-profile.sh b/tests/functional/nix-profile.sh index 7afde40a7..a96abbbdf 100755 --- a/tests/functional/nix-profile.sh +++ b/tests/functional/nix-profile.sh @@ -58,7 +58,7 @@ nix profile list | grep -A4 'Name:.*flake1' | grep 'Locked flake URL:.*narHash' [ -e $TEST_HOME/.nix-profile/share/man ] (! [ -e $TEST_HOME/.nix-profile/include ]) nix profile history -nix profile history | grep "packages.$system.default: 1.0 added" +nix profile history | grep "packages.$system.default: 1.0, 1.0-man added" nix profile diff-closures | grep 'env-manifest.nix: (no version) removed' # Test XDG Base Directories support