aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-08 00:03:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-08 00:03:22 +0000
commita557d5150c6f534bae80c9f334d557af970a4a7f (patch)
treec9fb7797a17a154fd7a4d7d7dca4fec26d6e7b14
parent71c093b9ede2b957659355a9eb62fc89544defa8 (diff)
downloadpaludis-a557d5150c6f534bae80c9f334d557af970a4a7f.tar.gz
paludis-a557d5150c6f534bae80c9f334d557af970a4a7f.tar.xz
Split dep list up a bit. Add in suggested deps vmd entry.
-rw-r--r--paludis/dep_list/Makefile.am14
-rw-r--r--paludis/dep_list/dep_list.cc289
-rw-r--r--paludis/dep_list/dep_list.hh309
-rw-r--r--paludis/dep_list/dep_list_TEST.cc1
-rw-r--r--paludis/dep_list/exceptions.cc51
-rw-r--r--paludis/dep_list/exceptions.hh151
-rw-r--r--paludis/dep_list/options.cc282
-rw-r--r--paludis/dep_list/options.hh217
-rw-r--r--paludis/repositories/portage/portage_repository.cc2
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc2
-rw-r--r--paludis/version_metadata.sr6
-rw-r--r--ruby/paludis_ruby.cc1
-rw-r--r--src/clients/adjutrix/display_default_system_resolution.cc1
-rw-r--r--src/clients/contrarius/install.cc1
-rw-r--r--src/clients/paludis/install.cc1
15 files changed, 727 insertions, 601 deletions
diff --git a/paludis/dep_list/Makefile.am b/paludis/dep_list/Makefile.am
index bc7da3b..79dd065 100644
--- a/paludis/dep_list/Makefile.am
+++ b/paludis/dep_list/Makefile.am
@@ -10,7 +10,18 @@ DEFS= \
-DDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\"
+paludis_dep_list_includedir = $(includedir)/paludis/dep_list
+paludis_dep_list_include_HEADERS = \
+ dep_list.hh \
+ uninstall_list.hh \
+ exceptions.hh \
+ options.hh \
+ dep_list-sr.hh \
+ uninstall_list-sr.hh
+
libpaludisdeplist_la_SOURCES = \
+ options.cc options.hh \
+ exceptions.cc exceptions.hh \
dep_list.cc dep_list.hh \
uninstall_list.cc uninstall_list.hh
@@ -34,9 +45,6 @@ lib_LTLIBRARIES = libpaludisdeplist.la
endif
-paludis_dep_list_includedir = $(includedir)/paludis/dep_list
-paludis_dep_list_include_HEADERS = dep_list.hh uninstall_list.hh dep_list-sr.hh uninstall_list-sr.hh
-
EXTRA_DIST = \
dep_list_TEST.cc \
uninstall_list_TEST.cc \
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index aabd39a..80c3f9b 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -20,6 +20,7 @@
#include <paludis/dep_atom.hh>
#include <paludis/dep_atom_flattener.hh>
#include <paludis/dep_list/dep_list.hh>
+#include <paludis/dep_list/exceptions.hh>
#include <paludis/match_package.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/util/collection_concrete.hh>
@@ -39,33 +40,6 @@ using namespace paludis;
#include <paludis/dep_list/dep_list-sr.cc>
-DepListError::DepListError(const std::string & m) throw () :
- Exception(m)
-{
-}
-
-AllMaskedError::AllMaskedError(const std::string & q) throw () :
- DepListError("Error searching for '" + q + "': no available versions"),
- _query(q)
-{
-}
-
-UseRequirementsNotMetError::UseRequirementsNotMetError(const std::string & q) throw () :
- DepListError("Error searching for '" + q + "': use requirements are not met"),
- _query(q)
-{
-}
-
-BlockError::BlockError(const std::string & msg) throw () :
- DepListError("Block: " + msg)
-{
-}
-
-CircularDependencyError::CircularDependencyError(const std::string & msg) throw () :
- DepListError("Circular dependency: " + msg)
-{
-}
-
DepListOptions::DepListOptions() :
reinstall(dl_reinstall_never),
reinstall_scm(dl_reinstall_scm_never),
@@ -233,11 +207,6 @@ namespace
{
}
- bool operator() (const DepListEntry & e)
- {
- return match_package(env, a, e.package);
- }
-
bool operator() (const std::pair<const QualifiedPackageName, MergeList::const_iterator> & e)
{
return match_package(env, a, e.second->package);
@@ -1118,260 +1087,4 @@ DepList::is_top_level_target(const PackageDatabaseEntry & e) const
return t(e);
}
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListTargetType & s)
-{
- do
- {
- switch (s)
- {
- case dl_target_package:
- o << "target_package";
- continue;
-
- case dl_target_set:
- o << "target_set";
- continue;
-
- case last_dl_target:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListTargetType");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListReinstallOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_reinstall_never:
- o << "reinstall_never";
- continue;
-
- case dl_reinstall_always:
- o << "reinstall_always";
- continue;
-
- case dl_reinstall_if_use_changed:
- o << "reinstall_if_use_changed";
- continue;
-
- case last_dl_reinstall:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListReinstallOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListFallBackOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_fall_back_as_needed_except_targets:
- o << "fall_back_as_needed_except_targets";
- continue;
-
- case dl_fall_back_as_needed:
- o << "fall_back_as_needed";
- continue;
-
- case dl_fall_back_never:
- o << "fall_back_never";
- continue;
-
- case last_dl_fall_back:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListFallBackOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListReinstallScmOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_reinstall_scm_never:
- o << "reinstall_scm_never";
- continue;
-
- case dl_reinstall_scm_always:
- o << "reinstall_scm_always";
- continue;
-
- case dl_reinstall_scm_daily:
- o << "reinstall_scm_daily";
- continue;
-
- case dl_reinstall_scm_weekly:
- o << "reinstall_scm_weekly";
- continue;
-
- case last_dl_reinstall_scm:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListReinstallScmOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListUpgradeOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_upgrade_always:
- o << "upgrade_always";
- continue;
-
- case dl_upgrade_as_needed:
- o << "upgrade_as_needed";
- continue;
-
- case last_dl_upgrade:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListUpgradeOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListNewSlotsOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_new_slots_always:
- o << "new_slots_always";
- continue;
-
- case dl_new_slots_as_needed:
- o << "new_slots_as_needed";
- continue;
-
- case last_dl_new_slots:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListNewSlotsOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListDepsOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_deps_discard:
- o << "deps_discard";
- continue;
-
- case dl_deps_pre:
- o << "deps_pre";
- continue;
-
- case dl_deps_pre_or_post:
- o << "deps_pre_or_post";
- continue;
-
- case dl_deps_post:
- o << "deps_post";
- continue;
-
- case dl_deps_try_post:
- o << "deps_try_post";
- continue;
-
- case last_dl_deps:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListDepsOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListCircularOption & s)
-{
- do
- {
- switch (s)
- {
- case dl_circular_error:
- o << "circular_error";
- continue;
-
- case dl_circular_discard:
- o << "circular_discard";
- continue;
-
- case last_dl_circular:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListCircularOption");
- } while (false);
-
- return o;
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & o, const DepListEntryState & s)
-{
- do
- {
- switch (s)
- {
- case dle_no_deps:
- o << "no_deps";
- continue;
-
- case dle_has_pre_deps:
- o << "has_pre_deps";
- continue;
-
- case dle_has_all_deps:
- o << "has_all_deps";
- continue;
-
- case last_dle:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad DepListEntryState");
- } while (false);
-
- return o;
-}
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index 141b799..51de69c 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -22,6 +22,7 @@
#include <paludis/dep_atom.hh>
#include <paludis/dep_tag.hh>
+#include <paludis/dep_list/options.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -35,246 +36,10 @@
namespace paludis
{
- /**
- * What type of target are we handling at the top level.
- *
- * \ingroup grpdepresolver
- */
- enum DepListTargetType
- {
- dl_target_package, ///< A package, so force reinstalls.
- dl_target_set, ///< A set, so don't force reinstalls.
- last_dl_target
- };
-
- /**
- * When should we reinstall.
- *
- * \ingroup grpdepresolver
- */
- enum DepListReinstallOption
- {
- dl_reinstall_never, ///< Never.
- dl_reinstall_always, ///< Always.
- dl_reinstall_if_use_changed, ///< If a USE flag has changed.
- last_dl_reinstall
- };
-
- /**
- * When can we fall back to installed?
- *
- * \ingroup grpdepresolver
- */
- enum DepListFallBackOption
- {
- dl_fall_back_as_needed_except_targets,
- dl_fall_back_as_needed,
- dl_fall_back_never,
- last_dl_fall_back
- };
-
- /**
- * When should we reinstall scm.
- *
- * \ingroup grpdepresolver
- */
- enum DepListReinstallScmOption
- {
- dl_reinstall_scm_never,
- dl_reinstall_scm_always,
- dl_reinstall_scm_daily,
- dl_reinstall_scm_weekly,
- last_dl_reinstall_scm
- };
-
- /**
- * When should we upgrade.
- *
- * \ingroup grpdepresolver
- */
- enum DepListUpgradeOption
- {
- dl_upgrade_always, ///< Always.
- dl_upgrade_as_needed, ///< Only as needed.
- last_dl_upgrade
- };
-
- /**
- * When should we pull in a new slot.
- *
- * \ingroup grpdepresolver
- */
- enum DepListNewSlotsOption
- {
- dl_new_slots_always,
- dl_new_slots_as_needed,
- last_dl_new_slots
- };
-
- /**
- * How should we handle a dep class.
- *
- * \ingroup grpdepresolver
- */
- enum DepListDepsOption
- {
- dl_deps_discard, ///< Discard it
- dl_deps_pre, ///< As a pre dependency
- dl_deps_pre_or_post, ///< As a pre dependency with fallback to post
- dl_deps_post, ///< As a post dependency
- dl_deps_try_post, ///< As an optional post dependency
- last_dl_deps
- };
-
- /**
- * How we handle circular deps.
- *
- * \ingroup grpdepresolver
- */
- enum DepListCircularOption
- {
- dl_circular_error, ///< As an error
- dl_circular_discard, ///< Discard them
- last_dl_circular
- };
-
- /**
- * State of a DepListEntry.
- *
- * \ingroup grpdepresolver
- */
- enum DepListEntryState
- {
- dle_no_deps, ///< Dependencies have yet to be added
- dle_has_pre_deps, ///< Predependencies have been added
- dle_has_all_deps, ///< All dependencies have been added
- last_dle
- };
#include <paludis/dep_list/dep_list-sr.hh>
/**
- * Thrown if an error occurs whilst building a DepList.
- *
- * \ingroup grpdepresolver
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class DepListError : public Exception
- {
- protected:
- ///\name Basic operations
- ///\{
-
- DepListError(const std::string &) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if all versions of a particular atom are masked.
- *
- * \ingroup grpdepresolver
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class AllMaskedError : public DepListError
- {
- private:
- std::string _query;
-
- public:
- ///\name Basic operations
- ///\{
-
- AllMaskedError(const std::string & query) throw ();
-
- virtual ~AllMaskedError() throw ()
- {
- }
-
- ///\}
-
- /**
- * Our query.
- */
- const std::string & query() const
- {
- return _query;
- }
- };
-
- /**
- * Thrown if all versions of a particular atom are masked,
- * but would not be if use requirements were not in effect.
- *
- * \ingroup grpdepresolver
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class UseRequirementsNotMetError : public DepListError
- {
- private:
- std::string _query;
-
- public:
- ///\name Basic operations
- ///\{
-
- UseRequirementsNotMetError(const std::string & query) throw ();
-
- virtual ~UseRequirementsNotMetError() throw ()
- {
- }
-
- ///\}
-
- /**
- * Our query.
- */
- const std::string & query() const
- {
- return _query;
- }
- };
-
- /**
- * Thrown if a block is encountered.
- *
- * \ingroup grpdepresolver
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class BlockError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- BlockError(const std::string & msg) throw ();
-
- ///\}
- };
-
- /**
- * Thrown if a circular dependency is encountered.
- *
- * \ingroup grpdepresolver
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class CircularDependencyError : public DepListError
- {
- public:
- ///\name Basic operations
- ///\{
-
- CircularDependencyError(const std::string & msg) throw ();
-
- ///\}
- };
-
- /**
* Holds a list of dependencies in merge order.
*
* \ingroup grpdepresolver
@@ -347,78 +112,6 @@ namespace paludis
///\}
};
-
- /**
- * Write a DepListTargetType to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListTargetType &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListReinstallOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListReinstallOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListFallBackOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListFallBackOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListReinstallScmOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListReinstallScmOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListUpgradeOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListUpgradeOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListNewSlotsOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListNewSlotsOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListDepsOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListDepsOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListCircularOption to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListCircularOption &) PALUDIS_VISIBLE;
-
- /**
- * Write a DepListEntryState to a stream.
- *
- * \ingroup grpdepresolver
- */
- std::ostream &
- operator<< (std::ostream &, const DepListEntryState &) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 620d905..75cdf7a 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/dep_list/dep_list.hh>
+#include <paludis/dep_list/exceptions.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
diff --git a/paludis/dep_list/exceptions.cc b/paludis/dep_list/exceptions.cc
new file mode 100644
index 0000000..ce54041
--- /dev/null
+++ b/paludis/dep_list/exceptions.cc
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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 "exceptions.hh"
+
+using namespace paludis;
+
+DepListError::DepListError(const std::string & m) throw () :
+ Exception(m)
+{
+}
+
+AllMaskedError::AllMaskedError(const std::string & q) throw () :
+ DepListError("Error searching for '" + q + "': no available versions"),
+ _query(q)
+{
+}
+
+UseRequirementsNotMetError::UseRequirementsNotMetError(const std::string & q) throw () :
+ DepListError("Error searching for '" + q + "': use requirements are not met"),
+ _query(q)
+{
+}
+
+BlockError::BlockError(const std::string & msg) throw () :
+ DepListError("Block: " + msg)
+{
+}
+
+CircularDependencyError::CircularDependencyError(const std::string & msg) throw () :
+ DepListError("Circular dependency: " + msg)
+{
+}
+
+
diff --git a/paludis/dep_list/exceptions.hh b/paludis/dep_list/exceptions.hh
new file mode 100644
index 0000000..4d27163
--- /dev/null
+++ b/paludis/dep_list/exceptions.hh
@@ -0,0 +1,151 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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>
+
+namespace paludis
+{
+ /**
+ * Thrown if an error occurs whilst building a DepList.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class DepListError : public Exception
+ {
+ protected:
+ ///\name Basic operations
+ ///\{
+
+ DepListError(const std::string &) throw ();
+
+ ///\}
+ };
+
+ /**
+ * Thrown if all versions of a particular atom are masked.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class AllMaskedError : public DepListError
+ {
+ private:
+ std::string _query;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ AllMaskedError(const std::string & query) throw ();
+
+ virtual ~AllMaskedError() throw ()
+ {
+ }
+
+ ///\}
+
+ /**
+ * Our query.
+ */
+ const std::string & query() const
+ {
+ return _query;
+ }
+ };
+
+ /**
+ * Thrown if all versions of a particular atom are masked,
+ * but would not be if use requirements were not in effect.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class UseRequirementsNotMetError : public DepListError
+ {
+ private:
+ std::string _query;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ UseRequirementsNotMetError(const std::string & query) throw ();
+
+ virtual ~UseRequirementsNotMetError() throw ()
+ {
+ }
+
+ ///\}
+
+ /**
+ * Our query.
+ */
+ const std::string & query() const
+ {
+ return _query;
+ }
+ };
+
+ /**
+ * Thrown if a block is encountered.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class BlockError : public DepListError
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ BlockError(const std::string & msg) throw ();
+
+ ///\}
+ };
+
+ /**
+ * Thrown if a circular dependency is encountered.
+ *
+ * \ingroup grpdepresolver
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class CircularDependencyError : public DepListError
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ CircularDependencyError(const std::string & msg) throw ();
+
+ ///\}
+ };
+
+
+}
+
+#endif
diff --git a/paludis/dep_list/options.cc b/paludis/dep_list/options.cc
new file mode 100644
index 0000000..24bcb00
--- /dev/null
+++ b/paludis/dep_list/options.cc
@@ -0,0 +1,282 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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 "options.hh"
+#include <ostream>
+#include <paludis/util/exception.hh>
+
+using namespace paludis;
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListTargetType & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_target_package:
+ o << "target_package";
+ continue;
+
+ case dl_target_set:
+ o << "target_set";
+ continue;
+
+ case last_dl_target:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListTargetType");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListReinstallOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_reinstall_never:
+ o << "reinstall_never";
+ continue;
+
+ case dl_reinstall_always:
+ o << "reinstall_always";
+ continue;
+
+ case dl_reinstall_if_use_changed:
+ o << "reinstall_if_use_changed";
+ continue;
+
+ case last_dl_reinstall:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListReinstallOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListFallBackOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_fall_back_as_needed_except_targets:
+ o << "fall_back_as_needed_except_targets";
+ continue;
+
+ case dl_fall_back_as_needed:
+ o << "fall_back_as_needed";
+ continue;
+
+ case dl_fall_back_never:
+ o << "fall_back_never";
+ continue;
+
+ case last_dl_fall_back:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListFallBackOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListReinstallScmOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_reinstall_scm_never:
+ o << "reinstall_scm_never";
+ continue;
+
+ case dl_reinstall_scm_always:
+ o << "reinstall_scm_always";
+ continue;
+
+ case dl_reinstall_scm_daily:
+ o << "reinstall_scm_daily";
+ continue;
+
+ case dl_reinstall_scm_weekly:
+ o << "reinstall_scm_weekly";
+ continue;
+
+ case last_dl_reinstall_scm:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListReinstallScmOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListUpgradeOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_upgrade_always:
+ o << "upgrade_always";
+ continue;
+
+ case dl_upgrade_as_needed:
+ o << "upgrade_as_needed";
+ continue;
+
+ case last_dl_upgrade:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListUpgradeOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListNewSlotsOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_new_slots_always:
+ o << "new_slots_always";
+ continue;
+
+ case dl_new_slots_as_needed:
+ o << "new_slots_as_needed";
+ continue;
+
+ case last_dl_new_slots:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListNewSlotsOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListDepsOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_deps_discard:
+ o << "deps_discard";
+ continue;
+
+ case dl_deps_pre:
+ o << "deps_pre";
+ continue;
+
+ case dl_deps_pre_or_post:
+ o << "deps_pre_or_post";
+ continue;
+
+ case dl_deps_post:
+ o << "deps_post";
+ continue;
+
+ case dl_deps_try_post:
+ o << "deps_try_post";
+ continue;
+
+ case last_dl_deps:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListDepsOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListCircularOption & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dl_circular_error:
+ o << "circular_error";
+ continue;
+
+ case dl_circular_discard:
+ o << "circular_discard";
+ continue;
+
+ case last_dl_circular:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListCircularOption");
+ } while (false);
+
+ return o;
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & o, const DepListEntryState & s)
+{
+ do
+ {
+ switch (s)
+ {
+ case dle_no_deps:
+ o << "no_deps";
+ continue;
+
+ case dle_has_pre_deps:
+ o << "has_pre_deps";
+ continue;
+
+ case dle_has_all_deps:
+ o << "has_all_deps";
+ continue;
+
+ case last_dle:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad DepListEntryState");
+ } while (false);
+
+ return o;
+}
+
diff --git a/paludis/dep_list/options.hh b/paludis/dep_list/options.hh
new file mode 100644
index 0000000..464caf5
--- /dev/null
+++ b/paludis/dep_list/options.hh
@@ -0,0 +1,217 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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>
+
+namespace paludis
+{
+ /**
+ * What type of target are we handling at the top level.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListTargetType
+ {
+ dl_target_package, ///< A package, so force reinstalls.
+ dl_target_set, ///< A set, so don't force reinstalls.
+ last_dl_target
+ };
+
+ /**
+ * When should we reinstall.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListReinstallOption
+ {
+ dl_reinstall_never, ///< Never.
+ dl_reinstall_always, ///< Always.
+ dl_reinstall_if_use_changed, ///< If a USE flag has changed.
+ last_dl_reinstall
+ };
+
+ /**
+ * When can we fall back to installed?
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListFallBackOption
+ {
+ dl_fall_back_as_needed_except_targets,
+ dl_fall_back_as_needed,
+ dl_fall_back_never,
+ last_dl_fall_back
+ };
+
+ /**
+ * When should we reinstall scm.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListReinstallScmOption
+ {
+ dl_reinstall_scm_never,
+ dl_reinstall_scm_always,
+ dl_reinstall_scm_daily,
+ dl_reinstall_scm_weekly,
+ last_dl_reinstall_scm
+ };
+
+ /**
+ * When should we upgrade.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListUpgradeOption
+ {
+ dl_upgrade_always, ///< Always.
+ dl_upgrade_as_needed, ///< Only as needed.
+ last_dl_upgrade
+ };
+
+ /**
+ * When should we pull in a new slot.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListNewSlotsOption
+ {
+ dl_new_slots_always,
+ dl_new_slots_as_needed,
+ last_dl_new_slots
+ };
+
+ /**
+ * How should we handle a dep class.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListDepsOption
+ {
+ dl_deps_discard, ///< Discard it
+ dl_deps_pre, ///< As a pre dependency
+ dl_deps_pre_or_post, ///< As a pre dependency with fallback to post
+ dl_deps_post, ///< As a post dependency
+ dl_deps_try_post, ///< As an optional post dependency
+ last_dl_deps
+ };
+
+ /**
+ * How we handle circular deps.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListCircularOption
+ {
+ dl_circular_error, ///< As an error
+ dl_circular_discard, ///< Discard them
+ last_dl_circular
+ };
+
+ /**
+ * State of a DepListEntry.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListEntryState
+ {
+ dle_no_deps, ///< Dependencies have yet to be added
+ dle_has_pre_deps, ///< Predependencies have been added
+ dle_has_all_deps, ///< All dependencies have been added
+ last_dle
+ };
+
+ /**
+ * Write a DepListTargetType to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListTargetType &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListReinstallOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListReinstallOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListFallBackOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListFallBackOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListReinstallScmOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListReinstallScmOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListUpgradeOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListUpgradeOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListNewSlotsOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListNewSlotsOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListDepsOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListDepsOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListCircularOption to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListCircularOption &) PALUDIS_VISIBLE;
+
+ /**
+ * Write a DepListEntryState to a stream.
+ *
+ * \ingroup grpdepresolver
+ */
+ std::ostream &
+ operator<< (std::ostream &, const DepListEntryState &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index ea11c7f..42a8efb 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -968,7 +968,7 @@ PortageRepository::virtual_package_version_metadata(const RepositoryVirtualsEntr
result->eapi = m->eapi;
result->deps = VersionMetadataDeps(&PortageDepParser::parse_depend,
"=" + stringify(p.provided_by_atom->package()) + "-" + stringify(v),
- "=" + stringify(p.provided_by_atom->package()) + "-" + stringify(v), "");
+ "=" + stringify(p.provided_by_atom->package()) + "-" + stringify(v), "", "");
return result;
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index ba14d72..3aeb8db 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -1194,7 +1194,7 @@ VDBRepository::provided_package_version_metadata(const RepositoryProvidesEntry &
result->license_string = m->license_string;
result->eapi = m->eapi;
result->deps = VersionMetadataDeps(&PortageDepParser::parse_depend,
- stringify(p.provided_by_name), stringify(p.provided_by_name), "");
+ stringify(p.provided_by_name), stringify(p.provided_by_name), "", "");
return result;
}
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 99285d8..20a13c4 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -7,6 +7,7 @@ make_class_VersionMetadataDeps()
key build_depend_string std::string
key run_depend_string std::string
key post_depend_string std::string
+ key suggested_depend_string std::string
extra_constructors <<END
VersionMetadataDeps(const ParserFunction &);
@@ -27,6 +28,11 @@ END
* Our post depends.
*/
DepAtom::ConstPointer post_depend() const;
+
+ /**
+ * Our suggested depends.
+ */
+ DepAtom::ConstPointer suggested_depend() const;
END
doxygen_comment << "END"
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 3f3082d..97c44a7 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -22,6 +22,7 @@
#include <paludis_ruby.hh>
#include <paludis/config_file.hh>
#include <paludis/dep_list/dep_list.hh>
+#include <paludis/dep_list/exceptions.hh>
#include <ruby.h>
#include <list>
#include <ctype.h>
diff --git a/src/clients/adjutrix/display_default_system_resolution.cc b/src/clients/adjutrix/display_default_system_resolution.cc
index a5d4a29..12d62bf 100644
--- a/src/clients/adjutrix/display_default_system_resolution.cc
+++ b/src/clients/adjutrix/display_default_system_resolution.cc
@@ -28,6 +28,7 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/strip.hh>
#include <paludis/dep_list/dep_list.hh>
+#include <paludis/dep_list/exceptions.hh>
#include <iostream>
#include <iomanip>
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 5618a21..5fb63c0 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -35,6 +35,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/environment/default/default_environment.hh>
+#include <paludis/dep_list/exceptions.hh>
/** \file
* Handle the --install action for the contrarius program.
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 42bdb04..7167fd1 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -43,6 +43,7 @@
#include <paludis/util/system.hh>
#include <paludis/environment/default/default_environment.hh>
#include <paludis/environment/default/default_config.hh>
+#include <paludis/dep_list/exceptions.hh>
/** \file
* Handle the --install action for the main paludis program.