aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-03-22 15:17:45 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-03-22 15:17:32 +0000
commit4420b5ced9d425a93123b5c0afe7514cb05b88c3 (patch)
tree7602fb0ad702cef033a46613a64e86f8af0cdd09
parent7d0466af57231a0b727f4a619434fb80bbbbc5ff (diff)
downloadpaludis-4420b5ced9d425a93123b5c0afe7514cb05b88c3.tar.gz
paludis-4420b5ced9d425a93123b5c0afe7514cb05b88c3.tar.xz
Change how we store that icky DEPENDENCIES mess.
Rather than storing only generated DEPENDENCIES and hopping back and forth all over the place, store both the real DEPENDENCIES (and make that user-visible) and generated DEPENDENCIES (and make those internal visible).
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc21
-rw-r--r--paludis/repositories/e/ebuild.cc16
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc45
-rw-r--r--paludis/repositories/e/ebuild_id.cc37
-rw-r--r--paludis/repositories/e/ebuild_id.hh11
5 files changed, 92 insertions, 38 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 8c228d6..7ccb910 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -87,6 +87,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices;
std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license;
std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide;
+ std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > raw_dependencies;
std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies;
std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies;
std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > post_dependencies;
@@ -116,6 +117,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<std::string> > pkgmanager;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > vdb_format;
+ std::tr1::shared_ptr<DependencyLabelSequence> raw_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
@@ -129,10 +131,14 @@ namespace paludis
repository(r),
dir(f),
has_keys(false),
+ raw_dependencies_labels(new DependencyLabelSequence),
build_dependencies_labels(new DependencyLabelSequence),
run_dependencies_labels(new DependencyLabelSequence),
post_dependencies_labels(new DependencyLabelSequence)
{
+ raw_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build")));
+ raw_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("run")));
+
build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
post_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("PDEPEND")));
@@ -282,18 +288,25 @@ EInstalledRepositoryID::need_keys_added() const
if ((_imp->dir / vars->dependencies()->name()).exists())
{
DependenciesRewriter rewriter;
- parse_depend(file_contents(_imp->dir / vars->dependencies()->name()), _imp->environment, shared_from_this(), *eapi())->root()->accept(rewriter);
+ std::string raw_deps_str(file_contents(_imp->dir / vars->dependencies()->name()));
+ std::tr1::shared_ptr<DependencySpecTree> raw_deps(parse_depend(raw_deps_str,
+ _imp->environment, shared_from_this(), *eapi()));
+ raw_deps->root()->accept(rewriter);
+
+ _imp->raw_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->dependencies()->name(),
+ vars->dependencies()->description(), raw_deps_str, _imp->build_dependencies_labels, mkt_dependencies));
+ add_metadata_key(_imp->raw_dependencies);
_imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".DEPEND",
- vars->dependencies()->description() + " (build)", rewriter.depend(), _imp->build_dependencies_labels, mkt_dependencies));
+ vars->dependencies()->description() + " (build)", rewriter.depend(), _imp->build_dependencies_labels, mkt_internal));
add_metadata_key(_imp->build_dependencies);
_imp->run_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".RDEPEND",
- vars->dependencies()->description() + " (run)", rewriter.rdepend(), _imp->build_dependencies_labels, mkt_dependencies));
+ vars->dependencies()->description() + " (run)", rewriter.rdepend(), _imp->build_dependencies_labels, mkt_internal));
add_metadata_key(_imp->run_dependencies);
_imp->post_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".PDEPEND",
- vars->dependencies()->description() + " (post)", rewriter.pdepend(), _imp->build_dependencies_labels, mkt_dependencies));
+ vars->dependencies()->description() + " (post)", rewriter.pdepend(), _imp->build_dependencies_labels, mkt_internal));
add_metadata_key(_imp->post_dependencies);
}
}
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index cc1f694..3aa5e39 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -454,21 +454,23 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.dependencies()->name().empty())
{
DependenciesRewriter rewriter;
- parse_depend(get(keys, m.dependencies()->name()), params.environment(), id, *id->eapi())->root()->accept(rewriter);
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend());
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend());
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend());
+ std::string dep_s(get(keys, m.dependencies()->name()));
+ parse_depend(dep_s, params.environment(), id, *id->eapi())->root()->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);
}
else
{
if (! m.build_depend()->name().empty())
- id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), get(keys, m.build_depend()->name()));
+ id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), get(keys, m.build_depend()->name()), false);
if (! m.run_depend()->name().empty())
- id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), get(keys, m.run_depend()->name()));
+ id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), get(keys, m.run_depend()->name()), false);
if (! m.pdepend()->name().empty())
- id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), get(keys, m.pdepend()->name()));
+ id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), get(keys, m.pdepend()->name()), false);
}
if (! m.slot()->name().empty())
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 79673b4..c3b1940 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -172,16 +172,18 @@ namespace
{
DependenciesRewriter rewriter;
parse_depend(lines.at(m.dependencies()->flat_list_index()), _imp->env, id, *id->eapi())->root()->accept(rewriter);
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend());
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend());
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend());
+ id->load_raw_depend(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()));
+ id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), lines.at(m.build_depend()->flat_list_index()), false);
if (-1 != m.run_depend()->flat_list_index() && ! m.run_depend()->name().empty())
- id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), lines.at(m.run_depend()->flat_list_index()));
+ id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), lines.at(m.run_depend()->flat_list_index()), false);
id->load_slot(m.slot(), lines.at(m.slot()->flat_list_index()));
@@ -231,7 +233,7 @@ namespace
id->load_myoptions(m.myoptions()->name(), m.myoptions()->description(), lines.at(m.myoptions()->flat_list_index()));
if (-1 != m.pdepend()->flat_list_index() && ! m.pdepend()->name().empty())
- id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), lines.at(m.pdepend()->flat_list_index()));
+ id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), lines.at(m.pdepend()->flat_list_index()), false);
if (-1 != m.provide()->flat_list_index() && ! m.provide()->name().empty())
id->load_provide(m.provide()->name(), m.provide()->description(), lines.at(m.provide()->flat_list_index()));
@@ -503,16 +505,18 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
{
DependenciesRewriter rewriter;
parse_depend(keys[m.dependencies()->name()], _imp->env, id, *id->eapi())->root()->accept(rewriter);
- id->load_build_depend(m.dependencies()->name() + ".DEPEND", m.dependencies()->description() + " (build)", rewriter.depend());
- id->load_run_depend(m.dependencies()->name() + ".RDEPEND", m.dependencies()->description() + " (run)", rewriter.rdepend());
- id->load_post_depend(m.dependencies()->name() + ".PDEPEND", m.dependencies()->description() + " (post)", rewriter.pdepend());
+ id->load_raw_depend(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()]);
+ id->load_build_depend(m.build_depend()->name(), m.build_depend()->description(), keys[m.build_depend()->name()], false);
if (! m.run_depend()->name().empty())
- id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), keys[m.run_depend()->name()]);
+ id->load_run_depend(m.run_depend()->name(), m.run_depend()->description(), keys[m.run_depend()->name()], false);
id->load_slot(m.slot(), keys[m.slot()->name()]);
@@ -561,7 +565,7 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
id->load_myoptions(m.myoptions()->name(), m.myoptions()->description(), keys[m.myoptions()->name()]);
if (! m.pdepend()->name().empty())
- id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), keys[m.pdepend()->name()]);
+ id->load_post_depend(m.pdepend()->name(), m.pdepend()->description(), keys[m.pdepend()->name()], false);
if (! m.provide()->name().empty())
id->load_provide(m.provide()->name(), m.provide()->description(), keys[m.provide()->name()]);
@@ -718,12 +722,17 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
{
std::string s;
- if (id->build_dependencies_key())
- s.append(flatten(id->build_dependencies_key()->value()) + " ");
- if (id->run_dependencies_key())
- s.append(flatten(id->run_dependencies_key()->value()) + " ");
- if (id->post_dependencies_key())
- s.append(flatten(id->post_dependencies_key()->value()) + " ");
+ if (id->raw_dependencies_key())
+ s.append(flatten(id->raw_dependencies_key()->value()));
+ else
+ {
+ if (id->build_dependencies_key())
+ s.append(flatten(id->build_dependencies_key()->value()) + " ");
+ if (id->run_dependencies_key())
+ s.append(flatten(id->run_dependencies_key()->value()) + " ");
+ if (id->post_dependencies_key())
+ s.append(flatten(id->post_dependencies_key()->value()) + " ");
+ }
write_kv(cache, m.dependencies()->name(), s);
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3613928..4009201 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -82,6 +82,7 @@ namespace paludis
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > short_description;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stderr_key;
+ mutable std::tr1::shared_ptr<const EDependenciesKey> raw_dependencies;
mutable std::tr1::shared_ptr<const EDependenciesKey> build_dependencies;
mutable std::tr1::shared_ptr<const EDependenciesKey> run_dependencies;
mutable std::tr1::shared_ptr<const EDependenciesKey> post_dependencies;
@@ -108,6 +109,7 @@ namespace paludis
mutable std::tr1::shared_ptr<const EChoicesKey> choices;
mutable std::tr1::shared_ptr<const EStringSetKey> defined_phases;
+ std::tr1::shared_ptr<DependencyLabelSequence> raw_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> post_dependencies_labels;
@@ -126,10 +128,14 @@ namespace paludis
eclass_mtimes(m),
has_keys(false),
has_masks(false),
+ raw_dependencies_labels(new DependencyLabelSequence),
build_dependencies_labels(new DependencyLabelSequence),
run_dependencies_labels(new DependencyLabelSequence),
post_dependencies_labels(new DependencyLabelSequence)
{
+ raw_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build")));
+ raw_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("run")));
+
build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("RDEPEND")));
post_dependencies_labels->push_back(make_shared_ptr(new DependencyPostLabel("PDEPEND")));
@@ -639,6 +645,13 @@ EbuildID::provide_key() const
}
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+EbuildID::raw_dependencies_key() const
+{
+ need_keys_added();
+ return _imp->raw_dependencies;
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
EbuildID::build_dependencies_key() const
{
need_keys_added();
@@ -808,29 +821,41 @@ EbuildID::load_long_description(const std::string & r, const std::string & h, co
}
void
-EbuildID::load_build_depend(const std::string & r, const std::string & h, const std::string & v) const
+EbuildID::load_raw_depend(const std::string & r, const std::string & h, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->raw_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
+ _imp->raw_dependencies_labels, mkt_dependencies));
+ add_metadata_key(_imp->raw_dependencies);
+}
+
+void
+EbuildID::load_build_depend(const std::string & r, const std::string & h, const std::string & v,
+ bool rewritten) const
{
Lock l(_imp->mutex);
_imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
- _imp->build_dependencies_labels, mkt_dependencies));
+ _imp->build_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies));
add_metadata_key(_imp->build_dependencies);
}
void
-EbuildID::load_run_depend(const std::string & r, const std::string & h, const std::string & v) const
+EbuildID::load_run_depend(const std::string & r, const std::string & h, const std::string & v,
+ bool rewritten) const
{
Lock l(_imp->mutex);
_imp->run_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
- _imp->run_dependencies_labels, mkt_dependencies));
+ _imp->run_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies));
add_metadata_key(_imp->run_dependencies);
}
void
-EbuildID::load_post_depend(const std::string & r, const std::string & h, const std::string & v) const
+EbuildID::load_post_depend(const std::string & r, const std::string & h, const std::string & v,
+ bool rewritten) const
{
Lock l(_imp->mutex);
_imp->post_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), r, h, v,
- _imp->post_dependencies_labels, mkt_dependencies));
+ _imp->post_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies));
add_metadata_key(_imp->post_dependencies);
}
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index a619c79..bef876a 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -97,6 +97,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > raw_dependencies_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > remote_ids_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > bugs_to_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > upstream_changelog_key() const;
@@ -116,9 +117,13 @@ namespace paludis
void load_short_description(const std::string &, const std::string &, const std::string &) const;
void load_captured_stderr(const std::string &, const std::string &, const MetadataKeyType, const std::string &) const;
- void load_build_depend(const std::string &, const std::string &, const std::string &) const;
- void load_run_depend(const std::string &, const std::string &, const std::string &) const;
- void load_post_depend(const std::string &, const std::string &, const std::string &) const;
+ void load_raw_depend(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 &,
+ const bool rewritten) const;
+ void load_post_depend(const std::string &, const std::string &, const std::string &,
+ const bool rewritten) const;
void load_src_uri(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
void load_homepage(const std::string &, const std::string &, const std::string &) const;
void load_license(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;