aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-06 16:28:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-06 16:28:13 +0000
commitb38149a7b9859f1ea04c854127dafcfd0746ce83 (patch)
treeb68242f3e2fbdea03b02035e411fac890eda43f9
parent7c929c87597f4e6fcfe8638e03e7b60c22090415 (diff)
downloadpaludis-b38149a7b9859f1ea04c854127dafcfd0746ce83.tar.gz
paludis-b38149a7b9859f1ea04c854127dafcfd0746ce83.tar.xz
No need to rewrite dependencies
-rw-r--r--paludis/repositories/e/Makefile.am18
-rw-r--r--paludis/repositories/e/dependencies_rewriter.cc277
-rw-r--r--paludis/repositories/e/dependencies_rewriter.hh57
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc31
-rw-r--r--paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc131
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_dependencies_rewriter_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_dependencies_rewriter_setup.sh43
-rw-r--r--paludis/repositories/e/ebuild.cc11
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc19
-rw-r--r--paludis/repositories/e/ebuild_id.cc10
-rw-r--r--paludis/repositories/e/ebuild_id.hh2
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc41
-rw-r--r--ruby/dep_spec_TEST.rb6
-rw-r--r--ruby/package_id.cc10
14 files changed, 27 insertions, 638 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index f900a58..942fa97 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -28,7 +28,6 @@ noinst_HEADERS = \
dep_parser.hh \
dep_parser-se.hh \
dep_parser-fwd.hh \
- dependencies_rewriter.hh \
do_fetch_action.hh \
do_info_action.hh \
do_install_action.hh \
@@ -102,7 +101,6 @@ libpaludiserepository_la_SOURCES = \
check_fetched_files_visitor.cc \
check_userpriv.cc \
dep_parser.cc \
- dependencies_rewriter.cc \
do_fetch_action.cc \
do_info_action.cc \
do_install_action.cc \
@@ -189,17 +187,6 @@ depend_rdepend_TEST_LDADD = \
depend_rdepend_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-e_repository_TEST_dependencies_rewriter_SOURCES = e_repository_TEST_dependencies_rewriter.cc
-
-e_repository_TEST_dependencies_rewriter_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/test/libtest.a \
- $(DYNAMIC_LD_LIBS)
-
-e_repository_TEST_dependencies_rewriter_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
e_repository_TEST_ever_SOURCES = e_repository_TEST_ever.cc
e_repository_TEST_ever_LDADD = \
@@ -454,9 +441,6 @@ EXTRA_DIST = \
e_repository_TEST.cc \
e_repository_TEST_setup.sh \
e_repository_TEST_cleanup.sh \
- e_repository_TEST_dependencies_rewriter.cc \
- e_repository_TEST_dependencies_rewriter_setup.sh \
- e_repository_TEST_dependencies_rewriter_cleanup.sh \
e_repository_TEST_ever.cc \
e_repository_TEST_ever_setup.sh \
e_repository_TEST_ever_cleanup.sh \
@@ -537,7 +521,6 @@ BUILT_SOURCES = \
check_SCRIPTS = \
depend_rdepend_TEST_setup.sh depend_rdepend_TEST_cleanup.sh \
e_repository_TEST_setup.sh e_repository_TEST_cleanup.sh \
- e_repository_TEST_dependencies_rewriter_setup.sh e_repository_TEST_dependencies_rewriter_cleanup.sh \
e_repository_TEST_ever_setup.sh e_repository_TEST_ever_cleanup.sh \
e_repository_TEST_exheres_0_setup.sh e_repository_TEST_exheres_0_cleanup.sh \
e_repository_TEST_0_setup.sh e_repository_TEST_0_cleanup.sh \
@@ -629,7 +612,6 @@ TESTS = \
e_repository_TEST_2 \
e_repository_TEST_3 \
e_repository_TEST_4 \
- e_repository_TEST_dependencies_rewriter \
e_repository_TEST_ever \
e_repository_TEST_exheres_0 \
e_repository_TEST_exlibs \
diff --git a/paludis/repositories/e/dependencies_rewriter.cc b/paludis/repositories/e/dependencies_rewriter.cc
deleted file mode 100644
index ceb5e76..0000000
--- a/paludis/repositories/e/dependencies_rewriter.cc
+++ /dev/null
@@ -1,277 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/repositories/e/dependencies_rewriter.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/return_literal_function.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#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>
-
-using namespace paludis;
-using namespace paludis::erepository;
-
-typedef std::list<std::shared_ptr<DependenciesLabelSequence> > LabelsStack;
-
-namespace
-{
- const std::string get_annotations(const DepSpec & a)
- {
- std::stringstream s;
- if (a.maybe_annotations() && (a.maybe_annotations()->begin() != a.maybe_annotations()->end()))
- {
- s << " [[ ";
- for (auto m(a.maybe_annotations()->begin()), m_end(a.maybe_annotations()->end()) ;
- m != m_end ; ++m)
- s << m->key() << " = [" << (m->value().empty() ? " " : " " + m->value() + " ") << "] ";
-
- s << "]]";
- }
- 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
-{
- template <>
- struct Imp<DependenciesRewriter>
- {
- std::string depend;
- std::string rdepend;
- std::string pdepend;
-
- LabelsStack labels;
-
- Imp()
- {
- labels.push_front(DependenciesRewriterData::get_instance()->default_labels);
- }
- };
-}
-
-DependenciesRewriter::DependenciesRewriter() :
- _imp()
-{
-}
-
-DependenciesRewriter::~DependenciesRewriter()
-{
-}
-
-const std::string
-DependenciesRewriter::depend() const
-{
- return _imp->depend;
-}
-
-const std::string
-DependenciesRewriter::rdepend() const
-{
- return _imp->rdepend;
-}
-
-const std::string
-DependenciesRewriter::pdepend() const
-{
- return _imp->pdepend;
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- _add_where_necessary(stringify(*node.spec()), *node.spec());
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- _add_where_necessary(stringify(*node.spec()), *node.spec());
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
-{
- _add_where_necessary(stringify(*node.spec()), *node.spec());
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
-{
- _imp->depend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
- _imp->rdepend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
- _imp->pdepend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
-
- std::shared_ptr<DependenciesLabelSequence> labels(std::make_shared<DependenciesLabelSequence>());
- std::copy(node.spec()->begin(), node.spec()->end(), labels->back_inserter());
- *_imp->labels.begin() = labels;
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::string d(_imp->depend), r(_imp->rdepend), p(_imp->pdepend);
- _imp->depend.clear();
- _imp->rdepend.clear();
- _imp->pdepend.clear();
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-
- _imp->depend = d + " ( " + _imp->depend + " )" + get_annotations(*node.spec());
- _imp->rdepend = r + " ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
- _imp->pdepend = p + " ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::string d(_imp->depend), r(_imp->rdepend), p(_imp->pdepend);
- _imp->depend.clear();
- _imp->rdepend.clear();
- _imp->pdepend.clear();
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-
- _imp->depend = d + " || ( " + _imp->depend + " )" + get_annotations(*node.spec());
- _imp->rdepend = r + " || ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
- _imp->pdepend = p + " || ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
-}
-
-void
-DependenciesRewriter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- _imp->labels.push_front(*_imp->labels.begin());
- RunOnDestruction restore_labels(std::bind(std::mem_fn(&LabelsStack::pop_front), &_imp->labels));
-
- std::string d(_imp->depend), r(_imp->rdepend), p(_imp->pdepend);
- _imp->depend.clear();
- _imp->rdepend.clear();
- _imp->pdepend.clear();
-
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-
- _imp->depend = d + " " + stringify(*node.spec()) + " ( " + _imp->depend + " )" + get_annotations(*node.spec());
- _imp->rdepend = r + " " + stringify(*node.spec()) + " ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
- _imp->pdepend = p + " " + stringify(*node.spec()) + " ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
-}
-
-namespace
-{
- struct AddWhereNecessary
- {
- std::string & d, & r, & p;
- const std::string & s;
- const DepSpec & a;
-
- AddWhereNecessary(std::string & dd, std::string & rr, std::string & pp, const std::string & ss,
- const DepSpec & aa) :
- d(dd),
- r(rr),
- p(pp),
- s(ss),
- a(aa)
- {
- }
-
- void visit(const DependenciesRunLabel &)
- {
- r.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesPostLabel &)
- {
- p.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesSuggestionLabel &)
- {
- p.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesRecommendationLabel &)
- {
- p.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesBuildLabel &)
- {
- d.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesTestLabel &)
- {
- d.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesFetchLabel &)
- {
- d.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesCompileAgainstLabel &)
- {
- r.append(" " + s + get_annotations(a));
- }
-
- void visit(const DependenciesInstallLabel &)
- {
- d.append(" " + s + get_annotations(a));
- }
- };
-}
-
-void
-DependenciesRewriter::_add_where_necessary(const std::string & s, const DepSpec & a)
-{
- AddWhereNecessary v(_imp->depend, _imp->rdepend, _imp->pdepend, s, a);
- std::for_each(
- indirect_iterator((*_imp->labels.begin())->begin()),
- indirect_iterator((*_imp->labels.begin())->end()),
- accept_visitor(v));
-}
-
diff --git a/paludis/repositories/e/dependencies_rewriter.hh b/paludis/repositories/e/dependencies_rewriter.hh
deleted file mode 100644
index 9996e14..0000000
--- a/paludis/repositories/e/dependencies_rewriter.hh
+++ /dev/null
@@ -1,57 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2008, 2009, 2011 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_DEPENDENCIES_REWRITER_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_DEPENDENCIES_REWRITER_HH 1
-
-#include <paludis/dep_spec.hh>
-#include <paludis/spec_tree.hh>
-#include <paludis/util/pimp.hh>
-
-namespace paludis
-{
- namespace erepository
- {
- class DependenciesRewriter
- {
- private:
- Pimp<DependenciesRewriter> _imp;
-
- public:
- DependenciesRewriter();
- ~DependenciesRewriter();
-
- void _add_where_necessary(const std::string &, const DepSpec &);
-
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
- void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
-
- const std::string depend() const;
- const std::string rdepend() const;
- const std::string pdepend() const;
- };
- }
-}
-
-#endif
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index e522598..358882c 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -24,7 +24,6 @@
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
-#include <paludis/repositories/e/dependencies_rewriter.hh>
#include <paludis/repositories/e/e_choice_value.hh>
#include <paludis/repositories/e/e_string_set_key.hh>
@@ -82,7 +81,7 @@ namespace
std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > choices;
std::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license;
std::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide;
- std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > raw_dependencies;
+ std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > dependencies;
std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies;
std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies;
std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies;
@@ -329,30 +328,10 @@ EInstalledRepositoryID::need_keys_added() const
{
if ((_imp->dir / vars->dependencies()->name()).stat().exists())
{
- DependenciesRewriter rewriter;
- std::string raw_deps_str(file_contents(_imp->dir / vars->dependencies()->name()));
- std::shared_ptr<DependencySpecTree> raw_deps(parse_depend(raw_deps_str, _imp->environment, *eapi(), false));
- raw_deps->top()->accept(rewriter);
-
- _imp->keys->raw_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name(),
- vars->dependencies()->description(), raw_deps_str,
+ _imp->keys->dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name(),
+ vars->dependencies()->description(), file_contents(_imp->dir / vars->dependencies()->name()),
EInstalledRepositoryIDData::get_instance()->build_dependencies_labels, mkt_dependencies);
- add_metadata_key(_imp->keys->raw_dependencies);
-
- _imp->keys->build_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".DEPEND",
- vars->dependencies()->description() + " (build)", rewriter.depend(),
- EInstalledRepositoryIDData::get_instance()->build_dependencies_labels, mkt_internal);
- add_metadata_key(_imp->keys->build_dependencies);
-
- _imp->keys->run_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".RDEPEND",
- vars->dependencies()->description() + " (run)", rewriter.rdepend(),
- EInstalledRepositoryIDData::get_instance()->run_dependencies_labels, mkt_internal);
- add_metadata_key(_imp->keys->run_dependencies);
-
- _imp->keys->post_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".PDEPEND",
- vars->dependencies()->description() + " (post)", rewriter.pdepend(),
- EInstalledRepositoryIDData::get_instance()->post_dependencies_labels, mkt_internal);
- add_metadata_key(_imp->keys->post_dependencies);
+ add_metadata_key(_imp->keys->dependencies);
}
}
else
@@ -788,7 +767,7 @@ const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
EInstalledRepositoryID::dependencies_key() const
{
need_keys_added();
- return _imp->keys->raw_dependencies;
+ return _imp->keys->dependencies;
}
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
diff --git a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc
deleted file mode 100644
index 5fd479c..0000000
--- a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/repositories/e/e_repository.hh>
-#include <paludis/repositories/e/e_repository_exceptions.hh>
-#include <paludis/repositories/e/e_repository_id.hh>
-#include <paludis/repositories/e/vdb_repository.hh>
-#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
-#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/map.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/standard_output_manager.hh>
-#include <paludis/util/safe_ifstream.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/action.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/selection.hh>
-#include <paludis/repository_factory.hh>
-#include <paludis/choice.hh>
-#include <paludis/unformatted_pretty_printer.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <functional>
-#include <set>
-#include <string>
-
-#include "config.h"
-
-using namespace test;
-using namespace paludis;
-
-namespace
-{
- void cannot_uninstall(const std::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
- {
- if (id)
- throw InternalError(PALUDIS_HERE, "cannot uninstall");
- }
-
- std::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
- {
- return std::make_shared<StandardOutputManager>();
- }
-
- std::string from_keys(const std::shared_ptr<const Map<std::string, std::string> > & m,
- const std::string & k)
- {
- Map<std::string, std::string>::ConstIterator mm(m->find(k));
- if (m->end() == mm)
- return "";
- else
- return mm->second;
- }
-
- WantPhase want_all_phases(const std::string &)
- {
- return wp_yes;
- }
-}
-
-namespace test_cases
-{
- struct ERepositoryDependenciesRewriterTest : TestCase
- {
- ERepositoryDependenciesRewriterTest() : TestCase("dependencies_rewriter") { }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
- keys->insert("format", "e");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_dependencies_rewriter_dir" / "repo"));
- keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_dependencies_rewriter_dir" / "repo/profiles/profile"));
- keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_dependencies_rewriter_dir" / "build"));
- std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("category/package",
- &env, { })), make_null_shared_ptr(), { }))]->last());
-
- UnformattedPrettyPrinter ff;
-
- erepository::SpecTreePrettyPrinter pd(ff, { });
- TEST_CHECK(bool(id->build_dependencies_key()));
- id->build_dependencies_key()->value()->top()->accept(pd);
- TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build+run: cat/pkg3 suggestion: post: )");
-
- erepository::SpecTreePrettyPrinter pr(ff, { });
- TEST_CHECK(bool(id->run_dependencies_key()));
- id->run_dependencies_key()->value()->top()->accept(pr);
- TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build+run: cat/pkg3 suggestion: post: )");
-
- erepository::SpecTreePrettyPrinter pp(ff, { });
- TEST_CHECK(bool(id->post_dependencies_key()));
- id->post_dependencies_key()->value()->top()->accept(pp);
- TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build+run: suggestion: cat/pkg4 post: cat/pkg5 )");
- }
- } test_e_repository_dependencies_rewriter;
-}
-
diff --git a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_cleanup.sh b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_cleanup.sh
deleted file mode 100755
index 713193b..0000000
--- a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_cleanup.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d e_repository_TEST_dependencies_rewriter_dir ] ; then
- rm -fr e_repository_TEST_dependencies_rewriter_dir
-else
- true
-fi
-
diff --git a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_setup.sh b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_setup.sh
deleted file mode 100755
index c3431eb..0000000
--- a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter_setup.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir e_repository_TEST_dependencies_rewriter_dir || exit 1
-cd e_repository_TEST_dependencies_rewriter_dir || exit 1
-
-mkdir -p root/etc
-
-mkdir -p vdb
-touch vdb/THISISTHEVDB
-
-mkdir -p build
-ln -s build symlinked_build
-
-mkdir -p distdir
-echo "already fetched" > distdir/already-fetched.txt || exit 1
-cat <<END > distdir/expatch-success-1.patch || exit 1
---- a/bar
-+++ b/bar
-@@ -1 +1,3 @@
- foo
-+bar
-+baz
-END
-
-mkdir -p repo/{eclass,distfiles,profiles/profile} || exit 1
-mkdir -p repo/category/package || exit 1
-cd repo || exit 1
-echo "test-repo" >> profiles/repo_name || exit 1
-echo "category" >> profiles/categories || exit 1
-cat <<END > profiles/profile/make.defaults
-ARCH=test
-END
-cat <<END > category/package/package-1.ebuild || exit 1
-EAPI="exheres-0"
-SLOT="0"
-PLATFORMS="test"
-DEPENDENCIES="cat/pkg1 build: cat/pkg2 build+run: cat/pkg3 suggestion: cat/pkg4 post: cat/pkg5"
-END
-cd ..
-
-cd ..
-
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 13d802a..2a1fa5c 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -23,7 +23,6 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/pipe_command_handler.hh>
-#include <paludis/repositories/e/dependencies_rewriter.hh>
#include <paludis/util/system.hh>
#include <paludis/util/process.hh>
@@ -549,15 +548,7 @@ EbuildMetadataCommand::load(const std::shared_ptr<const EbuildID> & id)
}
if (! m.dependencies()->name().empty())
- {
- DependenciesRewriter rewriter;
- std::string dep_s(get(keys, m.dependencies()->name()));
- parse_depend(dep_s, params.environment(), *id->eapi(), id->is_installed())->top()->accept(rewriter);
- id->load_raw_depend(m.dependencies()->name(), m.dependencies()->description(), dep_s);
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend(), true);
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend(), true);
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend(), true);
- }
+ id->load_dependencies(m.dependencies()->name(), m.dependencies()->description(), get(keys, m.dependencies()->name()));
else
{
if (! m.build_depend()->name().empty())
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 9d40bec..bafd432 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -31,7 +31,6 @@
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_error.hh>
#include <paludis/repositories/e/dep_parser.hh>
-#include <paludis/repositories/e/dependencies_rewriter.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/util/pimp-impl.hh>
@@ -179,15 +178,8 @@ namespace
}
if (-1 != m.dependencies()->flat_list_index() && ! m.dependencies()->name().empty())
- {
- DependenciesRewriter rewriter;
- parse_depend(lines.at(m.dependencies()->flat_list_index()), _imp->env, *id->eapi(), false)->top()->accept(rewriter);
- id->load_raw_depend(m.dependencies()->name(), m.dependencies()->description(),
+ id->load_dependencies(m.dependencies()->name(), m.dependencies()->description(),
lines.at(m.dependencies()->flat_list_index()));
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend(), true);
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend(), true);
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend(), true);
- }
if (-1 != m.build_depend()->flat_list_index() && ! m.build_depend()->name().empty())
id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), lines.at(m.build_depend()->flat_list_index()), false);
@@ -522,15 +514,8 @@ EbuildFlatMetadataCache::load(const std::shared_ptr<const EbuildID> & id, const
}
if (! m.dependencies()->name().empty())
- {
- DependenciesRewriter rewriter;
- parse_depend(keys[m.dependencies()->name()], _imp->env, *id->eapi(), false)->top()->accept(rewriter);
- id->load_raw_depend(m.dependencies()->name(), m.dependencies()->description(),
+ id->load_dependencies(m.dependencies()->name(), m.dependencies()->description(),
keys[m.dependencies()->name()]);
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend(), true);
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend(), true);
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend(), true);
- }
if (! m.build_depend()->name().empty())
id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), keys[m.build_depend()->name()], false);
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index d0dc8a6..d4c9d27 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -135,7 +135,7 @@ namespace paludis
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description;
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stdout_key;
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stderr_key;
- mutable std::shared_ptr<const EDependenciesKey> raw_dependencies;
+ mutable std::shared_ptr<const EDependenciesKey> dependencies;
mutable std::shared_ptr<const EDependenciesKey> build_dependencies;
mutable std::shared_ptr<const EDependenciesKey> run_dependencies;
mutable std::shared_ptr<const EDependenciesKey> post_dependencies;
@@ -787,7 +787,7 @@ const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
EbuildID::dependencies_key() const
{
need_keys_added();
- return _imp->raw_dependencies;
+ return _imp->dependencies;
}
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
@@ -968,12 +968,12 @@ EbuildID::load_long_description(const std::string & r, const std::string & h, co
}
void
-EbuildID::load_raw_depend(const std::string & r, const std::string & h, const std::string & v) const
+EbuildID::load_dependencies(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->raw_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
+ _imp->dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
EbuildIDData::get_instance()->raw_dependencies_labels, mkt_dependencies);
- add_metadata_key(_imp->raw_dependencies);
+ add_metadata_key(_imp->dependencies);
}
void
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 2558371..8691c21 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -121,7 +121,7 @@ namespace paludis
void load_short_description(const std::string &, const std::string &, const std::string &) const;
void load_captured_stdout(const std::string &, const std::string &, const MetadataKeyType, const std::string &) const;
void load_captured_stderr(const std::string &, const std::string &, const MetadataKeyType, const std::string &) const;
- void load_raw_depend(const std::string &, const std::string &, const std::string &) const;
+ void load_dependencies(const std::string &, const std::string &, const std::string &) const;
void load_build_depend(const std::string &, const std::string &, const std::string &,
const bool rewritten) const;
void load_run_depend(const std::string &, const std::string &, const std::string &,
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index e28ba6f..94712b8 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -258,47 +258,6 @@ namespace test_cases
}
} vdb_repository_contents_test;
- struct VDBRepositoryDependenciesRewriterTest : TestCase
- {
- VDBRepositoryDependenciesRewriterTest() : TestCase("dependencies_rewriter") { }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
- keys->insert("format", "vdb");
- keys->insert("names_cache", "/var/empty");
- keys->insert("provides_cache", "/var/empty");
- keys->insert("location", stringify(FSPath::cwd() / "vdb_repository_TEST_dir" / "repo2"));
- keys->insert("builddir", stringify(FSPath::cwd() / "vdb_repository_TEST_dir" / "build"));
- std::shared_ptr<Repository> repo(VDBRepository::VDBRepository::repository_factory_create(&env,
- std::bind(from_keys, keys, std::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("category/package",
- &env, { })), make_null_shared_ptr(), { }))]->begin());
-
- UnformattedPrettyPrinter ff;
-
- erepository::SpecTreePrettyPrinter pd(ff, { });
- TEST_CHECK(bool(id->build_dependencies_key()));
- id->build_dependencies_key()->value()->top()->accept(pd);
- TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build+run: cat/pkg3 suggestion: post: )");
-
- erepository::SpecTreePrettyPrinter pr(ff, { });
- TEST_CHECK(bool(id->run_dependencies_key()));
- id->run_dependencies_key()->value()->top()->accept(pr);
- TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build+run: cat/pkg3 suggestion: post: )");
-
- erepository::SpecTreePrettyPrinter pp(ff, { });
- TEST_CHECK(bool(id->post_dependencies_key()));
- id->post_dependencies_key()->value()->top()->accept(pp);
- TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build+run: suggestion: cat/pkg4 post: cat/pkg5 )");
- }
- } test_vdb_repository_dependencies_rewriter;
-
struct PhasesTest : TestCase
{
const std::string eapi;
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 67a746a..451ed5c 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -385,14 +385,14 @@ module Paludis
end
def spec_key
- env[Selection::RequireExactlyOne.new(Generator::Package.new("bar/foo"))].last.build_dependencies_key
+ env[Selection::RequireExactlyOne.new(Generator::Package.new("bar/foo"))].last.dependencies_key
end
def test_initial_labels
assert_kind_of Array, spec_key.initial_labels
assert_kind_of DependenciesBuildLabel, spec_key.initial_labels[0]
- assert_equal "DEPEND", spec_key.initial_labels[0].text
- assert_equal "DEPEND", spec_key.initial_labels[0].to_s
+ assert_equal "build", spec_key.initial_labels[0].text
+ assert_equal "build", spec_key.initial_labels[0].to_s
end
end
end
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index e7ba44b..f8e9b8c 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -402,6 +402,14 @@ namespace
* What we are a virtual for
*/
/*
+ * Document-method: dependencies_key
+ *
+ * call-seq:
+ * dependencies_key -> MetadataDependencySpecTreeKey
+ *
+ * Our dependencies
+ */
+ /*
* Document-method: build_dependencies_key
*
* call-seq:
@@ -514,6 +522,8 @@ namespace
rb_define_method(c_package_id, "keywords_key", RUBY_FUNC_CAST((&KeyValue<MetadataCollectionKey<KeywordNameSet>,&PackageID::keywords_key>::fetch)), 0);
rb_define_method(c_package_id, "provide_key", RUBY_FUNC_CAST((
&KeyValue<MetadataSpecTreeKey<ProvideSpecTree>, &PackageID::provide_key>::fetch)), 0);
+ rb_define_method(c_package_id, "dependencies_key", RUBY_FUNC_CAST((
+ &KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::dependencies_key>::fetch)), 0);
rb_define_method(c_package_id, "build_dependencies_key", RUBY_FUNC_CAST((
&KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::build_dependencies_key>::fetch)), 0);
rb_define_method(c_package_id, "run_dependencies_key", RUBY_FUNC_CAST((