aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-12 02:18:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-12 02:18:26 +0000
commit342df67f19661afb564d1688f0882c8411b82cc3 (patch)
tree946567614df0bce241ef1a0125453791c0b3353d
parentb527b9fbe8b1b33db6b4eb616788f54988f5bd33 (diff)
downloadpaludis-342df67f19661afb564d1688f0882c8411b82cc3.tar.gz
paludis-342df67f19661afb564d1688f0882c8411b82cc3.tar.xz
Include environment sets in set lists.
-rw-r--r--paludis/environment.cc6
-rw-r--r--paludis/environment.hh7
-rw-r--r--paludis/environment/default/default_environment.cc18
-rw-r--r--paludis/environment/default/default_environment.hh2
-rw-r--r--src/gtkpaludis/sets_list.cc3
-rw-r--r--src/paludis/list.cc14
6 files changed, 47 insertions, 3 deletions
diff --git a/paludis/environment.cc b/paludis/environment.cc
index aae5646..2e18e26 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -472,3 +472,9 @@ Environment::known_use_expand_names(const UseFlagName &, const PackageDatabaseEn
return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
}
+SetsCollection::ConstPointer
+Environment::sets_list() const
+{
+ return SetsCollection::ConstPointer(new SetsCollection::Concrete);
+}
+
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 9cd0224..eeacee1 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -236,6 +236,13 @@ namespace paludis
DepAtom::Pointer package_set(const SetName &) const;
/**
+ * Fetch all named sets. Does not include sets from repositories.
+ *
+ * Default behaviour: no sets.
+ */
+ virtual SetsCollection::ConstPointer sets_list() const;
+
+ /**
* Subclass for callbacks used by add_appropriate_to_world and
* remove_appropriate_from_world.
*
diff --git a/paludis/environment/default/default_environment.cc b/paludis/environment/default/default_environment.cc
index 0a71981..a755685 100644
--- a/paludis/environment/default/default_environment.cc
+++ b/paludis/environment/default/default_environment.cc
@@ -28,6 +28,7 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/strip.hh>
#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/dir_iterator.hh>
@@ -490,6 +491,23 @@ DefaultEnvironment::local_package_set(const SetName & s) const
return DepAtom::Pointer(0);
}
+SetsCollection::ConstPointer
+DefaultEnvironment::sets_list() const
+{
+ SetsCollection::Pointer result(new SetsCollection::Concrete);
+
+ for (DirIterator d(FSEntry(DefaultConfig::get_instance()->config_dir()) / "sets"), d_end ;
+ d != d_end ; ++d)
+ {
+ if (! IsFileWithExtension(".conf")(*d))
+ continue;
+
+ result->insert(SetName(strip_trailing_string(d->basename(), ".conf")));
+ }
+
+ return result;
+}
+
DefaultEnvironment::MirrorIterator
DefaultEnvironment::begin_mirrors(const std::string & mirror) const
{
diff --git a/paludis/environment/default/default_environment.hh b/paludis/environment/default/default_environment.hh
index 8d4b74e..17f60dc 100644
--- a/paludis/environment/default/default_environment.hh
+++ b/paludis/environment/default/default_environment.hh
@@ -52,6 +52,8 @@ namespace paludis
CompositeDepAtom::Pointer local_package_set(const SetName &) const;
public:
+ virtual SetsCollection::ConstPointer sets_list() const;
+
virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool accept_keyword(const KeywordName &, const PackageDatabaseEntry * const) const;
diff --git a/src/gtkpaludis/sets_list.cc b/src/gtkpaludis/sets_list.cc
index 8714c2d..969f53d 100644
--- a/src/gtkpaludis/sets_list.cc
+++ b/src/gtkpaludis/sets_list.cc
@@ -104,6 +104,9 @@ namespace
std::copy(sets->begin(), sets->end(), std::inserter(names, names.end()));
}
+ SetsCollection::ConstPointer sets(DefaultEnvironment::get_instance()->sets_list());
+ std::copy(sets->begin(), sets->end(), std::inserter(names, names.end()));
+
dispatch(sigc::bind<1>(sigc::mem_fun(_imp, &Implementation<SetsList>::add_sets), names));
}
}
diff --git a/src/paludis/list.cc b/src/paludis/list.cc
index f652639..66ade33 100644
--- a/src/paludis/list.cc
+++ b/src/paludis/list.cc
@@ -186,7 +186,7 @@ do_list_sets()
p::Context context("While performing list-sets action from command line:");
p::Environment * const env(p::DefaultEnvironment::get_instance());
- std::map<p::SetName, std::list<p::RepositoryName> > sets;
+ std::map<p::SetName, std::list<std::string> > sets;
for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
@@ -205,10 +205,18 @@ do_list_sets()
p::SetsCollection::ConstPointer set_names(r->sets_interface->sets_list());
for (p::SetsCollection::Iterator s(set_names->begin()), s_end(set_names->end()) ;
s != s_end ; ++s)
- sets[*s].push_back(r->name());
+ sets[*s].push_back(stringify(r->name()));
}
- for (std::map<p::SetName, std::list<p::RepositoryName > >::const_iterator
+ if (! CommandLine::get_instance()->a_repository.specified())
+ {
+ p::SetsCollection::ConstPointer set_names(env->sets_list());
+ for (p::SetsCollection::Iterator s(set_names->begin()), s_end(set_names->end()) ;
+ s != s_end ; ++s)
+ sets[*s].push_back("environment");
+ }
+
+ for (std::map<p::SetName, std::list<std::string> >::const_iterator
s(sets.begin()), s_end(sets.end()) ; s != s_end ; ++s)
{
if (CommandLine::get_instance()->a_set.specified())