aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-06 14:11:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-06 14:11:22 +0000
commit05b3a52ec5ab06937bc9038c370db9b347dbe9af (patch)
tree24c2c04de3e6fbf7181859a44f8fb194413aa039
parentbb634210c725c1fa821b61b8f4270f9468099928 (diff)
downloadpaludis-05b3a52ec5ab06937bc9038c370db9b347dbe9af.tar.gz
paludis-05b3a52ec5ab06937bc9038c370db9b347dbe9af.tar.xz
Remove legacy code
-rw-r--r--.gitignore4
-rw-r--r--configure.ac1
-rw-r--r--doc/api/ruby/create_ruby_doc.rb6
-rw-r--r--paludis/Makefile.am.m42
-rw-r--r--paludis/legacy/Makefile.am143
-rw-r--r--paludis/legacy/dep_list-fwd.hh52
-rw-r--r--paludis/legacy/dep_list.cc1769
-rw-r--r--paludis/legacy/dep_list.hh320
-rw-r--r--paludis/legacy/dep_list_TEST.cc2347
-rw-r--r--paludis/legacy/dep_list_TEST.hh216
-rw-r--r--paludis/legacy/dep_list_TEST_blockers.cc376
-rw-r--r--paludis/legacy/dep_list_exceptions.cc97
-rw-r--r--paludis/legacy/dep_list_exceptions.hh224
-rw-r--r--paludis/legacy/dep_list_options.cc28
-rw-r--r--paludis/legacy/dep_list_options.hh41
-rw-r--r--paludis/legacy/dep_list_options.se257
-rw-r--r--paludis/legacy/find_unused_packages_task.cc104
-rw-r--r--paludis/legacy/find_unused_packages_task.hh76
-rw-r--r--paludis/legacy/handled_information-fwd.hh42
-rw-r--r--paludis/legacy/handled_information.cc88
-rw-r--r--paludis/legacy/handled_information.hh208
-rw-r--r--paludis/legacy/install_task.cc1978
-rw-r--r--paludis/legacy/install_task.hh287
-rw-r--r--paludis/legacy/install_task.se24
-rw-r--r--paludis/legacy/override_functions.cc111
-rw-r--r--paludis/legacy/override_functions.hh77
-rw-r--r--paludis/legacy/query_visitor.cc212
-rw-r--r--paludis/legacy/query_visitor.hh81
-rw-r--r--paludis/legacy/range_rewriter.cc309
-rw-r--r--paludis/legacy/range_rewriter.hh81
-rw-r--r--paludis/legacy/range_rewriter_TEST.cc62
-rw-r--r--paludis/legacy/report_task.cc276
-rw-r--r--paludis/legacy/report_task.hh98
-rw-r--r--paludis/legacy/show_suggest_visitor.cc262
-rw-r--r--paludis/legacy/show_suggest_visitor.hh75
-rw-r--r--paludis/legacy/sync_task.cc225
-rw-r--r--paludis/legacy/sync_task.hh113
-rw-r--r--paludis/legacy/tasks_exceptions.cc34
-rw-r--r--paludis/legacy/tasks_exceptions.hh65
-rw-r--r--paludis/legacy/uninstall_list.cc614
-rw-r--r--paludis/legacy/uninstall_list.hh163
-rw-r--r--paludis/legacy/uninstall_list.se21
-rw-r--r--paludis/legacy/uninstall_list_TEST.cc510
-rw-r--r--paludis/legacy/uninstall_task.cc492
-rw-r--r--paludis/legacy/uninstall_task.hh174
-rw-r--r--python/Makefile.am4
-rw-r--r--python/dep_list.cc305
-rwxr-xr-xpython/dep_list_TEST.py179
-rwxr-xr-xpython/dep_list_TEST_cleanup.sh8
-rwxr-xr-xpython/dep_list_TEST_setup.sh104
-rw-r--r--python/paludis_python.hh1
-rw-r--r--python/paludis_python_so.cc1
-rw-r--r--ruby/Makefile.am7
-rw-r--r--ruby/dep_list.cc1477
-rw-r--r--ruby/dep_list_TEST.rb305
-rwxr-xr-xruby/dep_list_TEST_cleanup.sh12
-rwxr-xr-xruby/dep_list_TEST_setup.sh104
-rw-r--r--ruby/find_unused_packages_task.cc101
-rw-r--r--ruby/find_unused_packages_task_TEST.rb52
-rwxr-xr-xruby/find_unused_packages_task_TEST_cleanup.sh12
-rwxr-xr-xruby/find_unused_packages_task_TEST_setup.sh63
-rw-r--r--ruby/paludis_ruby.cc78
-rw-r--r--src/output/Makefile.am6
-rw-r--r--src/output/console_install_task.cc1998
-rw-r--r--src/output/console_install_task.hh314
-rw-r--r--src/output/console_query_task.cc968
-rw-r--r--src/output/console_query_task.hh73
-rw-r--r--src/output/console_task.cc187
-rw-r--r--src/output/console_task.hh84
-rw-r--r--src/output/mask_displayer.cc307
-rw-r--r--src/output/mask_displayer.hh54
71 files changed, 6 insertions, 19543 deletions
diff --git a/.gitignore b/.gitignore
index 378c2c3..946b32d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -260,10 +260,6 @@ paludis-*.*.*.tar.bz2
/paludis/hooker_TEST
/paludis/host_tuple_name_TEST
/paludis/ihateautomake.cc
-/paludis/legacy/dep_list_TEST
-/paludis/legacy/dep_list_TEST_blockers
-/paludis/legacy/range_rewriter_TEST
-/paludis/legacy/uninstall_list_TEST
/paludis/name_TEST
/paludis/package_database_TEST
/paludis/paludis.hh
diff --git a/configure.ac b/configure.ac
index ff2f3db..c1b044f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1754,7 +1754,6 @@ AC_OUTPUT(
paludis/environments/test/Makefile
paludis/fetchers/Makefile
paludis/fetchers/demos/Makefile
- paludis/legacy/Makefile
paludis/repositories/Makefile
paludis/repositories/accounts/Makefile
paludis/repositories/cran/Makefile
diff --git a/doc/api/ruby/create_ruby_doc.rb b/doc/api/ruby/create_ruby_doc.rb
index 3ae25f6..11dcc3f 100644
--- a/doc/api/ruby/create_ruby_doc.rb
+++ b/doc/api/ruby/create_ruby_doc.rb
@@ -62,11 +62,7 @@ module RDoc
def generate_consts(header, type, in_class)
consts = []
- if File.exist?(ENV["TOP_SRCDIR"] + "/#{header}")
- file = File.read(ENV["TOP_SRCDIR"] + "/#{header}")
- else
- file = File.read(ENV["TOP_SRCDIR"] + "/#{header.sub(%r[^paludis/], "paludis/legacy/")}")
- end
+ file = File.read(ENV["TOP_SRCDIR"] + "/#{header}")
match = Regexp.new(/enum\s+#{type}\s+\{([^}]+)\}/)#, Regexp::MULTILINE)
if file =~ match
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 3264762..03c10b4 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -66,7 +66,7 @@ EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \
testscriptlist selist secleanlist \
hooker.bash \
stripper_TEST_binary.cc
-SUBDIRS = distributions fetchers syncers util selinux repositories environments . legacy args resolver
+SUBDIRS = distributions fetchers syncers util selinux repositories environments . args resolver
BUILT_SOURCES = secleanlist
libpaludis_@PALUDIS_PC_SLOT@_la_SOURCES = filelist
diff --git a/paludis/legacy/Makefile.am b/paludis/legacy/Makefile.am
deleted file mode 100644
index c6485b6..0000000
--- a/paludis/legacy/Makefile.am
+++ /dev/null
@@ -1,143 +0,0 @@
-include $(top_srcdir)/misc/common-makefile.am
-
-DISTCLEANFILES = \
- dep_list_options-se.hh dep_list_options-se.cc \
- install_task-se.hh install_task-se.cc \
- uninstall_list-se.hh uninstall_list-se.cc
-
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
-
-EXTRA_DIST = \
- dep_list_options-se.hh dep_list_options-se.cc dep_list_options.se \
- install_task-se.hh install_task-se.cc install_task.se \
- uninstall_list-se.hh uninstall_list-se.cc uninstall_list.se
-
-BUILT_SOURCES = \
- dep_list_options-se.hh dep_list_options-se.cc \
- install_task-se.hh install_task-se.cc \
- uninstall_list-se.hh uninstall_list-se.cc
-
-paludis_legacy_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/paludis/legacy
-
-paludis_legacy_include_HEADERS = \
- dep_list.hh dep_list-fwd.hh \
- dep_list_exceptions.hh \
- dep_list_options.hh dep_list_options-se.hh \
- find_unused_packages_task.hh \
- handled_information.hh handled_information-fwd.hh \
- install_task.hh install_task-se.hh \
- override_functions.hh \
- query_visitor.hh \
- range_rewriter.hh \
- report_task.hh \
- show_suggest_visitor.hh \
- sync_task.hh \
- tasks_exceptions.hh \
- uninstall_list.hh uninstall_list-se.hh \
- uninstall_task.hh
-
-libpaludislegacy_@PALUDIS_PC_SLOT@_la_SOURCES = \
- dep_list.cc \
- dep_list_exceptions.cc \
- dep_list_options.cc \
- find_unused_packages_task.cc \
- handled_information.cc \
- install_task.cc \
- override_functions.cc \
- query_visitor.cc \
- range_rewriter.cc \
- report_task.cc \
- show_suggest_visitor.cc \
- sync_task.cc \
- tasks_exceptions.cc \
- uninstall_list.cc \
- uninstall_task.cc
-
-libpaludislegacy_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
-
-libpaludislegacy_@PALUDIS_PC_SLOT@_la_LIBADD = \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la
-
-lib_LTLIBRARIES = libpaludislegacy_@PALUDIS_PC_SLOT@.la
-
-TESTS = \
- dep_list_TEST \
- dep_list_TEST_blockers \
- range_rewriter_TEST \
- uninstall_list_TEST
-
-check_PROGRAMS = $(TESTS)
-
-dep_list_TEST_SOURCES = dep_list_TEST.cc dep_list_TEST.hh
-
-dep_list_TEST_LDADD = \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/test/libtest.a \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(DYNAMIC_LD_LIBS)
-
-dep_list_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
-dep_list_TEST_blockers_SOURCES = dep_list_TEST_blockers.cc dep_list_TEST.hh
-
-dep_list_TEST_blockers_LDADD = \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/test/libtest.a \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(DYNAMIC_LD_LIBS)
-
-dep_list_TEST_blockers_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
-range_rewriter_TEST_SOURCES = range_rewriter_TEST.cc
-
-range_rewriter_TEST_LDADD = \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/test/libtest.a \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(DYNAMIC_LD_LIBS)
-
-range_rewriter_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
-uninstall_list_TEST_SOURCES = uninstall_list_TEST.cc
-
-uninstall_list_TEST_LDADD = \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/test/libtest.a \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(DYNAMIC_LD_LIBS)
-
-uninstall_list_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
-test_ldadd = \
- $(top_builddir)/paludis/util/test_extras.o \
- libpaludislegacy_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/test/libtest.a \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la
-
-dep_list_options-se.hh : dep_list_options.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/dep_list_options.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
-dep_list_options-se.cc : dep_list_options.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/dep_list_options.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
-uninstall_list-se.hh : uninstall_list.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/uninstall_list.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
-uninstall_list-se.cc : uninstall_list.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/uninstall_list.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
-install_task-se.hh : install_task.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/install_task.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
-install_task-se.cc : install_task.se $(top_srcdir)/misc/make_se.bash
- if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/install_task.se > $@ ; then rm -f $@ ; exit 1 ; fi
-
diff --git a/paludis/legacy/dep_list-fwd.hh b/paludis/legacy/dep_list-fwd.hh
deleted file mode 100644
index 727a0e6..0000000
--- a/paludis/legacy/dep_list-fwd.hh
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2010 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_DEP_LIST_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_LIST_FWD_HH 1
-
-#include <paludis/repository-fwd.hh>
-#include <paludis/spec_tree.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/environment-fwd.hh>
-
-/** \file
- * Forward declarations for paludis/dep_list.hh .
- *
- * \ingroup g_dep_list
- */
-
-namespace paludis
-{
- class DepListOptions;
- class DepListEntryDestination;
- class DepListEntry;
- class DepList;
-
- /**
- * Is an item a valid child in an AnyDepSpec?
- *
- * \ingroup g_dep_list
- */
- bool is_viable_any_child(
- const Environment * const,
- const std::shared_ptr<const PackageID> &,
- const DependencySpecTree::BasicNode & i);
-}
-
-#endif
diff --git a/paludis/legacy/dep_list.cc b/paludis/legacy/dep_list.cc
deleted file mode 100644
index b112af4..0000000
--- a/paludis/legacy/dep_list.cc
+++ /dev/null
@@ -1,1769 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/dep_list.hh>
-#include <paludis/legacy/dep_list_exceptions.hh>
-#include <paludis/legacy/query_visitor.hh>
-#include <paludis/legacy/show_suggest_visitor.hh>
-#include <paludis/legacy/range_rewriter.hh>
-#include <paludis/legacy/handled_information.hh>
-
-#include <paludis/dep_spec.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/action.hh>
-#include <paludis/dep_spec_flattener.hh>
-#include <paludis/distribution.hh>
-#include <paludis/match_package.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/package_id.hh>
-#include <paludis/version_requirements.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/choice.hh>
-#include <paludis/package_dep_spec_properties.hh>
-#include <paludis/notifier_callback.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-
-#include <paludis/util/join.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/member_iterator.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/hashes.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/timestamp.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-
-#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/set-impl.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-
-#include <algorithm>
-#include <functional>
-#include <vector>
-#include <list>
-#include <set>
-#include <unordered_map>
-
-using namespace paludis;
-
-typedef std::list<std::shared_ptr<DependenciesLabelSequence> > LabelsStack;
-
-DepListOptions::DepListOptions() :
- blocks(dl_blocks_accumulate),
- circular(dl_circular_error),
- dependency_tags(false),
- downgrade(dl_downgrade_as_needed),
- fall_back(dl_fall_back_as_needed_except_targets),
- installed_deps_post(dl_deps_try_post),
- installed_deps_pre(dl_deps_discard),
- installed_deps_runtime(dl_deps_try_post),
- match_package_options({ }),
- new_slots(dl_new_slots_always),
- override_masks(make_null_shared_ptr()),
- reinstall(dl_reinstall_never),
- reinstall_scm(dl_reinstall_scm_never),
- suggested(dl_suggested_show),
- target_type(dl_target_package),
- uninstalled_deps_post(dl_deps_post),
- uninstalled_deps_pre(dl_deps_pre),
- uninstalled_deps_runtime(dl_deps_pre_or_post),
- uninstalled_deps_suggested(dl_deps_try_post),
- upgrade(dl_upgrade_always),
- use(dl_use_deps_standard)
-{
- /* when changing the above, also see src/paludis/command_line.cc. */
-}
-
-namespace paludis
-{
- typedef std::list<DepListEntry> MergeList;
- typedef std::unordered_multimap<QualifiedPackageName, MergeList::iterator, Hash<QualifiedPackageName> > MergeListIndex;
-
- template<>
- struct Imp<DepList>
- {
- const Environment * const env;
- std::shared_ptr<DepListOptions> opts;
-
- MergeList merge_list;
- MergeList::const_iterator current_merge_list_entry;
- MergeList::iterator merge_list_insert_position;
- long merge_list_generation;
-
- MergeListIndex merge_list_index;
-
- const SetSpecTree * current_top_level_target;
-
- bool throw_on_blocker;
-
- LabelsStack labels;
-
- const std::shared_ptr<const PackageID> current_package_id() const
- {
- if (current_merge_list_entry != merge_list.end())
- return current_merge_list_entry->package_id();
- return std::shared_ptr<const PackageID>();
- }
-
- Imp(const Environment * const e, const DepListOptions & o) :
- env(e),
- opts(std::make_shared<DepListOptions>(o)),
- current_merge_list_entry(merge_list.end()),
- merge_list_insert_position(merge_list.end()),
- merge_list_generation(0),
- current_top_level_target(0),
- throw_on_blocker(o.blocks() == dl_blocks_error)
- {
- labels.push_front(std::make_shared<DependenciesLabelSequence>());
- }
- };
-
- template <>
- struct WrappedForwardIteratorTraits<DepList::IteratorTag>
- {
- typedef MergeList::iterator UnderlyingIterator;
- };
-
- template <>
- struct WrappedForwardIteratorTraits<DepList::ConstIteratorTag>
- {
- typedef MergeList::const_iterator UnderlyingIterator;
-
- typedef DepList::Iterator EquivalentNonConstIterator;
- };
-}
-
-namespace
-{
- struct GenerationGreaterThan
- {
- long g;
-
- GenerationGreaterThan(long gg) :
- g(gg)
- {
- }
-
- template <typename T_>
- bool operator() (const T_ & e) const
- {
- return e.generation() > g;
- }
- };
-
- struct RemoveTagsWithGenerationGreaterThan
- {
- long g;
-
- RemoveTagsWithGenerationGreaterThan(long gg) :
- g(gg)
- {
- }
-
- void operator() (DepListEntry & e) const
- {
- /* see EffSTL 9 for why this is so painful */
- if (e.tags()->empty())
- return;
- std::shared_ptr<DepListEntryTags> t(std::make_shared<DepListEntryTags>());
- GenerationGreaterThan pred(g);
- for (DepListEntryTags::ConstIterator i(e.tags()->begin()), i_end(e.tags()->end()) ;
- i != i_end ; ++i)
- if (! pred(*i))
- t->insert(*i);
- std::swap(e.tags(), t);
- }
- };
-
- class DepListTransaction
- {
- protected:
- MergeList & _list;
- MergeListIndex & _index;
- long & _generation;
- int _initial_generation;
- bool _committed;
-
- public:
- DepListTransaction(MergeList & l, MergeListIndex & i, long & g) :
- _list(l),
- _index(i),
- _generation(g),
- _initial_generation(g),
- _committed(false)
- {
- ++_generation;
- }
-
- void commit()
- {
- _committed = true;
- }
-
- ~DepListTransaction()
- {
- if (_committed)
- return;
-
- /* See EffSTL 9 */
- GenerationGreaterThan pred(_initial_generation);
- for (MergeList::iterator i(_list.begin()) ; i != _list.end() ; )
- {
- if (! pred(*i))
- ++i;
- else
- {
- for (std::pair<MergeListIndex::iterator, MergeListIndex::iterator> p(
- _index.equal_range(i->package_id()->name())) ; p.first != p.second ; )
- if (p.first->second == i)
- _index.erase(p.first++);
- else
- ++p.first;
-
- _list.erase(i++);
- }
- }
-
- std::for_each(_list.begin(), _list.end(),
- RemoveTagsWithGenerationGreaterThan(_initial_generation));
- }
- };
-
- struct MatchDepListEntryAgainstPackageDepSpec
- {
- const Environment * const env;
- const PackageDepSpec & a;
- const std::shared_ptr<const PackageID> from_id;
- const MatchPackageOptions & o;
-
- MatchDepListEntryAgainstPackageDepSpec(const Environment * const ee,
- const PackageDepSpec & aa, const std::shared_ptr<const PackageID> & f, const MatchPackageOptions & oo) :
- env(ee),
- a(aa),
- from_id(f),
- o(oo)
- {
- }
-
- bool operator() (const std::pair<const QualifiedPackageName, MergeList::const_iterator> & e)
- {
- switch (e.second->kind())
- {
- case dlk_virtual:
- case dlk_package:
- case dlk_provided:
- case dlk_already_installed:
- case dlk_subpackage:
- return match_package(*env, a, e.second->package_id(), from_id, o);
-
- case dlk_block:
- case dlk_masked:
- case dlk_suggested:
- return false;
-
- case last_dlk:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad e.second->kind");
- }
- };
-
- bool is_interesting_any_child(const Environment & env, const DependencySpecTree::BasicNode & i)
- {
- const DependencySpecTree::NodeType<PackageDepSpec>::Type * const u(simple_visitor_cast<
- const DependencySpecTree::NodeType<PackageDepSpec>::Type>(i));
- if (u && u->spec()->package_ptr())
- {
- return ! env[selection::SomeArbitraryVersion(
- generator::Package(*u->spec()->package_ptr()) |
- filter::InstalledAtRoot(env.preferred_root_key()->value()))]->empty();
- }
- else
- return false;
- }
-}
-
-struct DepList::AddVisitor
-{
- DepList * const d;
- std::shared_ptr<const DestinationsSet> destinations;
- std::set<SetName> recursing_sets;
- const bool only_if_not_suggested_label;
-
- AddVisitor(DepList * const dd, bool l, std::shared_ptr<const DestinationsSet> ddd) :
- d(dd),
- destinations(ddd),
- only_if_not_suggested_label(l)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
-};
-
-namespace
-{
- struct SuggestActiveVisitor
- {
- bool visit(const DependenciesBuildLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesTestLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesRunLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesPostLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesCompileAgainstLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesFetchLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesInstallLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesRecommendationLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesSuggestionLabel &) const
- {
- return true;
- }
- };
-
- bool is_suggest_label(const std::shared_ptr<const DependenciesLabel> & l)
- {
- return l->accept_returning<bool>(SuggestActiveVisitor());
- }
-
- bool slot_is_same(
- const PackageID & a,
- const PackageID & b)
- {
- if (a.slot_key())
- return b.slot_key() && a.slot_key()->value() == b.slot_key()->value();
- else
- return ! b.slot_key();
- }
-
- std::string slot_as_human_string(const std::shared_ptr<const PackageID> & id)
- {
- if (! id->slot_key())
- return "(no slot)";
- else
- return stringify(id->slot_key()->value());
- }
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- Context context("When adding PackageDepSpec '" + stringify(*node.spec()) + "':");
-
- if (only_if_not_suggested_label)
- {
- if ((*d->_imp->labels.begin())->end() != std::find_if(((*d->_imp->labels.begin())->begin()),
- ((*d->_imp->labels.begin())->end()),
- is_suggest_label))
- {
- Log::get_instance()->message("dep_list.skipping_suggested", ll_debug, lc_context) << "Skipping dep '"
- << *node.spec() << "' because suggested label is active";
- return;
- }
- }
-
- /* find already installed things */
- // TODO: check destinations
- std::shared_ptr<const PackageIDSequence> already_installed((*d->_imp->env)[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), d->_imp->current_package_id(), d->_imp->opts->match_package_options()) |
- filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))]);
-
- /* are we already on the merge list? */
- std::pair<MergeListIndex::iterator, MergeListIndex::iterator> q;
- if (node.spec()->package_ptr())
- q = d->_imp->merge_list_index.equal_range(*node.spec()->package_ptr());
- else
- q = std::make_pair(d->_imp->merge_list_index.begin(), d->_imp->merge_list_index.end());
-
- MergeListIndex::iterator qq(std::find_if(q.first, q.second,
- MatchDepListEntryAgainstPackageDepSpec(d->_imp->env, *node.spec(),
- d->_imp->current_package_id(), d->_imp->opts->match_package_options())));
-
- MergeList::iterator existing_merge_list_entry(qq == q.second ? d->_imp->merge_list.end() : qq->second);
- if (existing_merge_list_entry != d->_imp->merge_list.end())
- {
- /* tag it */
- if (node.spec()->tag())
- existing_merge_list_entry->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = d->_imp->merge_list_generation,
- n::tag() = node.spec()->tag()
- ));
-
- if (d->_imp->opts->dependency_tags() && d->_imp->current_package_id())
- existing_merge_list_entry->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = d->_imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(d->_imp->current_package_id(), *node.spec()))
- ));
-
- /* add an appropriate destination */
- // TODO
-
- /* have our deps been merged already, or is this a circular dep? */
- if (dle_no_deps == existing_merge_list_entry->state())
- {
- /* is a sufficiently good version installed? */
- if (! already_installed->empty())
- return;
-
- if (d->_imp->opts->circular() == dl_circular_discard)
- {
- Log::get_instance()->message("dep_list.dropping_circular", ll_qa, lc_context)
- << "Dropping circular dependency on '" << *existing_merge_list_entry->package_id() << "'";
- return;
- }
- else if (d->_imp->opts->circular() == dl_circular_discard_silently)
- return;
-
- throw CircularDependencyError("Atom '" + stringify(*node.spec()) + "' matched by merge list entry '" +
- stringify(*existing_merge_list_entry->package_id()) + "', which does not yet have its "
- "dependencies installed");
- }
- else
- return;
- }
-
- /* find installable candidates, and find the best visible candidate */
- std::shared_ptr<const PackageID> best_visible_candidate;
- std::shared_ptr<const PackageIDSequence> installable_candidates(
- (*d->_imp->env)[selection::AllVersionsSorted(generator::Matches(*node.spec(),
- d->_imp->current_package_id(), d->_imp->opts->match_package_options()) &
- generator::SomeIDsMightSupportAction<InstallAction>())]);
-
- for (PackageIDSequence::ReverseConstIterator p(installable_candidates->rbegin()),
- p_end(installable_candidates->rend()) ; p != p_end ; ++p)
- if ((*p)->supports_action(SupportsActionTest<InstallAction>()) && ! (*p)->masked())
- {
- best_visible_candidate = *p;
- break;
- }
-
- if (! best_visible_candidate && ! already_installed->empty() &&
- (*already_installed->last())->behaviours_key() &&
- (*already_installed->last())->behaviours_key()->value()->end() != (*already_installed->last())->behaviours_key()->value()->find("transient") &&
- (dl_target_package != d->_imp->opts->target_type() || ! d->is_top_level_target(*already_installed->last())))
- {
- Log::get_instance()->message("dep_list.no_visible.transient", ll_debug, lc_context) << "No visible packages matching '"
- << *node.spec() << "', silently falling back to installed package '" << **already_installed->last() << "' as it is transient";
- d->add_already_installed_package(*already_installed->last(), node.spec()->tag(), *node.spec(), destinations);
- return;
- }
-
- /* are we allowed to override mask reasons? */
- if (! best_visible_candidate && d->_imp->opts->override_masks())
- {
- for (DepListOverrideMasksFunctions::ConstIterator of(d->_imp->opts->override_masks()->begin()),
- of_end(d->_imp->opts->override_masks()->end()) ; of != of_end ; ++of)
- {
- if (best_visible_candidate)
- break;
-
- for (PackageIDSequence::ReverseConstIterator p(installable_candidates->rbegin()),
- p_end(installable_candidates->rend()) ; p != p_end ; ++p)
- {
- if (! (*p)->supports_action(SupportsActionTest<InstallAction>()))
- continue;
-
- bool success(true);
- for (PackageID::MasksConstIterator m((*p)->begin_masks()), m_end((*p)->end_masks()) ;
- m != m_end ; ++m)
- {
- bool local_success(false);
- for (DepListOverrideMasksFunctions::ConstIterator o(d->_imp->opts->override_masks()->begin()),
- o_end(next(of)) ; o != o_end ; ++o)
- if ((*o)(*p, **m))
- local_success = true;
-
- success &= local_success;
- if (! success)
- break;
- }
-
- if (success)
- {
- d->add_error_package(*p, dlk_masked, *node.spec());
- best_visible_candidate = *p;
- }
- }
- }
- }
-
- /* no installable candidates. if we're already installed, that's ok (except for top level
- * package targets), otherwise error. */
- if (! best_visible_candidate)
- {
- bool can_fall_back;
- do
- {
- switch (d->_imp->opts->fall_back())
- {
- case dl_fall_back_never:
- can_fall_back = false;
- continue;
-
- case dl_fall_back_as_needed_except_targets:
- if (! d->_imp->current_package_id())
- can_fall_back = false;
- else if (already_installed->empty())
- can_fall_back = true;
- else
- can_fall_back = ! d->is_top_level_target(*already_installed->last());
-
- continue;
-
- case dl_fall_back_as_needed:
- can_fall_back = true;
- continue;
-
- case last_dl_fall_back:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad fall_back value '" + stringify(d->_imp->opts->fall_back()) + "'");
- } while (false);
-
- if (already_installed->empty() || ! can_fall_back)
- {
- if (! node.spec()->additional_requirements_ptr())
- throw AllMaskedError(*node.spec(), d->_imp->current_package_id());
-
- std::shared_ptr<const PackageIDSequence> match_except_reqs((*d->_imp->env)[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), d->_imp->current_package_id(),
- d->_imp->opts->match_package_options() + mpo_ignore_additional_requirements))]);
-
- for (PackageIDSequence::ReverseConstIterator i(match_except_reqs->rbegin()),
- i_end(match_except_reqs->rend()) ; i != i_end ; ++i)
- if (! (*i)->masked())
- throw AdditionalRequirementsNotMetError(*node.spec(), d->_imp->current_package_id(), *i);
-
- throw AllMaskedError(*node.spec(), d->_imp->current_package_id());
- }
- else
- {
- Log::get_instance()->message("dep_list.no_visible", ll_warning, lc_context) << "No visible packages matching '"
- << *node.spec() << "', falling back to installed package '" << **already_installed->last() << "'";
- d->add_already_installed_package(*already_installed->last(), node.spec()->tag(), *node.spec(), destinations);
- return;
- }
- }
-
- std::shared_ptr<PackageIDSequence> already_installed_in_same_slot(std::make_shared<PackageIDSequence>());
- for (PackageIDSequence::ConstIterator aa(already_installed->begin()),
- aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
- if (slot_is_same(**aa, *best_visible_candidate))
- already_installed_in_same_slot->push_back(*aa);
- /* no need to sort already_installed_in_same_slot here, although if the above is
- * changed then check that this still holds... */
-
- /* we have an already installed version. do we want to use it? */
- if (! already_installed_in_same_slot->empty())
- {
- if (d->prefer_installed_over_uninstalled(*already_installed_in_same_slot->last(), best_visible_candidate))
- {
- Log::get_instance()->message("dep_list.installed_over_best_visible", ll_debug, lc_context)
- << "Taking installed package '" << **already_installed_in_same_slot->last() << "' over '"
- << *best_visible_candidate << "'";
- d->add_already_installed_package(*already_installed_in_same_slot->last(), node.spec()->tag(), *node.spec(), destinations);
- return;
- }
- else
- Log::get_instance()->message("dep_list.best_visible_over_installed", ll_debug, lc_context)
- << "Not taking installed package '" << **already_installed_in_same_slot->last() << "' over '"
- << *best_visible_candidate << "'";
- }
- else if ((! already_installed->empty()) && (dl_new_slots_as_needed == d->_imp->opts->new_slots()))
- {
- /* we have an already installed, but not in the same slot, and our options
- * allow us to take this. */
- if (d->prefer_installed_over_uninstalled(*already_installed->last(), best_visible_candidate))
- {
- Log::get_instance()->message("dep_list.installed_over_slot", ll_debug, lc_context) <<
- "Taking installed package '" << **already_installed->last() << "' over '" << *best_visible_candidate <<
- "' (in different slot)";
- d->add_already_installed_package(*already_installed->last(), node.spec()->tag(), *node.spec(), destinations);
- return;
- }
- else
- Log::get_instance()->message("dep_list.slot_over_installed", ll_debug, lc_context) <<
- "Not taking installed package '" << **already_installed->last() << "' over '" <<
- *best_visible_candidate << "' (in different slot)";
- }
- else
- Log::get_instance()->message("dep_list.no_installed", ll_debug, lc_context) << "No installed packages in SLOT "
- << slot_as_human_string(best_visible_candidate) << ", taking uninstalled package '"
- << *best_visible_candidate << "'";
-
- /* if this is a downgrade, make sure that that's ok */
- switch (d->_imp->opts->downgrade())
- {
- case dl_downgrade_as_needed:
- break;
-
- case dl_downgrade_error:
- case dl_downgrade_warning:
- {
- std::shared_ptr<const PackageIDSequence> are_we_downgrading(
- (*d->_imp->env)[selection::AllVersionsSorted(
- generator::Package(best_visible_candidate->name()) |
- filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()) |
- filter::SameSlot(best_visible_candidate))]);
-
- if (are_we_downgrading->empty())
- break;
-
- if ((*are_we_downgrading->last())->version() <= best_visible_candidate->version())
- break;
-
- if (d->_imp->opts->downgrade() == dl_downgrade_error)
- throw DowngradeNotAllowedError(stringify(*best_visible_candidate),
- stringify(**are_we_downgrading->last()));
-
- Log::get_instance()->message("dep_list.downgrade", ll_warning, lc_context) << "Downgrade to '"
- << *best_visible_candidate << "' from '" << **are_we_downgrading->last() << "' forced";
- }
- break;
-
- case last_dl_downgrade:
- ;
- }
-
- d->add_package(best_visible_candidate, node.spec()->tag(), *node.spec(), destinations);
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- Context context("When adding NamedSetDepSpec '" + stringify(*node.spec()) + "':");
-
- std::shared_ptr<const SetSpecTree> set(d->_imp->env->set(node.spec()->name()));
-
- if (! set)
- throw NoSuchSetError(stringify(node.spec()->name()));
-
- if (! recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("dep_list.recursive_set", ll_warning, lc_context) << "Recursively defined set '" << node.spec()->name() << "'";
- throw RecursivelyDefinedSetError(stringify(node.spec()->name()));
- }
-
- set->top()->accept(*this);
-
- recursing_sets.erase(node.spec()->name());
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- d->_imp->labels.push_front(*d->_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &d->_imp->labels));
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- if (d->_imp->opts->use() == dl_use_deps_standard)
- {
- d->_imp->labels.push_front(*d->_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &d->_imp->labels));
-
- if (node.spec()->condition_met(d->_imp->env, d->_imp->current_package_id()))
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
- else
- {
- if (node.spec()->condition_meetable(d->_imp->env, d->_imp->current_package_id()))
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- using namespace std::placeholders;
-
- d->_imp->labels.push_front(*d->_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &d->_imp->labels));
-
- /* annoying requirement: || ( foo? ( ... ) ) resolves to empty if !foo. */
- if (indirect_iterator(node.end()) == std::find_if(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- std::bind(&is_viable_any_child, d->_imp->env, d->_imp->current_package_id(), std::placeholders::_1)))
- return;
-
- {
- RangeRewriter r;
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(r));
- std::shared_ptr<PackageDepSpec> rewritten_spec(r.spec());
- if (rewritten_spec)
- {
- DependencySpecTree::NodeType<PackageDepSpec>::Type rr(r.spec());
- d->add_not_top_level(only_if_not_suggested_label, rr, destinations);
- return;
- }
- }
-
- /* see if any of our children is already installed. if any is, add it so that
- * any upgrades kick in */
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
- continue;
-
- if (d->already_installed(**c, destinations))
- {
- Context context("When using already installed group to resolve dependencies:");
- try
- {
- d->add_not_top_level(only_if_not_suggested_label, **c, destinations);
- return;
- }
- catch (const DepListError &)
- {
- }
- }
- }
-
- /* if we have something like || ( a >=b-2 ) and b-1 is installed, try to go for
- * the b-2 bit first */
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
- continue;
- if (! is_interesting_any_child(*d->_imp->env, **c))
- continue;
-
- try
- {
- Context context("When using already installed package to resolve dependencies:");
-
- Save<bool> save_t(&d->_imp->throw_on_blocker,
- dl_blocks_discard_completely != d->_imp->opts->blocks());
- Save<std::shared_ptr<DepListOverrideMasksFunctions> > save_o(&d->_imp->opts->override_masks(),
- std::shared_ptr<DepListOverrideMasksFunctions>());
- d->add_not_top_level(only_if_not_suggested_label, **c, destinations);
- return;
- }
- catch (const DepListError &)
- {
- }
- }
-
- /* install first available viable option */
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
- continue;
-
- try
- {
- Context context("When using new group to resolve dependencies:");
-
- Save<bool> save_t(&d->_imp->throw_on_blocker,
- dl_blocks_discard_completely != d->_imp->opts->blocks());
- Save<std::shared_ptr<DepListOverrideMasksFunctions> > save_o(&d->_imp->opts->override_masks(),
- std::shared_ptr<DepListOverrideMasksFunctions>());
- d->add_not_top_level(only_if_not_suggested_label, **c, destinations);
- return;
- }
- catch (const DepListError &)
- {
- }
- }
-
- Log::get_instance()->message("dep_list.using_first_any_item", ll_debug, lc_context)
- << "No resolvable item in || ( ) block. Using first item for error message";
- {
- Context block_context("Inside || ( ) block with other options:");
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- if (! is_viable_any_child(d->_imp->env, d->_imp->current_package_id(), **c))
- continue;
-
- d->add_not_top_level(only_if_not_suggested_label, **c, destinations);
- return;
- }
- }
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
-{
- if (dl_blocks_discard_completely == d->_imp->opts->blocks())
- return;
-
- // TODO: check destinations
-
- Context context("When checking BlockDepSpec '" + stringify(*node.spec()) + "':");
-
- bool check_whole_list(false);
- std::list<MergeList::const_iterator> will_be_installed;
- std::shared_ptr<const PackageIDSequence> already_installed;
-
- if (node.spec()->blocking().package_ptr())
- {
- PackageDepSpec just_package(make_package_dep_spec({ }).package(
- *node.spec()->blocking().package_ptr()));
- already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted(
- generator::Matches(just_package, make_null_shared_ptr(), d->_imp->opts->match_package_options()) |
- filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))];
-
- MatchDepListEntryAgainstPackageDepSpec m(d->_imp->env, just_package, make_null_shared_ptr(), d->_imp->opts->match_package_options());
- for (std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p(
- d->_imp->merge_list_index.equal_range(*node.spec()->blocking().package_ptr())) ;
- p.first != p.second ; ++p.first)
- {
- if (d->_imp->current_merge_list_entry != d->_imp->merge_list.end())
- {
- if (d->_imp->current_merge_list_entry == p.first->second)
- continue;
-
- if (d->_imp->current_merge_list_entry->associated_entry() == &*p.first->second)
- continue;
- }
-
- if (m(*p.first))
- will_be_installed.push_back(p.first->second);
- }
- }
- else
- {
- check_whole_list = true;
- /* TODO: InstalledAtRoot? */
- already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted(
- generator::All() |
- filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))];
- }
-
- if (already_installed->empty() && will_be_installed.empty() && ! check_whole_list)
- return;
-
- for (PackageIDSequence::ConstIterator aa(already_installed->begin()),
- aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
- {
- if (! match_package(*d->_imp->env, node.spec()->blocking(), *aa, d->_imp->current_package_id(), d->_imp->opts->match_package_options()))
- continue;
-
- bool replaced(false);
- for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
- r_end(will_be_installed.end()) ; r != r_end && ! replaced ; ++r)
- if (slot_is_same(*(*r)->package_id(), **aa))
- {
- /* if it's a virtual, it only replaces if it's the same package. */
- if ((*r)->package_id()->virtual_for_key())
- {
- if ((*r)->package_id()->virtual_for_key()->value()->name() == (*aa)->name())
- replaced = true;
- }
- else
- replaced = true;
- }
-
- if (replaced)
- continue;
-
- /* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
- * ourself */
- if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
- n::has_category_name_part() = indeterminate,
- n::has_from_repository() = false,
- n::has_in_repository() = false,
- n::has_installable_to_path() = false,
- n::has_installable_to_repository() = false,
- n::has_installed_at_path() = false,
- n::has_package() = indeterminate,
- n::has_package_name_part() = indeterminate,
- n::has_slot_requirement() = false,
- n::has_tag() = indeterminate,
- n::has_version_requirements() = false
- ))
- && d->_imp->current_package_id())
- {
- if ((*aa)->name() == d->_imp->current_package_id()->name())
- continue;
-
- if ((*aa)->virtual_for_key() && (*aa)->virtual_for_key()->value()->name() == d->_imp->current_package_id()->name())
- continue;
- }
-
- switch (d->_imp->throw_on_blocker ? dl_blocks_error : d->_imp->opts->blocks())
- {
- case dl_blocks_error:
- throw BlockError(stringify(node.spec()->blocking()));
-
- case dl_blocks_discard:
- Log::get_instance()->message("dep_list.discarding_block", ll_warning, lc_context) << "Discarding block '" << *node.spec() << "'";
- break;
-
- case dl_blocks_discard_completely:
- break;
-
- case dl_blocks_accumulate:
- d->add_error_package(*aa, dlk_block, node.spec()->blocking());
- break;
-
- case last_dl_blocks:
- break;
- }
- }
-
- for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
- r_end(will_be_installed.end()) ; r != r_end ; ++r)
- {
- if (! match_package(*d->_imp->env, node.spec()->blocking(), (*r)->package_id(),
- d->_imp->current_package_id(), d->_imp->opts->match_package_options()))
- continue;
-
- /* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
- * ourself */
- if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
- n::has_category_name_part() = indeterminate,
- n::has_from_repository() = false,
- n::has_in_repository() = false,
- n::has_installable_to_path() = false,
- n::has_installable_to_repository() = false,
- n::has_installed_at_path() = false,
- n::has_package() = indeterminate,
- n::has_package_name_part() = indeterminate,
- n::has_slot_requirement() = false,
- n::has_tag() = indeterminate,
- n::has_version_requirements() = false
- ))
- && d->_imp->current_package_id())
- {
- if ((*r)->package_id()->name() == d->_imp->current_package_id()->name())
- continue;
-
- if ((*r)->package_id()->virtual_for_key() && (*r)->package_id()->virtual_for_key()->value()->name() ==
- d->_imp->current_package_id()->name())
- continue;
- }
-
- throw BlockError(stringify(node.spec()->blocking()));
- }
-
- if (check_whole_list)
- {
- for (MergeList::const_iterator r(d->_imp->merge_list.begin()),
- r_end(d->_imp->merge_list.end()) ; r != r_end ; ++r)
- {
- if (! match_package(*d->_imp->env, node.spec()->blocking(), r->package_id(),
- d->_imp->current_package_id(), d->_imp->opts->match_package_options()))
- continue;
-
- /* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
- * ourself */
- if (package_dep_spec_has_properties(node.spec()->blocking(), make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
- n::has_category_name_part() = indeterminate,
- n::has_from_repository() = false,
- n::has_in_repository() = false,
- n::has_installable_to_path() = false,
- n::has_installable_to_repository() = false,
- n::has_installed_at_path() = false,
- n::has_package() = indeterminate,
- n::has_package_name_part() = indeterminate,
- n::has_slot_requirement() = false,
- n::has_tag() = indeterminate,
- n::has_version_requirements() = false
- ))
- && d->_imp->current_package_id())
- {
- if (r->package_id()->name() == d->_imp->current_package_id()->name())
- continue;
-
- if (r->package_id()->virtual_for_key() &&
- r->package_id()->virtual_for_key()->value()->name() == d->_imp->current_package_id()->name())
- continue;
- }
-
- throw BlockError(stringify(node.spec()->blocking()));
- }
- }
-}
-
-void
-DepList::AddVisitor::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
-{
- std::shared_ptr<DependenciesLabelSequence> labels(std::make_shared<DependenciesLabelSequence>());
- std::copy(node.spec()->begin(), node.spec()->end(), labels->back_inserter());
- *d->_imp->labels.begin() = labels;
-}
-
-DepList::DepList(const Environment * const e, const DepListOptions & o) :
- _imp(e, o)
-{
-}
-
-DepList::~DepList()
-{
-}
-
-std::shared_ptr<DepListOptions>
-DepList::options()
-{
- return _imp->opts;
-}
-
-const std::shared_ptr<const DepListOptions>
-DepList::options() const
-{
- return _imp->opts;
-}
-
-void
-DepList::clear()
-{
- DepListOptions o(*options());
- _imp.reset(new Imp<DepList>(_imp->env, o));
-}
-
-void
-DepList::add_in_role(const bool only_if_not_suggested_label, const DependencySpecTree::BasicNode & spec, const std::string & role,
- const std::shared_ptr<const DestinationsSet> & destinations)
-{
- Context context("When adding " + role + (only_if_not_suggested_label ? " unless under a suggested label" : "") + ":");
- add_not_top_level(only_if_not_suggested_label, spec, destinations);
-}
-
-void
-DepList::add_not_top_level(const bool only_if_not_suggested_label,
- const DependencySpecTree::BasicNode & spec, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- DepListTransaction transaction(_imp->merge_list, _imp->merge_list_index, _imp->merge_list_generation);
-
- AddVisitor visitor(this, only_if_not_suggested_label, destinations);
- spec.accept(visitor);
- transaction.commit();
-}
-
-void
-DepList::add(const SetSpecTree & spec, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- DepListTransaction transaction(_imp->merge_list, _imp->merge_list_index, _imp->merge_list_generation);
-
- Save<const SetSpecTree *> save_current_top_level_target(&_imp->current_top_level_target,
- _imp->current_top_level_target ? _imp->current_top_level_target : &spec);
-
- AddVisitor visitor(this, false, destinations);
- spec.top()->accept(visitor);
- transaction.commit();
-}
-
-void
-DepList::add(const PackageDepSpec & spec, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- SetSpecTree tree(std::make_shared<AllDepSpec>());
- tree.top()->append(std::make_shared<PackageDepSpec>(spec));
- add(tree, destinations);
-}
-
-void
-DepList::add_package(const std::shared_ptr<const PackageID> & p, const std::shared_ptr<const DepTag> & tag,
- const PackageDepSpec & pds, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- Context context("When adding package '" + stringify(*p) + "':");
- _imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
-
- Save<MergeList::iterator> save_merge_list_insert_position(&_imp->merge_list_insert_position);
-
- /* create our merge list entry. insert pre deps before ourself in the list. insert
- * post deps after ourself, and after any provides. */
-
- MergeList::iterator our_merge_entry_position(
- _imp->merge_list.insert(_imp->merge_list_insert_position,
- make_named_values<DepListEntry>(
- n::associated_entry() = static_cast<DepListEntry *>(0),
- n::destination() = p->virtual_for_key() ? std::shared_ptr<Repository>() : find_destination(p, destinations),
- n::generation() = _imp->merge_list_generation,
- n::handled() = p->virtual_for_key() ?
- std::shared_ptr<DepListEntryHandled>(std::make_shared<DepListEntryNoHandlingRequired>()) :
- std::shared_ptr<DepListEntryHandled>(std::make_shared<DepListEntryUnhandled>()),
- n::kind() = p->virtual_for_key() ? dlk_virtual : dlk_package,
- n::package_id() = p,
- n::state() = dle_no_deps,
- n::tags() = std::shared_ptr<DepListEntryTags>(std::make_shared<DepListEntryTags>())
- ))),
- our_merge_entry_post_position(our_merge_entry_position);
-
- _imp->merge_list_index.insert(std::make_pair(p->name(), our_merge_entry_position));
-
- if (tag)
- our_merge_entry_position->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = tag
- ));
-
- if (_imp->opts->dependency_tags() && _imp->current_package_id())
- our_merge_entry_position->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(_imp->current_package_id(), pds))
- ));
-
- Save<MergeList::const_iterator> save_current_merge_list_entry(&_imp->current_merge_list_entry,
- our_merge_entry_position);
-
- _imp->merge_list_insert_position = our_merge_entry_position;
-
- /* add provides */
- if (p->provide_key())
- {
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, p);
- p->provide_key()->value()->top()->accept(f);
-
- if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string(
- _imp->env->distribution())).support_old_style_virtuals())
- throw DistributionConfigurationError("Package '" + stringify(*p) + "' has PROVIDEs, but this distribution "
- "does not support old style virtuals");
-
- for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
- {
- std::shared_ptr<PackageDepSpec> pp(std::make_shared<PackageDepSpec>(make_package_dep_spec({ })
- .package(*(*i)->package_ptr())
- .version_requirement(make_named_values<VersionRequirement>(
- n::version_operator() = vo_equal,
- n::version_spec() = p->version()))
- ));
-
- std::pair<MergeListIndex::iterator, MergeListIndex::iterator> z;
- if (pp->package_ptr())
- z = _imp->merge_list_index.equal_range(*pp->package_ptr());
- else
- z = std::make_pair(_imp->merge_list_index.begin(), _imp->merge_list_index.end());
-
- MergeListIndex::iterator zz(std::find_if(z.first, z.second,
- MatchDepListEntryAgainstPackageDepSpec(_imp->env, *pp, p, _imp->opts->match_package_options())));
-
- if (zz != z.second)
- continue;
-
- our_merge_entry_post_position = _imp->merge_list.insert(next(our_merge_entry_post_position),
- DepListEntry(make_named_values<DepListEntry>(
- n::associated_entry() = &*_imp->current_merge_list_entry,
- n::destination() = std::shared_ptr<Repository>(),
- n::generation() = _imp->merge_list_generation,
- n::handled() = std::make_shared<DepListEntryNoHandlingRequired>(),
- n::kind() = dlk_provided,
- n::package_id() = (*_imp->env->package_database()->fetch_repository(
- RepositoryName("virtuals"))).make_virtuals_interface()->make_virtual_package_id(
- QualifiedPackageName((*i)->text()), p),
- n::state() = dle_has_all_deps,
- n::tags() = std::shared_ptr<DepListEntryTags>(std::make_shared<DepListEntryTags>())
- )));
- _imp->merge_list_index.insert(std::make_pair(QualifiedPackageName((*i)->text()), our_merge_entry_post_position));
- }
- }
-
- /* add suggests */
- if (_imp->opts->suggested() == dl_suggested_show && p->suggested_dependencies_key())
- {
- Context c("When showing suggestions:");
- Save<MergeList::iterator> suggest_save_merge_list_insert_position(&_imp->merge_list_insert_position,
- next(our_merge_entry_position));
- ShowSuggestVisitor visitor(this, destinations, _imp->env, _imp->current_package_id(), _imp->opts->dependency_tags(), false);
- p->suggested_dependencies_key()->value()->top()->accept(visitor);
- }
-
- /* add suggests in post depend too */
- if (_imp->opts->suggested() == dl_suggested_show && p->post_dependencies_key())
- {
- Context c("When showing suggestions in post dependencies key:");
- Save<MergeList::iterator> suggest_save_merge_list_insert_position(&_imp->merge_list_insert_position,
- next(our_merge_entry_position));
- ShowSuggestVisitor visitor(this, destinations, _imp->env, _imp->current_package_id(), _imp->opts->dependency_tags(), true);
- p->post_dependencies_key()->value()->top()->accept(visitor);
- }
-
- /* add pre dependencies */
- if (p->build_dependencies_key())
- add_predeps(*p->build_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_pre(), "build", destinations, false);
- if (p->run_dependencies_key())
- add_predeps(*p->run_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_runtime(), "run", destinations, false);
- if (p->post_dependencies_key())
- add_predeps(*p->post_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_post(), "post", destinations,
- (_imp->opts->suggested() == dl_suggested_install) ? false : true);
- if (_imp->opts->suggested() == dl_suggested_install && p->suggested_dependencies_key())
- add_predeps(*p->suggested_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_suggested(), "suggest", destinations, false);
-
- our_merge_entry_position->state() = dle_has_pre_deps;
- _imp->merge_list_insert_position = next(our_merge_entry_post_position);
-
- /* add post dependencies */
- if (p->build_dependencies_key())
- add_postdeps(*p->build_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_pre(), "build", destinations, false);
- if (p->run_dependencies_key())
- add_postdeps(*p->run_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_runtime(), "run", destinations, false);
- if (p->post_dependencies_key())
- add_postdeps(*p->post_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_post(), "post", destinations,
- (_imp->opts->suggested() == dl_suggested_install) ? false : true);
-
- if (_imp->opts->suggested() == dl_suggested_install && p->suggested_dependencies_key())
- add_postdeps(*p->suggested_dependencies_key()->value()->top(), _imp->opts->uninstalled_deps_suggested(), "suggest", destinations, false);
-
- our_merge_entry_position->state() = dle_has_all_deps;
-}
-
-void
-DepList::add_error_package(const std::shared_ptr<const PackageID> & p, const DepListEntryKind kind,
- const PackageDepSpec & pds)
-{
- std::pair<MergeListIndex::iterator, MergeListIndex::const_iterator> pp(
- _imp->merge_list_index.equal_range(p->name()));
-
- for ( ; pp.second != pp.first ; ++pp.first)
- {
- if (pp.first->second->kind() == kind && *pp.first->second->package_id() == *p)
- {
- if (_imp->current_package_id())
- pp.first->second->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(_imp->current_package_id(), pds))
- ));
- return;
- }
- }
-
- MergeList::iterator our_merge_entry_position(
- _imp->merge_list.insert(_imp->merge_list.begin(),
- make_named_values<DepListEntry>(
- n::associated_entry() = &*_imp->current_merge_list_entry,
- n::destination() = std::shared_ptr<Repository>(),
- n::generation() = _imp->merge_list_generation,
- n::handled() = std::make_shared<DepListEntryNoHandlingRequired>(),
- n::kind() = kind,
- n::package_id() = p,
- n::state() = dle_has_all_deps,
- n::tags() = std::shared_ptr<DepListEntryTags>(std::make_shared<DepListEntryTags>())
- )));
-
- if (_imp->current_package_id())
- our_merge_entry_position->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(_imp->current_package_id(), pds))
- ));
-
- _imp->merge_list_index.insert(std::make_pair(p->name(), our_merge_entry_position));
-}
-
-void
-DepList::add_suggested_package(const std::shared_ptr<const PackageID> & p,
- const PackageDepSpec & pds, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- std::pair<MergeListIndex::iterator, MergeListIndex::const_iterator> pp(
- _imp->merge_list_index.equal_range(p->name()));
-
- for ( ; pp.second != pp.first ; ++pp.first)
- {
- if ((pp.first->second->kind() == dlk_suggested || pp.first->second->kind() == dlk_already_installed
- || pp.first->second->kind() == dlk_package || pp.first->second->kind() == dlk_provided
- || pp.first->second->kind() == dlk_subpackage) && *pp.first->second->package_id() == *p)
- return;
- }
-
- MergeList::iterator our_merge_entry_position(
- _imp->merge_list.insert(_imp->merge_list_insert_position,
- make_named_values<DepListEntry>(
- n::associated_entry() = &*_imp->current_merge_list_entry,
- n::destination() = find_destination(p, destinations),
- n::generation() = _imp->merge_list_generation,
- n::handled() = std::make_shared<DepListEntryNoHandlingRequired>(),
- n::kind() = dlk_suggested,
- n::package_id() = p,
- n::state() = dle_has_all_deps,
- n::tags() = std::shared_ptr<DepListEntryTags>(std::make_shared<DepListEntryTags>())
- )));
-
- if (_imp->current_package_id())
- our_merge_entry_position->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(_imp->current_package_id(), pds))
- ));
-
- _imp->merge_list_index.insert(std::make_pair(p->name(), our_merge_entry_position));
-}
-
-void
-DepList::add_predeps(const DependencySpecTree::BasicNode & d, const DepListDepsOption opt, const std::string & s,
- const std::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label)
-{
- if (dl_deps_pre == opt || dl_deps_pre_or_post == opt)
- {
- try
- {
- add_in_role(only_if_not_suggested_label, d, s + " dependencies as pre dependencies", destinations);
- }
- catch (const DepListError & e)
- {
- if (dl_deps_pre == opt)
- throw;
- else
- Log::get_instance()->message("dep_list.dropping_dependencies", ll_warning, lc_context)
- << "Dropping " << s << " dependencies to post dependencies because of exception '"
- << e.message() << "' (" << e.what() << ")";
- }
- }
-}
-
-void
-DepList::add_postdeps(const DependencySpecTree::BasicNode & d, const DepListDepsOption opt, const std::string & s,
- const std::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label)
-{
- if (dl_deps_pre_or_post == opt || dl_deps_post == opt || dl_deps_try_post == opt)
- {
- try
- {
- try
- {
- add_in_role(only_if_not_suggested_label, d, s + " dependencies as post dependencies", destinations);
- }
- catch (const CircularDependencyError &)
- {
- Save<DepListCircularOption> save_circular(&_imp->opts->circular(),
- _imp->opts->circular() == dl_circular_discard_silently ?
- dl_circular_discard_silently : dl_circular_discard);
- Save<MergeList::iterator> save_merge_list_insert_position(&_imp->merge_list_insert_position,
- _imp->merge_list.end());
- add_in_role(only_if_not_suggested_label, d, s + " dependencies as post dependencies with cycle breaking", destinations);
- }
- }
- catch (const DepListError & e)
- {
- if (dl_deps_try_post != opt)
- throw;
- else
- Log::get_instance()->message("dep_list.ignoring_dependencies", ll_warning, lc_context)
- << "Ignoring " << s << " dependencies due to exception '" << e.message() << "' (" << e.what() << ")";
- }
- }
-}
-
-void
-DepList::add_already_installed_package(const std::shared_ptr<const PackageID> & p, const std::shared_ptr<const DepTag> & tag,
- const PackageDepSpec & pds, const std::shared_ptr<const DestinationsSet> & destinations)
-{
- Context context("When adding installed package '" + stringify(*p) + "':");
- _imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
-
- Save<MergeList::iterator> save_merge_list_insert_position(&_imp->merge_list_insert_position);
-
- MergeList::iterator our_merge_entry(_imp->merge_list.insert(_imp->merge_list_insert_position,
- make_named_values<DepListEntry>(
- n::associated_entry() = static_cast<DepListEntry *>(0),
- n::destination() = std::shared_ptr<Repository>(),
- n::generation() = _imp->merge_list_generation,
- n::handled() = std::make_shared<DepListEntryNoHandlingRequired>(),
- n::kind() = dlk_already_installed,
- n::package_id() = p,
- n::state() = dle_has_pre_deps,
- n::tags() = std::shared_ptr<DepListEntryTags>(std::make_shared<DepListEntryTags>())
- )));
- _imp->merge_list_index.insert(std::make_pair(p->name(), our_merge_entry));
-
- if (tag)
- our_merge_entry->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = tag
- ));
-
- if (_imp->opts->dependency_tags() && _imp->current_package_id())
- our_merge_entry->tags()->insert(make_named_values<DepTagEntry>(
- n::generation() = _imp->merge_list_generation,
- n::tag() = std::shared_ptr<DepTag>(std::make_shared<DependencyDepTag>(_imp->current_package_id(), pds))
- ));
-
- Save<MergeList::const_iterator> save_current_merge_list_entry(&_imp->current_merge_list_entry,
- our_merge_entry);
-
- if (p->build_dependencies_key())
- add_predeps(*p->build_dependencies_key()->value()->top(), _imp->opts->installed_deps_pre(), "build", destinations, false);
- if (p->run_dependencies_key())
- add_predeps(*p->run_dependencies_key()->value()->top(), _imp->opts->installed_deps_runtime(), "run", destinations, false);
- if (p->post_dependencies_key())
- add_predeps(*p->post_dependencies_key()->value()->top(), _imp->opts->installed_deps_post(), "post", destinations, true);
-
- our_merge_entry->state() = dle_has_pre_deps;
- _imp->merge_list_insert_position = next(our_merge_entry);
-
- if (p->build_dependencies_key())
- add_postdeps(*p->build_dependencies_key()->value()->top(), _imp->opts->installed_deps_pre(), "build", destinations, false);
- if (p->run_dependencies_key())
- add_postdeps(*p->run_dependencies_key()->value()->top(), _imp->opts->installed_deps_runtime(), "run", destinations, false);
- if (p->post_dependencies_key())
- add_postdeps(*p->post_dependencies_key()->value()->top(), _imp->opts->installed_deps_post(), "post", destinations, true);
-}
-
-namespace
-{
- bool is_scm(const QualifiedPackageName & n)
- {
- std::string pkg(stringify(n.package()));
- switch (pkg.length())
- {
- case 0:
- case 1:
- case 2:
- case 3:
- return false;
-
- default:
- if (0 == pkg.compare(pkg.length() - 6, 6, "-darcs"))
- return true;
-
- case 5:
- if (0 == pkg.compare(pkg.length() - 5, 5, "-live"))
- return true;
-
- case 4:
- if (0 == pkg.compare(pkg.length() - 4, 4, "-cvs"))
- return true;
- if (0 == pkg.compare(pkg.length() - 4, 4, "-svn"))
- return true;
- return false;
- }
- }
-}
-
-bool
-DepList::prefer_installed_over_uninstalled(
- const std::shared_ptr<const PackageID> & installed,
- const std::shared_ptr<const PackageID> & uninstalled)
-{
- do
- {
- switch (_imp->opts->target_type())
- {
- case dl_target_package:
- if (! _imp->current_package_id())
- return false;
-
- if (is_top_level_target(uninstalled))
- return false;
-
- continue;
-
- case dl_target_set:
- continue;
-
- case last_dl_target:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad target_type value '" + stringify(_imp->opts->target_type()) + "'");
- } while (false);
-
- if (dl_reinstall_always == _imp->opts->reinstall())
- return false;
-
- if (dl_upgrade_as_needed == _imp->opts->upgrade())
- return true;
-
- if (dl_reinstall_scm_never != _imp->opts->reinstall_scm())
- if (uninstalled->version() == installed->version() &&
- (installed->version().is_scm() || is_scm(installed->name())))
- {
- static Timestamp current_time(Timestamp::now()); /* static to avoid weirdness */
- Timestamp installed_time(current_time);
- if (installed->installed_time_key())
- installed_time = installed->installed_time_key()->value();
-
- do
- {
- switch (_imp->opts->reinstall_scm())
- {
- case dl_reinstall_scm_always:
- return false;
-
- case dl_reinstall_scm_daily:
- if (current_time.seconds() - installed_time.seconds() > (24 * 60 * 60))
- return false;
- continue;
-
- case dl_reinstall_scm_weekly:
- if (current_time.seconds() - installed_time.seconds() > (24 * 60 * 60 * 7))
- return false;
- continue;
-
- case dl_reinstall_scm_never:
- ; /* nothing */
-
- case last_dl_reinstall_scm:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad value for opts->reinstall_scm");
- } while (false);
- }
-
- /* use != rather than > to correctly force a downgrade when packages are
- * removed. */
- if (uninstalled->version() != installed->version())
- return false;
-
- if (dl_reinstall_if_use_changed == _imp->opts->reinstall())
- {
- std::set<ChoiceNameWithPrefix> common;
- if (installed->choices_key() && uninstalled->choices_key())
- {
- std::set<ChoiceNameWithPrefix> i_common, u_common;
- for (Choices::ConstIterator k(installed->choices_key()->value()->begin()),
- k_end(installed->choices_key()->value()->end()) ;
- k != k_end ; ++k)
- {
- if (! (*k)->consider_added_or_changed())
- continue;
-
- for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
- i != i_end ; ++i)
- if ((*i)->explicitly_listed())
- i_common.insert((*i)->name_with_prefix());
- }
-
- for (Choices::ConstIterator k(uninstalled->choices_key()->value()->begin()),
- k_end(uninstalled->choices_key()->value()->end()) ;
- k != k_end ; ++k)
- {
- if (! (*k)->consider_added_or_changed())
- continue;
-
- for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
- i != i_end ; ++i)
- if ((*i)->explicitly_listed())
- u_common.insert((*i)->name_with_prefix());
- }
-
- std::set_intersection(
- i_common.begin(), i_common.end(),
- u_common.begin(), u_common.end(),
- std::inserter(common, common.begin()));
- }
-
- for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ;
- f != f_end ; ++f)
- if (installed->choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
- uninstalled->choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
- return false;
- }
-
- return true;
-}
-
-bool
-DepList::already_installed(const DependencySpecTree::BasicNode & spec,
- const std::shared_ptr<const DestinationsSet> & destinations) const
-{
- QueryVisitor visitor(this, destinations, _imp->env, _imp->current_package_id());
- spec.accept(visitor);
- return visitor.result();
-}
-
-DepList::Iterator
-DepList::begin()
-{
- return Iterator(_imp->merge_list.begin());
-}
-
-DepList::Iterator
-DepList::end()
-{
- return Iterator(_imp->merge_list.end());
-}
-
-DepList::ConstIterator
-DepList::begin() const
-{
- return ConstIterator(_imp->merge_list.begin());
-}
-
-DepList::ConstIterator
-DepList::end() const
-{
- return ConstIterator(_imp->merge_list.end());
-}
-
-bool
-DepList::is_top_level_target(const std::shared_ptr<const PackageID> & e) const
-{
- if (! _imp->current_top_level_target)
- throw InternalError(PALUDIS_HERE, "current_top_level_target not set?");
-
- return match_package_in_set(*_imp->env, *_imp->current_top_level_target, e, _imp->opts->match_package_options());
-}
-
-namespace
-{
- struct IsError
- {
- bool operator() (const DepListEntry & e) const
- {
- switch (e.kind())
- {
- case dlk_virtual:
- case dlk_package:
- case dlk_provided:
- case dlk_already_installed:
- case dlk_subpackage:
- case dlk_suggested:
- return false;
-
- case dlk_block:
- case dlk_masked:
- return true;
-
- case last_dlk:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad e.kind");
- }
- };
-}
-
-bool
-DepList::has_errors() const
-{
- return end() != std::find_if(begin(), end(), IsError());
-}
-
-std::shared_ptr<Repository>
-DepList::find_destination(const std::shared_ptr<const PackageID> & p,
- const std::shared_ptr<const DestinationsSet> & dd)
-{
- for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ;
- d != d_end ; ++d)
- if ((**d).destination_interface())
- if ((**d).destination_interface()->is_suitable_destination_for(p))
- return *d;
-
- throw NoDestinationError(p, dd);
-}
-
-bool
-DepList::replaced(const PackageID & m) const
-{
- std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p(
- _imp->merge_list_index.equal_range(m.name()));
-
- PackageDepSpec spec(make_package_dep_spec({ }).package(m.name()));
- while (p.second != ((p.first = std::find_if(p.first, p.second,
- MatchDepListEntryAgainstPackageDepSpec(_imp->env, spec, make_null_shared_ptr(), _imp->opts->match_package_options())))))
- {
- if (! slot_is_same(*p.first->second->package_id(), m))
- p.first = next(p.first);
- else
- return true;
- }
-
- return false;
-}
-
-bool
-DepList::match_on_list(const PackageDepSpec & a, const std::shared_ptr<const PackageID> & from_id) const
-{
- std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p;
- if (a.package_ptr())
- p = _imp->merge_list_index.equal_range(*a.package_ptr());
- else
- p = std::make_pair(_imp->merge_list_index.begin(), _imp->merge_list_index.end());
-
- return p.second != std::find_if(p.first, p.second,
- MatchDepListEntryAgainstPackageDepSpec(_imp->env, a, from_id, _imp->opts->match_package_options()));
-}
-
-DepList::Iterator
-DepList::push_back(const DepListEntry & e)
-{
- MergeList::iterator our_merge_entry_position(_imp->merge_list.insert(_imp->merge_list.end(), e));
- _imp->merge_list_index.insert(std::make_pair(e.package_id()->name(), our_merge_entry_position));
- return Iterator(our_merge_entry_position);
-}
-
-bool
-paludis::is_viable_any_child(const Environment * const env,
- const std::shared_ptr<const PackageID> & id, const DependencySpecTree::BasicNode & i)
-{
- const DependencySpecTree::NodeType<ConditionalDepSpec>::Type * const u(simple_visitor_cast<
- const DependencySpecTree::NodeType<ConditionalDepSpec>::Type>(i));
- if (0 != u)
- return u->spec()->condition_met(env, id);
- else
- return true;
-}
-
-template class Sequence<std::function<bool (const std::shared_ptr<const PackageID> &, const Mask &)> >;
-template class WrappedForwardIterator<DepList::IteratorTag, DepListEntry>;
-template class WrappedForwardIterator<DepList::ConstIteratorTag, const DepListEntry>;
-
-template WrappedForwardIterator<DepList::ConstIteratorTag, const DepListEntry>::WrappedForwardIterator(const DepList::Iterator &);
-
-template class Pimp<DepList>;
-
diff --git a/paludis/legacy/dep_list.hh b/paludis/legacy/dep_list.hh
deleted file mode 100644
index 06429dc..0000000
--- a/paludis/legacy/dep_list.hh
+++ /dev/null
@@ -1,320 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_DEP_LIST_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_LIST_HH 1
-
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/mask-fwd.hh>
-#include <paludis/dep_tag.hh>
-#include <paludis/legacy/dep_list_options.hh>
-#include <paludis/legacy/dep_list-fwd.hh>
-#include <paludis/legacy/handled_information-fwd.hh>
-#include <paludis/name.hh>
-#include <paludis/environment.hh>
-#include <paludis/match_package.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/util/options.hh>
-#include <paludis/version_spec.hh>
-#include <functional>
-#include <iosfwd>
-
-/** \file
- * Declarations for DepList and related classes.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time. Use InstallTask if you need to install things.
- */
-
-namespace paludis
-{
- namespace n
- {
- typedef Name<struct name_associated_entry> associated_entry;
- typedef Name<struct name_blocks> blocks;
- typedef Name<struct name_circular> circular;
- typedef Name<struct name_dependency_tags> dependency_tags;
- typedef Name<struct name_destination> destination;
- typedef Name<struct name_downgrade> downgrade;
- typedef Name<struct name_fall_back> fall_back;
- typedef Name<struct name_generation> generation;
- typedef Name<struct name_handled> handled;
- typedef Name<struct name_installed_deps_post> installed_deps_post;
- typedef Name<struct name_installed_deps_pre> installed_deps_pre;
- typedef Name<struct name_installed_deps_runtime> installed_deps_runtime;
- typedef Name<struct name_kind> kind;
- typedef Name<struct name_match_package_options> match_package_options;
- typedef Name<struct name_new_slots> new_slots;
- typedef Name<struct name_override_masks> override_masks;
- typedef Name<struct name_package_id> package_id;
- typedef Name<struct name_reinstall> reinstall;
- typedef Name<struct name_reinstall_scm> reinstall_scm;
- typedef Name<struct name_state> state;
- typedef Name<struct name_suggested> suggested;
- typedef Name<struct name_tags> tags;
- typedef Name<struct name_target_type> target_type;
- typedef Name<struct name_uninstalled_deps_post> uninstalled_deps_post;
- typedef Name<struct name_uninstalled_deps_pre> uninstalled_deps_pre;
- typedef Name<struct name_uninstalled_deps_runtime> uninstalled_deps_runtime;
- typedef Name<struct name_uninstalled_deps_suggested> uninstalled_deps_suggested;
- typedef Name<struct name_upgrade> upgrade;
- typedef Name<struct name_use> use;
- }
-
- /**
- * A sequence of functions to try, in order, when overriding masks.
- *
- * \ingroup g_dep_list
- */
- typedef Sequence<std::function<bool (const std::shared_ptr<const PackageID> &, const Mask &)> > DepListOverrideMasksFunctions;
-
- /**
- * An entry in a DepList.
- *
- * \see DepList
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- struct DepListEntry
- {
- NamedValue<n::associated_entry, const DepListEntry *> associated_entry;
- NamedValue<n::destination, std::shared_ptr<Repository> > destination;
- NamedValue<n::generation, long> generation;
- NamedValue<n::handled, std::shared_ptr<const DepListEntryHandled> > handled;
- NamedValue<n::kind, DepListEntryKind> kind;
- NamedValue<n::package_id, std::shared_ptr<const PackageID> > package_id;
- NamedValue<n::state, DepListEntryState> state;
- NamedValue<n::tags, std::shared_ptr<DepListEntryTags> > tags;
- };
-
- /**
- * Parameters for a DepList.
- *
- * \see DepList
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- struct PALUDIS_VISIBLE DepListOptions
- {
- DepListOptions();
-
- NamedValue<n::blocks, DepListBlocksOption> blocks;
- NamedValue<n::circular, DepListCircularOption> circular;
- NamedValue<n::dependency_tags, bool> dependency_tags;
- NamedValue<n::downgrade, DepListDowngradeOption> downgrade;
- NamedValue<n::fall_back, DepListFallBackOption> fall_back;
- NamedValue<n::installed_deps_post, DepListDepsOption> installed_deps_post;
- NamedValue<n::installed_deps_pre, DepListDepsOption> installed_deps_pre;
- NamedValue<n::installed_deps_runtime, DepListDepsOption> installed_deps_runtime;
- NamedValue<n::match_package_options, MatchPackageOptions> match_package_options;
- NamedValue<n::new_slots, DepListNewSlotsOption> new_slots;
- NamedValue<n::override_masks, std::shared_ptr<DepListOverrideMasksFunctions> > override_masks;
- NamedValue<n::reinstall, DepListReinstallOption> reinstall;
- NamedValue<n::reinstall_scm, DepListReinstallScmOption> reinstall_scm;
- NamedValue<n::suggested, DepListSuggestedOption> suggested;
- NamedValue<n::target_type, DepListTargetType> target_type;
- NamedValue<n::uninstalled_deps_post, DepListDepsOption> uninstalled_deps_post;
- NamedValue<n::uninstalled_deps_pre, DepListDepsOption> uninstalled_deps_pre;
- NamedValue<n::uninstalled_deps_runtime, DepListDepsOption> uninstalled_deps_runtime;
- NamedValue<n::uninstalled_deps_suggested, DepListDepsOption> uninstalled_deps_suggested;
- NamedValue<n::upgrade, DepListUpgradeOption> upgrade;
- NamedValue<n::use, DepListUseOption> use;
- };
-
- /**
- * Holds a list of dependencies in merge order.
- *
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepList
- {
- private:
- Pimp<DepList> _imp;
-
- protected:
- class AddVisitor;
- friend class AddVisitor;
-
- /**
- * Find an appropriate destination for a package.
- */
- std::shared_ptr<Repository> find_destination(const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<const DestinationsSet> &);
-
- /**
- * Add a DepSpec with role context.
- */
- void add_in_role(const bool only_if_not_suggested_label, const DependencySpecTree::BasicNode &, const std::string & role,
- const std::shared_ptr<const DestinationsSet> &);
-
- /**
- * Return whether we prefer the first parameter, which is installed,
- * over the second, which isn't.
- */
- bool prefer_installed_over_uninstalled(
- const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<const PackageID> &);
-
- /**
- * Add a package to the list.
- */
- void add_package(const std::shared_ptr<const PackageID> &, const std::shared_ptr<const DepTag> &,
- const PackageDepSpec &, const std::shared_ptr<const DestinationsSet> & destinations);
-
- /**
- * Add an already installed package to the list.
- */
- void add_already_installed_package(const std::shared_ptr<const PackageID> &, const std::shared_ptr<const DepTag> &,
- const PackageDepSpec &, const std::shared_ptr<const DestinationsSet> & destinations);
-
- /**
- * Add an error package to the list.
- */
- void add_error_package(const std::shared_ptr<const PackageID> &, const DepListEntryKind, const PackageDepSpec &);
-
- /**
- * Add predependencies.
- */
- void add_predeps(const DependencySpecTree::BasicNode &, const DepListDepsOption, const std::string &,
- const std::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label);
-
- /**
- * Add postdependencies.
- */
- void add_postdeps(const DependencySpecTree::BasicNode &, const DepListDepsOption, const std::string &,
- const std::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label);
-
- /**
- * Return whether the specified PackageID is matched by
- * the top level target.
- */
- bool is_top_level_target(const std::shared_ptr<const PackageID> &) const;
-
- void add_not_top_level(
- const bool only_if_not_suggested_label,
- const DependencySpecTree::BasicNode &,
- const std::shared_ptr<const DestinationsSet> & target_destinations);
-
- public:
- ///\name Basic operations
- ///\{
-
- DepList(const Environment * const, const DepListOptions &);
-
- virtual ~DepList();
-
- DepList(const DepList &) = delete;
- DepList & operator= (const DepList &) = delete;
-
- ///\}
-
- ///\name Iterate over our dependency list entries.
- ///\{
-
- struct IteratorTag;
- typedef WrappedForwardIterator<IteratorTag, DepListEntry> Iterator;
-
- struct ConstIteratorTag;
- typedef WrappedForwardIterator<ConstIteratorTag, const DepListEntry> ConstIterator;
-
- Iterator begin();
- Iterator end();
-
- ConstIterator begin() const;
- ConstIterator end() const;
-
- ///\}
-
- /**
- * Our options.
- */
- std::shared_ptr<DepListOptions> options();
-
- /**
- * Our options.
- */
- const std::shared_ptr<const DepListOptions> options() const;
-
- /**
- * Add the packages required to resolve an additional dependency
- * spec.
- */
- void add(const SetSpecTree &,
- const std::shared_ptr<const DestinationsSet> & target_destinations);
-
- /**
- * Add the packages required to resolve an additional dependency
- * spec.
- */
- void add(const PackageDepSpec &,
- const std::shared_ptr<const DestinationsSet> & target_destinations);
-
- /**
- * Manually add a DepListEntry to the list.
- *
- * Does not work well with ordered resolution, and does not do much
- * sanity checking. This is used by InstallTask to implement resume
- * commands and the exec command.
- */
- Iterator push_back(const DepListEntry &);
-
- /**
- * Clear the list.
- */
- void clear();
-
- /**
- * Return whether a spec structure is already installed.
- */
- bool already_installed(const DependencySpecTree::BasicNode &,
- const std::shared_ptr<const DestinationsSet> & target_destinations) const;
-
- /**
- * Return whether a PackageID has been replaced.
- */
- bool replaced(const PackageID &) const;
-
- /**
- * Return whether a spec matches an item in the list.
- */
- bool match_on_list(const PackageDepSpec &, const std::shared_ptr<const PackageID> & from_id) const;
-
- /**
- * Whether we have any errors.
- */
- bool has_errors() const;
-
- /**
- * Add a suggested package to the list.
- */
- void add_suggested_package(const std::shared_ptr<const PackageID> &,
- const PackageDepSpec &, const std::shared_ptr<const DestinationsSet> & destinations);
- };
-
- extern template class Pimp<DepList>;
- extern template class WrappedForwardIterator<DepList::IteratorTag, DepListEntry>;
- extern template class WrappedForwardIterator<DepList::ConstIteratorTag, const DepListEntry>;
- extern template WrappedForwardIterator<DepList::ConstIteratorTag, const DepListEntry>::WrappedForwardIterator(const DepList::Iterator &);
-}
-
-#endif
diff --git a/paludis/legacy/dep_list_TEST.cc b/paludis/legacy/dep_list_TEST.cc
deleted file mode 100644
index bfc2a1b..0000000
--- a/paludis/legacy/dep_list_TEST.cc
+++ /dev/null
@@ -1,2347 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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 "dep_list_TEST.hh"
-#include <paludis/util/set.hh>
-#include <paludis/package_id.hh>
-#include <paludis/mask.hh>
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/legacy/override_functions.hh>
-#include <paludis/choice.hh>
-
-using namespace paludis;
-using namespace test;
-
-namespace test_cases
-{
- /**
- * Convenience sub base class used by the numbered DepList tests.
- *
- */
- template <int i_>
- struct DepListTestCase : DepListTestCaseBase
- {
- /**
- * Constructor.
- */
- DepListTestCase() :
- DepListTestCaseBase("dep list " + stringify(i_))
- {
- }
- };
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase1 : DepListTestCase<1>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_1;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase2 : DepListTestCase<2>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_2;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase3 : DepListTestCase<3>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/three");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_3;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase4 : DepListTestCase<4>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_4;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase5 : DepListTestCase<5>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/three");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_5;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase6 : DepListTestCase<6>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_6;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase7 : DepListTestCase<7>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "four", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/four-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_7;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase8 : DepListTestCase<8>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four cat/three");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "four", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/four-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_8;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase9 : DepListTestCase<9>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/four cat/two");
- repo->add_version("cat", "four", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/four-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_9;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase10 : DepListTestCase<10>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_10;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase11 : DepListTestCase<11>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/four )");
- repo->add_version("cat", "four", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_11;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase12 : DepListTestCase<12>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( ( cat/two cat/three ) cat/four )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- repo->add_version("cat", "four", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_12;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase13 : DepListTestCase<13>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three cat/four");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- repo->add_version("cat", "four", "1")->build_dependencies_key()->set_from_string("|| ( ( cat/two cat/three ) cat/five )");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/four-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_13;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase14 : DepListTestCase<14>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_14;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase15 : DepListTestCase<15>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_15;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase16 : DepListTestCase<16>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two:slot2");
- repo->add_version("cat", "two", "1.1")->set_slot(SlotName("slot1"));
- repo->add_version("cat", "two", "1.2")->set_slot(SlotName("slot2"));
- repo->add_version("cat", "two", "1.3")->set_slot(SlotName("slot3"));
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1.2:slot2::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_16;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase17 : DepListTestCase<17>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("<cat/two-1.2-r2:slot2");
- repo->add_version("cat", "two", "1.1")->set_slot(SlotName("slot1"));
- repo->add_version("cat", "two", "1.2")->set_slot(SlotName("slot2"));
- repo->add_version("cat", "two", "1.2-r1")->set_slot(SlotName("slot2"));
- repo->add_version("cat", "two", "1.2-r2")->set_slot(SlotName("slot2"));
- repo->add_version("cat", "two", "1.3")->set_slot(SlotName("slot3"));
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1.2-r1:slot2::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_17;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase18 : DepListTestCase<18>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( )");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_18;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase19 : DepListTestCase<19>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("enabled? ( cat/two )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_19;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase20 : DepListTestCase<20>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("!enabled? ( cat/two )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_20;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase21 : DepListTestCase<21>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("disabled? ( cat/two )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_21;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase22 : DepListTestCase<22>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("!disabled? ( cat/two )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_22;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase23 : DepListTestCase<23>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( enabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_23;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase24 : DepListTestCase<24>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( !enabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_24;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase25 : DepListTestCase<25>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( disabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_25;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase26 : DepListTestCase<26>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( !disabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_26;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase27 : DepListTestCase<27>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_27;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase28 : DepListTestCase<28>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_28;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase29 : DepListTestCase<29>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_29;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase30 : DepListTestCase<30>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/two ) cat/three )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_30;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase31 : DepListTestCase<31>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/three ) cat/two )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_31;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase32 : DepListTestCase<32>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/three ) cat/two )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_32;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase33 : DepListTestCase<33>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/three ) cat/two )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_33;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase34 : DepListTestCase<34>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/three ) cat/two )");
- idcat->choices_key()->add("", "disabled");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_34;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase35 : DepListTestCase<35>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
- idcat->choices_key()->add("", "enabled1");
- idcat->choices_key()->add("", "enabled2");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_35;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase36 : DepListTestCase<36>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
- idcat->choices_key()->add("", "enabled1");
- idcat->choices_key()->add("", "enabled2");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_36;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase37 : DepListTestCase<37>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
- idcat->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
- idcat->choices_key()->add("", "enabled1");
- idcat->choices_key()->add("", "enabled2");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_37;
-
- struct DepListTestCase38 : DepListTestCase<38>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->keywords_key()->set_from_string("test");
- repo->add_version("cat", "one", "2")->keywords_key()->set_from_string("~test");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_38;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase42 : DepListTestCase<42>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/one");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_42;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase43 : DepListTestCase<43>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->post_dependencies_key()->set_from_string("cat/one");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_43;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase44 : DepListTestCase<44>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two )");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_44;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase45 : DepListTestCase<45>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_45;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase46 : DepListTestCase<46>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_46;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase47 : DepListTestCase<47>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_47;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase48 : DepListTestCase<48>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_48;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase49 : DepListTestCase<49>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_49;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase50 : DepListTestCase<50>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_50;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase51 : DepListTestCase<51>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_51;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase52 : DepListTestCase<52>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_52;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase53 : DepListTestCase<53>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->post_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- }
- } test_dep_list_53;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase54 : DepListTestCase<54>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->post_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/three");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- }
- } test_dep_list_54;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase55 : DepListTestCase<55>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->post_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/one");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- }
- } test_dep_list_55;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase56 : DepListTestCase<56>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two || ( cat/three virtual/four )");
- repo->add_version("cat", "two", "1")->provide_key()->set_from_string("virtual/four");
- repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("virtual/four-1::virtuals (virtual for cat/two-1:0::repo)");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_56;
-#endif
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase57 : DepListTestCase<57>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->post_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/three");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/one");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/two-1:0::repo");
- }
- } test_dep_list_57;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase58 : DepListTestCase<58>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("virtual/two-1::virtuals (virtual for cat/one-1:0::repo)");
- }
- } test_dep_list_58;
-#endif
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase59 : DepListTestCase<59>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two >=cat/three-2 )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "2");
- installed_repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/three-2:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_59;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase60 : DepListTestCase<60>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two >=cat/three-3 )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "2");
- installed_repo->add_version("cat", "three", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_60;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- struct DepListTestCase61 : DepListTestCase<61>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->provide_key()->set_from_string("virtual/foo");
- std::shared_ptr<FakePackageID> m(repo->add_version("cat", "two", "2"));
- m->provide_key()->set_from_string("virtual/foo");
- m->build_dependencies_key()->set_from_string("cat/one");
- }
-
- void populate_expected()
- {
- merge_target = "cat/two";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("virtual/foo-1::virtuals (virtual for cat/one-1:0::repo)");
- expected.push_back("cat/two-2:0::repo");
- expected.push_back("virtual/foo-2::virtuals (virtual for cat/two-2:0::repo)");
- }
- } test_dep_list_61;
-#endif
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase62 : DepListTestCase<62>
- {
- void set_options(DepListOptions & opts)
- {
- using namespace std::placeholders;
- opts.override_masks() = std::make_shared<DepListOverrideMasksFunctions>();
- opts.override_masks()->push_back(std::bind(&override_tilde_keywords, &env, _1, _2));
- }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->keywords_key()->set_from_string("~test");
- repo->add_version("cat", "three", "2")->keywords_key()->set_from_string("~test");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo(M)");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_62;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase63 : DepListTestCase<63>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( =cat/two-1 =cat/two-2 )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "two", "2");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-2:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_63;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase64 : DepListTestCase<64>
- {
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( =cat/two-1 =cat/two-2 )");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "two", "2");
- installed_repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-2:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_64;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase65 : DepListTestCase<65>
- {
- void set_options(DepListOptions & opts)
- {
- using namespace std::placeholders;
- opts.override_masks() = std::make_shared<DepListOverrideMasksFunctions>();
- opts.override_masks()->push_back(std::bind(&override_tilde_keywords, &env, _1, _2));
- }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( =cat/two-2 =cat/two-1 )");
- repo->add_version("cat", "two", "1")->keywords_key()->set_from_string("~test");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo(M)");
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_65;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase66 : DepListTestCase<66>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname?] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "disabled", "1"));
- idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname?] )");
- idcat5->choices_key()->add("", "pkgname");
- repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat6/disabled-1:0::repo");
- expected.push_back("cat5/disabled-1:0::repo");
- expected.push_back("cat4/enabled-1:0::repo");
- expected.push_back("cat3/disabled-1:0::repo");
- expected.push_back("cat2/enabled-1:0::repo");
- expected.push_back("cat1/enabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_66;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase67 : DepListTestCase<67>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/enabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_67;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase68 : DepListTestCase<68>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "enabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!?] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "enabled", "1"));
- idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname!?] )");
- idcat5->choices_key()->add("", "pkgname");
- repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat6/disabled-1:0::repo");
- expected.push_back("cat5/enabled-1:0::repo");
- expected.push_back("cat4/enabled-1:0::repo");
- expected.push_back("cat3/enabled-1:0::repo");
- expected.push_back("cat2/enabled-1:0::repo");
- expected.push_back("cat1/disabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_68;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase69 : DepListTestCase<69>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/disabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_69;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase70 : DepListTestCase<70>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname?] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "disabled", "1"));
- idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname?] )");
- idcat5->choices_key()->add("", "pkgname");
- repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat6/disabled-1:0::repo");
- expected.push_back("cat5/disabled-1:0::repo");
- expected.push_back("cat4/enabled-1:0::repo");
- expected.push_back("cat3/disabled-1:0::repo");
- expected.push_back("cat2/disabled-1:0::repo");
- expected.push_back("cat1/enabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_70;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase71 : DepListTestCase<71>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[-pkgname?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/enabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_71;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase72 : DepListTestCase<72>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "enabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname!?] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "enabled", "1"));
- idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname!?] )");
- idcat5->choices_key()->add("", "pkgname");
- repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat6/disabled-1:0::repo");
- expected.push_back("cat5/enabled-1:0::repo");
- expected.push_back("cat4/enabled-1:0::repo");
- expected.push_back("cat3/enabled-1:0::repo");
- expected.push_back("cat2/disabled-1:0::repo");
- expected.push_back("cat1/disabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_72;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase73 : DepListTestCase<73>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/disabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_73;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase74 : DepListTestCase<74>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/disabled[pkgname=] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat4/disabled-1:0::repo");
- expected.push_back("cat3/disabled-1:0::repo");
- expected.push_back("cat2/enabled-1:0::repo");
- expected.push_back("cat1/enabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_74;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase75 : DepListTestCase<75>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/enabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_75;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase76 : DepListTestCase<76>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/disabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_76;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase77 : DepListTestCase<77>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
- idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!=] )");
- idcat3->choices_key()->add("", "pkgname");
- repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
- idcat->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
- idcat->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat/all";
- expected.push_back("cat4/enabled-1:0::repo");
- expected.push_back("cat3/disabled-1:0::repo");
- expected.push_back("cat2/disabled-1:0::repo");
- expected.push_back("cat1/enabled-1:0::repo");
- expected.push_back("cat/all-1:0::repo");
- }
- } test_dep_list_77;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase78 : DepListTestCase<78>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/enabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_78;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase79 : DepListTestCase<79>
- {
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
- idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!=] )");
- idcat1->choices_key()->add("", "pkgname");
- repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
- }
-
- void populate_expected()
- {
- merge_target = "cat1/disabled";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_79;
-
- /**
- * \test Test DepList resolution behaviour.
- *
- */
- struct DepListTestCase80 : DepListTestCase<80>
- {
- void populate_repo()
- {
- repo->add_version("cat", "pkg-bin", "1");
- std::shared_ptr<FakePackageID> catpkg(repo->add_version("cat", "pkg", "1"));
- catpkg->build_dependencies_key()->set_from_string("|| ( cat/pkg-bin cat/pkg )");
- }
-
- void populate_expected()
- {
- merge_target = "cat/pkg";
- expected.push_back("cat/pkg-bin-1:0::repo");
- expected.push_back("cat/pkg-1:0::repo");
- }
- } test_dep_list_80;
-
- /**
- * \test Test DepList transactional add behaviour.
- *
- */
- struct DepListTestCaseTransactionalAdd : TestCase
- {
- DepListTestCaseTransactionalAdd() : TestCase("dep list transactional add") { }
-
- void run()
- {
- TestEnvironment env;
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- std::shared_ptr<FakeInstalledRepository> destination_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, destination_repo);
-
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/four cat/two");
- repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->build_dependencies_key()->set_from_string("cat/six cat/seven");
- repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->build_dependencies_key()->set_from_string("cat/doesnotexist");
-
- DepList d(&env, DepListOptions());
- d.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
- "cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
-
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec("cat/five",
- &env, { })),
- env.default_destinations()), DepListError);
-
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
- "cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
- }
- } test_dep_list_transactional_add;
-
- /**
- * \test Test DepList transactional add behaviour on PDEPENDs.
- *
- */
- struct DepListTestCaseTransactionalAddPost : TestCase
- {
- DepListTestCaseTransactionalAddPost() : TestCase("dep list transactional add post") { }
-
- void run()
- {
- TestEnvironment env;
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- std::shared_ptr<FakeInstalledRepository> destination_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, destination_repo);
-
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("cat/four");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("cat/four cat/two");
- repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->build_dependencies_key()->set_from_string("cat/six cat/seven");
- repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->post_dependencies_key()->set_from_string("cat/doesnotexist");
-
- DepList d(&env, DepListOptions());
- d.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
- "cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
-
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec("cat/five",
- &env, { })),
- env.default_destinations()), DepListError);
-
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "),
- "cat/four-1:0::repo cat/two-1:0::repo cat/three-1:0::repo cat/one-1:0::repo");
- }
- } test_dep_list_transactional_add_post;
-
- /**
- * \test Test DepList transactional forced downgrade of installed package behaviour.
- *
- */
- struct DepListTestCaseForcedDowngradeOfInstalled : TestCase
- {
- DepListTestCaseForcedDowngradeOfInstalled() : TestCase("dep list forced downgrade of installed") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "one", "2");
-
- DepList d(&env, DepListOptions());
- d.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "), "cat/one-1:0::repo");
- }
- } test_dep_list_forced_downgrade_of_installed;
-
- /**
- * \test Test DepList fall back never.
- */
- struct DepListTestCaseFallBackNever : TestCase
- {
- DepListTestCaseFallBackNever() : TestCase("dep list fall back never") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "two", "2");
-
- DepList d(&env, DepListOptions());
- d.options()->fall_back() = dl_fall_back_never;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })),
- env.default_destinations()), DepListError);
- }
- } test_dep_list_fall_back_never;
-
- /**
- * \test Test DepList fall back as needed.
- */
- struct DepListTestCaseFallBackAsNeeded : TestCase
- {
- DepListTestCaseFallBackAsNeeded() : TestCase("dep list fall back as needed") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "two", "2");
-
- DepList d(&env, DepListOptions());
- d.options()->fall_back() = dl_fall_back_as_needed;
- d.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- d.add(PackageDepSpec(parse_user_package_dep_spec("cat/two",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d.begin(), d.end(), " "), "cat/two-2:0::installed_repo cat/one-1:0::repo");
- }
- } test_dep_list_fall_back_as_needed;
-
- /**
- * \test Test DepList fall back as needed.
- */
- struct DepListTestCaseFallBackAsNeededNotTargets : TestCase
- {
- DepListTestCaseFallBackAsNeededNotTargets() : TestCase("dep list fall back as needed not targets") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "two", "2");
- installed_repo->add_version("cat", "three", "3");
-
- DepList d1(&env, DepListOptions());
- d1.options()->fall_back() = dl_fall_back_as_needed_except_targets;
- d1.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/two-2:0::installed_repo cat/one-1:0::repo");
- TEST_CHECK_THROWS(d1.add(PackageDepSpec(parse_user_package_dep_spec("cat/three",
- &env, { })),
- env.default_destinations()), DepListError);
-
- DepList d2(&env, DepListOptions());
- d2.options()->fall_back() = dl_fall_back_as_needed_except_targets;
- TEST_CHECK_THROWS(d2.add(PackageDepSpec(parse_user_package_dep_spec("cat/two",
- &env, { })),
- env.default_destinations()), DepListError);
-
- DepList d3(&env, DepListOptions());
- d3.options()->fall_back() = dl_fall_back_as_needed_except_targets;
- std::shared_ptr<SetSpecTree> t3(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- t3->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/one", &env, { })));
- t3->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/two", &env, { })));
- TEST_CHECK_THROWS(d3.add(*t3, env.default_destinations()), DepListError);
-
- DepList d4(&env, DepListOptions());
- std::shared_ptr<SetSpecTree> t4(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- t4->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/one", &env, { })));
- t4->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/three", &env, { })));
- TEST_CHECK_THROWS(d4.add(*t4, env.default_destinations()), DepListError);
- }
- } test_dep_list_fall_back_as_needed_not_targets;
-
- /**
- * \test Test DepList upgrade as needed.
- */
- struct DepListTestCaseUpgradeAsNeeded : TestCase
- {
- DepListTestCaseUpgradeAsNeeded() : TestCase("dep list upgrade as needed") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "2");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "two", "0");
-
- DepList d1(&env, DepListOptions());
- d1.options()->upgrade() = dl_upgrade_as_needed;
- d1.add(PackageDepSpec(parse_user_package_dep_spec("cat/one",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/two-0:0::installed_repo cat/one-1:0::repo");
-
- DepList d2(&env, DepListOptions());
- d2.options()->upgrade() = dl_upgrade_as_needed;
-
- std::shared_ptr<SetSpecTree> t2(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- t2->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/one", &env, { })));
- t2->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/two", &env, { })));
- d2.add(*t2, env.default_destinations());
- TEST_CHECK_EQUAL(join(d2.begin(), d2.end(), " "), "cat/two-2:0::repo cat/one-1:0::repo");
- }
- } test_dep_list_upgrade_as_needed;
-
- /**
- * \test Test DepList reinstall scm.
- */
- struct DepListTestCaseReinstallSCM : TestCase
- {
- DepListTestCaseReinstallSCM() : TestCase("dep list reinstall scm") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "zero", "1")->build_dependencies_key()->set_from_string(
- "( cat/one cat/two cat/three-live cat/four-cvs cat/five-svn cat/six-darcs )");
- repo->add_version("cat", "one", "scm");
- repo->add_version("cat", "two", "2");
- repo->add_version("cat", "three-live", "0");
- repo->add_version("cat", "four-cvs", "0");
- repo->add_version("cat", "five-svn", "0");
- repo->add_version("cat", "six-darcs", "0");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
- installed_repo->add_version("cat", "one", "scm");
- installed_repo->add_version("cat", "two", "2");
- installed_repo->add_version("cat", "three-live", "0");
- installed_repo->add_version("cat", "four-cvs", "0");
- installed_repo->add_version("cat", "five-svn", "0");
- installed_repo->add_version("cat", "six-darcs", "0");
-
- DepList d1(&env, DepListOptions());
- d1.options()->reinstall_scm() = dl_reinstall_scm_always;
- d1.add(PackageDepSpec(parse_user_package_dep_spec("cat/zero",
- &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/one-scm:0::repo cat/two-2:0::installed_repo "
- "cat/three-live-0:0::repo cat/four-cvs-0:0::repo cat/five-svn-0:0::repo cat/six-darcs-0:0::repo "
- "cat/zero-1:0::repo");
- }
- } test_dep_list_upgrade_reinstall_scm;
-
- /**
- * \test Test DepList dependency tags.
- */
- struct DepListTestCaseDependencyTags : TestCase
- {
- DepListTestCaseDependencyTags() : TestCase("dep list dependency tags") { }
-
- void run()
- {
- TestEnvironment env;
-
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.package_database()->add_repository(1, repo);
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three");
- std::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "two", "1"));
- idcat->build_dependencies_key()->set_from_string("enabled? ( || ( ( <cat/three-1 cat/three:0 =cat/four-1 ) cat/five ) )");
- idcat->choices_key()->add("", "enabled");
- repo->add_version("cat", "three", "0.9");
- repo->add_version("cat", "four", "1");
-
- std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed_repo"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- )));
- env.package_database()->add_repository(2, installed_repo);
-
- DepList d1(&env, DepListOptions());
- d1.options()->dependency_tags() = true;
- PackageDepSpec with_target_tag(parse_user_package_dep_spec("cat/one",
- &env, { }));
- with_target_tag.set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- d1.add(with_target_tag, env.default_destinations());
- PackageDepSpec with_set_tag(parse_user_package_dep_spec("cat/two",
- &env, { }));
- with_set_tag.set_tag(std::shared_ptr<const DepTag>(std::make_shared<GeneralSetDepTag>(SetName("set"), "test")));
- d1.add(with_set_tag, env.default_destinations());
-
- TEST_CHECK_EQUAL(join(d1.begin(), d1.end(), " "), "cat/three-0.9:0::repo cat/one-1:0::repo "
- "cat/four-1:0::repo cat/two-1:0::repo");
-
- // tags for cat/three
- DepList::Iterator it(d1.begin());
- std::shared_ptr<DepListEntryTags> tags(it->tags());
- TEST_CHECK_EQUAL(tags->size(), 3U);
-
- // tags for cat/one
- ++it;
- tags = it->tags();
- TEST_CHECK_EQUAL(tags->size(), 1U);
- TEST_CHECK_EQUAL(tags->begin()->tag()->category(), "target");
-
- // tags for cat/four
- ++it;
- tags = it->tags();
- TEST_CHECK_EQUAL(tags->size(), 1U);
- TEST_CHECK_EQUAL(tags->begin()->tag()->category(), "dependency");
- std::shared_ptr<const DependencyDepTag> deptag(
- std::static_pointer_cast<const DependencyDepTag>(tags->begin()->tag()));
- TEST_CHECK_EQUAL(deptag->short_text(), "cat/two-1:0::repo");
- TEST_CHECK_STRINGIFY_EQUAL(*deptag->dependency(), "=cat/four-1");
-
- // tags for cat/two
- ++it;
- tags = it->tags();
- TEST_CHECK_EQUAL(tags->size(), 1U);
- TEST_CHECK_EQUAL(tags->begin()->tag()->category(), "general");
- TEST_CHECK_EQUAL(tags->begin()->tag()->short_text(), "set");
- }
- } test_dep_list_dependency_tags;
-}
-
diff --git a/paludis/legacy/dep_list_TEST.hh b/paludis/legacy/dep_list_TEST.hh
deleted file mode 100644
index 9bd5fa1..0000000
--- a/paludis/legacy/dep_list_TEST.hh
+++ /dev/null
@@ -1,216 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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_DEP_LIST_TEST_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_LIST_TEST_HH 1
-
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/legacy/dep_list_exceptions.hh>
-#include <paludis/repositories/fake/fake_repository.hh>
-#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/repository_factory.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <string>
-#include <list>
-#include <ostream>
-
-#include "config.h"
-
-using namespace paludis;
-using namespace test;
-
-#ifndef DOXYGEN
-
-namespace paludis
-{
- class DepListEntry;
- std::ostream &
- operator<< (std::ostream & s, const DepListEntry & e)
- {
- s << *e.package_id();
-
- switch (e.kind())
- {
- case dlk_virtual:
- case dlk_package:
- case dlk_provided:
- case dlk_already_installed:
- case dlk_subpackage:
- case dlk_suggested:
- break;
-
- case dlk_block:
- s << "(!)";
- break;
-
- case dlk_masked:
- s << "(M)";
- break;
-
- case last_dlk:
- ;
- }
-
- return s;
- }
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- std::string virtuals_repo_keys(const std::string & k)
- {
- if (k == "format")
- return "virtuals";
- else if (k == "root")
- return "/";
- else
- return "";
- }
-
- std::string installed_virtuals_repo_keys(const std::string & k)
- {
- if (k == "format")
- return "installed_virtuals";
- else if (k == "root")
- return "/";
- else
- return "";
- }
-#endif
-}
-
-namespace test_cases
-{
- /**
- * Convenience base class used by many of the DepList tests.
- *
- */
- class DepListTestCaseBase :
- public TestCase
- {
- protected:
- TestEnvironment env;
- std::shared_ptr<FakeRepository> repo;
- std::shared_ptr<FakeInstalledRepository> installed_repo;
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- std::shared_ptr<Repository> virtuals_repo;
- std::shared_ptr<Repository> installed_virtuals_repo;
-#endif
- std::list<std::string> expected;
- std::string merge_target;
- bool done_populate;
-
- /**
- * Constructor.
- */
- DepListTestCaseBase(const std::string & s) :
- TestCase(s),
- env(),
- repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo")))),
- installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- ))),
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- virtuals_repo(RepositoryFactory::get_instance()->create(&env, virtuals_repo_keys)),
- installed_virtuals_repo(RepositoryFactory::get_instance()->create(&env, installed_virtuals_repo_keys)),
-#endif
- done_populate(false)
- {
- env.package_database()->add_repository(4, repo);
- env.package_database()->add_repository(3, installed_repo);
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- env.package_database()->add_repository(2, virtuals_repo);
- env.package_database()->add_repository(1, installed_virtuals_repo);
-#endif
- }
-
- /**
- * Populate our repo member.
- */
- virtual void populate_repo() = 0;
-
- /**
- * Populate our expected member.
- */
- virtual void populate_expected() = 0;
-
- virtual void set_options(DepListOptions &)
- {
- }
-
- /**
- * Check expected is what we got.
- */
- virtual void check_lists()
- {
- DepList d(&env, DepListOptions());
- set_options(*d.options());
- d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target,
- &env, UserPackageDepSpecOptions() + updso_allow_wildcards)),
- env.default_destinations());
- TEST_CHECK(true);
-
- TestMessageSuffix s("got={ " + join(d.begin(), d.end(), ", ") + " }", false);
- TestMessageSuffix s2("expected={ " + join(expected.begin(), expected.end(), ", ") + " }", false);
-
- unsigned n(0);
- std::list<std::string>::const_iterator exp(expected.begin());
- DepList::Iterator got(d.begin());
- while (true)
- {
- TestMessageSuffix sx(stringify(n++), true);
-
- TEST_CHECK((exp == expected.end()) == (got == d.end()));
- if (got == d.end())
- break;
- TEST_CHECK_STRINGIFY_EQUAL(*got, *exp);
- ++exp;
- ++got;
- }
-
- d.clear();
- TEST_CHECK(d.begin() == d.end());
- }
-
- public:
- void run()
- {
- if (! done_populate)
- {
- populate_repo();
- populate_expected();
- done_populate = true;
- }
- check_lists();
- }
- };
-}
-
-#endif
-
-#endif
diff --git a/paludis/legacy/dep_list_TEST_blockers.cc b/paludis/legacy/dep_list_TEST_blockers.cc
deleted file mode 100644
index cef81eb..0000000
--- a/paludis/legacy/dep_list_TEST_blockers.cc
+++ /dev/null
@@ -1,376 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2010 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 "dep_list_TEST.hh"
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-
-using namespace paludis;
-using namespace test;
-
-namespace test_cases
-{
- struct DepListTestCaseBasicBlock : DepListTestCaseBase
- {
- DepListTestCaseBasicBlock() : DepListTestCaseBase("block") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("!cat/two");
- installed_repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(parse_user_package_dep_spec(merge_target, &env, { }),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
-
- d.options()->blocks() = dl_blocks_accumulate;
- d.add(parse_user_package_dep_spec(merge_target, &env, { }), env.default_destinations());
- TEST_CHECK_EQUAL(std::distance(d.begin(), d.end()), 2);
- TEST_CHECK_EQUAL(d.begin()->kind(), dlk_block);
- TEST_CHECK_STRINGIFY_EQUAL(*d.begin()->package_id(), "cat/two-1:0::installed");
- TEST_CHECK_EQUAL(next(d.begin())->kind(), dlk_package);
- TEST_CHECK_STRINGIFY_EQUAL(*next(d.begin())->package_id(), "cat/one-1:0::repo");
- }
- } test_dep_list_basic_block;
-
- struct DepListTestCaseListBlock : DepListTestCaseBase
- {
- DepListTestCaseListBlock() : DepListTestCaseBase("block on list ignore") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("!cat/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_list_block;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- struct DepListTestCaseSelfBlock : DepListTestCaseBase
- {
- DepListTestCaseSelfBlock() : DepListTestCaseBase("self block via provide on list") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- std::shared_ptr<FakePackageID> two_m(repo->add_version("cat", "two", "1"));
- two_m->build_dependencies_key()->set_from_string("!virtual/two");
- two_m->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::repo");
- expected.push_back("virtual/two-1::virtuals (virtual for cat/two-1:0::repo)");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_self_block_list;
-
- struct DepListTestCaseProvidedBlock : DepListTestCaseBase
- {
- DepListTestCaseProvidedBlock() : DepListTestCaseBase("provided block") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- std::shared_ptr<FakePackageID> two_m(repo->add_version("cat", "two", "1"));
- two_m->build_dependencies_key()->set_from_string("!virtual/two");
- two_m->provide_key()->set_from_string("virtual/two");
- installed_repo->add_version("other", "two", "1")->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
-
- d.options()->blocks() = dl_blocks_accumulate;
- d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })), env.default_destinations());
- TEST_CHECK_EQUAL(std::distance(d.begin(), d.end()), 4);
- TEST_CHECK_EQUAL(d.begin()->kind(), dlk_block);
- TEST_CHECK_STRINGIFY_EQUAL(*d.begin()->package_id(), "virtual/two-1::installed-virtuals (virtual for other/two-1:0::installed)");
- TEST_CHECK_EQUAL(next(d.begin())->kind(), dlk_package);
- TEST_CHECK_STRINGIFY_EQUAL(*next(d.begin())->package_id(), "cat/two-1:0::repo");
- TEST_CHECK_EQUAL(next(next(d.begin()))->kind(), dlk_provided);
- TEST_CHECK_STRINGIFY_EQUAL(*next(next(d.begin()))->package_id(), "virtual/two-1::virtuals (virtual for cat/two-1:0::repo)");
- TEST_CHECK_EQUAL(next(next(next(d.begin())))->kind(), dlk_package);
- TEST_CHECK_STRINGIFY_EQUAL(*next(next(next(d.begin())))->package_id(), "cat/one-1:0::repo");
- }
- } test_dep_list_provided_block;
-#endif
-
- struct DepListTestCaseBlockOnList : DepListTestCaseBase
- {
- DepListTestCaseBlockOnList() : DepListTestCaseBase("block on list") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two cat/three");
- repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("!cat/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_block_on_list;
-
- struct DepListTestCaseNoBlockOnReplaced : DepListTestCaseBase
- {
- DepListTestCaseNoBlockOnReplaced() : DepListTestCaseBase("no block on replaced") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string(">=cat/two-2 cat/three");
- repo->add_version("cat", "two", "2");
- repo->add_version("cat", "three", "1")->build_dependencies_key()->set_from_string("!<cat/two-2");
- installed_repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-2:0::repo");
- expected.push_back("cat/three-1:0::repo");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_no_block_on_replaced;
-
- struct DepListTestCaseNoBlockOnNoUpgrade : DepListTestCaseBase
- {
- DepListTestCaseNoBlockOnNoUpgrade() : DepListTestCaseBase("no block on no upgrade") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("!cat/two");
- installed_repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-1:0::installed");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_no_block_on_no_upgrade;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- struct DepListTestCaseNoBlockOnNoUpgradeViaProvided : DepListTestCaseBase
- {
- DepListTestCaseNoBlockOnNoUpgradeViaProvided() : DepListTestCaseBase("no block on no upgrade via provided") { }
-
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> one_m(repo->add_version("cat", "one", "1"));
- one_m->provide_key()->set_from_string("virtual/one");
- one_m->build_dependencies_key()->set_from_string("!virtual/one");
- one_m->run_dependencies_key()->set_from_string("!virtual/one");
- std::shared_ptr<FakePackageID> i_one_m(installed_repo->add_version("cat", "one", "1"));
- i_one_m->provide_key()->set_from_string("virtual/one");
- i_one_m->run_dependencies_key()->set_from_string("!virtual/one");
- }
-
- void populate_expected()
- {
- merge_target = "virtual/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("virtual/one-1::virtuals (virtual for cat/one-1:0::repo)");
- }
- } test_dep_list_no_block_on_no_upgrade_via_provided;
-
- struct DepListTestCaseNoBlockOnNoReinstallViaProvided : DepListTestCaseBase
- {
- DepListTestCaseNoBlockOnNoReinstallViaProvided() : DepListTestCaseBase("no block on no reinstall via provided") { }
-
- void populate_repo()
- {
- std::shared_ptr<FakePackageID> one_m(repo->add_version("cat", "one", "1"));
- one_m->provide_key()->set_from_string("virtual/one");
- one_m->build_dependencies_key()->set_from_string("!virtual/one");
- one_m->run_dependencies_key()->set_from_string("!virtual/one");
- std::shared_ptr<FakePackageID> i_one_m(installed_repo->add_version("cat", "one", "1"));
- i_one_m->provide_key()->set_from_string("virtual/one");
- i_one_m->run_dependencies_key()->set_from_string("!virtual/one");
- }
-
- void populate_expected()
- {
- merge_target = "virtual/one";
- expected.push_back("cat/one-1:0::repo");
- expected.push_back("virtual/one-1::virtuals (virtual for cat/one-1:0::repo)");
- }
-
- virtual void set_options(DepListOptions & p)
- {
- p.reinstall() = dl_reinstall_always;
- }
- } test_dep_list_no_block_on_no_reinstall_via_provided;
-
- struct DepListTestCaseNoBlockOnReplacedProvide : DepListTestCaseBase
- {
- DepListTestCaseNoBlockOnReplacedProvide() : DepListTestCaseBase("no block on replaced provide") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- std::shared_ptr<FakePackageID> two_m(repo->add_version("cat", "two", "2"));
- two_m->provide_key()->set_from_string("virtual/two");
- two_m->build_dependencies_key()->set_from_string("!virtual/two");
- installed_repo->add_version("cat", "two", "1")->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- expected.push_back("cat/two-2:0::repo");
- expected.push_back("virtual/two-2::virtuals (virtual for cat/two-2:0::repo)");
- expected.push_back("cat/one-1:0::repo");
- }
- } test_dep_list_no_block_on_replaced_provide;
-#endif
-
- struct DepListTestCaseRestrictedOlderSelf : DepListTestCaseBase
- {
- DepListTestCaseRestrictedOlderSelf() : DepListTestCaseBase("restricted older self") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- repo->add_version("cat", "two", "2")->build_dependencies_key()->set_from_string("!<cat/two-2");
- installed_repo->add_version("cat", "two", "1");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_restricted_older_self;
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- struct DepListTestCaseRestrictedOlderSelfProvide : DepListTestCaseBase
- {
- DepListTestCaseRestrictedOlderSelfProvide() : DepListTestCaseBase("restricted older self provide") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- std::shared_ptr<FakePackageID> two_m(repo->add_version("cat", "two", "2"));
- two_m->build_dependencies_key()->set_from_string("!<virtual/two-2");
- two_m->provide_key()->set_from_string("virtual/two");
- installed_repo->add_version("cat", "two", "1")->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_restricted_older_self_provide;
-
- struct DepListTestCaseRestrictedOlderOtherProvide : DepListTestCaseBase
- {
- DepListTestCaseRestrictedOlderOtherProvide() : DepListTestCaseBase("restricted older other provide") { }
-
- void populate_repo()
- {
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/two");
- std::shared_ptr<FakePackageID> two_m(repo->add_version("cat", "two", "2"));
- two_m->build_dependencies_key()->set_from_string("!<virtual/two-2");
- two_m->provide_key()->set_from_string("virtual/two");
- installed_repo->add_version("other", "two", "1")->provide_key()->set_from_string("virtual/two");
- }
-
- void populate_expected()
- {
- merge_target = "cat/one";
- }
-
- void check_lists()
- {
- TEST_CHECK(true);
- DepList d(&env, DepListOptions());
- d.options()->blocks() = dl_blocks_error;
- TEST_CHECK_THROWS(d.add(PackageDepSpec(parse_user_package_dep_spec(merge_target, &env, { })),
- env.default_destinations()), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
- } test_dep_list_restricted_older_other_provide;
-#endif
-}
-
-
diff --git a/paludis/legacy/dep_list_exceptions.cc b/paludis/legacy/dep_list_exceptions.cc
deleted file mode 100644
index 688a67f..0000000
--- a/paludis/legacy/dep_list_exceptions.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2010, 2011 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 "dep_list_exceptions.hh"
-#include <paludis/util/set.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-
-using namespace paludis;
-
-DepListError::DepListError(const std::string & m) throw () :
- Exception(m)
-{
-}
-
-AllMaskedError::AllMaskedError(const PackageDepSpec & q, const std::shared_ptr<const PackageID> & i) throw () :
- DepListError("Error searching for '" + stringify(q) + "': no available versions"),
- _query(q),
- _from_id(i)
-{
-}
-
-AdditionalRequirementsNotMetError::AdditionalRequirementsNotMetError(const PackageDepSpec & q,
- const std::shared_ptr<const PackageID> & f,
- const std::shared_ptr<const PackageID> & i) throw () :
- DepListError("Error searching for '" + stringify(q) + "': additional requirements are not met on '" + stringify(*i) + "'"),
- _query(q),
- _from_id(f),
- _id(i)
-{
-}
-
-AdditionalRequirementsNotMetError::~AdditionalRequirementsNotMetError() throw ()
-{
-}
-
-BlockError::BlockError(const std::string & msg) throw () :
- DepListError("Block: " + msg)
-{
-}
-
-CircularDependencyError::CircularDependencyError(const std::string & msg) throw () :
- DepListError("Circular dependency: " + msg)
-{
-}
-
-DowngradeNotAllowedError::DowngradeNotAllowedError(const std::string & to, const std::string & from) throw () :
- DepListError("Downgrade to '" + to + "' from '" + from + "' forbidden")
-{
-}
-
-DowngradeNotAllowedError::~DowngradeNotAllowedError() throw ()
-{
-}
-
-namespace
-{
- std::string
- destinations_to_string(std::shared_ptr<const DestinationsSet> dd)
- {
- std::string result;
- bool need_comma(false);
- for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ;
- d != d_end ; ++d)
- {
- if (need_comma)
- result.append(", ");
- need_comma = true;
-
- result.append(stringify((*d)->name()));
- }
- return result;
- }
-}
-
-NoDestinationError::NoDestinationError(const std::shared_ptr<const PackageID> & p,
- const std::shared_ptr<const DestinationsSet> & d) throw () :
- DepListError("No suitable destination for '" + stringify(*p) + "' in (" +
- destinations_to_string(d) + ")")
-{
-}
-
diff --git a/paludis/legacy/dep_list_exceptions.hh b/paludis/legacy/dep_list_exceptions.hh
deleted file mode 100644
index 510a6db..0000000
--- a/paludis/legacy/dep_list_exceptions.hh
+++ /dev/null
@@ -1,224 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2010, 2011 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_DEP_LIST_EXCEPTIONS_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_LIST_EXCEPTIONS_HH 1
-
-#include <paludis/util/exception.hh>
-#include <paludis/package_database.hh>
-#include <paludis/environment.hh>
-
-/** \file
- * Declarations for DepList exceptions.
- *
- * \ingroup g_dep_spec
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Thrown if an error occurs whilst building a DepList.
- *
- * \ingroup g_dep_list
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListError : public Exception
- {
- protected:
- ///\name Basic operations
- ///\{
-
- DepListError(const std::string &) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if all versions of a particular spec are masked.
- *
- * \ingroup g_dep_list
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE AllMaskedError : public DepListError
- {
- private:
- const PackageDepSpec _query;
- const std::shared_ptr<const PackageID> _from_id;
-
- public:
- ///\name Basic operations
- ///\{
-
- AllMaskedError(const PackageDepSpec & query, const std::shared_ptr<const PackageID> & id) throw ();
-
- virtual ~AllMaskedError() throw ()
- {
- }
-
- ///\}
-
- /**
- * Our query.
- */
- const PackageDepSpec query() const
- {
- return _query;
- }
-
- const std::shared_ptr<const PackageID> from_id() const
- {
- return _from_id;
- }
- };
-
- /**
- * Thrown if all versions of a particular spec are masked,
- * but would not be if additional requirements were not in effect.
- *
- * \ingroup g_dep_list
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE AdditionalRequirementsNotMetError : public DepListError
- {
- private:
- PackageDepSpec _query;
- const std::shared_ptr<const PackageID> _from_id;
- const std::shared_ptr<const PackageID> _id;
-
- public:
- ///\name Basic operations
- ///\{
-
- AdditionalRequirementsNotMetError(
- const PackageDepSpec & query,
- const std::shared_ptr<const PackageID> & from_id,
- const std::shared_ptr<const PackageID> & id) throw ();
-
- virtual ~AdditionalRequirementsNotMetError() throw ();
-
- ///\}
-
- /**
- * Our query.
- */
- const PackageDepSpec query() const
- {
- return _query;
- }
-
- /**
- * Our ID of choice.
- *
- * \since 0.44
- */
- const std::shared_ptr<const PackageID> package_id() const
- {
- return _id;
- }
-
- const std::shared_ptr<const PackageID> from_package_id() const
- {
- return _from_id;
- }
- };
-
- /**
- * Thrown if a downgrade is forced and we're not allowed to downgrade.
- *
- * \ingroup g_exceptions
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DowngradeNotAllowedError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- DowngradeNotAllowedError(const std::string & to, const std::string & from) throw ();
-
- virtual ~DowngradeNotAllowedError() throw ();
-
- ///\}
- };
-
- /**
- * Thrown if a block is encountered.
- *
- * \ingroup g_exceptions
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE BlockError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- BlockError(const std::string & msg) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if a circular dependency is encountered.
- *
- * \ingroup g_dep_list
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE CircularDependencyError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- CircularDependencyError(const std::string & msg) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if no destination can be found.
- *
- * \ingroup g_dep_list
- * \ingroup g_exceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE NoDestinationError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- NoDestinationError(const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<const DestinationsSet> &) throw ();
-
- ///\}
- };
-}
-
-#endif
diff --git a/paludis/legacy/dep_list_options.cc b/paludis/legacy/dep_list_options.cc
deleted file mode 100644
index 1303e6a..0000000
--- a/paludis/legacy/dep_list_options.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2010 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 "dep_list_options.hh"
-#include <ostream>
-#include <paludis/util/exception.hh>
-#include <paludis/util/stringify.hh>
-
-using namespace paludis;
-
-#include <paludis/legacy/dep_list_options-se.cc>
-
diff --git a/paludis/legacy/dep_list_options.hh b/paludis/legacy/dep_list_options.hh
deleted file mode 100644
index 8255e46..0000000
--- a/paludis/legacy/dep_list_options.hh
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2010 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_DEP_LIST_OPTIONS_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_LIST_OPTIONS_HH 1
-
-#include <iosfwd>
-#include <paludis/util/attributes.hh>
-
-/** \file
- * Declarations for DepList options.
- *
- * \ingroup g_dep_spec
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
-#include <paludis/legacy/dep_list_options-se.hh>
-}
-
-#endif
diff --git a/paludis/legacy/dep_list_options.se b/paludis/legacy/dep_list_options.se
deleted file mode 100644
index be54857..0000000
--- a/paludis/legacy/dep_list_options.se
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_DepListTargetType()
-{
- prefix dl_target
-
- key dl_target_package "A package, so force reinstalls."
- key dl_target_set "A set, so don't force reinstalls."
-
- doxygen_comment << "END"
- /**
- * Type of target being handled at the top level.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListReinstallOption()
-{
- prefix dl_reinstall
-
- key dl_reinstall_never "Never"
- key dl_reinstall_always "Always"
- key dl_reinstall_if_use_changed "If a USE flag has changed"
-
- doxygen_comment << "END"
- /**
- * When we should reinstall.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListFallBackOption()
-{
- prefix dl_fall_back
-
- key dl_fall_back_as_needed_except_targets "As needed, except for targets"
- key dl_fall_back_as_needed "As needed"
- key dl_fall_back_never "Never"
-
- doxygen_comment << "END"
- /**
- * When we should fall back to an installed package.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListReinstallScmOption()
-{
- prefix dl_reinstall_scm
-
- key dl_reinstall_scm_never "Never"
- key dl_reinstall_scm_always "Always"
- key dl_reinstall_scm_daily "Daily"
- key dl_reinstall_scm_weekly "Weekly"
-
- doxygen_comment << "END"
- /**
- * When we should reinstall SCM packages.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListUpgradeOption()
-{
- prefix dl_upgrade
-
- key dl_upgrade_always "Always"
- key dl_upgrade_as_needed "Only as needed"
-
- doxygen_comment << "END"
- /**
- * When we should upgrade.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListDowngradeOption()
-{
- prefix dl_downgrade
- key dl_downgrade_as_needed "As needed"
- key dl_downgrade_warning "As needed, but warn"
- key dl_downgrade_error "Refuse to downgrade"
-
- doxygen_comment << "END"
- /**
- * What to do when we downgrade.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListNewSlotsOption()
-{
- prefix dl_new_slots
-
- key dl_new_slots_always "Always"
- key dl_new_slots_as_needed "Only where necessary"
-
- doxygen_comment << "END"
- /**
- * When we should pull in a new slot.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListDepsOption()
-{
- prefix dl_deps
-
- key dl_deps_discard "Discard it"
- key dl_deps_pre "As a pre dependency"
- key dl_deps_pre_or_post "As a pre dependency with fallback to post"
- key dl_deps_post "As a post dependency"
- key dl_deps_try_post "As an optional post dependency"
-
- doxygen_comment << "END"
- /**
- * How we should handle a dep class.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListSuggestedOption()
-{
- prefix dl_suggested
- key dl_suggested_show "Show"
- key dl_suggested_discard "Discard"
- key dl_suggested_install "Install"
-
- doxygen_comment << "END"
- /**
- * How we should handle suggested deps.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListCircularOption()
-{
- prefix dl_circular
-
- key dl_circular_error "As an error"
- key dl_circular_discard "Discard them"
- key dl_circular_discard_silently "Discard them silently"
-
- doxygen_comment << "END"
- /**
- * How we should handle circular deps.
- *
- * \see DepListOptions
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListBlocksOption()
-{
- prefix dl_blocks
-
- key dl_blocks_accumulate "Accumulate them and show all errors together"
- key dl_blocks_error "Error on the first one"
- key dl_blocks_discard "Discard (dangerous)"
- key dl_blocks_discard_completely "Discard completely (not for user visible use)"
-
- doxygen_comment <<"END"
- /**
- * How we handle blocks.
- *
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListUseOption()
-{
- prefix dl_use_deps
- key dl_use_deps_standard "Behave as standard"
- key dl_use_deps_take_all "Take both sides of use conditionals except on masks"
-
- doxygen_comment <<"END"
- /**
- * How we handle use deps.
- *
- * Not for end user use. Used by adjutrix and qa.
- *
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListEntryState()
-{
- prefix dle
- want_destringify
-
- key dle_no_deps "Dependencies have yet to be added"
- key dle_has_pre_deps "Predependencies have been added"
- key dle_has_all_deps "All dependencies have been added"
-
- doxygen_comment <<"END"
- /**
- * State of a DepListEntry.
- *
- * \ingroup g_dep_list
- */
-END
-}
-
-make_enum_DepListEntryKind()
-{
- prefix dlk
- want_destringify
-
- key dlk_package "A package to be installed"
- key dlk_subpackage "A package to be installed as part of the previous dlk_package"
- key dlk_already_installed "An already installed package"
- key dlk_virtual "A virtual package"
- key dlk_provided "A package provided by the previous dlk_package"
- key dlk_suggested "A package suggested by the previous dlk_package"
- key dlk_block "A blocked package that must be removed"
- key dlk_masked "A masked package that must be unmasked"
-
- doxygen_comment <<"END"
- /**
- * Kind of a DepListEntry.
- *
- * \ingroup g_dep_list
- */
-END
-}
-
diff --git a/paludis/legacy/find_unused_packages_task.cc b/paludis/legacy/find_unused_packages_task.cc
deleted file mode 100644
index c896e1f..0000000
--- a/paludis/legacy/find_unused_packages_task.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Danny van Dyk
- *
- * 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/legacy/find_unused_packages_task.hh>
-#include <paludis/environment.hh>
-#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/package_id.hh>
-#include <paludis/selection.hh>
-#include <paludis/filter.hh>
-#include <paludis/generator.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/set.hh>
-
-#include <set>
-
-using namespace paludis;
-
-namespace
-{
- std::string slot_as_string(const std::shared_ptr<const PackageID> & id)
- {
- if (id->slot_key())
- return stringify(id->slot_key()->value());
- else
- return "(none)";
- }
-}
-
-FindUnusedPackagesTask::~FindUnusedPackagesTask()
-{
-}
-
-std::shared_ptr<const PackageIDSequence>
-FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
-{
- std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>());
- std::shared_ptr<const PackageIDSequence> packages((*_env)[selection::AllVersionsGroupedBySlot(
- generator::InRepository(_repo->name()) &
- generator::Package(package)
- )]);
-
- std::string old_slot("I am not a slot");
- std::set<KeywordName> keywords;
- for (PackageIDSequence::ReverseConstIterator p(packages->rbegin()), p_end(packages->rend()) ;
- p != p_end ; ++p)
- {
- if (! (*p)->keywords_key())
- continue;
-
- if (slot_as_string(*p) != old_slot)
- {
- keywords.clear();
- old_slot = slot_as_string(*p);
- }
-
- std::shared_ptr<const KeywordNameSet> current_keywords((*p)->keywords_key()->value());
- bool used(false);
- for (KeywordNameSet::ConstIterator k(current_keywords->begin()), k_end(current_keywords->end()) ;
- k != k_end ; ++k)
- {
- std::string stable_keyword(stringify(*k));
- if (stable_keyword[0] == '-')
- continue;
-
- if (stable_keyword[0] == '~')
- stable_keyword.erase(0, 1);
-
- if ((keywords.end() == keywords.find(*k)) && (keywords.end() == keywords.find(KeywordName(stable_keyword))))
- {
- used = true;
- break;
- }
- }
-
- if (! used)
- result->push_back(*p);
-
- keywords.insert(current_keywords->begin(), current_keywords->end());
- }
-
- return result;
-}
-
diff --git a/paludis/legacy/find_unused_packages_task.hh b/paludis/legacy/find_unused_packages_task.hh
deleted file mode 100644
index 7e56566..0000000
--- a/paludis/legacy/find_unused_packages_task.hh
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Danny van Dyk
- *
- * 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_FIND_UNUSED_PACKAGES_TASK_HH
-#define PALUDIS_GUARD_PALUDIS_FIND_UNUSED_PACKAGES_TASK_HH 1
-
-#include <paludis/package_id-fwd.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/environment-fwd.hh>
-#include <paludis/repository-fwd.hh>
-
-/** \file
- * Declarations for FindUnusedPackagesTask.
- *
- * \ingroup g_tasks
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Task to find unused package versions for a given package name.
- *
- * \ingroup g_tasks
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE FindUnusedPackagesTask
- {
- private:
- const Environment * const _env;
- const Repository * const _repo;
-
- public:
- ///\name Basic operations
- ///\{
-
- FindUnusedPackagesTask(const Environment * const env, const Repository * const repo) :
- _env(env),
- _repo(repo)
- {
- }
-
- virtual ~FindUnusedPackagesTask();
-
- FindUnusedPackagesTask(const FindUnusedPackagesTask &) = delete;
- FindUnusedPackagesTask & operator= (const FindUnusedPackagesTask &) = delete;
-
- ///\}
-
- /**
- * Run the task.
- */
- std::shared_ptr<const PackageIDSequence> execute(const QualifiedPackageName &);
- };
-}
-
-#endif
diff --git a/paludis/legacy/handled_information-fwd.hh b/paludis/legacy/handled_information-fwd.hh
deleted file mode 100644
index 2942b9a..0000000
--- a/paludis/legacy/handled_information-fwd.hh
+++ /dev/null
@@ -1,42 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 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_HANDLED_INFORMATION_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_HANDLED_INFORMATION_FWD_HH 1
-
-/** \file
- * Forward declarations for paludis/handled_information.hh .
- *
- * \ingroup g_dep_list
- */
-
-namespace paludis
-{
- class DepListEntryHandled;
- class DepListEntryHandledFetchSuccess;
- class DepListEntryHandledFetchFailed;
- class DepListEntryHandledSuccess;
- class DepListEntryHandledSkippedUnsatisfied;
- class DepListEntryHandledSkippedDependent;
- class DepListEntryHandledFailed;
- class DepListEntryUnhandled;
- class DepListEntryNoHandlingRequired;
-}
-
-#endif
diff --git a/paludis/legacy/handled_information.cc b/paludis/legacy/handled_information.cc
deleted file mode 100644
index 48229ea..0000000
--- a/paludis/legacy/handled_information.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2010, 2011 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/legacy/handled_information.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/dep_spec.hh>
-
-using namespace paludis;
-
-DepListEntryHandled::~DepListEntryHandled()
-{
-}
-
-namespace paludis
-{
- template <>
- struct Imp<DepListEntryHandledSkippedUnsatisfied>
- {
- const PackageDepSpec spec;
-
- Imp(const PackageDepSpec & s) :
- spec(s)
- {
- }
- };
-}
-
-DepListEntryHandledSkippedUnsatisfied::DepListEntryHandledSkippedUnsatisfied(const PackageDepSpec & s) :
- _imp(s)
-{
-}
-
-DepListEntryHandledSkippedUnsatisfied::~DepListEntryHandledSkippedUnsatisfied()
-{
-}
-
-const PackageDepSpec
-DepListEntryHandledSkippedUnsatisfied::spec() const
-{
- return _imp->spec;
-}
-
-namespace paludis
-{
- template <>
- struct Imp<DepListEntryHandledSkippedDependent>
- {
- const std::shared_ptr<const PackageID> id;
-
- Imp(const std::shared_ptr<const PackageID> & i) :
- id(i)
- {
- }
- };
-}
-
-DepListEntryHandledSkippedDependent::DepListEntryHandledSkippedDependent(const std::shared_ptr<const PackageID> & i) :
- _imp(i)
-{
-}
-
-DepListEntryHandledSkippedDependent::~DepListEntryHandledSkippedDependent()
-{
-}
-
-const std::shared_ptr<const PackageID>
-DepListEntryHandledSkippedDependent::id() const
-{
- return _imp->id;
-}
-
-
diff --git a/paludis/legacy/handled_information.hh b/paludis/legacy/handled_information.hh
deleted file mode 100644
index d03fbad..0000000
--- a/paludis/legacy/handled_information.hh
+++ /dev/null
@@ -1,208 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2009, 2010, 2011 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_HANDLED_INFORMATION_HH
-#define PALUDIS_GUARD_PALUDIS_HANDLED_INFORMATION_HH 1
-
-#include <paludis/legacy/handled_information-fwd.hh>
-#include <paludis/util/simple_visitor.hh>
-#include <paludis/util/attributes.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/util/type_list.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-
-/** \file
- * Declarations for DepListEntryHandled classes, which are used by DepList and
- * InstallTask to keep track of whether a DepListEntry has been handled yet.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Represents a DepListEntry that has been handled.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandled :
- public virtual DeclareAbstractAcceptMethods<DepListEntryHandled, MakeTypeList<
- DepListEntryHandledSuccess,
- DepListEntryHandledFetchSuccess,
- DepListEntryHandledFetchFailed,
- DepListEntryHandledSkippedUnsatisfied,
- DepListEntryHandledSkippedDependent,
- DepListEntryHandledFailed,
- DepListEntryUnhandled,
- DepListEntryNoHandlingRequired>::Type>
- {
- public:
- virtual ~DepListEntryHandled() = 0;
- };
-
- /**
- * Represents a DepListEntry that has not been handled.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryUnhandled :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryUnhandled>
- {
- };
-
- /**
- * Represents a DepListEntry that requires no handling.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryNoHandlingRequired :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryNoHandlingRequired>
- {
- };
-
- /**
- * Represents a DepListEntry that has been handled successfully.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledSuccess :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSuccess>
- {
- };
-
- /**
- * Represents a DepListEntry that has been fetched successfully, but has
- * not yet started its install.
- *
- * \ingroup g_dep_list
- * \since 0.38
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledFetchSuccess :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledFetchSuccess>
- {
- };
-
- /**
- * Represents a DepListEntry that was skipped because of unsatisfied
- * dependencies.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledSkippedUnsatisfied :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSkippedUnsatisfied>
- {
- private:
- Pimp<DepListEntryHandledSkippedUnsatisfied> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- DepListEntryHandledSkippedUnsatisfied(const PackageDepSpec &);
- ~DepListEntryHandledSkippedUnsatisfied();
-
- ///\}
-
- /**
- * What PackageDepSpec was unsatisfied? If multiple specs were
- * unsatisfied, returns one of them.
- */
- const PackageDepSpec spec() const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- /**
- * Represents a DepListEntry that was skipped because of a dependency upon a
- * failed package.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledSkippedDependent :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSkippedDependent>
- {
- private:
- Pimp<DepListEntryHandledSkippedDependent> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- DepListEntryHandledSkippedDependent(const std::shared_ptr<const PackageID> &);
- ~DepListEntryHandledSkippedDependent();
-
- ///\}
-
- /**
- * Upon which PackageID are we dependent? If multiple dependent IDs are
- * unsatisfied, returns one of them.
- */
- const std::shared_ptr<const PackageID> id() const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- /**
- * Represents a DepListEntry that failed.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledFailed :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledFailed>
- {
- };
-
- /**
- * Represents a DepListEntry that failed its fetch.
- *
- * \ingroup g_dep_list
- * \since 0.38
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DepListEntryHandledFetchFailed :
- public DepListEntryHandled,
- public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledFetchFailed>
- {
- };
-}
-
-#endif
diff --git a/paludis/legacy/install_task.cc b/paludis/legacy/install_task.cc
deleted file mode 100644
index 1156ad6..0000000
--- a/paludis/legacy/install_task.cc
+++ /dev/null
@@ -1,1978 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/install_task.hh>
-#include <paludis/legacy/handled_information.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/action.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/util/exception.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/hook.hh>
-#include <paludis/repository.hh>
-#include <paludis/match_package.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_id.hh>
-#include <paludis/version_requirements.hh>
-#include <paludis/legacy/tasks_exceptions.hh>
-#include <paludis/selection.hh>
-#include <paludis/filter.hh>
-#include <paludis/generator.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/package_dep_spec_properties.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/set-impl.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/destringify.hh>
-#include <paludis/util/make_shared_copy.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/create_output_manager_info.hh>
-#include <paludis/output_manager_from_environment.hh>
-#include <paludis/output_manager.hh>
-#include <paludis/standard_output_manager.hh>
-#include <functional>
-#include <sstream>
-#include <algorithm>
-#include <list>
-#include <vector>
-#include <set>
-
-using namespace paludis;
-
-#include <paludis/legacy/install_task-se.cc>
-
-namespace
-{
- WantPhase want_all_phases_function(
- InstallTask * const task,
- OutputManagerFromEnvironment & output_manager_holder,
- bool & done_any, const std::string & phase)
- {
- output_manager_holder.construct_standard_if_unconstructed();
- task->on_phase_proceed_unconditionally(output_manager_holder.output_manager_if_constructed(), phase);
- done_any = true;
- return wp_yes;
- }
-
- WantPhase want_phase_function(
- InstallTask * const task,
- OutputManagerFromEnvironment & output_manager_holder,
- const std::shared_ptr<const Set<std::string> > & abort_at_phases,
- const std::shared_ptr<const Set<std::string> > & skip_phases,
- const std::shared_ptr<const Set<std::string> > & skip_until_phases,
- bool & done_any, const std::string & phase)
- {
- output_manager_holder.construct_standard_if_unconstructed();
- if (abort_at_phases->end() != abort_at_phases->find(phase))
- {
- task->on_phase_abort(output_manager_holder.output_manager_if_constructed(), phase);
- return wp_abort;
- }
-
- if (! skip_until_phases->empty())
- if (! done_any)
- if (skip_until_phases->end() == skip_until_phases->find(phase))
- {
- task->on_phase_skip_until(output_manager_holder.output_manager_if_constructed(), phase);
- return wp_skip;
- }
-
- /* make --skip-until-phase foo --skip-phase foo work */
- done_any = true;
-
- if (skip_phases->end() != skip_phases->find(phase))
- {
- task->on_phase_skip(output_manager_holder.output_manager_if_constructed(), phase);
- return wp_skip;
- }
-
- task->on_phase_proceed_conditionally(output_manager_holder.output_manager_if_constructed(), phase);
- return wp_yes;
- }
-}
-
-namespace paludis
-{
- template<>
- struct Imp<InstallTask>
- {
- Environment * const env;
- DepList dep_list;
-
- std::list<std::string> raw_targets;
- std::shared_ptr<SetSpecTree> targets;
- std::shared_ptr<std::string> add_to_world_spec;
- std::shared_ptr<const DestinationsSet> destinations;
-
- bool pretend;
- bool fetch_only;
- bool preserve_world;
- bool safe_resume;
-
- bool had_set_targets;
- bool had_package_targets;
- bool override_target_type;
-
- InstallTaskContinueOnFailure continue_on_failure;
-
- std::shared_ptr<const Set<std::string> > abort_at_phases;
- std::shared_ptr<const Set<std::string> > skip_phases;
- std::shared_ptr<const Set<std::string> > skip_until_phases;
-
- bool phase_options_apply_to_first;
- bool phase_options_apply_to_last;
- bool phase_options_apply_to_all;
-
- bool had_resolution_failures;
-
- Imp<InstallTask>(Environment * const e, const DepListOptions & o,
- std::shared_ptr<const DestinationsSet> d) :
- env(e),
- dep_list(e, o),
- targets(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())),
- destinations(d),
- pretend(false),
- fetch_only(false),
- preserve_world(false),
- safe_resume(false),
- had_set_targets(false),
- had_package_targets(false),
- override_target_type(false),
- continue_on_failure(itcof_if_fetch_only),
- abort_at_phases(std::make_shared<Set<std::string>>()),
- skip_phases(std::make_shared<Set<std::string>>()),
- skip_until_phases(std::make_shared<Set<std::string>>()),
- phase_options_apply_to_first(false),
- phase_options_apply_to_last(false),
- phase_options_apply_to_all(false),
- had_resolution_failures(false)
- {
- }
- };
-
- template <>
- struct WrappedForwardIteratorTraits<InstallTask::TargetsConstIteratorTag>
- {
- typedef std::list<std::string>::const_iterator UnderlyingIterator;
- };
-}
-
-InstallTask::InstallTask(Environment * const env, const DepListOptions & options,
- const std::shared_ptr<const DestinationsSet> & d) :
- _imp(env, options, d)
-{
-}
-
-InstallTask::~InstallTask()
-{
-}
-
-void
-InstallTask::clear()
-{
- _imp->targets = std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>());
- _imp->had_set_targets = false;
- _imp->had_package_targets = false;
- _imp->dep_list.clear();
- _imp->raw_targets.clear();
- _imp->had_package_targets = false;
-}
-
-void
-InstallTask::set_targets_from_user_specs(const std::shared_ptr<const Sequence<std::string> > & s)
-{
- using namespace std::placeholders;
- std::for_each(s->begin(), s->end(), std::bind(&InstallTask::_add_target, this, _1));
-}
-
-void
-InstallTask::set_targets_from_exact_packages(const std::shared_ptr<const PackageIDSequence> & s)
-{
- using namespace std::placeholders;
- std::for_each(s->begin(), s->end(), std::bind(&InstallTask::_add_package_id, this, _1));
-}
-
-namespace
-{
- std::shared_ptr<DepListEntryHandled> handled_from_string(const std::string & s,
- const Environment * const env)
- {
- Context context("When decoding DepListEntryHandled value '" + s + "':");
-
- if (s.empty())
- throw InternalError(PALUDIS_HERE, "Empty DepListEntryHandled value");
-
- switch (s.at(0))
- {
- case 'S':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "S takes no extra value");
- return std::make_shared<DepListEntryHandledSuccess>();
-
- case 'E':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "E takes no extra value");
- return std::make_shared<DepListEntryHandledFetchFailed>();
-
- case 'T':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "T takes no extra value");
- return std::make_shared<DepListEntryHandledFetchSuccess>();
-
- case 'U':
- return std::make_shared<DepListEntryHandledSkippedUnsatisfied>(
- parse_user_package_dep_spec(s.substr(1), env, { }));
-
- case 'D':
- return std::make_shared<DepListEntryHandledSkippedDependent>(
- *(*env)[selection::RequireExactlyOne(generator::Matches(
- parse_user_package_dep_spec(s.substr(1), env,
- { }), make_null_shared_ptr(), { }))]->begin());
-
- case 'F':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "F takes no extra value");
- return std::make_shared<DepListEntryHandledFailed>();
-
- case 'P':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "P takes no extra value");
- return std::make_shared<DepListEntryUnhandled>();
-
- case 'N':
- if (s.length() != 1)
- throw InternalError(PALUDIS_HERE, "N takes no extra value");
- return std::make_shared<DepListEntryNoHandlingRequired>();
-
- default:
- throw InternalError(PALUDIS_HERE, "Unknown value '" + s + "'");
- }
- }
-}
-
-void
-InstallTask::set_targets_from_serialisation(const std::string & format,
- const std::shared_ptr<const Sequence<std::string> > & ss)
-{
- if (format != "0.25" && format != "0.37")
- throw InternalError(PALUDIS_HERE, "Serialisation format '" + format + "' not supported by this version of Paludis");
-
- for (Sequence<std::string>::ConstIterator s(ss->begin()), s_end(ss->end()) ;
- s != s_end ; ++s)
- {
- Context context("When adding serialised entry '" + *s + "':");
-
- std::list<std::string> tokens;
- tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(*s, ";", "", std::back_inserter(tokens));
-
- if (tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no kind");
- const DepListEntryKind kind(destringify<DepListEntryKind>(*tokens.begin()));
- tokens.pop_front();
-
- if (tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no package_id");
- const std::shared_ptr<const PackageID> package_id(*(*_imp->env)[selection::RequireExactlyOne(
- generator::Matches(parse_user_package_dep_spec(*tokens.begin(),
- _imp->env, { }), make_null_shared_ptr(), { }))]->begin());
- tokens.pop_front();
-
- if (tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no destination");
- std::shared_ptr<Repository> destination;
- if ("0" != *tokens.begin())
- destination = _imp->env->package_database()->fetch_repository(RepositoryName(*tokens.begin()));
- tokens.pop_front();
-
- if (tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no state");
- const DepListEntryState state(destringify<DepListEntryState>(*tokens.begin()));
- tokens.pop_front();
-
- if (tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no handled");
- std::shared_ptr<DepListEntryHandled> handled(handled_from_string(*tokens.begin(), _imp->env));
- tokens.pop_front();
-
- if (! tokens.empty())
- throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too long");
-
- _imp->dep_list.push_back(make_named_values<DepListEntry>(
- n::associated_entry() = static_cast<DepListEntry *>(0),
- n::destination() = destination,
- n::generation() = 0,
- n::handled() = handled,
- n::kind() = kind,
- n::package_id() = package_id,
- n::state() = state,
- n::tags() = std::make_shared<DepListEntryTags>()
- ));
- }
-}
-
-std::string
-InstallTask::serialised_format() const
-{
- return "0.37";
-}
-
-namespace
-{
- struct HandledDisplayer
- {
- std::string result;
- const bool undo_failures;
-
- HandledDisplayer(const bool b) :
- undo_failures(b)
- {
- }
-
- void visit(const DepListEntryNoHandlingRequired &)
- {
- result = "N";
- }
-
- void visit(const DepListEntryHandledSuccess &)
- {
- result = "S";
- }
-
- void visit(const DepListEntryHandledFetchFailed &)
- {
- if (undo_failures)
- result = "P";
- else
- result = "E";
- }
-
- void visit(const DepListEntryHandledFetchSuccess &)
- {
- result = "T";
- }
-
- void visit(const DepListEntryHandledFailed &)
- {
- if (undo_failures)
- result = "P";
- else
- result = "F";
- }
-
- void visit(const DepListEntryUnhandled &)
- {
- result = "P";
- }
-
- void visit(const DepListEntryHandledSkippedUnsatisfied & s)
- {
- if (undo_failures)
- result = "P";
- else
- result = "U" + stringify(s.spec());
- }
-
- void visit(const DepListEntryHandledSkippedDependent & s)
- {
- if (undo_failures)
- result = "P";
- else
- result = "D=" + stringify(*s.id());
- }
- };
-}
-
-std::string
-InstallTask::serialise(const bool undo_failures) const
-{
- std::ostringstream result;
-
- for (DepList::ConstIterator d(_imp->dep_list.begin()), d_end(_imp->dep_list.end()) ;
- d != d_end ; ++d)
- {
- switch (d->kind())
- {
- case dlk_already_installed:
- case dlk_virtual:
- case dlk_provided:
- case dlk_block:
- case dlk_masked:
- case dlk_suggested:
- continue;
-
- case dlk_package:
- case dlk_subpackage:
- break;
-
- case last_dlk:
- throw InternalError(PALUDIS_HERE, "Bad d->kind");
- }
-
- if (! result.str().empty())
- result << " ";
-
- result << "'";
-
- result << d->kind() << ";";
-
- result << "=" << *d->package_id() << ";";
-
- if (d->destination())
- result << d->destination()->name() << ";";
- else
- result << "0" << ";";
-
- result << d->state() << ";";
-
- HandledDisplayer h(undo_failures);
- d->handled()->accept(h);
- result << h.result;
-
- result << "'";
- }
-
- return result.str();
-}
-
-void
-InstallTask::_add_target(const std::string & target)
-{
- Context context("When adding install target '" + target + "':");
-
- std::shared_ptr<SetSpecTree> s;
-
- try
- {
- std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(target,
- _imp->env, { updso_throw_if_set, updso_allow_wildcards },
- filter::SupportsAction<InstallAction>())));
-
- bool spec_is_installed(false);
-
- if (spec->in_repository_ptr() &&
- _imp->env->package_database()->has_repository_named(*spec->in_repository_ptr()) &&
- _imp->env->package_database()->fetch_repository(*spec->in_repository_ptr())->installed_root_key())
- spec_is_installed = true;
- else if (spec->from_repository_ptr())
- spec_is_installed = true;
- else if (spec->installed_at_path_ptr())
- spec_is_installed = true;
-
- if (spec_is_installed)
- Log::get_instance()->message("install_task.installed_spec", ll_warning, lc_context)
- << "Target '" << target << "' appears to make use of ::repository restrictions "
- << "that restrict to an installed repository. This probably does not do what you "
- << "think it does. Consult the FAQ for an explanation";
-
- if (_imp->had_set_targets)
- throw HadBothPackageAndSetTargets();
- _imp->had_package_targets = true;
- if (! _imp->override_target_type)
- _imp->dep_list.options()->target_type() = dl_target_package;
-
- if (spec->package_ptr())
- {
- /* no wildcards */
- spec->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets->top()->append(spec);
- }
- else
- {
- std::shared_ptr<const PackageIDSequence> names((*_imp->env)[selection::BestVersionOnly(
- generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>())]);
-
- if (names->empty())
- {
- /* no match. we'll get an error from this later anyway. */
- spec->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets->top()->append(spec);
- }
- else
- for (PackageIDSequence::ConstIterator i(names->begin()), i_end(names->end()) ;
- i != i_end ; ++i)
- {
- PartiallyMadePackageDepSpec p(*spec);
- p.package((*i)->name());
- std::shared_ptr<PackageDepSpec> specn(std::make_shared<PackageDepSpec>(p));
- specn->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets->top()->append(specn);
- }
- }
-
- _imp->raw_targets.push_back(stringify(*spec));
- }
- catch (const GotASetNotAPackageDepSpec &)
- {
- if (_imp->had_set_targets)
- throw MultipleSetTargetsSpecified();
- if (_imp->had_package_targets)
- throw HadBothPackageAndSetTargets();
- _imp->had_set_targets = true;
-
- _imp->targets->top()->append(std::make_shared<NamedSetDepSpec>(SetName(target)));
- if (! _imp->override_target_type)
- _imp->dep_list.options()->target_type() = dl_target_set;
-
- _imp->raw_targets.push_back(stringify(target));
- }
-}
-
-void
-InstallTask::_add_package_id(const std::shared_ptr<const PackageID> & target)
-{
- Context context("When adding install target '" + stringify(*target) + "' from ID:");
-
- if (_imp->had_set_targets)
- {
- _imp->had_resolution_failures = true;
- throw HadBothPackageAndSetTargets();
- }
-
- _imp->had_package_targets = true;
- if (! _imp->override_target_type)
- _imp->dep_list.options()->target_type() = dl_target_package;
-
- PartiallyMadePackageDepSpec part_spec({ });
- part_spec.package(target->name());
- part_spec.in_repository(target->repository_name());
- part_spec.version_requirement(make_named_values<VersionRequirement>(
- n::version_operator() = vo_equal,
- n::version_spec() = target->version()));
-
- if (target->slot_key())
- part_spec.slot_requirement(std::make_shared<UserSlotExactRequirement>(target->slot_key()->value()));
-
- std::shared_ptr<PackageDepSpec> spec(make_shared_copy(PackageDepSpec(part_spec)));
- spec->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets->top()->append(spec);
-
- _imp->raw_targets.push_back(stringify(*spec));
-}
-
-void
-InstallTask::_build_dep_list()
-{
- Context context("When building dependency list:");
-
- on_build_deplist_pre();
- _imp->dep_list.add(*_imp->targets, _imp->destinations);
- on_build_deplist_post();
-}
-
-void
-InstallTask::_display_task_list()
-{
- Context context("When displaying task list:");
-
- if (_imp->pretend &&
- 0 != perform_hook(Hook("install_pretend_pre")
- ("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors())),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Pretend install aborted by hook");
-
- on_display_merge_list_pre();
-
- /* display our task list */
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- {
- if (_imp->pretend &&
- 0 != perform_hook(Hook("install_pretend_display_item_pre")
- ("TARGET", stringify(*dep->package_id()))
- ("KIND", stringify(dep->kind())),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Pretend install aborted by hook");
-
- on_display_merge_list_entry(*dep);
-
- if (_imp->pretend &&
- 0 != perform_hook(Hook("install_pretend_display_item_post")
- ("TARGET", stringify(*dep->package_id()))
- ("KIND", stringify(dep->kind())),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Pretend install aborted by hook");
- }
-
- /* we're done displaying our task list */
- on_display_merge_list_post();
-}
-
-namespace
-{
- struct SummaryVisitor
- {
- int total, successes, skipped, failures, unreached;
- InstallTask & task;
- const DepListEntry * entry;
-
- SummaryVisitor(InstallTask & t) :
- total(0),
- successes(0),
- skipped(0),
- failures(0),
- unreached(0),
- task(t),
- entry(0)
- {
- }
-
- void visit(const DepListEntryHandledSkippedUnsatisfied & s)
- {
- ++skipped;
- ++total;
- task.on_display_failure_summary_skipped_unsatisfied(*entry, s.spec());
- }
-
- void visit(const DepListEntryHandledSkippedDependent & s)
- {
- ++skipped;
- ++total;
- task.on_display_failure_summary_skipped_dependent(*entry, s.id());
- }
-
- void visit(const DepListEntryHandledFailed &)
- {
- ++failures;
- ++total;
- task.on_display_failure_summary_failure(*entry);
- }
-
- void visit(const DepListEntryHandledFetchFailed &)
- {
- ++failures;
- ++total;
- task.on_display_failure_summary_failure(*entry);
- }
-
- void visit(const DepListEntryUnhandled &)
- {
- ++unreached;
- ++total;
- }
-
- void visit(const DepListEntryHandledFetchSuccess &)
- {
- ++unreached;
- ++total;
- }
-
- void visit(const DepListEntryNoHandlingRequired &)
- {
- }
-
- void visit(const DepListEntryHandledSuccess &)
- {
- ++successes;
- ++total;
- task.on_display_failure_summary_success(*entry);
- }
- };
-
- WantPhase want_all_phases(const std::string &)
- {
- return wp_yes;
- }
-}
-
-void
-InstallTask::_display_failure_summary()
-{
- Context context("When displaying summary:");
-
- if (! had_action_failures())
- return;
-
- on_display_failure_summary_pre();
-
- /* display our summary */
- SummaryVisitor s(*this);
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- {
- s.entry = &*dep;
- dep->handled()->accept(s);
- }
-
- /* we're done displaying our task list */
- on_display_failure_summary_totals(s.total, s.successes, s.skipped, s.failures, s.unreached);
- on_display_failure_summary_post();
-}
-
-bool
-InstallTask::_pretend()
-{
- Context context("When performing pretend actions:");
-
- bool pretend_failed(false);
-
- on_pretend_all_pre();
-
- SupportsActionTest<PretendAction> pretend_action_query;
- SupportsActionTest<FetchAction> fetch_action_query;
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- {
- if ((dlk_package != dep->kind()) || already_done(*dep))
- continue;
-
- if (dep->package_id()->supports_action(pretend_action_query) ||
- dep->package_id()->supports_action(fetch_action_query))
- {
- on_pretend_pre(*dep);
-
- OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive,
- ClientOutputFeatures());
-
- bool success(true);
- if (dep->package_id()->supports_action(pretend_action_query))
- {
- std::shared_ptr<PackageIDSequence> replacing;
-
- // look for packages with the same name in the same slot in the destination repos
- if (dep->destination())
- replacing = (*_imp->env)[selection::AllVersionsSorted(
- (generator::Package(dep->package_id()->name()) &
- generator::InRepository(dep->destination()->name())) |
- filter::SupportsAction<UninstallAction>() |
- filter::SameSlot(dep->package_id()))];
- else
- replacing = std::make_shared<PackageIDSequence>();
-
- PretendActionOptions options(make_named_values<PretendActionOptions>(
- n::destination() = dep->destination(),
- n::make_output_manager() = std::ref(output_manager_holder),
- n::replacing() = replacing
- ));
- PretendAction pretend_action(options);
- dep->package_id()->perform_action(pretend_action);
- if (pretend_action.failed())
- {
- pretend_failed = true;
- success = false;
- dep->handled() = std::make_shared<DepListEntryHandledFailed>();
- }
- }
-
- if (dep->package_id()->supports_action(fetch_action_query))
- {
- FetchActionOptions options(make_named_values<FetchActionOptions>(
- n::errors() = std::make_shared<Sequence<FetchActionFailure>>(),
- n::exclude_unmirrorable() = false,
- n::fetch_parts() = FetchParts() + fp_regulars + fp_extras,
- n::ignore_not_in_manifest() = false,
- n::ignore_unfetched() = true,
- n::make_output_manager() = std::ref(output_manager_holder),
- n::safe_resume() = _imp->safe_resume,
- n::want_phase() = &want_all_phases
- ));
- FetchAction fetch_action(options);
- try
- {
- dep->package_id()->perform_action(fetch_action);
- }
- catch (const ActionFailedError & e)
- {
- pretend_failed = true;
- success = false;
- if (output_manager_holder.output_manager_if_constructed())
- on_fetch_action_error(output_manager_holder.output_manager_if_constructed(), e,
- options.errors());
- else
- on_fetch_action_error(std::make_shared<StandardOutputManager>(), e,
- options.errors());
- }
- }
-
- if (success)
- {
- if (output_manager_holder.output_manager_if_constructed())
- output_manager_holder.output_manager_if_constructed()->succeeded();
- }
-
- on_pretend_post(*dep);
- }
- }
-
- on_pretend_all_post();
-
- if (_imp->pretend)
- {
- if (0 != perform_hook(Hook("install_pretend_post")
- ("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors())),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Pretend install aborted by hook");
- }
-
- return pretend_failed;
-}
-
-void
-InstallTask::_clean(
- const DepList::Iterator dep,
- const std::shared_ptr<const PackageID> & id,
- const UninstallActionOptions & options,
- const std::string & cpvr,
- const int x, const int y, const int s, const int f)
-{
- /* clean one item */
- if (0 != perform_hook(Hook("clean_pre")("TARGET", stringify(*id))
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Clean of '" + cpvr + "' aborted by hook");
- on_clean_pre(*dep, *id, x, y, s, f);
-
- try
- {
- UninstallAction uninstall_action(options);
- id->perform_action(uninstall_action);
- }
- catch (const ActionFailedError & e)
- {
- on_clean_fail(*dep, *id, x, y, s, f);
- HookResult PALUDIS_ATTRIBUTE((unused)) dummy(perform_hook(Hook("clean_fail")
- ("TARGET", stringify(*id))("MESSAGE", e.message()),
- make_null_shared_ptr()));
- throw;
- }
-
- on_clean_post(*dep, *id, x, y, s, f);
- if (0 != perform_hook(Hook("clean_post")("TARGET", stringify(*id))
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Clean of '" + cpvr + "' aborted by hook");
-}
-
-void
-InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const int s, const int f, const bool is_first, const bool is_last,
- std::shared_ptr<OutputManagerFromEnvironment> & output_manager_holder)
-{
- std::string cpvr(stringify(*dep->package_id()));
-
- bool live_destination(false);
- if (dep->destination())
- if ((*dep->destination()).destination_interface() && (*dep->destination()).destination_interface()->want_pre_post_phases())
- live_destination = true;
-
- if (already_done(*dep))
- {
- on_skip_already_done(*dep, x, y, s, f);
- return;
- }
-
- /* we're about to fetch / install one item */
- if (_imp->fetch_only)
- {
- if (0 != perform_hook(Hook("fetch_pre")
- ("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Fetch of '" + cpvr + "' aborted by hook");
- on_fetch_pre(*dep, x, y, s, f);
- }
- else
- {
- if (0 != perform_hook(Hook("install_pre")
- ("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))
- ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes"),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install of '" + cpvr + "' aborted by hook");
- on_install_pre(*dep, x, y, s, f);
- }
-
- /* fetch / install one item */
- try
- {
- SupportsActionTest<FetchAction> test_fetch;
- if (dep->package_id()->supports_action(test_fetch))
- {
- output_manager_holder = std::make_shared<OutputManagerFromEnvironment>(_imp->env, dep->package_id(), oe_exclusive,
- ClientOutputFeatures());
- FetchActionOptions fetch_options(make_fetch_action_options(*dep, *output_manager_holder));
- FetchAction fetch_action(fetch_options);
- dep->package_id()->perform_action(fetch_action);
- if (output_manager_holder->output_manager_if_constructed())
- output_manager_holder->output_manager_if_constructed()->succeeded();
- output_manager_holder.reset();
- dep->handled() = std::make_shared<DepListEntryHandledFetchSuccess>();
- }
-
- if (! _imp->fetch_only)
- {
- output_manager_holder = std::make_shared<OutputManagerFromEnvironment>(_imp->env, dep->package_id(),
- oe_exclusive, ClientOutputFeatures());
-
- std::shared_ptr<PackageIDSequence> replacing;
-
- // look for packages with the same name in the same slot in the destination repos
- if (dep->destination())
- replacing = (*_imp->env)[selection::AllVersionsSorted(
- (generator::Package(dep->package_id()->name()) &
- generator::InRepository(dep->destination()->name())) |
- filter::SupportsAction<UninstallAction>() |
- filter::SameSlot(dep->package_id()))];
- else
- replacing = std::make_shared<PackageIDSequence>();
-
- InstallActionOptions install_options(make_named_values<InstallActionOptions>(
- n::destination() = dep->destination(),
- n::make_output_manager() = std::ref(*output_manager_holder),
- n::perform_uninstall() = std::bind(&InstallTask::_clean, this, dep,
- std::placeholders::_1, std::placeholders::_2, cpvr, x, y, s, f),
- n::replacing() = replacing,
- n::want_phase() = std::function<WantPhase (const std::string &)>()
- ));
-
- bool done_any(false);
-
- bool apply_phases(false);
- if (! _imp->abort_at_phases->empty() || ! _imp->skip_phases->empty() || ! _imp->skip_until_phases->empty())
- {
- if (is_first && _imp->phase_options_apply_to_first)
- apply_phases = true;
- if (is_last && _imp->phase_options_apply_to_last)
- apply_phases = true;
- if (_imp->phase_options_apply_to_all)
- apply_phases = true;
- }
- if (apply_phases)
- install_options.want_phase() = std::bind(&want_phase_function, this, std::ref(*output_manager_holder),
- std::cref(_imp->abort_at_phases), std::cref(_imp->skip_phases), std::cref(_imp->skip_until_phases),
- std::ref(done_any), std::placeholders::_1);
- else
- install_options.want_phase() = std::bind(&want_all_phases_function, this, std::ref(*output_manager_holder),
- std::ref(done_any), std::placeholders::_1);
-
- InstallAction install_action(install_options);
- dep->package_id()->perform_action(install_action);
-
- if (output_manager_holder->output_manager_if_constructed())
- output_manager_holder->output_manager_if_constructed()->succeeded();
-
- output_manager_holder.reset();
- }
- }
- catch (const ActionFailedError & e)
- {
- on_install_fail(*dep, x, y, s, f);
- HookResult PALUDIS_ATTRIBUTE((unused)) dummy(perform_hook(Hook("install_fail")("TARGET", cpvr)("MESSAGE", e.message()),
- make_null_shared_ptr()));
- throw;
- }
-
- /* we've fetched / installed one item */
- if (_imp->fetch_only)
- {
- on_fetch_post(*dep, x, y, s, f);
- if (0 != perform_hook(Hook("fetch_post")
- ("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Fetch of '" + cpvr + "' aborted by hook");
- }
- else
- {
- on_install_post(*dep, x, y, s, f);
- if (0 != perform_hook(Hook("install_post")
- ("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))
- ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes"),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install of '" + cpvr + "' aborted by hook");
- }
-
- if (_imp->fetch_only || ! live_destination)
- return;
-
- // manually invalidate repos, they're probably wrong now
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- (*r)->invalidate();
-
- dep->handled() = std::make_shared<DepListEntryHandledSuccess>();
-
- /* if we installed paludis and a re-exec is available, use it. */
- if (_imp->env->is_paludis_package(dep->package_id()->name()))
- {
- DepList::Iterator d(dep);
- do
- {
- ++d;
- if (d == _imp->dep_list.end())
- break;
- }
- while (dlk_package != d->kind());
-
- if (d != _imp->dep_list.end())
- on_installed_paludis();
- }
-}
-
-void
-InstallTask::_main_actions_pre_hooks()
-{
- /* we're about to fetch / install the entire list */
- if (_imp->fetch_only)
- {
- if (0 != perform_hook(Hook("fetch_all_pre")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Fetch aborted by hook");
- on_fetch_all_pre();
- }
- else
- {
- bool any_live_destination(false);
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end && ! any_live_destination ; ++dep)
- if (dlk_package == dep->kind() && dep->destination())
- if ((*dep->destination()).destination_interface() && (*dep->destination()).destination_interface()->want_pre_post_phases())
- any_live_destination = true;
-
- if (0 != perform_hook(Hook("install_all_pre")
- ("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("PALUDIS_NO_LIVE_DESTINATION", any_live_destination ? "" : "yes"),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install aborted by hook");
- on_install_all_pre();
- }
-}
-
-void
-InstallTask::_main_actions_all(const int y, const DepList::Iterator dep_last_package)
-{
- int x(0), s(0), f(0);
- bool is_first(true), is_last(false);
-
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- {
- if (dlk_package != dep->kind())
- continue;
-
- is_last = (dep == dep_last_package);
-
- ++x;
-
- if (had_action_failures())
- {
- switch (_imp->continue_on_failure)
- {
- case itcof_if_fetch_only:
- if (_imp->fetch_only)
- break;
- ++s;
- continue;
-
- case itcof_never:
- ++s;
- continue;
-
- case itcof_if_satisfied:
- {
- std::shared_ptr<const PackageDepSpec> d(_unsatisfied(*dep));
- if (! d)
- break;
- dep->handled() = std::make_shared<DepListEntryHandledSkippedUnsatisfied>(*d);
- on_skip_unsatisfied(*dep, *d, x, y, s, f);
- ++s;
- continue;
- }
-
- case itcof_if_independent:
- {
- std::shared_ptr<const PackageID> d(_dependent(*dep));
- if (! d)
- break;
- dep->handled() = std::make_shared<DepListEntryHandledSkippedDependent>(d);
- on_skip_dependent(*dep, d, x, y, s, f);
- ++s;
- continue;
- }
-
- case itcof_always:
- break;
-
- case last_itcof:
- throw InternalError(PALUDIS_HERE, "Bad continue_on_failure");
- }
- }
-
- std::shared_ptr<OutputManagerFromEnvironment> output_manager_holder;
- try
- {
- _one(dep, x, y, s, f, is_first, is_last, output_manager_holder);
- }
- catch (const ActionFailedError & e)
- {
- dep->handled() = std::make_shared<DepListEntryHandledFailed>();
- if (output_manager_holder && output_manager_holder->output_manager_if_constructed())
- on_non_fetch_action_error(output_manager_holder->output_manager_if_constructed(), e);
- else
- on_non_fetch_action_error(std::make_shared<StandardOutputManager>(), e);
- ++f;
- }
-
- is_first = false;
- }
-}
-
-
-void
-InstallTask::_main_actions()
-{
- using namespace std::placeholders;
-
- _main_actions_pre_hooks();
-
- /* fetch / install our entire list */
- int y(0);
- DepList::Iterator dep_last_package(_imp->dep_list.end());
- for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- if (dep->kind() == dlk_package)
- {
- dep_last_package = dep;
- ++y;
- }
-
- _main_actions_all(y, dep_last_package);
-
- /* go no further if we had failures */
- if (had_action_failures())
- {
- _display_failure_summary();
- return;
- }
-
- _main_actions_post_hooks();
- _do_world_updates();
-}
-
-void
-InstallTask::_do_world_updates()
-{
- /* update world */
- if (! _imp->fetch_only)
- {
- if (! _imp->preserve_world)
- {
- on_update_world_pre();
-
- if (_imp->add_to_world_spec)
- {
- bool s_had_package_targets(_imp->had_package_targets), s_had_set_targets(_imp->had_set_targets);
- if (_imp->add_to_world_spec)
- {
- s_had_package_targets = ((std::string::npos != _imp->add_to_world_spec->find('/')));
- s_had_set_targets = (! s_had_package_targets) && (std::string::npos != _imp->add_to_world_spec->find_first_not_of(
- "() \t\r\n"));
- }
-
- std::shared_ptr<SetSpecTree> all(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- std::list<std::string> tokens;
- tokenise_whitespace(*_imp->add_to_world_spec, std::back_inserter(tokens));
- if ((! tokens.empty()) && ("(" == *tokens.begin()) && (")" == *previous(tokens.end())))
- {
- tokens.erase(tokens.begin());
- tokens.erase(previous(tokens.end()));
- }
-
- for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
- t != t_end ; ++t)
- {
- if (s_had_package_targets)
- all->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(*t, _imp->env,
- { })));
- else
- all->top()->append(std::make_shared<NamedSetDepSpec>(SetName(*t)));
- }
-
- if (s_had_package_targets)
- world_update_packages(all);
- else if (s_had_set_targets)
- world_update_set(SetName(*_imp->add_to_world_spec));
- }
- else
- {
- if (_imp->had_package_targets)
- world_update_packages(_imp->targets);
- else if (_imp->had_set_targets)
- {
- for (std::list<std::string>::const_iterator t(_imp->raw_targets.begin()), t_end(_imp->raw_targets.end()) ;
- t != t_end ; ++t)
- world_update_set(SetName(*t));
- }
- }
-
- on_update_world_post();
- }
- else
- on_preserve_world();
- }
-}
-
-void
-InstallTask::_main_actions_post_hooks()
-{
- /* we've fetched / installed the entire list */
- if (_imp->fetch_only)
- {
- on_fetch_all_post();
- if (0 != perform_hook(Hook("fetch_all_post")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Fetch aborted by hook");
- }
- else
- {
- on_install_all_post();
- if (0 != perform_hook(Hook("install_all_post")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install aborted by hook");
- }
-}
-
-void
-InstallTask::_execute()
-{
- Context context("When executing install task:");
-
- _build_dep_list();
- _display_task_list();
- bool pretend_failed(_pretend());
-
- if (_imp->dep_list.has_errors() || pretend_failed)
- {
- on_not_continuing_due_to_errors();
- return;
- }
-
- if (_imp->pretend)
- return;
-
- _main_actions();
-}
-
-void
-InstallTask::execute()
-{
- bool success(false);
- try
- {
- if (0 != perform_hook(Hook("install_task_execute_pre")
- ("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("PRETEND", stringify(_imp->pretend))
- ("FETCH_ONLY", stringify(_imp->fetch_only))
- ("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ,
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install task execute aborted by hook");
-
- _execute();
- success = true;
- }
- catch (const AmbiguousPackageNameError & e)
- {
- _imp->had_resolution_failures = true;
- on_ambiguous_package_name_error(e);
- }
- catch (const NoSuchPackageError & e)
- {
- _imp->had_resolution_failures = true;
- on_no_such_package_error(e);
- }
- catch (const AllMaskedError & e)
- {
- _imp->had_resolution_failures = true;
- on_all_masked_error(e);
- }
- catch (const AdditionalRequirementsNotMetError & e)
- {
- _imp->had_resolution_failures = true;
- on_additional_requirements_not_met_error(e);
- }
- catch (const DepListError & e)
- {
- _imp->had_resolution_failures = true;
- on_dep_list_error(e);
- }
- catch (const HadBothPackageAndSetTargets & e)
- {
- _imp->had_resolution_failures = true;
- on_had_both_package_and_set_targets_error(e);
- }
- catch (const MultipleSetTargetsSpecified & e)
- {
- _imp->had_resolution_failures = true;
- on_multiple_set_targets_specified(e);
- }
-
- if (0 != perform_hook(Hook("install_task_execute_post")
- ("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("PRETEND", stringify(_imp->pretend))
- ("FETCH_ONLY", stringify(_imp->fetch_only))
- ("SUCCESS", stringify(success))
- ("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ,
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Install task execute aborted by hook");
-}
-
-const DepList &
-InstallTask::dep_list() const
-{
- return _imp->dep_list;
-}
-
-void
-InstallTask::set_fetch_only(const bool value)
-{
- _imp->fetch_only = value;
-}
-
-void
-InstallTask::set_pretend(const bool value)
-{
- _imp->pretend = value;
-}
-
-void
-InstallTask::set_preserve_world(const bool value)
-{
- _imp->preserve_world = value;
-}
-
-void
-InstallTask::set_add_to_world_spec(const std::string & value)
-{
- _imp->add_to_world_spec = std::make_shared<std::string>(value);
-}
-
-InstallTask::TargetsConstIterator
-InstallTask::begin_targets() const
-{
- return TargetsConstIterator(_imp->raw_targets.begin());
-}
-
-InstallTask::TargetsConstIterator
-InstallTask::end_targets() const
-{
- return TargetsConstIterator(_imp->raw_targets.end());
-}
-
-Environment *
-InstallTask::environment()
-{
- return _imp->env;
-}
-
-const Environment *
-InstallTask::environment() const
-{
- return _imp->env;
-}
-
-void
-InstallTask::on_installed_paludis()
-{
-}
-
-void
-InstallTask::set_safe_resume(const bool value)
-{
- _imp->safe_resume = value;
-}
-
-HookResult
-InstallTask::perform_hook(const Hook & hook, const std::shared_ptr<OutputManager> & optional_output_manager)
-{
- return _imp->env->perform_hook(hook, optional_output_manager);
-}
-
-void
-InstallTask::override_target_type(const DepListTargetType t)
-{
- _imp->override_target_type = true;
- _imp->dep_list.options()->target_type() = t;
-}
-
-void
-InstallTask::world_update_set(const SetName & s)
-{
- if (s == SetName("world") || s == SetName("system") || s == SetName("security")
- || s == SetName("everything") || s == SetName("installed-packages")
- || s == SetName("installed-slots") || s == SetName("insecurity"))
- {
- on_update_world_skip(s, "special sets cannot be added to world");
- return;
- }
-
- _imp->env->add_to_world(s);
-
- on_update_world(s);
-}
-
-namespace
-{
- struct WorldTargetFinder
- {
- Environment * const env;
- InstallTask * const task;
-
- WorldTargetFinder(Environment * const e, InstallTask * const t) :
- env(e),
- task(t)
- {
- }
-
- void visit(const SetSpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- if (package_dep_spec_has_properties(*node.spec(), make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
- n::has_category_name_part() = false,
- n::has_from_repository() = false,
- n::has_in_repository() = false,
- n::has_installable_to_path() = false,
- n::has_installable_to_repository() = false,
- n::has_installed_at_path() = false,
- n::has_package() = true,
- n::has_package_name_part() = false,
- n::has_slot_requirement() = false,
- n::has_tag() = indeterminate,
- n::has_version_requirements() = false
- )))
- {
- env->add_to_world(*node.spec()->package_ptr());
- }
- else
- task->on_update_world_skip(*node.spec(), "not a simple cat/pkg");
- }
-
- void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type &)
- {
- }
- };
-}
-
-void
-InstallTask::world_update_packages(const std::shared_ptr<const SetSpecTree> & a)
-{
- WorldTargetFinder w(_imp->env, this);
- a->top()->accept(w);
-}
-
-bool
-InstallTask::had_resolution_failures() const
-{
- return _imp->had_resolution_failures;
-}
-
-void
-InstallTask::set_continue_on_failure(const InstallTaskContinueOnFailure c)
-{
- _imp->continue_on_failure = c;
-}
-
-namespace
-{
- struct CheckSatisfiedVisitor
- {
- const Environment * const env;
- const std::shared_ptr<const PackageID> & id;
- std::shared_ptr<const PackageDepSpec> failure;
- std::set<SetName> recursing_sets;
-
- CheckSatisfiedVisitor(const Environment * const e,
- const std::shared_ptr<const PackageID> & i) :
- env(e),
- id(i)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- if (! failure)
- if ((*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), id, { })
- | filter::InstalledAtRoot(env->preferred_root_key()->value()))]->empty())
- failure = node.spec();
- }
-
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
- {
- if (node.spec()->condition_met(env, id))
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
- {
- if (failure)
- return;
-
- failure.reset();
- for (DependencySpecTree::NodeType<ConditionalDepSpec>::Type::ConstIterator cur(node.begin()) ;
- cur != node.end() ; ++cur)
- {
- failure.reset();
- (*cur)->accept(*this);
- if (! failure)
- break;
- }
- }
-
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
- {
- std::shared_ptr<const SetSpecTree> set(env->set(node.spec()->name()));
-
- if (! set)
- {
- Log::get_instance()->message("install_task.unknown_set", ll_warning, lc_context) << "Unknown set '"
- << node.spec()->name() << "'";
- return;
- }
-
- if (! recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("install_task.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- recursing_sets.erase(node.spec()->name());
- }
- };
-}
-
-std::shared_ptr<const PackageDepSpec>
-InstallTask::_unsatisfied(const DepListEntry & e) const
-{
- Context context("When checking whether dependencies for '" + stringify(*e.package_id()) + "' are satisfied:");
-
- CheckSatisfiedVisitor v(environment(), e.package_id());
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_pre() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_pre())
- if (e.package_id()->build_dependencies_key())
- e.package_id()->build_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_runtime() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_runtime())
- if (e.package_id()->run_dependencies_key())
- e.package_id()->run_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_post() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_post())
- if (e.package_id()->post_dependencies_key())
- e.package_id()->post_dependencies_key()->value()->top()->accept(v);
-
- if ((dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_suggested() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_suggested())
- && dl_suggested_install == _imp->dep_list.options()->suggested())
- if (e.package_id()->suggested_dependencies_key())
- e.package_id()->suggested_dependencies_key()->value()->top()->accept(v);
-
- return v.failure;
-}
-
-namespace
-{
- struct CheckHandledVisitor
- {
- bool failure;
- bool skipped;
- bool success;
-
- CheckHandledVisitor() :
- failure(false),
- skipped(false),
- success(false)
- {
- }
-
- void visit(const DepListEntryHandledSkippedUnsatisfied &)
- {
- skipped = true;
- }
-
- void visit(const DepListEntryHandledSuccess &)
- {
- success = true;
- }
-
- void visit(const DepListEntryHandledSkippedDependent &)
- {
- skipped = true;
- }
-
- void visit(const DepListEntryHandledFailed &)
- {
- failure = true;
- }
-
- void visit(const DepListEntryNoHandlingRequired &)
- {
- }
-
- void visit(const DepListEntryUnhandled &)
- {
- }
-
- void visit(const DepListEntryHandledFetchFailed &)
- {
- failure = true;
- }
-
- void visit(const DepListEntryHandledFetchSuccess &)
- {
- }
- };
-
- struct CheckIndependentVisitor
- {
- const Environment * const env;
- const DepList & dep_list;
- const std::shared_ptr<const PackageID> id;
- std::shared_ptr<PackageIDSet> already_checked;
-
- std::shared_ptr<const PackageID> failure;
- std::set<SetName> recursing_sets;
-
- CheckIndependentVisitor(
- const Environment * const e,
- const DepList & d,
- const std::shared_ptr<const PackageID> & i,
- const std::shared_ptr<PackageIDSet> & a) :
- env(e),
- dep_list(d),
- id(i),
- already_checked(a)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- if (failure)
- return;
-
- for (DepList::ConstIterator d(dep_list.begin()), d_end(dep_list.end()) ;
- d != d_end ; ++d)
- {
- if (! d->handled())
- continue;
-
- if (! match_package(*env, *node.spec(), d->package_id(), id, { }))
- continue;
-
- CheckHandledVisitor v;
- d->handled()->accept(v);
-
- if (v.failure || v.skipped)
- failure = d->package_id();
- else if (v.success)
- return;
- }
-
- /* no match on the dep list, fall back to installed packages. if
- * there are no matches here it's not a problem because of or-deps. */
- std::shared_ptr<const PackageIDSequence> installed((*env)[selection::AllVersionsUnsorted(
- generator::Matches(*node.spec(), id, { }) |
- filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
-
- for (PackageIDSequence::ConstIterator i(installed->begin()), i_end(installed->end()) ;
- i != i_end ; ++i)
- {
- if (already_checked->end() != already_checked->find(*i))
- continue;
- already_checked->insert(*i);
-
- CheckIndependentVisitor v(env, dep_list, *i, already_checked);
-
- if (dl_deps_pre == dep_list.options()->uninstalled_deps_pre() ||
- dl_deps_pre_or_post == dep_list.options()->uninstalled_deps_pre())
- if ((*i)->build_dependencies_key())
- (*i)->build_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == dep_list.options()->uninstalled_deps_runtime() ||
- dl_deps_pre_or_post == dep_list.options()->uninstalled_deps_runtime())
- if ((*i)->run_dependencies_key())
- (*i)->run_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == dep_list.options()->uninstalled_deps_post() ||
- dl_deps_pre_or_post == dep_list.options()->uninstalled_deps_post())
- if ((*i)->post_dependencies_key())
- (*i)->post_dependencies_key()->value()->top()->accept(v);
-
- if ((dl_deps_pre == dep_list.options()->uninstalled_deps_suggested() ||
- dl_deps_pre_or_post == dep_list.options()->uninstalled_deps_suggested())
- && dl_suggested_install == dep_list.options()->suggested())
- if ((*i)->suggested_dependencies_key())
- (*i)->suggested_dependencies_key()->value()->top()->accept(v);
-
- if (v.failure)
- {
- failure = v.failure;
- return;
- }
- }
- }
-
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
- {
- if (node.spec()->condition_met(env, id))
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
- {
- std::shared_ptr<const SetSpecTree> set(env->set(node.spec()->name()));
-
- if (! set)
- {
- Log::get_instance()->message("install_task.unknown_set", ll_warning, lc_context) << "Unknown set '" << node.spec()->name() << "'";
- return;
- }
-
- if (! recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("install_task.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- recursing_sets.erase(node.spec()->name());
- }
- };
-}
-
-bool
-InstallTask::had_action_failures() const
-{
- for (DepList::ConstIterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
- dep != dep_end ; ++dep)
- {
- CheckHandledVisitor v;
- dep->handled()->accept(v);
- if (v.failure)
- return true;
- }
- return false;
-}
-
-
-std::shared_ptr<const PackageID>
-InstallTask::_dependent(const DepListEntry & e) const
-{
- Context context("When checking whether dependencies for '" + stringify(*e.package_id()) + "' are independent of failed packages:");
-
- std::shared_ptr<PackageIDSet> already_checked(std::make_shared<PackageIDSet>());
- CheckIndependentVisitor v(environment(), _imp->dep_list, e.package_id(), already_checked);
- already_checked->insert(e.package_id());
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_pre() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_pre())
- if (e.package_id()->build_dependencies_key())
- e.package_id()->build_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_runtime() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_runtime())
- if (e.package_id()->run_dependencies_key())
- e.package_id()->run_dependencies_key()->value()->top()->accept(v);
-
- if (dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_post() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_post())
- if (e.package_id()->post_dependencies_key())
- e.package_id()->post_dependencies_key()->value()->top()->accept(v);
-
- if ((dl_deps_pre == _imp->dep_list.options()->uninstalled_deps_suggested() ||
- dl_deps_pre_or_post == _imp->dep_list.options()->uninstalled_deps_suggested())
- && dl_suggested_install == _imp->dep_list.options()->suggested())
- if (e.package_id()->suggested_dependencies_key())
- e.package_id()->suggested_dependencies_key()->value()->top()->accept(v);
-
- return v.failure;
-}
-
-namespace
-{
- struct AlreadyDoneVisitor
- {
- bool result;
-
- void visit(const DepListEntryHandledSuccess &)
- {
- result = true;
- }
-
- void visit(const DepListEntryHandledSkippedUnsatisfied &)
- {
- result = true;
- }
-
- void visit(const DepListEntryHandledSkippedDependent &)
- {
- result = true;
- }
-
- void visit(const DepListEntryHandledFailed &)
- {
- result = true;
- }
-
- void visit(const DepListEntryUnhandled &)
- {
- result = false;
- }
-
- void visit(const DepListEntryNoHandlingRequired &)
- {
- result = false;
- }
-
- void visit(const DepListEntryHandledFetchFailed &)
- {
- result = false;
- }
-
- void visit(const DepListEntryHandledFetchSuccess &)
- {
- result = false;
- }
- };
-}
-
-bool
-InstallTask::already_done(const DepListEntry & e) const
-{
- AlreadyDoneVisitor v;
- e.handled()->accept(v);
- return v.result;
-}
-
-void
-InstallTask::set_skip_phases(const std::shared_ptr<const Set<std::string> > & s)
-{
- _imp->skip_phases = s;
-}
-
-void
-InstallTask::set_skip_until_phases(const std::shared_ptr<const Set<std::string> > & s)
-{
- _imp->skip_until_phases = s;
-}
-
-void
-InstallTask::set_abort_at_phases(const std::shared_ptr<const Set<std::string> > & s)
-{
- _imp->abort_at_phases = s;
-}
-
-void
-InstallTask::set_phase_options_apply_to_first(const bool b)
-{
- _imp->phase_options_apply_to_first = b;
-}
-
-void
-InstallTask::set_phase_options_apply_to_last(const bool b)
-{
- _imp->phase_options_apply_to_last = b;
-}
-
-void
-InstallTask::set_phase_options_apply_to_all(const bool b)
-{
- _imp->phase_options_apply_to_all = b;
-}
-
-FetchActionOptions
-InstallTask::make_fetch_action_options(const DepListEntry &, OutputManagerFromEnvironment & o) const
-{
- return make_named_values<FetchActionOptions>(
- n::errors() = std::make_shared<Sequence<FetchActionFailure>>(),
- n::exclude_unmirrorable() = false,
- n::fetch_parts() = FetchParts() + fp_regulars + fp_extras,
- n::ignore_not_in_manifest() = false,
- n::ignore_unfetched() = false,
- n::make_output_manager() = std::ref(o),
- n::safe_resume() = _imp->safe_resume,
- n::want_phase() = &want_all_phases
- );
-}
-
-template class WrappedForwardIterator<InstallTask::TargetsConstIteratorTag, const std::string>;
-
diff --git a/paludis/legacy/install_task.hh b/paludis/legacy/install_task.hh
deleted file mode 100644
index 2a69db7..0000000
--- a/paludis/legacy/install_task.hh
+++ /dev/null
@@ -1,287 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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_INSTALL_TASK_HH
-#define PALUDIS_GUARD_PALUDIS_INSTALL_TASK_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/legacy/dep_list_exceptions.hh>
-#include <paludis/legacy/tasks_exceptions.hh>
-#include <paludis/repository-fwd.hh>
-#include <paludis/action-fwd.hh>
-#include <paludis/package_database-fwd.hh>
-#include <paludis/output_manager_from_environment-fwd.hh>
-
-/** \file
- * Declarations for InstallTask.
- *
- * \ingroup g_tasks
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- class Environment;
-
-#include <paludis/legacy/install_task-se.hh>
-
- /**
- * Task used to install one or more targets.
- *
- * \ingroup g_tasks
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE InstallTask
- {
- private:
- Pimp<InstallTask> _imp;
-
- void _execute();
-
- void _build_dep_list();
- void _display_task_list();
- bool _pretend();
-
- void _main_actions();
- void _main_actions_pre_hooks();
- void _main_actions_post_hooks();
- void _do_world_updates();
- void _main_actions_all(const int y, const DepList::Iterator dep_last_package);
-
- void _one(const DepList::Iterator, const int, const int, const int, const int, const bool is_first, const bool is_last,
- std::shared_ptr<OutputManagerFromEnvironment> &);
- void _clean(const DepList::Iterator, const std::shared_ptr<const PackageID> & id,
- const UninstallActionOptions &,
- const std::string & cpvr, const int x, const int y, const int s, const int f);
- void _display_failure_summary();
-
- void _add_target(const std::string &);
- void _add_package_id(const std::shared_ptr<const PackageID> &);
-
- std::shared_ptr<const PackageDepSpec> _unsatisfied(const DepListEntry &) const;
- std::shared_ptr<const PackageID> _dependent(const DepListEntry &) const;
-
- protected:
- ///\name Basic operations
- ///\{
-
- InstallTask(Environment * const env, const DepListOptions & options,
- const std::shared_ptr<const DestinationsSet> & destinations);
-
- ///\}
-
- bool already_done(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- FetchActionOptions make_fetch_action_options(const DepListEntry &,
- OutputManagerFromEnvironment & o) const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~InstallTask();
-
- InstallTask(const InstallTask &) = delete;
- InstallTask & operator= (const InstallTask &) = delete;
-
- ///\}
-
- ///\name DepList and Install behaviour options
- ///\{
-
- void set_fetch_only(const bool value);
- void set_pretend(const bool value);
- void set_preserve_world(const bool value);
- void set_add_to_world_spec(const std::string &);
- void set_safe_resume(const bool);
- void set_continue_on_failure(const InstallTaskContinueOnFailure);
- void set_skip_phases(const std::shared_ptr<const Set<std::string> > &);
- void set_skip_until_phases(const std::shared_ptr<const Set<std::string> > &);
- void set_abort_at_phases(const std::shared_ptr<const Set<std::string> > &);
- void set_phase_options_apply_to_first(const bool);
- void set_phase_options_apply_to_last(const bool);
- void set_phase_options_apply_to_all(const bool);
-
- ///\}
-
- ///\name Targets
- ///\{
-
- void set_targets_from_user_specs(const std::shared_ptr<const Sequence<std::string> > &);
- void set_targets_from_exact_packages(const std::shared_ptr<const PackageIDSequence> &);
- void set_targets_from_serialisation(const std::string &, const std::shared_ptr<const Sequence<std::string> > &);
-
- void clear();
- void override_target_type(const DepListTargetType);
-
- struct TargetsConstIteratorTag;
- typedef WrappedForwardIterator<TargetsConstIteratorTag, const std::string> TargetsConstIterator;
- TargetsConstIterator begin_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));
- TargetsConstIterator end_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- ///\}
-
- ///\name Event callbacks
- ///\{
-
- virtual void on_build_deplist_pre() = 0;
- virtual void on_build_deplist_post() = 0;
-
- virtual void on_display_merge_list_pre() = 0;
- virtual void on_display_merge_list_post() = 0;
- virtual void on_display_merge_list_entry(const DepListEntry &) = 0;
-
- virtual void on_display_failure_summary_pre() = 0;
- virtual void on_display_failure_summary_success(const DepListEntry &) = 0;
- virtual void on_display_failure_summary_failure(const DepListEntry &) = 0;
- virtual void on_display_failure_summary_skipped_unsatisfied(const DepListEntry &, const PackageDepSpec &) = 0;
- virtual void on_display_failure_summary_skipped_dependent(const DepListEntry &, const std::shared_ptr<const PackageID> &) = 0;
- virtual void on_display_failure_summary_totals(const int, const int, const int, const int, const int) = 0;
- virtual void on_display_failure_summary_post() = 0;
-
- virtual void on_not_continuing_due_to_errors() = 0;
-
- virtual void on_pretend_all_pre() = 0;
- virtual void on_pretend_pre(const DepListEntry &) = 0;
- virtual void on_pretend_post(const DepListEntry &) = 0;
- virtual void on_pretend_all_post() = 0;
-
- virtual void on_fetch_all_pre() = 0;
- virtual void on_fetch_pre(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
- virtual void on_fetch_post(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
- virtual void on_fetch_all_post() = 0;
-
- virtual void on_install_all_pre() = 0;
- virtual void on_install_pre(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
- virtual void on_install_post(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
- virtual void on_install_fail(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
- virtual void on_install_all_post() = 0;
-
- virtual void on_skip_unsatisfied(const DepListEntry &, const PackageDepSpec &,
- const int x, const int y, const int s, const int f) = 0;
- virtual void on_skip_dependent(const DepListEntry &, const std::shared_ptr<const PackageID> &,
- const int x, const int y, const int s, const int f) = 0;
- virtual void on_skip_already_done(const DepListEntry &, const int, const int, const int, const int) = 0;
-
- virtual void on_clean_pre(const DepListEntry &,
- const PackageID &,
- const int x, const int y, const int s, const int f) = 0;
- virtual void on_clean_post(const DepListEntry &,
- const PackageID &,
- const int x, const int y, const int s, const int f) = 0;
- virtual void on_clean_fail(const DepListEntry &,
- const PackageID &,
- const int x, const int y, const int s, const int f) = 0;
-
- virtual void on_update_world_pre() = 0;
- virtual void on_update_world(const PackageDepSpec &) = 0;
- virtual void on_update_world(const SetName &) = 0;
- virtual void on_update_world_skip(const PackageDepSpec &, const std::string &) = 0;
- virtual void on_update_world_skip(const SetName &, const std::string &) = 0;
- virtual void on_update_world_post() = 0;
- virtual void on_preserve_world() = 0;
-
- virtual void on_installed_paludis();
-
- virtual void on_ambiguous_package_name_error(const AmbiguousPackageNameError &) = 0;
- virtual void on_no_such_package_error(const NoSuchPackageError &) = 0;
- virtual void on_all_masked_error(const AllMaskedError &) = 0;
- virtual void on_additional_requirements_not_met_error(const AdditionalRequirementsNotMetError &) = 0;
- virtual void on_dep_list_error(const DepListError &) = 0;
- virtual void on_had_both_package_and_set_targets_error(const HadBothPackageAndSetTargets &) = 0;
- virtual void on_multiple_set_targets_specified(const MultipleSetTargetsSpecified &) = 0;
-
- virtual void on_non_fetch_action_error(const std::shared_ptr<OutputManager> &,
- const ActionFailedError &) = 0;
- virtual void on_fetch_action_error(const std::shared_ptr<OutputManager> &,
- const ActionFailedError &,
- const std::shared_ptr<const Sequence<FetchActionFailure> > &) = 0;
-
- virtual void on_phase_skip(const std::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
- virtual void on_phase_abort(const std::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
- virtual void on_phase_skip_until(const std::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
- virtual void on_phase_proceed_conditionally(const std::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
- virtual void on_phase_proceed_unconditionally(const std::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
-
- ///\}
-
- ///\name Logic
- ///\{
-
- virtual void world_update_set(const SetName &);
- virtual void world_update_packages(const std::shared_ptr<const SetSpecTree> &);
-
- ///\}
-
- /**
- * Run the task.
- */
- virtual void execute();
-
- /**
- * Fetch our deplist.
- */
- const DepList & dep_list() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Fetch our environment.
- */
- Environment * environment() PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Fetch our environment.
- */
- const Environment * environment() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Perform a hook. By default, delegates to environment.
- */
- virtual HookResult perform_hook(const Hook &, const std::shared_ptr<OutputManager> &)
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Have we had any resolution failures?
- */
- virtual bool had_resolution_failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Have we had any action failures?
- */
- virtual bool had_action_failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Serialise the task.
- */
- std::string serialise(const bool undo_failures) const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * The format for serialisation.
- */
- std::string serialised_format() const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- extern template class WrappedForwardIterator<InstallTask::TargetsConstIteratorTag, const std::string>;
-}
-
-#endif
diff --git a/paludis/legacy/install_task.se b/paludis/legacy/install_task.se
deleted file mode 100644
index a78a140..0000000
--- a/paludis/legacy/install_task.se
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_InstallTaskContinueOnFailure()
-{
- prefix itcof
- want_destringify
-
- key itcof_if_fetch_only "Continue, but only if fetch only"
- key itcof_never "Never"
- key itcof_if_independent "Continue if packages are independent"
- key itcof_if_satisfied "If dependencies are satisfied"
- key itcof_always "Always"
-
- doxygen_comment << "END"
- /**
- * How to handle a failure when executing InstallTask.
- *
- * \see InstallTask
- * \ingroup g_tasks
- */
-END
-}
-
diff --git a/paludis/legacy/override_functions.cc b/paludis/legacy/override_functions.cc
deleted file mode 100644
index ace84d8..0000000
--- a/paludis/legacy/override_functions.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2010, 2011 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/legacy/override_functions.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/environment.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/mask.hh>
-#include <paludis/name.hh>
-
-using namespace paludis;
-
-bool
-paludis::override_tilde_keywords(const Environment * const e, const std::shared_ptr<const PackageID> & id, const Mask & m)
-{
- Context c("When working out whether mask is a tilde keyword mask for override:");
-
- const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
- if (! mm)
- return false;
-
- auto ki(id->find_metadata(mm->unaccepted_key_name()));
- if (ki == id->end_metadata())
- return false;
-
- auto k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(**ki));
- if (! k)
- return false;
-
- std::shared_ptr<KeywordNameSet> kk(std::make_shared<KeywordNameSet>());
- for (KeywordNameSet::ConstIterator i(k->value()->begin()), i_end(k->value()->end()) ;
- i != i_end ; ++i)
- {
- kk->insert(*i);
- if ('~' == stringify(*i).at(0))
- kk->insert(KeywordName(stringify(*i).substr(1)));
- }
-
- return e->accept_keywords(kk, id);
-}
-
-bool
-paludis::override_unkeyworded(const Environment * const e, const std::shared_ptr<const PackageID> & id, const Mask & m)
-{
- Context c("When working out whether mask is an unkeyworded mask for override:");
-
- const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
- if (! mm)
- return false;
-
- auto ki(id->find_metadata(mm->unaccepted_key_name()));
- if (ki == id->end_metadata())
- return false;
-
- auto k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(**ki));
- if (! k)
- return false;
-
- std::shared_ptr<KeywordNameSet> kk(std::make_shared<KeywordNameSet>());
- for (KeywordNameSet::ConstIterator i(k->value()->begin()), i_end(k->value()->end()) ;
- i != i_end ; ++i)
- if ('-' == stringify(*i).at(0))
- kk->insert(KeywordName(stringify(*i).substr(1)));
-
- return ! e->accept_keywords(kk, id);
-}
-
-bool
-paludis::override_repository_masks(const Mask & m)
-{
- Context c("When working out whether mask is a repository mask for override:");
- return simple_visitor_cast<const RepositoryMask>(m);
-}
-
-bool
-paludis::override_license(const std::shared_ptr<const PackageID> & id, const Mask & m)
-{
- Context c("When working out whether mask is a license mask for override:");
- const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
- if (! mm)
- return false;
-
- auto m_i(id->find_metadata(mm->unaccepted_key_name()));
- if (m_i == id->end_metadata())
- return false;
-
- return simple_visitor_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(**m_i);
-}
-
-
diff --git a/paludis/legacy/override_functions.hh b/paludis/legacy/override_functions.hh
deleted file mode 100644
index bd55a67..0000000
--- a/paludis/legacy/override_functions.hh
+++ /dev/null
@@ -1,77 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2010, 2011 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_OVERRIDE_FUNCTIONS_HH
-#define PALUDIS_GUARD_PALUDIS_OVERRIDE_FUNCTIONS_HH 1
-
-#include <paludis/util/attributes.hh>
-#include <paludis/environment-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/mask-fwd.hh>
-
-/** \file
- * Declarations for various override functions for DepList.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Override a mask if it is a ~keyword mask, and keyword is accepted.
- *
- * \ingroup g_dep_list
- * \since 0.26
- */
- bool override_tilde_keywords(const Environment * const e, const std::shared_ptr<const PackageID> & i, const Mask & m)
- PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
-
- /**
- * Override a mask if it is due to a missing keyword.
- *
- * \ingroup g_dep_list
- * \since 0.26
- */
- bool override_unkeyworded(const Environment * const e, const std::shared_ptr<const PackageID> & i, const Mask & m)
- PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
-
- /**
- * Override a mask if it is a repository mask.
- *
- * \ingroup g_dep_list
- * \since 0.26
- */
- bool override_repository_masks(const Mask & m)
- PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
-
- /**
- * Override a mask if it is a license mask.
- *
- * \ingroup g_dep_list
- * \since 0.26
- */
- bool override_license(const std::shared_ptr<const PackageID> &, const Mask & m)
- PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
-}
-
-#endif
diff --git a/paludis/legacy/query_visitor.cc b/paludis/legacy/query_visitor.cc
deleted file mode 100644
index 23350cb..0000000
--- a/paludis/legacy/query_visitor.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/query_visitor.hh>
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/legacy/range_rewriter.hh>
-#include <paludis/package_database.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/util/sequence.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <functional>
-#include <algorithm>
-#include <set>
-
-using namespace paludis;
-
-namespace paludis
-{
- template <>
- struct Imp<QueryVisitor>
- {
- bool result;
- const DepList * const dep_list;
- std::shared_ptr<const DestinationsSet> destinations;
- const Environment * const environment;
- const std::shared_ptr<const PackageID> id;
- std::set<SetName> recursing_sets;
-
- Imp(const DepList * const d, std::shared_ptr<const DestinationsSet> dd,
- const Environment * const e, const std::shared_ptr<const PackageID> & p) :
- result(true),
- dep_list(d),
- destinations(dd),
- environment(e),
- id(p)
- {
- }
- };
-}
-
-QueryVisitor::QueryVisitor(const DepList * const d, const std::shared_ptr<const DestinationsSet> & dd,
- const Environment * const e, const std::shared_ptr<const PackageID> & id) :
- _imp(d, dd, e, id)
-{
-}
-
-QueryVisitor::~QueryVisitor()
-{
-}
-
-bool
-QueryVisitor::result() const
-{
- return _imp->result;
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- using namespace std::placeholders;
-
- /* a pda matches if we'll be installed by the time we reach the current point. This
- * means that merely being installed is not enough, if we'll have our version changed
- * by something in the merge list. */
-
- _imp->result = false;
-
- // TODO: check destinations
- std::shared_ptr<const PackageIDSequence> matches((*_imp->environment)[selection::AllVersionsUnsorted(
- generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options()) |
- filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]);
-
- if (indirect_iterator(matches->end()) != std::find_if(indirect_iterator(matches->begin()), indirect_iterator(matches->end()),
- std::bind(std::logical_not<bool>(), std::bind(std::mem_fn(&DepList::replaced), _imp->dep_list, _1))))
- {
- _imp->result = true;
- return;
- }
-
- /* check the merge list for any new packages that match */
- if (_imp->dep_list->match_on_list(*node.spec(), _imp->id))
- {
- _imp->result = true;
- return;
- }
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- Context context("When expanding named set '" + stringify(*node.spec()) + "':");
-
- std::shared_ptr<const SetSpecTree> set(_imp->environment->set(node.spec()->name()));
-
- if (! set)
- {
- Log::get_instance()->message("dep_list.query_visitor.unknown_set", ll_warning, lc_context) << "Unknown set '" << node.spec()->name() << "'";
- _imp->result = false;
- return;
- }
-
- if (! _imp->recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("dep_list.query_visitor.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- _imp->recursing_sets.erase(node.spec()->name());
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- /* for use? ( ) dep specs, return true if we're not enabled, so that
- * weird || ( ) cases work. */
- if (node.spec()->condition_met(_imp->environment, _imp->id))
- {
- _imp->result = true;
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- (*c)->accept(*this);
- if (! _imp->result)
- return;
- }
- }
- else
- _imp->result = true;
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- /* empty || ( ) must resolve to true */
- _imp->result = true;
-
- RangeRewriter r;
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(r));
-
- if (r.spec())
- {
- DependencySpecTree tree(std::make_shared<AllDepSpec>());
- tree.top()->append(r.spec());
- tree.top()->accept(*this);
- }
- else
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- if (! is_viable_any_child(_imp->environment, _imp->id, **c))
- continue;
-
- (*c)->accept(*this);
- if (_imp->result)
- return;
- }
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
-{
- DependencySpecTree tree(std::make_shared<AllDepSpec>());
- tree.top()->append(std::static_pointer_cast<const PackageDepSpec>(node.spec()->blocking().clone()));
- tree.top()->accept(*this);
- _imp->result = !_imp->result;
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
- c != c_end ; ++c)
- {
- (*c)->accept(*this);
- if (! _imp->result)
- return;
- }
-}
-
-void
-QueryVisitor::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
-{
- // XXX implement
-}
-
diff --git a/paludis/legacy/query_visitor.hh b/paludis/legacy/query_visitor.hh
deleted file mode 100644
index 9f60ca2..0000000
--- a/paludis/legacy/query_visitor.hh
+++ /dev/null
@@ -1,81 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_QUERY_VISITOR_HH
-#define PALUDIS_GUARD_PALUDIS_QUERY_VISITOR_HH 1
-
-#include <paludis/legacy/dep_list-fwd.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/dep_spec-fwd.hh>
-
-/** \file
- * Declarations for QueryVisitor, which is used internally by DepList.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Used by DepList to check for existing deps.
- *
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class QueryVisitor
- {
- private:
- Pimp<QueryVisitor> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- QueryVisitor(const DepList * const, const std::shared_ptr<const DestinationsSet> &,
- const Environment * const, const std::shared_ptr<const PackageID> &);
-
- ~QueryVisitor();
-
- ///\}
-
- ///\name Visitor operations
- ///\{
-
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
-
- ///\}
-
- /**
- * Are we matched?
- */
- bool result() const;
- };
-}
-
-#endif
diff --git a/paludis/legacy/range_rewriter.cc b/paludis/legacy/range_rewriter.cc
deleted file mode 100644
index 1f920c5..0000000
--- a/paludis/legacy/range_rewriter.cc
+++ /dev/null
@@ -1,309 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2009, 2010, 2011 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/legacy/range_rewriter.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/version_requirements.hh>
-#include <paludis/package_dep_spec_properties.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/join.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/dep_spec_data.hh>
-#include <list>
-#include <sstream>
-#include <algorithm>
-
-using namespace paludis;
-
-namespace
-{
- struct RangeRewrittenPackageDepSpecData :
- PackageDepSpecData
- {
- std::shared_ptr<QualifiedPackageName> package;
- std::shared_ptr<VersionRequirements> version_requirements;
- VersionRequirementsMode version_requirements_mode_v;
- std::list<std::string> strings;
-
- virtual std::string as_string() const
- {
- std::ostringstream s;
- s << *package_ptr();
-
- if (version_requirements_ptr())
- {
- bool need_op(false);
- s << "[";
- for (VersionRequirements::ConstIterator r(version_requirements_ptr()->begin()),
- r_end(version_requirements_ptr()->end()) ; r != r_end ; ++r)
- {
- if (need_op)
- {
- do
- {
- switch (version_requirements_mode())
- {
- case vr_and:
- s << "&";
- continue;
-
- case vr_or:
- s << "|";
- continue;
-
- case last_vr:
- ;
- }
- throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
- } while (false);
- }
-
- if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
- s << "=";
- else
- s << r->version_operator();
-
- s << r->version_spec();
-
- if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
- s << "*";
-
- need_op = true;
- }
- s << "]";
- }
-
- return s.str() + " (rewritten from { " + join(strings.begin(), strings.end(), ", ") + " })";
- }
-
- virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const
- {
- return package;
- }
-
- virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const
- {
- return std::shared_ptr<const PackageNamePart>();
- }
-
- virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const
- {
- return std::shared_ptr<const CategoryNamePart>();
- }
-
- virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const
- {
- return version_requirements;
- }
-
- virtual VersionRequirementsMode version_requirements_mode() const
- {
- return version_requirements_mode_v;
- }
-
- virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const
- {
- return std::shared_ptr<const SlotRequirement>();
- }
-
- virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
- {
- return std::shared_ptr<const AdditionalPackageDepSpecRequirements>();
- }
-
- void add_spec(const PackageDepSpec & spec)
- {
- strings.push_back(stringify(spec));
- std::copy(spec.version_requirements_ptr()->begin(), spec.version_requirements_ptr()->end(),
- version_requirements->back_inserter());
- }
-
- RangeRewrittenPackageDepSpecData(const PackageDepSpec & spec) :
- package(std::make_shared<QualifiedPackageName>(*spec.package_ptr())),
- version_requirements(std::make_shared<VersionRequirements>()),
- version_requirements_mode_v(vr_or)
- {
- strings.push_back(stringify(spec));
- std::copy(spec.version_requirements_ptr()->begin(), spec.version_requirements_ptr()->end(),
- version_requirements->back_inserter());
- }
-
- std::shared_ptr<const PackageDepSpecData> without_slot_requirements() const
- {
- return std::make_shared<RangeRewrittenPackageDepSpecData>(*this);
- }
-
- virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
- {
- return make_null_shared_ptr();
- }
-
- virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const
- {
- return make_null_shared_ptr();
- }
-
- virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const
- {
- return make_null_shared_ptr();
- }
-
- virtual std::shared_ptr<const FSPath> installed_at_path_ptr() const
- {
- return make_null_shared_ptr();
- }
-
- virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const
- {
- return make_null_shared_ptr();
- }
-
- virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const
- {
- return { pmpdso_always_use_ranged_deps };
- }
- };
-}
-
-namespace paludis
-{
- template <>
- struct Imp<RangeRewriter>
- {
- bool invalid;
- std::shared_ptr<RangeRewrittenPackageDepSpecData> spec_data;
-
- Imp() :
- invalid(false)
- {
- }
- };
-}
-
-RangeRewriter::RangeRewriter() :
- _imp()
-{
-}
-
-RangeRewriter::~RangeRewriter()
-{
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- if (node.begin() != node.end())
- _imp->invalid = true;
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- if (node.begin() != node.end())
- _imp->invalid = true;
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type &)
-{
- _imp->invalid = true;
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- if (_imp->invalid)
- return;
-
- const PackageDepSpec & a(*node.spec());
- if (! package_dep_spec_has_properties(a, make_named_values<PackageDepSpecProperties>(
- n::has_additional_requirements() = false,
- n::has_category_name_part() = false,
- n::has_from_repository() = false,
- n::has_in_repository() = false,
- n::has_installable_to_path() = false,
- n::has_installable_to_repository() = false,
- n::has_installed_at_path() = false,
- n::has_package() = true,
- n::has_package_name_part() = false,
- n::has_slot_requirement() = false,
- n::has_tag() = indeterminate,
- n::has_version_requirements() = true
- )))
- {
- _imp->invalid = true;
- return;
- }
-
- if (a.version_requirements_mode() == vr_and &&
- 1 != std::distance(a.version_requirements_ptr()->begin(), a.version_requirements_ptr()->end()))
- {
- _imp->invalid = true;
- return;
- }
-
- if (_imp->spec_data)
- {
- if (*_imp->spec_data->package_ptr() != *a.package_ptr())
- {
- _imp->invalid = true;
- return;
- }
-
- _imp->spec_data->add_spec(a);
- }
- else
- {
- _imp->spec_data = std::make_shared<RangeRewrittenPackageDepSpecData>(a);
- }
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
-{
- _imp->invalid = true;
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
-{
- _imp->invalid = true;
-}
-
-void
-RangeRewriter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type &)
-{
- _imp->invalid = true;
-}
-
-std::shared_ptr<PackageDepSpec>
-RangeRewriter::spec() const
-{
- if (_imp->invalid || ! _imp->spec_data)
- return std::shared_ptr<PackageDepSpec>();
-
- return std::make_shared<PackageDepSpec>(_imp->spec_data);
-}
-
diff --git a/paludis/legacy/range_rewriter.hh b/paludis/legacy/range_rewriter.hh
deleted file mode 100644
index 8bec63e..0000000
--- a/paludis/legacy/range_rewriter.hh
+++ /dev/null
@@ -1,81 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2009, 2011 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_RANGE_REWRITER_HH
-#define PALUDIS_GUARD_PALUDIS_RANGE_REWRITER_HH 1
-
-#include <paludis/spec_tree.hh>
-#include <paludis/util/pimp.hh>
-
-/** \file
- * Declarations for RangeRewriter, which is used internally by Deplist.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Rewrite a DepSpec heirarchy to replace AllDepSpec and AnyDepSpec
- * collections of PackageDepSpec with a single PackageDepSpec using ranged
- * dependencies.
- *
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RangeRewriter
- {
- private:
- Pimp<RangeRewriter> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- RangeRewriter();
- virtual ~RangeRewriter();
-
- ///\}
-
- /**
- * Our rewritten spec, or a zero pointer if we couldn't do any
- * rewriting.
- */
- std::shared_ptr<PackageDepSpec> spec() const;
-
- ///\name Visit methods
- ///\{
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
-
- ///\}
- };
-}
-
-#endif
diff --git a/paludis/legacy/range_rewriter_TEST.cc b/paludis/legacy/range_rewriter_TEST.cc
deleted file mode 100644
index e97f24d..0000000
--- a/paludis/legacy/range_rewriter_TEST.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2009, 2010 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/legacy/range_rewriter.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/environments/test/test_environment.hh>
-
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
-
-#include <algorithm>
-
-using namespace test;
-using namespace paludis;
-
-namespace test_cases
-{
- struct RangeRewriterTestCase :
- TestCase
- {
- RangeRewriterTestCase() : TestCase("range rewriter") { }
-
- void run()
- {
- TestEnvironment env;
- std::shared_ptr<DependencySpecTree> a(std::make_shared<DependencySpecTree>(std::make_shared<AllDepSpec>()));
- a->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("=a/b-1",
- &env, { })));
- a->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("=a/b-2",
- &env, { })));
-
- RangeRewriter r;
- TEST_CHECK(! r.spec());
- std::for_each(indirect_iterator(a->top()->begin()), indirect_iterator(a->top()->end()), accept_visitor(r));
- TEST_CHECK(bool(r.spec()));
-
- TEST_CHECK(bool(r.spec()));
- TEST_CHECK_STRINGIFY_EQUAL(*r.spec(), "a/b[=1|=2] (rewritten from { =a/b-1, =a/b-2 })");
- }
- } test_range_rewriter;
-}
-
diff --git a/paludis/legacy/report_task.cc b/paludis/legacy/report_task.cc
deleted file mode 100644
index abcc6ce..0000000
--- a/paludis/legacy/report_task.cc
+++ /dev/null
@@ -1,276 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Fernando J. Pereda
- *
- * 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/legacy/report_task.hh>
-#include <paludis/legacy/uninstall_list.hh>
-#include <paludis/util/log.hh>
-#include <paludis/environment.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/dep_tag.hh>
-#include <paludis/package_id.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/package_database.hh>
-#include <paludis/version_requirements.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-#include <algorithm>
-#include <set>
-#include <map>
-
-using namespace paludis;
-
-namespace
-{
- class VulnerableChecker
- {
- private:
- std::multimap<std::shared_ptr<const PackageID>, std::shared_ptr<const DepTag>, PackageIDSetComparator> _found;
- const Environment & _env;
- std::set<SetName> _recursing_sets;
-
- public:
- typedef std::multimap<std::shared_ptr<const PackageID>, std::shared_ptr<const DepTag>,
- PackageIDSetComparator>::const_iterator ConstIterator;
-
- VulnerableChecker(const Environment & e) :
- _env(e)
- {
- }
-
- void visit(const SetSpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- }
-
- void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node);
-
- void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type & node)
- {
- Context context("When expanding named set '" + stringify(*node.spec()) + "':");
-
- std::shared_ptr<const SetSpecTree> set(_env.set(node.spec()->name()));
- if (! set)
- {
- Log::get_instance()->message("report_task.unknown_set", ll_warning, lc_context)
- << "Unknown set '" << node.spec()->name() << "'";
- return;
- }
-
- if (! _recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("report_task.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- _recursing_sets.erase(node.spec()->name());
- }
-
- std::pair<ConstIterator, ConstIterator> insecure_tags(const std::shared_ptr<const PackageID> & id) const
- {
- return _found.equal_range(id);
- }
- };
-
- void
- VulnerableChecker::visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- std::shared_ptr<const PackageIDSequence> insecure(_env[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), make_null_shared_ptr(), { }))]);
- for (PackageIDSequence::ConstIterator i(insecure->begin()),
- i_end(insecure->end()) ; i != i_end ; ++i)
- if (node.spec()->tag() && simple_visitor_cast<const GLSADepTag>(*node.spec()->tag()))
- _found.insert(std::make_pair(*i, node.spec()->tag()));
- else
- throw InternalError(PALUDIS_HERE, "didn't get a tag");
- }
-}
-
-namespace paludis
-{
- template<>
- struct Imp<ReportTask>
- {
- Environment * const env;
-
- Imp(Environment * const e) :
- env(e)
- {
- }
- };
-}
-
-ReportTask::ReportTask(Environment * const env) :
- _imp(env)
-{
-}
-
-ReportTask::~ReportTask()
-{
-}
-
-void
-ReportTask::execute()
-{
- Context context("When executing report task:");
-
- on_report_all_pre();
-
- paludis::Environment * const e(_imp->env);
- bool once(true);
-
- VulnerableChecker vuln(*e);
- try
- {
- std::shared_ptr<const SetSpecTree> insecure(_imp->env->set(SetName("insecurity")));
- if (insecure)
- insecure->top()->accept(vuln);
- }
- catch (const NotAvailableError &)
- {
- if (once)
- {
- Log::get_instance()->message("report_task.skipping_glsas", ll_warning, lc_no_context)
- << "Skipping GLSA checks because Paludis was built without XML support";
- once = false;
- }
- }
-
- UninstallList unused_list(e, make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = false
- ));
- unused_list.add_unused();
- std::set<std::shared_ptr<const PackageID>, PackageIDSetComparator> unused;
- for (UninstallList::ConstIterator i(unused_list.begin()), i_end(unused_list.end());
- i != i_end ; ++i)
- if (i->kind() != ulk_virtual)
- unused.insert(i->package_id());
-
- for (PackageDatabase::RepositoryConstIterator r(e->package_database()->begin_repositories()),
- r_end(e->package_database()->end_repositories()) ; r != r_end ; ++r)
- {
- std::shared_ptr<const Repository> rr(e->package_database()->fetch_repository((*r)->name()));
- if (! rr->installed_root_key())
- continue;
-
- std::shared_ptr<const CategoryNamePartSet> cat_names(rr->category_names());
- for (CategoryNamePartSet::ConstIterator c(cat_names->begin()), c_end(cat_names->end()) ;
- c != c_end ; ++c)
- {
- std::shared_ptr<const QualifiedPackageNameSet> packages(rr->package_names(*c));
- for (QualifiedPackageNameSet::ConstIterator p(packages->begin()), p_end(packages->end()) ;
- p != p_end ; ++p)
- {
- on_report_check_package_pre(*p);
-
- std::shared_ptr<const PackageIDSequence> ids(rr->package_ids(*p));
- for (PackageIDSequence::ConstIterator v(ids->begin()), v_end(ids->end()) ;
- v != v_end ; ++v)
- {
- bool is_missing(false);
- std::shared_ptr<PackageIDSequence> origins;
-
- if ((*v)->from_repositories_key())
- {
- is_missing = ! ((*v)->behaviours_key() && (*v)->behaviours_key()->value()->end() !=
- (*v)->behaviours_key()->value()->find("transient"));
-
- for (Set<std::string>::ConstIterator o((*v)->from_repositories_key()->value()->begin()),
- o_end((*v)->from_repositories_key()->value()->end()) ;
- o != o_end ; ++o)
- {
- std::shared_ptr<const PackageIDSequence> installable(
- (*e)[selection::BestVersionOnly((
- (generator::InRepository(RepositoryName(*o)) &
- generator::Matches(make_package_dep_spec({ })
- .package((*v)->name())
- .version_requirement(make_named_values<VersionRequirement>(
- n::version_operator() = vo_equal,
- n::version_spec() = (*v)->version())),
- make_null_shared_ptr(), { })) |
- filter::SupportsAction<InstallAction>()))]);
-
- if (! installable->empty())
- {
- is_missing = false;
- if (! origins)
- origins = std::make_shared<PackageIDSequence>();
- origins->push_back(*installable->last());
- }
- }
- }
-
- bool is_masked(origins && origins->end() != std::find_if(origins->begin(),
- origins->end(), std::bind(std::mem_fn(&PackageID::masked),
- std::placeholders::_1)));
- bool is_vulnerable(false);
- bool is_unused(false);
-
- std::pair<VulnerableChecker::ConstIterator, VulnerableChecker::ConstIterator> pi(vuln.insecure_tags(*v));
- if (pi.first != pi.second)
- is_vulnerable = true;
-
- if (unused.end() != unused.find(*v))
- is_unused = true;
-
- if (is_masked || is_vulnerable || is_missing || is_unused)
- {
- on_report_package_failure_pre(*v);
- if (is_masked)
- on_report_package_is_masked(*v, origins);
- if (is_vulnerable)
- {
- on_report_package_is_vulnerable_pre(*v);
- for (VulnerableChecker::ConstIterator itag(pi.first) ; itag != pi.second ; ++itag)
- on_report_package_is_vulnerable(*v, *static_cast<const GLSADepTag *>(itag->second.get()) );
- on_report_package_is_vulnerable_post(*v);
- }
- if (is_missing)
- on_report_package_is_missing(*v);
- if (is_unused)
- on_report_package_is_unused(*v);
- on_report_package_failure_post(*v);
- }
- else
- on_report_package_success(*v);
- }
-
- on_report_check_package_post(*p);
- }
- }
- }
-
- on_report_all_post();
-}
-
diff --git a/paludis/legacy/report_task.hh b/paludis/legacy/report_task.hh
deleted file mode 100644
index 302dc6d..0000000
--- a/paludis/legacy/report_task.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Fernando J. Pereda
- *
- * 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_REPORT_TASK_HH
-#define PALUDIS_GUARD_PALUDIS_REPORT_TASK_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/repository.hh>
-#include <paludis/dep_tag-fwd.hh>
-
-/** \file
- * Declarations for ReportTask.
- *
- * \ingroup g_tasks
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- class Environment;
-
- /**
- * Task to report the current state of the system.
- *
- * \ingroup g_tasks
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE ReportTask
- {
- private:
- Pimp<ReportTask> _imp;
-
- protected:
- ///\name Basic operations
- ///\{
-
- ReportTask(Environment * const env);
-
- ///\}
-
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~ReportTask();
-
- ReportTask(const ReportTask &) = delete;
- ReportTask & operator= (const ReportTask &) = delete;
-
- ///\}
-
- ///\name Event callbacks
- ///\{
-
- virtual void on_report_all_pre() = 0;
- virtual void on_report_check_package_pre(const QualifiedPackageName & p) = 0;
- virtual void on_report_package_success(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_failure_pre(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_is_masked(const std::shared_ptr<const PackageID> & id,
- const std::shared_ptr<const PackageIDSequence> & origins) = 0;
- virtual void on_report_package_is_vulnerable_pre(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_is_vulnerable(const std::shared_ptr<const PackageID> & id, const GLSADepTag & glsa_tag) = 0;
- virtual void on_report_package_is_vulnerable_post(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_is_missing(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_is_unused(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_package_failure_post(const std::shared_ptr<const PackageID> & id) = 0;
- virtual void on_report_check_package_post(const QualifiedPackageName & p) = 0;
- virtual void on_report_all_post() = 0;
-
- ///\}
-
- /**
- * Run the task.
- */
- void execute();
- };
-}
-
-#endif
diff --git a/paludis/legacy/show_suggest_visitor.cc b/paludis/legacy/show_suggest_visitor.cc
deleted file mode 100644
index 6724589..0000000
--- a/paludis/legacy/show_suggest_visitor.cc
+++ /dev/null
@@ -1,262 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/show_suggest_visitor.hh>
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/package_id.hh>
-#include <paludis/package_database.hh>
-#include <paludis/dep_label.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/util/log.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/util/join.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <algorithm>
-#include <functional>
-#include <set>
-#include <list>
-
-using namespace paludis;
-
-typedef std::list<std::shared_ptr<DependenciesLabelSequence> > LabelsStack;
-
-namespace paludis
-{
- template <>
- struct Imp<ShowSuggestVisitor>
- {
- DepList * const dep_list;
- std::shared_ptr<const DestinationsSet> destinations;
- const Environment * const environment;
- const std::shared_ptr<const PackageID> id;
- bool dependency_tags;
- const bool only_if_suggested_label;
- std::set<SetName> recursing_sets;
- LabelsStack labels;
-
- Imp(DepList * const d, std::shared_ptr<const DestinationsSet> dd,
- const Environment * const e, const std::shared_ptr<const PackageID> & p, bool t, bool l) :
- dep_list(d),
- destinations(dd),
- environment(e),
- id(p),
- dependency_tags(t),
- only_if_suggested_label(l)
- {
- labels.push_front(std::make_shared<DependenciesLabelSequence>());
- }
- };
-}
-
-ShowSuggestVisitor::ShowSuggestVisitor(DepList * const d, const std::shared_ptr<const DestinationsSet> & dd,
- const Environment * const e, const std::shared_ptr<const PackageID> & p, bool t, bool l) :
- _imp(d, dd, e, p, t, l)
-{
-}
-
-ShowSuggestVisitor::~ShowSuggestVisitor()
-{
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- if (node.spec()->condition_met(_imp->environment, _imp->id))
- {
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- }
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
-{
-}
-
-namespace
-{
- struct SuggestActiveVisitor
- {
- bool visit(const DependenciesBuildLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesTestLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesRunLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesPostLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesCompileAgainstLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesFetchLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesInstallLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesRecommendationLabel &) const
- {
- return false;
- }
-
- bool visit(const DependenciesSuggestionLabel &) const
- {
- return true;
- }
- };
-
- bool is_suggest_label(const std::shared_ptr<const DependenciesLabel> & l)
- {
- return l->accept_returning<bool>(SuggestActiveVisitor());
- }
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- Context context("When adding suggested dep '" + stringify(*node.spec()) + "':");
-
- if (_imp->only_if_suggested_label)
- {
- if ((*_imp->labels.begin())->end() == std::find_if(((*_imp->labels.begin())->begin()),
- ((*_imp->labels.begin())->end()),
- is_suggest_label))
- {
- Log::get_instance()->message("dep_list.show_suggest_visitor.skipping_suggested", ll_debug, lc_context)
- << "Skipping dep '" << *node.spec() << "' because no suggested label is active";
- return;
- }
- }
-
- std::shared_ptr<const PackageIDSequence> installed_matches((*_imp->environment)[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options())
- | filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]);
- if (! installed_matches->empty())
- {
- Log::get_instance()->message("dep_list.show_suggest_visitor.already_installed", ll_debug, lc_context)
- << "Suggestion '" << *node.spec() << "' already matched by installed packages '"
- << join(indirect_iterator(installed_matches->begin()), indirect_iterator(installed_matches->end()), ", ")
- << "', not suggesting it";
- return;
- }
-
- std::shared_ptr<const PackageIDSequence> matches((*_imp->environment)[selection::AllVersionsSorted(
- generator::Matches(*node.spec(), _imp->id, _imp->dep_list->options()->match_package_options())
- | filter::SupportsAction<InstallAction>())]);
- if (matches->empty())
- {
- Log::get_instance()->message("dep_list.show_suggest_visitor.nothing_found", ll_warning, lc_context)
- << "Nothing found for '" << *node.spec() << "'";
- return;
- }
-
- for (PackageIDSequence::ConstIterator m(matches->begin()), m_end(matches->end()) ;
- m != m_end ; ++m)
- {
- if ((*m)->masked())
- continue;
-
- _imp->dep_list->add_suggested_package(*m, *node.spec(), _imp->destinations);
- return;
- }
-
- Log::get_instance()->message("dep_list.show_suggest_visitor.nothing_visible_found", ll_warning, lc_context)
- << "Nothing visible found for '" << *node.spec() << "'";
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
-{
- std::shared_ptr<DependenciesLabelSequence> labels(std::make_shared<DependenciesLabelSequence>());
- std::copy(node.spec()->begin(), node.spec()->end(), labels->back_inserter());
- *_imp->labels.begin() = labels;
-}
-
-void
-ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- Context context("When expanding named set '" + stringify(*node.spec()) + "':");
-
- const std::shared_ptr<const SetSpecTree> set(_imp->environment->set(node.spec()->name()));
-
- if (! set)
- {
- Log::get_instance()->message("dep_list.show_suggest_visitor.unknown_set", ll_warning, lc_context)
- << "Unknown set '" << node.spec()->name() << "'";
- return;
- }
-
- if (! _imp->recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("dep_list.show_suggest_visitor.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- _imp->recursing_sets.erase(node.spec()->name());
-}
-
diff --git a/paludis/legacy/show_suggest_visitor.hh b/paludis/legacy/show_suggest_visitor.hh
deleted file mode 100644
index 3c0c72f..0000000
--- a/paludis/legacy/show_suggest_visitor.hh
+++ /dev/null
@@ -1,75 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_SHOW_SUGGEST_VISITOR_HH
-#define PALUDIS_GUARD_PALUDIS_SHOW_SUGGEST_VISITOR_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/legacy/dep_list-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
-
-/** \file
- * Declarations for ShowSuggestVisitor, which is used internally by DepList.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Used by DepList to add suggested deps.
- *
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class ShowSuggestVisitor
- {
- private:
- Pimp<ShowSuggestVisitor> _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- ShowSuggestVisitor(DepList * const dd, const std::shared_ptr<const DestinationsSet> & ddd,
- const Environment * const, const std::shared_ptr<const PackageID> &, bool, bool);
- ~ShowSuggestVisitor();
-
- ///\}
-
- ///\name Visitor operations
- ///\{
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
-
- ///\}
- };
-}
-
-#endif
diff --git a/paludis/legacy/sync_task.cc b/paludis/legacy/sync_task.cc
deleted file mode 100644
index 0717f63..0000000
--- a/paludis/legacy/sync_task.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/sync_task.hh>
-#include <paludis/environment.hh>
-#include <paludis/syncer.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/action_queue.hh>
-#include <paludis/util/mutex.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/package_database.hh>
-#include <paludis/hook.hh>
-#include <paludis/create_output_manager_info.hh>
-#include <paludis/output_manager.hh>
-#include <functional>
-#include <algorithm>
-#include <list>
-
-using namespace paludis;
-
-namespace paludis
-{
- template<>
- struct Imp<SyncTask>
- {
- Environment * const env;
- std::list<RepositoryName> targets;
- const bool parallel;
-
- Imp(Environment * const e, const bool p) :
- env(e),
- parallel(p)
- {
- }
- };
-
- template <>
- struct WrappedForwardIteratorTraits<SyncTask::TargetsConstIteratorTag>
- {
- typedef std::list<RepositoryName>::const_iterator UnderlyingIterator;
- };
-}
-
-SyncTask::SyncTask(Environment * const env, const bool p) :
- _imp(env, p)
-{
-}
-
-SyncTask::~SyncTask()
-{
-}
-
-void
-SyncTask::add_target(const std::string & t)
-{
- Context context("When adding sync target '" + t + "':");
- _imp->targets.push_back(RepositoryName(t));
-}
-
-namespace
-{
- struct ItemSyncer
- {
- typedef void result;
-
- Mutex mutex;
- int x, y, a;
- Environment * const env;
- SyncTask * const task;
-
- ItemSyncer(int yy, Environment * const e, SyncTask * const t) :
- x(0),
- y(yy),
- a(0),
- env(e),
- task(t)
- {
- }
-
- void sync(const RepositoryName & r)
- {
- Context context_local("When syncing repository '" + stringify(r) + "':");
-
- {
- Lock l(mutex);
- ++x;
- ++a;
- task->on_sync_status(x, y, a);
- }
-
- try
- {
- if (0 !=
- env->perform_hook(Hook("sync_pre")("TARGET", stringify(r))
- ("X_OF_Y", stringify(x) + " of " + stringify(y) + " (" + stringify(a) + " active)"),
- make_null_shared_ptr()).max_exit_status())
- throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
-
- {
- Lock l(mutex);
- task->on_sync_pre(r);
- }
-
- std::shared_ptr<const Repository> rr(env->package_database()->fetch_repository(r));
- CreateOutputManagerForRepositorySyncInfo info(rr->name(), oe_exclusive, ClientOutputFeatures());
- std::shared_ptr<OutputManager> output_manager(env->create_output_manager(info));
- if (rr->sync("", output_manager))
- {
- Lock l(mutex);
- task->on_sync_succeed(r);
- }
- else
- {
- Lock l(mutex);
- task->on_sync_skip(r);
- }
- output_manager->succeeded();
-
- {
- Lock l(mutex);
- task->on_sync_post(r);
- }
-
- if (0 !=
- env->perform_hook(Hook("sync_post")("TARGET", stringify(r))
- ("X_OF_Y", stringify(x) + " of " + stringify(y) + " (" + stringify(a) + " active)") ,
- make_null_shared_ptr()).max_exit_status())
- throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
-
- {
- Lock l(mutex);
- --a;
- task->on_sync_status(x, y, a);
- }
- }
- catch (const SyncFailedError & e)
- {
- HookResult PALUDIS_ATTRIBUTE((unused)) dummy(env->perform_hook(Hook("sync_fail")("TARGET", stringify(r))
- ("X_OF_Y", stringify(x) + " of " + stringify(y) + " (" + stringify(a) + " active)") ,
- make_null_shared_ptr()));
- Lock l(mutex);
- task->on_sync_fail(r, e);
- --a;
- task->on_sync_status(x, y, a);
- }
- }
- };
-}
-
-void
-SyncTask::execute()
-{
- Context context("When executing sync task:");
-
- if (_imp->targets.empty())
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- _imp->targets.push_back((*r)->name());
-
- if (0 !=
- _imp->env->perform_hook(Hook("sync_all_pre")("TARGETS", join(_imp->targets.begin(),
- _imp->targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw SyncFailedError("Sync aborted by hook");
- on_sync_all_pre();
-
- ItemSyncer s(std::distance(_imp->targets.begin(), _imp->targets.end()), _imp->env, this);
-
- using namespace std::placeholders;
- if (_imp->parallel)
- {
- ActionQueue actions(5);
- for (std::list<RepositoryName>::const_iterator t(_imp->targets.begin()), t_end(_imp->targets.end()) ;
- t != t_end ; ++t)
- actions.enqueue(std::bind(&ItemSyncer::sync, &s, *t));
- }
- else
- std::for_each(_imp->targets.begin(), _imp->targets.end(), std::bind(&ItemSyncer::sync, &s, _1));
-
- for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
- r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- {
- (*r)->invalidate();
- (*r)->purge_invalid_cache();
- }
-
- on_sync_all_post();
- if (0 !=
- _imp->env->perform_hook(Hook("sync_all_post")("TARGETS", join(_imp->targets.begin(),
- _imp->targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw SyncFailedError("Sync aborted by hook");
-}
-
-SyncTask::TargetsConstIterator
-SyncTask::begin_targets() const
-{
- return TargetsConstIterator(_imp->targets.begin());
-}
-
-SyncTask::TargetsConstIterator
-SyncTask::end_targets() const
-{
- return TargetsConstIterator(_imp->targets.end());
-}
-
-template class WrappedForwardIterator<SyncTask::TargetsConstIteratorTag, const RepositoryName>;
-
diff --git a/paludis/legacy/sync_task.hh b/paludis/legacy/sync_task.hh
deleted file mode 100644
index 31384ae..0000000
--- a/paludis/legacy/sync_task.hh
+++ /dev/null
@@ -1,113 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2010, 2011 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_SYNC_TASK_HH
-#define PALUDIS_GUARD_PALUDIS_SYNC_TASK_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-#include <paludis/util/attributes.hh>
-#include <paludis/name-fwd.hh>
-#include <string>
-
-/** \file
- * Declarations for SyncTask.
- *
- * \ingroup g_tasks
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- class Environment;
- class SyncFailedError;
-
- /**
- * Task to handle syncing some or all repositories.
- *
- * \ingroup g_tasks
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE SyncTask
- {
- private:
- Pimp<SyncTask> _imp;
-
- protected:
- ///\name Basic operations
- ///\{
-
- SyncTask(Environment * const env, const bool parallel);
-
- ///\}
-
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~SyncTask();
-
- SyncTask(const SyncTask &) = delete;
- SyncTask & operator= (const SyncTask &) = delete;
-
- ///\}
-
- ///\name Add targets
- ///\{
-
- void add_target(const std::string &);
-
- ///\}
-
- ///\name Event callbacks
- ///\{
-
- virtual void on_sync_all_pre() = 0;
- virtual void on_sync_pre(const RepositoryName &) = 0;
- virtual void on_sync_post(const RepositoryName &) = 0;
- virtual void on_sync_skip(const RepositoryName &) = 0;
- virtual void on_sync_fail(const RepositoryName &, const SyncFailedError &) = 0;
- virtual void on_sync_succeed(const RepositoryName &) = 0;
- virtual void on_sync_all_post() = 0;
-
- virtual void on_sync_status(const int x, const int y, const int a) = 0;
-
- ///\}
-
- ///\name Target iteration
- ///\{
-
- struct TargetsConstIteratorTag;
- typedef WrappedForwardIterator<TargetsConstIteratorTag, const RepositoryName> TargetsConstIterator;
- TargetsConstIterator begin_targets() const;
- TargetsConstIterator end_targets() const;
-
- ///\}
-
- /**
- * Run the task.
- */
- virtual void execute();
- };
-}
-
-#endif
diff --git a/paludis/legacy/tasks_exceptions.cc b/paludis/legacy/tasks_exceptions.cc
deleted file mode 100644
index 33565f7..0000000
--- a/paludis/legacy/tasks_exceptions.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2010 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/legacy/tasks_exceptions.hh>
-
-using namespace paludis;
-
-MultipleSetTargetsSpecified::MultipleSetTargetsSpecified() throw () :
- Exception("More than one set target was specified")
-{
-}
-
-HadBothPackageAndSetTargets::HadBothPackageAndSetTargets() throw () :
- Exception("Both package and set targets were specified")
-{
-}
-
-
diff --git a/paludis/legacy/tasks_exceptions.hh b/paludis/legacy/tasks_exceptions.hh
deleted file mode 100644
index 9d8a733..0000000
--- a/paludis/legacy/tasks_exceptions.hh
+++ /dev/null
@@ -1,65 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 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_TASKS_EXCEPTIONS_HH
-#define PALUDIS_GUARD_PALUDIS_TASKS_EXCEPTIONS_HH 1
-
-#include <paludis/util/exception.hh>
-
-/** \file
- * Declarations for exceptions for tasks.
- *
- * \ingroup g_tasks
- * \ingroup g_exceptions
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- /**
- * Thrown if multiple set targets are specified.
- *
- * \ingroup g_exceptions
- * \ingroup g_tasks
- */
- class PALUDIS_VISIBLE MultipleSetTargetsSpecified :
- public Exception
- {
- public:
- MultipleSetTargetsSpecified() throw ();
- };
-
- /**
- * Thrown if both sets and packages are specified as targets.
- *
- * \ingroup g_exceptions
- * \ingroup g_tasks
- */
- class PALUDIS_VISIBLE HadBothPackageAndSetTargets :
- public Exception
- {
- public:
- HadBothPackageAndSetTargets() throw ();
- };
-}
-
-#endif
diff --git a/paludis/legacy/uninstall_list.cc b/paludis/legacy/uninstall_list.cc
deleted file mode 100644
index d21d1a1..0000000
--- a/paludis/legacy/uninstall_list.cc
+++ /dev/null
@@ -1,614 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/uninstall_list.hh>
-#include <paludis/environment.hh>
-#include <paludis/util/join.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/set-impl.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/wrapped_output_iterator-impl.hh>
-#include <paludis/util/hashes.hh>
-#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/match_package.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/dep_tag.hh>
-#include <paludis/slot_requirement.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/selection.hh>
-#include <paludis/dep_spec_flattener.hh>
-#include <unordered_map>
-#include <list>
-#include <algorithm>
-#include <set>
-
-using namespace paludis;
-
-#include <paludis/legacy/uninstall_list-se.cc>
-
-typedef std::unordered_map<
- std::shared_ptr<const PackageID>,
- std::shared_ptr<const DepListEntryTags>,
- Hash<std::shared_ptr<const PackageID> > > DepCollectorCache;
-
-namespace paludis
-{
- template<>
- struct Imp<UninstallList>
- {
- const Environment * const env;
- UninstallListOptions options;
- std::list<UninstallListEntry> uninstall_list;
-
- mutable Mutex dep_collector_cache_mutex;
- mutable DepCollectorCache dep_collector_cache;
-
- Imp(const Environment * const e, const UninstallListOptions & o) :
- env(e),
- options(o)
- {
- }
- };
-
- template <>
- struct WrappedForwardIteratorTraits<UninstallList::UninstallListTag>
- {
- typedef std::list<UninstallListEntry>::const_iterator UnderlyingIterator;
- };
-}
-
-namespace
-{
- struct MatchUninstallListEntry
- {
- const std::shared_ptr<const PackageID> e;
-
- MatchUninstallListEntry(const std::shared_ptr<const PackageID> & ee) :
- e(ee)
- {
- }
-
- bool operator() (const UninstallListEntry & f) const
- {
- return *f.package_id() == *e;
- }
- };
-}
-
-UninstallList::UninstallList(const Environment * const env, const UninstallListOptions & o) :
- _imp(env, o),
- options(_imp->options)
-{
-}
-
-UninstallList::~UninstallList()
-{
-}
-
-void
-UninstallList::add(const std::shared_ptr<const PackageID> & e, const std::shared_ptr<DepTag> & t)
-{
- real_add(e, t, false);
-}
-
-void
-UninstallList::real_add(const std::shared_ptr<const PackageID> & e, const std::shared_ptr<DepTag> & t,
- const bool error)
-{
- std::list<UninstallListEntry>::iterator i;
- if (_imp->uninstall_list.end() != ((i = std::find_if(_imp->uninstall_list.begin(),
- _imp->uninstall_list.end(), MatchUninstallListEntry(e)))))
- {
- if (t)
- i->tags()->insert(t);
-
- return;
- }
-
- Context context("When adding '" + stringify(*e) + "' to the uninstall list:");
-
- if ((! error) || (! e->virtual_for_key()))
- add_package(e, t, error ? ulk_requires : (e->virtual_for_key() ? ulk_virtual : ulk_package));
-
- if (! error)
- {
- /* don't recurse errors, it gets horrid */
- if (_imp->options.with_dependencies_included())
- add_dependencies(*e, false);
- else if (_imp->options.with_dependencies_as_errors())
- add_dependencies(*e, true);
- }
-
- move_package_to_end(e);
-
- if (_imp->options.with_unused_dependencies())
- add_unused_dependencies();
-}
-
-void
-UninstallList::add_errors_for_system()
-{
- Context context("When finding system packages:");
-
- std::shared_ptr<const SetSpecTree> system(_imp->env->set(SetName("system")));
- if (! system)
- return;
-
- std::shared_ptr<Set<std::shared_ptr<DepTag> > > tags(std::make_shared<Set<std::shared_ptr<DepTag> >>());
- tags->insert(std::make_shared<GeneralSetDepTag>(SetName("system"), ""));
-
- for (std::list<UninstallListEntry>::iterator l(_imp->uninstall_list.begin()), l_end(_imp->uninstall_list.end()) ;
- l != l_end ; ++l)
- {
- if (l->kind() == ulk_requires)
- continue;
-
- bool needed(false);
- if (match_package_in_set(*_imp->env, *system, l->package_id(), { }))
- needed = true;
-
- if ((! needed) && l->package_id()->provide_key())
- {
- DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, l->package_id());
- l->package_id()->provide_key()->value()->top()->accept(f);
- for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator v(f.begin()), v_end(f.end()) ;
- v != v_end && ! needed ; ++v)
- {
- const std::shared_ptr<const PackageIDSequence> virtuals((*_imp->env)[selection::AllVersionsUnsorted(
- generator::Matches(**v, l->package_id(), { }))]);
- for (PackageIDSequence::ConstIterator i(virtuals->begin()), i_end(virtuals->end()) ;
- i != i_end && ! needed ; ++i)
- if (match_package_in_set(*_imp->env, *system, *i, { }))
- needed = true;
- }
- }
-
- if (needed)
- _imp->uninstall_list.insert(l, make_named_values<UninstallListEntry>(
- n::kind() = ulk_required_by,
- n::package_id() = l->package_id(),
- n::tags() = tags
- ));
- }
-}
-
-void
-UninstallList::add_unused()
-{
- Context context("When finding unused packages:");
-
- std::shared_ptr<const PackageIDSet> world(collect_world()),
- everything(collect_all_installed()), used(collect_used());
-
- std::shared_ptr<PackageIDSet>
- world_plus_deps(std::make_shared<PackageIDSet>()),
- unused(std::make_shared<PackageIDSet>());
-
- std::copy(world->begin(), world->end(), world_plus_deps->inserter());
- std::copy(used->begin(), used->end(), world_plus_deps->inserter());
-
- std::size_t old_size(0);
- while (old_size != world_plus_deps->size())
- {
- old_size = world_plus_deps->size();
- std::shared_ptr<const PackageIDSet> new_world_deps(collect_depped_upon(world_plus_deps));
- std::copy(new_world_deps->begin(), new_world_deps->end(), world_plus_deps->inserter());
- }
-
- std::set_difference(everything->begin(), everything->end(),
- world_plus_deps->begin(), world_plus_deps->end(), unused->inserter(),
- PackageIDSetComparator());
-
- for (PackageIDSet::ConstIterator i(unused->begin()), i_end(unused->end()) ; i != i_end ; ++i)
- add_package(*i, std::shared_ptr<DepTag>(), (*i)->virtual_for_key() ? ulk_virtual : ulk_package);
-}
-
-UninstallList::ConstIterator
-UninstallList::begin() const
-{
- return ConstIterator(_imp->uninstall_list.begin());
-}
-
-UninstallList::ConstIterator
-UninstallList::end() const
-{
- return ConstIterator(_imp->uninstall_list.end());
-}
-
-void
-UninstallList::add_package(const std::shared_ptr<const PackageID> & e, const std::shared_ptr<DepTag> & t,
- const UninstallListEntryKind k)
-{
- Context context("When adding package '" + stringify(*e) + "' to the uninstall list:");
-
- std::list<UninstallListEntry>::iterator i(_imp->uninstall_list.insert(
- _imp->uninstall_list.end(), make_named_values<UninstallListEntry>(
- n::kind() = k,
- n::package_id() = e,
- n::tags() = std::make_shared<Set<std::shared_ptr<DepTag> >>()
- )));
-
- if (t)
- i->tags()->insert(t);
-}
-
-void
-UninstallList::move_package_to_end(const std::shared_ptr<const PackageID> & e)
-{
- Context context("When removing package '" + stringify(*e) + "' from the uninstall list:");
-
- std::list<UninstallListEntry>::iterator i(std::find_if(_imp->uninstall_list.begin(),
- _imp->uninstall_list.end(), MatchUninstallListEntry(e)));
- if (_imp->uninstall_list.end() != i)
- _imp->uninstall_list.splice(_imp->uninstall_list.end(), _imp->uninstall_list, i);
-}
-
-std::shared_ptr<const PackageIDSet>
-UninstallList::collect_all_installed() const
-{
- Context context("When collecting all installed packages:");
-
- std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
- for (PackageDatabase::RepositoryConstIterator i(_imp->env->package_database()->begin_repositories()),
- i_end(_imp->env->package_database()->end_repositories()) ; i != i_end ; ++i)
- {
- if (! (*i)->installed_root_key())
- continue;
-
- std::shared_ptr<const CategoryNamePartSet> cats((*i)->category_names());
- for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
- c != c_end ; ++c)
- {
- std::shared_ptr<const QualifiedPackageNameSet> pkgs((*i)->package_names(*c));
- for (QualifiedPackageNameSet::ConstIterator p(pkgs->begin()), p_end(pkgs->end()) ;
- p != p_end ; ++p)
- {
- std::shared_ptr<const PackageIDSequence> ids((*i)->package_ids(*p));
- std::copy(ids->begin(), ids->end(), result->inserter());
- }
- }
- }
-
- return result;
-}
-
-namespace
-{
- struct DepCollector
- {
- const Environment * const env;
- const std::shared_ptr<const PackageID> pkg;
- std::shared_ptr<DepListEntryTags> matches;
- std::set<SetName> recursing_sets;
-
- DepCollector(const Environment * const ee, const std::shared_ptr<const PackageID> & e) :
- env(ee),
- pkg(e),
- matches(std::make_shared<DepListEntryTags>())
- {
- }
-
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- bool best_only(false);
- if (node.spec()->slot_requirement_ptr())
- best_only = simple_visitor_cast<const SlotAnyUnlockedRequirement>(*node.spec()->slot_requirement_ptr());
-
- std::shared_ptr<const PackageIDSequence> m(
- best_only ?
- (*env)[selection::BestVersionOnly(generator::Matches(*node.spec(), pkg, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))] :
- (*env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), pkg, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
- for (PackageIDSequence::ConstIterator it = m->begin(), it_end = m->end();
- it_end != it; ++it)
- matches->insert(make_named_values<DepTagEntry>(
- n::generation() = 0,
- n::tag() = std::shared_ptr<const DepTag>(std::make_shared<DependencyDepTag>(*it, *node.spec()))
- ));
- }
-
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
- {
- if (node.spec()->condition_met(env, pkg))
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()),
- accept_visitor(*this));
- }
-
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
- {
- Context context("When expanding named set '" + stringify(*node.spec()) + "':");
-
- std::shared_ptr<const SetSpecTree> set(env->set(node.spec()->name()));
-
- if (! set)
- {
- Log::get_instance()->message("uninstall_list.unknown_set", ll_warning, lc_context) << "Unknown set '" << node.spec()->name() << "'";
- return;
- }
-
- if (! recursing_sets.insert(node.spec()->name()).second)
- {
- Log::get_instance()->message("uninstall_list.recursive_set", ll_warning, lc_context)
- << "Recursively defined set '" << node.spec()->name() << "'";
- return;
- }
-
- set->top()->accept(*this);
-
- recursing_sets.erase(node.spec()->name());
- }
- };
-}
-
-std::shared_ptr<const PackageIDSet>
-UninstallList::collect_depped_upon(std::shared_ptr<const PackageIDSet> targets) const
-{
- Context context("When collecting depended upon packages:");
-
- std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
-
- Lock l(_imp->dep_collector_cache_mutex);
- for (PackageIDSet::ConstIterator i(targets->begin()), i_end(targets->end()) ;
- i != i_end ; ++i)
- {
- Context local_context("When collecting depended upon packages for '" + stringify(**i) + "':");
-
- DepCollectorCache::const_iterator cache(_imp->dep_collector_cache.find(*i));
-
- if (cache == _imp->dep_collector_cache.end())
- {
- DepCollector c(_imp->env, *i);
- if ((*i)->build_dependencies_key())
- (*i)->build_dependencies_key()->value()->top()->accept(c);
- if ((*i)->run_dependencies_key())
- (*i)->run_dependencies_key()->value()->top()->accept(c);
- if ((*i)->post_dependencies_key())
- (*i)->post_dependencies_key()->value()->top()->accept(c);
- if ((*i)->suggested_dependencies_key())
- (*i)->suggested_dependencies_key()->value()->top()->accept(c);
-
- cache = _imp->dep_collector_cache.insert(std::make_pair(*i,
- std::shared_ptr<const DepListEntryTags>(c.matches))).first;
- }
-
- for (DepListEntryTags::ConstIterator it(cache->second->begin()), it_end(cache->second->end());
- it_end != it; ++it)
- result->insert(std::static_pointer_cast<const DependencyDepTag>(it->tag())->package_id());
- }
-
- return result;
-}
-
-void
-UninstallList::add_unused_dependencies()
-{
- Context context("When adding unused dependencies:");
-
- bool added(true);
- std::shared_ptr<const PackageIDSet> everything(collect_all_installed());
- while (added)
- {
- added = false;
-
- /* find packages that're depped upon by anything in our uninstall list, excluding error
- * packages */
- std::shared_ptr<PackageIDSet> uninstall_list_targets(std::make_shared<PackageIDSet>());
- for (std::list<UninstallListEntry>::const_iterator i(_imp->uninstall_list.begin()),
- i_end(_imp->uninstall_list.end()) ; i != i_end ; ++i)
- if (i->kind() == ulk_package || i->kind() == ulk_virtual)
- uninstall_list_targets->insert(i->package_id());
-
- std::shared_ptr<const PackageIDSet> depped_upon_list(collect_depped_upon(uninstall_list_targets));
-
- /* find packages that're depped upon by anything not in our uninstall list */
- std::shared_ptr<PackageIDSet> everything_except_uninstall_list_targets(std::make_shared<PackageIDSet>());
- std::set_difference(everything->begin(), everything->end(),
- uninstall_list_targets->begin(), uninstall_list_targets->end(),
- everything_except_uninstall_list_targets->inserter(),
- PackageIDSetComparator());
-
- Log::get_instance()->message("uninstall_list.everything_except_uninstall_list_targets", ll_debug, lc_context)
- << "everything_except_uninstall_list_targets is '"
- << join(indirect_iterator(everything_except_uninstall_list_targets->begin()),
- indirect_iterator(everything_except_uninstall_list_targets->end()), " ") << "'";
-
- std::shared_ptr<const PackageIDSet> depped_upon_not_list(
- collect_depped_upon(everything_except_uninstall_list_targets));
-
- /* find unused dependencies */
- std::shared_ptr<PackageIDSet> unused_dependencies(std::make_shared<PackageIDSet>());
- std::set_difference(depped_upon_list->begin(), depped_upon_list->end(),
- depped_upon_not_list->begin(), depped_upon_not_list->end(), unused_dependencies->inserter(),
- PackageIDSetComparator());
-
- /* if any of them aren't already on the list, and aren't in world, add them and recurse */
- std::shared_ptr<const SetSpecTree> world(_imp->env->set(SetName("world")));
- for (PackageIDSet::ConstIterator i(unused_dependencies->begin()),
- i_end(unused_dependencies->end()) ; i != i_end ; ++i)
- {
- if (match_package_in_set(*_imp->env, *world, *i, { }))
- continue;
-
- if (_imp->uninstall_list.end() != std::find_if(_imp->uninstall_list.begin(),
- _imp->uninstall_list.end(), MatchUninstallListEntry(*i)))
- continue;
-
- add_package(*i, std::shared_ptr<DepTag>(), (*i)->virtual_for_key() ? ulk_virtual : ulk_package);
- added = true;
- }
- }
-}
-
-void
-UninstallList::add_dependencies(const PackageID & e, const bool error)
-{
- Context context("When adding things that depend upon '" + stringify(e) + "':");
-
- std::shared_ptr<const PackageIDSet> everything(collect_all_installed());
-
- Lock l(_imp->dep_collector_cache_mutex);
-
- for (PackageIDSet::ConstIterator i(everything->begin()),
- i_end(everything->end()) ; i != i_end ; ++i)
- {
- Context local_context("When seeing whether '" + stringify(**i) + "' has a dep:");
-
- DepCollectorCache::const_iterator cache(_imp->dep_collector_cache.find(*i));
-
- if (cache == _imp->dep_collector_cache.end())
- {
- DepCollector c(_imp->env, *i);
- if ((*i)->build_dependencies_key())
- (*i)->build_dependencies_key()->value()->top()->accept(c);
- if ((*i)->run_dependencies_key())
- (*i)->run_dependencies_key()->value()->top()->accept(c);
- if ((*i)->post_dependencies_key())
- (*i)->post_dependencies_key()->value()->top()->accept(c);
- if ((*i)->suggested_dependencies_key())
- (*i)->suggested_dependencies_key()->value()->top()->accept(c);
- cache = _imp->dep_collector_cache.insert(std::make_pair(*i,
- std::shared_ptr<const DepListEntryTags>(c.matches))).first;
- }
-
- bool logged(false);
- for (DepListEntryTags::ConstIterator it(cache->second->begin()), it_end(cache->second->end());
- it_end != it; ++it)
- {
- std::shared_ptr<const DependencyDepTag> tag(std::static_pointer_cast<const DependencyDepTag>(it->tag()));
- if (*tag->package_id() == e)
- {
- if (! logged)
- {
- Log::get_instance()->message("uninstall_list.adding", ll_debug, lc_context) << "Adding '" << **i <<
- "' because it depends upon '" << e << "'";
- logged = true;
- }
- real_add(*i, std::shared_ptr<DependencyDepTag>(
- std::make_shared<DependencyDepTag>(tag->package_id(), *tag->dependency())), error);
- }
- }
-
- }
-}
-
-std::shared_ptr<const PackageIDSet>
-UninstallList::collect_world() const
-{
- Context local_context("When collecting world packages:");
-
- std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
- std::shared_ptr<const PackageIDSet> everything(collect_all_installed());
-
- std::shared_ptr<const SetSpecTree> world(_imp->env->set(SetName("world")));
- for (PackageIDSet::ConstIterator i(everything->begin()),
- i_end(everything->end()) ; i != i_end ; ++i)
- {
- if (match_package_in_set(*_imp->env, *world, *i, { }))
- result->insert(*i);
- }
-
- return result;
-}
-
-std::shared_ptr<const PackageIDSet>
-UninstallList::collect_used() const
-{
- Context local_context("When collecting used packages:");
-
- std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>());
- std::shared_ptr<const PackageIDSet> everything(collect_all_installed());
-
- for (PackageIDSet::ConstIterator i(everything->begin()),
- i_end(everything->end()) ; i != i_end ; ++i)
- {
- if ((*i)->behaviours_key() && (*i)->behaviours_key()->value()->end() !=
- (*i)->behaviours_key()->value()->find("used"))
- result->insert(*i);
- }
-
- return result;
-}
-
-namespace
-{
- struct IsError
- {
- bool operator() (const UninstallListEntry & e) const
- {
- switch (e.kind())
- {
- case ulk_virtual:
- case ulk_package:
- return false;
-
- case ulk_requires:
- case ulk_required_by:
- return true;
-
- case last_ulk:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad e.kind");
- }
- };
-}
-
-bool
-UninstallList::has_errors() const
-{
- return end() != std::find_if(begin(), end(), IsError());
-}
-
-template class Set<std::shared_ptr<DepTag> >;
-template class WrappedForwardIterator<Set<std::shared_ptr<DepTag> >::ConstIteratorTag, const std::shared_ptr<DepTag> >;
-template class WrappedOutputIterator<Set<std::shared_ptr<DepTag> >::InserterTag, std::shared_ptr<DepTag> >;
-template class WrappedForwardIterator<UninstallList::UninstallListTag, const UninstallListEntry>;
-
diff --git a/paludis/legacy/uninstall_list.hh b/paludis/legacy/uninstall_list.hh
deleted file mode 100644
index f2add28..0000000
--- a/paludis/legacy/uninstall_list.hh
+++ /dev/null
@@ -1,163 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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_UNUSED_LIST_HH
-#define PALUDIS_GUARD_PALUDIS_UNUSED_LIST_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/named_value.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/dep_tag-fwd.hh>
-
-/** \file
- * Declarations for UninstallList and related classes.
- *
- * \ingroup g_dep_list
- *
- * \section Examples
- *
- * - None at this time. Use UninstallTask if you need to uninstall things.
- */
-
-namespace paludis
-{
-#include <paludis/legacy/uninstall_list-se.hh>
-
- namespace n
- {
- typedef Name<struct name_kind> kind;
- typedef Name<struct name_package_id> package_id;
- typedef Name<struct name_tags> tags;
- typedef Name<struct name_with_dependencies_as_errors> with_dependencies_as_errors;
- typedef Name<struct name_with_dependencies_included> with_dependencies_included;
- typedef Name<struct name_with_unused_dependencies> with_unused_dependencies;
- }
-
- /**
- * Parameters for an UninstallList.
- *
- * \see UninstallList
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- struct UninstallListOptions
- {
- NamedValue<n::with_dependencies_as_errors, bool> with_dependencies_as_errors;
- NamedValue<n::with_dependencies_included, bool> with_dependencies_included;
- NamedValue<n::with_unused_dependencies, bool> with_unused_dependencies;
- };
-
- /**
- * An entry in an UninstallList.
- *
- * \see UninstallList
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- struct UninstallListEntry
- {
- NamedValue<n::kind, UninstallListEntryKind> kind;
- NamedValue<n::package_id, std::shared_ptr<const PackageID> > package_id;
- NamedValue<n::tags, std::shared_ptr<Set<std::shared_ptr<DepTag> > > > tags;
- };
-
- class Environment;
-
- /**
- * Work out uninstall ordering for packages.
- *
- * \ingroup g_dep_list
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE UninstallList
- {
- private:
- Pimp<UninstallList> _imp;
-
- void add_package(const std::shared_ptr<const PackageID> &, const std::shared_ptr<DepTag> &,
- const UninstallListEntryKind k);
- void real_add(const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<DepTag> &, const bool);
- void move_package_to_end(const std::shared_ptr<const PackageID> &);
- void add_unused_dependencies();
- void add_dependencies(const PackageID &, const bool);
-
- std::shared_ptr<const PackageIDSet> collect_depped_upon(
- const std::shared_ptr<const PackageIDSet> targets) const;
-
- std::shared_ptr<const PackageIDSet> collect_all_installed() const;
-
- std::shared_ptr<const PackageIDSet> collect_world() const;
-
- std::shared_ptr<const PackageIDSet> collect_used() const;
-
- public:
- ///\name Basic operations
- ///\{
-
- UninstallList(const Environment * const, const UninstallListOptions &);
- virtual ~UninstallList();
-
- UninstallList(const UninstallList &) = delete;
- UninstallList & operator= (const UninstallList &) = delete;
-
- ///\}
-
- /**
- * Our options.
- */
- UninstallListOptions & options;
-
- /**
- * Add a package, optionally with a reason.
- */
- void add(const std::shared_ptr<const PackageID> &,
- const std::shared_ptr<DepTag> & = std::shared_ptr<DepTag>());
-
- /**
- * Add errors for any package on our uninstall list that is required by system.
- */
- void add_errors_for_system();
-
- /**
- * Add any unused packages that are dependencies of packages to uninstall.
- */
- void add_unused();
-
- /**
- * Whether we have any errors.
- */
- bool has_errors() const;
-
- ///\name Iterate over our items to remove
- ///\{
-
- struct UninstallListTag;
- typedef WrappedForwardIterator<UninstallListTag, const UninstallListEntry> ConstIterator;
- ConstIterator begin() const;
- ConstIterator end() const;
-
- ///\}
- };
-
- extern template class WrappedForwardIterator<UninstallList::UninstallListTag, const UninstallListEntry>;
-}
-
-#endif
diff --git a/paludis/legacy/uninstall_list.se b/paludis/legacy/uninstall_list.se
deleted file mode 100644
index 6903fbf..0000000
--- a/paludis/legacy/uninstall_list.se
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_UninstallListEntryKind()
-{
- prefix ulk
-
- key ulk_package "A package to be uninstalled"
- key ulk_requires "A package that requires its tags"
- key ulk_required_by "A package that is required by its tags"
- key ulk_virtual "A virtual"
-
- doxygen_comment <<"END"
- /**
- * Kind of an UninstallListEntry.
- *
- * \ingroup g_dep_list
- */
-END
-}
-
diff --git a/paludis/legacy/uninstall_list_TEST.cc b/paludis/legacy/uninstall_list_TEST.cc
deleted file mode 100644
index 67bd1b3..0000000
--- a/paludis/legacy/uninstall_list_TEST.cc
+++ /dev/null
@@ -1,510 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/uninstall_list.hh>
-#include <paludis/repositories/fake/fake_repository.hh>
-#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/return_literal_function.hh>
-#include <paludis/package_database.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/repository_factory.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <string>
-#include <list>
-#include <ostream>
-
-#include "config.h"
-
-using namespace paludis;
-using namespace test;
-
-namespace paludis
-{
- std::ostream &
- operator<< (std::ostream & s, const UninstallListEntry & e)
- {
- s << *e.package_id();
- return s;
- }
-}
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
-namespace
-{
- std::string virtuals_repo_keys(const std::string & key)
- {
- if (key == "format")
- return "virtuals";
- else
- return "";
- }
-}
-#endif
-
-namespace test_cases
-{
- /**
- * Convenience base class used by many of the UninstallList tests.
- *
- */
- class UninstallListTestCaseBase :
- public TestCase
- {
- protected:
- TestEnvironment env;
- std::shared_ptr<FakeInstalledRepository> installed_repo;
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- std::shared_ptr<Repository> virtuals_repo;
-#endif
- std::shared_ptr<PackageIDSequence> targets;
- std::list<std::string> expected;
- bool done_populate;
- bool unused_target;
-
- /**
- * Constructor.
- */
- UninstallListTestCaseBase(const std::string & s) :
- TestCase("uninstall list " + s),
- env(),
- installed_repo(std::make_shared<FakeInstalledRepository>(
- make_named_values<FakeInstalledRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("installed"),
- n::suitable_destination() = true,
- n::supports_uninstall() = true
- ))),
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- virtuals_repo(RepositoryFactory::get_instance()->create(&env, virtuals_repo_keys)),
-#endif
- targets(std::make_shared<PackageIDSequence>()),
- done_populate(false),
- unused_target(false)
- {
- env.package_database()->add_repository(2, installed_repo);
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- env.package_database()->add_repository(1, virtuals_repo);
-#endif
- }
-
- /**
- * Populate our repo member.
- */
- virtual void populate_repo() = 0;
-
- /**
- * Populate our targets.
- */
- virtual void populate_targets() = 0;
-
- void add_target(const std::string & p, const std::string & v)
- {
- targets->push_back(
- env.fetch_package_id(
- QualifiedPackageName(p),
- VersionSpec(v, { }),
- RepositoryName("installed")));
- }
-
- void add_unused_target()
- {
- unused_target = true;
- }
-
- /**
- * Populate our expected member.
- */
- virtual void populate_expected() = 0;
-
- /**
- * Check expected is what we got.
- */
- virtual void check_lists()
- {
- TEST_CHECK(true);
- UninstallList d(&env, options());
- if (unused_target)
- d.add_unused();
- else
- for (PackageIDSequence::ConstIterator i(targets->begin()),
- i_end(targets->end()) ; i != i_end ; ++i)
- d.add(*i);
- TEST_CHECK(true);
-
- TestMessageSuffix s("got={ " + join(d.begin(), d.end(), ", ") + " }", false);
- TestMessageSuffix s2("expected={ " + join(expected.begin(), expected.end(), ", ") + " }", false);
-
- std::list<std::string>::const_iterator exp(expected.begin());
- UninstallList::ConstIterator got(d.begin());
- while (true)
- {
- TEST_CHECK((exp == expected.end()) == (got == d.end()));
- if (got == d.end())
- break;
- TEST_CHECK_STRINGIFY_EQUAL(*got, *exp);
- ++exp;
- ++got;
- }
- }
-
- virtual UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = false
- );
- }
-
- public:
- void run()
- {
- if (! done_populate)
- {
- populate_repo();
- populate_targets();
- populate_expected();
- done_populate = true;
- }
- check_lists();
- }
- };
-
- struct UninstallListSimpleTest :
- public UninstallListTestCaseBase
- {
- UninstallListSimpleTest() : UninstallListTestCaseBase("simple") { }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- }
- } uninstall_list_simple_test;
-
- struct UninstallListRepeatTest :
- public UninstallListTestCaseBase
- {
- UninstallListRepeatTest() : UninstallListTestCaseBase("repeat") { }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- }
- } uninstall_list_repeat_test;
-
- struct UninstallListWithUnusedDepsTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsTest() : UninstallListTestCaseBase("with unused deps") { }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz");
- installed_repo->add_version("foo", "baz", "2");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_test;
-
- struct UninstallListWithUnusedDepsRecursiveTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsRecursiveTest() : UninstallListTestCaseBase("with unused deps recursive") { }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz");
- installed_repo->add_version("foo", "baz", "2")->build_dependencies_key()->set_from_string("foo/moo");
- installed_repo->add_version("foo", "moo", "3");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- expected.push_back("foo/moo-3:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_recursive_test;
-
- struct UninstallListWithUnusedDepsWithUsedTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsWithUsedTest() : UninstallListTestCaseBase("with unused deps with used") { }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz foo/oink");
- installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "3")->build_dependencies_key()->set_from_string("foo/oink");
- installed_repo->add_version("foo", "oink", "1");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_with_used_test;
-
- struct UninstallListWithUnusedDepsWithCrossUsedTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsWithCrossUsedTest() :
- UninstallListTestCaseBase("with unused deps with cross used") { }
-
- void populate_targets()
- {
- add_target("foo/moo", "3");
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz foo/oink");
- installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "3")->build_dependencies_key()->set_from_string("foo/oink");
- installed_repo->add_version("foo", "oink", "1");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/moo-3:0::installed");
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- expected.push_back("foo/oink-1:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_with_cross_used_test;
-
- struct UninstallListWithUnusedDepsWorldTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsWorldTest() :
- UninstallListTestCaseBase("with unused deps world")
- {
- std::shared_ptr<SetSpecTree> world(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("foo/moo", &env, { })));
- env.add_set(SetName("world"), SetName("world"), return_literal_function(world), false);
- }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz foo/moo");
- installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "2");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_world_test;
-
- struct UninstallListWithUnusedDepsWorldTargetTest :
- public UninstallListTestCaseBase
- {
- UninstallListWithUnusedDepsWorldTargetTest() :
- UninstallListTestCaseBase("with unused deps world target")
- {
- std::shared_ptr<SetSpecTree> world(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("foo/moo", &env, { })));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("foo/bar", &env, { })));
- env.add_set(SetName("world"), SetName("world"), return_literal_function(world), false);
- }
-
- void populate_targets()
- {
- add_target("foo/bar", "1");
- }
-
- void populate_repo()
- {
- installed_repo->add_version("foo", "bar", "1")->build_dependencies_key()->set_from_string("foo/baz foo/moo");
- installed_repo->add_version("foo", "baz", "2");
- installed_repo->add_version("foo", "moo", "2");
- }
-
- void populate_expected()
- {
- expected.push_back("foo/bar-1:0::installed");
- expected.push_back("foo/baz-2:0::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = true
- );
- }
- } uninstall_list_with_unused_deps_world_target_test;
-
- struct UninstallListWithSlotsTest :
- UninstallListTestCaseBase
- {
- UninstallListWithSlotsTest() :
- UninstallListTestCaseBase("with slots")
- {
- std::shared_ptr<SetSpecTree> world(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/needs-a", &env, { })));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/needs-b", &env, { })));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/needs-c", &env, { })));
- world->top()->append(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec("cat/needs-d", &env, { })));
- env.add_set(SetName("world"), SetName("world"), return_literal_function(world), false);
- }
-
- void populate_targets()
- {
- add_unused_target();
- }
-
- void populate_repo()
- {
- installed_repo->add_version("cat", "needs-a", "1")->run_dependencies_key()->set_from_string("cat/a:1");
- installed_repo->add_version("cat", "needs-b", "1")->run_dependencies_key()->set_from_string("cat/b:2");
- installed_repo->add_version("cat", "needs-c", "1")->run_dependencies_key()->set_from_string("cat/c");
- installed_repo->add_version("cat", "needs-d", "1")->run_dependencies_key()->set_from_string("cat/d:*");
-
- installed_repo->add_version("cat", "a", "1")->set_slot(SlotName("1"));
- installed_repo->add_version("cat", "a", "2")->set_slot(SlotName("2"));
-
- installed_repo->add_version("cat", "b", "1")->set_slot(SlotName("1"));
- installed_repo->add_version("cat", "b", "2")->set_slot(SlotName("2"));
-
- installed_repo->add_version("cat", "c", "1")->set_slot(SlotName("1"));
- installed_repo->add_version("cat", "c", "2")->set_slot(SlotName("2"));
-
- installed_repo->add_version("cat", "d", "1")->set_slot(SlotName("1"));
- installed_repo->add_version("cat", "d", "2")->set_slot(SlotName("2"));
- }
-
- void populate_expected()
- {
- expected.push_back("cat/a-2:2::installed");
- expected.push_back("cat/b-1:1::installed");
- expected.push_back("cat/d-1:1::installed");
- }
-
- UninstallListOptions options()
- {
- return make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = false,
- n::with_dependencies_included() = false,
- n::with_unused_dependencies() = false
- );
- }
- } uninstall_list_slots_test;
-}
-
diff --git a/paludis/legacy/uninstall_task.cc b/paludis/legacy/uninstall_task.cc
deleted file mode 100644
index 4fc3e73..0000000
--- a/paludis/legacy/uninstall_task.cc
+++ /dev/null
@@ -1,492 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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/legacy/uninstall_task.hh>
-#include <paludis/legacy/uninstall_list.hh>
-#include <paludis/environment.hh>
-#include <paludis/action.hh>
-#include <paludis/dep_spec_flattener.hh>
-#include <paludis/legacy/tasks_exceptions.hh>
-#include <paludis/user_dep_spec.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/util/pimp-impl.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/package_database.hh>
-#include <paludis/hook.hh>
-#include <paludis/dep_tag.hh>
-#include <paludis/repository.hh>
-#include <paludis/output_manager_from_environment.hh>
-#include <paludis/output_manager.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-#include <map>
-#include <set>
-#include <list>
-#include <algorithm>
-#include <functional>
-
-using namespace paludis;
-
-AmbiguousUnmergeTargetError::AmbiguousUnmergeTargetError(const std::string & t,
- const std::shared_ptr<const PackageIDSequence> m) throw () :
- Exception("Ambiguous unmerge target '" + t + "'"),
- _t(t),
- _p(m)
-{
-}
-
-AmbiguousUnmergeTargetError::~AmbiguousUnmergeTargetError() throw ()
-{
-}
-
-AmbiguousUnmergeTargetError::ConstIterator
-AmbiguousUnmergeTargetError::begin() const
-{
- return ConstIterator(_p->begin());
-}
-
-AmbiguousUnmergeTargetError::ConstIterator
-AmbiguousUnmergeTargetError::end() const
-{
- return ConstIterator(_p->end());
-}
-
-std::string
-AmbiguousUnmergeTargetError::target() const
-{
- return _t;
-}
-
-namespace paludis
-{
- template<>
- struct Imp<UninstallTask>
- {
- Environment * const env;
-
- std::list<std::string> raw_targets;
- std::list<std::shared_ptr<const PackageDepSpec> > targets;
-
- bool pretend;
- bool preserve_world;
- bool all_versions;
- bool with_unused_dependencies;
- bool with_dependencies;
- bool unused;
- bool check_safety;
-
- bool had_set_targets;
- bool had_package_targets;
-
- Imp<UninstallTask>(Environment * const e) :
- env(e),
- pretend(false),
- preserve_world(false),
- all_versions(false),
- with_unused_dependencies(false),
- with_dependencies(false),
- unused(false),
- check_safety(false),
- had_set_targets(false),
- had_package_targets(false)
- {
- }
- };
-
- template <>
- struct WrappedForwardIteratorTraits<AmbiguousUnmergeTargetError::ConstIteratorTag>
- {
- typedef PackageIDSequence::ConstIterator UnderlyingIterator;
- };
-}
-
-UninstallTask::UninstallTask(Environment * const e) :
- _imp(e)
-{
-}
-
-UninstallTask::~UninstallTask()
-{
-}
-
-void
-UninstallTask::set_pretend(const bool v)
-{
- _imp->pretend = v;
-}
-
-void
-UninstallTask::set_preserve_world(const bool v)
-{
- _imp->preserve_world = v;
-}
-
-void
-UninstallTask::set_check_safety(const bool v)
-{
- _imp->check_safety = v;
-}
-
-void
-UninstallTask::add_target(const std::string & target)
-{
- Context context("When adding uninstall target '" + target + "':");
-
- try
- {
- std::shared_ptr<PackageDepSpec> pds(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
- target, _imp->env, { updso_throw_if_set, updso_allow_wildcards },
- filter::SupportsAction<UninstallAction>())));
-
- if (_imp->had_set_targets)
- throw HadBothPackageAndSetTargets();
- _imp->had_package_targets = true;
-
- if (pds->package_ptr())
- {
- /* don't need to dewildcard */
- pds->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets.push_back(pds);
- }
- else
- {
- /* blech. wildcards. */
- std::shared_ptr<const PackageIDSequence> names((*_imp->env)[selection::BestVersionOnly(
- generator::Matches(*pds, make_null_shared_ptr(), { }) | filter::SupportsAction<UninstallAction>())]);
- if (names->empty())
- {
- /* no match. we'll get an error from this later anyway. */
- pds->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets.push_back(pds);
- }
- else
- {
- for (PackageIDSequence::ConstIterator i(names->begin()), i_end(names->end()) ;
- i != i_end ; ++i)
- {
- PartiallyMadePackageDepSpec p(*pds);
- p.package((*i)->name());
- std::shared_ptr<PackageDepSpec> pdsn(std::make_shared<PackageDepSpec>(p));
- pdsn->set_tag(std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()));
- _imp->targets.push_back(pdsn);
- }
- }
- }
- }
- catch (const GotASetNotAPackageDepSpec &)
- {
- if (_imp->had_set_targets)
- throw MultipleSetTargetsSpecified();
- if (_imp->had_package_targets)
- throw HadBothPackageAndSetTargets();
- _imp->had_set_targets = true;
-
- std::shared_ptr<const SetSpecTree> spec(_imp->env->set(SetName(target)));
- DepSpecFlattener<SetSpecTree, PackageDepSpec> f(_imp->env, make_null_shared_ptr());
- spec->top()->accept(f);
- std::copy(f.begin(), f.end(), std::back_inserter(_imp->targets));
- }
-
- _imp->raw_targets.push_back(target);
-
- if (_imp->unused)
- throw InternalError(PALUDIS_HERE, "Trying to mix unused and normal targets?");
-}
-
-void
-UninstallTask::add_unused()
-{
- Context context("When adding unused packages:");
- _imp->unused = true;
-
- if (! _imp->raw_targets.empty())
- throw InternalError(PALUDIS_HERE, "Trying to mix unused and normal targets?");
-}
-
-namespace
-{
- bool ignore_nothing(const FSPath &)
- {
- return false;
- }
-}
-
-void
-UninstallTask::execute()
-{
- using namespace std::placeholders;
-
- Context context("When executing uninstall task:");
-
- on_build_unmergelist_pre();
-
- UninstallList list(_imp->env, make_named_values<UninstallListOptions>(
- n::with_dependencies_as_errors() = _imp->check_safety,
- n::with_dependencies_included() = _imp->with_dependencies,
- n::with_unused_dependencies() = _imp->with_unused_dependencies
- ));
-
- if (_imp->unused)
- list.add_unused();
- else
- {
- for (std::list<std::shared_ptr<const PackageDepSpec> >::const_iterator t(_imp->targets.begin()),
- t_end(_imp->targets.end()) ; t != t_end ; ++t)
- {
- Context local_context("When looking for target '" + stringify(**t) + "':");
-
- std::shared_ptr<const PackageIDSequence> r((*_imp->env)[selection::AllVersionsSorted(
- generator::Matches(**t, make_null_shared_ptr(), { }) |
- filter::SupportsAction<UninstallAction>())]);
- if (r->empty())
- {
- if (! _imp->had_set_targets)
- throw NoSuchPackageError(stringify(**t));
- }
- else if (next(r->begin()) != r->end())
- {
- if (_imp->all_versions)
- {
- /* all_versions, not all_packages. */
- for (PackageIDSequence::ConstIterator i_start(r->begin()), i(r->begin()),
- i_end(r->end()) ; i != i_end ; ++i)
- if ((*i)->name() != (*i_start)->name())
- throw AmbiguousUnmergeTargetError(stringify(**t), r);
-
- for (PackageIDSequence::ConstIterator i(r->begin()), i_end(r->end()) ;
- i != i_end ; ++i)
- list.add(*i);
- }
- else
- throw AmbiguousUnmergeTargetError(stringify(**t), r);
- }
- else
- list.add(*r->begin());
- }
-
- if (_imp->check_safety)
- list.add_errors_for_system();
- }
-
- on_build_unmergelist_post();
-
- on_display_unmerge_list_pre();
-
- for (UninstallList::ConstIterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
- on_display_unmerge_list_entry(*i);
-
- on_display_unmerge_list_post();
-
- if (_imp->pretend)
- return;
-
- if (list.has_errors())
- {
- on_not_continuing_due_to_errors();
- return;
- }
-
- if (_imp->preserve_world)
- on_preserve_world();
- else
- {
- on_update_world_pre();
-
- std::shared_ptr<SetSpecTree> all(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()));
-
- std::map<QualifiedPackageName, std::set<VersionSpec> > being_removed;
- for (UninstallList::ConstIterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
- if (i->kind() != ulk_virtual)
- being_removed[i->package_id()->name()].insert(i->package_id()->version());
-
- for (std::map<QualifiedPackageName, std::set<VersionSpec> >::const_iterator
- i(being_removed.begin()), i_end(being_removed.end()) ; i != i_end ; ++i)
- {
- bool remove(true);
- std::shared_ptr<const PackageIDSequence> installed((*_imp->env)[selection::AllVersionsUnsorted(
- generator::Matches(make_package_dep_spec({ }).package(i->first), make_null_shared_ptr(), { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value())
- )]);
- for (PackageIDSequence::ConstIterator r(installed->begin()), r_end(installed->end()) ;
- r != r_end && remove ; ++r)
- if (i->second.end() == i->second.find((*r)->version()))
- remove = false;
-
- if (remove)
- all->top()->append(std::make_shared<PackageDepSpec>(make_package_dep_spec(
- { }).package(i->first)));
- }
-
- world_remove_packages(all);
-
- if (_imp->had_set_targets)
- for (std::list<std::string>::const_iterator t(_imp->raw_targets.begin()),
- t_end(_imp->raw_targets.end()) ; t != t_end ; ++t)
- world_remove_set(SetName(*t));
-
- on_update_world_post();
- }
-
- if (0 !=
- _imp->env->perform_hook(Hook("uninstall_all_pre")("TARGETS", join(_imp->raw_targets.begin(),
- _imp->raw_targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Uninstall aborted by hook");
- on_uninstall_all_pre();
-
- int x(0), y(0);
- for (UninstallList::ConstIterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
- if (i->kind() != ulk_virtual)
- ++y;
-
- for (UninstallList::ConstIterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
- {
- if (i->kind() == ulk_virtual)
- continue;
- ++x;
-
- std::string cpvr(stringify(*i->package_id()));
-
- if (0 !=
- _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Uninstall of '" + cpvr + "' aborted by hook");
- on_uninstall_pre(*i);
-
- try
- {
- OutputManagerFromEnvironment output_manager_holder(_imp->env, i->package_id(), oe_exclusive,
- ClientOutputFeatures());
- UninstallAction uninstall_action(
- make_named_values<UninstallActionOptions>(
- n::config_protect() = "",
- n::if_for_install_id() = make_null_shared_ptr(),
- n::ignore_for_unmerge() = &ignore_nothing,
- n::is_overwrite() = false,
- n::make_output_manager() = std::ref(output_manager_holder)
- ));
- i->package_id()->perform_action(uninstall_action);
-
- if (output_manager_holder.output_manager_if_constructed())
- output_manager_holder.output_manager_if_constructed()->succeeded();
- }
- catch (const ActionFailedError & e)
- {
- HookResult PALUDIS_ATTRIBUTE((unused)) dummy(_imp->env->perform_hook(Hook("uninstall_fail")("TARGET", cpvr)("MESSAGE", e.message()),
- make_null_shared_ptr()));
- throw;
- }
-
- on_uninstall_post(*i);
- if (0 !=
- _imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y)),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Uninstall of '" + cpvr + "' aborted by hook");
- }
-
- on_uninstall_all_post();
- if (0 !=
- _imp->env->perform_hook(Hook("uninstall_all_post")("TARGETS", join(_imp->raw_targets.begin(),
- _imp->raw_targets.end(), " ")),
- make_null_shared_ptr()).max_exit_status())
- throw ActionAbortedError("Uninstall aborted by hook");
-}
-
-void
-UninstallTask::set_with_unused_dependencies(const bool value)
-{
- _imp->with_unused_dependencies = value;
-}
-
-void
-UninstallTask::set_with_dependencies(const bool value)
-{
- _imp->with_dependencies = value;
-}
-
-void
-UninstallTask::set_all_versions(const bool value)
-{
- _imp->all_versions = value;
-}
-
-void
-UninstallTask::world_remove_set(const SetName & s)
-{
- _imp->env->remove_from_world(s);
- on_update_world(s);
-}
-
-namespace
-{
- struct WorldTargetFinder
- {
- Environment * const env;
- UninstallTask * const task;
-
- WorldTargetFinder(Environment * const e, UninstallTask * const t) :
- env(e),
- task(t)
- {
- }
-
- void visit(const SetSpecTree::NodeType<AllDepSpec>::Type & node)
- {
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- }
-
- void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- if (! (node.spec()->slot_requirement_ptr() || (node.spec()->version_requirements_ptr() && ! node.spec()->version_requirements_ptr()->empty())))
- {
- if (node.spec()->package_ptr())
- env->remove_from_world(*node.spec()->package_ptr());
-
- task->on_update_world(*node.spec());
- }
- }
-
- void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type &)
- {
- }
- };
-}
-
-void
-UninstallTask::world_remove_packages(const std::shared_ptr<const SetSpecTree> & a)
-{
- WorldTargetFinder w(_imp->env, this);
- a->top()->accept(w);
-}
-
-template class WrappedForwardIterator<AmbiguousUnmergeTargetError::ConstIteratorTag, const std::shared_ptr<const PackageID> >;
-
diff --git a/paludis/legacy/uninstall_task.hh b/paludis/legacy/uninstall_task.hh
deleted file mode 100644
index 20621a7..0000000
--- a/paludis/legacy/uninstall_task.hh
+++ /dev/null
@@ -1,174 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2010, 2011 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_UNINSTALL_TASK_HH
-#define PALUDIS_GUARD_PALUDIS_UNINSTALL_TASK_HH 1
-
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/package_id.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/util/exception.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-
-/** \file
- * Declarations for UninstallTask.
- *
- * \ingroup g_tasks
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- class Environment;
- class UninstallListEntry;
-
- /**
- * Thrown if an ambiguous unmerge target is supplied.
- *
- * \ingroup g_exceptions
- * \ingroup g_tasks
- */
- class PALUDIS_VISIBLE AmbiguousUnmergeTargetError :
- public Exception
- {
- private:
- const std::string _t;
- const std::shared_ptr<const PackageIDSequence> _p;
-
- public:
- ///\name Basic operations
- ///\{
-
- AmbiguousUnmergeTargetError(const std::string & our_target,
- const std::shared_ptr<const PackageIDSequence> matches) throw ();
-
- ~AmbiguousUnmergeTargetError() throw ();
-
- ///\}
-
- ///\name Iterate over our entries
- ///\{
-
- struct ConstIteratorTag;
- typedef WrappedForwardIterator<ConstIteratorTag, const std::shared_ptr<const PackageID> > ConstIterator;
- ConstIterator begin() const;
- ConstIterator end() const;
-
- ///\}
-
- /**
- * What was our target?
- */
- std::string target() const;
- };
-
- /**
- * Task used to uninstall one or more targets.
- *
- * \ingroup g_tasks
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE UninstallTask
- {
- private:
- Pimp<UninstallTask> _imp;
-
- protected:
- ///\name Basic operations
- ///\{
-
- UninstallTask(Environment * const env);
-
- ///\}
-
- public:
- ///\name Basic operations
- ///\{
-
- virtual ~UninstallTask();
-
- UninstallTask(const UninstallTask &) = delete;
- UninstallTask & operator= (const UninstallTask &) = delete;
-
- ///\}
-
- ///\name Behaviour options
- ///\{
-
- void set_pretend(const bool value);
- void set_preserve_world(const bool value);
- void set_all_versions(const bool value);
- void set_with_unused_dependencies(const bool value);
- void set_with_dependencies(const bool value);
- void set_check_safety(const bool value);
-
- ///\}
-
- ///\name Add targets
- ///\{
-
- void add_target(const std::string &);
- void add_unused();
-
- ///\}
-
- ///\name Event callbacks
- ///\{
-
- virtual void on_build_unmergelist_pre() = 0;
- virtual void on_build_unmergelist_post() = 0;
-
- virtual void on_display_unmerge_list_pre() = 0;
- virtual void on_display_unmerge_list_post() = 0;
- virtual void on_display_unmerge_list_entry(const UninstallListEntry &) = 0;
-
- virtual void on_uninstall_all_pre() = 0;
- virtual void on_uninstall_pre(const UninstallListEntry &) = 0;
- virtual void on_uninstall_post(const UninstallListEntry &) = 0;
- virtual void on_uninstall_all_post() = 0;
-
- virtual void on_not_continuing_due_to_errors() = 0;
-
- virtual void on_update_world_pre() = 0;
- virtual void on_update_world(const PackageDepSpec &) = 0;
- virtual void on_update_world(const SetName &) = 0;
- virtual void on_update_world_post() = 0;
- virtual void on_preserve_world() = 0;
-
- ///\}
-
- ///\name Logic
- ///\{
-
- virtual void world_remove_set(const SetName &);
- virtual void world_remove_packages(const std::shared_ptr<const SetSpecTree> &);
-
- ///\}
-
- /**
- * Run the task.
- */
- void execute();
- };
-}
-
-#endif
diff --git a/python/Makefile.am b/python/Makefile.am
index 00f78f3..32067bb 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -29,7 +29,6 @@ IF_PYTHON_TESTS = \
contents_TEST.py \
choices_TEST.py \
dep_label_TEST.py \
- dep_list_TEST.py \
dep_spec_TEST.py \
dep_tag_TEST.py \
environment_TEST.py \
@@ -58,7 +57,6 @@ IF_PYTHON_SOURCES = \
choices.cc \
contents.cc \
dep_label.cc \
- dep_list.cc \
dep_spec.hh dep_spec.cc \
dep_tag.cc \
environment.cc \
@@ -89,7 +87,6 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
paludis_python_so.cc \
additional_tests_so.cc \
choices_TEST_setup.sh choices_TEST_cleanup.sh \
- dep_list_TEST_setup.sh dep_list_TEST_cleanup.sh \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
mask_TEST_setup.sh mask_TEST_cleanup.sh \
metadata_key_TEST_setup.sh metadata_key_TEST_cleanup.sh \
@@ -134,7 +131,6 @@ libpaludispython_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_PYTHON_SOURCES)
TESTS = $(IF_PYTHON_TESTS)
libpaludispython_@PALUDIS_PC_SLOT@_la_LIBADD = \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la
diff --git a/python/dep_list.cc b/python/dep_list.cc
deleted file mode 100644
index 74703e0..0000000
--- a/python/dep_list.cc
+++ /dev/null
@@ -1,305 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Piotr Jaroszyński
- *
- * 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 <python/paludis_python.hh>
-#include <python/exception.hh>
-
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/legacy/dep_list_exceptions.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-
-
-using namespace paludis;
-using namespace paludis::python;
-namespace bp = boost::python;
-
-struct DepListWrapper
-{
- static void
- add(DepList & self, std::shared_ptr<const SetSpecTree> st,
- std::shared_ptr<const DestinationsSet> & d)
- {
- self.add(*st, d);
- }
-
- static bool
- already_installed(const DepList & self, std::shared_ptr<const DependencySpecTree> st,
- std::shared_ptr<const DestinationsSet> & d)
- {
- return self.already_installed(*st->top(), d);
- }
-};
-
-void expose_dep_list()
-{
- /**
- * Exceptions
- */
- ExceptionRegister::get_instance()->add_exception<DepListError>
- ("DepListError", "BaseException",
- "Thrown if an error occurs whilst building a DepList.");
- ExceptionRegister::get_instance()->add_exception<AllMaskedError>
- ("AllMaskedError", "DepListError",
- "Thrown if all versions of a particular spec are masked.");
- ExceptionRegister::get_instance()->add_exception<AdditionalRequirementsNotMetError>
- ("AdditionalRequirementsNotMetError", "DepListError",
- "Thrown if all versions of a particular spec are masked, "
- "but would not be if additional requirements were not in effect.");
- ExceptionRegister::get_instance()->add_exception<DowngradeNotAllowedError>
- ("DowngradeNotAllowedError", "DepListError",
- "Thrown if a downgrade is forced and we're not allowed to downgrade.");
- ExceptionRegister::get_instance()->add_exception<BlockError>
- ("BlockError", "DepListError",
- "Thrown if a block is encountered.");
- ExceptionRegister::get_instance()->add_exception<CircularDependencyError>
- ("CircularDependencyError", "DepListError",
- "Thrown if a circular dependency is encountered.");
- ExceptionRegister::get_instance()->add_exception<NoDestinationError>
- ("NoDestinationError", "DepListError",
- "Thrown if no destination can be found.");
-
- /**
- * Enums
- */
- enum_auto("DepListTargetType", last_dl_target,
- "Type of target being handled at the top level.");
- enum_auto("DepListReinstallOption", last_dl_reinstall,
- "When we should reinstall.");
- enum_auto("DepListFallBackOption", last_dl_fall_back,
- "When we should fall back to an installed package.");
- enum_auto("DepListReinstallScmOption", last_dl_reinstall_scm,
- "When we should reinstall SCM packages.");
- enum_auto("DepListUpgradeOption", last_dl_upgrade,
- "When we should upgrade.");
- enum_auto("DepListDowngradeOption", last_dl_downgrade,
- "What to do when we downgrade.");
- enum_auto("DepListNewSlotsOption", last_dl_new_slots,
- "When we should pull in a new slot.");
- enum_auto("DepListDepsOption", last_dl_deps,
- "How we should handle a dep class.");
- enum_auto("DepListSuggestedOption", last_dl_suggested,
- "How we should handle suggested deps.");
- enum_auto("DepListCircularOption", last_dl_circular,
- "How we should handle circular deps.");
- enum_auto("DepListBlocksOption", last_dl_blocks,
- "How we handle blocks.");
- enum_auto("DepListUseOption", last_dl_use_deps,
- "How we handle use deps.");
- enum_auto("DepListEntryState", last_dle,
- "State of a DepListEntry.");
- enum_auto("DepListEntryKind", last_dlk,
- "Kind of a DepListEntry.");
-
- /**
- * DepListOptions
- */
- register_shared_ptrs_to_python<DepListOptions>(rsp_non_const);
- bp::class_<DepListOptions, boost::noncopyable>
- (
- "DepListOptions",
- "Parameters for a DepList.",
- bp::init<>("__init__()")
- )
- .add_property("reinstall",
- &named_values_getter<DepListOptions, n::reinstall, DepListReinstallOption, &DepListOptions::reinstall>,
- &named_values_setter<DepListOptions, n::reinstall, DepListReinstallOption, &DepListOptions::reinstall>,
- "[rw] DepListReinstallOption"
- )
-
- .add_property("reinstall_scm",
- &named_values_getter<DepListOptions, n::reinstall_scm, DepListReinstallScmOption, &DepListOptions::reinstall_scm>,
- &named_values_setter<DepListOptions, n::reinstall_scm, DepListReinstallScmOption, &DepListOptions::reinstall_scm>,
- "[rw] DepListReinstallScmOption"
- )
-
- .add_property("target_type",
- &named_values_getter<DepListOptions, n::target_type, DepListTargetType, &DepListOptions::target_type>,
- &named_values_setter<DepListOptions, n::target_type, DepListTargetType, &DepListOptions::target_type>,
- "[rw] DepListTargetType"
- )
-
- .add_property("upgrade",
- &named_values_getter<DepListOptions, n::upgrade, DepListUpgradeOption, &DepListOptions::upgrade>,
- &named_values_setter<DepListOptions, n::upgrade, DepListUpgradeOption, &DepListOptions::upgrade>,
- "[rw] DepListUpgradeOption"
- )
-
- .add_property("downgrade",
- &named_values_getter<DepListOptions, n::downgrade, DepListDowngradeOption, &DepListOptions::downgrade>,
- &named_values_setter<DepListOptions, n::downgrade, DepListDowngradeOption, &DepListOptions::downgrade>,
- "[rw] DepListDowngradeOption"
- )
-
- .add_property("new_slots",
- &named_values_getter<DepListOptions, n::new_slots, DepListNewSlotsOption, &DepListOptions::new_slots>,
- &named_values_setter<DepListOptions, n::new_slots, DepListNewSlotsOption, &DepListOptions::new_slots>,
- "[rw] DepListNewSlotsOption"
- )
-
- .add_property("fall_back",
- &named_values_getter<DepListOptions, n::fall_back, DepListFallBackOption, &DepListOptions::fall_back>,
- &named_values_setter<DepListOptions, n::fall_back, DepListFallBackOption, &DepListOptions::fall_back>,
- "[rw] DepListFallBackOption"
- )
-
- .add_property("installed_deps_pre",
- &named_values_getter<DepListOptions, n::installed_deps_pre, DepListDepsOption, &DepListOptions::installed_deps_pre>,
- &named_values_setter<DepListOptions, n::installed_deps_pre, DepListDepsOption, &DepListOptions::installed_deps_pre>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("installed_deps_runtime",
- &named_values_getter<DepListOptions, n::installed_deps_runtime, DepListDepsOption, &DepListOptions::installed_deps_runtime>,
- &named_values_setter<DepListOptions, n::installed_deps_runtime, DepListDepsOption, &DepListOptions::installed_deps_runtime>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("installed_deps_post",
- &named_values_getter<DepListOptions, n::installed_deps_post, DepListDepsOption, &DepListOptions::installed_deps_post>,
- &named_values_setter<DepListOptions, n::installed_deps_post, DepListDepsOption, &DepListOptions::installed_deps_post>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("uninstalled_deps_pre",
- &named_values_getter<DepListOptions, n::uninstalled_deps_pre, DepListDepsOption, &DepListOptions::uninstalled_deps_pre>,
- &named_values_setter<DepListOptions, n::uninstalled_deps_pre, DepListDepsOption, &DepListOptions::uninstalled_deps_pre>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("uninstalled_deps_runtime",
- &named_values_getter<DepListOptions, n::uninstalled_deps_runtime, DepListDepsOption, &DepListOptions::uninstalled_deps_runtime>,
- &named_values_setter<DepListOptions, n::uninstalled_deps_runtime, DepListDepsOption, &DepListOptions::uninstalled_deps_runtime>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("uninstalled_deps_post",
- &named_values_getter<DepListOptions, n::uninstalled_deps_post, DepListDepsOption, &DepListOptions::uninstalled_deps_post>,
- &named_values_setter<DepListOptions, n::uninstalled_deps_post, DepListDepsOption, &DepListOptions::uninstalled_deps_post>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("uninstalled_deps_suggested",
- &named_values_getter<DepListOptions, n::uninstalled_deps_suggested, DepListDepsOption, &DepListOptions::uninstalled_deps_suggested>,
- &named_values_setter<DepListOptions, n::uninstalled_deps_suggested, DepListDepsOption, &DepListOptions::uninstalled_deps_suggested>,
- "[rw] DepListDepsOption"
- )
-
- .add_property("suggested",
- &named_values_getter<DepListOptions, n::suggested, DepListSuggestedOption, &DepListOptions::suggested>,
- &named_values_setter<DepListOptions, n::suggested, DepListSuggestedOption, &DepListOptions::suggested>,
- "[rw] DepListSuggestedOption"
- )
-
- .add_property("circular",
- &named_values_getter<DepListOptions, n::circular, DepListCircularOption, &DepListOptions::circular>,
- &named_values_setter<DepListOptions, n::circular, DepListCircularOption, &DepListOptions::circular>,
- "[rw] DepListSuggestedOption"
- )
-
- .add_property("use",
- &named_values_getter<DepListOptions, n::use, DepListUseOption, &DepListOptions::use>,
- &named_values_setter<DepListOptions, n::use, DepListUseOption, &DepListOptions::use>,
- "[rw] DepListUseOption"
- )
-
- .add_property("blocks",
- &named_values_getter<DepListOptions, n::blocks, DepListBlocksOption, &DepListOptions::blocks>,
- &named_values_setter<DepListOptions, n::blocks, DepListBlocksOption, &DepListOptions::blocks>,
- "[rw] DepListBlocksOption"
- )
-
- .add_property("dependency_tags",
- &named_values_getter<DepListOptions, n::dependency_tags, bool, &DepListOptions::dependency_tags>,
- &named_values_setter<DepListOptions, n::dependency_tags, bool, &DepListOptions::dependency_tags>,
- "[rw] bool"
- )
- ;
-
- /**
- * DepListEntry
- */
- bp::register_ptr_to_python<DepListEntry *>();
- bp::class_<DepListEntry, boost::noncopyable>
- (
- "DepListEntry",
- "An entry in a DepList.",
- bp::no_init
- )
- .add_property("kind",
- &named_values_getter<DepListEntry, n::kind, DepListEntryKind, &DepListEntry::kind>,
- "[ro] DepListEntryKind"
- )
-
- .add_property("package_id",
- &named_values_getter<DepListEntry, n::package_id, std::shared_ptr<const PackageID>, &DepListEntry::package_id>,
- "[ro] PackageID"
- )
-
- .add_property("tags",
- &named_values_getter<DepListEntry, n::tags, std::shared_ptr<DepListEntryTags>, &DepListEntry::tags>,
- "[ro] DepListEntryTags"
- )
-
- .add_property("destination",
- &named_values_getter<DepListEntry, n::destination, std::shared_ptr<Repository>, &DepListEntry::destination>,
- "[ro] Repository"
- )
-
- .add_property("state",
- &named_values_getter<DepListEntry, n::state, DepListEntryState, &DepListEntry::state>,
- "[ro] DepListEntryState"
- )
- ;
-
- /**
- * DepList
- */
- std::shared_ptr<DepListOptions> (DepList::* options_ptr)() = &DepList::options;
- DepList::Iterator (DepList::*dl_begin_ptr)() = &DepList::begin;
- DepList::Iterator (DepList::*dl_end_ptr)() = &DepList::end;
- bp::class_<DepList, boost::noncopyable>
- (
- "DepList",
- "Holds a list of dependencies in merge order.",
- bp::init<const Environment * const, const DepListOptions &>("__init__(Environment, DepListOptions)")
- )
- .add_property("options", options_ptr,
- "[ro] DepListOptions\n"
- "Our options."
- )
-
- .def("add", &DepListWrapper::add,
- "add(SetSpecTree, DestinationsIterable)\n"
- "Add the packages required to resolve an additional dependency spec."
- )
-
- .def("clear", &DepList::clear,
- "clear()\n"
- "Clear the list."
- )
-
- .def("already_installed", &DepListWrapper::already_installed,
- "already_installed(DepSpec, DestinationsIterable) -> bool\n"
- "Return whether a spec structure is already installed."
- )
-
- .def("__iter__", bp::range<bp::return_internal_reference<> >(dl_begin_ptr, dl_end_ptr))
- ;
-}
-
diff --git a/python/dep_list_TEST.py b/python/dep_list_TEST.py
deleted file mode 100755
index 616bd36..0000000
--- a/python/dep_list_TEST.py
+++ /dev/null
@@ -1,179 +0,0 @@
-#!/usr/bin/env python
-# vim: set fileencoding=utf-8 sw=4 sts=4 et :
-
-#
-# Copyright (c) 2007 Piotr Jaroszyński
-#
-# 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
-#
-
-import os
-
-os.environ["PALUDIS_HOME"] = os.path.join(os.getcwd(), "dep_list_TEST_dir/home")
-repo_path = os.path.join(os.getcwd(), "package_id_TEST_dir/testrepo")
-irepo_path = os.path.join(os.getcwd(), "package_id_TEST_dir/installed")
-
-from paludis import *
-import unittest
-
-Log.instance.log_level = LogLevel.WARNING
-
-class TestCase_01_DepListOptions(unittest.TestCase):
- def setUp(self):
- global dlo
- dlo = DepListOptions()
-
- def test_01_create(self):
- pass
-
- def test_02_data_members_types(self):
- self.assert_(isinstance(dlo.reinstall, DepListReinstallOption))
- self.assert_(isinstance(dlo.reinstall_scm, DepListReinstallScmOption))
- self.assert_(isinstance(dlo.target_type, DepListTargetType))
- self.assert_(isinstance(dlo.upgrade, DepListUpgradeOption))
- self.assert_(isinstance(dlo.downgrade, DepListDowngradeOption))
- self.assert_(isinstance(dlo.new_slots, DepListNewSlotsOption))
- self.assert_(isinstance(dlo.fall_back, DepListFallBackOption))
- self.assert_(isinstance(dlo.installed_deps_pre, DepListDepsOption))
- self.assert_(isinstance(dlo.installed_deps_runtime, DepListDepsOption))
- self.assert_(isinstance(dlo.installed_deps_post, DepListDepsOption))
- self.assert_(isinstance(dlo.uninstalled_deps_pre, DepListDepsOption))
- self.assert_(isinstance(dlo.uninstalled_deps_runtime, DepListDepsOption))
- self.assert_(isinstance(dlo.uninstalled_deps_post, DepListDepsOption))
- self.assert_(isinstance(dlo.uninstalled_deps_suggested, DepListDepsOption))
- self.assert_(isinstance(dlo.suggested, DepListSuggestedOption))
- self.assert_(isinstance(dlo.circular, DepListCircularOption))
- self.assert_(isinstance(dlo.use, DepListUseOption))
- self.assert_(isinstance(dlo.blocks, DepListBlocksOption))
- self.assert_(isinstance(dlo.dependency_tags, bool))
-
- def test_03_data_members_set(self):
- dlo.reinstall = DepListReinstallOption.values[0]
- self.assertEquals(dlo.reinstall, DepListReinstallOption.values[0])
-
- dlo.reinstall_scm = DepListReinstallScmOption.values[0]
- self.assertEquals(dlo.reinstall_scm, DepListReinstallScmOption.values[0])
-
- dlo.target_type = DepListTargetType.values[0]
- self.assertEquals(dlo.target_type, DepListTargetType.values[0])
-
- dlo.upgrade = DepListUpgradeOption.values[0]
- self.assertEquals(dlo.upgrade, DepListUpgradeOption.values[0])
-
- dlo.downgrade = DepListDowngradeOption.values[0]
- self.assertEquals(dlo.downgrade, DepListDowngradeOption.values[0])
-
- dlo.new_slots = DepListNewSlotsOption.values[0]
- self.assertEquals(dlo.new_slots, DepListNewSlotsOption.values[0])
-
- dlo.fall_back = DepListFallBackOption.values[0]
- self.assertEquals(dlo.fall_back, DepListFallBackOption.values[0])
-
- dlo.installed_deps_pre = DepListDepsOption.values[0]
- self.assertEquals(dlo.installed_deps_pre, DepListDepsOption.values[0])
-
- dlo.installed_deps_runtime = DepListDepsOption.values[0]
- self.assertEquals(dlo.installed_deps_runtime, DepListDepsOption.values[0])
-
- dlo.installed_deps_post = DepListDepsOption.values[0]
- self.assertEquals(dlo.installed_deps_post, DepListDepsOption.values[0])
-
- dlo.uninstalled_deps_pre = DepListDepsOption.values[0]
- self.assertEquals(dlo.uninstalled_deps_pre, DepListDepsOption.values[0])
-
- dlo.uninstalled_deps_runtime = DepListDepsOption.values[0]
- self.assertEquals(dlo.uninstalled_deps_runtime, DepListDepsOption.values[0])
-
- dlo.uninstalled_deps_post = DepListDepsOption.values[0]
- self.assertEquals(dlo.uninstalled_deps_post, DepListDepsOption.values[0])
-
- dlo.uninstalled_deps_suggested = DepListDepsOption.values[0]
- self.assertEquals(dlo.uninstalled_deps_suggested, DepListDepsOption.values[0])
-
- dlo.suggested = DepListSuggestedOption.values[0]
- self.assertEquals(dlo.suggested, DepListSuggestedOption.values[0])
-
- dlo.circular = DepListCircularOption.values[0]
- self.assertEquals(dlo.circular, DepListCircularOption.values[0])
-
- dlo.use = DepListUseOption.values[0]
- self.assertEquals(dlo.use, DepListUseOption.values[0])
-
- dlo.blocks = DepListBlocksOption.values[0]
- self.assertEquals(dlo.blocks, DepListBlocksOption.values[0])
-
- dlo.dependency_tags = False
- self.assertEquals(dlo.dependency_tags, False)
-
-class TestCase_02_DepList(unittest.TestCase):
- def setUp(self):
- global env, dl, dd, pds, cds
- env = EnvironmentFactory.instance.create("")
- dl = DepList(env, DepListOptions())
- dd = env.default_destinations
- pds = parse_user_package_dep_spec("foo/bar", env, [])
- cds = env.set("bar")
-
- def test_01_create(self):
- pass
-
- def test_02_options(self):
- self.assert_(isinstance(dl.options, DepListOptions))
-
- def test_04_clear(self):
- dl.add(pds, dd)
- dl.clear()
-
- def test_05_add(self):
- dl.add(pds, dd)
- dl.clear()
- dl.add(cds, dd)
-
- def test_06_already_installed(self):
- self.assert_(not dl.already_installed(pds, dd))
- dl.add(cds, dd)
- self.assert_(dl.already_installed(pds, dd))
-
- def test_07_entries(self):
- dl.add(pds, dd)
-
- entries = list(dl)
- self.assert_(isinstance(entries[0], DepListEntry))
-
-
-class TestCase_03_DepListEntry(unittest.TestCase):
- def setUp(self):
- global env, dl, dd, pds, cds
- env = EnvironmentFactory.instance.create("")
- dl = DepList(env, DepListOptions())
- dd = env.default_destinations
-
- def test_01_no_create(self):
- self.assertRaises(Exception, DepListEntry)
-
- def test_02_data_members(self):
- dl.add(pds, dd)
-
- dle = list(dl)[0]
-
- self.assertEquals(dle.kind, DepListEntryKind.PACKAGE)
- self.assertEquals(dle.package_id.name, "foo/bar")
- self.assertEquals(list(dle.tags), [])
- self.assertEquals(str(dle.destination.name), "installed")
- self.assertEquals(dle.state, DepListEntryState.HAS_ALL_DEPS)
-
-
-if __name__ == "__main__":
- unittest.main()
-
diff --git a/python/dep_list_TEST_cleanup.sh b/python/dep_list_TEST_cleanup.sh
deleted file mode 100755
index 781c821..0000000
--- a/python/dep_list_TEST_cleanup.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d dep_list_TEST_dir ] ; then
- rm -fr dep_list_TEST_dir
-else
- true
-fi
diff --git a/python/dep_list_TEST_setup.sh b/python/dep_list_TEST_setup.sh
deleted file mode 100755
index 89231b3..0000000
--- a/python/dep_list_TEST_setup.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir dep_list_TEST_dir || exit 1
-cd dep_list_TEST_dir || exit 1
-
-mkdir -p home/.paludis/repositories
-
-cat <<END > home/.paludis/repositories/testrepo.conf
-location = `pwd`/testrepo
-format = e
-names_cache = /var/empty
-cache = /var/empty
-profiles = \${location}/profiles/testprofile
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/repositories/installed.conf
-location = `pwd`/installed
-format = vdb
-names_cache = /var/empty
-provides_cache = /var/empty
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/keywords.conf
-*/* test
-~foo/bar-1.0 ~test
-END
-
-cat <<END > home/.paludis/use.conf
-*/* enabled
-~foo/bar-1.0 sometimes_enabled
-END
-
-cat <<END > home/.paludis/package_mask.conf
-=foo/bar-3*
-END
-
-cat <<END > home/.paludis/licenses.conf
-*/* *
-END
-
-cat <<END > home/.paludis/general.conf
-world = /dev/null
-END
-
-mkdir -p testrepo/{eclass,sets,distfiles,profiles/testprofile,foo/bar/files} || exit 1
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-cat <<END > profiles/profiles.desc
-test testprofile stable
-END
-cat <<END > sets/bar.conf
-* foo/bar
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-END
-cd ..
-
-mkdir -p installed/cat-one/pkg-one-1 || exit 1
-
-for i in SLOT EAPI; do
- echo "0" >installed/cat-one/pkg-one-1/${i}
-done
-
-for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
- touch installed/cat-one/pkg-one-1/${i}
-done
-
-echo "flag1 flag2" >>installed/cat-one/pkg-one-1/USE
-
-cat <<END >installed/cat-one/pkg-one-1/CONTENTS
-dir //test
-obj /test/test_file de54c26b0678df67aca147575523b3c2 1165250496
-sym /test/test_link -> /test/test_file 1165250496
-END
-
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 0f467c0..2dc5fb3 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -176,7 +176,6 @@ void expose_action() PALUDIS_VISIBLE;
void expose_choices() PALUDIS_VISIBLE;
void expose_contents() PALUDIS_VISIBLE;
void expose_dep_label() PALUDIS_VISIBLE;
-void expose_dep_list() PALUDIS_VISIBLE;
void expose_dep_spec() PALUDIS_VISIBLE;
void expose_dep_tag() PALUDIS_VISIBLE;
void expose_environment() PALUDIS_VISIBLE;
diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc
index 61ac663..9517ead 100644
--- a/python/paludis_python_so.cc
+++ b/python/paludis_python_so.cc
@@ -40,7 +40,6 @@ BOOST_PYTHON_MODULE(paludis)
expose_dep_spec();
expose_dep_tag();
expose_dep_label();
- expose_dep_list();
expose_name();
expose_log();
expose_environment();
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 472f986..d24fbd1 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -22,13 +22,11 @@ IF_RUBY_TESTS = \
action_TEST.rb \
choice_TEST.rb \
contents_TEST.rb \
- dep_list_TEST.rb \
dep_spec_TEST.rb \
dep_tag_TEST.rb \
environment_TEST.rb \
filter_TEST.rb \
filtered_generator_TEST.rb \
- find_unused_packages_task_TEST.rb \
generator_TEST.rb \
log_TEST.rb \
package_database_TEST.rb \
@@ -44,13 +42,11 @@ IF_RUBY_SOURCES = \
choice.cc \
contents.cc \
dep_label.cc \
- dep_list.cc \
dep_spec.cc \
dep_tag.cc \
environment.cc \
filter.cc \
filtered_generator.cc \
- find_unused_packages_task.cc \
generator.cc \
log.cc \
mask.cc \
@@ -73,9 +69,7 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
choice_TEST_setup.sh choice_TEST_cleanup.sh \
dep_spec_TEST_setup.sh dep_spec_TEST_cleanup.sh \
dep_tag_TEST_setup.sh dep_tag_TEST_cleanup.sh \
- dep_list_TEST_setup.sh dep_list_TEST_cleanup.sh \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
- find_unused_packages_task_TEST_setup.sh find_unused_packages_task_TEST_cleanup.sh \
generator_TEST_setup.sh generator_TEST_cleanup.sh \
nice_names.nn \
package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
@@ -106,7 +100,6 @@ libpaludisruby_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_RUBY_SOURCES)
TESTS = $(IF_RUBY_TESTS)
libpaludisruby_@PALUDIS_PC_SLOT@_la_LIBADD = \
- $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
$(PTHREAD_LIBS)
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
deleted file mode 100644
index 2c16c3d..0000000
--- a/ruby/dep_list.cc
+++ /dev/null
@@ -1,1477 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Richard Brown
- *
- * 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_ruby.hh>
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/dep_tag.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/legacy/override_functions.hh>
-#include <ruby.h>
-
-using namespace paludis;
-using namespace paludis::ruby;
-
-namespace
-{
- static VALUE c_dep_list_target_type;
- static VALUE c_dep_list_reinstall_option;
- static VALUE c_dep_list_fall_back_option;
- static VALUE c_dep_list_reinstall_scm_option;
- static VALUE c_dep_list_upgrade_option;
- static VALUE c_dep_list_downgrade_option;
- static VALUE c_dep_list_new_slots_option;
- static VALUE c_dep_list_deps_option;
- static VALUE c_dep_list_suggested_option;
- static VALUE c_dep_list_circular_option;
- static VALUE c_dep_list_blocks_option;
- static VALUE c_dep_list_use_option;
- static VALUE c_dep_list_entry_state;
- static VALUE c_dep_list_entry_kind;
- static VALUE c_dep_list_options;
- static VALUE c_dep_list;
- static VALUE c_dep_list_entry;
- static VALUE c_dep_list_override_masks_functions;
-
- std::shared_ptr<DepListOverrideMasksFunctions>
- value_to_dep_list_override_masks_functions(VALUE v)
- {
- if (rb_obj_is_kind_of(v, c_dep_list_override_masks_functions))
- {
- std::shared_ptr<DepListOverrideMasksFunctions> * v_ptr;
- Data_Get_Struct(v, std::shared_ptr<DepListOverrideMasksFunctions>, v_ptr);
- return *v_ptr;
- }
- else
- {
- rb_raise(rb_eTypeError, "Can't convert %s into DepListOverrideMasksFunctions", rb_obj_classname(v));
- }
- }
-
- VALUE
- dep_list_override_masks_functions_to_value(std::shared_ptr<DepListOverrideMasksFunctions> m)
- {
- std::shared_ptr<DepListOverrideMasksFunctions> * m_ptr(0);
- try
- {
- m_ptr = new std::shared_ptr<DepListOverrideMasksFunctions>(m);
- return Data_Wrap_Struct(c_dep_list_override_masks_functions, 0, &Common<std::shared_ptr<DepListOverrideMasksFunctions> >::free, m_ptr);
- }
- catch (const std::exception & e)
- {
- delete m_ptr;
- exception_to_ruby_exception(e);
- }
- }
-
- std::shared_ptr<DepListOptions>
- value_to_dep_list_options(VALUE v)
- {
- if (rb_obj_is_kind_of(v, c_dep_list_options))
- {
- std::shared_ptr<DepListOptions> * v_ptr;
- Data_Get_Struct(v, std::shared_ptr<DepListOptions>, v_ptr);
- return *v_ptr;
- }
- else
- {
- rb_raise(rb_eTypeError, "Can't convert %s into DepListOptions", rb_obj_classname(v));
- }
- }
-
- VALUE
- dep_list_options_to_value(std::shared_ptr<DepListOptions> m)
- {
- std::shared_ptr<DepListOptions> * m_ptr(0);
- try
- {
- m_ptr = new std::shared_ptr<DepListOptions>(m);
- return Data_Wrap_Struct(c_dep_list_options, 0, &Common<std::shared_ptr<DepListOptions> >::free, m_ptr);
- }
- catch (const std::exception & e)
- {
- delete m_ptr;
- exception_to_ruby_exception(e);
- }
- }
-
- VALUE
- dep_list_entry_to_value(const DepListEntry & v)
- {
- DepListEntry * vv(new DepListEntry(v));
- return Data_Wrap_Struct(c_dep_list_entry, 0, &Common<DepListEntry>::free, vv);
- }
-
- VALUE
- dep_list_override_masks_functions_init(int, VALUE *, VALUE self)
- {
- return self;
- }
-
- VALUE
- dep_list_override_masks_functions_new(int argc, VALUE* argv, VALUE self)
- {
- if (argc != 0)
- rb_raise(rb_eArgError, "No Arguments Please, we're british");
- std::shared_ptr<DepListOverrideMasksFunctions> * ptr(0);
- try
- {
- ptr = new std::shared_ptr<DepListOverrideMasksFunctions>(std::make_shared<DepListOverrideMasksFunctions>());
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<DepListOverrideMasksFunctions> >::free, ptr));
- rb_obj_call_init(tdata, argc, argv);
- return tdata;
- }
- catch (const std::exception & e)
- {
- delete ptr;
- exception_to_ruby_exception(e);
- }
- }
-
-
- VALUE
- dep_list_options_init(int, VALUE *, VALUE self)
- {
- return self;
- }
-
- /*
- * call-seq:
- * DepListOptions.new(reinstall, reinstall_scm, target_type, upgrade, new_slots, fall_back, installed_deps_prem installed_deps_runtime, installed_deps_post, uninstalled_deps_pre, uninstalled_deps_runtime, uninstalled_deps_post, uninstalled_deps_suggested, suggested, circular, blocks, override_masks, dependency_tags, MatchPackageOptions) -> DepListOptions
- * DepListOptions.new(Hash) -> DepListOptions
- * DepListOptions.new -> DepListOptions
- *
- * DepListOptions.new can either be called with all parameters in order, or with one hash
- * parameter, where the hash keys are symbols with the names above, or with no parameters
- * in which case it will be created with the default options, i.e. the following hash:
- *
- * {
- * :reinstall => DepListReinstallOption::Never,
- * :reinstall_scm => DepListReinstallScmOption::Never,
- * :target_type => DepListTargetType::Package,
- * :upgrade => DepListUpgradeOption::Always,
- * :downgrade => DepListDowngradeOption::AsNeeded,
- * :new_slots => DepListNewSlotsOption::Always,
- * :fall_back => DepListFallBackOption::AsNeededExceptTargets,
- * :installed_deps_pre => DepListDepsOption::Discard,
- * :installed_deps_runtime => DepListDepsOption::TryPost,
- * :installed_deps_post => DepListDepsOption::TryPost,
- * :uninstalled_deps_pre => DepListDepsOption::Pre,
- * :uninstalled_deps_runtime => DepListDepsOption::PreOrPost,
- * :uninstalled_deps_post => DepListDepsOption::Post,
- * :uninstalled_deps_suggested => DepListDepsOption::TryPost,
- * :suggested => DepListSuggestedOption::Show,
- * :circular => DepListCircularOption::Error,
- * :use => DepListUseOption::Standard,
- * :blocks => DepListBlocksOption::Accumulate,
- * :override_masks => DepListOverrideMasksFunctions.new
- * :dependency_tags => false,
- * :match_package_options => MatchPackageOptions.new
- * }
- */
- VALUE
- dep_list_options_new(int argc, VALUE *argv, VALUE self)
- {
- std::shared_ptr<DepListOptions> * ptr(0);
- if (0 == argc)
- {
- try
- {
- ptr = new std::shared_ptr<DepListOptions>(std::make_shared<DepListOptions>());
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<DepListOptions> >::free, ptr));
- rb_obj_call_init(tdata, argc, argv);
- return tdata;
- }
- catch (const std::exception & e)
- {
- delete ptr;
- exception_to_ruby_exception(e);
- }
- }
- else
- {
- try
- {
- int value_for_reinstall;
- int value_for_reinstall_scm;
- int value_for_target_type;
- int value_for_upgrade;
- int value_for_downgrade;
- int value_for_new_slots;
- int value_for_fall_back;
- int value_for_installed_deps_pre;
- int value_for_installed_deps_runtime;
- int value_for_installed_deps_post;
- int value_for_uninstalled_deps_pre;
- int value_for_uninstalled_deps_runtime;
- int value_for_uninstalled_deps_post;
- int value_for_uninstalled_deps_suggested;
- int value_for_suggested;
- int value_for_circular;
- int value_for_use;
- int value_for_blocks;
- bool value_for_dependency_tags;
- std::shared_ptr<DepListOverrideMasksFunctions> value_for_override_masks_functions;
- MatchPackageOptions value_for_match_package_options;
-
- if (1 == argc && rb_obj_is_kind_of(argv[0], rb_cHash))
- {
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("reinstall"))))
- rb_raise(rb_eArgError, "Missing Parameter: reinstall");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("reinstall_scm"))))
- rb_raise(rb_eArgError, "Missing Parameter: reinstall_scm");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("target_type"))))
- rb_raise(rb_eArgError, "Missing Parameter: target_type");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("upgrade"))))
- rb_raise(rb_eArgError, "Missing Parameter: upgrade");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("downgrade"))))
- rb_raise(rb_eArgError, "Missing Parameter: downgrade");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("new_slots"))))
- rb_raise(rb_eArgError, "Missing Parameter: new_slots");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("fall_back"))))
- rb_raise(rb_eArgError, "Missing Parameter: fall_back");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_pre"))))
- rb_raise(rb_eArgError, "Missing Parameter: installed_deps_pre");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_runtime"))))
- rb_raise(rb_eArgError, "Missing Parameter: installed_deps_runtime");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_post"))))
- rb_raise(rb_eArgError, "Missing Parameter: installed_deps_post");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_pre"))))
- rb_raise(rb_eArgError, "Missing Parameter: uninstalled_deps_pre");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_runtime"))))
- rb_raise(rb_eArgError, "Missing Parameter: uninstalled_deps_runtime");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_post"))))
- rb_raise(rb_eArgError, "Missing Parameter: uninstalled_deps_post");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_suggested"))))
- rb_raise(rb_eArgError, "Missing Parameter: uninstalled_deps_suggested");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("suggested"))))
- rb_raise(rb_eArgError, "Missing Parameter: suggested");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("circular"))))
- rb_raise(rb_eArgError, "Missing Parameter: circular");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("use"))))
- rb_raise(rb_eArgError, "Missing Parameter: use");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("blocks"))))
- rb_raise(rb_eArgError, "Missing Parameter: blocks");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("dependency_tags"))))
- rb_raise(rb_eArgError, "Missing Parameter: dependency_tags");
- if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("match_package_options"))))
- rb_raise(rb_eArgError, "Missing Parameter: match_package_options");
- value_for_reinstall =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("reinstall"))));
- value_for_reinstall_scm =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("reinstall_scm"))));
- value_for_target_type =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("target_type"))));
- value_for_upgrade =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("upgrade"))));
- value_for_downgrade =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("downgrade"))));
- value_for_new_slots =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("new_slots"))));
- value_for_fall_back =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("fall_back"))));
- value_for_installed_deps_pre =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_pre"))));
- value_for_installed_deps_runtime =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_runtime"))));
- value_for_installed_deps_post =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("installed_deps_post"))));
- value_for_uninstalled_deps_pre =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_pre"))));
- value_for_uninstalled_deps_runtime =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_runtime"))));
- value_for_uninstalled_deps_post =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_post"))));
- value_for_uninstalled_deps_suggested =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("uninstalled_deps_suggested"))));
- value_for_suggested =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("suggested"))));
- value_for_circular =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("circular"))));
- value_for_use =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("use"))));
- value_for_blocks =
- NUM2INT(rb_hash_aref(argv[0], ID2SYM(rb_intern("blocks"))));
- value_for_override_masks_functions =
- value_to_dep_list_override_masks_functions(rb_hash_aref(argv[0], ID2SYM(rb_intern("override_masks"))));
- value_for_dependency_tags =
- Qtrue == (rb_hash_aref(argv[0], ID2SYM(rb_intern("dependency_tags")))) ? true : false;
- value_for_match_package_options = value_to_match_package_options(
- rb_hash_aref(argv[0], ID2SYM(rb_intern("match_package_options"))));
- }
- else if (21 == argc)
- {
- value_for_reinstall = NUM2INT(argv[0]);
- value_for_reinstall_scm = NUM2INT(argv[1]);
- value_for_target_type = NUM2INT(argv[2]);
- value_for_upgrade = NUM2INT(argv[3]);
- value_for_downgrade = NUM2INT(argv[4]);
- value_for_new_slots = NUM2INT(argv[5]);
- value_for_fall_back = NUM2INT(argv[6]);
- value_for_installed_deps_pre = NUM2INT(argv[7]);
- value_for_installed_deps_runtime = NUM2INT(argv[8]);
- value_for_installed_deps_post = NUM2INT(argv[9]);
- value_for_uninstalled_deps_pre = NUM2INT(argv[10]);
- value_for_uninstalled_deps_runtime = NUM2INT(argv[11]);
- value_for_uninstalled_deps_post = NUM2INT(argv[12]);
- value_for_uninstalled_deps_suggested = NUM2INT(argv[13]);
- value_for_suggested = NUM2INT(argv[14]);
- value_for_circular = NUM2INT(argv[15]);
- value_for_use = NUM2INT(argv[16]);
- value_for_blocks = NUM2INT(argv[17]);
- value_for_override_masks_functions = value_to_dep_list_override_masks_functions(argv[18]);
- value_for_dependency_tags = Qtrue == argv[19] ? true : false;
- value_for_match_package_options = value_to_match_package_options(argv[20]);
- }
- else
- {
- rb_raise(rb_eArgError, "DepListOptions expects twenty one or zero arguments, but got %d",argc);
- }
-
- if (value_for_reinstall < 0 || value_for_reinstall >= last_dl_reinstall)
- rb_raise(rb_eArgError, "reinstall out of range");
- if (value_for_reinstall_scm < 0 || value_for_reinstall_scm >= last_dl_reinstall_scm)
- rb_raise(rb_eArgError, "reinstall_scm out of range");
- if (value_for_target_type < 0 || value_for_target_type >= last_dl_target)
- rb_raise(rb_eArgError, "target_type out of range");
- if (value_for_upgrade < 0 || value_for_upgrade >= last_dl_upgrade)
- rb_raise(rb_eArgError, "upgrade out of range");
- if (value_for_downgrade < 0 || value_for_downgrade >= last_dl_downgrade)
- rb_raise(rb_eArgError, "downgrade out of range");
- if (value_for_new_slots < 0 || value_for_new_slots >= last_dl_new_slots)
- rb_raise(rb_eArgError, "new_slots out of range");
- if (value_for_fall_back < 0 || value_for_fall_back >= last_dl_fall_back)
- rb_raise(rb_eArgError, "fall_back out of range");
- if (value_for_installed_deps_pre < 0 || value_for_installed_deps_pre >= last_dl_deps)
- rb_raise(rb_eArgError, "installed_deps_pre out of range");
- if (value_for_installed_deps_runtime < 0 || value_for_installed_deps_runtime >= last_dl_deps)
- rb_raise(rb_eArgError, "installed_deps_runtime out of range");
- if (value_for_installed_deps_post < 0 || value_for_installed_deps_post >= last_dl_deps)
- rb_raise(rb_eArgError, "installed_deps_post out of range");
- if (value_for_uninstalled_deps_pre < 0 || value_for_uninstalled_deps_pre >= last_dl_deps)
- rb_raise(rb_eArgError, "uninstalled_deps_pre out of range");
- if (value_for_uninstalled_deps_runtime < 0 || value_for_uninstalled_deps_runtime >= last_dl_deps)
- rb_raise(rb_eArgError, "uninstalled_deps_runtime out of range");
- if (value_for_uninstalled_deps_post < 0 || value_for_uninstalled_deps_post >= last_dl_deps)
- rb_raise(rb_eArgError, "uninstalled_deps_post out of range");
- if (value_for_uninstalled_deps_suggested < 0 || value_for_uninstalled_deps_suggested >= last_dl_deps)
- rb_raise(rb_eArgError, "uninstalled_deps_suggested out of range");
- if (value_for_suggested < 0 || value_for_suggested >= last_dl_suggested)
- rb_raise(rb_eArgError, "suggested out of range");
- if (value_for_circular < 0 || value_for_circular >= last_dl_circular)
- rb_raise(rb_eArgError, "circular out of range");
- if (value_for_circular < 0 || value_for_use >= last_dl_use_deps)
- rb_raise(rb_eArgError, "use out of range");
- if (value_for_circular < 0 || value_for_blocks >= last_dl_blocks)
- rb_raise(rb_eArgError, "blocks out of range");
-
- ptr = new std::shared_ptr<DepListOptions>(std::make_shared<DepListOptions>());
- (*ptr)->blocks() = static_cast<DepListBlocksOption>(value_for_blocks);
- (*ptr)->circular() = static_cast<DepListCircularOption>(value_for_circular);
- (*ptr)->dependency_tags() = value_for_dependency_tags;
- (*ptr)->downgrade() = static_cast<DepListDowngradeOption>(value_for_downgrade);
- (*ptr)->fall_back() = static_cast<DepListFallBackOption>(value_for_fall_back);
- (*ptr)->installed_deps_post() = static_cast<DepListDepsOption>(value_for_installed_deps_post);
- (*ptr)->installed_deps_pre() = static_cast<DepListDepsOption>(value_for_installed_deps_pre);
- (*ptr)->installed_deps_runtime() = static_cast<DepListDepsOption>(value_for_installed_deps_runtime);
- (*ptr)->match_package_options() = value_for_match_package_options;
- (*ptr)->new_slots() = static_cast<DepListNewSlotsOption>(value_for_new_slots);
- (*ptr)->override_masks() = value_for_override_masks_functions;
- (*ptr)->reinstall() = static_cast<DepListReinstallOption>(value_for_reinstall);
- (*ptr)->reinstall_scm() = static_cast<DepListReinstallScmOption>(value_for_reinstall_scm);
- (*ptr)->suggested() = static_cast<DepListSuggestedOption>(value_for_suggested);
- (*ptr)->target_type() = static_cast<DepListTargetType>(value_for_target_type);
- (*ptr)->uninstalled_deps_post() = static_cast<DepListDepsOption>(value_for_uninstalled_deps_post);
- (*ptr)->uninstalled_deps_pre() = static_cast<DepListDepsOption>(value_for_uninstalled_deps_pre);
- (*ptr)->uninstalled_deps_runtime() = static_cast<DepListDepsOption>(value_for_uninstalled_deps_runtime);
- (*ptr)->uninstalled_deps_suggested() = static_cast<DepListDepsOption>(value_for_uninstalled_deps_suggested);
- (*ptr)->upgrade() = static_cast<DepListUpgradeOption>(value_for_upgrade);
- (*ptr)->use() = static_cast<DepListUseOption>(value_for_use);
-
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<DepListOptions> >::free, ptr));
- rb_obj_call_init(tdata, argc, argv);
- return tdata;
- }
- catch (const std::exception & e)
- {
- delete ptr;
- exception_to_ruby_exception(e);
- }
- }
- }
-
- /*
- * Document-method: reinstall
- *
- * call-seq:
- * reinstall -> DepListReinstallOption
- *
- * Our DepListReinstallOption
- */
- /*
- * Document-method: reinstall_scm
- *
- * call-seq:
- * reinstall_scm -> DepListReinstallScmOption
- *
- * Our DepListReinstallScmOption
- */
- /*
- * Document-method: target
- *
- * call-seq:
- * target -> DepListTargetType
- *
- * Our DepListTargetType
- */
- /*
- * Document-method: upgrade
- *
- * call-seq:
- * upgrade -> DepListUpgradeOption
- *
- * Our DepListUpgradeOption
- */
- /*
- * Document-method: downgrade
- *
- * call-seq:
- * downgrade -> DepListDowngradeOption
- *
- * Our DepListDowngradeOption
- */
- /*
- * Document-method: new_slots
- *
- * call-seq:
- * new_slots -> DepListNewSlotsOption
- *
- * Our DepListNewSlotsOption
- */
- /*
- * Document-method: fall_back
- *
- * call-seq:
- * fall_back -> DepListFallBackOption
- *
- * Our DepListFallBackOption
- */
- /*
- * Document-method: installed_deps_pre
- *
- * call-seq:
- * installed_deps_pre -> DepListDepsOption
- *
- * Our installed_deps_runtime
- */
- /*
- * Document-method: installed_deps_runtime
- *
- * call-seq:
- * installed_deps_runtime -> DepListDepsOption
- *
- * Our installed_deps_runtime
- */
- /*
- * Document-method: installed_deps_post
- *
- * call-seq:
- * installed_deps_post -> DepListDepsOption
- *
- * Our installed_deps_post
- */
- /*
- * Document-method: uninstalled_deps_pre
- *
- * call-seq:
- * uninstalled_deps_pre -> DepListDepsOption
- *
- * Our uninstalled_deps_runtime
- */
- /*
- * Document-method: uninstalled_deps_runtime
- *
- * call-seq:
- * uninstalled_deps_runtime -> DepListDepsOption
- *
- * Our uninstalled_deps_runtime
- */
- /*
- * Document-method: uninstalled_deps_post
- *
- * call-seq:
- * uninstalled_deps_post -> DepListDepsOption
- *
- * Our uninstalled_deps_post
- */
- /*
- * Document-method: uninstalled_deps_suggested
- *
- * call-seq:
- * uninstalled_deps_suggested -> DepListDepsOption
- *
- * Our uninstalled_deps_suggested
- */
- /*
- * Document-method: suggested
- *
- * call-seq:
- * suggested -> DepListSuggestedOption
- *
- * Our DepListSuggestedOption
- */
- /*
- * Document-method: circular
- *
- * call-seq:
- * circular -> DepListCircularOption
- *
- * Our DepListCircularOption
- */
- /*
- * Document-method: use
- *
- * call-seq:
- * use -> DepListUseOption
- *
- * Our DepListSuggestedOption
- */
- /*
- * Document-method: blocks
- *
- * call-seq:
- * blocks -> DepListBlockOption
- *
- * Our DepListBlockOption
- */
- /*
- * Document-method: suggested
- *
- * call-seq:
- * suggested -> DepListSuggestedOption
- *
- * Our DepListSuggestedOption
- */
- /*
- * Document-method: reinstall=
- *
- * call-seq:
- * reinstall=(dep_list_reinstall_option) -> Qnil
- *
- * Set our DepListReinstallOption
- */
- /*
- * Document-method: reinstall_scm=
- *
- * call-seq:
- * reinstall_scm=(dep_list_reinstall_scm_option) -> Qnil
- *
- * Set our DepListReinstallScmOption
- */
- /*
- * Document-method: target=
- *
- * call-seq:
- * target=dep_list_target_type) -> Qnil
- *
- * Set our DepListTargetType
- */
- /*
- * Document-method: upgrade=
- *
- * call-seq:
- * upgrade=(dep_list_upgrade_option) -> Qnil
- *
- * Set our DepListUpgradeOption
- */
- /*
- * Document-method: downgrade=
- *
- * call-seq:
- * downgrade=(dep_list_downgrade_options) -> Qnil
- *
- * Set our DepListDowngradeOption
- */
- /*
- * Document-method: new_slots=
- *
- * call-seq:
- * new_slots=(dep_list_new_slots_options) -> Qnil
- *
- * Set our DepListNewSlotsOption
- */
- /*
- * Document-method: fall_back=
- *
- * call-seq:
- * fall_back=(dep_list_fall_back_option) -> Qnil
- *
- * Set our DepListFallBackOption
- */
- /*
- * Document-method: installed_deps_pre=
- *
- * call-seq:
- * installed_deps_pre=(dep_list_deps_option) -> Qnil
- *
- * Set our installed_deps_runtime
- */
- /*
- * Document-method: installed_deps_runtime=
- *
- * call-seq:
- * installed_deps_runtime=(dep_list_deps_option) -> Qnil
- *
- * Set our installed_deps_runtime
- */
- /*
- * Document-method: installed_deps_post=
- *
- * call-seq:
- * installed_deps_post=(dep_list_deps_option) -> Qnil
- *
- * Set our installed_deps_post
- */
- /*
- * Document-method: uninstalled_deps_pre=
- *
- * call-seq:
- * uninstalled_deps_pre=(dep_list_deps_option) -> Qnil
- *
- * Set our uninstalled_deps_runtime
- */
- /*
- * Document-method: uninstalled_deps_runtime=
- *
- * call-seq:
- * uninstalled_deps_runtime(dep_list_deps_option) -> Qnil
- *
- * Set our uninstalled_deps_runtime
- */
- /*
- * Document-method: uninstalled_deps_post=
- *
- * call-seq:
- * uninstalled_deps_post=(dep_list_deps_option) -> Qnil
- *
- * Set our uninstalled_deps_post
- */
- /*
- * Document-method: uninstalled_deps_suggested=
- *
- * call-seq:
- * uninstalled_deps_suggested=(dep_list_deps_option) -> Qnil
- *
- * Set our uninstalled_deps_suggested
- */
- /*
- * Document-method: suggested=
- *
- * call-seq:
- * suggested=(dep_list_suggested_option) -> Qnil
- *
- * Set our DepListSuggestedOption
- */
- /*
- * Document-method: circular=
- *
- * call-seq:
- * circular=(dep_list_circular_options) -> Qnil
- *
- * Set our DepListCircularOption
- */
- /*
- * Document-method: use=
- *
- * call-seq:
- * use=(dep_list_use_option) -> Qnil
- *
- * Set our DepListSuggestedOption
- */
- /*
- * Document-method: blocks=
- *
- * call-seq:
- * blocks=(dep_list_block_option) -> Qnil
- *
- * Set our DepListBlockOption
- */
- template <typename T_, typename K_, NamedValue<K_, T_> DepListOptions::* m_>
- struct OptionsMember
- {
- static VALUE
- fetch(VALUE self)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- return INT2FIX(((**p).*m_)());
- }
-
- static VALUE
- set (VALUE self, VALUE val)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- try
- {
- ((**p).*m_)() = static_cast<T_>(NUM2INT(val));
- return Qnil;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
- };
-
- /*
- * call-seq:
- * dependancy_tags -> true or false
- *
- * Our dependency_tags
- */
- VALUE
- dep_list_options_dependency_tags(VALUE self)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- return (*p)->dependency_tags() ? Qtrue : Qfalse;
- }
-
- /*
- * call-seq:
- * dependancy_tags=(true or false) -> Qnil
- *
- * Set our dependency_tags
- */
- VALUE
- dep_list_options_dependency_tags_set(VALUE self, VALUE tags)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- try
- {
- if (Qtrue == tags)
- {
- (*p)->dependency_tags() = true;
- }
- else if (Qfalse == tags)
- {
- (*p)->dependency_tags() = false;
- }
- else
- {
- rb_raise(rb_eTypeError, "dependency_tags= expects a bool");
- }
- return Qnil;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * override_masks -> DepListOverrideMasksFunctions
- *
- * Our override masks.
- */
- VALUE
- dep_list_options_override_masks(VALUE self)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- return (*p)->override_masks() ? dep_list_override_masks_functions_to_value((*p)->override_masks()) : Qnil;
- }
-
- /*
- * call-seq:
- * override_masks=(dep_list_override_masks_functions) -> Qnil
- *
- * Set our override masks.
- */
- VALUE
- dep_list_options_override_masks_set(VALUE self, VALUE omf)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- try
- {
- (*p)->override_masks() = value_to_dep_list_override_masks_functions(omf);
- return Qnil;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * match_package_options -> MatchPackageOptions
- *
- * Our match_package options.
- */
- VALUE
- dep_list_options_match_package_options(VALUE self)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- return match_package_options_to_value((*p)->match_package_options());
- }
-
- /*
- * call-seq:
- * match_package_options=(MatchPackageOptions) -> Qnil
- *
- * Set our override masks.
- */
- VALUE
- dep_list_options_match_package_options_set(VALUE self, VALUE omf)
- {
- std::shared_ptr<DepListOptions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOptions>, p);
- try
- {
- (*p)->match_package_options() = value_to_match_package_options(omf);
- return Qnil;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- VALUE
- dep_list_init(int, VALUE *, VALUE self)
- {
- return self;
- }
-
- /*
- * call-seq:
- * new(environment, dep_list_options) -> DepList
- *
- * Create a new DepList
- */
- VALUE
- dep_list_new(int argc, VALUE *argv, VALUE self)
- {
- DepList * ptr(0);
- try
- {
- if (2 == argc)
- {
- ptr = new DepList(value_to_environment(argv[0]).get(),
- *value_to_dep_list_options(argv[1]));
- }
- else
- {
- rb_raise(rb_eArgError, "DepList expects two arguments, but got %d",argc);
- }
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<DepList>::free, ptr));
- rb_obj_call_init(tdata, argc, argv);
- return tdata;
- }
- catch (const std::exception & e)
- {
- delete ptr;
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * add(dep_spec, destinations)
- * add(set_spec_tree, destinations)
- *
- * Add the packages required to resolve an additional dependency
- * spec or set.
- */
- VALUE
- dep_list_add(VALUE self, VALUE da, VALUE d)
- {
- try
- {
- DepList * p;
- Data_Get_Struct(self, DepList, p);
- if (!rb_obj_is_kind_of(d, rb_cArray))
- rb_raise(rb_eTypeError, "Can't convert %s into Array", rb_obj_classname(d));
- std::shared_ptr<DestinationsSet> destinations(std::make_shared<DestinationsSet>());
-
- for (long i = 0 ; i < RARRAY_LEN(d) ; ++i)
- destinations->insert(value_to_repository(rb_ary_entry(d, i)));
-
- std::shared_ptr<const SetSpecTree> sst(value_to_dep_tree<SetSpecTree>(da));
- p->add(*sst, destinations);
- return self;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * clear
- *
- * Clear the list.
- */
- VALUE
- dep_list_clear(VALUE self)
- {
- DepList * p;
- Data_Get_Struct(self, DepList, p);
- p->clear();
- return self;
- }
-
- /*
- * call-seq:
- * options -> DepListOptions
- *
- * Our DepListOptions.
- */
- VALUE
- dep_list_options(VALUE self)
- {
- DepList * p;
- Data_Get_Struct(self, DepList, p);
- return dep_list_options_to_value(p->options());
- }
-
-#if CIARANM_REMOVED_THIS
- /*
- * call-seq:
- * already_installed?(dep_spec, destinations)
- *
- * Is an spec structure already installed?
- */
- VALUE
- dep_list_already_installed(VALUE self, VALUE da, VALUE d)
- {
- try
- {
- DepList * p;
- Data_Get_Struct(self, DepList, p);
- if (!rb_obj_is_kind_of(d, rb_cArray))
- rb_raise(rb_eTypeError, "Can't convert %s into Array", rb_obj_classname(d));
- std::shared_ptr<DestinationsCollection> destinations(std::make_shared<DestinationsCollection::Concrete>());
-
- for (long i = 0 ; i < RARRAY_LEN(d) ; ++i)
- destinations->insert(value_to_repository(rb_ary_entry(d, i)));
-
- return p->already_installed(*value_to_dep_spec(da), destinations) ? Qtrue : Qfalse;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-#endif
-
- /*
- * call-seq:
- * each {|dep_list_entry| block}
- *
- * Iterate over our DepListEntrys
- */
- VALUE
- dep_list_each(VALUE self)
- {
- DepList * p;
- Data_Get_Struct(self, DepList, p);
- for (DepList::Iterator i(p->begin()), i_end(p->end()) ; i != i_end ; ++i)
- rb_yield(dep_list_entry_to_value(*i));
- return self;
- }
-
- /*
- * call-seq:
- * kind -> DepListEntryKind
- *
- * Our DepListEntryKind.
- */
- VALUE
- dep_list_entry_kind(VALUE self)
- {
- try
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
- return INT2FIX(p->kind());
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * package_id -> PackageID
- *
- * Our PackageID.
- */
-
- VALUE
- dep_list_entry_package_id(VALUE self)
- {
- try
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
- return(package_id_to_value(p->package_id()));
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * tags -> Array
- *
- * Our DepTags
- */
- VALUE
- dep_list_entry_tags(VALUE self)
- {
- try
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
-
- VALUE result(rb_ary_new());
- for (DepListEntryTags::ConstIterator r(p->tags()->begin()),
- r_end(p->tags()->end()) ; r != r_end ; ++r)
- rb_ary_push(result, dep_tag_to_value((*r).tag()));
-
- return result;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * state -> DepListEntryState
- *
- * Our DepListEntryState.
- */
- VALUE
- dep_list_entry_state(VALUE self)
- {
- try
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
- return INT2FIX(p->state());
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- /*
- * call-seq:
- * bind(function, [environment] -> self
- *
- * Bind a c++ function to DepListOverrideMasksFunctions. Acceptable values are
- * bind(:tilde_keywords, env)
- * bind(:unkeyworded, env)
- * bind(:repository_masks)
- * bind(:license)
- */
- VALUE
- dep_list_override_masks_functions_bind(int argc, VALUE* argv, VALUE self)
- {
- using namespace std::placeholders;
-
- if (argc < 1 || argc > 2)
- rb_raise(rb_eArgError, "Expected one or two arguments, not %d", argc);
- Check_Type(argv[0], T_SYMBOL);
- std::shared_ptr<DepListOverrideMasksFunctions> * p;
- Data_Get_Struct(self, std::shared_ptr<DepListOverrideMasksFunctions>, p);
- if (rb_intern("tilde_keywords") == SYM2ID(argv[0]))
- {
- if (2 != argc)
- rb_raise(rb_eArgError, "Expected two arguments, not %d", argc);
- std::shared_ptr<Environment> env = value_to_environment(argv[1]);
- (*p)->push_back(std::bind(&override_tilde_keywords, env.get(), _1, _2));
- }
- else if (rb_intern("unkeyworded") == SYM2ID(argv[0]))
- {
- if (2 != argc)
- rb_raise(rb_eArgError, "Expected two arguments, not %d", argc);
- std::shared_ptr<Environment> env = value_to_environment(argv[1]);
- (*p)->push_back(std::bind(&override_unkeyworded, env.get(), _1, _2));
- }
- else if (rb_intern("repository_masks") == SYM2ID(argv[0]))
- {
- if (1 != argc)
- rb_raise(rb_eArgError, "Expected one argument, not %d", argc);
- (*p)->push_back(std::bind(&override_repository_masks, _2));
- }
- else if (rb_intern("license") == SYM2ID(argv[0]))
- {
- if (1 != argc)
- {
- rb_raise(rb_eArgError, "Expected one argument, not %d", argc);
- }
- (*p)->push_back(std::bind(&override_license, _1, _2));
- }
- else
- {
- rb_raise(rb_eArgError, "Unrecognised function to bind: %s", rb_id2name(SYM2ID(argv[0])));
- }
- return self;
- }
-
- void do_register_dep_list()
- {
- /*
- * Document-module: Paludis::DepListTargetType
- *
- * What type of target are we handling at the top level.
- *
- */
- c_dep_list_target_type = rb_define_module_under(paludis_module(), "DepListTargetType");
- for (DepListTargetType l(static_cast<DepListTargetType>(0)), l_end(last_dl_target) ; l != l_end ;
- l = static_cast<DepListTargetType>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_target_type, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListTargetType, c_dep_list_target_type>
-
- /*
- * Document-module: Paludis::DepListReinstallOption
- *
- * What should we reinstall.
- *
- */
- c_dep_list_reinstall_option = rb_define_module_under(paludis_module(), "DepListReinstallOption");
- for (DepListReinstallOption l(static_cast<DepListReinstallOption>(0)), l_end(last_dl_reinstall) ; l != l_end ;
- l = static_cast<DepListReinstallOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_reinstall_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListReinstallOption, c_dep_list_reinstall_option>
-
- /*
- * Document-module: Paludis::DepListFallBackOption
- *
- * When can we fall back to installed?
- *
- */
- c_dep_list_fall_back_option = rb_define_module_under(paludis_module(), "DepListFallBackOption");
- for (DepListFallBackOption l(static_cast<DepListFallBackOption>(0)), l_end(last_dl_fall_back) ; l != l_end ;
- l = static_cast<DepListFallBackOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_fall_back_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListFallBackOption, c_dep_list_fall_back_option>
-
- /*
- * Document-module: Paludis::DepListReinstallScmOption
- *
- * When should we reinstall scm.
- *
- */
- c_dep_list_reinstall_scm_option = rb_define_module_under(paludis_module(), "DepListReinstallScmOption");
- for (DepListReinstallScmOption l(static_cast<DepListReinstallScmOption>(0)), l_end(last_dl_reinstall_scm) ; l != l_end ;
- l = static_cast<DepListReinstallScmOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_reinstall_scm_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListReinstallScmOption, c_dep_list_reinstall_scm_option>
-
- /*
- * Document-module: Paludis::DepListDowngradeOption
- *
- * What do we do when we downgrade.
- *
- */
- c_dep_list_downgrade_option = rb_define_module_under(paludis_module(), "DepListDowngradeOption");
- for (DepListDowngradeOption l(static_cast<DepListDowngradeOption>(0)), l_end(last_dl_downgrade) ; l != l_end ;
- l = static_cast<DepListDowngradeOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_downgrade_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListDowngradeOption, c_dep_list_downgrade_option>
-
- /*
- * Document-module: Paludis::DepListUpgradeOption
- *
- * When should we upgrade.
- *
- */
- c_dep_list_upgrade_option = rb_define_module_under(paludis_module(), "DepListUpgradeOption");
- for (DepListUpgradeOption l(static_cast<DepListUpgradeOption>(0)), l_end(last_dl_upgrade) ; l != l_end ;
- l = static_cast<DepListUpgradeOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_upgrade_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListUpgradeOption, c_dep_list_upgrade_option>
-
- /*
- * Document-module: Paludis::DepListNewSlotsOption
- *
- * When should we pull in a new slot.
- *
- */
- c_dep_list_new_slots_option = rb_define_module_under(paludis_module(), "DepListNewSlotsOption");
- for (DepListNewSlotsOption l(static_cast<DepListNewSlotsOption>(0)), l_end(last_dl_new_slots) ; l != l_end ;
- l = static_cast<DepListNewSlotsOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_new_slots_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListNewSlotsOption, c_dep_list_new_slots_option>
-
- /*
- * Document-module: Paludis::DepListDepsOption
- *
- * How should we handle a dep class.
- *
- */
- c_dep_list_deps_option = rb_define_module_under(paludis_module(), "DepListDepsOption");
- for (DepListDepsOption l(static_cast<DepListDepsOption>(0)), l_end(last_dl_deps) ; l != l_end ;
- l = static_cast<DepListDepsOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_deps_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListDepsOption, c_dep_list_deps_option>
-
- /*
- * Document-module: Paludis::DepListCircularOption
- *
- * How we handle circular deps.
- *
- */
- c_dep_list_suggested_option = rb_define_module_under(paludis_module(), "DepListSuggestedOption");
- for (DepListSuggestedOption l(static_cast<DepListSuggestedOption>(0)), l_end(last_dl_suggested) ; l != l_end ;
- l = static_cast<DepListSuggestedOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_suggested_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListSuggestedOption, c_dep_list_suggested_option>
-
- /*
- * Document-module: Paludis::DepListCircularOption
- *
- * How we handle circular deps.
- *
- */
- c_dep_list_circular_option = rb_define_module_under(paludis_module(), "DepListCircularOption");
- for (DepListCircularOption l(static_cast<DepListCircularOption>(0)), l_end(last_dl_circular) ; l != l_end ;
- l = static_cast<DepListCircularOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_circular_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListCircularOption, c_dep_list_circular_option>
-
- /*
- * Document-module: Paludis::DepListUseOption
- *
- * Not for end user use. Used by adjutrix and qa.
- *
- */
- c_dep_list_use_option = rb_define_module_under(paludis_module(), "DepListUseOption");
- for (DepListUseOption l(static_cast<DepListUseOption>(0)), l_end(last_dl_use_deps) ; l != l_end ;
- l = static_cast<DepListUseOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_use_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListUseOption, c_dep_list_use_option>
-
- /*
- * Document-module: Paludis::DepListBlocksOption
- *
- * How we handle blocks.
- *
- */
- c_dep_list_blocks_option = rb_define_module_under(paludis_module(), "DepListBlocksOption");
- for (DepListBlocksOption l(static_cast<DepListBlocksOption>(0)), l_end(last_dl_blocks) ; l != l_end ;
- l = static_cast<DepListBlocksOption>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_blocks_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListBlocksOption, c_dep_list_blocks_option>
-
- /*
- * Document-module: Paludis::DepListEntryState
- *
- * State of a DepListEntry.
- *
- */
- c_dep_list_entry_state = rb_define_module_under(paludis_module(), "DepListEntryState");
- for (DepListEntryState l(static_cast<DepListEntryState>(0)), l_end(last_dle) ; l != l_end ;
- l = static_cast<DepListEntryState>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_entry_state, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListEntryState, c_dep_list_entry_state>
-
- /*
- * Document-module: Paludis::DepListEntryKind
- *
- * Kind of a DepListEntry.
- *
- */
- c_dep_list_entry_kind = rb_define_module_under(paludis_module(), "DepListEntryKind");
- for (DepListEntryKind l(static_cast<DepListEntryKind>(0)), l_end(last_dlk) ; l != l_end ;
- l = static_cast<DepListEntryKind>(static_cast<int>(l) + 1))
- rb_define_const(c_dep_list_entry_kind, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/dep_list_options-se.hh, DepListEntryKind, c_dep_list_entry_kind>
-
- /*
- * Document-class: Paludis::DepListOptions
- *
- * Parameters for a DepList.
- */
- c_dep_list_options = rb_define_class_under(paludis_module(), "DepListOptions", rb_cObject);
- rb_define_singleton_method(c_dep_list_options, "new", RUBY_FUNC_CAST(&dep_list_options_new), -1);
- rb_define_method(c_dep_list_options, "initialize", RUBY_FUNC_CAST(&dep_list_options_init), -1);
- rb_define_method(c_dep_list_options, "reinstall",
- RUBY_FUNC_CAST((&OptionsMember<DepListReinstallOption, n::reinstall, &DepListOptions::reinstall>::fetch)),0);
- rb_define_method(c_dep_list_options, "reinstall_scm",
- RUBY_FUNC_CAST((&OptionsMember<DepListReinstallScmOption, n::reinstall_scm, &DepListOptions::reinstall_scm>::fetch)),0);
- rb_define_method(c_dep_list_options, "target_type",
- RUBY_FUNC_CAST((&OptionsMember<DepListTargetType, n::target_type, &DepListOptions::target_type>::fetch)),0);
- rb_define_method(c_dep_list_options, "downgrade",
- RUBY_FUNC_CAST((&OptionsMember<DepListDowngradeOption, n::downgrade, &DepListOptions::downgrade>::fetch)),0);
- rb_define_method(c_dep_list_options, "upgrade",
- RUBY_FUNC_CAST((&OptionsMember<DepListUpgradeOption, n::upgrade, &DepListOptions::upgrade>::fetch)),0);
- rb_define_method(c_dep_list_options, "new_slots",
- RUBY_FUNC_CAST((&OptionsMember<DepListNewSlotsOption, n::new_slots, &DepListOptions::new_slots>::fetch)),0);
- rb_define_method(c_dep_list_options, "fall_back",
- RUBY_FUNC_CAST((&OptionsMember<DepListFallBackOption, n::fall_back, &DepListOptions::fall_back>::fetch)),0);
- rb_define_method(c_dep_list_options, "installed_deps_pre",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_pre, &DepListOptions::installed_deps_pre>::fetch)),0);
- rb_define_method(c_dep_list_options, "installed_deps_runtime",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_runtime, &DepListOptions::installed_deps_runtime>::fetch)),0);
- rb_define_method(c_dep_list_options, "installed_deps_post",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_post, &DepListOptions::installed_deps_post>::fetch)),0);
- rb_define_method(c_dep_list_options, "uninstalled_deps_pre",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_pre, &DepListOptions::uninstalled_deps_pre>::fetch)),0);
- rb_define_method(c_dep_list_options, "uninstalled_deps_runtime",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_runtime, &DepListOptions::uninstalled_deps_runtime>::fetch)),0);
- rb_define_method(c_dep_list_options, "uninstalled_deps_post",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_post, &DepListOptions::uninstalled_deps_post>::fetch)),0);
- rb_define_method(c_dep_list_options, "uninstalled_deps_suggested",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_suggested, &DepListOptions::uninstalled_deps_suggested>::fetch)),0);
- rb_define_method(c_dep_list_options, "suggested",
- RUBY_FUNC_CAST((&OptionsMember<DepListSuggestedOption, n::suggested, &DepListOptions::suggested>::fetch)),0);
- rb_define_method(c_dep_list_options, "circular",
- RUBY_FUNC_CAST((&OptionsMember<DepListCircularOption, n::circular, &DepListOptions::circular>::fetch)),0);
- rb_define_method(c_dep_list_options, "use",
- RUBY_FUNC_CAST((&OptionsMember<DepListUseOption, n::use, &DepListOptions::use>::fetch)),0);
- rb_define_method(c_dep_list_options, "blocks",
- RUBY_FUNC_CAST((&OptionsMember<DepListBlocksOption, n::blocks, &DepListOptions::blocks>::fetch)),0);
-
- rb_define_method(c_dep_list_options, "reinstall=",
- RUBY_FUNC_CAST((&OptionsMember<DepListReinstallOption, n::reinstall, &DepListOptions::reinstall>::set)),1);
- rb_define_method(c_dep_list_options, "reinstall_scm=",
- RUBY_FUNC_CAST((&OptionsMember<DepListReinstallScmOption, n::reinstall_scm, &DepListOptions::reinstall_scm>::set)),1);
- rb_define_method(c_dep_list_options, "target_type=",
- RUBY_FUNC_CAST((&OptionsMember<DepListTargetType, n::target_type, &DepListOptions::target_type>::set)),1);
- rb_define_method(c_dep_list_options, "upgrade=",
- RUBY_FUNC_CAST((&OptionsMember<DepListUpgradeOption, n::upgrade, &DepListOptions::upgrade>::set)),1);
- rb_define_method(c_dep_list_options, "downgrade=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDowngradeOption, n::downgrade, &DepListOptions::downgrade>::set)),1);
- rb_define_method(c_dep_list_options, "new_slots=",
- RUBY_FUNC_CAST((&OptionsMember<DepListNewSlotsOption, n::new_slots, &DepListOptions::new_slots>::set)),1);
- rb_define_method(c_dep_list_options, "fall_back=",
- RUBY_FUNC_CAST((&OptionsMember<DepListFallBackOption, n::fall_back, &DepListOptions::fall_back>::set)),1);
- rb_define_method(c_dep_list_options, "installed_deps_pre=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_pre, &DepListOptions::installed_deps_pre>::set)),1);
- rb_define_method(c_dep_list_options, "installed_deps_runtime=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_runtime, &DepListOptions::installed_deps_runtime>::set)),1);
- rb_define_method(c_dep_list_options, "installed_deps_post=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::installed_deps_post, &DepListOptions::installed_deps_post>::set)),1);
- rb_define_method(c_dep_list_options, "uninstalled_deps_pre=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_pre, &DepListOptions::uninstalled_deps_pre>::set)),1);
- rb_define_method(c_dep_list_options, "uninstalled_deps_runtime=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_runtime, &DepListOptions::uninstalled_deps_runtime>::set)),1);
- rb_define_method(c_dep_list_options, "uninstalled_deps_post=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_post, &DepListOptions::uninstalled_deps_post>::set)),1);
- rb_define_method(c_dep_list_options, "uninstalled_deps_suggested=",
- RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, n::uninstalled_deps_suggested, &DepListOptions::uninstalled_deps_suggested>::set)),1);
- rb_define_method(c_dep_list_options, "suggested=",
- RUBY_FUNC_CAST((&OptionsMember<DepListSuggestedOption, n::suggested, &DepListOptions::suggested>::set)),1);
- rb_define_method(c_dep_list_options, "circular=",
- RUBY_FUNC_CAST((&OptionsMember<DepListCircularOption, n::circular, &DepListOptions::circular>::set)),1);
- rb_define_method(c_dep_list_options, "use=",
- RUBY_FUNC_CAST((&OptionsMember<DepListUseOption, n::use, &DepListOptions::use>::set)),1);
- rb_define_method(c_dep_list_options, "blocks=",
- RUBY_FUNC_CAST((&OptionsMember<DepListBlocksOption, n::blocks, &DepListOptions::blocks>::set)),1);
-
-
- rb_define_method(c_dep_list_options, "dependency_tags", RUBY_FUNC_CAST(&dep_list_options_dependency_tags),0);
- rb_define_method(c_dep_list_options, "dependency_tags=", RUBY_FUNC_CAST(&dep_list_options_dependency_tags_set),1);
-
- rb_define_method(c_dep_list_options, "override_masks", RUBY_FUNC_CAST(&dep_list_options_override_masks),0);
- rb_define_method(c_dep_list_options, "override_masks=", RUBY_FUNC_CAST(&dep_list_options_override_masks_set),1);
-
- rb_define_method(c_dep_list_options, "match_package_options", RUBY_FUNC_CAST(&dep_list_options_match_package_options), 0);
- rb_define_method(c_dep_list_options, "match_package_options=", RUBY_FUNC_CAST(&dep_list_options_match_package_options_set), 1);
-
- /*
- * Document-class: Paludis::DepList
- *
- * Holds a list of dependencies in merge order. Includes Enumerable[http://www.ruby-doc.org/core/classes/Enumerable.html],
- * but not Comparable.
- */
- c_dep_list= rb_define_class_under(paludis_module(), "DepList", rb_cObject);
- rb_define_singleton_method(c_dep_list, "new", RUBY_FUNC_CAST(&dep_list_new), -1);
- rb_define_method(c_dep_list, "initialize", RUBY_FUNC_CAST(&dep_list_init), -1);
- rb_define_method(c_dep_list, "clear", RUBY_FUNC_CAST(&dep_list_clear), 0);
- rb_define_method(c_dep_list, "add", RUBY_FUNC_CAST(&dep_list_add), 2);
-#if CIARANM_REMOVED_THIS
- rb_define_method(c_dep_list, "already_installed?", RUBY_FUNC_CAST(&dep_list_already_installed), 2);
-#endif
- rb_define_method(c_dep_list, "each", RUBY_FUNC_CAST(&dep_list_each), 0);
- rb_include_module(c_dep_list, rb_mEnumerable);
- rb_define_method(c_dep_list, "options", RUBY_FUNC_CAST(&dep_list_options), 0);
-
- /*
- * Document-class Paludis::DepListEntry
- *
- * An entry in a DepList.
- */
- c_dep_list_entry = rb_define_class_under(paludis_module(), "DepListEntry", rb_cObject);
- rb_funcall(c_dep_list_entry, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_dep_list_entry, "kind", RUBY_FUNC_CAST(&dep_list_entry_kind), 0);
- rb_define_method(c_dep_list_entry, "package_id", RUBY_FUNC_CAST(&dep_list_entry_package_id), 0);
- rb_define_method(c_dep_list_entry, "state", RUBY_FUNC_CAST(&dep_list_entry_state), 0);
- rb_define_method(c_dep_list_entry, "tags", RUBY_FUNC_CAST(&dep_list_entry_tags), 0);
-
- /*
- * Document-module Paludis::OverrideFunctions
- *
- * blah
- */
- c_dep_list_override_masks_functions = rb_define_class_under(paludis_module(), "DepListOverrideMasksFunctions", rb_cObject);
- rb_define_singleton_method(c_dep_list_override_masks_functions, "new", RUBY_FUNC_CAST(&dep_list_override_masks_functions_new), -1);
- rb_define_method(c_dep_list_override_masks_functions, "initialize", RUBY_FUNC_CAST(&dep_list_override_masks_functions_init), -1);
- rb_define_method(c_dep_list_override_masks_functions, "bind",
- RUBY_FUNC_CAST(&dep_list_override_masks_functions_bind), -1);
- }
-}
-
-
-RegisterRubyClass::Register paludis_ruby_register_dep_list PALUDIS_ATTRIBUTE((used))
- (&do_register_dep_list);
-
-
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
deleted file mode 100644
index 056ba64..0000000
--- a/ruby/dep_list_TEST.rb
+++ /dev/null
@@ -1,305 +0,0 @@
-#!/usr/bin/env ruby
-# vim: set sw=4 sts=4 et tw=80 :
-#
-# Copyright (c) 2007 Richard Brown
-#
-# 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
-#
-
-ENV['PALUDIS_HOME'] = Dir.getwd() + '/dep_list_TEST_dir/home'
-
-require 'test/unit'
-require 'Paludis'
-
-Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
-
-module Paludis
- module Shared
- def dlo
- DepListOptions.new(
- DepListReinstallOption::Never,
- DepListReinstallScmOption::Never,
- DepListTargetType::Package,
- DepListUpgradeOption::Always,
- DepListDowngradeOption::AsNeeded,
- DepListNewSlotsOption::Always,
- DepListFallBackOption::AsNeededExceptTargets,
- DepListDepsOption::Discard,
- DepListDepsOption::TryPost,
- DepListDepsOption::TryPost,
- DepListDepsOption::Pre,
- DepListDepsOption::PreOrPost,
- DepListDepsOption::Post,
- DepListDepsOption::TryPost,
- DepListSuggestedOption::Show,
- DepListCircularOption::Error,
- DepListUseOption::Standard,
- DepListBlocksOption::Accumulate,
- DepListOverrideMasksFunctions.new,
- false,
- []
- )
- end
-
- def default_options
- {
- :reinstall => DepListReinstallOption::Never,
- :reinstall_scm => DepListReinstallScmOption::Never,
- :target_type => DepListTargetType::Package,
- :upgrade => DepListUpgradeOption::Always,
- :downgrade => DepListDowngradeOption::AsNeeded,
- :new_slots => DepListNewSlotsOption::Always,
- :fall_back => DepListFallBackOption::AsNeededExceptTargets,
- :installed_deps_pre => DepListDepsOption::Discard,
- :installed_deps_runtime => DepListDepsOption::TryPost,
- :installed_deps_post => DepListDepsOption::TryPost,
- :uninstalled_deps_pre => DepListDepsOption::Pre,
- :uninstalled_deps_runtime => DepListDepsOption::PreOrPost,
- :uninstalled_deps_post => DepListDepsOption::Post,
- :uninstalled_deps_suggested => DepListDepsOption::TryPost,
- :suggested => DepListSuggestedOption::Show,
- :circular => DepListCircularOption::Error,
- :use => DepListUseOption::Standard,
- :blocks => DepListBlocksOption::Accumulate,
- :override_masks => DepListOverrideMasksFunctions.new,
- :dependency_tags => false,
- :match_package_options => []
- }
- end
-
- def dlo_hash
- DepListOptions.new(options_hash)
- end
-
- def options_hash
- {
- :reinstall => DepListReinstallOption::Always,
- :reinstall_scm => DepListReinstallScmOption::Always,
- :target_type => DepListTargetType::Set,
- :upgrade => DepListUpgradeOption::AsNeeded,
- :downgrade => DepListDowngradeOption::Warning,
- :new_slots => DepListNewSlotsOption::AsNeeded,
- :fall_back => DepListFallBackOption::AsNeeded,
- :installed_deps_pre => DepListDepsOption::Pre,
- :installed_deps_runtime => DepListDepsOption::Discard,
- :installed_deps_post => DepListDepsOption::Discard,
- :uninstalled_deps_pre => DepListDepsOption::Discard,
- :uninstalled_deps_runtime => DepListDepsOption::Discard,
- :uninstalled_deps_post => DepListDepsOption::Discard,
- :uninstalled_deps_suggested => DepListDepsOption::Discard,
- :suggested => DepListSuggestedOption::Discard,
- :circular => DepListCircularOption::Discard,
- :use => DepListUseOption::TakeAll,
- :blocks => DepListBlocksOption::Error,
- :override_masks => DepListOverrideMasksFunctions.new,
- :dependency_tags => true,
- :match_package_options => []
- }
- end
-
- def dlo_default
- DepListOptions.new()
- end
-
- def env
- @env or @env = EnvironmentFactory.instance.create("")
- end
-
- def dl
- DepList.new(env,dlo)
- end
-
- def pda
- Paludis::parse_user_package_dep_spec('foo/bar', env, [])
- end
-
- def dd
- env.default_destinations
- end
- end
-
- class TestCase_DepListOptions < Test::Unit::TestCase
- include Shared
-
- def test_create
- assert_nothing_raised do
- dlo
- end
-
- assert_nothing_raised do
- dlo_hash
- end
-
- assert_nothing_raised do
- dlo_default
- end
- end
-
- def test_members
- options = dlo_default
- #This will fail if the defaults change, please also update the rdoc.
- default_options.each_pair do |method, value|
- assert_respond_to options, method
- if :override_masks == method
- assert_nil options.send(method)
- else
- assert_equal value, options.send(method)
- end
- #check setters work
- assert_nothing_raised do
- options.send("#{method}=", options_hash[method])
- if :override_masks == method
- assert_equal options_hash[method].class, options.send(method).class
- else
- assert_equal options_hash[method], options.send(method)
- end
- end
- end
- end
-
- def test_bad_create
- options_hash.each_key do |key|
- assert_raises ArgumentError do
- DepListOptions.new(options_hash.delete(key))
- end
- end
- end
- end
-
- class TestCase_DepList < Test::Unit::TestCase
- include Shared
-
- def test_create
- assert_nothing_raised do
- dl
- end
- end
-
-### def test_respond
-### dep_list = dl
-### [:add, :clear, :already_installed?, :each, :options].each {|sym| assert_respond_to dep_list, sym}
-### end
-
- def test_add
- assert_nothing_raised do
- dl.add(pda, dd)
- end
- end
-
- def test_add_set
- assert_nothing_raised do
- dl.add(env.set("world"), dd)
- end
- end
-
- def test_add_bad_tree
- assert_raise TypeError do
- dl.add(env[Selection::BestVersionOnly.new(Generator::Matches.new(
- pda, nil, []))].last.build_dependencies_key.value, dd)
- end
- end
-
- def test_clear
- assert_nothing_raised do
- dl.clear
- end
- end
-
-### def test_already_installed?
-### dep_spec = pda
-### dep_list = dl
-### assert !dep_list.already_installed?(dep_spec, dd)
-### dep_list.add(dep_spec, dd)
-### assert dep_list.already_installed?(dep_spec, dd)
-### end
-
-### def test_each
-### assert_kind_of DepListEntry, dl.add(pda, dd).entries.first
-### end
-
-### def test_errors
-### assert_raise AllMaskedError do
-### dl.add(PackageDepSpec.new('foo/ba', PackageDepSpecParseMode::Permissive), dd)
-### end
-###
-### begin
-### dl.add(PackageDepSpec.new('foo/ba', PackageDepSpecParseMode::Permissive), dd)
-### rescue AllMaskedError => error
-### assert_equal 'foo/ba', error.query
-### end
-###
-### end
-
- def test_options
- dep_list = dl
- assert_kind_of DepListOptions, dep_list.options
- assert_equal DepListReinstallOption::Never, dep_list.options.reinstall
-
- assert_nothing_raised do
- dep_list.options.reinstall = DepListReinstallOption::Always
- end
-
- assert_equal DepListReinstallOption::Always, dep_list.options.reinstall
-
- end
- end
-
- class TestCase_DepListEntry < Test::Unit::TestCase
- include Shared
-
- def dle
- dl.add(pda, dd).entries.first
- end
-
- def test_create
- assert_raise NoMethodError do
- DepListEntry.new
- end
- end
-
- def test_methods
- dep_list_entry = dle
- {
- :package_id => PackageID, :state=> Integer, :tags => [String]
- }.each_pair do |method, returns|
- assert_respond_to dep_list_entry, method
- if returns.kind_of? Array
- assert_kind_of Array, dep_list_entry.send(method)
- dep_list_entry.send(method).each {|x| assert_kind_of returns.first, x}
- else
- assert_kind_of returns, dep_list_entry.send(method)
- end
- end
- end
- end
-
- class TestCase_DepListOverrideMasksFunctions < Test::Unit::TestCase
- include Shared
-
- def test_create
- assert_nothing_raised do
- DepListOverrideMasksFunctions.new
- end
- end
-
- def test_bind
- dlo = DepListOverrideMasksFunctions.new
- assert_equal dlo, dlo.bind(:tilde_keywords, env)
- assert_equal dlo, dlo.bind(:unkeyworded, env)
- assert_equal dlo, dlo.bind(:repository_masks)
- assert_equal dlo, dlo.bind(:license)
- end
- end
-end
-
diff --git a/ruby/dep_list_TEST_cleanup.sh b/ruby/dep_list_TEST_cleanup.sh
deleted file mode 100755
index f51e43b..0000000
--- a/ruby/dep_list_TEST_cleanup.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d dep_list_TEST_dir ] ; then
- rm -fr dep_list_TEST_dir
-else
- true
-fi
-
-
-
-
diff --git a/ruby/dep_list_TEST_setup.sh b/ruby/dep_list_TEST_setup.sh
deleted file mode 100755
index 923afd2..0000000
--- a/ruby/dep_list_TEST_setup.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir dep_list_TEST_dir || exit 1
-cd dep_list_TEST_dir || exit 1
-
-mkdir -p home/.paludis/repositories
-
-cat <<END > home/.paludis/repositories/testrepo.conf
-location = `pwd`/testrepo
-format = e
-names_cache = /var/empty
-cache = /var/empty
-profiles = \${location}/profiles/testprofile
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/repositories/installed.conf
-location = `pwd`/installed
-format = vdb
-names_cache = /var/empty
-provides_cache = /var/empty
-builddir = `pwd`
-END
-
-cat <<END > home/.paludis/keywords.conf
-*/* test
-~foo/bar-1.0 ~test
-END
-
-cat <<END > home/.paludis/use.conf
-*/* enabled
-~foo/bar-1.0 sometimes_enabled
-END
-
-cat <<END > home/.paludis/package_mask.conf
-=foo/bar-3*
-END
-
-cat <<END > home/.paludis/licenses.conf
-*/* *
-END
-
-cat <<END > home/.paludis/general.conf
-world = /dev/null
-END
-
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-cat <<END > profiles/profiles.desc
-test testprofile stable
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-DEPEND="disabled? ( bar/foo )"
-END
-cd ..
-
-mkdir -p installed/cat-one/pkg-one-1 || exit 1
-
-echo foo/bar >installed/world
-
-for i in SLOT EAPI; do
- echo "0" >installed/cat-one/pkg-one-1/${i}
-done
-
-for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
- touch installed/cat-one/pkg-one-1/${i}
-done
-
-echo "flag1 flag2" >>installed/cat-one/pkg-one-1/USE
-
-cat <<END >installed/cat-one/pkg-one-1/CONTENTS
-dir //test
-obj /test/test_file de54c26b0678df67aca147575523b3c2 1165250496
-sym /test/test_link -> /test/test_file 1165250496
-END
-
diff --git a/ruby/find_unused_packages_task.cc b/ruby/find_unused_packages_task.cc
deleted file mode 100644
index df149c2..0000000
--- a/ruby/find_unused_packages_task.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Richard Brown
- *
- * 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_ruby.hh>
-#include <paludis/legacy/find_unused_packages_task.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/sequence-impl.hh>
-#include <ruby.h>
-
-using namespace paludis;
-using namespace paludis::ruby;
-
-namespace
-{
- static VALUE c_find_unused_packages_task;
-
- VALUE
- find_unused_packages_task_init(int, VALUE *, VALUE self)
- {
- return self;
- }
-
- VALUE
- find_unused_packages_task_new(int argc, VALUE *argv, VALUE self)
- {
- FindUnusedPackagesTask * ptr(0);
- try
- {
- if (2 == argc)
- {
- ptr = new FindUnusedPackagesTask(value_to_environment(argv[0]).get(),
- value_to_repository(argv[1]).get());
- }
- else
- {
- rb_raise(rb_eArgError, "FindUnusedPackagesTask expects two arguments, but got %d",argc);
- }
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<FindUnusedPackagesTask>::free, ptr));
- rb_obj_call_init(tdata, argc, argv);
- return tdata;
- }
- catch (const std::exception & e)
- {
- delete ptr;
- exception_to_ruby_exception(e);
- }
- }
-
- VALUE find_unused_packages_task_execute(VALUE self, VALUE qpn)
- {
- try
- {
- FindUnusedPackagesTask * ptr;
- Data_Get_Struct(self, FindUnusedPackagesTask, ptr);
- std::shared_ptr<const PackageIDSequence> c(ptr->execute(value_to_qualified_package_name(qpn)));
- VALUE result(rb_ary_new());
- for (PackageIDSequence::ConstIterator i(c->begin()), i_end(c->end()) ; i != i_end ; ++i)
- rb_ary_push(result, package_id_to_value(*i));
- return result;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
- void do_register_find_unused_packages_task()
- {
- /* Document-class: Paludis::QA::Message
- *
- * A QA message
- */
- c_find_unused_packages_task = rb_define_class_under(paludis_module(),
- "FindUnusedPackagesTask", rb_cObject);
- rb_define_singleton_method(c_find_unused_packages_task,
- "new", RUBY_FUNC_CAST(&find_unused_packages_task_new),-1);
- rb_define_method(c_find_unused_packages_task,
- "initialize", RUBY_FUNC_CAST(&find_unused_packages_task_init),-1);
- rb_define_method(c_find_unused_packages_task,
- "execute", RUBY_FUNC_CAST(&find_unused_packages_task_execute),1);
- }
-}
-
-RegisterRubyClass::Register paludis_ruby_register_find_unused_packages_task PALUDIS_ATTRIBUTE((used))
- (&do_register_find_unused_packages_task);
diff --git a/ruby/find_unused_packages_task_TEST.rb b/ruby/find_unused_packages_task_TEST.rb
deleted file mode 100644
index 175b258..0000000
--- a/ruby/find_unused_packages_task_TEST.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env ruby
-# vim: set sw=4 sts=4 et tw=80 :
-
-#
-# Copyright (c) 2007 Richard Brown
-#
-# 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
-#
-
-require 'test/unit'
-require 'Paludis'
-
-module Paludis
- Log.instance.log_level = LogLevel::Warning
-
- class TestCase_FindUnusedPackagesTask < Test::Unit::TestCase
- def env
- NoConfigEnvironment.new(Dir.getwd().to_s + "/find_unused_packages_task_TEST_dir/testrepo")
- end
-
- def task
- FindUnusedPackagesTask.new(env,env.main_repository)
- end
-
- def test_create
- assert_nothing_raised do
- task
- end
- end
-
- def test_execute
- t = task
- bar = t.execute(QualifiedPackageName.new('foo/bar'))
- assert bar.empty?
- baz = t.execute(QualifiedPackageName.new('foo/baz'))
- assert_equal 1, baz.length
- assert_kind_of PackageID, baz.first
- end
- end
-end
-
diff --git a/ruby/find_unused_packages_task_TEST_cleanup.sh b/ruby/find_unused_packages_task_TEST_cleanup.sh
deleted file mode 100755
index 63faeb5..0000000
--- a/ruby/find_unused_packages_task_TEST_cleanup.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d find_unused_packages_task_TEST_dir ] ; then
- rm -fr find_unused_packages_task_TEST_dir
-else
- true
-fi
-
-
-
-
diff --git a/ruby/find_unused_packages_task_TEST_setup.sh b/ruby/find_unused_packages_task_TEST_setup.sh
deleted file mode 100755
index b37d2c8..0000000
--- a/ruby/find_unused_packages_task_TEST_setup.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir find_unused_packages_task_TEST_dir || exit 1
-cd find_unused_packages_task_TEST_dir || exit 1
-
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files,foo/baz/files} || exit 1
-
-cd testrepo || exit 1
-echo "testrepo" > profiles/repo_name || exit 1
-cat <<END > profiles/categories || exit 1
-foo
-END
-cat <<END > profiles/testprofile/make.defaults
-ARCH=test
-USERLAND=test
-KERNEL=test
-END
-cat <<END > profiles/profiles.desc
-test testprofile stable
-END
-
-cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="~test"
-END
-
-cat <<"END" > foo/baz/baz-1.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cat <<"END" > foo/baz/baz-2.0.ebuild || exit 1
-DESCRIPTION="Test package"
-HOMEPAGE="http://paludis.pioto.org/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-END
-
-cd ..
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 292dda4..3c201b9 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -22,13 +22,13 @@
#include <paludis/util/config_file.hh>
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/legacy/dep_list_exceptions.hh>
#include <paludis/match_package.hh>
#include <paludis/version_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/about.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/action.hh>
+#include <paludis/package_database.hh>
#include <ruby.h>
#include <list>
#include <ctype.h>
@@ -63,13 +63,6 @@ namespace
static VALUE c_no_such_repository_error;
static VALUE c_configuration_error;
static VALUE c_config_file_error;
- static VALUE c_dep_list_error;
- static VALUE c_all_masked_error;
- static VALUE c_block_error;
- static VALUE c_circular_dependency_error;
- static VALUE c_additional_requirements_not_met_error;
- static VALUE c_downgrade_not_allowed_error;
- static VALUE c_no_destination_error;
static VALUE c_action_failed_error;
static VALUE c_action_aborted_error;
static VALUE c_bad_version_operator_error;
@@ -196,8 +189,6 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
rb_raise(c_name_error, dynamic_cast<const paludis::NameError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::PackageDepSpecError *>(&ee))
rb_raise(c_package_dep_spec_error, dynamic_cast<const paludis::PackageDepSpecError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee))
- rb_raise(c_no_such_repository_error, dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::AmbiguousPackageNameError *>(&ee))
{
VALUE ex_args[2];
@@ -211,29 +202,12 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
}
else if (0 != dynamic_cast<const paludis::NoSuchPackageError *>(&ee))
rb_raise(c_no_such_package_error, dynamic_cast<const paludis::NoSuchPackageError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee))
+ rb_raise(c_no_such_repository_error, dynamic_cast<const paludis::NoSuchRepositoryError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::PackageDatabaseLookupError *>(&ee))
rb_raise(c_package_database_lookup_error, dynamic_cast<const paludis::PackageDatabaseLookupError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::PackageDatabaseError *>(&ee))
rb_raise(c_package_database_error, dynamic_cast<const paludis::PackageDatabaseError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::AllMaskedError *>(&ee))
- {
- VALUE ex_args[2];
- ex_args[0] = rb_str_new2(dynamic_cast<const paludis::AllMaskedError *>(&ee)->message().c_str());
- ex_args[1] = rb_str_new2(stringify(dynamic_cast<const paludis::AllMaskedError *>(&ee)->query()).c_str());
- rb_exc_raise(rb_class_new_instance(2, ex_args, c_all_masked_error));
- }
- else if (0 != dynamic_cast<const paludis::BlockError *>(&ee))
- rb_raise(c_block_error, dynamic_cast<const paludis::BlockError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::CircularDependencyError *>(&ee))
- rb_raise(c_circular_dependency_error, dynamic_cast<const paludis::CircularDependencyError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::AdditionalRequirementsNotMetError *>(&ee))
- rb_raise(c_additional_requirements_not_met_error, dynamic_cast<const paludis::AdditionalRequirementsNotMetError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::DowngradeNotAllowedError *>(&ee))
- rb_raise(c_downgrade_not_allowed_error, dynamic_cast<const paludis::DowngradeNotAllowedError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::NoDestinationError *>(&ee))
- rb_raise(c_no_destination_error, dynamic_cast<const paludis::NoDestinationError *>(&ee)->message().c_str());
- else if (0 != dynamic_cast<const paludis::DepListError *>(&ee))
- rb_raise(c_dep_list_error, dynamic_cast<const paludis::DepListError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ConfigFileError *>(&ee))
rb_raise(c_config_file_error, dynamic_cast<const paludis::ConfigFileError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ConfigurationError *>(&ee))
@@ -282,17 +256,6 @@ paludis::ruby::paludis_module()
return c_paludis_module;
}
-static VALUE
-has_query_property_error_init(int argc, VALUE* argv, VALUE self)
-{
- VALUE query;
-
- query = (argc > 1) ? argv[--argc] : Qnil;
- rb_call_super(argc, argv);
- rb_iv_set(self, "query", query);
- return self;
-}
-
/*
* call-seq:
* query -> String or Nil
@@ -358,41 +321,6 @@ void PALUDIS_VISIBLE paludis::ruby::init()
c_no_such_repository_error = rb_define_class_under(c_paludis_module, "NoSuchRepositoryError", c_package_database_lookup_error);
c_configuration_error = rb_define_class_under(c_paludis_module, "ConfigurationError", rb_eRuntimeError);
c_config_file_error = rb_define_class_under(c_paludis_module, "ConfigFileError", c_configuration_error);
- c_dep_list_error = rb_define_class_under(c_paludis_module, "DepListError", rb_eRuntimeError);
-
- /*
- * Document-class: Paludis::AllMaskedError
- *
- * Thrown if all versions of a particular spec are masked.
- */
- c_all_masked_error = rb_define_class_under(c_paludis_module, "AllMaskedError", c_dep_list_error);
- rb_define_method(c_all_masked_error, "initialize", RUBY_FUNC_CAST(&has_query_property_error_init), -1);
- rb_define_method(c_all_masked_error, "query", RUBY_FUNC_CAST(&has_query_property_error_query), 0);
-
- /*
- * Document-class: Paludis::BlockError
- *
- * Thrown if a block is encountered.
- */
- c_block_error = rb_define_class_under(c_paludis_module, "BlockError", c_dep_list_error);
-
- /*
- * Document-class: Paludis::CircularDependencyError
- *
- * Thrown if a circular dependency is encountered.
- */
- c_circular_dependency_error = rb_define_class_under(c_paludis_module, "CircularDependencyError", c_dep_list_error);
-
- /*
- * Document-class: Paludis::UseRequirementsNotMetError
- *
- * Thrown if all versions of a particular spec are masked, but would not be if use requirements were not in effect.
- */
- c_additional_requirements_not_met_error = rb_define_class_under(c_paludis_module, "UseRequirementsNotMetError", c_dep_list_error);
- rb_define_method(c_additional_requirements_not_met_error, "initialize", RUBY_FUNC_CAST(&has_query_property_error_init), -1);
- rb_define_method(c_additional_requirements_not_met_error, "query", RUBY_FUNC_CAST(&has_query_property_error_query), 0);
- c_downgrade_not_allowed_error = rb_define_class_under(c_paludis_module, "DowngradeNotAllowedError", c_dep_list_error);
- c_no_destination_error = rb_define_class_under(c_paludis_module, "NoDestinationError", c_dep_list_error);
/*
* Document-class: Paludis::ActionFailedError
diff --git a/src/output/Makefile.am b/src/output/Makefile.am
index dfecb07..5cf1b06 100644
--- a/src/output/Makefile.am
+++ b/src/output/Makefile.am
@@ -6,11 +6,7 @@ AUTOMAKE_OPTIONS = 1.11 parallel-tests
noinst_LIBRARIES = liboutput.a
liboutput_a_SOURCES = \
colour.cc colour.hh \
- colour_pretty_printer.cc colour_pretty_printer.hh \
- console_task.cc console_task.hh \
- console_install_task.cc console_install_task.hh \
- console_query_task.cc console_query_task.hh \
- mask_displayer.cc mask_displayer.hh
+ colour_pretty_printer.cc colour_pretty_printer.hh
AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
deleted file mode 100644
index d64030f..0000000
--- a/src/output/console_install_task.cc
+++ /dev/null
@@ -1,1998 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 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 "console_install_task.hh"
-#include "colour.hh"
-#include "colour_pretty_printer.hh"
-#include "mask_displayer.hh"
-
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/join.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/mutex.hh>
-#include <paludis/util/pretty_print.hh>
-#include <paludis/util/safe_ofstream.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/strip.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/action.hh>
-#include <paludis/repository.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/mask.hh>
-#include <paludis/hook.hh>
-#include <paludis/fuzzy_finder.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/choice.hh>
-#include <paludis/output_manager_from_environment.hh>
-#include <paludis/output_manager.hh>
-#include <paludis/legacy/dep_list.hh>
-#include <paludis/notifier_callback.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
-
-#include <functional>
-#include <algorithm>
-#include <set>
-#include <list>
-#include <iostream>
-#include <iomanip>
-#include <limits>
-#include <cstring>
-#include <cstdlib>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <map>
-
-using namespace paludis;
-using std::cout;
-using std::cerr;
-using std::endl;
-
-namespace
-{
- std::list<ConsoleInstallTask *> tasks;
- Mutex tasks_mutex;
-
- void signal_handler(int sig) PALUDIS_ATTRIBUTE((noreturn));
-
- void signal_handler(int sig)
- {
- cout << endl;
- cerr << "Caught signal " << sig << endl;
- cerr << "Waiting for children..." << endl;
- while (-1 != wait(0))
- ;
- cerr << endl;
- {
- Lock l(tasks_mutex);
- if (! tasks.empty())
- (*tasks.begin())->show_resume_command();
- }
- cerr << endl;
- cerr << "Exiting with failure" << endl;
- _exit(EXIT_FAILURE);
- }
-}
-
-ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
- const DepListOptions & options,
- const std::shared_ptr<const DestinationsSet> & d) :
- InstallTask(env, options, d),
- _download_size(0),
- _download_size_overflow(false),
- _all_tags(std::make_shared<Set<DepTagEntry, DepTagEntryComparator>>()),
- _already_downloaded(std::make_shared<Set<FSPath, FSPathComparator>>()),
- _resolution_finished(false)
-{
- std::fill_n(_counts, static_cast<int>(last_count), 0);
-}
-
-void
-ConsoleInstallTask::execute()
-{
- struct sigaction act, oldint, oldterm;
- act.sa_handler = &signal_handler;
- act.sa_flags = 0;
- ::sigemptyset(&act.sa_mask);
- ::sigaddset(&act.sa_mask, SIGINT);
- ::sigaddset(&act.sa_mask, SIGTERM);
-
- {
- Lock l(tasks_mutex);
- tasks.push_front(this);
- ::sigaction(SIGINT, &act, &oldint);
- ::sigaction(SIGTERM, &act, &oldterm);
- }
-
- InstallTask::execute();
-
- {
- Lock l(tasks_mutex);
- ::sigaction(SIGINT, &oldint, 0);
- ::sigaction(SIGTERM, &oldterm, 0);
- tasks.remove(this);
- }
-}
-
-int
-ConsoleInstallTask::exit_status() const
-{
- int return_code(0);
- if (dep_list().has_errors())
- return_code |= 1;
- if (had_resolution_failures())
- return_code |= 3;
- if (had_action_failures())
- return_code |= 7;
- return return_code;
-}
-
-bool
-ConsoleInstallTask::try_to_set_targets_from_user_specs(const std::shared_ptr<const Sequence<std::string> > & s)
-{
- bool is_ok(true);
- try
- {
- InstallTask::set_targets_from_user_specs(s);
- }
- catch (const NoSuchPackageError & e)
- {
- output_stream() << endl;
- output_stream() << "Query error:" << endl;
- output_stream() << " * " << e.backtrace("\n * ");
- output_stream() << "Could not find '" << e.name() << "'.";
-
- if (want_suggestions())
- {
- output_stream() << " Looking for suggestions:" << endl;
-
- FuzzyCandidatesFinder f(*environment(), e.name(), filter::SupportsAction<InstallAction>());
-
- if (f.begin() == f.end())
- output_stream() << "No suggestions found." << endl;
- else
- output_stream() << "Suggestions:" << endl;
-
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
- output_stream() << " * " << colour(cl_package_name, *c) << endl;
- }
-
- output_stream() << endl;
- is_ok = false;;
- }
-
- return is_ok;
-}
-
-struct ConsoleInstallTask::CallbackDisplayer
-{
- Mutex mutex;
-
- std::ostream & stream;
- unsigned width;
- std::map<std::string, int> metadata, steps;
-
- CallbackDisplayer(std::ostream & s) :
- stream(s),
- width(0)
- {
- }
-
- void operator() (const NotifierCallbackEvent & event)
- {
- event.accept(*this);
- }
-
- void visit(const NotifierCallbackGeneratingMetadataEvent & e)
- {
- Lock lock(mutex);
- ++metadata.insert(std::make_pair(stringify(e.repository()), 0)).first->second;
- update();
- }
-
- void visit(const NotifierCallbackResolverStepEvent &)
- {
- Lock lock(mutex);
- ++steps.insert(std::make_pair("steps", 0)).first->second;
- update();
- }
-
- void visit(const NotifierCallbackResolverStageEvent &)
- {
- }
-
- void visit(const NotifierCallbackLinkageStepEvent &)
- {
- }
-
- void update()
- {
- std::string s;
- if (! steps.empty())
- {
- for (std::map<std::string, int>::const_iterator i(steps.begin()), i_end(steps.end()) ;
- i != i_end ; ++i)
- {
- if (! s.empty())
- s.append(", ");
-
- s.append(stringify(i->second) + " " + i->first);
- }
- }
-
- if (! metadata.empty())
- {
- std::multimap<int, std::string> biggest;
- for (std::map<std::string, int>::const_iterator i(metadata.begin()), i_end(metadata.end()) ;
- i != i_end ; ++i)
- biggest.insert(std::make_pair(i->second, i->first));
-
- int t(0), n(0);
- std::string ss;
- for (std::multimap<int, std::string>::const_reverse_iterator i(biggest.rbegin()), i_end(biggest.rend()) ;
- i != i_end ; ++i)
- {
- ++n;
-
- if (n == 4)
- ss.append(", ...");
-
- if (n < 4)
- {
- if (! ss.empty())
- ss.append(", ");
-
- ss.append(stringify(i->first) + " " + i->second);
- }
-
- t += i->first;
- }
-
- if (! s.empty())
- s.append(", ");
- s.append(stringify(t) + " metadata (" + ss + ")");
- }
-
- stream << std::string(width, '\010') << " " << s;
-
- if (width > s.length())
- stream
- << std::string(width - s.length(), ' ')
- << std::string(width - s.length(), '\010');
-
- width = s.length() + 1;
- stream << std::flush;
- }
-};
-
-void
-ConsoleInstallTask::on_build_deplist_pre()
-{
- output_activity_start_message("Building dependency list: ");
- output_xterm_title("Building dependency list");
-
- _callback_displayer = std::make_shared<CallbackDisplayer>(output_stream());
- _notifier_callback = std::make_shared<NotifierCallbackID>(environment()->add_notifier_callback(
- std::bind(std::mem_fn(&ConsoleInstallTask::_notifier_callback_fn),
- this, std::placeholders::_1)));
-}
-
-void
-ConsoleInstallTask::_notifier_callback_fn(const NotifierCallbackEvent & e)
-{
- e.accept(*_callback_displayer);
-}
-
-void
-ConsoleInstallTask::on_build_deplist_post()
-{
- output_activity_end_message();
- _resolution_finished = true;
-
- environment()->remove_notifier_callback(*_notifier_callback);
- _notifier_callback.reset();
-}
-
-void
-ConsoleInstallTask::on_clean_pre(const DepListEntry &,
- const PackageID & c, const int x, const int y, const int s, const int f)
-{
- std::string m("(" + make_x_of_y(x, y, s, f) + ") Cleaning " + stringify(c));
- output_heading(m);
- output_xterm_title(m);
-}
-
-void
-ConsoleInstallTask::on_clean_post(const DepListEntry &,
- const PackageID &, const int, const int, const int, const int)
-{
-}
-
-void
-ConsoleInstallTask::on_clean_fail(const DepListEntry &,
- const PackageID & c, const int x, const int y, const int s, const int f)
-{
- output_xterm_title("(" + make_x_of_y(x, y, s, f) + ") Failed cleaning " + stringify(c));
-}
-
-void
-ConsoleInstallTask::on_display_merge_list_pre()
-{
- output_heading("These packages will be installed:");
-}
-
-void
-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_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::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-&