aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-14 01:58:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-14 01:58:30 +0000
commit6ef6be0f125caea65a9354a62b1efdf8dfb20846 (patch)
tree3dbd3fa37b672a9b8263001562bfc2d0193ab04d
parent88063a9fd59e09c35ec23fe0994a081ec3508d74 (diff)
downloadpaludis-6ef6be0f125caea65a9354a62b1efdf8dfb20846.tar.gz
paludis-6ef6be0f125caea65a9354a62b1efdf8dfb20846.tar.xz
Centralise EAPI information. Fixes: ticket:222
-rw-r--r--paludis/dep_list/dep_list.cc2
-rw-r--r--paludis/dep_spec-fwd.hh68
-rw-r--r--paludis/dep_spec.hh35
-rw-r--r--paludis/eapi-fwd.hh30
-rw-r--r--paludis/eapi.cc77
-rw-r--r--paludis/eapi.hh65
-rw-r--r--paludis/eapi.sr46
-rw-r--r--paludis/environment_implementation.cc8
-rw-r--r--paludis/environment_implementation.hh3
-rw-r--r--paludis/files.m43
-rw-r--r--paludis/qa/create_metadata_check.cc2
-rw-r--r--paludis/qa/parse_deps_check.cc13
-rw-r--r--paludis/repositories/cran/cran_description.cc4
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc2
-rw-r--r--paludis/repositories/cran/cran_repository.cc2
-rw-r--r--paludis/repositories/cran/cran_version_metadata.cc2
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc6
-rw-r--r--paludis/repositories/gems/gems_version_metadata.cc2
-rw-r--r--paludis/repositories/gentoo/ebin.cc2
-rw-r--r--paludis/repositories/gentoo/ebin_entries.cc4
-rw-r--r--paludis/repositories/gentoo/ebuild.cc6
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc2
-rw-r--r--paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc4
-rw-r--r--paludis/repositories/gentoo/portage_repository_TEST.cc9
-rw-r--r--paludis/repositories/gentoo/portage_virtual_version_metadata.cc2
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc2
-rw-r--r--paludis/repositories/gentoo/vdb_version_metadata.cc4
-rw-r--r--paludis/version_metadata.cc52
-rw-r--r--paludis/version_metadata.hh11
-rw-r--r--paludis/version_metadata.sr2
-rw-r--r--python/version_metadata.cc2
-rwxr-xr-xpython/version_metadata_TEST.py2
-rw-r--r--ruby/version_metadata.cc4
-rw-r--r--ruby/version_metadata_TEST.rb2
-rw-r--r--src/clients/contrarius/install.cc2
-rw-r--r--src/clients/paludis/install.cc2
-rw-r--r--src/output/console_install_task.cc2
37 files changed, 363 insertions, 123 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 235a4f8..1e837de 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -123,7 +123,7 @@ namespace
.slot(s)
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.cran_interface(0)
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
new file mode 100644
index 0000000..d159e60
--- /dev/null
+++ b/paludis/dep_spec-fwd.hh
@@ -0,0 +1,68 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_SPEC_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_FWD_HH 1
+
+#include <iosfwd>
+#include <string>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/visitor-fwd.hh>
+
+namespace paludis
+{
+ class DepSpec;
+ class CompositeDepSpec;
+ class PackageDepSpec;
+ class PlainTextDepSpec;
+ class AllDepSpec;
+ class AnyDepSpec;
+ class UseDepSpec;
+ class SetDepSpec;
+ class BlockDepSpec;
+
+#include <paludis/dep_spec-se.hh>
+
+ /**
+ * Visitor types for a visitor that can visit a DepSpec heirarchy.
+ *
+ * \ingroup grpdepspecs
+ */
+ typedef VisitorTypes<PackageDepSpec *, PlainTextDepSpec *, AllDepSpec *, AnyDepSpec *,
+ UseDepSpec *, BlockDepSpec *> DepSpecVisitorTypes;
+
+ /**
+ * A PlainTextDepSpec can be written to an ostream.
+ *
+ * \ingroup grpdepspecs
+ */
+ std::ostream & operator<< (std::ostream &, const PlainTextDepSpec &) PALUDIS_VISIBLE;
+
+ class PackageDepSpecError;
+
+ /**
+ * A PackageDepSpec can be written to an ostream.
+ *
+ * \ingroup grpdepspecs
+ */
+ std::ostream & operator<< (std::ostream &, const PackageDepSpec &) PALUDIS_VISIBLE;
+}
+
+
+#endif
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 507aae9..f9e85c2 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -20,6 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_HH 1
+#include <paludis/dep_spec-fwd.hh>
#include <paludis/dep_tag.hh>
#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
@@ -41,26 +42,6 @@
namespace paludis
{
- class DepSpec;
- class CompositeDepSpec;
- class PackageDepSpec;
- class PlainTextDepSpec;
- class AllDepSpec;
- class AnyDepSpec;
- class UseDepSpec;
- class SetDepSpec;
- class BlockDepSpec;
-
-#include <paludis/dep_spec-se.hh>
-
- /**
- * Visitor types for a visitor that can visit a DepSpec heirarchy.
- *
- * \ingroup grpdepspecs
- */
- typedef VisitorTypes<PackageDepSpec *, PlainTextDepSpec *, AllDepSpec *, AnyDepSpec *,
- UseDepSpec *, BlockDepSpec *> DepSpecVisitorTypes;
-
/**
* Base class for a dependency spec.
*
@@ -450,13 +431,6 @@ namespace paludis
};
/**
- * A PlainTextDepSpec can be written to an ostream.
- *
- * \ingroup grpdepspecs
- */
- std::ostream & operator<< (std::ostream &, const PlainTextDepSpec &) PALUDIS_VISIBLE;
-
- /**
* Thrown if an invalid package dep spec specification is encountered.
*
* \ingroup grpexceptions
@@ -476,13 +450,6 @@ namespace paludis
};
/**
- * A PackageDepSpec can be written to an ostream.
- *
- * \ingroup grpdepspecs
- */
- std::ostream & operator<< (std::ostream &, const PackageDepSpec &) PALUDIS_VISIBLE;
-
- /**
* A BlockDepSpec represents a block on a package name (for example,
* 'app-editors/vim'), possibly with associated version and SLOT
* restrictions.
diff --git a/paludis/eapi-fwd.hh b/paludis/eapi-fwd.hh
new file mode 100644
index 0000000..bb9d159
--- /dev/null
+++ b/paludis/eapi-fwd.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_EAPI_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_EAPI_FWD_HH 1
+
+namespace paludis
+{
+ class EAPI;
+ class SupportedEAPI;
+ class EAPIData;
+}
+
+#endif
diff --git a/paludis/eapi.cc b/paludis/eapi.cc
new file mode 100644
index 0000000..9455d85
--- /dev/null
+++ b/paludis/eapi.cc
@@ -0,0 +1,77 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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/eapi.hh>
+#include <paludis/name.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/hashed_containers.hh>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<EAPIData>
+ {
+ MakeHashedMap<std::string, EAPI>::Type values;
+
+ Implementation()
+ {
+ values.insert(std::make_pair("0", EAPI("0", std::tr1::shared_ptr<SupportedEAPI>(new SupportedEAPI(
+ pds_pm_eapi_0, pds_pm_eapi_0_strict, iuse_pm_eapi_0, iuse_pm_eapi_0_strict, false)))));
+
+ values.insert(std::make_pair("", EAPI("", std::tr1::shared_ptr<SupportedEAPI>(new SupportedEAPI(
+ pds_pm_eapi_0, pds_pm_eapi_0_strict, iuse_pm_eapi_0, iuse_pm_eapi_0_strict, false)))));
+
+ values.insert(std::make_pair("paludis-1", EAPI("paludis-1", std::tr1::shared_ptr<SupportedEAPI>(new SupportedEAPI(
+ pds_pm_permissive, pds_pm_permissive, iuse_pm_permissive, iuse_pm_permissive, true)))));
+
+ values.insert(std::make_pair("CRAN-1", EAPI("CRAN-1", std::tr1::shared_ptr<SupportedEAPI>(new SupportedEAPI(
+ pds_pm_permissive, pds_pm_permissive, iuse_pm_permissive, iuse_pm_permissive, true)))));
+ }
+ };
+}
+
+#include <paludis/eapi-sr.cc>
+
+EAPIData::EAPIData() :
+ PrivateImplementationPattern<EAPIData>(new Implementation<EAPIData>)
+{
+}
+
+EAPIData::~EAPIData()
+{
+}
+
+EAPI
+EAPIData::eapi_from_string(const std::string & s) const
+{
+ MakeHashedMap<std::string, EAPI>::Type::const_iterator i(_imp->values.find(s));
+ if (i != _imp->values.end())
+ return i->second;
+
+ return EAPI(s, std::tr1::shared_ptr<SupportedEAPI>());
+}
+
+EAPI
+EAPIData::unknown_eapi() const
+{
+ return EAPI("UNKNOWN", std::tr1::shared_ptr<SupportedEAPI>());
+}
+
diff --git a/paludis/eapi.hh b/paludis/eapi.hh
new file mode 100644
index 0000000..0a9b5e3
--- /dev/null
+++ b/paludis/eapi.hh
@@ -0,0 +1,65 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_EAPI_HH
+#define PALUDIS_GUARD_PALUDIS_EAPI_HH 1
+
+#include <paludis/eapi-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/sr.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/name.hh>
+#include <paludis/dep_spec-fwd.hh>
+
+namespace paludis
+{
+#include <paludis/eapi-sr.hh>
+
+ /**
+ * Holds information on recognised EAPIs.
+ *
+ * \see EAPI
+ * \ingroup grpnames
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE EAPIData :
+ private PrivateImplementationPattern<EAPIData>,
+ public InstantiationPolicy<EAPIData, instantiation_method::SingletonTag>
+ {
+ friend class InstantiationPolicy<EAPIData, instantiation_method::SingletonTag>;
+
+ private:
+ EAPIData();
+ ~EAPIData();
+
+ public:
+ /**
+ * Make an EAPI.
+ */
+ EAPI eapi_from_string(const std::string &) const;
+
+ /**
+ * Make the unknown EAPI.
+ */
+ EAPI unknown_eapi() const;
+ };
+}
+
+#endif
diff --git a/paludis/eapi.sr b/paludis/eapi.sr
new file mode 100644
index 0000000..5e927b6
--- /dev/null
+++ b/paludis/eapi.sr
@@ -0,0 +1,46 @@
+make_class_SupportedEAPI()
+{
+ visible
+
+ key package_dep_spec_parse_mode PackageDepSpecParseMode
+ key strict_package_dep_spec_parse_mode PackageDepSpecParseMode
+
+ key iuse_flag_parse_mode IUseFlagParseMode
+ key strict_iuse_flag_parse_mode IUseFlagParseMode
+
+ key breaks_portage bool
+
+ allow_named_args
+
+ doxygen_comment << "END"
+ /**
+ * Information about a supported EAPI.
+ *
+ * \see EAPIData
+ * \see EAPI
+ * \ingroup grpnames
+ * \nosubgrouping
+ */
+END
+}
+
+make_class_EAPI()
+{
+ visible
+
+ key name std::string
+ key supported "std::tr1::shared_ptr<const SupportedEAPI>"
+
+ allow_named_args
+
+ doxygen_comment << "END"
+ /**
+ * Information about an EAPI.
+ *
+ * \see EAPIData
+ * \ingroup grpnames
+ * \nosubgrouping
+ */
+END
+}
+
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index d5f52cf..8bbe7e8 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -22,6 +22,7 @@
#include <paludis/version_metadata.hh>
#include <paludis/package_database.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/eapi.hh>
using namespace paludis;
@@ -91,10 +92,11 @@ namespace
}
};
}
+
bool
-EnvironmentImplementation::accept_eapi(const std::string & e, const PackageDatabaseEntry &) const
+EnvironmentImplementation::accept_eapi(const EAPI & e, const PackageDatabaseEntry &) const
{
- return e == "0" || e == "" || e == "paludis-1" || e == "CRAN-1";
+ return e.supported;
}
bool
@@ -138,7 +140,7 @@ bool
EnvironmentImplementation::breaks_portage(const PackageDatabaseEntry & e, const VersionMetadata & m) const
{
return (e.version.has_try_part() || e.version.has_scm_part()
- || std::string::npos != m.eapi.find("paludis"));
+ || (! m.eapi.supported) || (m.eapi.supported->breaks_portage));
}
EnvironmentImplementation::~EnvironmentImplementation()
diff --git a/paludis/environment_implementation.hh b/paludis/environment_implementation.hh
index 37232ed..88a9895 100644
--- a/paludis/environment_implementation.hh
+++ b/paludis/environment_implementation.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_IMPLEMENTATION_HH 1
#include <paludis/environment.hh>
+#include <paludis/eapi-fwd.hh>
namespace paludis
{
@@ -44,7 +45,7 @@ namespace paludis
*
* Default behaviour: recognised EAPIs accepted.
*/
- virtual bool accept_eapi(const std::string &, const PackageDatabaseEntry &) const
+ virtual bool accept_eapi(const EAPI &, const PackageDatabaseEntry &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
/**
diff --git a/paludis/files.m4 b/paludis/files.m4
index b6c25a0..be5c631 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -11,10 +11,11 @@ dnl on this file at present...
add(`about', `hh', `test')
add(`config_file', `hh', `cc', `se', `test', `testscript')
add(`contents', `hh', `cc')
-add(`dep_spec', `hh', `cc', `se', `test')
+add(`dep_spec', `hh', `cc', `se', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_spec_pretty_printer', `hh', `cc', `test')
add(`dep_tag', `hh', `cc', `sr')
+add(`eapi', `hh', `cc', `fwd', `sr')
add(`environment', `hh', `cc', `se')
add(`environment_implementation', `hh', `cc', `test')
add(`hashed_containers', `hhx', `cc', `test')
diff --git a/paludis/qa/create_metadata_check.cc b/paludis/qa/create_metadata_check.cc
index 4a8da25..7148ed3 100644
--- a/paludis/qa/create_metadata_check.cc
+++ b/paludis/qa/create_metadata_check.cc
@@ -42,7 +42,7 @@ CreateMetadataCheck::operator() (const EbuildCheckData & e) const
std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- if ("UNKNOWN" == metadata->eapi)
+ if (! metadata->eapi.supported)
result << Message(qal_fatal, "Couldn't generate metadata");
}
catch (const InternalError &)
diff --git a/paludis/qa/parse_deps_check.cc b/paludis/qa/parse_deps_check.cc
index 58763fa..79f51fd 100644
--- a/paludis/qa/parse_deps_check.cc
+++ b/paludis/qa/parse_deps_check.cc
@@ -47,8 +47,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
{
std::string depend(metadata->deps_interface->get_raw_build_depend());
PortageDepParser::parse(depend, PortageDepParser::Policy::text_is_package_dep_spec(true,
- metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
- pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
+ metadata->eapi.supported->strict_package_dep_spec_parse_mode));
}
catch (const Exception & err)
{
@@ -60,9 +59,8 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
{
std::string rdepend(metadata->deps_interface->get_raw_run_depend());
PortageDepParser::parse(rdepend, PortageDepParser::Policy::text_is_package_dep_spec(true,
- metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
- pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
-}
+ metadata->eapi.supported->strict_package_dep_spec_parse_mode));
+ }
catch (const Exception & err)
{
result << Message(qal_fatal, "Unparsable RDEPEND: '" +
@@ -73,9 +71,8 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
{
std::string pdepend(metadata->deps_interface->get_raw_post_depend());
PortageDepParser::parse(pdepend, PortageDepParser::Policy::text_is_package_dep_spec(true,
- metadata->eapi_as_package_dep_spec_parse_mode() == pds_pm_eapi_0 ?
- pds_pm_eapi_0_strict : metadata->eapi_as_package_dep_spec_parse_mode()));
-}
+ metadata->eapi.supported->strict_package_dep_spec_parse_mode));
+ }
catch (const Exception & err)
{
result << Message(qal_fatal, "Unparsable PDEPEND: '" +
diff --git a/paludis/repositories/cran/cran_description.cc b/paludis/repositories/cran/cran_description.cc
index 4f9268c..8c32143 100644
--- a/paludis/repositories/cran/cran_description.cc
+++ b/paludis/repositories/cran/cran_description.cc
@@ -37,7 +37,7 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f, bool
if (! f.is_regular_file())
{
- metadata->eapi = "UNKNOWN";
+ metadata->eapi = EAPIData::get_instance()->unknown_eapi();
Log::get_instance()->message(ll_warning, lc_context, "Unexpected irregular file: '" + stringify(f) + "'.");
return;
}
@@ -48,7 +48,7 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f, bool
// Fill in default values
metadata->slot = SlotName("0");
metadata->cran_interface->set_keywords("*");
- metadata->eapi = "CRAN-1";
+ metadata->eapi = EAPIData::get_instance()->eapi_from_string("CRAN-1");
std::string key;
for ( ; l != l_end ; ++l)
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 19a0082..166ad03 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -353,7 +353,7 @@ CRANInstalledRepository::do_version_metadata(
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': No DESCRIPTION file present.");
result.reset(new CRANVersionMetadata(true));
- result->eapi = "UNKNOWN";
+ result->eapi = EAPIData::get_instance()->unknown_eapi();
return result;
}
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 95e4f22..86826a4 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -414,7 +414,7 @@ CRANRepository::do_version_metadata(
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': File '" + n + ".DESCRIPTION' not present.");
result.reset(new CRANVersionMetadata(false));
- result->eapi = "UNKNOWN";
+ result->eapi = EAPIData::get_instance()->unknown_eapi();
}
_imp->metadata.insert(std::make_pair(std::make_pair(q, v), result));
diff --git a/paludis/repositories/cran/cran_version_metadata.cc b/paludis/repositories/cran/cran_version_metadata.cc
index 9f94fed..7cd1baf 100644
--- a/paludis/repositories/cran/cran_version_metadata.cc
+++ b/paludis/repositories/cran/cran_version_metadata.cc
@@ -28,7 +28,7 @@ CRANVersionMetadata::CRANVersionMetadata(bool want_origins) :
.slot(SlotName("unset"))
.homepage("")
.description("")
- .eapi("UNKNOWN")
+ .eapi(EAPIData::get_instance()->unknown_eapi())
.interactive(false),
VersionMetadataCapabilities::create()
.cran_interface(this)
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 13356a8..d9410b5 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -173,7 +173,7 @@ FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpe
std::tr1::shared_ptr<VersionMetadata>(new FakeVersionMetadata)));
std::tr1::shared_ptr<VersionMetadata> r(_imp->metadata.find(stringify(q) + "-" + stringify(v))->second);
r->slot = SlotName("0");
- r->eapi = "0";
+ r->eapi = EAPIData::get_instance()->eapi_from_string("0");
return r;
}
@@ -290,7 +290,7 @@ FakeVersionMetadata::FakeVersionMetadata() :
.slot(SlotName("0"))
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.ebuild_interface(this)
@@ -318,7 +318,7 @@ FakeVirtualVersionMetadata::FakeVirtualVersionMetadata(const SlotName & s, const
.slot(s)
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.ebuild_interface(0)
diff --git a/paludis/repositories/gems/gems_version_metadata.cc b/paludis/repositories/gems/gems_version_metadata.cc
index 4676f1f..d4eb9f8 100644
--- a/paludis/repositories/gems/gems_version_metadata.cc
+++ b/paludis/repositories/gems/gems_version_metadata.cc
@@ -28,7 +28,7 @@ GemsVersionMetadata::GemsVersionMetadata(const VersionSpec & v) :
.slot(SlotName(stringify(v)))
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.deps_interface(this)
diff --git a/paludis/repositories/gentoo/ebin.cc b/paludis/repositories/gentoo/ebin.cc
index 7732985..f566032 100644
--- a/paludis/repositories/gentoo/ebin.cc
+++ b/paludis/repositories/gentoo/ebin.cc
@@ -39,7 +39,7 @@ EbinVersionMetadata::EbinVersionMetadata(const SlotName & s) :
.slot(s)
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.ebin_interface(this)
diff --git a/paludis/repositories/gentoo/ebin_entries.cc b/paludis/repositories/gentoo/ebin_entries.cc
index 3084677..b3e0d70 100644
--- a/paludis/repositories/gentoo/ebin_entries.cc
+++ b/paludis/repositories/gentoo/ebin_entries.cc
@@ -89,7 +89,7 @@ EbinEntries::generate_version_metadata(const QualifiedPackageName & q,
result->slot = SlotName(f.get("SLOT"));
result->set_homepage(f.get("HOMEPAGE"));
result->description = f.get("DESCRIPTION");
- result->eapi = f.get("EAPI");
+ result->eapi = EAPIData::get_instance()->eapi_from_string(f.get("EAPI"));
result->set_provide(f.get("PROVIDE"));
result->set_src_uri(f.get("SRC_URI"));
@@ -394,7 +394,7 @@ EbinEntries::merge(const MergeOptions & m)
metadata->homepage()->accept(&h);
ebin_file << "HOMEPAGE=" << h << std::endl;
ebin_file << "DESCRIPTION=" << metadata->description << std::endl;
- ebin_file << "EAPI=" << metadata->eapi << std::endl;
+ ebin_file << "EAPI=" << metadata->eapi.name << std::endl;
if (metadata->ebuild_interface)
{
diff --git a/paludis/repositories/gentoo/ebuild.cc b/paludis/repositories/gentoo/ebuild.cc
index 663f7f3..b6c3db8 100644
--- a/paludis/repositories/gentoo/ebuild.cc
+++ b/paludis/repositories/gentoo/ebuild.cc
@@ -208,7 +208,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
_metadata->set_iuse(f.get("IUSE"));
_metadata->set_post_depend(f.get("PDEPEND"));
_metadata->set_provide(f.get("PROVIDE"));
- _metadata->eapi = f.get("EAPI");
+ _metadata->eapi = EAPIData::get_instance()->eapi_from_string(f.get("EAPI"));
if (0 == prog.exit_status())
ok = true;
@@ -226,7 +226,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
{
Log::get_instance()->message(ll_warning, lc_context, "Could not generate cache for '"
+ stringify(*params.db_entry) + "'");
- _metadata->eapi = "UNKNOWN";
+ _metadata->eapi = EAPIData::get_instance()->unknown_eapi();
return false;
}
@@ -484,7 +484,7 @@ EbuildVersionMetadata::EbuildVersionMetadata() :
.slot(SlotName("UNSET"))
.homepage("")
.description("")
- .eapi("UNKNOWN")
+ .eapi(EAPIData::get_instance()->unknown_eapi())
.interactive(false),
VersionMetadataCapabilities::create()
.ebuild_interface(this)
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index 731ca3b..c203000 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -156,7 +156,7 @@ EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
if (0 == ((result = cmd.metadata())))
throw InternalError(PALUDIS_HERE, "cmd.metadata() is zero pointer???");
- if (_imp->params.write_cache.basename() != "empty" && result->eapi != "UNKNOWN")
+ if (_imp->params.write_cache.basename() != "empty" && result->eapi.supported)
{
EbuildFlatMetadataCache metadata_cache(write_cache_file, ebuild_file, _imp->master_mtime,
_imp->eclass_mtimes, false);
diff --git a/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc b/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
index 2edb530..51debe9 100644
--- a/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/gentoo/ebuild_flat_metadata_cache.cc
@@ -67,7 +67,7 @@ EbuildFlatMetadataCache::load(std::tr1::shared_ptr<EbuildVersionMetadata> result
std::getline(cache, line);
std::getline(cache, line); result->set_post_depend(line);
std::getline(cache, line); result->set_provide(line);
- std::getline(cache, line); result->eapi = line;
+ std::getline(cache, line); result->eapi = EAPIData::get_instance()->eapi_from_string(line);
// check mtimes
time_t cache_time(std::max(_master_mtime, _filename.mtime()));
@@ -140,7 +140,7 @@ EbuildFlatMetadataCache::save(std::tr1::shared_ptr<const EbuildVersionMetadata>
cache << std::endl;
cache << normalise(v->post_depend()) << std::endl;
cache << normalise(v->provide()) << std::endl;
- cache << normalise(v->eapi) << std::endl;
+ cache << normalise(v->eapi.name) << std::endl;
}
else
{
diff --git a/paludis/repositories/gentoo/portage_repository_TEST.cc b/paludis/repositories/gentoo/portage_repository_TEST.cc
index cfe88a2..c1bab26 100644
--- a/paludis/repositories/gentoo/portage_repository_TEST.cc
+++ b/paludis/repositories/gentoo/portage_repository_TEST.cc
@@ -544,11 +544,13 @@ namespace test_cases
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
TEST_CHECK_EQUAL(m->description, "The Description");
- TEST_CHECK_EQUAL(m->eapi, "0");
+ TEST_CHECK_EQUAL(m->eapi.name, "0");
+ TEST_CHECK(m->eapi.supported);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2"));
TEST_CHECK_EQUAL(m->description, "dquote \" squote ' backslash \\ dollar $");
- TEST_CHECK_EQUAL(m->eapi, "0");
+ TEST_CHECK_EQUAL(m->eapi.name, "0");
+ TEST_CHECK(m->eapi.supported);
}
}
}
@@ -585,7 +587,8 @@ namespace test_cases
std::tr1::shared_ptr<const VersionMetadata> m;
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->eapi, "UNKNOWN");
+ TEST_CHECK_EQUAL(m->eapi.name, "UNKNOWN");
+ TEST_CHECK(! m->eapi.supported);
}
}
} test_portage_repository_metadata_unparsable;
diff --git a/paludis/repositories/gentoo/portage_virtual_version_metadata.cc b/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
index f5a0dfd..f0f727e 100644
--- a/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
+++ b/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
@@ -29,7 +29,7 @@ PortageVirtualVersionMetadata::PortageVirtualVersionMetadata(const SlotName & s,
.slot(s)
.homepage("")
.description("")
- .eapi("paludis-1")
+ .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
.interactive(false),
VersionMetadataCapabilities::create()
.virtual_interface(this)
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index 55acd24..afa09c4 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -466,7 +466,7 @@ namespace paludis
}
{
Context local_context("When loading key 'EAPI':");
- p->metadata->eapi = file_contents(location, p->name, p->version, "EAPI");
+ p->metadata->eapi = EAPIData::get_instance()->eapi_from_string(file_contents(location, p->name, p->version, "EAPI"));
}
{
Context local_context("When loading key 'HOMEPAGE':");
diff --git a/paludis/repositories/gentoo/vdb_version_metadata.cc b/paludis/repositories/gentoo/vdb_version_metadata.cc
index be2026a..52a2f7d 100644
--- a/paludis/repositories/gentoo/vdb_version_metadata.cc
+++ b/paludis/repositories/gentoo/vdb_version_metadata.cc
@@ -28,7 +28,7 @@ VDBVersionMetadata::VDBVersionMetadata() :
.slot(SlotName("UNSET"))
.homepage("")
.description("")
- .eapi("UNKNOWN")
+ .eapi(EAPIData::get_instance()->unknown_eapi())
.interactive(false),
VersionMetadataCapabilities::create()
.deps_interface(this)
@@ -55,7 +55,7 @@ VDBVirtualVersionMetadata::VDBVirtualVersionMetadata(const SlotName & s,
.slot(s)
.homepage("")
.description("")
- .eapi("UNKNOWN")
+ .eapi(EAPIData::get_instance()->unknown_eapi())
.interactive(false),
VersionMetadataCapabilities::create()
.deps_interface(this)
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 3f7de4b..dfd9f6c 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -74,43 +74,20 @@ VersionMetadataHasInterfaces::~VersionMetadataHasInterfaces()
{
}
-PackageDepSpecParseMode
-VersionMetadata::eapi_as_package_dep_spec_parse_mode() const
-{
- if (eapi == "0" || eapi == "")
- return pds_pm_eapi_0;
- else if (eapi == "CRAN-1" || eapi == "paludis-1")
- return pds_pm_permissive;
- else
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "BUG! Don't know what parse mode to use for EAPI '" + stringify(eapi) + "'");
- return pds_pm_permissive;
- }
-}
-
-IUseFlagParseMode
-VersionMetadata::eapi_as_iuse_flag_parse_mode() const
+std::tr1::shared_ptr<const DepSpec>
+VersionMetadataDepsInterface::_make_depend(const std::string & s) const
{
- if (eapi == "0" || eapi == "")
- return iuse_pm_eapi_0;
- else if (eapi == "CRAN-1" || eapi == "paludis-1")
- return iuse_pm_permissive;
+ if (version_metadata()->eapi.supported)
+ return parser(s, version_metadata()->eapi.supported->package_dep_spec_parse_mode);
else
{
- Log::get_instance()->message(ll_warning, lc_context,
- "BUG! Don't know what parse mode to use for EAPI '" + stringify(eapi) + "'");
- return iuse_pm_permissive;
+ Log::get_instance()->message(ll_warning, lc_context) <<
+ "Don't know how to parse dependency strings for EAPI '" + version_metadata()->eapi.name + "'";
+ return std::tr1::shared_ptr<DepSpec>(new AllDepSpec);
}
}
std::tr1::shared_ptr<const DepSpec>
-VersionMetadataDepsInterface::_make_depend(const std::string & s) const
-{
- return parser(s, version_metadata()->eapi_as_package_dep_spec_parse_mode());
-}
-
-std::tr1::shared_ptr<const DepSpec>
VersionMetadataLicenseInterface::_make_license(const std::string & s) const
{
return parser(s);
@@ -143,9 +120,18 @@ VersionMetadataEbuildInterface::_make_iuse_collection(const std::string & s) con
std::tr1::shared_ptr<IUseFlagCollection> result(new IUseFlagCollection::Concrete);
std::list<std::string> t;
WhitespaceTokeniser::get_instance()->tokenise(s, std::back_inserter(t));
- for (std::list<std::string>::const_iterator u(t.begin()), u_end(t.end()) ;
- u != u_end ; ++u)
- result->insert(IUseFlag(*u, version_metadata()->eapi_as_iuse_flag_parse_mode()));
+
+ if (version_metadata()->eapi.supported)
+ {
+ IUseFlagParseMode m(version_metadata()->eapi.supported->iuse_flag_parse_mode);
+ for (std::list<std::string>::const_iterator u(t.begin()), u_end(t.end()) ;
+ u != u_end ; ++u)
+ result->insert(IUseFlag(*u, m));
+ }
+ else
+ Log::get_instance()->message(ll_warning, lc_context) <<
+ "Don't know how to parse IUSE strings for EAPI '" + version_metadata()->eapi.name + "'";
+
return result;
}
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index 9921ff3..0a14206 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -26,6 +26,7 @@
#include <paludis/util/sr.hh>
#include <paludis/dep_spec.hh>
#include <paludis/package_database_entry.hh>
+#include <paludis/eapi.hh>
#include <string>
/** \file
@@ -100,16 +101,6 @@ namespace paludis
public:
virtual ~VersionMetadata();
- /**
- * Return the appropriate PackageDepSpecParseMode for our EAPI.
- */
- PackageDepSpecParseMode eapi_as_package_dep_spec_parse_mode() const;
-
- /**
- * Return the appropriate IUseFlagParseMode for our EAPI.
- */
- IUseFlagParseMode eapi_as_iuse_flag_parse_mode() const;
-
protected:
///\name Basic operations
///\{
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 62569d3..b12107c 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -118,7 +118,7 @@ make_class_VersionMetadataBase()
key slot SlotName
cache_key homepage std::string DepSpec _make_text
key description std::string
- key eapi std::string
+ key eapi EAPI
key interactive bool
allow_named_args
diff --git a/python/version_metadata.cc b/python/version_metadata.cc
index 8c73ebf..59a70d7 100644
--- a/python/version_metadata.cc
+++ b/python/version_metadata.cc
@@ -87,9 +87,11 @@ void PALUDIS_VISIBLE expose_version_metadata()
vm.def_readonly("description", &VersionMetadata::description,
"[ro] string"
);
+#ifdef CIARANM_REMOVED_THIS
vm.def_readonly("eapi", &VersionMetadata::eapi,
"[ro] string"
);
+#endif
vm.add_property("ebuild_interface", bp::make_function(&VersionMetadataWrapper::get_ebuild_interface,
bp::return_internal_reference<>()),
"[ro] EbuildInterface"
diff --git a/python/version_metadata_TEST.py b/python/version_metadata_TEST.py
index 7af541b..5a82151 100755
--- a/python/version_metadata_TEST.py
+++ b/python/version_metadata_TEST.py
@@ -50,7 +50,7 @@ class TestCase_VersionMetadata(unittest.TestCase):
self.assertEquals(str(vmd.slot), "0")
self.assertEquals(str(iter(vmd.homepage).next()), "http://paludis.pioto.org/")
self.assertEquals(vmd.description, "Test package")
- self.assertEquals(vmd.eapi, "0")
+# self.assertEquals(vmd.eapi, "0")
def test_04_ebuild_interface(self):
ei = self.vmd("1.0").ebuild_interface
diff --git a/ruby/version_metadata.cc b/ruby/version_metadata.cc
index e7dcb2e..7b8bef1 100644
--- a/ruby/version_metadata.cc
+++ b/ruby/version_metadata.cc
@@ -133,6 +133,7 @@ namespace
*
* Our slot
*/
+#ifdef CIARANM_REMOVED_THIS
/*
* Document-method: eapi
*
@@ -141,6 +142,7 @@ namespace
*
* Our eapi
*/
+#endif
/*
* Document-method: description
*
@@ -457,7 +459,9 @@ namespace
rb_define_method(c_version_metadata, "license", RUBY_FUNC_CAST(&version_metadata_license), 0);
rb_define_method(c_version_metadata, "slot", RUBY_FUNC_CAST((&BaseValue<SlotName, &VersionMetadataBase::slot>::fetch)), 0);
+#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_version_metadata, "eapi", RUBY_FUNC_CAST((&BaseValue<std::string, &VersionMetadataBase::eapi>::fetch)), 0);
+#endif
rb_define_method(c_version_metadata, "homepage", RUBY_FUNC_CAST(&version_metadata_homepage), 0);
rb_define_method(c_version_metadata, "description", RUBY_FUNC_CAST((&BaseValue<std::string,
&VersionMetadataBase::description>::fetch)), 0);
diff --git a/ruby/version_metadata_TEST.rb b/ruby/version_metadata_TEST.rb
index 7112e58..844c62c 100644
--- a/ruby/version_metadata_TEST.rb
+++ b/ruby/version_metadata_TEST.rb
@@ -68,7 +68,7 @@ module Paludis
# assert_equal "http://paludis.pioto.org/", vmd("1.0").homepage
assert_kind_of DepSpec, vmd('1.0').homepage
assert_equal "0", vmd("1.0").slot
- assert_equal "0", vmd("1.0").eapi
+# assert_equal "0", vmd("1.0").eapi
# assert_equal "GPL-2", vmd("1.0").license_string
assert_kind_of DepSpec, vmd('1.0').license
assert !vmd('1.0').interactive?
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 237db86..3587269 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -331,7 +331,7 @@ do_install(std::tr1::shared_ptr<Environment> env, std::string spec_str)
std::string eapi_str(env->
package_database()->fetch_repository(
pp->repository)->version_metadata(
- pp->name, pp->version)->eapi);
+ pp->name, pp->version)->eapi.name);
cerr << " ( " << colour(cl_masked, eapi_str) << " )";
}
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 21b546f..13a9c74 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -645,7 +645,7 @@ do_install(std::tr1::shared_ptr<Environment> env)
{
std::string eapi_str(env->package_database()->fetch_repository(
pp->repository)->version_metadata(
- pp->name, pp->version)->eapi);
+ pp->name, pp->version)->eapi.name);
if (eapi_str == "UNKNOWN")
cerr << " ( " << colour(cl_masked, eapi_str) <<
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 9b061c1..a2168cf 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -1101,7 +1101,7 @@ ConsoleInstallTask::display_merge_list_entry_mask_reasons(const DepListEntry & e
if (mr_eapi == mm)
{
std::string eapi_str(environment()->package_database()->fetch_repository(
- e.package.repository)->version_metadata(e.package.name, e.package.version)->eapi);
+ e.package.repository)->version_metadata(e.package.name, e.package.version)->eapi.name);
if (eapi_str == "UNKNOWN")
output_no_endl(" ( " + render_as_masked(eapi_str) + " ) (probably a broken ebuild)");