mirror of
https://github.com/NixOS/nix.git
synced 2024-11-29 02:02:27 +00:00
Add verbosity to nix profile upgrade
Followup of https://github.com/NixOS/nix/pull/6086. This time adding a warning if no packages are upgraded.
This commit is contained in:
parent
9bc03adbba
commit
61295b910f
@ -410,12 +410,16 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
|
||||
// FIXME: code duplication
|
||||
std::vector<DerivedPath> pathsToBuild;
|
||||
|
||||
auto upgradedCount = 0;
|
||||
|
||||
for (size_t i = 0; i < manifest.elements.size(); ++i) {
|
||||
auto & element(manifest.elements[i]);
|
||||
if (element.source
|
||||
&& !element.source->originalRef.input.isImmutable()
|
||||
&& matches(*store, element, i, matchers))
|
||||
{
|
||||
upgradedCount++;
|
||||
|
||||
Activity act(*logger, lvlChatty, actUnknown,
|
||||
fmt("checking '%s' for updates", element.source->attrPath));
|
||||
|
||||
@ -448,6 +452,19 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
|
||||
}
|
||||
}
|
||||
|
||||
if (upgradedCount == 0) {
|
||||
for (auto matcher: matchers) {
|
||||
if (const size_t* index = std::get_if<size_t>(&matcher)){
|
||||
warn("'%d' is not a valid index in profile", *index);
|
||||
} else if (const Path* path = std::get_if<Path>(&matcher)){
|
||||
warn("'%s' does not match any paths in profile", *path);
|
||||
} else if (const RegexPattern* regex = std::get_if<RegexPattern>(&matcher)){
|
||||
warn("'%s' does not match any packages in profile", regex->pattern);
|
||||
}
|
||||
}
|
||||
warn ("Try `nix profile list` to see the current profile.");
|
||||
}
|
||||
|
||||
store->buildPaths(pathsToBuild);
|
||||
|
||||
updateProfile(manifest.build(store));
|
||||
|
Loading…
Reference in New Issue
Block a user