diff options
author | 2011-02-06 15:17:14 +0000 | |
---|---|---|
committer | 2011-02-06 15:17:14 +0000 | |
commit | 7c929c87597f4e6fcfe8638e03e7b60c22090415 (patch) | |
tree | 625ad4cc2261b7f76d098022db32499845c3fc3e | |
parent | 05b3a52ec5ab06937bc9038c370db9b347dbe9af (diff) | |
download | paludis-7c929c87597f4e6fcfe8638e03e7b60c22090415.tar.gz paludis-7c929c87597f4e6fcfe8638e03e7b60c22090415.tar.xz |
Dep tags are no longer needed
39 files changed, 9 insertions, 2067 deletions
diff --git a/doc/api/cplusplus/examples/Makefile.am b/doc/api/cplusplus/examples/Makefile.am index ff69e593f..05bd89cf0 100644 --- a/doc/api/cplusplus/examples/Makefile.am +++ b/doc/api/cplusplus/examples/Makefile.am @@ -15,7 +15,6 @@ noinst_PROGRAMS = \ example_contents \ example_dep_label \ example_dep_spec \ - example_dep_tag \ example_dep_spec_flattener \ example_environment \ example_package_id \ @@ -68,12 +67,6 @@ example_dep_spec_LDADD = \ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la -example_dep_tag_SOURCES = example_dep_tag.cc -example_dep_tag_LDADD = \ - libpaludisexamples.a \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la - example_dep_spec_flattener_SOURCES = example_dep_spec_flattener.cc example_dep_spec_flattener_LDADD = \ libpaludisexamples.a \ diff --git a/doc/api/cplusplus/examples/example_dep_tag.cc b/doc/api/cplusplus/examples/example_dep_tag.cc deleted file mode 100644 index 4c50a36e8..000000000 --- a/doc/api/cplusplus/examples/example_dep_tag.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/** \file - * - * Example \ref example_dep_tag.cc "example_dep_tag.cc" . - * - * \ingroup g_dep_spec - */ - -/** \example example_dep_tag.cc - * - * This example demonstrates how to handle dependency tags. It displays - * information about the 'security' and 'world' sets. - */ - -#include <paludis/paludis.hh> -#include "example_command_line.hh" -#include <iostream> -#include <iomanip> -#include <cstdlib> -#include <set> - -using namespace paludis; -using namespace examples; - -using std::cout; -using std::endl; -using std::setw; -using std::left; -using std::boolalpha; - -/* We store a set of dep tag categories that we've seen. */ -typedef std::set<std::string> SeenCategories; - -namespace -{ - /* This visitor is used to display information about a tag. */ - class TagDisplayer - { - public: - void visit(const DependencyDepTag & tag) - { - /* A DependencyDepTag is used during dependency resolution. It - * shows why a package is included on a DepList. It has three - * additional fields: an optional package ID that pulled in the - * entry, an optional dep spec that pulled in the dependency and - * an optional set of conditions upon which that dependency is - * active. The third field is not used here, since it is too - * complicated for this example. */ - if (tag.package_id()) - cout << left << setw(20) << " Package ID:" << " " << *tag.package_id() << endl; - if (tag.dependency()) - cout << left << setw(20) << " Dependency:" << " " << *tag.dependency() << endl; - } - - void visit(const GLSADepTag & tag) - { - /* A GLSADepTag is for security advisories. It carries one - * additional field, the GLSA's title. */ - cout << left << setw(20) << " GLSA title:" << " " << tag.glsa_title() << endl; - } - - void visit(const GeneralSetDepTag & tag) - { - /* A GeneralSetDepTag is for general package sets. It carries - * one additional field, the source (e.g. a repository or - * environment name). */ - cout << left << setw(20) << " Source:" << " " << tag.source() << endl; - } - - void visit(const TargetDepTag &) - { - /* A TargetDepTag is used to indicate explicit targets when - * resolving dependencies. It carries no extra information. */ - } - }; - - /* Display information about a named set. */ - void display_set( - const std::shared_ptr<const Environment> & env, - const SetName & name, - SeenCategories & seen_categories) - { - std::shared_ptr<const SetSpecTree> set(env->set(name)); - - /* Environment::set can return a zero pointer, if a set is not known. */ - if (! set) - return; - - /* The set isn't necessarily flat. We use DepSpecFlattener to make it - * so, rather than writing a full visitor ourselves. */ - DepSpecFlattener<SetSpecTree, PackageDepSpec> set_flat(env.get()); - set->top()->accept(set_flat); - - cout << "Set '" << name << "':" << endl; - - /* For each item... */ - for (DepSpecFlattener<SetSpecTree, PackageDepSpec>::ConstIterator s(set_flat.begin()), - s_end(set_flat.end()) ; s != s_end ; ++s) - { - /* Ignore it, if it has no tag. */ - if (! (*s)->tag()) - continue; - - cout << " " << **s << ": " << endl; - - /* All dep tags have short text and a category. As well as - * displaying the category, we remember it for the categories - * summary later on. */ - cout << left << setw(20) << " Short text:" << " " << (*s)->tag()->short_text() << endl; - cout << left << setw(20) << " Category:" << " " << (*s)->tag()->category() << endl; - seen_categories.insert((*s)->tag()->category()); - - /* We use a visitor to do extra displaying, so that we can display - * more detailed information for whatever our tag type is. */ - TagDisplayer displayer; - (*s)->tag()->accept(displayer); - - cout << endl; - } - - cout << endl; - } -} - -int main(int argc, char * argv[]) -{ - try - { - CommandLine::get_instance()->run(argc, argv, - "example_dep_tag", "EXAMPLE_DEP_TAG_OPTIONS", "EXAMPLE_DEP_TAG_CMDLINE"); - - /* We start with an Environment, respecting the user's '--environment' choice. */ - std::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create( - CommandLine::get_instance()->a_environment.argument())); - - SeenCategories seen_categories; - - /* First, tell us about the 'security' set: */ - display_set(env, SetName("security"), seen_categories); - - /* Then the 'world' set: */ - display_set(env, SetName("world"), seen_categories); - - /* Now display a summary of seen categories. */ - cout << "Seen categories:" << endl; - for (SeenCategories::const_iterator s(seen_categories.begin()), s_end(seen_categories.end()) ; - s != s_end ; ++s) - { - cout << " " << *s << ":" << endl; - - /* Fetch the category. */ - std::shared_ptr<const DepTagCategory> category(DepTagCategoryFactory::get_instance()->create(*s)); - - cout << left << setw(20) << " Visible:" << " " << boolalpha << category->visible() << endl; - cout << left << setw(20) << " ID:" << " " << category->id() << endl; - cout << left << setw(20) << " Title:" << " " << category->title() << endl; - cout << left << setw(20) << " Pre text:" << " " << category->pre_text() << endl; - cout << left << setw(20) << " Post text:" << " " << category->post_text() << endl; - - cout << endl; - } - } - catch (const Exception & e) - { - /* Paludis exceptions can provide a handy human-readable backtrace and - * an explanation message. Where possible, these should be displayed. */ - cout << endl; - cout << "Unhandled exception:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - return EXIT_FAILURE; - } - catch (const std::exception & e) - { - cout << endl; - cout << "Unhandled exception:" << endl - << " * " << e.what() << endl; - return EXIT_FAILURE; - } - catch (...) - { - cout << endl; - cout << "Unhandled exception:" << endl - << " * Unknown exception type. Ouch..." << endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} - - - diff --git a/doc/api/index.html.part b/doc/api/index.html.part index 2fcce7d4a..8a8eaf6bb 100644 --- a/doc/api/index.html.part +++ b/doc/api/index.html.part @@ -93,13 +93,6 @@ how concepts map on to different language bindings.</p> <td>How to use DepSpecFlattener</td> </tr> <tr> - <td>example_dep_tag</td> - <td><a href="cplusplus/examples.html">C++</a></td> - <td></td> - <td></td> - <td>How to handle dependency tags</td> - </tr> - <tr> <td>example_dep_tree</td> <td><a href="cplusplus/examples.html">C++</a></td> <td><a href="ruby/example_dep_tree.html">Ruby</a></td> diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc index 5696a0ba8..f4bcf1c59 100644 --- a/paludis/dep_spec.cc +++ b/paludis/dep_spec.cc @@ -530,11 +530,9 @@ namespace paludis struct Imp<PackageDepSpec> { const std::shared_ptr<const PackageDepSpecData> data; - std::shared_ptr<const DepTag> tag; - Imp(const std::shared_ptr<const PackageDepSpecData> & d, const std::shared_ptr<const DepTag> & t) : - data(d), - tag(t) + Imp(const std::shared_ptr<const PackageDepSpecData> & d) : + data(d) { } }; @@ -543,7 +541,7 @@ namespace paludis PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> & d) : Cloneable<DepSpec>(), StringDepSpec(d->as_string()), - _imp(d, std::shared_ptr<const DepTag>()) + _imp(d) { } @@ -555,7 +553,7 @@ PackageDepSpec::PackageDepSpec(const PackageDepSpec & d) : Cloneable<DepSpec>(d), StringDepSpec(d._imp->data->as_string()), CloneUsingThis<DepSpec, PackageDepSpec>(d), - _imp(d._imp->data, d._imp->tag) + _imp(d._imp->data) { set_annotations(d.maybe_annotations()); } @@ -632,18 +630,6 @@ PackageDepSpec::additional_requirements_ptr() const return _imp->data->additional_requirements_ptr(); } -std::shared_ptr<const DepTag> -PackageDepSpec::tag() const -{ - return _imp->tag; -} - -void -PackageDepSpec::set_tag(const std::shared_ptr<const DepTag> & s) -{ - _imp->tag = s; -} - std::string PackageDepSpec::_as_string() const { diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh index ba2388e94..3ea80302a 100644 --- a/paludis/dep_spec.hh +++ b/paludis/dep_spec.hh @@ -30,7 +30,6 @@ #include <paludis/changed_choices-fwd.hh> #include <paludis/dep_label.hh> #include <paludis/dep_spec-fwd.hh> -#include <paludis/dep_tag-fwd.hh> #include <paludis/name.hh> #include <paludis/version_operator-fwd.hh> #include <paludis/version_requirements-fwd.hh> @@ -54,7 +53,6 @@ * * - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications) * - \ref example_dep_label.cc "example_dep_label.cc" (for labels) - * - \ref example_dep_tag.cc "example_dep_tag.cc" (for tags) */ namespace paludis @@ -415,16 +413,6 @@ namespace paludis std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const; /** - * Fetch our tag. - */ - std::shared_ptr<const DepTag> tag() const; - - /** - * Set our tag. - */ - void set_tag(const std::shared_ptr<const DepTag> & s); - - /** * Access to our data. */ std::shared_ptr<const PackageDepSpecData> data() const; diff --git a/paludis/dep_tag-fwd.hh b/paludis/dep_tag-fwd.hh deleted file mode 100644 index a505a58f1..000000000 --- a/paludis/dep_tag-fwd.hh +++ /dev/null @@ -1,54 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_TAG_FWD_HH -#define PALUDIS_GUARD_PALUDIS_DEP_TAG_FWD_HH 1 - -#include <paludis/util/set-fwd.hh> -#include <paludis/util/attributes.hh> - -/** \file - * Forward declarations for paludis/dep_tag.hh . - * - * \ingroup g_dep_spec - */ - -namespace paludis -{ - class DepTagCategory; - class DepTagCategoryFactory; - - class DepTag; - class GLSADepTag; - class GeneralSetDepTag; - class DependencyDepTag; - class TargetDepTag; - - class DepTagEntry; - class DepTagEntryComparator; - - /** - * Tags attached to a DepListEntry. - * - * \ingroup g_dep_spec - */ - typedef Set<DepTagEntry, DepTagEntryComparator> DepListEntryTags; -} - -#endif diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc deleted file mode 100644 index 62525d657..000000000 --- a/paludis/dep_tag.cc +++ /dev/null @@ -1,362 +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 - */ - -#include <paludis/dep_tag.hh> -#include <paludis/dep_spec.hh> -#include <paludis/dep_label.hh> -#include <paludis/spec_tree.hh> -#include <paludis/util/pimp-impl.hh> -#include <paludis/util/singleton-impl.hh> -#include <paludis/util/set-impl.hh> -#include <paludis/util/mutex.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/accept_visitor.hh> -#include <algorithm> -#include <sstream> - -using namespace paludis; - -namespace -{ - std::shared_ptr<DepTagCategory> - make_glsa_dep_tag() - { - return std::make_shared<DepTagCategory>( - true, - "glsa", - "Security advisories", - "Your system is potentially affected by these security issues:", - "Please read the advisories carefully and take appropriate action."); - } - - std::shared_ptr<DepTagCategory> - make_general_set_dep_tag() - { - return std::make_shared<DepTagCategory>( - true, - "general", - "General sets", - "", - ""); - } - - std::shared_ptr<DepTagCategory> - make_dependency_set_dep_tag() - { - return std::make_shared<DepTagCategory>( - false, - "dependency", - "Dependencies", - "", - ""); - } - - std::shared_ptr<DepTagCategory> - make_target_dep_tag() - { - return std::make_shared<DepTagCategory>( - false, - "target", - "Targets", - "", - ""); - } -} - -DepTagCategory::DepTagCategory( - bool vis, - const std::string & our_id, - const std::string & t, const std::string & pre, - const std::string & post) : - _visible(vis), - _id(our_id), - _title(t), - _pre_text(pre), - _post_text(post) -{ -} - -bool -DepTagCategory::visible() const -{ - return _visible; -} - -std::string -DepTagCategory::id() const -{ - return _id; -} - -std::string -DepTagCategory::title() const -{ - return _title; -} - -std::string -DepTagCategory::pre_text() const -{ - return _pre_text; -} - -std::string -DepTagCategory::post_text() const -{ - return _post_text; -} - -DepTag::DepTag() -{ -} - -DepTag::~DepTag() -{ -} - -namespace -{ - struct DepTagComparator - { - std::string value; - - void visit(const GLSADepTag & t) - { - value = t.short_text(); - } - - void visit(const GeneralSetDepTag & t) - { - value = t.short_text(); - } - - void visit(const DependencyDepTag & t) - { - value = stringify(*t.package_id()) + "," + stringify(*t.dependency()) + ","; - } - - void visit(const TargetDepTag & t) - { - value = t.short_text(); - } - }; -} - -bool -DepTag::operator== (const DepTag & other) const -{ - DepTagComparator c1, c2; - accept(c1); - other.accept(c2); - return c1.value == c2.value; -} - -bool -DepTag::operator< (const DepTag & other) const -{ - DepTagComparator c1, c2; - accept(c1); - other.accept(c2); - return c1.value < c2.value; -} - -GLSADepTag::GLSADepTag(const std::string & id, const std::string & our_glsa_title, const FSPath & our_glsa_file) : - _id(id), - _glsa_title(our_glsa_title), - _glsa_file(our_glsa_file) -{ -} - -GLSADepTag::~GLSADepTag() -{ -} - -std::string -GLSADepTag::short_text() const -{ - return "GLSA-" + _id; -} - -std::string -GLSADepTag::category() const -{ - return "glsa"; -} - -const FSPath -GLSADepTag::glsa_file() const -{ - return _glsa_file; -} - -std::string -GLSADepTag::glsa_title() const -{ - return _glsa_title; -} - -namespace paludis -{ - template <> - struct Imp<GeneralSetDepTag> - { - const SetName id; - const std::string source; - - Imp(const SetName & n, const std::string s) : - id(n), - source(s) - { - } - }; -} - -GeneralSetDepTag::GeneralSetDepTag(const SetName & id, const std::string & r) : - _imp(id, r) -{ -} - -GeneralSetDepTag::~GeneralSetDepTag() -{ -} - -std::string -GeneralSetDepTag::short_text() const -{ - return stringify(_imp->id); -} - -std::string -GeneralSetDepTag::category() const -{ - return "general"; -} - -std::string -GeneralSetDepTag::source() const -{ - return _imp->source; -} - -namespace paludis -{ - template <> - struct Imp<DependencyDepTag> - { - mutable Mutex mutex; - mutable std::string str; - - std::shared_ptr<const PackageID> id; - const std::shared_ptr<PackageDepSpec> spec; - - Imp(const std::shared_ptr<const PackageID> & i, const PackageDepSpec & d) : - id(i), - spec(std::static_pointer_cast<PackageDepSpec>(d.clone())) - { - spec->set_tag(std::shared_ptr<const DepTag>()); - } - }; -} - -DependencyDepTag::DependencyDepTag(const std::shared_ptr<const PackageID> & i, const PackageDepSpec & d) : - _imp(i, d) -{ -} - -DependencyDepTag::~DependencyDepTag() -{ -} - -std::string -DependencyDepTag::short_text() const -{ - return stringify(*_imp->id); -} - -std::string -DependencyDepTag::category() const -{ - return "dependency"; -} - -const std::shared_ptr<const PackageID> -DependencyDepTag::package_id() const -{ - return _imp->id; -} - -const std::shared_ptr<const PackageDepSpec> -DependencyDepTag::dependency() const -{ - return _imp->spec; -} - -TargetDepTag::TargetDepTag() -{ -} - -TargetDepTag::~TargetDepTag() -{ -} - -std::string -TargetDepTag::short_text() const -{ - return "target"; -} - -std::string -TargetDepTag::category() const -{ - return "target"; -} - -DepTagCategoryFactory::DepTagCategoryFactory() -{ -} - -const std::shared_ptr<DepTagCategory> -DepTagCategoryFactory::create(const std::string & s) const -{ - if (s == "glsa") - return make_glsa_dep_tag(); - if (s == "general") - return make_general_set_dep_tag(); - if (s == "dependency") - return make_dependency_set_dep_tag(); - if (s == "target") - return make_target_dep_tag(); - throw ConfigurationError("No dep tag category named '" + s + "'"); -} - -bool -DepTagEntryComparator::operator() (const DepTagEntry & l, const DepTagEntry & r) const -{ - return *l.tag() < *r.tag(); -} - -template class Singleton<DepTagCategoryFactory>; - -template class Set<DepTagEntry, DepTagEntryComparator>; -template class WrappedForwardIterator<Set<DepTagEntry, DepTagEntryComparator>::ConstIteratorTag, const DepTagEntry>; -template class WrappedOutputIterator<Set<DepTagEntry, DepTagEntryComparator>::InserterTag, DepTagEntry>; - -template class Pimp<GeneralSetDepTag>; -template class Pimp<DependencyDepTag>; - diff --git a/paludis/dep_tag.hh b/paludis/dep_tag.hh deleted file mode 100644 index ad1513317..000000000 --- a/paludis/dep_tag.hh +++ /dev/null @@ -1,365 +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_DEP_TAG_HH -#define PALUDIS_GUARD_PALUDIS_DEP_TAG_HH 1 - -/** \file - * Declarations for dependency tags. - * - * \ingroup g_dep_spec - * - * \section Examples - * - * - \ref example_dep_tag.cc "example_dep_tag.cc" (for tags) - * - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications) - * - \ref example_dep_label.cc "example_dep_label.cc" (for labels) - */ - -#include <paludis/dep_tag-fwd.hh> -#include <paludis/dep_spec-fwd.hh> -#include <paludis/name-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/spec_tree-fwd.hh> -#include <paludis/util/simple_visitor.hh> -#include <paludis/util/exception.hh> -#include <paludis/util/named_value.hh> -#include <paludis/util/fs_path.hh> -#include <paludis/util/operators.hh> -#include <paludis/util/type_list.hh> -#include <paludis/util/singleton.hh> - -#include <string> -#include <memory> - -namespace paludis -{ - namespace n - { - typedef Name<struct name_generation> generation; - typedef Name<struct name_tag> tag; - } - - /** - * A DepTagCategory is identified by its name and has associated display - * information for a DepTag's category. - * - * It is usually accessed via DepTagCategoryMaker. - * - * \see DepTagCategoryMaker - * \see DepTag - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE DepTagCategory - { - private: - bool _visible; - const std::string _id; - const std::string _title; - const std::string _pre_text; - const std::string _post_text; - - public: - ///\name Basic operations - ///\{ - - DepTagCategory( - bool visible, - const std::string & id, - const std::string & t, - const std::string & pre, - const std::string & post); - - DepTagCategory(const DepTagCategory &) = delete; - DepTagCategory & operator= (const DepTagCategory &) = delete; - - ///\} - - /** - * Should we be displayed in a tag category summary? - */ - bool visible() const; - - /** - * Fetch our short ID (for example, 'GLSA'). - */ - std::string id() const; - - /** - * Fetch our title (for example, 'Security advisories'), or an - * empty string if we're untitled. - */ - std::string title() const; - - /** - * Fetch our pre list text, or an empty string. - */ - std::string pre_text() const; - - /** - * Fetch our post list text, or an empty string. - */ - std::string post_text() const; - }; - - /** - * Factory for accessing DepTagCategory instances. - * - * \ingroup g_dep_spec - * \since 0.30 - */ - class PALUDIS_VISIBLE DepTagCategoryFactory : - public Singleton<DepTagCategoryFactory> - { - friend class Singleton<DepTagCategoryFactory>; - - private: - DepTagCategoryFactory(); - - public: - const std::shared_ptr<DepTagCategory> create(const std::string &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - }; - - /** - * A DepTag can be associated with a PackageDepSpec, and is transferred - * onto any associated DepListEntry instances. - * - * It is used for tagging dep list entries visually, for example to - * indicate an associated GLSA. - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE DepTag : - public relational_operators::HasRelationalOperators, - public virtual DeclareAbstractAcceptMethods<DepTag, MakeTypeList< - GLSADepTag, GeneralSetDepTag, DependencyDepTag, TargetDepTag>::Type> - { - protected: - ///\name Basic operations - ///\{ - - DepTag(); - - public: - virtual ~DepTag(); - - DepTag(const DepTag &) = delete; - DepTag & operator= (const DepTag &) = delete; - - ///\} - - /** - * Fetch our short text (for example, 'GLSA-1234') that is - * displayed with the dep list entry. - */ - virtual std::string short_text() const = 0; - - /** - * Fetch our DepTagCategory's tag. - */ - virtual std::string category() const = 0; - - ///\name Comparison operators - ///\{ - - bool operator< (const DepTag &) const; - bool operator== (const DepTag &) const; - - ///\} - }; - - /** - * DepTag subclass for GLSAs. - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE GLSADepTag : - public DepTag, - public ImplementAcceptMethods<DepTag, GLSADepTag> - { - private: - const std::string _id; - const std::string _glsa_title; - const FSPath _glsa_file; - - public: - ///\name Basic operations - ///\{ - - GLSADepTag(const std::string & id, const std::string & glsa_title, const FSPath &); - ~GLSADepTag(); - - ///\} - - ///\name Content information - ///\{ - - virtual std::string short_text() const; - - virtual std::string category() const; - - /** - * The full path to the glsa announcement file. - */ - const FSPath glsa_file() const; - - /** - * Fetch our GLSA title (for example, 'Yet another PHP remote access - * hole'). - */ - std::string glsa_title() const; - - ///\} - }; - - /** - * DepTag subclass for general sets. - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE GeneralSetDepTag : - public DepTag, - public ImplementAcceptMethods<DepTag, GeneralSetDepTag> - { - private: - Pimp<GeneralSetDepTag> _imp; - - public: - ///\name Basic operations - ///\{ - - GeneralSetDepTag(const SetName & id, const std::string & source); - ~GeneralSetDepTag(); - - ///\} - - virtual std::string short_text() const; - - virtual std::string category() const; - - /** - * From which repository or environment did we originate? - */ - std::string source() const; - }; - - /** - * DepTag subclass for dependencies. - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE DependencyDepTag : - public DepTag, - public ImplementAcceptMethods<DepTag, DependencyDepTag> - { - private: - Pimp<DependencyDepTag> _imp; - - void _make_str() const; - - public: - ///\name Basic operations - ///\{ - - DependencyDepTag(const std::shared_ptr<const PackageID> &, const PackageDepSpec &); - - ~DependencyDepTag(); - - ///\} - - virtual std::string short_text() const; - - virtual std::string category() const; - - /** - * The PackageID that contains our dependency. - */ - const std::shared_ptr<const PackageID> package_id() const; - - /** - * The PackageDepSpec that pulled us in. - */ - const std::shared_ptr<const PackageDepSpec> dependency() const; - }; - - /** - * DepTag subclass for explicit targets. - * - * \ingroup g_dep_spec - * \nosubgrouping - */ - class PALUDIS_VISIBLE TargetDepTag : - public DepTag, - public ImplementAcceptMethods<DepTag, TargetDepTag> - { - public: - ///\name Basic operations - ///\{ - - TargetDepTag(); - ~TargetDepTag(); - - ///\} - - virtual std::string short_text() const; - virtual std::string category() const; - }; - - /** - * Tags associated with a DepListEntry. - * - * The generation key is used internally by DepList. Its value is of no interest - * to outside clients. - * - * \see DepListEntry - * \ingroup g_dep_list - * \nosubgrouping - */ - struct DepTagEntry - { - NamedValue<n::generation, long> generation; - NamedValue<n::tag, std::shared_ptr<const DepTag> > tag; - }; - - /** - * Compare two DepListEntry structs by tag only. - * - * \see DepTagEntry - * \ingroup g_dep_list - * \since 0.34 - */ - struct PALUDIS_VISIBLE DepTagEntryComparator - { - bool operator() (const DepTagEntry &, const DepTagEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result)); - }; - - extern template class Singleton<DepTagCategoryFactory>; - extern template class Pimp<DependencyDepTag>; - extern template class Pimp<GeneralSetDepTag>; - -} - -#endif diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc index ce30f7b33..c44499245 100644 --- a/paludis/environments/paludis/paludis_environment.cc +++ b/paludis/environments/paludis/paludis_environment.cc @@ -33,7 +33,6 @@ #include <paludis/hook.hh> #include <paludis/set_file.hh> #include <paludis/distribution.hh> -#include <paludis/dep_tag.hh> #include <paludis/package_id.hh> #include <paludis/mask.hh> #include <paludis/user_dep_spec.hh> @@ -526,15 +525,12 @@ namespace { Context context("When making set '" + stringify(f) + "':"); - const std::shared_ptr<GeneralSetDepTag> tag(std::make_shared<GeneralSetDepTag>(n, stringify(f.basename()))); - SetFile s(make_named_values<SetFileParams>( n::environment() = env, n::file_name() = f, n::parser() = std::bind(&parse_user_package_dep_spec, std::placeholders::_1, env, UserPackageDepSpecOptions() + updso_allow_wildcards, filter::All()), n::set_operator_mode() = mode, - n::tag() = tag, n::type() = type )); return s.contents(); diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc index ea3b90074..b546d4f5d 100644 --- a/paludis/environments/paludis/world.cc +++ b/paludis/environments/paludis/world.cc @@ -27,7 +27,6 @@ #include <paludis/util/fs_stat.hh> #include <paludis/set_file.hh> #include <paludis/user_dep_spec.hh> -#include <paludis/dep_tag.hh> #include <paludis/partially_made_package_dep_spec.hh> #include <functional> @@ -121,7 +120,6 @@ World::_add_string_to_world(const std::string & n) const n::file_name() = *_imp->maybe_world_file, n::parser() = std::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_simple )); bool result(world.add(n)); @@ -154,7 +152,6 @@ World::_remove_string_from_world(const std::string & n) const n::file_name() = *_imp->maybe_world_file, n::parser() = std::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_simple )); @@ -177,8 +174,6 @@ World::world_set() const { using namespace std::placeholders; - std::shared_ptr<GeneralSetDepTag> tag(std::make_shared<GeneralSetDepTag>(SetName("world"), "Environment")); - if (_imp->maybe_world_file) { if (_imp->maybe_world_file->stat().exists()) @@ -188,7 +183,6 @@ World::world_set() const n::file_name() = *_imp->maybe_world_file, n::parser() = std::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = tag, n::type() = sft_simple )); return world.contents(); diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc index 9d64dbba2..adc2ffde3 100644 --- a/paludis/environments/portage/portage_environment.cc +++ b/paludis/environments/portage/portage_environment.cc @@ -51,7 +51,6 @@ #include <paludis/package_id.hh> #include <paludis/user_dep_spec.hh> #include <paludis/set_file.hh> -#include <paludis/dep_tag.hh> #include <paludis/util/mutex.hh> #include <paludis/literal_metadata_key.hh> #include <paludis/repository_factory.hh> @@ -932,7 +931,6 @@ PortageEnvironment::_add_string_to_world(const std::string & s) const n::file_name() = _imp->world_file, n::parser() = std::bind(&parse_user_package_dep_spec, _1, this, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_simple )); bool result(world.add(s)); @@ -959,7 +957,6 @@ PortageEnvironment::_remove_string_from_world(const std::string & s) const n::parser() = std::bind(&parse_user_package_dep_spec, _1, this, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_simple )); @@ -1027,14 +1024,12 @@ namespace return std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>()); } - const std::shared_ptr<GeneralSetDepTag> tag(std::make_shared<GeneralSetDepTag>(SetName("world::environment"), "Environment")); SetFile world(make_named_values<SetFileParams>( n::environment() = env, n::file_name() = f, n::parser() = std::bind(&parse_user_package_dep_spec, std::placeholders::_1, env, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = tag, n::type() = sft_simple )); return world.contents(); diff --git a/paludis/files.m4 b/paludis/files.m4 index d6c897c7a..0fae3f739 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -31,7 +31,6 @@ add(`dep_spec', `hh', `cc', `test', `fwd', `s add(`dep_spec_annotations', `hh', `cc', `fwd', `se') add(`dep_spec_data', `hh', `cc', `fwd') add(`dep_spec_flattener', `hh', `cc') -add(`dep_tag', `hh', `cc', `fwd') add(`distribution', `hh', `cc', `impl', `fwd') add(`elf_linkage_checker', `hh', `cc') add(`elike_choices', `hh', `cc', `fwd', `se') diff --git a/paludis/package_dep_spec_properties.cc b/paludis/package_dep_spec_properties.cc index 667fdc27d..75a1efc96 100644 --- a/paludis/package_dep_spec_properties.cc +++ b/paludis/package_dep_spec_properties.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 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 @@ -51,7 +51,6 @@ paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const Pack result = result && check(bool(spec.package_ptr()), properties.has_package()); result = result && check(bool(spec.package_name_part_ptr()), properties.has_package_name_part()); result = result && check(bool(spec.slot_requirement_ptr()), properties.has_slot_requirement()); - result = result && check(bool(spec.tag()), properties.has_tag()); result = result && check(spec.version_requirements_ptr() && ! spec.version_requirements_ptr()->empty(), properties.has_version_requirements()); return result; diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc index 483c84cfb..1ca62acb4 100644 --- a/paludis/repositories/accounts/accounts_repository.cc +++ b/paludis/repositories/accounts/accounts_repository.cc @@ -30,7 +30,6 @@ #include <paludis/util/stringify.hh> #include <paludis/util/log.hh> #include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/dep_tag.hh> #include <paludis/literal_metadata_key.hh> #include <paludis/action.hh> #include <paludis/package_id.hh> diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc index 77f6459fe..02d46a2c8 100644 --- a/paludis/repositories/cran/cran_installed_repository.cc +++ b/paludis/repositories/cran/cran_installed_repository.cc @@ -21,7 +21,6 @@ #include <paludis/environment.hh> #include <paludis/util/pimp-impl.hh> #include <paludis/dep_spec.hh> -#include <paludis/dep_tag.hh> #include <paludis/util/config_file.hh> #include <paludis/set_file.hh> #include <paludis/action.hh> diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc index fda8d2247..e437114ee 100644 --- a/paludis/repositories/e/e_installed_repository.cc +++ b/paludis/repositories/e/e_installed_repository.cc @@ -45,7 +45,6 @@ #include <paludis/environment.hh> #include <paludis/set_file.hh> #include <paludis/hook.hh> -#include <paludis/dep_tag.hh> #include <paludis/user_dep_spec.hh> #include <paludis/generator.hh> #include <paludis/filter.hh> diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc index c2331df37..186b28b61 100644 --- a/paludis/repositories/e/e_repository_sets.cc +++ b/paludis/repositories/e/e_repository_sets.cc @@ -26,7 +26,6 @@ #include <paludis/action-fwd.hh> #include <paludis/dep_spec.hh> -#include <paludis/dep_tag.hh> #include <paludis/elike_slot_requirement.hh> #include <paludis/environment.hh> #include <paludis/filter.hh> @@ -116,8 +115,6 @@ ERepositorySets::package_set(const SetName & ss) const if ((_imp->params.setsdir() / (stringify(s.first) + ".conf")).stat().exists()) { - std::shared_ptr<GeneralSetDepTag> tag(std::make_shared<GeneralSetDepTag>(ss, stringify(_imp->e_repository->name()))); - FSPath ff(_imp->params.setsdir() / (stringify(s.first) + ".conf")); Context context("When loading package set '" + stringify(s.first) + "' from '" + stringify(ff) + "':"); @@ -126,7 +123,6 @@ ERepositorySets::package_set(const SetName & ss) const n::file_name() = ff, n::parser() = std::bind(&parse_user_package_dep_spec, _1, _imp->environment, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()), n::set_operator_mode() = s.second, - n::tag() = tag, n::type() = sft_paludis_conf )); @@ -258,8 +254,6 @@ ERepositorySets::security_set(bool insecurity) const if (!_imp->params.securitydir().stat().is_directory_or_symlink_to_directory()) return security_packages; - std::map<std::string, std::shared_ptr<GLSADepTag> > glsa_tags; - for (FSIterator f(_imp->params.securitydir(), { }), f_end ; f != f_end; ++f) { if (! is_file_with_prefix_extension(*f, "glsa-", ".xml", { })) @@ -298,10 +292,6 @@ ERepositorySets::security_set(bool insecurity) const if (! is_vulnerable(*glsa_pkg, **c, ver_options, pds_options)) continue; - if (glsa_tags.end() == glsa_tags.find(glsa->id())) - glsa_tags.insert(std::make_pair(glsa->id(), std::shared_ptr<GLSADepTag>( - std::make_shared<GLSADepTag>(glsa->id(), glsa->title(), *f)))); - if (insecurity) { std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( @@ -311,7 +301,6 @@ ERepositorySets::security_set(bool insecurity) const n::version_operator() = vo_equal, n::version_spec() = (*c)->version())) .in_repository((*c)->repository_name()))); - spec->set_tag(glsa_tags.find(glsa->id())->second); security_packages->top()->append(spec); } else @@ -344,7 +333,6 @@ ERepositorySets::security_set(bool insecurity) const n::version_operator() = vo_equal, n::version_spec() = (*r)->version())) .in_repository((*r)->repository_name()))); - spec->set_tag(glsa_tags.find(glsa->id())->second); security_packages->top()->append(spec); ok = true; break; diff --git a/paludis/repositories/e/exheres_profile.cc b/paludis/repositories/e/exheres_profile.cc index 166fd1633..07154dfd3 100644 --- a/paludis/repositories/e/exheres_profile.cc +++ b/paludis/repositories/e/exheres_profile.cc @@ -40,7 +40,6 @@ #include <paludis/util/fs_stat.hh> #include <paludis/choice.hh> -#include <paludis/dep_tag.hh> #include <paludis/environment.hh> #include <paludis/match_package.hh> #include <paludis/distribution.hh> @@ -93,10 +92,9 @@ namespace paludis const std::shared_ptr<Set<std::string> > use_expand_values; const std::shared_ptr<SetSpecTree> system_packages; - const std::shared_ptr<GeneralSetDepTag> system_tag; Imp(const Environment * const e, const ERepository * const p, - const RepositoryName & name, const FSPathSequence &, + const RepositoryName &, const FSPathSequence &, const std::string &, const bool) : env(e), repository(p), @@ -114,8 +112,7 @@ namespace paludis use_expand_implicit(std::make_shared<Set<std::string>>()), iuse_implicit(std::make_shared<Set<std::string>>()), use_expand_values(std::make_shared<Set<std::string>>()), - system_packages(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())), - system_tag(std::make_shared<GeneralSetDepTag>(SetName("system"), stringify(name))) + system_packages(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())) { environment_variables["CONFIG_PROTECT"] = getenv_with_default("CONFIG_PROTECT", "/etc"); environment_variables["CONFIG_PROTECT_MASK"] = getenv_with_default("CONFIG_PROTECT_MASK", ""); @@ -162,7 +159,6 @@ ExheresProfile::ExheresProfile( i->first->supported()->package_dep_spec_parse_options(), i->first->supported()->version_spec_options()))); - spec->set_tag(_imp->system_tag); _imp->system_packages->top()->append(spec); } diff --git a/paludis/repositories/e/traditional_profile.cc b/paludis/repositories/e/traditional_profile.cc index b3e51b6f7..6255b1522 100644 --- a/paludis/repositories/e/traditional_profile.cc +++ b/paludis/repositories/e/traditional_profile.cc @@ -46,7 +46,6 @@ #include <paludis/util/make_null_shared_ptr.hh> #include <paludis/choice.hh> -#include <paludis/dep_tag.hh> #include <paludis/environment.hh> #include <paludis/match_package.hh> #include <paludis/distribution.hh> @@ -151,7 +150,6 @@ namespace paludis ///\{ std::shared_ptr<SetSpecTree> system_packages; - std::shared_ptr<GeneralSetDepTag> system_tag; ///\} @@ -199,7 +197,6 @@ namespace paludis repository(p), profiles_with_parents(std::make_shared<FSPathSequence>()), system_packages(std::make_shared<SetSpecTree>(std::make_shared<AllDepSpec>())), - system_tag(std::make_shared<GeneralSetDepTag>(SetName("system"), stringify(name))), virtuals(std::make_shared<Map<QualifiedPackageName, PackageDepSpec>>()), use_expand(std::make_shared<Set<std::string>>()), use_expand_hidden(std::make_shared<Set<std::string>>()), @@ -583,7 +580,6 @@ Imp<TraditionalProfile>::make_vars_from_file_vars() i->first->supported()->package_dep_spec_parse_options(), i->first->supported()->version_spec_options()))); - spec->set_tag(system_tag); system_packages->top()->append(spec); } } diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc index 08d89250d..d1cbc8862 100644 --- a/paludis/repositories/e/vdb_repository.cc +++ b/paludis/repositories/e/vdb_repository.cc @@ -35,7 +35,6 @@ #include <paludis/user_dep_spec.hh> #include <paludis/literal_metadata_key.hh> #include <paludis/dep_spec_flattener.hh> -#include <paludis/dep_tag.hh> #include <paludis/distribution.hh> #include <paludis/environment.hh> #include <paludis/hook.hh> diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc index 557bc18f2..b69dd1ebe 100644 --- a/paludis/repositories/unpackaged/installed_repository.cc +++ b/paludis/repositories/unpackaged/installed_repository.cc @@ -38,7 +38,6 @@ #include <paludis/util/fs_stat.hh> #include <paludis/action.hh> #include <paludis/environment.hh> -#include <paludis/dep_tag.hh> #include <paludis/metadata_key.hh> #include <paludis/literal_metadata_key.hh> #include <paludis/user_dep_spec.hh> diff --git a/paludis/set_file.cc b/paludis/set_file.cc index 93397fda8..da71adfe3 100644 --- a/paludis/set_file.cc +++ b/paludis/set_file.cc @@ -222,8 +222,6 @@ namespace else { std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(params.parser()(tokens.at(1)))); - if (params.tag()) - spec->set_tag(params.tag()); result->top()->append(spec); } } @@ -237,9 +235,6 @@ namespace } std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(params.parser()(tokens.at(1)))); - if (params.tag()) - spec->set_tag(params.tag()); - if (spec->package_ptr()) { if (! params.environment()) @@ -264,9 +259,6 @@ namespace } std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(params.parser()(tokens.at(1)))); - if (params.tag()) - spec->set_tag(params.tag()); - if (spec->package_ptr()) { if (! params.environment()) @@ -346,8 +338,6 @@ SimpleHandler::_create_contents() const else { std::shared_ptr<PackageDepSpec> p(std::make_shared<PackageDepSpec>(_p.parser()(stringify(*i)))); - if (_p.tag()) - p->set_tag(_p.tag()); _contents->top()->append(p); } } diff --git a/paludis/set_file.hh b/paludis/set_file.hh index 4bc4354b0..e3a853c6b 100644 --- a/paludis/set_file.hh +++ b/paludis/set_file.hh @@ -28,7 +28,6 @@ #include <paludis/name.hh> #include <paludis/spec_tree.hh> #include <paludis/dep_spec-fwd.hh> -#include <paludis/dep_tag-fwd.hh> #include <functional> #include <iosfwd> @@ -72,7 +71,6 @@ namespace paludis NamedValue<n::file_name, FSPath> file_name; NamedValue<n::parser, std::function<PackageDepSpec (const std::string &)> > parser; NamedValue<n::set_operator_mode, SetFileSetOperatorMode> set_operator_mode; - NamedValue<n::tag, std::shared_ptr<const DepTag> > tag; NamedValue<n::type, SetFileType> type; }; diff --git a/paludis/set_file_TEST.cc b/paludis/set_file_TEST.cc index 9879355bd..83b485669 100644 --- a/paludis/set_file_TEST.cc +++ b/paludis/set_file_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * 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 @@ -76,7 +76,6 @@ namespace test_cases n::file_name() = FSPath("set_file_TEST_dir/simple1"), n::parser() = std::bind(&parse_user_package_dep_spec, _1, &env, UserPackageDepSpecOptions(), filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_simple )); @@ -143,7 +142,6 @@ namespace test_cases n::file_name() = FSPath("set_file_TEST_dir/paludisconf1"), n::parser() = std::bind(&parse_user_package_dep_spec, _1, &env, UserPackageDepSpecOptions(), filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_paludis_conf )); @@ -213,7 +211,6 @@ namespace test_cases n::file_name() = FSPath("set_file_TEST_dir/override"), n::parser() = std::bind(&parse_user_package_dep_spec, _1, &env, UserPackageDepSpecOptions(), filter::All()), n::set_operator_mode() = sfsmo_natural, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_paludis_conf )); @@ -228,7 +225,6 @@ namespace test_cases n::file_name() = FSPath("set_file_TEST_dir/override"), n::parser() = std::bind(&parse_user_package_dep_spec, _1, &env, UserPackageDepSpecOptions(), filter::All()), n::set_operator_mode() = sfsmo_star, - n::tag() = std::shared_ptr<DepTag>(), n::type() = sft_paludis_conf )); diff --git a/python/Makefile.am b/python/Makefile.am index 32067bb47..4164596f0 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -30,7 +30,6 @@ IF_PYTHON_TESTS = \ choices_TEST.py \ dep_label_TEST.py \ dep_spec_TEST.py \ - dep_tag_TEST.py \ environment_TEST.py \ filter_TEST.py \ filtered_generator_TEST.py \ @@ -58,7 +57,6 @@ IF_PYTHON_SOURCES = \ contents.cc \ dep_label.cc \ dep_spec.hh dep_spec.cc \ - dep_tag.cc \ environment.cc \ exception.hh exception.cc \ filter.cc \ diff --git a/python/dep_spec.cc b/python/dep_spec.cc index fbe91c781..5d7bb5e8d 100644 --- a/python/dep_spec.cc +++ b/python/dep_spec.cc @@ -23,7 +23,6 @@ #include <python/options.hh> #include <python/nice_names-nn.hh> -#include <paludis/dep_tag.hh> #include <paludis/dep_spec.hh> #include <paludis/environment.hh> #include <paludis/user_dep_spec.hh> @@ -82,7 +81,6 @@ namespace paludis std::shared_ptr<const RepositoryName> in_repository; std::shared_ptr<const RepositoryName> from_repository; std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements; - std::shared_ptr<const DepTag> tag; const std::string str; Imp( @@ -95,7 +93,6 @@ namespace paludis const std::shared_ptr<const RepositoryName> & ri, const std::shared_ptr<const RepositoryName> & rf, const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u, - const std::shared_ptr<const DepTag> & t, const std::string & st) : package_ptr(q), category_name_part_ptr(c), @@ -106,7 +103,6 @@ namespace paludis in_repository(ri), from_repository(rf), additional_requirements(u), - tag(t), str(st) { } @@ -235,7 +231,6 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) : deep_copy(p.in_repository_ptr()), deep_copy(p.from_repository_ptr()), p.additional_requirements_ptr(), - p.tag(), stringify(p)) { if (p.version_requirements_ptr()) @@ -257,7 +252,6 @@ PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) : deep_copy(p.in_repository_ptr()), deep_copy(p.from_repository_ptr()), p.additional_requirements_ptr(), - p.tag(), p.py_str()) { std::copy(p.version_requirements_ptr()->begin(), p.version_requirements_ptr()->end(), @@ -375,24 +369,12 @@ PythonPackageDepSpec::additional_requirements_ptr() const return _imp->additional_requirements; } -std::shared_ptr<const DepTag> -PythonPackageDepSpec::tag() const -{ - return _imp->tag; -} - std::string PythonPackageDepSpec::py_str() const { return _imp->str; } -void -PythonPackageDepSpec::set_tag(const std::shared_ptr<const DepTag> & s) -{ - _imp->tag = s; -} - PythonPlainTextDepSpec::PythonPlainTextDepSpec(const std::string & s) : PythonStringDepSpec(s) { diff --git a/python/dep_spec.hh b/python/dep_spec.hh index 70b4a792c..a33adb6c7 100644 --- a/python/dep_spec.hh +++ b/python/dep_spec.hh @@ -182,8 +182,6 @@ namespace paludis std::shared_ptr<const RepositoryName> in_repository_ptr() const; std::shared_ptr<const RepositoryName> from_repository_ptr() const; std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const; - std::shared_ptr<const DepTag> tag() const; - void set_tag(const std::shared_ptr<const DepTag> & s); std::string py_str() const; }; diff --git a/python/dep_tag.cc b/python/dep_tag.cc deleted file mode 100644 index 1ee440568..000000000 --- a/python/dep_tag.cc +++ /dev/null @@ -1,199 +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 <python/iterable.hh> - -#include <paludis/dep_tag.hh> -#include <paludis/dep_spec.hh> -#include <paludis/util/wrapped_forward_iterator.hh> - -using namespace paludis; -using namespace paludis::python; -namespace bp = boost::python; - -struct DepTagCategoryFactoryWrapper -{ - // More convenient way of creating DepTagCategories - static std::shared_ptr<const DepTagCategory> - create(const DepTagCategoryFactory & self, const std::string & id) - { - return self.create(id); - } -}; - -void expose_dep_tag() -{ - /** - * DepTagCategory - */ - register_shared_ptrs_to_python<DepTagCategory>(); - bp::class_<DepTagCategory, boost::noncopyable> - ( - "DepTagCategory", - "A DepTagCategory is identified by its name and has associated display " - "information for a DepTag's category.", - bp::no_init - ) - .add_property("visible", &DepTagCategory::visible, - "[ro] bool\n" - "Should we be displayed in a tag category summary?" - ) - - .add_property("id", &DepTagCategory::id, - "[ro] string\n" - "Fetch our short ID (for example, 'GLSA')." - ) - - .add_property("title", &DepTagCategory::title, - "[ro] string\n" - "Fetch our title (for example, 'Security advisories'), or an " - "empty string if we're untitled." - ) - - .add_property("pre_text", &DepTagCategory::pre_text, - "[ro] string\n" - "Fetch our pre list text, or an empty string." - ) - - .add_property("post_text", &DepTagCategory::post_text, - "[ro] string\n" - "Fetch our post list text, or an empty string." - ) - ; - - /** - * DepTagCategoryFactory - */ - bp::class_<DepTagCategoryFactory, boost::noncopyable> - ( - "DepTagCategoryFactory", - "Virtual constructor for accessing DepTagCategory instances.", - bp::no_init - ) - .add_static_property("instance", bp::make_function(&DepTagCategoryFactory::get_instance, - bp::return_value_policy<bp::reference_existing_object>()), - "Singleton instance." - ) - - .def("create", &DepTagCategoryFactory::create, - "create(id_string) -> DepTagCategory\n" - "Make DepTagCategory from id." - ) - ; - - /** - * DepTag - */ - bp::class_<DepTag, boost::noncopyable> - ( - "DepTag", - "A DepTag can be associated with a PackageDepSpec, and is transferred " - "onto any associated DepListEntry instances.", - bp::no_init - ) - .add_property("short_text", &DepTag::short_text, - "[ro] string\n" - "Our short text (for example, 'GLSA-1234') that is " - "displayed with the dep list entry." - ) - - .add_property("category", &DepTag::category, - "[ro] string\n" - "Our DepTagCategory's tag." - ) - - .def("__cmp__", &py_cmp<DepTag>) - ; - - /** - * GLSADepTag - */ - bp::class_<GLSADepTag, bp::bases<DepTag>, boost::noncopyable> - ( - "GLSADepTag", - "DepTag subclass for GLSAs.", - bp::init<const std::string &, const std::string &, const FSPath &>("__init__(id_str, glsa_title_str, glsa_file_str)") - ) - .add_property("glsa_title", &GLSADepTag::glsa_title, - "Our GLSA title (for example, 'Yet another PHP remote access hole')" - ) - .add_property("glsa_file", &GLSADepTag::glsa_file, - "Our GLSA filename" - ) - ; - - /** - * GeneralSetDepTag - */ - bp::class_<GeneralSetDepTag, bp::bases<DepTag>, boost::noncopyable> - ( - "GeneralSetDepTag", - "DepTag subclass for general sets.", - bp::init<const SetName &, const std::string &>("__init__(SetName, source_str)") - ) - .add_property("source", &GeneralSetDepTag::source, - "From which repository or environment did we originate?" - ) - ; - - /** - * DependencyDepTag - */ - bp::class_<DependencyDepTag, bp::bases<DepTag>, boost::noncopyable> - ( - "DependencyDepTag", - "DepTag subclass for dependencies.", - bp::init<const std::shared_ptr<const PackageID> &, const PackageDepSpec &>( - "__init__(PackageID, PackageDepSpec)" - ) - ) - .add_property("package_id", &DependencyDepTag::package_id, - "[ro] PackageID\n" - "The PackageID that contains our dependency." - ) - - .add_property("dependency", bp::make_function(&DependencyDepTag::dependency, - bp::return_value_policy<bp::return_by_value>()), - "[ro] PackageDepSpec\n" - "The PackageDepSpec that pulled us in." - ) - ; - - /** - * TargetDepTag - */ - bp::class_<TargetDepTag, bp::bases<DepTag>, boost::noncopyable> - ( - "TargetDepTag", - "DepTag subclass for explicit targets.", - bp::init<>("__init__()") - ) - ; - - /** - * DepListEntryTags - */ - class_iterable<DepListEntryTags> - ( - "DepListEntryTags", - "Tags attached to a DepListEntry." - ); -} diff --git a/python/dep_tag_TEST.py b/python/dep_tag_TEST.py deleted file mode 100755 index d809b0d46..000000000 --- a/python/dep_tag_TEST.py +++ /dev/null @@ -1,114 +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 -# - -from paludis import * -import unittest - -class TestCase_01_DepTag(unittest.TestCase): - def test_01_no_create(self): - self.assertRaises(Exception, DepTag) - -class TestCase_02_GLSADepTag(unittest.TestCase): - def setUp(self): - global dt - dt = GLSADepTag("id", "title", "/path") - - def test_01_instance(self): - self.assert_(isinstance(dt, DepTag)) - - def test_02_properties(self): - self.assertEquals(dt.category, "glsa") - self.assertEquals(dt.short_text, "GLSA-id") - self.assertEquals(dt.glsa_title, "title") - self.assertEquals(dt.glsa_file, "/path") - -class TestCase_03_GeneralSetDepTag(unittest.TestCase): - def setUp(self): - global dt - dt = GeneralSetDepTag("set_name", "source") - - def test_01_instance(self): - self.assert_(isinstance(dt, DepTag)) - - def test_02_properties(self): - self.assertEquals(dt.category, "general") - self.assertEquals(dt.short_text, "set_name") - self.assertEquals(dt.source, "source") - -class TestCase_04_DependencyDepTag(unittest.TestCase): - def setUp(self): - global dt, pid, pds, cds - env = TestEnvironment() - repo = FakeRepository(env, "repo") - pid = repo.add_version("cat/foo", VersionSpec("1.0")) - pds = parse_user_package_dep_spec("=cat/boo-1", env, []) - dt = DependencyDepTag(pid, pds); - - def test_01_instance(self): - self.assert_(isinstance(dt, DepTag)) - - def test_02_properties(self): - self.assertEquals(dt.category, "dependency") - self.assertEquals(dt.short_text, "cat/foo-1.0:0::repo") - self.assertEquals(dt.package_id, pid) - self.assertEquals(str(dt.dependency), str(pds)) - -class TestCase_05_TargetDepTag(unittest.TestCase): - def setUp(self): - global dt - dt = TargetDepTag() - - def test_01_instance(self): - self.assert_(isinstance(dt, DepTag)) - - def test_02_properties(self): - self.assertEquals(dt.category, "target") - self.assertEquals(dt.short_text, "target") - -class TestCase_06_DepTagCategoryFactory(unittest.TestCase): - def test_01_no_create(self): - self.assertRaises(Exception, DepTagCategoryFactory) - - def test_02_instance(self): - self.assert_(isinstance(DepTagCategoryFactory.instance, DepTagCategoryFactory)) - - def test_03_create(self): - cdt = DepTagCategoryFactory.instance.create("glsa") - self.assert_(isinstance(cdt, DepTagCategory)) - - self.assertRaises(ConfigurationError, DepTagCategoryFactory.instance.create, "foo") - -class TestCase_07_DepTagCategory(unittest.TestCase): - def setUp(self): - global cdt - cdt = DepTagCategoryFactory.instance.create("glsa") - - def test_01_no_create(self): - self.assertRaises(Exception, DepTagCategory) - - def test_02_properties(self): - self.assertEquals(cdt.visible, True) - self.assertEquals(cdt.id, "glsa") - self.assertEquals(cdt.title, "Security advisories") - self.assertEquals(cdt.pre_text, "Your system is potentially affected by these security issues:") - self.assertEquals(cdt.post_text, "Please read the advisories carefully and take appropriate action.") - -if __name__ == "__main__": - unittest.main() diff --git a/python/paludis_python.hh b/python/paludis_python.hh index 2dc5fb38d..496ecc6e1 100644 --- a/python/paludis_python.hh +++ b/python/paludis_python.hh @@ -177,7 +177,6 @@ void expose_choices() PALUDIS_VISIBLE; void expose_contents() PALUDIS_VISIBLE; void expose_dep_label() PALUDIS_VISIBLE; void expose_dep_spec() PALUDIS_VISIBLE; -void expose_dep_tag() PALUDIS_VISIBLE; void expose_environment() PALUDIS_VISIBLE; void expose_exception() PALUDIS_VISIBLE; void expose_filter() PALUDIS_VISIBLE; diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc index 9517ead30..938043536 100644 --- a/python/paludis_python_so.cc +++ b/python/paludis_python_so.cc @@ -38,7 +38,6 @@ BOOST_PYTHON_MODULE(paludis) expose_contents(); expose_filter(); /* must be before dep_spec */ expose_dep_spec(); - expose_dep_tag(); expose_dep_label(); expose_name(); expose_log(); diff --git a/ruby/Makefile.am b/ruby/Makefile.am index d24fbd1d5..149d06a02 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -23,7 +23,6 @@ IF_RUBY_TESTS = \ choice_TEST.rb \ contents_TEST.rb \ dep_spec_TEST.rb \ - dep_tag_TEST.rb \ environment_TEST.rb \ filter_TEST.rb \ filtered_generator_TEST.rb \ @@ -43,7 +42,6 @@ IF_RUBY_SOURCES = \ contents.cc \ dep_label.cc \ dep_spec.cc \ - dep_tag.cc \ environment.cc \ filter.cc \ filtered_generator.cc \ @@ -68,7 +66,6 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \ paludis_ruby_so.cc \ 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 \ environment_TEST_setup.sh environment_TEST_cleanup.sh \ generator_TEST_setup.sh generator_TEST_cleanup.sh \ nice_names.nn \ diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc index 358daad09..8cb530077 100644 --- a/ruby/dep_spec.cc +++ b/ruby/dep_spec.cc @@ -581,37 +581,6 @@ namespace /* * call-seq: - * tag -> DepTag or Nil - * - * Fetch the dep tag. - */ - VALUE - package_dep_spec_tag(VALUE self) - { - std::shared_ptr<WrappedSpecBase> * ptr; - Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr); - if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->tag())) - return Qnil; - return dep_tag_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->tag()); - } - - /* - * call-seq: - * tag=(dep_tag) -> Qnil - * - * Set the dep tag. - */ - VALUE - package_dep_spec_set_tag(VALUE self, VALUE dep_tag) - { - std::shared_ptr<WrappedSpecBase> * ptr; - Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr); - (std::static_pointer_cast<WrappedSpec<PackageDepSpec> >(*ptr))->spec()->set_tag(value_to_dep_tag(dep_tag)); - return Qnil; - } - - /* - * call-seq: * package -> QualifiedPackageName or Nil * * Fetch the package name. @@ -1157,8 +1126,6 @@ namespace #ifdef CIARANM_REMOVED_THIS rb_define_method(c_package_dep_spec, "use_requirements", RUBY_FUNC_CAST(&package_dep_spec_use_requirements), 0); #endif - rb_define_method(c_package_dep_spec, "tag", RUBY_FUNC_CAST(&package_dep_spec_tag), 0); - rb_define_method(c_package_dep_spec, "tag=", RUBY_FUNC_CAST(&package_dep_spec_set_tag), 1); VALUE (* package_dep_spec_to_s) (VALUE) = &dep_spec_to_s<PackageDepSpec>; rb_define_method(c_package_dep_spec, "to_s", RUBY_FUNC_CAST(package_dep_spec_to_s), 0); diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb index 8e8112a8d..67a746a86 100644 --- a/ruby/dep_spec_TEST.rb +++ b/ruby/dep_spec_TEST.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # vim: set sw=4 sts=4 et tw=80 : # -# Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh +# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh # Copyright (c) 2007 Richard Brown # # This file is part of the Paludis package manager. Paludis is free software; @@ -233,22 +233,6 @@ module Paludis ### assert_equal 'b', pda.use_requirements[1][:flag] ### assert_equal false, pda.use_requirements[1][:state] ### end - - def test_tag - assert_nil pda.tag - assert_nil pdb.tag - assert_nil pdc.tag - assert_nil pdd.tag - assert_nil pde.tag - - my_pda = pda - my_pda.tag = TargetDepTag.new - assert_kind_of TargetDepTag, my_pda.tag - - assert_raise TypeError do - pdb.tag = 42 - end - end end class TestCase_PlainTextDepSpec < Test::Unit::TestCase diff --git a/ruby/dep_tag.cc b/ruby/dep_tag.cc deleted file mode 100644 index 908c0b83c..000000000 --- a/ruby/dep_tag.cc +++ /dev/null @@ -1,344 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Richard Brown - * Copyright (c) 2007 David Leverton - * - * 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/dep_spec.hh> -#include <paludis/dep_tag.hh> -#include <ruby.h> - -using namespace paludis; -using namespace paludis::ruby; - -namespace -{ - static VALUE c_dep_tag; - static VALUE c_dependency_dep_tag; - static VALUE c_glsa_dep_tag; - static VALUE c_general_set_dep_tag; - static VALUE c_target_dep_tag; - - struct V - { - VALUE value; - std::shared_ptr<const DepTag> mm; - - V(std::shared_ptr<const DepTag> _m) : - mm(_m) - { - } - - void visit(const DependencyDepTag &) - { - value = Data_Wrap_Struct(c_dependency_dep_tag, 0, &Common<std::shared_ptr<const DependencyDepTag> >::free, - new std::shared_ptr<const DepTag>(mm)); - } - - void visit(const GLSADepTag &) - { - value = Data_Wrap_Struct(c_glsa_dep_tag, 0, &Common<std::shared_ptr<const DependencyDepTag> >::free, - new std::shared_ptr<const DepTag>(mm)); - } - - void visit(const GeneralSetDepTag &) - { - value = Data_Wrap_Struct(c_general_set_dep_tag, 0, &Common<std::shared_ptr<const DependencyDepTag> >::free, - new std::shared_ptr<const DepTag>(mm)); - } - - void visit(const TargetDepTag &) - { - value = Data_Wrap_Struct(c_target_dep_tag, 0, &Common<std::shared_ptr<const DependencyDepTag> >::free, - new std::shared_ptr<const DepTag>(mm)); - } - }; - - VALUE - dep_tag_init_1(int, VALUE*, VALUE self) - { - return self; - } - - VALUE - dependency_dep_tag_new(int argc, VALUE * argv, VALUE self) - { - if (2 != argc) - rb_raise(rb_eArgError, "DependencyDepTag expects two arguments, but got %d", argc); - - std::shared_ptr<const DepTag> * ptr(0); - try - { - ptr = new std::shared_ptr<const DepTag>( - std::make_shared<DependencyDepTag>(value_to_package_id(argv[0]), - *value_to_package_dep_spec(argv[1]))); - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::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: - * package_id -> PackageID - * - * The PackageID that contains our dependency. - */ - VALUE - dependency_dep_tag_package_id(VALUE self) - { - std::shared_ptr<const DepTag> * ptr; - Data_Get_Struct(self, std::shared_ptr<const DepTag>, ptr); - return package_id_to_value((std::static_pointer_cast<const DependencyDepTag>(*ptr))->package_id()); - } - - /* - * call-seq: - * dependency -> PackageDepSpec - * - * The PackageDepSpec that pulled us in. - */ - VALUE - dependency_dep_tag_dependency(VALUE self) - { - std::shared_ptr<const DepTag> * ptr; - Data_Get_Struct(self, std::shared_ptr<const DepTag>, ptr); - return package_dep_spec_to_value(*(std::static_pointer_cast<const DependencyDepTag>(*ptr))->dependency()); - } - - VALUE - glsa_dep_tag_new(int argc, VALUE * argv, VALUE self) - { - if (3 != argc) - rb_raise(rb_eArgError, "GLSADepTag expects three arguments, but got %d",argc); - - std::shared_ptr<const DepTag> * ptr(0); - try - { - ptr = new std::shared_ptr<const DepTag>(std::make_shared<GLSADepTag>(StringValuePtr(argv[0]), StringValuePtr(argv[1]), - FSPath(StringValuePtr(argv[2])))); - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr)); - rb_obj_call_init(tdata, argc, argv); - return tdata; - } - catch (const std::exception & e) - { - delete ptr; - exception_to_ruby_exception(e); - } - } - - VALUE - general_set_dep_tag_new(int argc, VALUE * argv, VALUE self) - { - if (2 != argc) - rb_raise(rb_eArgError, "GeneralSetDepTag expects two arguments, but got %d",argc); - - std::shared_ptr<const DepTag> * ptr(0); - try - { - ptr = new std::shared_ptr<const DepTag>(std::make_shared<GeneralSetDepTag>(SetName(StringValuePtr(argv[0])), StringValuePtr(argv[1]))); - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr)); - rb_obj_call_init(tdata, argc, argv); - return tdata; - } - catch (const std::exception & e) - { - delete ptr; - exception_to_ruby_exception(e); - } - } - - VALUE - target_dep_tag_new(VALUE self) - { - std::shared_ptr<const DepTag> * ptr(0); - try - { - ptr = new std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>()); - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr)); - rb_obj_call_init(tdata, 0, 0); - return tdata; - } - catch (const std::exception & e) - { - delete ptr; - exception_to_ruby_exception(e); - } - } - - /* - * Document-method: short_text - * - * call-seq: - * short_text -> String - * - * Fetch our short text (for example, 'GLSA-1234') that is - * displayed with the dep list entry. - */ - /* - * Document-method: category - * - * call-seq: - * category -> String - * - * Fetch our DepTagCategory's tag. - */ - /* - * Document-method: glsa_title - * - * call-seq: - * glsa_title -> String - * - * Fetch our GLSA title (for example, 'Yet another PHP remote access hole'). - */ - /* - * Document-method: source - * - * call-seq: - * source -> String - * - * From which repository or environment did we originate? - */ - template <typename T_, std::string (T_::* m_) () const> - struct DepTagThings - { - static VALUE - fetch(VALUE self) - { - std::shared_ptr<const DepTag> * ptr; - Data_Get_Struct(self, std::shared_ptr<const DepTag>, ptr); - return rb_str_new2((((*std::static_pointer_cast<const T_>(*ptr)).*m_)()).c_str()); - } - }; - - /* - * Document-method: glsa_file - * - * call-seq: - * glsa_file -> String - * - * Fetch our GLSA file. - */ - template <typename T_, const FSPath (T_::* m_) () const> - struct DepTagFSPathThings - { - static VALUE - fetch(VALUE self) - { - std::shared_ptr<const DepTag> * ptr; - Data_Get_Struct(self, std::shared_ptr<const DepTag>, ptr); - return rb_str_new2(stringify(((*std::static_pointer_cast<const T_>(*ptr)).*m_)()).c_str()); - } - }; - - void do_register_dep_tag() - { - /* - * Document-class: Paludis::DepTag - * - * A DepTag can be associated with a PackageDepSpec, and is transferred onto any associated DepListEntry instances. - * - * It is used for tagging dep list entries visually, for example to indicate an associated GLSA. - */ - c_dep_tag = rb_define_class_under(paludis_module(), "DepTag", rb_cObject); - rb_funcall(c_dep_tag, rb_intern("private_class_method"), 1, rb_str_new2("new")); - rb_define_method(c_dep_tag, "initialize", RUBY_FUNC_CAST(&dep_tag_init_1), -1); - rb_define_method(c_dep_tag, "short_text", RUBY_FUNC_CAST((&DepTagThings<DepTag,&DepTag::short_text>::fetch)), 0); - rb_define_method(c_dep_tag, "category", RUBY_FUNC_CAST((&DepTagThings<DepTag,&DepTag::category>::fetch)), 0); - - /* - * Document-class: Paludis::DependencyDepTag - * - * DepTag subclass for dependencies. - */ - c_dependency_dep_tag = rb_define_class_under(paludis_module(), "DependencyDepTag", c_dep_tag); - rb_define_singleton_method(c_dependency_dep_tag, "new", RUBY_FUNC_CAST(&dependency_dep_tag_new), -1); - rb_define_method(c_dependency_dep_tag, "package_id", RUBY_FUNC_CAST(&dependency_dep_tag_package_id), 0); - rb_define_method(c_dependency_dep_tag, "dependency", RUBY_FUNC_CAST(&dependency_dep_tag_dependency), 0); - - /* - * Document-class: Paludis::GLSADepTag - * - * DepTag subclass for GLSAs. - */ - c_glsa_dep_tag = rb_define_class_under(paludis_module(), "GLSADepTag", c_dep_tag); - rb_define_singleton_method(c_glsa_dep_tag, "new", RUBY_FUNC_CAST(&glsa_dep_tag_new), -1); - rb_define_method(c_glsa_dep_tag, "glsa_title", RUBY_FUNC_CAST((&DepTagThings<GLSADepTag, - &GLSADepTag::glsa_title>::fetch)), 0); - rb_define_method(c_glsa_dep_tag, "glsa_file", RUBY_FUNC_CAST((&DepTagFSPathThings<GLSADepTag, - &GLSADepTag::glsa_file>::fetch)), 0); - - /* - * Document-class: Paludis::GeneralSetDepTag - * - * DepTag subclass for general sets. - */ - c_general_set_dep_tag = rb_define_class_under(paludis_module(), "GeneralSetDepTag", c_dep_tag); - rb_define_singleton_method(c_general_set_dep_tag, "new", RUBY_FUNC_CAST(&general_set_dep_tag_new), -1); - rb_define_method(c_general_set_dep_tag, "source", RUBY_FUNC_CAST((&DepTagThings<GeneralSetDepTag, - &GeneralSetDepTag::source>::fetch)), 0); - - /* - * Document-class: Paludis::TargetDepTag - * - * DepTag subclass for general sets. - */ - c_target_dep_tag = rb_define_class_under(paludis_module(), "TargetDepTag", c_dep_tag); - rb_define_singleton_method(c_target_dep_tag, "new", RUBY_FUNC_CAST(&target_dep_tag_new), 0); - } -} - -VALUE -paludis::ruby::dep_tag_to_value(std::shared_ptr<const DepTag> m) -{ - try - { - V v(m); - m->accept(v); - return v.value; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } -} - -std::shared_ptr<const DepTag> -paludis::ruby::value_to_dep_tag(VALUE v) -{ - if (rb_obj_is_kind_of(v, c_dep_tag)) - { - std::shared_ptr<const DepTag> * v_ptr; - Data_Get_Struct(v, std::shared_ptr<const DepTag>, v_ptr); - return *v_ptr; - } - else - { - rb_raise(rb_eTypeError, "Can't convert %s into DepTag", rb_obj_classname(v)); - } -} - -RegisterRubyClass::Register paludis_ruby_register_dep_tag PALUDIS_ATTRIBUTE((used)) - (&do_register_dep_tag); - diff --git a/ruby/dep_tag_TEST.rb b/ruby/dep_tag_TEST.rb deleted file mode 100644 index d6d64354a..000000000 --- a/ruby/dep_tag_TEST.rb +++ /dev/null @@ -1,191 +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' - -ENV['PALUDIS_HOME'] = Dir.getwd() + '/dep_tag_TEST_dir/home' - -module Paludis - class TestCase_DepTag < Test::Unit::TestCase - def test_no_create - assert_raise NoMethodError do - ce = DepTag.new('test') - end - end - end - - class TestCase_DependencyDepTag < Test::Unit::TestCase - def env - @env or @env = EnvironmentFactory.instance.create("") - end - - def get_dt - DependencyDepTag.new(env[Selection::RequireExactlyOne.new(Generator::All.new)].last, - Paludis::parse_user_package_dep_spec('foo/bar', env, [])) - end - - def test_create - assert_kind_of DependencyDepTag, get_dt - end - - def test_create_error - assert_raise ArgumentError do - DependencyDepTag.new - end - - assert_raise ArgumentError do - DependencyDepTag.new('a','b','c') - end - - assert_raise TypeError do - DependencyDepTag.new('a','b') - end - - assert_raise ArgumentError do - DependencyDepTag.new(1) - end - end - - def test_methods - dt = get_dt - {:short_text => 'foo/bar-1.0::testrepo', :category=>'dependency'}.each do |method, val| - assert_respond_to dt, method - assert_equal val, dt.send(method) - end - end - - def test_package_id - dt = get_dt - assert_respond_to dt, :package_id - id = dt.package_id - assert_kind_of PackageID, id - assert_equal "foo/bar-1.0::testrepo", id.to_s - end - - def test_dependency - dt = get_dt - assert_respond_to dt, :dependency - pds = dt.dependency - assert_kind_of PackageDepSpec, pds - assert_equal "foo/bar", pds.to_s - end - end - - class TestCase_GLSADepTag < Test::Unit::TestCase - def get_dt - GLSADepTag.new("id", "title", "/path") - end - - def test_create - assert_kind_of GLSADepTag, get_dt - end - - def test_create_error - assert_raise ArgumentError do - GLSADepTag.new - end - - assert_raise ArgumentError do - GLSADepTag.new('a') - end - - assert_raise TypeError do - GLSADepTag.new(1,1,3) - end - end - - def test_respond_to - dt = get_dt - { - :short_text => 'GLSA-id', - :category=>'glsa', - :glsa_title => 'title', - :glsa_file => "/path" - }.each do |method, val| - assert_respond_to dt, method - assert_equal val, dt.send(method) - end - end - end - - class TestCase_GeneralSetDepTag < Test::Unit::TestCase - def get_dt - GeneralSetDepTag.new("world", "title") - end - - def test_create - assert_kind_of GeneralSetDepTag, get_dt - end - - def test_create_error - assert_raise ArgumentError do - GeneralSetDepTag.new - end - - assert_raise ArgumentError do - GeneralSetDepTag.new('a') - end - - assert_raise TypeError do - GeneralSetDepTag.new(1,1) - end - end - - def test_respond_to - dt = get_dt - { - :short_text => 'world', - :category=>'general', - :source => 'title' - }.each do |method, val| - assert_respond_to dt, method - assert_equal val, dt.send(method) - end - end - end - - class TestCase_TargetDepTag < Test::Unit::TestCase - def get_dt - TargetDepTag.new - end - - def test_create - assert_kind_of TargetDepTag, get_dt - end - - def test_create_error - assert_raise ArgumentError do - TargetDepTag.new(1) - end - end - - def test_respond_to - dt = get_dt - { - :short_text => 'target', - :category=>'target', - }.each do |method, val| - assert_respond_to dt, method - assert_equal val, dt.send(method) - end - end - end -end - diff --git a/ruby/dep_tag_TEST_cleanup.sh b/ruby/dep_tag_TEST_cleanup.sh deleted file mode 100755 index 2cccc9111..000000000 --- a/ruby/dep_tag_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_tag_TEST_dir ] ; then - rm -fr dep_tag_TEST_dir -else - true -fi - - - - diff --git a/ruby/dep_tag_TEST_setup.sh b/ruby/dep_tag_TEST_setup.sh deleted file mode 100755 index e75fed20c..000000000 --- a/ruby/dep_tag_TEST_setup.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir dep_tag_TEST_dir || exit 1 -cd dep_tag_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/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" -DEPEND="|| ( foo/bar foo/baz ) foo/monkey" -END - diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh index 925bf2e02..fe7fbd102 100644 --- a/ruby/paludis_ruby.hh +++ b/ruby/paludis_ruby.hh @@ -31,7 +31,6 @@ #include <paludis/environments/no_config/no_config_environment.hh> #include <paludis/repository.hh> #include <paludis/contents.hh> -#include <paludis/dep_tag.hh> #include <paludis/mask-fwd.hh> #include <paludis/metadata_key.hh> #include <paludis/selection.hh> @@ -85,7 +84,6 @@ namespace paludis VALUE repository_to_value(std::shared_ptr<Repository>); VALUE version_spec_to_value(const VersionSpec &); VALUE package_id_to_value(std::shared_ptr<const PackageID>); - VALUE dep_tag_to_value(std::shared_ptr<const DepTag>); VALUE qualified_package_name_to_value(const QualifiedPackageName &); VALUE contents_to_value(std::shared_ptr<const Contents>); VALUE repository_mask_info_to_value(std::shared_ptr<const RepositoryMaskInfo>); @@ -114,7 +112,6 @@ namespace paludis std::shared_ptr<const PackageDepSpec> value_to_package_dep_spec(VALUE v); std::shared_ptr<const DependenciesLabelsDepSpec> value_to_dependencies_labels_dep_spec(VALUE v); std::shared_ptr<const DepSpec> value_to_dep_spec(VALUE v); - std::shared_ptr<const DepTag> value_to_dep_tag(VALUE v); QualifiedPackageName value_to_qualified_package_name(VALUE v); std::shared_ptr<Environment> value_to_environment(VALUE v); std::shared_ptr<NoConfigEnvironment> value_to_no_config_environment(VALUE v); |