diff options
author | 2010-12-29 00:59:37 +0000 | |
---|---|---|
committer | 2011-01-01 03:57:52 +0000 | |
commit | d3dcce377a01c5b3ae0414e9e4dd67eaddc4ef0e (patch) | |
tree | 7d81deba8b41b103f927572df149c98941ed515c | |
parent | eba9fcb1d71dd48458d09c1328ba11ea06fbb40b (diff) | |
download | paludis-d3dcce377a01c5b3ae0414e9e4dd67eaddc4ef0e.tar.gz paludis-d3dcce377a01c5b3ae0414e9e4dd67eaddc4ef0e.tar.xz |
Tinker with labels
21 files changed, 387 insertions, 198 deletions
diff --git a/paludis/always_enabled_dependency_label-fwd.hh b/paludis/always_enabled_dependency_label-fwd.hh new file mode 100644 index 000000000..3c3f2afca --- /dev/null +++ b/paludis/always_enabled_dependency_label-fwd.hh @@ -0,0 +1,29 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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_ALWAYS_ENABLED_DEPENDENCY_LABEL_FWD_HH +#define PALUDIS_GUARD_PALUDIS_ALWAYS_ENABLED_DEPENDENCY_LABEL_FWD_HH 1 + +namespace paludis +{ + template <typename Label_> + struct AlwaysEnabledDependencyLabel; +} + +#endif diff --git a/paludis/always_enabled_dependency_label.cc b/paludis/always_enabled_dependency_label.cc new file mode 100644 index 000000000..9bfd7dddc --- /dev/null +++ b/paludis/always_enabled_dependency_label.cc @@ -0,0 +1,58 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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/always_enabled_dependency_label.hh> + +using namespace paludis; + +template <typename Label_> +AlwaysEnabledDependencyLabel<Label_>::AlwaysEnabledDependencyLabel(const std::string & t) : + _text(t) +{ +} + +template <typename Label_> +AlwaysEnabledDependencyLabel<Label_>::~AlwaysEnabledDependencyLabel() +{ +} + +template <typename Label_> +const std::string +AlwaysEnabledDependencyLabel<Label_>::text() const +{ + return _text; +} + +template <typename Label_> +bool +AlwaysEnabledDependencyLabel<Label_>::enabled() const +{ + return true; +} + +template class AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesRunLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesPostLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesCompileAgainstLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesFetchLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesInstallLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesRecommendationLabelTag>; +template class AlwaysEnabledDependencyLabel<DependenciesTestLabelTag>; + diff --git a/paludis/always_enabled_dependency_label.hh b/paludis/always_enabled_dependency_label.hh new file mode 100644 index 000000000..de260bcd5 --- /dev/null +++ b/paludis/always_enabled_dependency_label.hh @@ -0,0 +1,55 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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_ALWAYS_ENABLED_DEPENDENCY_LABEL_HH +#define PALUDIS_GUARD_PALUDIS_ALWAYS_ENABLED_DEPENDENCY_LABEL_HH 1 + +#include <paludis/always_enabled_dependency_label-fwd.hh> +#include <paludis/util/attributes.hh> +#include <paludis/dep_label.hh> + +namespace paludis +{ + template <typename Label_> + class PALUDIS_VISIBLE AlwaysEnabledDependencyLabel : + public SpecificDependenciesLabel<Label_> + { + private: + const std::string _text; + + public: + AlwaysEnabledDependencyLabel(const std::string &); + ~AlwaysEnabledDependencyLabel(); + + virtual const std::string text() const; + virtual bool enabled() const; + }; + + extern template class AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesRunLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesPostLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesCompileAgainstLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesFetchLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesInstallLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesRecommendationLabelTag>; + extern template class AlwaysEnabledDependencyLabel<DependenciesTestLabelTag>; +} + +#endif diff --git a/paludis/dep_label.cc b/paludis/dep_label.cc index 3b01a49fa..9e8edc588 100644 --- a/paludis/dep_label.cc +++ b/paludis/dep_label.cc @@ -71,33 +71,6 @@ DependenciesLabel::~DependenciesLabel() { } -template <typename T_> -SpecificDependenciesLabel<T_>::SpecificDependenciesLabel(const std::string & t, - const std::function<bool ()> & e) : - _text(t), - _enabled(e) -{ -} - -template <typename T_> -SpecificDependenciesLabel<T_>::~SpecificDependenciesLabel() -{ -} - -template <typename T_> -const std::string -SpecificDependenciesLabel<T_>::text() const -{ - return _text; -} - -template <typename T_> -bool -SpecificDependenciesLabel<T_>::enabled() const -{ - return _enabled(); -} - template class SpecificURILabel<URIMirrorsThenListedLabelTag>; template class SpecificURILabel<URIMirrorsOnlyLabelTag>; template class SpecificURILabel<URIListedOnlyLabelTag>; diff --git a/paludis/dep_label.hh b/paludis/dep_label.hh index 0e30acc8e..dc5925a3d 100644 --- a/paludis/dep_label.hh +++ b/paludis/dep_label.hh @@ -28,7 +28,6 @@ #include <paludis/util/type_list.hh> #include <paludis/util/sequence.hh> #include <paludis/util/wrapped_forward_iterator.hh> -#include <functional> /** \file * Declarations for dependency label-related classes. @@ -144,22 +143,7 @@ namespace paludis public DependenciesLabel, public ImplementAcceptMethods<DependenciesLabel, SpecificDependenciesLabel<T_> > { - private: - const std::string _text; - const std::function<bool ()> _enabled; - public: - ///\name Basic operations - ///\{ - - SpecificDependenciesLabel(const std::string &, const std::function<bool ()> &); - ~SpecificDependenciesLabel(); - - ///\} - - virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)); - virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result)); - /// Convenience typedef alias to obtain our tag. typedef T_ Tag; }; diff --git a/paludis/files.m4 b/paludis/files.m4 index e2c857dba..0ab91b0f1 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -13,6 +13,7 @@ add(`about_metadata', `hh', `cc', `fwd') add(`action', `hh', `cc', `fwd', `se') add(`action_names', `hh', `cc', `fwd') add(`additional_package_dep_spec_requirement', `hh', `cc', `fwd') +add(`always_enabled_dependency_label', `hh', `cc', `fwd') add(`broken_linkage_configuration', `hh', `cc', `test', `testscript') add(`broken_linkage_finder', `hh', `cc') add(`buffer_output_manager', `hh', `cc', `fwd') diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc index a5f11d945..d208bee2b 100644 --- a/paludis/repositories/accounts/accounts_dep_key.cc +++ b/paludis/repositories/accounts/accounts_dep_key.cc @@ -21,6 +21,7 @@ #include <paludis/util/set-impl.hh> #include <paludis/util/wrapped_forward_iterator.hh> #include <paludis/util/return_literal_function.hh> +#include <paludis/util/singleton-impl.hh> #include <paludis/selection.hh> #include <paludis/generator.hh> #include <paludis/filtered_generator.hh> @@ -30,12 +31,29 @@ #include <paludis/environment.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/partially_made_package_dep_spec.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <sstream> #include <list> using namespace paludis; using namespace paludis::accounts_repository; +namespace +{ + struct AccountsDepKeyData : + Singleton<AccountsDepKeyData> + { + const std::shared_ptr<DependenciesLabelSequence> initial_labels; + + AccountsDepKeyData() : + initial_labels(std::make_shared<DependenciesLabelSequence>()) + { + initial_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build")); + initial_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run")); + } + }; +} + namespace paludis { template <> @@ -44,13 +62,11 @@ namespace paludis const Environment * const env; const std::shared_ptr<std::list<std::shared_ptr<PackageDepSpec> > > specs; const std::shared_ptr<DependencySpecTree> tree; - const std::shared_ptr<DependenciesLabelSequence> initial_labels; Imp(const Environment * const e, const std::shared_ptr<const Set<std::string> > & s) : env(e), specs(std::make_shared<std::list<std::shared_ptr<PackageDepSpec> >>()), - tree(std::make_shared<DependencySpecTree>(std::make_shared<AllDepSpec>())), - initial_labels(std::make_shared<DependenciesLabelSequence>()) + tree(std::make_shared<DependencySpecTree>(std::make_shared<AllDepSpec>())) { for (Set<std::string>::ConstIterator i(s->begin()), i_end(s->end()) ; i != i_end ; ++i) @@ -60,9 +76,6 @@ namespace paludis specs->push_back(spec); tree->top()->append(spec); } - - initial_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true))); - initial_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true))); } }; } @@ -104,7 +117,7 @@ AccountsDepKey::value() const const std::shared_ptr<const DependenciesLabelSequence> AccountsDepKey::initial_labels() const { - return _imp->initial_labels; + return AccountsDepKeyData::get_instance()->initial_labels; } std::string diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc index 9ad431365..e9e42f232 100644 --- a/paludis/repositories/cran/cran_package_id.cc +++ b/paludis/repositories/cran/cran_package_id.cc @@ -44,6 +44,8 @@ #include <paludis/environment.hh> #include <paludis/package_database.hh> #include <paludis/util/tokeniser.hh> +#include <paludis/util/singleton-impl.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <string> #include <algorithm> #include <list> @@ -52,6 +54,24 @@ using namespace paludis; using namespace paludis::cranrepository; +namespace +{ + struct CRANPackageIDData : + Singleton<CRANPackageIDData> + { + std::shared_ptr<DependenciesLabelSequence> suggests_labels; + std::shared_ptr<DependenciesLabelSequence> depends_labels; + + CRANPackageIDData() : + suggests_labels(std::make_shared<DependenciesLabelSequence>()), + depends_labels(std::make_shared<DependenciesLabelSequence>()) + { + suggests_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag> >("Suggests")); + depends_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("Depends")); + } + }; +} + namespace paludis { template <> @@ -73,19 +93,12 @@ namespace paludis std::shared_ptr<DepKey> depends_key; std::shared_ptr<DepKey> suggests_key; - std::shared_ptr<DependenciesLabelSequence> suggests_labels; - std::shared_ptr<DependenciesLabelSequence> depends_labels; - Imp(const Environment * const e, const RepositoryName & r, const FSPath & f) : env(e), repository_name(r), name("cran/" + cran_name_to_internal(strip_trailing_string(f.basename(), ".DESCRIPTION"))), - version("0", { }), - suggests_labels(std::make_shared<DependenciesLabelSequence>()), - depends_labels(std::make_shared<DependenciesLabelSequence>()) + version("0", { }) { - suggests_labels->push_back(std::make_shared<DependenciesSuggestionLabel>("Suggests", return_literal_function(true))); - depends_labels->push_back(std::make_shared<DependenciesBuildLabel>("Depends", return_literal_function(true))); } Imp(const Environment * const e, const RepositoryName & c, const CRANPackageID * const r, const std::string & t) : @@ -93,12 +106,8 @@ namespace paludis repository_name(c), name("cran/" + cran_name_to_internal(t)), version(r->version()), - contained_in_key(std::make_shared<PackageIDKey>(e, "Contained", "Contained in", r, mkt_normal)), - suggests_labels(std::make_shared<DependenciesLabelSequence>()), - depends_labels(std::make_shared<DependenciesLabelSequence>()) + contained_in_key(std::make_shared<PackageIDKey>(e, "Contained", "Contained in", r, mkt_normal)) { - suggests_labels->push_back(std::make_shared<DependenciesSuggestionLabel>("Suggests", return_literal_function(true))); - depends_labels->push_back(std::make_shared<DependenciesBuildLabel>("Depends", return_literal_function(true))); } }; } @@ -238,7 +247,7 @@ CRANPackageID::CRANPackageID(const Environment * const env, const RepositoryName { Context local_context("When handling Suggests: key:"); _imp->suggests_key = std::make_shared<DepKey>(_imp->env, "Suggests", "Suggests", file.get("Suggests"), - _imp->suggests_labels, mkt_dependencies); + CRANPackageIDData::get_instance()->suggests_labels, mkt_dependencies); add_metadata_key(_imp->suggests_key); } @@ -253,10 +262,11 @@ CRANPackageID::CRANPackageID(const Environment * const env, const RepositoryName { Context local_context("When handling Depends: key:"); _imp->depends_key = std::make_shared<DepKey>(_imp->env, "Depends", "Depends", file.get("Depends") + ", R", - _imp->depends_labels, mkt_dependencies); + CRANPackageIDData::get_instance()->depends_labels, mkt_dependencies); } else - _imp->depends_key = std::make_shared<DepKey>(_imp->env, "Depends", "Depends", "R", _imp->depends_labels, mkt_dependencies); + _imp->depends_key = std::make_shared<DepKey>(_imp->env, "Depends", "Depends", "R", + CRANPackageIDData::get_instance()->depends_labels, mkt_dependencies); add_metadata_key(_imp->depends_key); } catch (const InternalError &) diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc index c518c137d..943875086 100644 --- a/paludis/repositories/e/dep_parser.cc +++ b/paludis/repositories/e/dep_parser.cc @@ -43,6 +43,7 @@ #include <paludis/dep_spec_annotations.hh> #include <paludis/metadata_key.hh> #include <paludis/package_database.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <map> #include <list> #include <set> @@ -923,21 +924,23 @@ namespace std::shared_ptr<DependenciesLabel> make(const std::string & class_name, const std::string & text) { if (class_name == "DependenciesBuildLabel") - return std::make_shared<DependenciesBuildLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >(text); else if (class_name == "DependenciesRunLabel") - return std::make_shared<DependenciesRunLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >(text); else if (class_name == "DependenciesPostLabel") - return std::make_shared<DependenciesPostLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >(text); else if (class_name == "DependenciesInstallLabel") - return std::make_shared<DependenciesInstallLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesInstallLabelTag> >(text); else if (class_name == "DependenciesCompileAgainstLabel") - return std::make_shared<DependenciesCompileAgainstLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesCompileAgainstLabelTag> >(text); else if (class_name == "DependenciesFetchLabel") - return std::make_shared<DependenciesFetchLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesFetchLabelTag> >(text); else if (class_name == "DependenciesSuggestionLabel") - return std::make_shared<DependenciesSuggestionLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag> >(text); else if (class_name == "DependenciesRecommendationLabel") - return std::make_shared<DependenciesRecommendationLabel>(text, return_literal_function(true)); + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRecommendationLabelTag> >(text); + else if (class_name == "DependenciesTestLabel") + return std::make_shared<AlwaysEnabledDependencyLabel<DependenciesTestLabelTag> >(text); else throw EDepParseError(text, "Label '" + text + "' maps to unknown class '" + class_name + "'"); } @@ -953,6 +956,29 @@ namespace return i->second; } }; + + struct TestLabel : + DependenciesTestLabel + { + std::string label_text; + std::function<bool ()> label_enabled; + + TestLabel(const std::string & s, const std::function<bool ()> & l) : + label_text(s), + label_enabled(l) + { + } + + virtual bool enabled() const + { + return label_enabled(); + } + + virtual const std::string text() const + { + return label_text; + } + }; } std::shared_ptr<DependenciesLabelsDepSpec> @@ -975,14 +1001,6 @@ paludis::erepository::parse_dependency_label( for (std::set<std::string>::iterator it = labels.begin(), it_e = labels.end(); it != it_e; ++it) { - if (std::string::npos != it->find(',')) - { - Log::get_instance()->message("e.dep_parser.obsolete_label_syntax", ll_warning, lc_context) - << "Label '" << *it << "' uses commas, which are obsolete, so treating it as a build label instead"; - l->add_label(std::make_shared<DependenciesBuildLabel>(*it, return_literal_function(true))); - continue; - } - std::string c(e.supported()->dependency_labels()->class_for_label(*it)), cc; if (c.empty()) throw EDepParseError(s, "Unknown label '" + *it + "'"); @@ -997,16 +1015,10 @@ paludis::erepository::parse_dependency_label( if (c == "DependenciesTestLabel") { if (cc.empty()) - l->add_label(std::make_shared<DependenciesTestLabel>(*it, return_literal_function(true))); + l->add_label(DepLabelsStore::get_instance()->get(e.name(), c, *it)); else - l->add_label(std::make_shared<DependenciesTestLabel>(*it, std::bind( - &enabled_if_option, env, id, *it, ChoiceNameWithPrefix(cc)))); - } - else if (c == "WarnAndIgnore") - { - Log::get_instance()->message("e.dep_parser.obsolete_label", ll_warning, lc_context) - << "Label '" << *it << "' no longer exists, pretending it's a build label instead"; - l->add_label(std::make_shared<DependenciesBuildLabel>(*it, return_literal_function(true))); + l->add_label(std::make_shared<TestLabel>(*it, std::bind( + &enabled_if_option, env, id, *it, ChoiceNameWithPrefix(cc)))); } else l->add_label(DepLabelsStore::get_instance()->get(e.name(), c, *it)); diff --git a/paludis/repositories/e/dependencies_rewriter.cc b/paludis/repositories/e/dependencies_rewriter.cc index b0a785731..4264f940a 100644 --- a/paludis/repositories/e/dependencies_rewriter.cc +++ b/paludis/repositories/e/dependencies_rewriter.cc @@ -29,7 +29,9 @@ #include <paludis/util/wrapped_output_iterator.hh> #include <paludis/util/sequence.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/singleton-impl.hh> #include <paludis/dep_spec_annotations.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <list> #include <algorithm> @@ -54,6 +56,19 @@ namespace } return s.str(); } + + struct DependenciesRewriterData : + Singleton<DependenciesRewriterData> + { + std::shared_ptr<DependenciesLabelSequence> default_labels; + + DependenciesRewriterData() : + default_labels(std::make_shared<DependenciesLabelSequence>()) + { + default_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build")); + default_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run")); + } + }; } namespace paludis @@ -65,15 +80,11 @@ namespace paludis std::string rdepend; std::string pdepend; - std::shared_ptr<DependenciesLabelSequence> default_labels; LabelsStack labels; - Imp() : - default_labels(std::make_shared<DependenciesLabelSequence>()) + Imp() { - default_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true))); - default_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true))); - labels.push_front(default_labels); + labels.push_front(DependenciesRewriterData::get_instance()->default_labels); } }; } diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc index ce9b7ced9..32174b25c 100644 --- a/paludis/repositories/e/e_installed_repository_id.cc +++ b/paludis/repositories/e/e_installed_repository_id.cc @@ -51,6 +51,7 @@ #include <paludis/user_dep_spec.hh> #include <paludis/elike_choices.hh> #include <paludis/package_database.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <iterator> @@ -128,12 +129,12 @@ namespace run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), post_dependencies_labels(std::make_shared<DependenciesLabelSequence>()) { - raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true))); - raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true))); + raw_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build")); + raw_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run")); - build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", return_literal_function(true))); - run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", return_literal_function(true))); - post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND", return_literal_function(true))); + build_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("DEPEND")); + run_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("RDEPEND")); + post_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >("PDEPEND")); } }; } diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index e408d384f..bc16bb777 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -322,13 +322,7 @@ dependency_labels = \ recommendation = DependenciesRecommendationLabel ; \ suggestion = DependenciesSuggestionLabel ; \ test = DependenciesTestLabel/build_options:recommended_tests ; \ - test-expensive = DependenciesTestLabel/build_options:expensive_tests ; \ - host = WarnAndIgnore ; \ - target = WarnAndIgnore ; \ - compile-against = WarnAndIgnore ; \ - suggested = WarnAndIgnore ; \ - recommended = WarnAndIgnore ; \ - required = WarnAndIgnore + test-expensive = DependenciesTestLabel/build_options:expensive_tests restrict_mirror = mirror restrict_fetch = fetch diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc index 54a9756f7..00f10cbbe 100644 --- a/paludis/repositories/e/ebuild_id.cc +++ b/paludis/repositories/e/ebuild_id.cc @@ -46,6 +46,7 @@ #include <paludis/elike_choices.hh> #include <paludis/user_dep_spec.hh> #include <paludis/notifier_callback.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <paludis/util/fs_error.hh> #include <paludis/util/stringify.hh> @@ -97,12 +98,12 @@ namespace pbin_behaviours_value->insert("unbinaryable"); pbin_behaviours_value->insert("binary"); - raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true))); - raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true))); + raw_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build")); + raw_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run")); - build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", return_literal_function(true))); - run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", return_literal_function(true))); - post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND", return_literal_function(true))); + build_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("DEPEND")); + run_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("RDEPEND")); + post_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >("PDEPEND")); } }; } diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc index 3dea04138..d77c79557 100644 --- a/paludis/repositories/fake/fake_package_id.cc +++ b/paludis/repositories/fake/fake_package_id.cc @@ -30,6 +30,7 @@ #include <paludis/choice.hh> #include <paludis/user_dep_spec.hh> #include <paludis/package_database.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <paludis/util/stringify.hh> #include <paludis/util/mutex.hh> #include <paludis/util/pimp-impl.hh> @@ -45,6 +46,7 @@ #include <paludis/util/return_literal_function.hh> #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> +#include <paludis/util/singleton-impl.hh> #include <map> #include <list> #include <sstream> @@ -679,6 +681,30 @@ FakeUnsupportedMask::explanation() const return "Marked as unsupported"; } +namespace +{ + struct FakePackageIDData : + Singleton<FakePackageIDData> + { + std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; + std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; + std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels; + std::shared_ptr<DependenciesLabelSequence> suggested_dependencies_labels; + + FakePackageIDData() : + build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), + run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), + post_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), + suggested_dependencies_labels(std::make_shared<DependenciesLabelSequence>()) + { + build_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("DEPEND")); + run_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("RDEPEND")); + post_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >("PDEPEND")); + suggested_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag> >("SDEPEND")); + } + }; +} + namespace paludis { using namespace std::placeholders; @@ -693,11 +719,6 @@ namespace paludis const QualifiedPackageName name; const VersionSpec version; - mutable std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; - mutable std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; - mutable std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels; - mutable std::shared_ptr<DependenciesLabelSequence> suggested_dependencies_labels; - std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot; std::shared_ptr<FakeMetadataKeywordSetKey> keywords; std::shared_ptr<FakeMetadataSpecTreeKey<LicenseSpecTree> > license; @@ -724,22 +745,10 @@ namespace paludis repository_name(r), name(q), version(v), - build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), - run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), - post_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), - suggested_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), slot(std::make_shared<LiteralMetadataValueKey<SlotName>>("SLOT", "Slot", mkt_internal, SlotName("0"))), behaviours_set(std::make_shared<Set<std::string>>()), has_masks(false) { - build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", - return_literal_function(true))); - run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", - return_literal_function(true))); - post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND", - return_literal_function(true))); - suggested_dependencies_labels->push_back(std::make_shared<DependenciesSuggestionLabel>("SDEPEND", - return_literal_function(true))); } }; } @@ -997,22 +1006,22 @@ FakePackageID::need_keys_added() const _imp->build_dependencies = std::make_shared<FakeMetadataSpecTreeKey<DependencySpecTree>>("DEPEND", "Build dependencies", "", std::bind(&parse_depend, _1, _imp->env, shared_from_this()), - _imp->build_dependencies_labels, mkt_dependencies); + FakePackageIDData::get_instance()->build_dependencies_labels, mkt_dependencies); _imp->run_dependencies = std::make_shared<FakeMetadataSpecTreeKey<DependencySpecTree>>("RDEPEND", "Run dependencies", "", std::bind(&parse_depend, _1, _imp->env, shared_from_this()), - _imp->run_dependencies_labels, mkt_dependencies); + FakePackageIDData::get_instance()->run_dependencies_labels, mkt_dependencies); _imp->post_dependencies = std::make_shared<FakeMetadataSpecTreeKey<DependencySpecTree>>("PDEPEND", "Post dependencies", "", std::bind(&parse_depend, _1, _imp->env, shared_from_this()), - _imp->post_dependencies_labels, mkt_dependencies); + FakePackageIDData::get_instance()->post_dependencies_labels, mkt_dependencies); _imp->suggested_dependencies = std::make_shared<FakeMetadataSpecTreeKey<DependencySpecTree>>("SDEPEND", "Suggested dependencies", "", std::bind(&parse_depend, _1, _imp->env, shared_from_this()), - _imp->suggested_dependencies_labels, mkt_dependencies); + FakePackageIDData::get_instance()->suggested_dependencies_labels, mkt_dependencies); _imp->src_uri = std::make_shared<FakeMetadataSpecTreeKey<FetchableURISpecTree>>("SRC_URI", "Source URI", "", std::bind(&parse_fetchable_uri, _1, _imp->env, diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc index 078bb731a..f53b70a19 100644 --- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc +++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc @@ -27,6 +27,7 @@ #include <paludis/util/make_shared_copy.hh> #include <paludis/util/tokeniser.hh> #include <paludis/util/make_named_values.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <paludis/spec_tree.hh> #include <paludis/dep_spec.hh> #include <paludis/partially_made_package_dep_spec.hh> @@ -151,8 +152,8 @@ namespace runtime_dependencies_label(std::make_shared<DependenciesLabelsDepSpec>()), initial_labels(std::make_shared<DependenciesLabelSequence>()) { - development_dependencies_label->add_label(std::make_shared<DependenciesBuildLabel>("development", return_literal_function(true))); - runtime_dependencies_label->add_label(std::make_shared<DependenciesRunLabel>("runtime", return_literal_function(true))); + development_dependencies_label->add_label(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("development")); + runtime_dependencies_label->add_label(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("runtime")); initial_labels->push_back(*development_dependencies_label->begin()); } }; diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc index 297696439..cf563ef17 100644 --- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc +++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc @@ -22,14 +22,31 @@ #include <paludis/util/set.hh> #include <paludis/util/make_named_values.hh> #include <paludis/util/return_literal_function.hh> +#include <paludis/util/singleton-impl.hh> #include <paludis/dep_label.hh> #include <paludis/comma_separated_dep_parser.hh> #include <paludis/comma_separated_dep_printer.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <memory> using namespace paludis; using namespace paludis::unavailable_repository; +namespace +{ + struct UnavailableRepositoryDependenciesKeyData : + Singleton<UnavailableRepositoryDependenciesKeyData> + { + const std::shared_ptr<DependenciesLabelSequence> labels; + + UnavailableRepositoryDependenciesKeyData() : + labels(std::make_shared<DependenciesLabelSequence>()) + { + labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build")); + } + }; +} + namespace paludis { template <> @@ -37,7 +54,6 @@ namespace paludis { const Environment * const env; const std::shared_ptr<const DependencySpecTree> value; - const std::shared_ptr<DependenciesLabelSequence> labels; const std::string raw_name; const std::string human_name; @@ -48,12 +64,10 @@ namespace paludis const std::string & v) : env(e), value(CommaSeparatedDepParser::parse(e, v)), - labels(std::make_shared<DependenciesLabelSequence>()), raw_name(r), human_name(h), type(t) { - labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true))); } }; } @@ -112,6 +126,6 @@ UnavailableRepositoryDependenciesKey::pretty_print_flat(const DependencySpecTree const std::shared_ptr<const DependenciesLabelSequence> UnavailableRepositoryDependenciesKey::initial_labels() const { - return _imp->labels; + return UnavailableRepositoryDependenciesKeyData::get_instance()->labels; } diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc index dbe0c0879..69b236d31 100644 --- a/paludis/repositories/unpackaged/installed_id.cc +++ b/paludis/repositories/unpackaged/installed_id.cc @@ -48,6 +48,7 @@ #include <paludis/comma_separated_dep_parser.hh> #include <paludis/comma_separated_dep_printer.hh> #include <paludis/formatter.hh> +#include <paludis/always_enabled_dependency_label.hh> #include <functional> using namespace paludis; @@ -55,17 +56,25 @@ using namespace paludis::unpackaged_repositories; namespace { - struct InstalledUnpackagedIDBehaviours : - Singleton<InstalledUnpackagedIDBehaviours> + struct InstalledUnpackagedIDData : + Singleton<InstalledUnpackagedIDData> { std::shared_ptr<Set<std::string> > behaviours_value; std::shared_ptr<LiteralMetadataStringSetKey> behaviours_key; - InstalledUnpackagedIDBehaviours() : + std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; + std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; + + InstalledUnpackagedIDData() : behaviours_value(std::make_shared<Set<std::string>>()), - behaviours_key(std::make_shared<LiteralMetadataStringSetKey>("behaviours", "behaviours", mkt_internal, behaviours_value)) + behaviours_key(std::make_shared<LiteralMetadataStringSetKey>("behaviours", "behaviours", mkt_internal, behaviours_value)), + build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), + run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()) { behaviours_value->insert("transient"); + + build_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build_dependencies")); + run_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run_dependencies")); } }; @@ -393,9 +402,6 @@ namespace paludis const FSPath root; const NDBAM * const ndbam; - std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; - std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; - std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key; std::shared_ptr<InstalledUnpackagedFSPathKey> fs_location_key; std::shared_ptr<InstalledUnpackagedContentsKey> contents_key; @@ -422,17 +428,10 @@ namespace paludis repository_name(r), root(ro), ndbam(d), - build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), - run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, s)), fs_location_key(std::make_shared<InstalledUnpackagedFSPathKey>(l)), - behaviours_key(InstalledUnpackagedIDBehaviours::get_instance()->behaviours_key) + behaviours_key(InstalledUnpackagedIDData::get_instance()->behaviours_key) { - build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build_dependencies", - return_literal_function(true))); - run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run_dependencies", - return_literal_function(true))); - if ((l / "contents").stat().exists()) { contents_key = std::make_shared<InstalledUnpackagedContentsKey>(id, d); @@ -452,12 +451,12 @@ namespace paludis if ((l / "build_dependencies").stat().exists()) build_dependencies_key = std::make_shared<InstalledUnpackagedDependencyKey>(env, "build_dependencies", "Build dependencies", l / "build_dependencies", - build_dependencies_labels, mkt_dependencies); + InstalledUnpackagedIDData::get_instance()->build_dependencies_labels, mkt_dependencies); if ((l / "run_dependencies").stat().exists()) run_dependencies_key = std::make_shared<InstalledUnpackagedDependencyKey>(env, "run_dependencies", "Run dependencies", l / "run_dependencies", - run_dependencies_labels, mkt_dependencies); + InstalledUnpackagedIDData::get_instance()->run_dependencies_labels, mkt_dependencies); } }; } diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc index bb346ca02..133b30607 100644 --- a/paludis/repositories/unpackaged/unpackaged_id.cc +++ b/paludis/repositories/unpackaged/unpackaged_id.cc @@ -29,6 +29,7 @@ #include <paludis/util/return_literal_function.hh> #include <paludis/util/make_null_shared_ptr.hh> #include <paludis/util/fs_stat.hh> +#include <paludis/util/singleton-impl.hh> #include <paludis/output_manager.hh> #include <paludis/name.hh> #include <paludis/version_spec.hh> @@ -40,10 +41,29 @@ #include <paludis/choice.hh> #include <paludis/elike_choices.hh> #include <paludis/user_dep_spec.hh> +#include <paludis/always_enabled_dependency_label.hh> using namespace paludis; using namespace paludis::unpackaged_repositories; +namespace +{ + struct UnpackagedIDData : + Singleton<UnpackagedIDData> + { + std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; + std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; + + UnpackagedIDData() : + build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), + run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()) + { + build_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("build_dependencies")); + run_dependencies_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("run_dependencies")); + } + }; +} + namespace paludis { template <> @@ -54,9 +74,6 @@ namespace paludis const VersionSpec version; const RepositoryName repository_name; - std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels; - std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels; - const std::shared_ptr<LiteralMetadataValueKey<SlotName> > slot_key; const std::shared_ptr<LiteralMetadataValueKey<FSPath> > fs_location_key; const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key; @@ -82,14 +99,12 @@ namespace paludis name(q), version(v), repository_name(n), - build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), - run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()), slot_key(std::make_shared<LiteralMetadataValueKey<SlotName> >("slot", "Slot", mkt_internal, s)), fs_location_key(std::make_shared<LiteralMetadataValueKey<FSPath> >("location", "Location", mkt_normal, l)), build_dependencies_key(std::make_shared<UnpackagedDependencyKey>(env, "build_dependencies", "Build dependencies", mkt_dependencies, - build_dependencies_labels, b)), + UnpackagedIDData::get_instance()->build_dependencies_labels, b)), run_dependencies_key(std::make_shared<UnpackagedDependencyKey>(env, "run_dependencies", "Run dependencies", mkt_dependencies, - run_dependencies_labels, r)), + UnpackagedIDData::get_instance()->run_dependencies_labels, r)), description_key(std::make_shared<LiteralMetadataValueKey<std::string> >("description", "Description", mkt_significant, d)), choices_key(std::make_shared<UnpackagedChoicesKey>(env, "choices", "Choices", mkt_normal, id)), strip_key(ds.is_indeterminate() ? make_null_shared_ptr() : @@ -97,10 +112,6 @@ namespace paludis preserve_work_key(dw.is_indeterminate() ? make_null_shared_ptr() : std::make_shared<LiteralMetadataValueKey<bool>>("preserve_work", "Preserve work", mkt_internal, dw.is_true() ? true : false)) { - build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build_dependencies", - return_literal_function(true))); - run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run_dependencies", - return_literal_function(true))); } }; } diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc index 7aee731ad..30f780acc 100644 --- a/paludis/repositories/virtuals/package_id.cc +++ b/paludis/repositories/virtuals/package_id.cc @@ -27,6 +27,7 @@ #include <paludis/util/make_named_values.hh> #include <paludis/util/return_literal_function.hh> #include <paludis/util/make_null_shared_ptr.hh> +#include <paludis/util/singleton-impl.hh> #include <paludis/name.hh> #include <paludis/dep_spec.hh> #include <paludis/version_spec.hh> @@ -44,6 +45,7 @@ #include <paludis/filter.hh> #include <paludis/filtered_generator.hh> #include <paludis/partially_made_package_dep_spec.hh> +#include <paludis/always_enabled_dependency_label.hh> using namespace paludis; using namespace paludis::virtuals; @@ -158,6 +160,24 @@ VirtualsDepKey::initial_labels() const return _imp->labels; } +namespace +{ + struct VirtualsDepKeyData : + Singleton<VirtualsDepKeyData> + { + std::shared_ptr<DependenciesLabelSequence> bdep_labels; + std::shared_ptr<DependenciesLabelSequence> rdep_labels; + + VirtualsDepKeyData() : + bdep_labels(std::make_shared<DependenciesLabelSequence>()), + rdep_labels(std::make_shared<DependenciesLabelSequence>()) + { + bdep_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("DEPEND")); + rdep_labels->push_back(std::make_shared<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("RDEPEND")); + } + }; +} + namespace paludis { template <> @@ -167,8 +187,6 @@ namespace paludis const RepositoryName repository_name; const QualifiedPackageName name; const VersionSpec version; - std::shared_ptr<DependenciesLabelSequence> bdep_labels; - std::shared_ptr<DependenciesLabelSequence> rdep_labels; const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const PackageID> > > virtual_for; const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > bdep; const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > rdep; @@ -185,17 +203,11 @@ namespace paludis repository_name(r), name(n), version(p->version()), - bdep_labels(std::make_shared<DependenciesLabelSequence>()), - rdep_labels(std::make_shared<DependenciesLabelSequence>()), virtual_for(std::make_shared<LiteralMetadataValueKey<std::shared_ptr<const PackageID> > >("VIRTUAL_FOR", "Virtual for", mkt_normal, p)), - bdep(std::make_shared<virtuals::VirtualsDepKey>(e, "DEPEND", "Build dependencies", p, bdep_labels, b)), - rdep(std::make_shared<virtuals::VirtualsDepKey>(e, "RDEPEND", "Run dependencies", p, rdep_labels, b)), + bdep(std::make_shared<virtuals::VirtualsDepKey>(e, "DEPEND", "Build dependencies", p, VirtualsDepKeyData::get_instance()->bdep_labels, b)), + rdep(std::make_shared<virtuals::VirtualsDepKey>(e, "RDEPEND", "Run dependencies", p, VirtualsDepKeyData::get_instance()->rdep_labels, b)), has_masks(false) { - bdep_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", - return_literal_function(true))); - rdep_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", - return_literal_function(true))); } }; } diff --git a/python/dep_label.cc b/python/dep_label.cc index 11099d633..95b05c19d 100644 --- a/python/dep_label.cc +++ b/python/dep_label.cc @@ -23,6 +23,7 @@ #include <paludis/dep_label.hh> #include <paludis/util/return_literal_function.hh> +#include <paludis/always_enabled_dependency_label.hh> using namespace paludis; using namespace paludis::python; @@ -31,9 +32,9 @@ namespace bp = boost::python; namespace { template <typename T_> - T_ * make_concrete_dependencies_label(const std::string & t, const bool b) + T_ * make_concrete_dependencies_label(const std::string & t) { - return new T_(t, return_literal_function(b)); + return new T_(t); } } @@ -67,7 +68,7 @@ struct class_concrete_dependencies_label : { def("__init__", bp::make_constructor(&make_concrete_dependencies_label<L_>), - "__init__(String, bool)" + "__init__(String)" ); bp::implicitly_convertible<std::shared_ptr<L_>, std::shared_ptr<DependenciesLabel> >(); @@ -125,12 +126,12 @@ void expose_dep_label() /** * ConcreteDependenciesLabels */ - class_concrete_dependencies_label<DependenciesBuildLabel>("DependenciesBuildLabel"); - class_concrete_dependencies_label<DependenciesRunLabel>("DependenciesRunLabel"); - class_concrete_dependencies_label<DependenciesPostLabel>("DependenciesPostLabel"); - class_concrete_dependencies_label<DependenciesCompileAgainstLabel>("DependenciesCompileAgainstLabel"); - class_concrete_dependencies_label<DependenciesInstallLabel>("DependenciesInstallLabel"); - class_concrete_dependencies_label<DependenciesFetchLabel>("DependenciesFetchLabel"); - class_concrete_dependencies_label<DependenciesSuggestionLabel>("DependenciesSuggestionLabel"); - class_concrete_dependencies_label<DependenciesRecommendationLabel>("DependenciesRecommendationLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesBuildLabelTag> >("DependenciesBuildLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesRunLabelTag> >("DependenciesRunLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesPostLabelTag> >("DependenciesPostLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesCompileAgainstLabelTag> >("DependenciesCompileAgainstLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesInstallLabelTag> >("DependenciesInstallLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesFetchLabelTag> >("DependenciesFetchLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesSuggestionLabelTag> >("DependenciesSuggestionLabel"); + class_concrete_dependencies_label<AlwaysEnabledDependencyLabel<DependenciesRecommendationLabelTag> >("DependenciesRecommendationLabel"); } diff --git a/python/dep_label_TEST.py b/python/dep_label_TEST.py index e46925652..eaf183725 100755 --- a/python/dep_label_TEST.py +++ b/python/dep_label_TEST.py @@ -49,14 +49,14 @@ class TestCase_01_URILabels(unittest.TestCase): class TestCase_02_DependenciesLabels(unittest.TestCase): def setUp(self): self.list = [] - self.list.append((DependenciesBuildLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesRunLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesPostLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesCompileAgainstLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesInstallLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesFetchLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesSuggestionLabel("foo", True), DependenciesLabel)) - self.list.append((DependenciesRecommendationLabel("foo", True), DependenciesLabel)) + self.list.append((DependenciesBuildLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesRunLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesPostLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesCompileAgainstLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesInstallLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesFetchLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesSuggestionLabel("foo"), DependenciesLabel)) + self.list.append((DependenciesRecommendationLabel("foo"), DependenciesLabel)) def test_01_no_create(self): self.assertRaises(Exception, DependenciesLabel) |