diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-02-21 22:30:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 22:30:47 +0100 |
commit | caf51729450d4c57d48ddbef8e855e9bf65f8792 (patch) | |
tree | 71d3a26a36139e44a13c6dc485c8866eb5ec08af /src/nix | |
parent | 3848a8edb8bd31376976e03943687e156845d159 (diff) | |
parent | 3cd958849b820ba6ec80965afa6268f59c9bb650 (diff) |
Merge pull request #6136 from matthewbauer/profile-upgrade-verbosity
Add verbosity to nix profile upgrade
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/profile.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nix/profile.cc b/src/nix/profile.cc index 55b5ff736..508cbd336 100644 --- a/src/nix/profile.cc +++ b/src/nix/profile.cc @@ -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 ("Use 'nix profile list' to see the current profile."); + } + store->buildPaths(pathsToBuild); updateProfile(manifest.build(store)); |