aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-24 09:32:40 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-24 09:32:40 +0100
commit7cd0c2d122a5b38c5a925dac52b429c99e7f5085 (patch)
tree3263a593a314a0f91c8d14005b61a8a134325ae1 /src
parent95de300935276509248c6ad2f6a08bf458ef290c (diff)
downloadpaludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.gz
paludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.xz
Paludis is about choices.
Diffstat (limited to 'src')
-rw-r--r--src/clients/accerso/command_line.hh2
-rw-r--r--src/clients/adjutrix/find_unused_packages.cc3
-rw-r--r--src/clients/adjutrix/keywords_graph.cc44
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc3
-rw-r--r--src/clients/importare/command_line.cc1
-rw-r--r--src/clients/inquisitio/key_extractor.cc50
-rw-r--r--src/clients/instruo/command_line.hh2
-rw-r--r--src/clients/instruo/instruo.cc9
-rw-r--r--src/clients/paludis/applets.cc18
-rw-r--r--src/clients/paludis/info.cc15
-rwxr-xr-xsrc/clients/paludis/install_TEST22
-rwxr-xr-xsrc/clients/paludis/install_TEST_setup.sh54
-rw-r--r--src/clients/qualudis/qualudis.cc15
-rw-r--r--src/output/Makefile.am10
-rw-r--r--src/output/colour_formatter.cc228
-rw-r--r--src/output/colour_formatter.hh40
-rw-r--r--src/output/console_install_task.cc445
-rw-r--r--src/output/console_install_task.hh45
-rw-r--r--src/output/console_install_task.sr15
-rw-r--r--src/output/console_query_task.cc142
-rw-r--r--src/output/mask_displayer.cc17
21 files changed, 501 insertions, 679 deletions
diff --git a/src/clients/accerso/command_line.hh b/src/clients/accerso/command_line.hh
index 14052a2..16131d0 100644
--- a/src/clients/accerso/command_line.hh
+++ b/src/clients/accerso/command_line.hh
@@ -22,8 +22,6 @@
#include <paludis/args/args.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/args/debug_build_arg.hh>
-#include <paludis/args/checks_arg.hh>
#include <paludis/args/log_level_arg.hh>
#include <paludis/args/deps_option_arg.hh>
diff --git a/src/clients/adjutrix/find_unused_packages.cc b/src/clients/adjutrix/find_unused_packages.cc
index 6d0953c..51a6054 100644
--- a/src/clients/adjutrix/find_unused_packages.cc
+++ b/src/clients/adjutrix/find_unused_packages.cc
@@ -51,9 +51,6 @@ void do_find_unused_packages(const NoConfigEnvironment & env)
if (env.master_repository() && r->name() == env.master_repository()->name())
continue;
- if (! (*r).use_interface())
- continue;
-
Context repo_context("When searching for unused packages in repository '" + stringify(r->name()) + "':");
FindUnusedPackagesTask task(&env, &(*r));
diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc
index c3c2b4f..94638ce 100644
--- a/src/clients/adjutrix/keywords_graph.cc
+++ b/src/clients/adjutrix/keywords_graph.cc
@@ -26,6 +26,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/log.hh>
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
@@ -34,6 +35,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <set>
#include <map>
@@ -80,12 +82,30 @@ namespace
if (packages->empty())
return;
- if (! repo.use_interface())
- throw InternalError(PALUDIS_HERE, "Repository has no use_interface");
+ std::set<std::string> arch_flags;
+ for (PackageIDSequence::ConstIterator p(packages->begin()), p_end(packages->end()) ;
+ p != p_end ; ++p)
+ {
+ if (! (*p)->choices_key())
+ continue;
+
+ for (Choices::ConstIterator c((*p)->choices_key()->value()->begin()), c_end((*p)->choices_key()->value()->end()) ;
+ c != c_end ; ++c)
+ {
+ if ((*c)->raw_name() != "ARCH")
+ continue;
- std::tr1::shared_ptr<const UseFlagNameSet> arch_flags(repo.use_interface()->arch_flags());
- if (arch_flags->empty())
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end ; ++i)
+ arch_flags.insert(stringify((*i)->unprefixed_name()));
+ }
+ }
+
+ if (arch_flags.empty())
+ {
+ Log::get_instance()->message("adjutrix.keywords_graph.no_arch_flags", ll_warning, lc_context) << "Couldn't find any arch flags";
return;
+ }
std::set<SlotName> slots;
std::transform(indirect_iterator(packages->begin()), indirect_iterator(packages->end()),
@@ -99,8 +119,8 @@ namespace
std::tr1::bind(std::tr1::mem_fn(&PackageID::canonical_form), _2, idcf_version))
)->canonical_form(idcf_version).length() + 1);
- unsigned tallest_arch_name(std::max(stringify(*std::max_element(arch_flags->begin(),
- arch_flags->end(), CompareByStringLength<UseFlagName>())).length(), static_cast<std::size_t>(6)));
+ unsigned tallest_arch_name(std::max(stringify(*std::max_element(arch_flags.begin(),
+ arch_flags.end(), CompareByStringLength<std::string>())).length(), static_cast<std::size_t>(6)));
unsigned longest_slot_name(stringify(*std::max_element(slots.begin(),
slots.end(), CompareByStringLength<SlotName>())).length());
@@ -108,13 +128,13 @@ namespace
for (unsigned h = 0 ; h < tallest_arch_name ; ++h)
{
cout << std::left << std::setw(version_specs_columns_width) << " " << "| ";
- for (UseFlagNameSet::ConstIterator a(arch_flags->begin()), a_end(arch_flags->end()) ;
+ for (std::set<std::string>::const_iterator a(arch_flags.begin()), a_end(arch_flags.end()) ;
a != a_end ; ++a)
{
- if ((tallest_arch_name - h) > a->data().length())
+ if ((tallest_arch_name - h) > a->length())
cout << " ";
else
- cout << a->data().at(a->data().length() - tallest_arch_name + h) << " ";
+ cout << a->at(a->length() - tallest_arch_name + h) << " ";
}
cout << "| ";
if ((tallest_arch_name - h) <= 6)
@@ -130,7 +150,7 @@ namespace
}
cout << std::string(version_specs_columns_width, '-') << "+"
- << std::string(arch_flags->size() * 2 + 1, '-') << "+"
+ << std::string(arch_flags.size() * 2 + 1, '-') << "+"
<< std::string(longest_slot_name + 3, '-') << endl;
SlotName old_slot("first_slot");
@@ -143,14 +163,14 @@ namespace
if (p->slot() != old_slot)
if (old_slot != SlotName("first_slot"))
cout << std::string(version_specs_columns_width, '-') << "+"
- << std::string(arch_flags->size() * 2 + 1, '-') << "+"
+ << std::string(arch_flags.size() * 2 + 1, '-') << "+"
<< std::string(longest_slot_name + 3, '-') << endl;
cout << std::left << std::setw(version_specs_columns_width) << p->canonical_form(idcf_version) << "| ";
std::tr1::shared_ptr<const KeywordNameSet> keywords(p->keywords_key()->value());
- for (UseFlagNameSet::ConstIterator a(arch_flags->begin()), a_end(arch_flags->end()) ;
+ for (std::set<std::string>::const_iterator a(arch_flags.begin()), a_end(arch_flags.end()) ;
a != a_end ; ++a)
{
if (keywords->end() != keywords->find(KeywordName(stringify(*a))))
diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc
index e3a81ed..551ce55 100644
--- a/src/clients/adjutrix/what_needs_keywording.cc
+++ b/src/clients/adjutrix/what_needs_keywording.cc
@@ -65,8 +65,7 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
}
KeywordName target_keyword(*CommandLine::get_instance()->begin_parameters());
- UseFlagName target_arch(strip_leading_string(
- *CommandLine::get_instance()->begin_parameters(), "~"));
+ std::string target_arch(strip_leading_string(*CommandLine::get_instance()->begin_parameters(), "~"));
(*env.main_repository()).e_interface()->set_profile_by_arch(target_arch);
env.set_accept_unstable('~' == stringify(target_keyword).at(0));
diff --git a/src/clients/importare/command_line.cc b/src/clients/importare/command_line.cc
index be5ed3b..db163ca 100644
--- a/src/clients/importare/command_line.cc
+++ b/src/clients/importare/command_line.cc
@@ -64,7 +64,6 @@ CommandLine::CommandLine() :
add_usage_line("[ --install ] [ --location path/ ] category/package [ version ] [ slot ]");
install_args.a_add_to_world_spec.remove();
- install_args.a_checks.remove();
install_args.a_fetch.remove();
install_args.a_no_safe_resume.remove();
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index de34313..5ceb986 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -31,6 +31,7 @@
#include <paludis/stringify_formatter.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <algorithm>
@@ -158,6 +159,12 @@ namespace
result |= _m(stringify(s));
}
+ void visit_leaf(const PlainTextLabelDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
void visit_leaf(const DependencyLabelsDepSpec & s)
{
if (! result)
@@ -235,18 +242,7 @@ namespace
result = _m(stringify(*s.value()));
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> & s)
- {
- using namespace std::tr1::placeholders;
-
- if (_flatten)
- result = _m(join(s.value()->begin(), s.value()->end(), " "));
- else
- result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
- std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), std::tr1::bind(&stringify<UseFlagName>, _1)));
- }
-
- void visit(const MetadataCollectionKey<IUseFlagSet> & s)
+ void visit(const MetadataCollectionKey<KeywordNameSet> & s)
{
using namespace std::tr1::placeholders;
@@ -254,18 +250,34 @@ namespace
result = _m(join(s.value()->begin(), s.value()->end(), " "));
else
result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
- std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), std::tr1::bind(&stringify<IUseFlag>, _1)));
+ std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), std::tr1::bind(&stringify<KeywordName>, _1)));
}
- void visit(const MetadataCollectionKey<KeywordNameSet> & s)
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & s)
{
- using namespace std::tr1::placeholders;
-
if (_flatten)
- result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ {
+ std::string r;
+ for (Choices::ConstIterator c(s.value()->begin()), c_end(s.value()->end()) ;
+ c != c_end ; ++c)
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end ; ++i)
+ {
+ if (! r.empty())
+ r.append(" ");
+ r.append(stringify((*i)->name_with_prefix()));
+ }
+
+ result = _m(r);
+ }
else
- result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
- std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), std::tr1::bind(&stringify<KeywordName>, _1)));
+ {
+ for (Choices::ConstIterator c(s.value()->begin()), c_end(s.value()->end()) ;
+ c != c_end && ! result ; ++c)
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end && ! result ; ++i)
+ result = _m(stringify((*i)->name_with_prefix()));
+ }
}
void visit(const MetadataCollectionKey<Set<std::string> > & s)
diff --git a/src/clients/instruo/command_line.hh b/src/clients/instruo/command_line.hh
index 3cf46e1..3addac0 100644
--- a/src/clients/instruo/command_line.hh
+++ b/src/clients/instruo/command_line.hh
@@ -22,8 +22,6 @@
#include <paludis/args/args.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/args/debug_build_arg.hh>
-#include <paludis/args/checks_arg.hh>
#include <paludis/args/log_level_arg.hh>
#include <paludis/args/deps_option_arg.hh>
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 759fbd6..4bb6615 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -149,14 +149,9 @@ namespace
const std::tr1::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
{
- const std::tr1::shared_ptr<const IUseFlagSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
- }
-
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- const std::tr1::shared_ptr<const UseFlagNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ const std::tr1::shared_ptr<const Choices> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
void visit(const MetadataSectionKey & k)
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 5ec03b1..658f47d 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -89,6 +89,12 @@ namespace
return_code |= 1;
}
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > &)
+ {
+ std::cout << "(unprintable)" << std::endl;
+ return_code |= 1;
+ }
+
void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k)
{
StringifyFormatter f;
@@ -143,18 +149,6 @@ namespace
std::cout << k.pretty_print_flat(f) << std::endl;
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
- {
- StringifyFormatter f;
- std::cout << k.pretty_print_flat(f) << std::endl;
- }
-
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- StringifyFormatter f;
- std::cout << k.pretty_print_flat(f) << std::endl;
- }
-
void visit(const MetadataCollectionKey<Set<std::string> > & k)
{
StringifyFormatter f;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 5199064..2100eef 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -184,28 +184,21 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
- {
- ColourFormatter f;
- cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
- }
-
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
+ void visit(const MetadataCollectionKey<Set<std::string> > & k)
{
ColourFormatter f;
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
- void visit(const MetadataCollectionKey<Set<std::string> > & k)
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f;
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
- void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
{
- ColourFormatter f;
- cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl;
}
};
}
diff --git a/src/clients/paludis/install_TEST b/src/clients/paludis/install_TEST
index 62ffb98..f59742c 100755
--- a/src/clients/paludis/install_TEST
+++ b/src/clients/paludis/install_TEST
@@ -2,34 +2,34 @@
for c in vdb_config exndbam_config ; do
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--list-packages || exit 12
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--query test-category/target || exit 13
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--has-version test-category/target && exit 1
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--install target --resume-command-template `pwd`/install_TEST_dir/resume \
- --checks always && exit 2
+ && exit 2
( echo -n './paludis ' ; cut -d ' ' -f2- < install_TEST_dir/resume ) > install_TEST_dir/fixedresume
cat install_TEST_dir/fixedresume
- PALUDIS_HOME=./install_TEST_dir/config/ bash `pwd`/install_TEST_dir/fixedresume --checks none || exit 3
+ PALUDIS_HOME=./install_TEST_dir/config-checks-none/ bash `pwd`/install_TEST_dir/fixedresume || exit 3
./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null || exit 4
grep target install_TEST_dir/root/world-${c%_config} || exit 5
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--has-version test-category/target || exit 6
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--contents test-category/target || exit 12
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--uninstall target || exit 7
[[ -f ./install_TEST_dir/root/usr/bin/testbin ]] && exit 8
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
--has-version test-category/target && exit 9
grep target install_TEST_dir/root/world-${c%_config} >/dev/null && exit 10
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test-$c \
+ PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \
-qMD test-category/target || exit 11
rm -fr install_TEST_dir/root/usr/{share/doc,bin}
diff --git a/src/clients/paludis/install_TEST_setup.sh b/src/clients/paludis/install_TEST_setup.sh
index cd02d83..342fc3c 100755
--- a/src/clients/paludis/install_TEST_setup.sh
+++ b/src/clients/paludis/install_TEST_setup.sh
@@ -5,43 +5,60 @@ mkdir install_TEST_dir || exit 1
cd install_TEST_dir || exit 1
mkdir -p build
-mkdir -p config/.paludis-install-test-vdb_config
-cat <<END > config/.paludis-install-test-vdb_config/specpath.conf
+mkdir -p config-checks-always/.paludis-install-test-vdb_config
+cat <<END > config-checks-always/.paludis-install-test-vdb_config/specpath.conf
root = `pwd`/root
-config-suffix = vdb
+config-suffix = vdb-checks-always
END
-mkdir -p config/.paludis-install-test-exndbam_config
-cat <<END > config/.paludis-install-test-exndbam_config/specpath.conf
+mkdir -p config-checks-always/.paludis-install-test-exndbam_config
+cat <<END > config-checks-always/.paludis-install-test-exndbam_config/specpath.conf
root = `pwd`/root
-config-suffix = exndbam
+config-suffix = exndbam-checks-always
+END
+
+mkdir -p config-checks-none/.paludis-install-test-vdb_config
+cat <<END > config-checks-none/.paludis-install-test-vdb_config/specpath.conf
+root = `pwd`/root
+config-suffix = vdb-checks-none
+END
+
+mkdir -p config-checks-none/.paludis-install-test-exndbam_config
+cat <<END > config-checks-none/.paludis-install-test-exndbam_config/specpath.conf
+root = `pwd`/root
+config-suffix = exndbam-checks-none
END
for c in vdb exndbam ; do
+ mkdir -p root/${SYSCONFDIR}/paludis-${c}-checks-{always,none}/repositories
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-always/use.conf
+*/* foo build_options: optional_tests recommended_tests
+END
- mkdir -p root/${SYSCONFDIR}/paludis-${c}/repositories
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/use.conf
-*/* foo
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-none/use.conf
+*/* foo build_options: -optional_tests -recommended_tests
END
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/environment.conf
+ for d in always none ; do
+
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/environment.conf
world = `pwd`/root/world-${c}
END
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/licenses.conf
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/licenses.conf
*/* *
END
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/keywords.conf
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/keywords.conf
*/* test
END
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/bashrc
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/bashrc
export CHOST="my-chost"
export USER_BASHRC_WAS_USED=yes
END
- cat <<END > root/${SYSCONFDIR}/paludis-${c}/repositories/repo1.conf
+ cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/repositories/repo1.conf
location = `pwd`/repo1
cache = /var/empty
format = ebuild
@@ -50,9 +67,12 @@ profiles = \${location}/profiles/testprofile \${location}/profiles/anothertestpr
builddir = `pwd`/build
END
+ done
+
done
-cat <<END > root/${SYSCONFDIR}/paludis-vdb/repositories/installed.conf
+for d in always none ; do
+ cat <<END > root/${SYSCONFDIR}/paludis-vdb-checks-${d}/repositories/installed.conf
location = `pwd`/root/var/db/pkg
format = vdb
names_cache = /var/empty
@@ -60,12 +80,14 @@ provides_cache = /var/empty
builddir = `pwd`/build
END
-cat <<END > root/${SYSCONFDIR}/paludis-exndbam/repositories/installed.conf
+ cat <<END > root/${SYSCONFDIR}/paludis-exndbam-checks-${d}/repositories/installed.conf
location = `pwd`/root/var/db/exndbam
format = exndbam
builddir = `pwd`/build
END
+done
+
mkdir -p root/tmp
mkdir -p root/var/db/pkg
mkdir -p root/var/db/exndbam
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index b5fe133..dd5f151 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -77,11 +77,6 @@ namespace
std::ostringstream stream;
StringifyFormatter formatter;
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
- {
- stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
- }
-
void visit(const MetadataCollectionKey<Set<std::string> > & k)
{
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
@@ -97,11 +92,6 @@ namespace
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
- }
-
void visit(const MetadataCollectionKey<KeywordNameSet> & k)
{
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
@@ -187,6 +177,11 @@ namespace
stream << k.raw_name() << "\n";
}
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
+ {
+ stream << k.raw_name() << "\n";
+ }
+
void visit(const MetadataSectionKey & k)
{
stream << k.raw_name() << "\n";
diff --git a/src/output/Makefile.am b/src/output/Makefile.am
index a261ccc..ba596ef 100644
--- a/src/output/Makefile.am
+++ b/src/output/Makefile.am
@@ -1,8 +1,5 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail
-DISTCLEANFILES = console_install_task-sr.hh console_install_task-sr.cc
MAINTAINERCLEANFILES = Makefile.in
-EXTRA_DIST = console_install_task.sr console_install_task-sr.hh console_install_task-sr.cc
-BUILT_SOURCES = console_install_task-sr.hh console_install_task-sr.cc
noinst_LIBRARIES = liboutput.a
liboutput_a_SOURCES = \
@@ -28,10 +25,3 @@ distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
-console_install_task-sr.hh : console_install_task.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/console_install_task.sr > $@
-
-console_install_task-sr.cc : console_install_task.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/console_install_task.sr > $@
-
-
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index a954750..c46a754 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -19,269 +19,95 @@
#include "colour_formatter.hh"
#include "colour.hh"
-#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/set.hh>
#include <paludis/name.hh>
+#include <paludis/choice.hh>
using namespace paludis;
-namespace paludis
-{
- template <>
- struct Implementation<ColourFormatter>
- {
- const bool unchanged_are_new;
-
- mutable std::string active_prefix;
-
- const std::tr1::shared_ptr<UseFlagNameSet> seen_new_use_flag_names;
- const std::tr1::shared_ptr<UseFlagNameSet> seen_changed_use_flag_names;
- const std::tr1::shared_ptr<UseFlagNameSet> seen_use_flag_names;
- const std::tr1::shared_ptr<UseFlagNameSet> seen_use_expand_prefixes;
-
- Implementation(const bool b) :
- unchanged_are_new(b),
- seen_new_use_flag_names(new UseFlagNameSet),
- seen_changed_use_flag_names(new UseFlagNameSet),
- seen_use_flag_names(new UseFlagNameSet),
- seen_use_expand_prefixes(new UseFlagNameSet)
- {
- }
- };
-}
-
-ColourFormatter::ColourFormatter(const bool b) :
- PrivateImplementationPattern<ColourFormatter>(new Implementation<ColourFormatter>(b))
-{
-}
-
-ColourFormatter::~ColourFormatter()
-{
-}
-
-const std::tr1::shared_ptr<const UseFlagNameSet>
-ColourFormatter::seen_new_use_flag_names() const
-{
- return _imp->seen_new_use_flag_names;
-}
-
-const std::tr1::shared_ptr<const UseFlagNameSet>
-ColourFormatter::seen_changed_use_flag_names() const
-{
- return _imp->seen_changed_use_flag_names;
-}
-
-const std::tr1::shared_ptr<const UseFlagNameSet>
-ColourFormatter::seen_use_flag_names() const
-{
- return _imp->seen_use_flag_names;
-}
-
-const std::tr1::shared_ptr<const UseFlagNameSet>
-ColourFormatter::seen_use_expand_prefixes() const
-{
- return _imp->seen_use_expand_prefixes;
-}
-
std::string
-ColourFormatter::format(const IUseFlag & f, const format::Plain &) const
+ColourFormatter::format(const ChoiceValue & f, const format::Plain &) const
{
- _imp->seen_use_flag_names->insert(f.flag);
- if (_imp->unchanged_are_new)
- _imp->seen_new_use_flag_names->insert(f.flag);
-
- std::string g(stringify(f.flag)), h;
-
- if (std::string::npos != f.prefix_delim_pos)
- {
- std::string p(g.substr(0, f.prefix_delim_pos));
- if (_imp->active_prefix == p)
- g.erase(0, f.prefix_delim_pos + 1);
- else
- {
- _imp->active_prefix = p;
- _imp->seen_use_expand_prefixes->insert(UseFlagName(_imp->active_prefix));
- h = _imp->active_prefix + ": ";
- g.erase(0, f.prefix_delim_pos + 1);
- }
- }
-
- return h + g;
+ return stringify(f.name_with_prefix());
}
std::string
-ColourFormatter::format(const IUseFlag & f, const format::Enabled &) const
+ColourFormatter::format(const ChoiceValue & f, const format::Enabled &) const
{
- _imp->seen_use_flag_names->insert(f.flag);
- if (_imp->unchanged_are_new)
- _imp->seen_new_use_flag_names->insert(f.flag);
- std::string g(stringify(f.flag)), h;
-
- if (std::string::npos != f.prefix_delim_pos)
- {
- std::string p(g.substr(0, f.prefix_delim_pos));
- if (_imp->active_prefix == p)
- g.erase(0, f.prefix_delim_pos + 1);
- else
- {
- _imp->active_prefix = p;
- _imp->seen_use_expand_prefixes->insert(UseFlagName(_imp->active_prefix));
- h = _imp->active_prefix + ": ";
- g.erase(0, f.prefix_delim_pos + 1);
- }
- }
-
- return h + colour(cl_flag_on, g);
+ return colour(cl_flag_on, stringify(f.unprefixed_name()));
}
std::string
-ColourFormatter::format(const IUseFlag & f, const format::Disabled &) const
+ColourFormatter::format(const ChoiceValue & f, const format::Disabled &) const
{
- _imp->seen_use_flag_names->insert(f.flag);
- if (_imp->unchanged_are_new)
- _imp->seen_new_use_flag_names->insert(f.flag);
- std::string g(stringify(f.flag)), h;
-
- if (std::string::npos != f.prefix_delim_pos)
- {
- std::string p(g.substr(0, f.prefix_delim_pos));
- if (_imp->active_prefix == p)
- g.erase(0, f.prefix_delim_pos + 1);
- else
- {
- _imp->active_prefix = p;
- _imp->seen_use_expand_prefixes->insert(UseFlagName(_imp->active_prefix));
- h = _imp->active_prefix + ": ";
- g.erase(0, f.prefix_delim_pos + 1);
- }
- }
-
- return h + colour(cl_flag_off, "-" + g);
+ return colour(cl_flag_off, "-" + stringify(f.unprefixed_name()));
}
std::string
-ColourFormatter::format(const IUseFlag & f, const format::Forced &) const
+ColourFormatter::format(const ChoiceValue & f, const format::Forced &) const
{
- _imp->seen_use_flag_names->insert(f.flag);
- if (_imp->unchanged_are_new)
- _imp->seen_new_use_flag_names->insert(f.flag);
- std::string g(stringify(f.flag)), h;
-
- if (std::string::npos != f.prefix_delim_pos)
- {
- std::string p(g.substr(0, f.prefix_delim_pos));
- if (_imp->active_prefix == p)
- g.erase(0, f.prefix_delim_pos + 1);
- else
- {
- _imp->active_prefix = p;
- _imp->seen_use_expand_prefixes->insert(UseFlagName(_imp->active_prefix));
- h = _imp->active_prefix + ": ";
- g.erase(0, f.prefix_delim_pos + 1);
- }
- }
-
- return h + colour(cl_flag_on, "(" + g + ")");
+ return colour(cl_flag_on, "(" + stringify(f.unprefixed_name()) + ")");
}
std::string
-ColourFormatter::format(const IUseFlag & f, const format::Masked &) const
+ColourFormatter::format(const ChoiceValue & f, const format::Masked &) const
{
- _imp->seen_use_flag_names->insert(f.flag);
- if (_imp->unchanged_are_new)
- _imp->seen_new_use_flag_names->insert(f.flag);
- std::string g(stringify(f.flag)), h;
-
- if (std::string::npos != f.prefix_delim_pos)
- {
- std::string p(g.substr(0, f.prefix_delim_pos));
- if (_imp->active_prefix == p)
- g.erase(0, f.prefix_delim_pos + 1);
- else
- {
- _imp->active_prefix = p;
- _imp->seen_use_expand_prefixes->insert(UseFlagName(_imp->active_prefix));
- h = _imp->active_prefix + ": ";
- g.erase(0, f.prefix_delim_pos + 1);
- }
- }
-
- return h + colour(cl_flag_off, "(-" + g + ")");
+ return colour(cl_flag_off, "(-" + stringify(f.unprefixed_name()) + ")");
}
std::string
-ColourFormatter::decorate(const IUseFlag & i, const std::string & f, const format::Added &) const
+ColourFormatter::decorate(const ChoiceValue &, const std::string & f, const format::Added &) const
{
- _imp->seen_new_use_flag_names->insert(i.flag);
return f + "+";
}
std::string
-ColourFormatter::decorate(const IUseFlag & i, const std::string & f, const format::Changed &) const
+ColourFormatter::decorate(const ChoiceValue &, const std::string & f, const format::Changed &) const
{
- _imp->seen_changed_use_flag_names->insert(i.flag);
return f + "*";
}
std::string
-ColourFormatter::format(const UseFlagName & f, const format::Plain &) const
+ColourFormatter::format(const ConditionalDepSpec & f, const format::Plain &) const
{
return stringify(f);
}
std::string
-ColourFormatter::format(const UseFlagName & f, const format::Enabled &) const
+ColourFormatter::format(const ConditionalDepSpec & f, const format::Enabled &) const
{
return colour(cl_flag_on, f);
}
std::string
-ColourFormatter::format(const UseFlagName & f, const format::Disabled &) const
+ColourFormatter::format(const ConditionalDepSpec & f, const format::Disabled &) const
{
- return colour(cl_flag_off, "-" + stringify(f));
+ return colour(cl_flag_off, f);
}
std::string
-ColourFormatter::format(const UseFlagName & f, const format::Forced &) const
+ColourFormatter::format(const ConditionalDepSpec & f, const format::Forced &) const
{
return colour(cl_flag_on, "(" + stringify(f) + ")");
}
std::string
-ColourFormatter::format(const UseFlagName & f, const format::Masked &) const
-{
- return colour(cl_flag_off, "(-" + stringify(f) + ")");
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Enabled &) const
-{
- return colour(cl_flag_on, f);
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Disabled &) const
+ColourFormatter::format(const ConditionalDepSpec & f, const format::Masked &) const
{
- return colour(cl_flag_off, f);
+ return colour(cl_flag_off, "(" + stringify(f) + ")");
}
std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Forced &) const
+ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & f, const format::Added &) const
{
- return colour(cl_flag_on, "(" + stringify(f) + ")");
+ return f;
}
std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Masked &) const
+ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & f, const format::Changed &) const
{
- return colour(cl_flag_off, "(" + stringify(f) + ")");
+ return f;
}
std::string
@@ -351,6 +177,12 @@ ColourFormatter::format(const std::string & f, const format::Plain &) const
}
std::string
+ColourFormatter::format(const PlainTextLabelDepSpec & f, const format::Plain &) const
+{
+ return stringify(f);
+}
+
+std::string
ColourFormatter::format(const URILabelsDepSpec & f, const format::Plain &) const
{
return stringify(f);
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
index cf18060..a323a63 100644
--- a/src/output/colour_formatter.hh
+++ b/src/output/colour_formatter.hh
@@ -23,12 +23,10 @@
#include <paludis/formatter.hh>
#include <paludis/name-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/fs_entry-fwd.hh>
class ColourFormatter :
- public paludis::CanFormat<paludis::UseFlagName>,
- public paludis::CanFormat<paludis::IUseFlag>,
+ public paludis::CanFormat<paludis::ChoiceValue>,
public paludis::CanFormat<paludis::KeywordName>,
public paludis::CanFormat<paludis::ConditionalDepSpec>,
public paludis::CanFormat<paludis::PackageDepSpec>,
@@ -37,43 +35,31 @@ class ColourFormatter :
public paludis::CanFormat<paludis::URILabelsDepSpec>,
public paludis::CanFormat<paludis::PlainTextDepSpec>,
public paludis::CanFormat<paludis::SimpleURIDepSpec>,
+ public paludis::CanFormat<paludis::PlainTextLabelDepSpec>,
public paludis::CanFormat<paludis::FetchableURIDepSpec>,
public paludis::CanFormat<paludis::LicenseDepSpec>,
public paludis::CanFormat<paludis::NamedSetDepSpec>,
public paludis::CanFormat<paludis::FSEntry>,
public paludis::CanFormat<paludis::PackageID>,
public paludis::CanFormat<std::string>,
- public paludis::CanSpace,
- private paludis::PrivateImplementationPattern<ColourFormatter>
+ public paludis::CanSpace
{
public:
- ColourFormatter(const bool unchanged_are_new = false);
- ~ColourFormatter();
-
- const std::tr1::shared_ptr<const paludis::UseFlagNameSet> seen_new_use_flag_names() const;
- const std::tr1::shared_ptr<const paludis::UseFlagNameSet> seen_changed_use_flag_names() const;
- const std::tr1::shared_ptr<const paludis::UseFlagNameSet> seen_use_flag_names() const;
- const std::tr1::shared_ptr<const paludis::UseFlagNameSet> seen_use_expand_prefixes() const;
-
- std::string format(const paludis::IUseFlag &, const paludis::format::Plain &) const;
- std::string format(const paludis::IUseFlag &, const paludis::format::Enabled &) const;
- std::string format(const paludis::IUseFlag &, const paludis::format::Disabled &) const;
- std::string format(const paludis::IUseFlag &, const paludis::format::Forced &) const;
- std::string format(const paludis::IUseFlag &, const paludis::format::Masked &) const;
- std::string decorate(const paludis::IUseFlag &, const std::string &, const paludis::format::Added &) const;
- std::string decorate(const paludis::IUseFlag &, const std::string &, const paludis::format::Changed &) const;
-
- std::string format(const paludis::UseFlagName &, const paludis::format::Plain &) const;
- std::string format(const paludis::UseFlagName &, const paludis::format::Enabled &) const;
- std::string format(const paludis::UseFlagName &, const paludis::format::Disabled &) const;
- std::string format(const paludis::UseFlagName &, const paludis::format::Forced &) const;
- std::string format(const paludis::UseFlagName &, const paludis::format::Masked &) const;
+ std::string format(const paludis::ChoiceValue &, const paludis::format::Plain &) const;
+ std::string format(const paludis::ChoiceValue &, const paludis::format::Enabled &) const;
+ std::string format(const paludis::ChoiceValue &, const paludis::format::Disabled &) const;
+ std::string format(const paludis::ChoiceValue &, const paludis::format::Forced &) const;
+ std::string format(const paludis::ChoiceValue &, const paludis::format::Masked &) const;
+ std::string decorate(const paludis::ChoiceValue &, const std::string &, const paludis::format::Added &) const;
+ std::string decorate(const paludis::ChoiceValue &, const std::string &, const paludis::format::Changed &) const;
std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Enabled &) const;
std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Disabled &) const;
std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Forced &) const;
std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Masked &) const;
+ std::string decorate(const paludis::ConditionalDepSpec &, const std::string &, const paludis::format::Added &) const;
+ std::string decorate(const paludis::ConditionalDepSpec &, const std::string &, const paludis::format::Changed &) const;
std::string format(const paludis::PackageDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::PackageDepSpec &, const paludis::format::Installed &) const;
@@ -91,6 +77,8 @@ class ColourFormatter :
std::string format(const std::string &, const paludis::format::Plain &) const;
+ std::string format(const paludis::PlainTextLabelDepSpec &, const paludis::format::Plain &) const;
+
std::string format(const paludis::URILabelsDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::DependencyLabelsDepSpec &, const paludis::format::Plain &) const;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 770068a..18560d9 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -50,6 +50,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <algorithm>
@@ -73,8 +74,6 @@ using std::cout;
using std::cerr;
using std::endl;
-#include <src/output/console_install_task-sr.cc>
-
namespace
{
std::list<ConsoleInstallTask *> tasks;
@@ -101,30 +100,6 @@ namespace
}
}
-bool
-UseDescriptionComparator::operator() (const UseDescription & lhs, const UseDescription & rhs) const
-{
- if (lhs.flag < rhs.flag)
- return true;
- if (lhs.flag > rhs.flag)
- return false;
-
- if (lhs.package_id->name() < rhs.package_id->name())
- return true;
- if (lhs.package_id->name() > rhs.package_id->name())
- return false;
-
- if (lhs.package_id->version() < rhs.package_id->version())
- return true;
- if (lhs.package_id->version() < rhs.package_id->version())
- return false;
-
- if (lhs.package_id->repository()->name().data() < rhs.package_id->repository()->name().data())
- return true;
-
- return false;
-}
-
ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
const DepListOptions & options,
const std::tr1::shared_ptr<const DestinationsSet> & d) :
@@ -132,8 +107,6 @@ ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
_download_size(0),
_download_size_overflow(false),
_all_tags(new Set<DepTagEntry>),
- _all_use_descriptions(new Set<UseDescription, UseDescriptionComparator>),
- _all_expand_prefixes(new UseFlagNameSet),
_already_downloaded(new Set<FSEntry>),
_resolution_finished(false)
{
@@ -302,11 +275,94 @@ ConsoleInstallTask::on_display_merge_list_post()
output_endl();
display_merge_list_post_counts();
display_merge_list_post_tags();
+ display_merge_list_post_use_descriptions();
+}
+
+void
+ConsoleInstallTask::display_merge_list_post_use_descriptions()
+{
+ if (! want_use_summary())
+ return;
+
+ if (_choice_descriptions.empty())
+ return;
+
+ display_use_summary_start();
+ for (ChoiceDescriptions::const_iterator i(_choice_descriptions.begin()), i_end(_choice_descriptions.end()) ;
+ i != i_end ; ++i)
+ {
+ if (i->second.empty())
+ continue;
- display_merge_list_post_use_descriptions("");
- for (UseFlagNameSet::ConstIterator f(_all_expand_prefixes->begin()),
- f_end(_all_expand_prefixes->end()) ; f != f_end ; ++f)
- display_merge_list_post_use_descriptions(stringify(*f));
+ display_use_summary_start_choice(i);
+ for (ChoiceValueDescriptions::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
+ j != j_end ; ++j)
+ display_use_summary_entry(j);
+ display_use_summary_end_choice(i);
+ }
+ display_tag_summary_end();
+}
+
+void
+ConsoleInstallTask::display_use_summary_start()
+{
+}
+
+void
+ConsoleInstallTask::display_use_summary_start_choice(const ChoiceDescriptions::const_iterator & i)
+{
+ output_heading(i->first + ":");
+}
+
+void
+ConsoleInstallTask::display_use_summary_end_choice(const ChoiceDescriptions::const_iterator &)
+{
+}
+
+void
+ConsoleInstallTask::display_use_summary_entry(const ChoiceValueDescriptions::const_iterator & i)
+{
+ if (i->second.empty())
+ return;
+
+ bool all_same(true);
+ std::string description((*i->second.begin())->choices_key()->value()->find_by_name_with_prefix(
+ i->first)->description());
+ for (std::list<std::tr1::shared_ptr<const PackageID> >::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
+ j != j_end ; ++j)
+ if ((*j)->choices_key()->value()->find_by_name_with_prefix(i->first)->description() != description)
+ all_same = false;
+
+ if (all_same)
+ {
+ std::stringstream desc;
+ desc << std::left << std::setw(30) << (render_as_tag(stringify((*i->second.begin())->choices_key()->value()->find_by_name_with_prefix(
+ i->first)->unprefixed_name())) + ": ");
+ desc << description;
+ output_starred_item(desc.str());
+ }
+ else
+ {
+ {
+ std::stringstream desc;
+ desc << std::left << std::setw(30) << (render_as_tag(stringify((*i->second.begin())->choices_key()->value()->find_by_name_with_prefix(
+ i->first)->unprefixed_name())) + ": ");
+ output_starred_item(desc.str());
+ }
+ for (std::list<std::tr1::shared_ptr<const PackageID> >::const_iterator j(i->second.begin()), j_end(i->second.end()) ;
+ j != j_end ; ++j)
+ {
+ std::stringstream desc;
+ desc << std::left << std::setw(30) << (render_as_package_name(stringify(**j)) + ": ");
+ desc << (*j)->choices_key()->value()->find_by_name_with_prefix(i->first)->description();
+ output_starred_item(desc.str(), 1);
+ }
+ }
+}
+
+void
+ConsoleInstallTask::display_use_summary_end()
+{
}
void
@@ -400,8 +456,8 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_non_package_tags(d, m);
if (! want_compact())
display_merge_list_entry_package_tags(d, m);
+ display_merge_list_entry_choices(d, m, existing_repo);
display_merge_list_entry_description(d, existing_repo, existing_slot_repo, m);
- display_merge_list_entry_use(d, existing_repo, existing_slot_repo, m);
display_merge_list_entry_distsize(d, m);
if (want_compact())
display_merge_list_entry_package_tags(d, m);
@@ -705,143 +761,6 @@ ConsoleInstallTask::display_merge_list_post_tags()
}
void
-ConsoleInstallTask::display_merge_list_post_use_descriptions(const std::string & prefix)
-{
- if (! want_use_summary())
- return;
-
- bool started(false);
- UseFlagName old_flag("OFTEN_NOT_BEEN_ON_BOATS");
-
- std::tr1::shared_ptr<Set<UseDescription, UseDescriptionComparator> > group(
- new Set<UseDescription, UseDescriptionComparator>);
- for (Set<UseDescription, UseDescriptionComparator>::ConstIterator i(all_use_descriptions()->begin()),
- i_end(all_use_descriptions()->end()) ; i != i_end ; ++i)
- {
- switch (i->state)
- {
- case uds_new:
- if (! want_new_use_flags())
- continue;
- break;
-
- case uds_all:
- if (! want_unchanged_use_flags())
- continue;
- break;
-
- case uds_changed:
- if (! want_changed_use_flags())
- continue;
- break;
- }
-
- if (prefix.empty())
- {
- bool prefixed(false);
- for (UseFlagNameSet::ConstIterator f(_all_expand_prefixes->begin()),
- f_end(_all_expand_prefixes->end()) ; f != f_end && ! prefixed ; ++f)
- if (stringify(*f).length() < stringify(i->flag).length())
- if (0 == stringify(i->flag).compare(0, stringify(*f).length(), stringify(*f)))
- prefixed = true;
-
- if (prefixed)
- continue;
- }
- else
- {
- if (stringify(i->flag).length() <= prefix.length())
- continue;
-
- if (0 != stringify(i->flag).compare(0, prefix.length(), prefix))
- continue;
- }
-
- if (! started)
- {
- display_use_summary_start(prefix);
- started = true;
- }
-
- if (old_flag != i->flag)
- {
- if (! group->empty())
- display_use_summary_flag(prefix, group->begin(), group->end());
- old_flag = i->flag;
- group.reset(new Set<UseDescription, UseDescriptionComparator>);
- }
-
- group->insert(*i);
- }
-
- if (! group->empty())
- display_use_summary_flag(prefix, group->begin(), group->end());
-
- if (started)
- display_use_summary_end();
-}
-
-void
-ConsoleInstallTask::display_use_summary_start(const std::string & prefix)
-{
- if (! prefix.empty())
- output_heading(prefix + ":");
- else
- output_heading("Use flags:");
-}
-
-void
-ConsoleInstallTask::display_use_summary_flag(const std::string & prefix,
- Set<UseDescription, UseDescriptionComparator>::ConstIterator i,
- Set<UseDescription, UseDescriptionComparator>::ConstIterator i_end)
-{
- Log::get_instance()->message("console_install_task.display_use_summary_flag.prefix", ll_debug, lc_context)
- << "display_use_summary_flag: prefix is '" << prefix
- << "', i->flag is '" << i->flag << "', i->package_id is '" << *i->package_id << "', i->state is '" << i->state
- << "', i->description is '" << i->description << "'";
-
- if (next(i) == i_end)
- {
- std::ostringstream s;
- s << std::left << std::setw(30) << (render_as_tag(stringify(i->flag).substr(prefix.empty() ? 0 : prefix.length() + 1)) + ": ");
- s << i->description;
- output_starred_item(s.str());
- }
- else
- {
- bool all_same(true);
- for (Set<UseDescription, UseDescriptionComparator>::ConstIterator j(next(i)) ; all_same && j != i_end ; ++j)
- if (j->description != i->description)
- all_same = false;
-
- if (all_same)
- {
- std::ostringstream s;
- s << std::left << std::setw(30) << (render_as_tag(stringify(i->flag).substr(prefix.empty() ? 0 : prefix.length() + 1)) + ": ");
- s << i->description;
- output_starred_item(s.str());
- }
- else
- {
- output_starred_item(render_as_tag(
- stringify(i->flag).substr(prefix.empty() ? 0 : prefix.length() + 1)) + ":");
-
- for ( ; i != i_end ; ++i)
- {
- std::ostringstream s;
- s << i->description << " (for " << render_as_package_name(stringify(*i->package_id)) << ")";
- output_starred_item(s.str(), 1);
- }
- }
- }
-}
-
-void
-ConsoleInstallTask::display_use_summary_end()
-{
-}
-
-void
ConsoleInstallTask::display_tag_summary_start()
{
}
@@ -1136,6 +1055,120 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
}
void
+ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
+ const DisplayMode m,
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo
+ )
+{
+ switch (m)
+ {
+ case unimportant_entry:
+ case error_entry:
+ case suggested_entry:
+ break;
+
+ case normal_entry:
+ {
+ if (! d.package_id->choices_key())
+ break;
+
+ std::tr1::shared_ptr<const Choices> old_choices;
+ if (existing_repo && ! existing_repo->empty())
+ if ((*existing_repo->last())->choices_key())
+ old_choices = (*existing_repo->last())->choices_key()->value();
+
+ ColourFormatter formatter;
+ std::string s;
+ bool non_blank_prefix(false);
+ for (Choices::ConstIterator k(d.package_id->choices_key()->value()->begin()),
+ k_end(d.package_id->choices_key()->value()->end()) ;
+ k != k_end ; ++k)
+ {
+ if ((*k)->hidden())
+ continue;
+
+ bool shown_prefix(false);
+ for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
+ i != i_end ; ++i)
+ {
+ if (! (*i)->explicitly_listed())
+ continue;
+
+ if (! shown_prefix)
+ {
+ if (non_blank_prefix || ! (*k)->show_with_no_prefix())
+ {
+ shown_prefix = true;
+ if (! s.empty())
+ s.append(" ");
+ s.append((*k)->raw_name() + ":");
+ }
+ }
+
+ if (! s.empty())
+ s.append(" ");
+
+ std::string t;
+ if ((*i)->enabled())
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Forced());
+ else
+ t = formatter.format(**i, format::Enabled());
+ }
+ else
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Masked());
+ else
+ t = formatter.format(**i, format::Disabled());
+ }
+
+ bool changed(false), added(false);
+ if (old_choices && (*k)->consider_added_or_changed())
+ {
+ std::tr1::shared_ptr<const ChoiceValue> old_choice(old_choices->find_by_name_with_prefix((*i)->name_with_prefix()));
+ if (! old_choice)
+ added = true;
+ else if (old_choice->enabled() != (*i)->enabled())
+ changed = true;
+ }
+
+ if (changed)
+ {
+ t = formatter.decorate(**i, t, format::Changed());
+ if (want_changed_use_flags())
+ _choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id);
+ }
+ else if (added)
+ {
+ t = formatter.decorate(**i, t, format::Added());
+ if (want_new_use_flags())
+ _choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id);
+ }
+ else if (want_unchanged_use_flags())
+ _choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id);
+
+ s.append(t);
+ }
+ }
+
+ if (s.empty())
+ break;
+
+ if (want_compact())
+ output_no_endl(" " + s);
+ else
+ {
+ output_endl();
+ output_no_endl(" " + s);
+ }
+ }
+ break;
+ }
+}
+
+void
ConsoleInstallTask::display_merge_list_entry_description(const DepListEntry & d,
const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo,
const std::tr1::shared_ptr<const PackageIDSequence> &,
@@ -1174,78 +1207,6 @@ ConsoleInstallTask::display_merge_list_entry_description(const DepListEntry & d,
}
}
-void
-ConsoleInstallTask::_add_descriptions(const std::tr1::shared_ptr<const UseFlagNameSet> & c,
- const std::tr1::shared_ptr<const PackageID> & p, UseDescriptionState s)
-{
- for (UseFlagNameSet::ConstIterator f(c->begin()), f_end(c->end()) ;
- f != f_end ; ++f)
- {
- std::string d;
- const RepositoryUseInterface * const i((*p->repository()).use_interface());
-
- if (i)
- d = i->describe_use_flag(*f, *p);
-
- UseDescription e(UseDescription::create()
- .flag(*f)
- .state(s)
- .package_id(p)
- .description(d));
-
- Set<UseDescription, UseDescriptionComparator>::ConstIterator x(_all_use_descriptions->find(e));
- if (_all_use_descriptions->end() == x)
- _all_use_descriptions->insert(e);
- else
- {
- if (x->state < e.state)
- {
- _all_use_descriptions->erase(e);
- _all_use_descriptions->insert(e);
- }
- }
- }
-}
-
-void
-ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
- const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo,
- const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo,
- const DisplayMode m)
-{
- if (normal_entry != m && suggested_entry != m)
- return;
-
- if ((! d.package_id->iuse_key()) || d.package_id->iuse_key()->value()->empty())
- return;
-
- if (want_compact())
- output_no_endl(" ");
- else
- {
- output_endl();
- output_no_endl(" ");
- }
-
- std::tr1::shared_ptr<const PackageID> old_id;
- if (! existing_slot_repo->empty())
- old_id = *existing_slot_repo->last();
- else if (! existing_repo->empty())
- old_id = *existing_repo->last();
-
- ColourFormatter formatter(old_id ? false : true);
- if (old_id)
- output_stream() << d.package_id->iuse_key()->pretty_print_flat_with_comparison(environment(), old_id, formatter);
- else
- output_stream() << d.package_id->iuse_key()->pretty_print_flat(formatter);
-
- _add_descriptions(formatter.seen_new_use_flag_names(), d.package_id, uds_new);
- _add_descriptions(formatter.seen_changed_use_flag_names(), d.package_id, uds_changed);
- _add_descriptions(formatter.seen_use_flag_names(), d.package_id, uds_all);
- std::copy(formatter.seen_use_expand_prefixes()->begin(), formatter.seen_use_expand_prefixes()->end(),
- _all_expand_prefixes->inserter());
-}
-
namespace
{
struct FindDistfilesSize :
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index d123ed9..ff0163f 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -24,25 +24,13 @@
#include <paludis/util/set.hh>
#include <src/output/console_task.hh>
#include <iosfwd>
+#include <map>
+#include <list>
namespace paludis
{
class ConsoleInstallTask;
- enum UseDescriptionState
- {
- uds_all,
- uds_changed,
- uds_new
- };
-
-#include <src/output/console_install_task-sr.hh>
-
- struct UseDescriptionComparator
- {
- bool operator() (const UseDescription &, const UseDescription &) const;
- };
-
class PALUDIS_VISIBLE DepTagSummaryDisplayer :
public ConstVisitor<DepTagVisitorTypes>
{
@@ -111,17 +99,16 @@ namespace paludis
suggested_entry
};
+ typedef std::map<ChoiceNameWithPrefix, std::list<std::tr1::shared_ptr<const PackageID> > > ChoiceValueDescriptions;
+ typedef std::map<std::string, ChoiceValueDescriptions> ChoiceDescriptions;
+
private:
int _counts[last_count];
unsigned long _download_size;
bool _download_size_overflow;
std::tr1::shared_ptr<Set<DepTagEntry> > _all_tags;
- std::tr1::shared_ptr<Set<UseDescription, UseDescriptionComparator> > _all_use_descriptions;
- std::tr1::shared_ptr<UseFlagNameSet> _all_expand_prefixes;
std::tr1::shared_ptr<Set<FSEntry> > _already_downloaded;
-
- void _add_descriptions(const std::tr1::shared_ptr<const UseFlagNameSet> &,
- const std::tr1::shared_ptr<const PackageID> &, UseDescriptionState);
+ ChoiceDescriptions _choice_descriptions;
bool _resolution_finished;
@@ -222,6 +209,7 @@ namespace paludis
virtual void display_merge_list_post_counts();
virtual void display_merge_list_post_tags();
+ virtual void display_merge_list_post_use_descriptions();
virtual void display_merge_list_entry_start(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_package_name(const DepListEntry &, const DisplayMode);
@@ -234,9 +222,8 @@ namespace paludis
virtual void display_merge_list_entry_description(const DepListEntry &,
const std::tr1::shared_ptr<const PackageIDSequence> &,
const std::tr1::shared_ptr<const PackageIDSequence> &, const DisplayMode);
- virtual void display_merge_list_entry_use(const DepListEntry &,
- const std::tr1::shared_ptr<const PackageIDSequence> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &, const DisplayMode);
+ virtual void display_merge_list_entry_choices(const DepListEntry &, const DisplayMode,
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo);
virtual void display_merge_list_entry_distsize(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_non_package_tags(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_package_tags(const DepListEntry &, const DisplayMode);
@@ -251,11 +238,10 @@ namespace paludis
virtual void display_tag_summary_tag_post_text(const DepTagCategory &);
virtual void display_tag_summary_end();
- virtual void display_merge_list_post_use_descriptions(const std::string &);
- virtual void display_use_summary_start(const std::string &);
- virtual void display_use_summary_flag(const std::string &,
- Set<UseDescription, UseDescriptionComparator>::ConstIterator,
- Set<UseDescription, UseDescriptionComparator>::ConstIterator);
+ virtual void display_use_summary_start();
+ virtual void display_use_summary_start_choice(const ChoiceDescriptions::const_iterator &);
+ virtual void display_use_summary_entry(const ChoiceValueDescriptions::const_iterator &);
+ virtual void display_use_summary_end_choice(const ChoiceDescriptions::const_iterator &);
virtual void display_use_summary_end();
virtual void show_resume_command() const;
@@ -291,11 +277,6 @@ namespace paludis
return _all_tags;
}
- std::tr1::shared_ptr<Set<UseDescription, UseDescriptionComparator> > all_use_descriptions()
- {
- return _all_use_descriptions;
- }
-
///\}
///\name Options
diff --git a/src/output/console_install_task.sr b/src/output/console_install_task.sr
deleted file mode 100644
index 401cc60..0000000
--- a/src/output/console_install_task.sr
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_UseDescription()
-{
- visible
-
- key flag UseFlagName
- key package_id "std::tr1::shared_ptr<const PackageID>"
- key state UseDescriptionState
- key description std::string
-
- allow_named_args
-}
-
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 4d1479c..3a574f0 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -38,6 +38,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/choice.hh>
#include <list>
using namespace paludis;
@@ -291,24 +292,6 @@ namespace
{
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
- {
- if (k.type() == type)
- {
- ColourFormatter formatter;
- if (task->want_raw())
- {
- task->output_left_column(k.raw_name() + ":", in);
- task->output_right_column(k.pretty_print_flat(formatter));
- }
- else
- {
- task->output_left_column(k.human_name() + ":", in);
- task->output_right_column(k.pretty_print_flat(formatter));
- }
- }
- }
-
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
if (k.type() == type)
@@ -363,24 +346,6 @@ namespace
}
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- if (k.type() == type)
- {
- ColourFormatter formatter;
- if (task->want_raw())
- {
- task->output_left_column(k.raw_name() + ":", in);
- task->output_right_column(k.pretty_print_flat(formatter));
- }
- else
- {
- task->output_left_column(k.human_name() + ":", in);
- task->output_right_column(k.pretty_print_flat(formatter));
- }
- }
- }
-
void visit(const MetadataCollectionKey<KeywordNameSet> & k)
{
if (k.type() == type)
@@ -693,6 +658,107 @@ namespace
}
}
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
+ {
+ ColourFormatter formatter;
+ if (k.type() == type)
+ {
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":", in);
+ task->output_right_column("");
+ for (Choices::ConstIterator c(k.value()->begin()), c_end(k.value()->end()) ;
+ c != c_end ; ++c)
+ {
+ task->output_left_column((*c)->raw_name() + ":", in + 4);
+
+ std::string v;
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end ; ++i)
+ {
+ if (! v.empty())
+ v.append(" ");
+
+ std::string t;
+ if ((*i)->enabled())
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Forced());
+ else
+ t = formatter.format(**i, format::Enabled());
+ }
+ else
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Masked());
+ else
+ t = formatter.format(**i, format::Disabled());
+ }
+
+ v.append(t);
+ }
+ task->output_right_column(v);
+ }
+ }
+ else
+ {
+ std::string s;
+ bool shown_prefix(false);
+
+ for (Choices::ConstIterator c(k.value()->begin()), c_end(k.value()->end()) ;
+ c != c_end ; ++c)
+ {
+ bool done_leader(false);
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end ; ++i)
+ {
+ if ((*c)->hidden())
+ continue;
+ if (! (*i)->explicitly_listed())
+ continue;
+
+ if (! done_leader)
+ {
+ if (shown_prefix || ! (*c)->show_with_no_prefix())
+ {
+ if (! s.empty())
+ s.append(" ");
+
+ s.append((*c)->human_name() + ":");
+ done_leader = true;
+ shown_prefix = true;
+ }
+ }
+
+ if (! s.empty())
+ s.append(" ");
+
+ std::string t;
+ if ((*i)->enabled())
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Forced());
+ else
+ t = formatter.format(**i, format::Enabled());
+ }
+ else
+ {
+ if ((*i)->locked())
+ t = formatter.format(**i, format::Masked());
+ else
+ t = formatter.format(**i, format::Disabled());
+ }
+
+ s.append(t);
+ }
+ }
+
+ task->output_left_column(k.human_name() + ":", in);
+ task->output_right_column(s);
+ }
+ }
+ }
+
void visit(const MetadataValueKey<std::tr1::shared_ptr<const Contents> > &)
{
}
@@ -818,6 +884,10 @@ namespace
{
}
+ void visit_leaf(const PlainTextLabelDepSpec &)
+ {
+ }
+
void visit_leaf(const DependencyLabelsDepSpec &)
{
}
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index 231ca98..c655dbe 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -124,18 +124,6 @@ namespace
s << k.value();
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- ColourFormatter formatter;
- s << k.pretty_print_flat(formatter);
- }
-
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
- {
- ColourFormatter formatter;
- s << k.pretty_print_flat(formatter);
- }
-
void visit(const MetadataCollectionKey<Set<std::string> > & k)
{
ColourFormatter formatter;
@@ -201,6 +189,11 @@ namespace
ColourFormatter formatter;
s << k.pretty_print_flat(formatter);
}
+
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
+ {
+ s << k.human_name();
+ }
};
}