aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-01-13 21:08:17 -0800
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-01-13 21:14:45 -0800
commitfff8a3b796153a2f5f5742cbfcfe55a31bb9ba60 (patch)
tree65bdff5f1c999639a196e4a2663fa0f2d7f58330
parent1684b446715907515359cd310c1e7bd93bad5a2e (diff)
downloadpaludis-fff8a3b796153a2f5f5742cbfcfe55a31bb9ba60.tar.gz
paludis-fff8a3b796153a2f5f5742cbfcfe55a31bb9ba60.tar.xz
support hiding suboptions
Introduce the concept of `SUBOPTIONS_NO_DESCRIBE` to the exheres profile. This allows suboptions to be silenced by default from the description list. This is useful in rare scenarios, such as `linguas`, where the suboption is common, has a large set of values. In such a case, the output of the descriptions would obscure the actual resolution and useful options. This new profile variable permits the profile to indicate to the "frontend" that the description should be squelched. Currently, this is consumed only by the cave frontend.
-rw-r--r--paludis/choice.cc6
-rw-r--r--paludis/choice.hh8
-rw-r--r--paludis/repositories/e/e_choices_key.cc11
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc1
-rw-r--r--paludis/repositories/e/ebuild_id.cc1
-rw-r--r--paludis/repositories/e/exheres_profile.cc14
-rw-r--r--paludis/repositories/e/exheres_profile.hh3
-rw-r--r--paludis/repositories/e/profile.hh3
-rw-r--r--paludis/repositories/e/traditional_profile.cc6
-rw-r--r--paludis/repositories/e/traditional_profile.hh3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc1
-rw-r--r--paludis/unchoices_key.cc1
-rw-r--r--src/clients/cave/cmd_display_resolution.cc8
14 files changed, 64 insertions, 3 deletions
diff --git a/paludis/choice.cc b/paludis/choice.cc
index d434379..88d6148 100644
--- a/paludis/choice.cc
+++ b/paludis/choice.cc
@@ -294,6 +294,12 @@ Choice::hidden() const
}
bool
+Choice::hide_description() const
+{
+ return _imp->params.hide_description();
+}
+
+bool
Choice::show_with_no_prefix() const
{
return _imp->params.show_with_no_prefix();
diff --git a/paludis/choice.hh b/paludis/choice.hh
index c5347ca..d745931 100644
--- a/paludis/choice.hh
+++ b/paludis/choice.hh
@@ -52,6 +52,7 @@ namespace paludis
typedef Name<struct name_consider_added_or_changed> consider_added_or_changed;
typedef Name<struct name_contains_every_value> contains_every_value;
typedef Name<struct name_hidden> hidden;
+ typedef Name<struct name_hide_description> hide_description;
typedef Name<struct name_human_name> human_name;
typedef Name<struct name_prefix> prefix;
typedef Name<struct name_raw_name> raw_name;
@@ -213,6 +214,7 @@ namespace paludis
NamedValue<n::consider_added_or_changed, bool> consider_added_or_changed;
NamedValue<n::contains_every_value, bool> contains_every_value;
NamedValue<n::hidden, bool> hidden;
+ NamedValue<n::hide_description, bool> hide_description;
NamedValue<n::human_name, std::string> human_name;
NamedValue<n::prefix, ChoicePrefixName> prefix;
NamedValue<n::raw_name, std::string> raw_name;
@@ -283,6 +285,12 @@ namespace paludis
bool hidden() const PALUDIS_ATTRIBUTE((warn_unused_result));
/**
+ * If true, this option should not have a description be shown
+ * visually to the user.
+ */
+ bool hide_description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
* If true, hint that we're better not displaying our prefix to the user.
*
* This is used by --pretend --install and --query to avoid showing a Use:
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index 063303d..1e33b8c 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -309,6 +309,7 @@ EChoicesKey::populate_myoptions() const
n::consider_added_or_changed() = true,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = eapi->ebuild_environment_variables()->env_use(),
n::prefix() = ChoicePrefixName(""),
n::raw_name() = eapi->ebuild_environment_variables()->env_use(),
@@ -332,11 +333,17 @@ EChoicesKey::populate_myoptions() const
{
Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:");
+ bool hide_description = false;
+ if (const auto & repo = _imp->maybe_e_repository)
+ if (const auto & undescribed = repo->profile()->use_expand_no_describe())
+ hide_description = undescribed->find(*u) != undescribed->end();
+
std::string lower_u(tolower(*u));
std::shared_ptr<Choice> exp(std::make_shared<Choice>(make_named_values<ChoiceParams>(
n::consider_added_or_changed() = true,
n::contains_every_value() = false,
n::hidden() = hidden ? hidden->end() != hidden->find(*u) : false,
+ n::hide_description() = hide_description,
n::human_name() = lower_u,
n::prefix() = ChoicePrefixName(lower_u),
n::raw_name() = stringify(*u),
@@ -363,6 +370,7 @@ EChoicesKey::populate_myoptions() const
n::consider_added_or_changed() = true,
n::contains_every_value() = true,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = parts_prefix->value(),
n::prefix() = prefix,
n::raw_name() = parts_prefix->value(),
@@ -410,6 +418,7 @@ EChoicesKey::populate_iuse(const std::shared_ptr<const Map<ChoiceNameWithPrefix,
n::consider_added_or_changed() = true,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = _imp->id->eapi()->supported()->ebuild_environment_variables()->env_use(),
n::prefix() = ChoicePrefixName(""),
n::raw_name() = _imp->id->eapi()->supported()->ebuild_environment_variables()->env_use(),
@@ -533,6 +542,7 @@ EChoicesKey::populate_iuse(const std::shared_ptr<const Map<ChoiceNameWithPrefix,
n::consider_added_or_changed() = false,
n::contains_every_value() = false,
n::hidden() = true,
+ n::hide_description() = false,
n::human_name() = env_arch,
n::prefix() = ChoicePrefixName(""),
n::raw_name() = env_arch,
@@ -556,6 +566,7 @@ EChoicesKey::populate_iuse(const std::shared_ptr<const Map<ChoiceNameWithPrefix,
n::consider_added_or_changed() = true,
n::contains_every_value() = ! _imp->id->eapi()->supported()->ebuild_options()->require_use_expand_in_iuse(),
n::hidden() = hidden ? hidden->end() != hidden->find(*u) : false,
+ n::hide_description() = false,
n::human_name() = lower_u,
n::prefix() = ChoicePrefixName(lower_u),
n::raw_name() = stringify(*u),
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 9dcf096..c8ef487 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -1032,6 +1032,7 @@ EInstalledRepositoryID::add_build_options(const std::shared_ptr<Choices> & choic
n::consider_added_or_changed() = false,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = canonical_build_options_human_name(),
n::prefix() = canonical_build_options_prefix(),
n::raw_name() = canonical_build_options_raw_name(),
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 627996a..42582cb 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1587,6 +1587,7 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
n::consider_added_or_changed() = false,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = canonical_build_options_human_name(),
n::prefix() = canonical_build_options_prefix(),
n::raw_name() = canonical_build_options_raw_name(),
diff --git a/paludis/repositories/e/exheres_profile.cc b/paludis/repositories/e/exheres_profile.cc
index 4abf767..51ae4c0 100644
--- a/paludis/repositories/e/exheres_profile.cc
+++ b/paludis/repositories/e/exheres_profile.cc
@@ -83,6 +83,7 @@ namespace paludis
const std::shared_ptr<Set<std::string> > use_expand;
const std::shared_ptr<Set<std::string> > use_expand_hidden;
+ const std::shared_ptr<Set<std::string>> use_expand_no_describe;
const std::shared_ptr<Set<std::string> > use_expand_unprefixed;
const std::shared_ptr<Set<std::string> > use_expand_implicit;
const std::shared_ptr<Set<std::string> > iuse_implicit;
@@ -105,6 +106,7 @@ namespace paludis
)),
use_expand(std::make_shared<Set<std::string>>()),
use_expand_hidden(std::make_shared<Set<std::string>>()),
+ use_expand_no_describe(std::make_shared<Set<std::string>>()),
use_expand_unprefixed(std::make_shared<Set<std::string>>()),
use_expand_implicit(std::make_shared<Set<std::string>>()),
iuse_implicit(std::make_shared<Set<std::string>>()),
@@ -148,6 +150,12 @@ ExheresProfile::ExheresProfile(
if (_imp->options_conf.want_choice_enabled_locked(nullptr,
ChoicePrefixName("hidden_suboptions"), *f).first.is_true())
_imp->use_expand_hidden->insert(stringify(*f));
+
+ const std::shared_ptr<const Set<UnprefixedChoiceName>> suboptions_no_describe =
+ _imp->options_conf.known_choice_value_names(nullptr,
+ ChoicePrefixName("suboptions_no_describe"));
+ for (const auto & suboption : *suboptions_no_describe)
+ _imp->use_expand_no_describe->insert(stringify(suboption));
}
ExheresProfile::~ExheresProfile()
@@ -278,6 +286,12 @@ ExheresProfile::use_expand_hidden() const
return _imp->use_expand_hidden;
}
+const std::shared_ptr<const Set<std::string>>
+ExheresProfile::use_expand_no_describe() const
+{
+ return _imp->use_expand_no_describe;
+}
+
const std::shared_ptr<const Set<std::string> >
ExheresProfile::use_expand_unprefixed() const
{
diff --git a/paludis/repositories/e/exheres_profile.hh b/paludis/repositories/e/exheres_profile.hh
index acf11c3..34a93ed 100644
--- a/paludis/repositories/e/exheres_profile.hh
+++ b/paludis/repositories/e/exheres_profile.hh
@@ -83,7 +83,8 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_hidden() const
PALUDIS_ATTRIBUTE((warn_unused_result));
-
+ virtual const std::shared_ptr<const Set<std::string>> use_expand_no_describe() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_unprefixed() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_implicit() const
diff --git a/paludis/repositories/e/profile.hh b/paludis/repositories/e/profile.hh
index a58702b..f36b24d 100644
--- a/paludis/repositories/e/profile.hh
+++ b/paludis/repositories/e/profile.hh
@@ -83,7 +83,8 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual const std::shared_ptr<const Set<std::string> > use_expand_hidden() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
+ virtual const std::shared_ptr<const Set<std::string>> use_expand_no_describe() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual const std::shared_ptr<const Set<std::string> > use_expand_unprefixed() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual const std::shared_ptr<const Set<std::string> > use_expand_implicit() const
diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc
index fd72b4f..567b9b5 100644
--- a/paludis/repositories/e/traditional_profile.cc
+++ b/paludis/repositories/e/traditional_profile.cc
@@ -1050,6 +1050,12 @@ TraditionalProfile::use_expand_hidden() const
return _imp->use_expand_hidden;
}
+const std::shared_ptr<const Set<std::string>>
+TraditionalProfile::use_expand_no_describe() const
+{
+ return nullptr;
+}
+
const std::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand_unprefixed() const
{
diff --git a/paludis/repositories/e/traditional_profile.hh b/paludis/repositories/e/traditional_profile.hh
index 6005590..5a98a3b 100644
--- a/paludis/repositories/e/traditional_profile.hh
+++ b/paludis/repositories/e/traditional_profile.hh
@@ -82,7 +82,8 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_hidden() const
PALUDIS_ATTRIBUTE((warn_unused_result));
-
+ virtual const std::shared_ptr<const Set<std::string>> use_expand_no_describe() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_unprefixed() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const Set<std::string> > use_expand_implicit() const
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 2b4bfa2..bc3a0ec 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -496,6 +496,7 @@ FakeMetadataChoicesKey::add(const std::string & n, const std::string & v)
n::consider_added_or_changed() = false,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = n.empty() ? "default" : n,
n::prefix() = ChoicePrefixName(n),
n::raw_name() = n.empty() ? "default" : n,
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 587f747..388a01b 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -158,6 +158,7 @@ UnpackagedChoicesKey::parse_value() const
n::consider_added_or_changed() = false,
n::contains_every_value() = false,
n::hidden() = false,
+ n::hide_description() = false,
n::human_name() = canonical_build_options_human_name(),
n::prefix() = canonical_build_options_prefix(),
n::raw_name() = canonical_build_options_raw_name(),
diff --git a/paludis/unchoices_key.cc b/paludis/unchoices_key.cc
index ceca78f..51a16e2 100644
--- a/paludis/unchoices_key.cc
+++ b/paludis/unchoices_key.cc
@@ -42,6 +42,7 @@ namespace
n::consider_added_or_changed() = false,
n::contains_every_value() = true,
n::hidden() = true,
+ n::hide_description() = false,
n::human_name() = "Choices",
n::prefix() = ChoicePrefixName(""),
n::raw_name() = "Choices",
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 66cf06c..e8d18f1 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -85,6 +85,7 @@
#include <paludis/dep_spec_annotations.hh>
#include <paludis/slot.hh>
+#include <algorithm>
#include <set>
#include <iterator>
#include <iostream>
@@ -583,6 +584,13 @@ namespace
continue;
}
+ if ((*k)->hide_description())
+ if (std::none_of((*k)->begin(), (*k)->end(),
+ [&old_choices](const std::shared_ptr<const ChoiceValue> & value) {
+ return show_choice_value_even_if_hidden(value, old_choices);
+ }))
+ continue;
+
bool shown_prefix_changed(false), shown_prefix_unchanged(false);
for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
i != i_end ; ++i)