aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-16 13:58:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-16 13:58:49 +0000
commit3437c3c717e2aff920266d24f0b5d2166acb214a (patch)
tree045eb1fc9bd26f5d8c53f1cad66e5987914478e1
parent6b36e86d003321a4f644d8e83ae2bd6428c1b07e (diff)
downloadpaludis-3437c3c717e2aff920266d24f0b5d2166acb214a.tar.gz
paludis-3437c3c717e2aff920266d24f0b5d2166acb214a.tar.xz
everything -> installed-{packages,slots}
-rw-r--r--doc/configuration/sets.html.part.in7
-rw-r--r--paludis/common_sets-fwd.hh34
-rw-r--r--paludis/common_sets.cc84
-rw-r--r--paludis/common_sets.hh30
-rw-r--r--paludis/environment_implementation.cc22
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/install_task.cc3
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc33
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc30
-rw-r--r--paludis/repositories/e/e_installed_repository.cc30
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc8
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc30
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc30
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc3
-rw-r--r--src/output/console_install_task.cc3
15 files changed, 197 insertions, 151 deletions
diff --git a/doc/configuration/sets.html.part.in b/doc/configuration/sets.html.part.in
index 0699b48..4ab3a8b 100644
--- a/doc/configuration/sets.html.part.in
+++ b/doc/configuration/sets.html.part.in
@@ -16,8 +16,11 @@
<dd>Consists of the system set, plus all packages that have been installed as targets (as opposed to merely pulled
in as dependencies of a target).</dd>
- <dt><code>everything</code></dt>
- <dd>All installed packages.</dd>
+ <dt><code>installed-packages</code></dt>
+ <dd>The names of all installed packages.</dd>
+
+ <dt><code>installed-slots</code></dt>
+ <dd>The names plus slots of all installed packages.</dd>
<dt><code>security</code></dt>
<dd>The set of upgrades which must be performed to resolve security holes.</dd>
diff --git a/paludis/common_sets-fwd.hh b/paludis/common_sets-fwd.hh
new file mode 100644
index 0000000..326eb82
--- /dev/null
+++ b/paludis/common_sets-fwd.hh
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_COMMON_SETS_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_COMMON_SETS_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/repository-fwd.hh>
+
+namespace paludis
+{
+ void add_common_sets_for_installed_repo(
+ const Environment * const,
+ const Repository &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/common_sets.cc b/paludis/common_sets.cc
new file mode 100644
index 0000000..f14fb7e
--- /dev/null
+++ b/paludis/common_sets.cc
@@ -0,0 +1,84 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/common_sets.hh>
+#include <paludis/environment.hh>
+#include <paludis/repository.hh>
+#include <paludis/spec_tree.hh>
+#include <paludis/selection.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/package_id.hh>
+#include <paludis/elike_slot_requirement.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/stringify.hh>
+
+using namespace paludis;
+
+namespace
+{
+ std::tr1::shared_ptr<SetSpecTree> get_installed_set(
+ const Environment * const env,
+ const Repository * const repo,
+ const bool slots)
+ {
+ Context context("When making " + std::string(slots ? "installed-slots" : "installed-packages") +
+ " set from '" + stringify(repo->name()) + "':");
+
+ std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
+
+ std::tr1::shared_ptr<const PackageIDSequence> ids;
+ if (slots)
+ ids = ((*env)[selection::BestVersionInEachSlot(generator::InRepository(repo->name()))]);
+ else
+ ids = ((*env)[selection::BestVersionOnly(generator::InRepository(repo->name()))]);
+
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ if (slots && (*i)->slot_key())
+ result->root()->append(make_shared_ptr(new PackageDepSpec(
+ make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
+ .package((*i)->name())
+ .slot_requirement(make_shared_ptr(new ELikeSlotExactRequirement(
+ (*i)->slot_key()->value(), false)))
+ )));
+ else
+ result->root()->append(make_shared_ptr(new PackageDepSpec(
+ make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
+ .package((*i)->name())
+ )));
+
+ return result;
+ }
+}
+
+void
+paludis::add_common_sets_for_installed_repo(
+ const Environment * const env,
+ const Repository & repo)
+{
+ env->add_set(SetName("installed-packages"), SetName("installed-packages::" + stringify(repo.name())),
+ std::tr1::bind(&get_installed_set, env, &repo, false), true);
+ env->add_set(SetName("installed-slots"), SetName("installed-slots::" + stringify(repo.name())),
+ std::tr1::bind(&get_installed_set, env, &repo, true), true);
+}
+
diff --git a/paludis/common_sets.hh b/paludis/common_sets.hh
new file mode 100644
index 0000000..6f78325
--- /dev/null
+++ b/paludis/common_sets.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_COMMON_SETS_HH
+#define PALUDIS_GUARD_PALUDIS_COMMON_SETS_HH 1
+
+#include <paludis/common_sets-fwd.hh>
+
+namespace paludis
+{
+
+}
+
+#endif
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 7fdb086..8370f3c 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -313,18 +313,38 @@ EnvironmentImplementation::_need_sets() const
_imp->loaded_sets = true;
}
+namespace
+{
+ std::tr1::shared_ptr<const SetSpecTree> make_everything_set()
+ {
+ Log::get_instance()->message("environment_implementation.everything_deprecated", ll_warning, lc_context)
+ << "The 'everything' set is deprecated. Use either 'installed-packages' or 'installed-slots' instead";
+
+ std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
+ result->root()->append(make_shared_ptr(new NamedSetDepSpec(SetName("installed-packages"))));
+ return result;
+ }
+}
+
void
EnvironmentImplementation::populate_standard_sets() const
{
set_always_exists(SetName("system"));
set_always_exists(SetName("world"));
- set_always_exists(SetName("everything"));
+
+ set_always_exists(SetName("installed-packages"));
+ set_always_exists(SetName("installed-slots"));
SetsStore::iterator i(_imp->sets.find(SetName("world")));
/* some test cases build world through evil haxx. don't inject system in
* then. */
if (i->second.second)
i->second.second(SetName("system"));
+
+ /* nothing should define 'everything' any more */
+ if (_imp->sets.end() != _imp->sets.find(SetName("everything")))
+ throw InternalError(PALUDIS_HERE, "something's still defining the 'everything' set");
+ add_set(SetName("everything"), SetName("everything"), make_everything_set, false);
}
namespace
diff --git a/paludis/files.m4 b/paludis/files.m4
index c1f9ed3..b9f1470 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -12,6 +12,7 @@ add(`about', `hh', `test')
add(`action', `hh', `cc', `fwd', `se')
add(`action_names', `hh', `cc', `fwd')
add(`choice', `hh', `cc', `fwd')
+add(`common_sets', `hh', `cc', `fwd')
add(`contents', `hh', `cc', `fwd')
add(`create_output_manager_info', `hh', `cc', `fwd', `se')
add(`dep_label', `hh', `cc', `fwd')
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 1d9749c..be97346 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -1393,7 +1393,8 @@ void
InstallTask::world_update_set(const SetName & s)
{
if (s == SetName("world") || s == SetName("system") || s == SetName("security")
- || s == SetName("everything") || s == SetName("insecurity"))
+ || s == SetName("everything") || s == SetName("installed-packages")
+ || s == SetName("installed-slotted") || s == SetName("insecurity"))
{
on_update_world_skip(s, "special sets cannot be added to world");
return;
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index 1a3a2aa..ec80a9a 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -39,6 +39,7 @@
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/hook.hh>
+#include <paludis/common_sets.hh>
using namespace paludis;
using namespace paludis::accounts_repository;
@@ -410,29 +411,6 @@ AccountsRepository::merge(const MergeParams & m)
_imp->handler_if_installed->merge(m);
}
-namespace
-{
- std::tr1::shared_ptr<SetSpecTree> get_everything_set(
- const Environment * const env,
- const AccountsRepository * const repo)
- {
- Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
-
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
-
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::InRepository(repo->name()))]);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
- i != i_end ; ++i)
- result->root()->append(make_shared_ptr(new PackageDepSpec(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package((*i)->name())
- )));
-
- return result;
- }
-}
-
void
AccountsRepository::populate_sets() const
{
@@ -441,14 +419,7 @@ AccountsRepository::populate_sets() const
/* no sets */
}
else
- {
- /* everything */
- _imp->params_if_installed->environment()->add_set(
- SetName("everything"),
- SetName("everything::" + stringify(name())),
- std::tr1::bind(get_everything_set, _imp->params_if_installed->environment(), this),
- true);
- }
+ add_common_sets_for_installed_repo(_imp->params_if_installed->environment(), *this);
}
HookResult
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 622cf40..11edacd 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -32,6 +32,7 @@
#include <paludis/filter.hh>
#include <paludis/selection.hh>
#include <paludis/hook.hh>
+#include <paludis/common_sets.hh>
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/cran_installed_repository.hh>
@@ -560,37 +561,10 @@ CRANInstalledRepository::installed_root_key() const
return _imp->installed_root_key;
}
-namespace
-{
- std::tr1::shared_ptr<SetSpecTree> get_everything_set(
- const Environment * const env,
- const Repository * const repo)
- {
- Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
-
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
-
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::InRepository(repo->name()))]);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
- i != i_end ; ++i)
- result->root()->append(make_shared_ptr(new PackageDepSpec(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package((*i)->name())
- )));
-
- return result;
- }
-}
-
void
CRANInstalledRepository::populate_sets() const
{
- _imp->params.environment()->add_set(
- SetName("everything"),
- SetName("everything::" + stringify(name())),
- std::tr1::bind(get_everything_set, _imp->params.environment(), this),
- true);
+ add_common_sets_for_installed_repo(_imp->params.environment(), *this);
}
HookResult
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 01a2974..e081bba 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -50,6 +50,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/common_sets.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -371,37 +372,10 @@ EInstalledRepository::perform_info(
}
}
-namespace
-{
- std::tr1::shared_ptr<SetSpecTree> get_everything_set(
- const Environment * const env,
- const Repository * const repo)
- {
- Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
-
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
-
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::InRepository(repo->name()))]);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
- i != i_end ; ++i)
- result->root()->append(make_shared_ptr(new PackageDepSpec(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package((*i)->name())
- )));
-
- return result;
- }
-}
-
void
EInstalledRepository::populate_sets() const
{
- _imp->params.environment()->add_set(
- SetName("everything"),
- SetName("everything::" + stringify(name())),
- std::tr1::bind(get_everything_set, _imp->params.environment(), this),
- true);
+ add_common_sets_for_installed_repo(_imp->params.environment(), *this);
}
bool
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index 43f1e32..a5069d8 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -66,8 +66,12 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::tr1::shared_ptr<const SetNameSet> sets_list(env.set_names());
- TEST_CHECK_EQUAL(join(sets_list->begin(), sets_list->end(), " "), "everything everything::default insecurity "
- "insecurity::test-repo-1 security security::test-repo-1 set1 set1* set1::test-repo-1 set1::test-repo-1* "
+ TEST_CHECK_EQUAL(join(sets_list->begin(), sets_list->end(), " "), "everything insecurity "
+ "insecurity::test-repo-1 "
+ "installed-packages installed-packages::default "
+ "installed-slots installed-slots::default "
+ "security security::test-repo-1 set1 set1* "
+ "set1::test-repo-1 set1::test-repo-1* "
"system system::test-repo-1 world world::default");
}
} test_e_repository_sets_sets_list;
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 93d5989..26fcbc4 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -46,6 +46,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/hook.hh>
+#include <paludis/common_sets.hh>
#include <tr1/unordered_map>
using namespace paludis;
@@ -412,37 +413,10 @@ InstalledGemsRepository::repository_factory_create(
)));
}
-namespace
-{
- std::tr1::shared_ptr<SetSpecTree> get_everything_set(
- const Environment * const env,
- const Repository * const repo)
- {
- Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
-
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
-
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::InRepository(repo->name()))]);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
- i != i_end ; ++i)
- result->root()->append(make_shared_ptr(new PackageDepSpec(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package((*i)->name())
- )));
-
- return result;
- }
-}
-
void
InstalledGemsRepository::populate_sets() const
{
- _imp->params.environment()->add_set(
- SetName("everything"),
- SetName("everything::" + stringify(name())),
- std::tr1::bind(get_everything_set, _imp->params.environment(), this),
- true);
+ add_common_sets_for_installed_repo(_imp->params.environment(), *this);
}
HookResult
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index e0680a5..9d33628 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -47,6 +47,7 @@
#include <paludis/filter.hh>
#include <paludis/selection.hh>
#include <paludis/hook.hh>
+#include <paludis/common_sets.hh>
#include <sstream>
#include <sys/time.h>
@@ -475,37 +476,10 @@ InstalledUnpackagedRepository::repository_factory_dependencies(
return make_shared_ptr(new RepositoryNameSet);
}
-namespace
-{
- std::tr1::shared_ptr<SetSpecTree> get_everything_set(
- const Environment * const env,
- const Repository * const repo)
- {
- Context context("When making 'everything' set from '" + stringify(repo->name()) + "':");
-
- std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
-
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::InRepository(repo->name()))]);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
- i != i_end ; ++i)
- result->root()->append(make_shared_ptr(new PackageDepSpec(
- make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
- .package((*i)->name())
- )));
-
- return result;
- }
-}
-
void
InstalledUnpackagedRepository::populate_sets() const
{
- _imp->params.environment()->add_set(
- SetName("everything"),
- SetName("everything::" + stringify(name())),
- std::tr1::bind(get_everything_set, _imp->params.environment(), this),
- true);
+ add_common_sets_for_installed_repo(_imp->params.environment(), *this);
}
HookResult
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index 8071e70..85c9032 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -519,7 +519,8 @@ namespace
a != a_end ; ++a)
{
if (*a == "world" || *a == "system" || *a == "security"
- || *a == "everything" || *a == "insecurity")
+ || *a == "everything" || *a == "insecurity"
+ || *a == "installed-packages" || *a == "installed-slots")
cout << "* Special set '" << *a << "' does not belong in world" << endl;
else
{
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index c71feed..aea0964 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -892,7 +892,8 @@ DepTagSummaryDisplayer::visit(const GeneralSetDepTag & tag)
std::string desc;
if (tag.short_text() == "world")
desc = ": Packages that have been explicitly installed";
- else if (tag.short_text() == "everything")
+ else if (tag.short_text() == "everything" || tag.short_text() == "installed-packages"
+ || tag.short_text() == "installed-slotted")
desc = ": All installed packages";
else if (tag.short_text() == "system")
desc = ": Packages that are part of the base system";