aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-01 00:10:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-01 00:10:35 +0000
commitd10178c32cc88440c5e9182c87ef0a4a5900c89f (patch)
tree9750f7ca024bdae8b6c80d8be109e2202f73c86d
parent9f8589b844f7aa6467b80180a24caee7616f4a9a (diff)
downloadpaludis-d10178c32cc88440c5e9182c87ef0a4a5900c89f.tar.gz
paludis-d10178c32cc88440c5e9182c87ef0a4a5900c89f.tar.xz
More flexible cache, work for EAPIs that aren't 0/1. Fixes: ticket:482
-rw-r--r--paludis/repositories/e/eapi.cc18
-rw-r--r--paludis/repositories/e/eapi.sr19
-rw-r--r--paludis/repositories/e/eapis/0.conf19
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf19
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf19
-rw-r--r--paludis/repositories/e/eapis/pbin-1+0.conf4
-rw-r--r--paludis/repositories/e/eapis/pbin-1+1.conf3
-rw-r--r--paludis/repositories/e/eapis/pbin-1+exheres-0.conf3
-rw-r--r--paludis/repositories/e/eapis/pbin-1+paludis-1.conf3
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc293
10 files changed, 308 insertions, 92 deletions
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index ea8f83c..3880155 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -195,6 +195,24 @@ namespace paludis
.description_eapi(k.get("description_eapi"))
.description_dependencies(k.get("description_dependencies"))
.description_use(k.get("description_use"))
+ .flat_cache_build_depend(destringify<int>(k.get("flat_cache_build_depend")))
+ .flat_cache_run_depend(destringify<int>(k.get("flat_cache_run_depend")))
+ .flat_cache_slot(destringify<int>(k.get("flat_cache_slot")))
+ .flat_cache_src_uri(destringify<int>(k.get("flat_cache_src_uri")))
+ .flat_cache_restrict(destringify<int>(k.get("flat_cache_restrict")))
+ .flat_cache_homepage(destringify<int>(k.get("flat_cache_homepage")))
+ .flat_cache_license(destringify<int>(k.get("flat_cache_license")))
+ .flat_cache_description(destringify<int>(k.get("flat_cache_description")))
+ .flat_cache_keywords(destringify<int>(k.get("flat_cache_keywords")))
+ .flat_cache_eclass_keywords(destringify<int>(k.get("flat_cache_eclass_keywords")))
+ .flat_cache_inherited(destringify<int>(k.get("flat_cache_inherited")))
+ .flat_cache_iuse(destringify<int>(k.get("flat_cache_iuse")))
+ .flat_cache_pdepend(destringify<int>(k.get("flat_cache_pdepend")))
+ .flat_cache_provide(destringify<int>(k.get("flat_cache_provide")))
+ .flat_cache_eapi(destringify<int>(k.get("flat_cache_eapi")))
+ .flat_cache_dependencies(destringify<int>(k.get("flat_cache_dependencies")))
+ .flat_cache_use(destringify<int>(k.get("flat_cache_use")))
+ .flat_cache_minimum_size(destringify<int>(k.get("flat_cache_minimum_size")))
)))
.ebuild_environment_variables(make_shared_ptr(new EAPIEbuildEnvironmentVariables(
diff --git a/paludis/repositories/e/eapi.sr b/paludis/repositories/e/eapi.sr
index 21c3346..4ffa16c 100644
--- a/paludis/repositories/e/eapi.sr
+++ b/paludis/repositories/e/eapi.sr
@@ -67,6 +67,25 @@ make_class_EAPIEbuildMetadataVariables()
key description_dependencies std::string
key description_use std::string
+ key flat_cache_minimum_size int
+ key flat_cache_build_depend int
+ key flat_cache_run_depend int
+ key flat_cache_slot int
+ key flat_cache_src_uri int
+ key flat_cache_restrict int
+ key flat_cache_homepage int
+ key flat_cache_license int
+ key flat_cache_description int
+ key flat_cache_keywords int
+ key flat_cache_eclass_keywords int
+ key flat_cache_inherited int
+ key flat_cache_iuse int
+ key flat_cache_pdepend int
+ key flat_cache_provide int
+ key flat_cache_eapi int
+ key flat_cache_dependencies int
+ key flat_cache_use int
+
doxygen_comment << "END"
/**
* Information about a supported EAPI's ebuild metadata variables.
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 47f117b..6cfe7c3 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -145,6 +145,25 @@ metadata_run_depend = RDEPEND
metadata_slot = SLOT
metadata_src_uri = SRC_URI
+flat_cache_minimum_size = 15
+flat_cache_build_depend = 0
+flat_cache_description = 7
+flat_cache_eapi = 14
+flat_cache_eclass_keywords = -1
+flat_cache_dependencies = -1
+flat_cache_homepage = 5
+flat_cache_inherited = 9
+flat_cache_iuse = 10
+flat_cache_keywords = 8
+flat_cache_license = 6
+flat_cache_pdepend = 12
+flat_cache_provide = 13
+flat_cache_restrict = 4
+flat_cache_run_depend = 1
+flat_cache_slot = 2
+flat_cache_src_uri = 3
+flat_cache_use = -1
+
env_use = USE
env_use_expand = USE_EXPAND
env_use_expand_hidden = USE_EXPAND_HIDDEN
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 5ed14c9..1b305f9 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -152,6 +152,25 @@ description_src_uri = Source URI
description_use = Selected option flags
description_dependencies = Dependencies
+flat_cache_minimum_size = 15
+flat_cache_build_depend = -1
+flat_cache_description = 7
+flat_cache_eapi = 14
+flat_cache_dependencies = 1
+flat_cache_eclass_keywords = 11
+flat_cache_homepage = 5
+flat_cache_inherited = 9
+flat_cache_iuse = 10
+flat_cache_keywords = 8
+flat_cache_license = 6
+flat_cache_pdepend = -1
+flat_cache_provide = -1
+flat_cache_restrict = 4
+flat_cache_run_depend = -1
+flat_cache_slot = 2
+flat_cache_src_uri = 3
+flat_cache_use = -1
+
env_use = OPTIONS
env_use_expand = SUBOPTIONS
env_use_expand_hidden = HIDDEN_SUBOPTIONS
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 8c6e852..34f73c6 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -151,6 +151,25 @@ description_slot = Slot
description_src_uri = Source URI
description_use = Selected USE flags
+flat_cache_minimum_size = 15
+flat_cache_build_depend = 0
+flat_cache_description = 7
+flat_cache_eapi = 14
+flat_cache_eclass_keywords = -1
+flat_cache_dependencies = -1
+flat_cache_homepage = 5
+flat_cache_inherited = 9
+flat_cache_iuse = 10
+flat_cache_keywords = 8
+flat_cache_license = 6
+flat_cache_pdepend = 12
+flat_cache_provide = 13
+flat_cache_restrict = 4
+flat_cache_run_depend = 1
+flat_cache_slot = 2
+flat_cache_src_uri = 3
+flat_cache_use = -1
+
env_use = USE
env_use_expand = USE_EXPAND
env_use_expand_hidden = USE_EXPAND_HIDDEN
diff --git a/paludis/repositories/e/eapis/pbin-1+0.conf b/paludis/repositories/e/eapis/pbin-1+0.conf
index bae0552..d6043c4 100644
--- a/paludis/repositories/e/eapis/pbin-1+0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+0.conf
@@ -34,3 +34,7 @@ metadata_generated_time = GENERATED_TIME
metadata_keywords = BINARY_KEYWORDS
metadata_src_uri = BINARY_URI
metadata_use = USE
+
+flat_cache_minimum_size = 16
+flat_cache_use = 15
+
diff --git a/paludis/repositories/e/eapis/pbin-1+1.conf b/paludis/repositories/e/eapis/pbin-1+1.conf
index 1b4dd94..291f4e7 100644
--- a/paludis/repositories/e/eapis/pbin-1+1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+1.conf
@@ -35,3 +35,6 @@ metadata_keywords = BINARY_KEYWORDS
metadata_src_uri = BINARY_URI
metadata_use = USE
+flat_cache_minimum_size = 16
+flat_cache_use = 15
+
diff --git a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
index 087caed..ffed67c 100644
--- a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
@@ -34,3 +34,6 @@ metadata_generated_time = GENERATED_TIME
metadata_keywords = BINARY_PLATFORMS
metadata_src_uri = BINARY_URI
metadata_use = OPTIONS
+
+flat_cache_use = 12
+
diff --git a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
index acb7f36..2e2f270 100644
--- a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
@@ -35,3 +35,6 @@ metadata_keywords = BINARY_KEYWORDS
metadata_src_uri = BINARY_URI
metadata_use = USE
+flat_cache_minimum_size = 16
+flat_cache_use = 15
+
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index d4eb0a0..ecdd026 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * 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
@@ -24,6 +24,8 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/dependencies_rewriter.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/tr1_functional.hh>
@@ -89,33 +91,73 @@ EbuildFlatMetadataCache::load(const tr1::shared_ptr<const EbuildID> & id)
}
if (ok)
+ ok = static_cast<int>(lines.size()) >= m.flat_cache_minimum_size;
+
+ if (ok)
{
- if (! m.metadata_build_depend.empty())
- id->load_build_depend(m.metadata_build_depend, m.description_build_depend, lines[0]);
- if (! m.metadata_run_depend.empty())
- id->load_run_depend(m.metadata_run_depend, m.description_run_depend, lines[1]);
- id->set_slot(SlotName(lines[2]));
- if (! m.metadata_src_uri.empty())
- id->load_src_uri(m.metadata_src_uri, m.description_src_uri, lines[3]);
- if (! m.metadata_restrict.empty())
- id->load_restrict(m.metadata_restrict, m.description_restrict, lines[4]);
- if (! m.metadata_homepage.empty())
- id->load_homepage(m.metadata_homepage, m.description_homepage, lines[5]);
- if (! m.metadata_license.empty())
- id->load_license(m.metadata_license, m.description_license, lines[6]);
- if (! m.metadata_description.empty())
- id->load_short_description(m.metadata_description, m.description_description, lines[7]);
- if (! m.metadata_keywords.empty())
- id->load_keywords(m.metadata_keywords, m.description_keywords, lines[8]);
- if (! m.metadata_inherited.empty())
- id->load_inherited(m.metadata_inherited, m.description_inherited, lines[9]);
- if (! m.metadata_iuse.empty())
- id->load_iuse(m.metadata_iuse, m.description_iuse, lines[10]);
- /* 11 no longer used */
- if (! m.metadata_pdepend.empty())
- id->load_post_depend(m.metadata_pdepend, m.description_pdepend, lines[12]);
- if (! m.metadata_provide.empty())
- id->load_provide(m.metadata_provide, m.description_provide, lines[13]);
+ if (-1 != m.flat_cache_dependencies)
+ if (! m.metadata_dependencies.empty())
+ {
+ DependenciesRewriter rewriter;
+ parse_depend(lines.at(m.flat_cache_dependencies), *id->eapi(), id)->accept(rewriter);
+ id->load_build_depend(m.metadata_dependencies + ".DEPEND", m.description_dependencies + " (build)", rewriter.depend());
+ id->load_run_depend(m.metadata_dependencies + ".RDEPEND", m.description_dependencies + " (run)", rewriter.rdepend());
+ id->load_post_depend(m.metadata_dependencies + ".PDEPEND", m.description_dependencies + " (post)", rewriter.pdepend());
+ }
+
+ if (-1 != m.flat_cache_build_depend)
+ if (! m.metadata_build_depend.empty())
+ id->load_build_depend(m.metadata_build_depend, m.description_build_depend, lines.at(m.flat_cache_build_depend));
+
+ if (-1 != m.flat_cache_run_depend)
+ if (! m.metadata_run_depend.empty())
+ id->load_run_depend(m.metadata_run_depend, m.description_run_depend, lines.at(m.flat_cache_run_depend));
+
+ id->set_slot(SlotName(lines.at(m.flat_cache_slot)));
+
+ if (-1 != m.flat_cache_src_uri)
+ if (! m.metadata_src_uri.empty())
+ id->load_src_uri(m.metadata_src_uri, m.description_src_uri, lines.at(m.flat_cache_src_uri));
+
+ if (-1 != m.flat_cache_restrict)
+ if (! m.metadata_restrict.empty())
+ id->load_restrict(m.metadata_restrict, m.description_restrict, lines.at(m.flat_cache_restrict));
+
+ if (-1 != m.flat_cache_homepage)
+ if (! m.metadata_homepage.empty())
+ id->load_homepage(m.metadata_homepage, m.description_homepage, lines.at(m.flat_cache_homepage));
+
+ if (-1 != m.flat_cache_license)
+ if (! m.metadata_license.empty())
+ id->load_license(m.metadata_license, m.description_license, lines.at(m.flat_cache_license));
+
+ if (-1 != m.flat_cache_description)
+ if (! m.metadata_description.empty())
+ id->load_short_description(m.metadata_description, m.description_description, lines.at(m.flat_cache_description));
+
+ if (-1 != m.flat_cache_keywords)
+ if (! m.metadata_keywords.empty())
+ id->load_keywords(m.metadata_keywords, m.description_keywords, lines.at(m.flat_cache_keywords));
+
+ if (-1 != m.flat_cache_inherited)
+ if (! m.metadata_inherited.empty())
+ id->load_inherited(m.metadata_inherited, m.description_inherited, lines.at(m.flat_cache_inherited));
+
+ if (-1 != m.flat_cache_iuse)
+ if (! m.metadata_iuse.empty())
+ id->load_iuse(m.metadata_iuse, m.description_iuse, lines.at(m.flat_cache_iuse));
+
+ if (-1 != m.flat_cache_pdepend)
+ if (! m.metadata_pdepend.empty())
+ id->load_post_depend(m.metadata_pdepend, m.description_pdepend, lines.at(m.flat_cache_pdepend));
+
+ if (-1 != m.flat_cache_provide)
+ if (! m.metadata_provide.empty())
+ id->load_provide(m.metadata_provide, m.description_provide, lines.at(m.flat_cache_provide));
+
+ if (-1 != m.flat_cache_use)
+ if (! m.metadata_use.empty())
+ id->load_use(m.metadata_use, m.description_use, lines.at(m.flat_cache_use));
}
}
else
@@ -184,75 +226,142 @@ EbuildFlatMetadataCache::save(const tr1::shared_ptr<const EbuildID> & id)
return;
}
+ if (! id->eapi()->supported)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context) << "Not writing cache file to '"
+ << _filename << "' because EAPI '" << id->eapi()->name << "' is not supported";
+ return;
+ }
+
std::ostringstream cache;
try
{
- if (id->build_dependencies_key())
- cache << flatten(id->build_dependencies_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->run_dependencies_key())
- cache << flatten(id->run_dependencies_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- cache << normalise(id->slot()) << std::endl;
-
- if (id->fetches_key())
- cache << flatten(id->fetches_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->restrict_key())
- cache << flatten(id->restrict_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->homepage_key())
- cache << flatten(id->homepage_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->license_key())
- cache << flatten(id->license_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->short_description_key())
- cache << normalise(id->short_description_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->keywords_key())
- cache << join(id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), " ") << std::endl;
- else
- cache << std::endl;
-
- if (id->inherited_key())
- cache << join(id->inherited_key()->value()->begin(), id->inherited_key()->value()->end(), " ") << std::endl;
- else
- cache << std::endl;
-
- if (id->iuse_key())
- cache << join(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(), " ") << std::endl;
- else
- cache << std::endl;
-
- cache << std::endl;
-
- if (id->post_dependencies_key())
- cache << flatten(id->post_dependencies_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- if (id->provide_key())
- cache << flatten(id->provide_key()->value()) << std::endl;
- else
- cache << std::endl;
-
- cache << normalise(id->eapi()->name) << std::endl;
+ const EAPIEbuildMetadataVariables & m(*id->eapi()->supported->ebuild_metadata_variables);
+ for (int x(0), x_end(m.flat_cache_minimum_size) ; x != x_end ; ++x)
+ {
+ if (x == m.flat_cache_dependencies)
+ {
+ 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()) + " ");
+
+ cache << s << std::endl;
+ }
+ else if (x == m.flat_cache_eclass_keywords)
+ {
+ if (id->eclass_keywords_key())
+ cache << join(id->eclass_keywords_key()->value()->begin(), id->eclass_keywords_key()->value()->end(), " ") << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_use)
+ {
+ if (id->use_key())
+ cache << join(id->use_key()->value()->begin(), id->use_key()->value()->end(), " ") << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_build_depend)
+ {
+ if (id->build_dependencies_key())
+ cache << flatten(id->build_dependencies_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_run_depend)
+ {
+ if (id->run_dependencies_key())
+ cache << flatten(id->run_dependencies_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_slot)
+ {
+ cache << normalise(id->slot()) << std::endl;
+ }
+ else if (x == m.flat_cache_src_uri)
+ {
+ if (id->fetches_key())
+ cache << flatten(id->fetches_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_restrict)
+ {
+ if (id->restrict_key())
+ cache << flatten(id->restrict_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_homepage)
+ {
+ if (id->homepage_key())
+ cache << flatten(id->homepage_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_license)
+ {
+ if (id->license_key())
+ cache << flatten(id->license_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_description)
+ {
+ if (id->short_description_key())
+ cache << normalise(id->short_description_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_keywords)
+ {
+ if (id->keywords_key())
+ cache << join(id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), " ") << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_inherited)
+ {
+ if (id->inherited_key())
+ cache << join(id->inherited_key()->value()->begin(), id->inherited_key()->value()->end(), " ") << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_iuse)
+ {
+ if (id->iuse_key())
+ cache << join(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(), " ") << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_pdepend)
+ {
+ if (id->post_dependencies_key())
+ cache << flatten(id->post_dependencies_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_provide)
+ {
+ if (id->provide_key())
+ cache << flatten(id->provide_key()->value()) << std::endl;
+ else
+ cache << std::endl;
+ }
+ else if (x == m.flat_cache_eapi)
+ {
+ cache << normalise(id->eapi()->name) << std::endl;
+ }
+ else
+ cache << std::endl;
+ }
}
catch (const Exception & e)
{