aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2009-03-15 17:03:35 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2009-03-15 17:03:35 +0000
commit8f1dad5344f35167870503654ab1a10eea63eb5a (patch)
tree55a143048e08e3da72ae372cdfbd4ed763105507
parentd57d0952051724d80b00b49270008be48b638922 (diff)
downloadpaludis-8f1dad5344f35167870503654ab1a10eea63eb5a.tar.gz
paludis-8f1dad5344f35167870503654ab1a10eea63eb5a.tar.xz
Take the pre-source EAPI into account when validating the cache
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc20
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc150
-rwxr-xr-xpaludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh171
-rw-r--r--paludis/repositories/e/ebuild_id.cc13
-rw-r--r--paludis/repositories/e/ebuild_id.hh1
5 files changed, 350 insertions, 5 deletions
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index d0e7864..79673b4 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -112,6 +112,13 @@ namespace
Log::get_instance()->message("e.cache.flat_list.mtime", ll_debug, lc_context)
<< "ebuild has mtime " << _imp->ebuild.mtime() << ", but expected at most " << cache_time;
+ if (ok && "0" != id->guessed_eapi_name())
+ {
+ Log::get_instance()->message("e.cache.flat_list.guessed_eapi", ll_debug, lc_context)
+ << "ebuild has guessed EAPI '" << id->guessed_eapi_name() << "', but flat_list assumes '0'";
+ ok = false;
+ }
+
if (ok)
{
std::set<std::string> tokens;
@@ -357,6 +364,18 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
Log::get_instance()->message("e.cache.flat_hash.mtime", ll_debug, lc_context)
<< "ebuild has mtime " << _imp->ebuild.mtime() << ", but expected " << cache_time;
+ if (ok) {
+ std::string cache_guessed(keys["_guessed_eapi_"]);
+ if (cache_guessed.empty())
+ cache_guessed = "0";
+ if (id->guessed_eapi_name() != cache_guessed)
+ {
+ Log::get_instance()->message("e.cache.flat_hash.guessed_eapi", ll_debug, lc_context)
+ << "ebuild has guessed EAPI '" << id->guessed_eapi_name() << "', but cache has '" << cache_guessed << "'";
+ ok = false;
+ }
+ }
+
if (ok && id->eapi()->supported()->ebuild_options()->support_eclasses())
{
std::vector<std::string> eclasses;
@@ -657,6 +676,7 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
std::ostringstream cache;
write_kv(cache, "_mtime_", _imp->ebuild.mtime());
+ write_kv(cache, "_guessed_eapi_", id->guessed_eapi_name());
if (id->eapi()->supported()->ebuild_options()->support_eclasses() && id->inherited_key())
{
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index fdb5dd8..071f65e 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -111,6 +111,35 @@ namespace test_cases
}
} test_metadata_flat_list_stale;
+ struct MetadataFlatListGuessedEAPITest : TestCase
+ {
+ MetadataFlatListGuessedEAPITest() : TestCase("metadata flat_list guessed EAPI") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "ebuild_flat_metadata_cache_TEST_dir/repo");
+ keys->insert("profiles", "ebuild_flat_metadata_cache_TEST_dir/repo/profiles/profile");
+ keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
+ keys->insert("eapi_when_unknown", "1");
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ const std::tr1::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/flat_list-guessed-eapi-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
+
+ TEST_CHECK(id1->short_description_key());
+ TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_list-guessed-eapi");
+ }
+ } test_metadata_flat_list_guessed_eapi;
+
struct MetadataFlatListEclassCachedTest : TestCase
{
MetadataFlatListEclassCachedTest() : TestCase("metadata flat_list eclass cached") { }
@@ -282,6 +311,91 @@ namespace test_cases
}
} test_metadata_flat_hash_cached;
+ struct MetadataFlatHashGuessedEAPITest : TestCase
+ {
+ MetadataFlatHashGuessedEAPITest() : TestCase("metadata flat_hash guessed EAPI") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "ebuild_flat_metadata_cache_TEST_dir/repo");
+ keys->insert("profiles", "ebuild_flat_metadata_cache_TEST_dir/repo/profiles/profile");
+ keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
+ keys->insert("eapi_when_unknown", "1");
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ const std::tr1::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
+
+ TEST_CHECK(id1->short_description_key());
+ TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-guessed-eapi");
+ }
+ } test_metadata_flat_hash_guessed_eapi;
+
+ struct MetadataFlatHashGuessedEAPIExtensionTest : TestCase
+ {
+ MetadataFlatHashGuessedEAPIExtensionTest() : TestCase("metadata flat_hash guessed EAPI by extension") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "ebuild_flat_metadata_cache_TEST_dir/repo");
+ keys->insert("profiles", "ebuild_flat_metadata_cache_TEST_dir/repo/profiles/profile");
+ keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ const std::tr1::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-guessed-eapi-extension-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
+
+ TEST_CHECK(id1->short_description_key());
+ TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Generated Description flat_hash-guessed-eapi-extension");
+ }
+ } test_metadata_flat_hash_guessed_eapi_extension;
+
+ struct MetadataFlatHashCachedNoGuessedEAPITest : TestCase
+ {
+ MetadataFlatHashCachedNoGuessedEAPITest() : TestCase("metadata flat_hash no guessed EAPI") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "ebuild_flat_metadata_cache_TEST_dir/repo");
+ keys->insert("profiles", "ebuild_flat_metadata_cache_TEST_dir/repo/profiles/profile");
+ keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/flat_hash-no-guessed-eapi-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
+
+ TEST_CHECK(id->short_description_key());
+ TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-no-guessed-eapi");
+ }
+ } test_metadata_flat_hash_cached_no_guessed_eapi;
+
struct MetadataFlatHashEmptyValueTest : TestCase
{
MetadataFlatHashEmptyValueTest() : TestCase("metadata flat_hash empty value") { }
@@ -1111,6 +1225,42 @@ namespace test_cases
}
} test_metadata_write;
+ struct MetadataWriteEAPI1Test : TestCase
+ {
+ MetadataWriteEAPI1Test() : TestCase("metadata write EAPI 1") { }
+
+ std::string contents(const std::string & filename)
+ {
+ SafeIFStream s(FSEntry(filename).realpath());
+ return std::string((std::istreambuf_iterator<char>(s)), std::istreambuf_iterator<char>());
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "ebuild_flat_metadata_cache_TEST_dir/repo");
+ keys->insert("profiles", "ebuild_flat_metadata_cache_TEST_dir/repo/profiles/profile");
+ keys->insert("eclassdirs", "ebuild_flat_metadata_cache_TEST_dir/repo/eclass ebuild_flat_metadata_cache_TEST_dir/extra_eclasses");
+ keys->insert("write_cache", "ebuild_flat_metadata_cache_TEST_dir/cache");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "ebuild_flat_metadata_cache_TEST_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/write-eapi1-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
+
+ TEST_CHECK(id->short_description_key());
+ TEST_CHECK_EQUAL(contents("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-eapi1-1"), contents("ebuild_flat_metadata_cache_TEST_dir/cache/expected/cat/write-eapi1-1"));
+ TEST_CHECK_EQUAL(FSEntry("ebuild_flat_metadata_cache_TEST_dir/cache/test-repo/cat/write-eapi1-1").mtime(), 60);
+ }
+ } test_metadata_write_eapi1;
+
struct MetadataWriteEclassesTest : TestCase
{
MetadataWriteEclassesTest() : TestCase("metadata write eclasses") { }
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
index c496f7a..06070d1 100755
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
@@ -88,6 +88,37 @@ the-properties
END
TZ=UTC touch -t 199901010101 metadata/cache/cat/flat_list-stale-1 || exit 2
+mkdir cat/flat_list-guessed-eapi
+cat <<END > cat/flat_list-guessed-eapi/flat_list-guessed-eapi-1.ebuild || exit 1
+DESCRIPTION="The Generated Description flat_list-guessed-eapi"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND=""
+END
+cat <<END > metadata/cache/cat/flat_list-guessed-eapi-1 || exit 1
+the/depend
+the/rdepend
+the-slot
+the-src-uri
+the-restrict
+the-homepage
+the-license
+The Stale Description
+the-keywords
+
+the-iuse
+unused
+the/pdepend
+the/provide
+0
+the-properties
+
+END
+
mkdir cat/flat_list-eclass
cat <<END > cat/flat_list-eclass/flat_list-eclass-1.ebuild || exit 1
END
@@ -234,6 +265,7 @@ cat <<END > cat/flat_hash/flat_hash-1.ebuild || exit 1
END
cat <<END > metadata/cache/cat/flat_hash-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -251,12 +283,93 @@ PROPERTIES=the-properties
END
TZ=UTC touch -t 197001010001 cat/flat_hash/flat_hash-1.ebuild || exit 2
+mkdir cat/flat_hash-guessed-eapi
+cat <<END > cat/flat_hash-guessed-eapi/flat_hash-guessed-eapi-1.ebuild || exit 1
+DESCRIPTION="The Generated Description flat_hash-guessed-eapi"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND=""
+END
+cat <<END > metadata/cache/cat/flat_hash-guessed-eapi-1 || exit 1
+_mtime_=60
+_guessed_eapi_=0
+DEPEND=the/depend
+RDEPEND=the/rdepend
+SLOT=the-slot
+SRC_URI=the-src-uri
+RESTRICT=the-restrict
+HOMEPAGE=the-homepage
+LICENSE=the-license
+DESCRIPTION=The Stale Description
+KEYWORDS=the-keywords
+IUSE=the-iuse
+PDEPEND=the/pdepend
+PROVIDE=the/provide
+EAPI=0
+PROPERTIES=the-properties
+END
+TZ=UTC touch -t 197001010001 cat/flat_hash-guessed-eapi/flat_hash-guessed-eapi-1.ebuild || exit 2
+
+mkdir cat/flat_hash-guessed-eapi-extension
+cat <<END > cat/flat_hash-guessed-eapi-extension/flat_hash-guessed-eapi-extension-1.exheres-0 || exit 1
+SUMMARY="The Generated Description flat_hash-guessed-eapi-extension"
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS=""
+LICENCES="GPL-2"
+PLATOFORMS="test"
+DEPENDENCIES=""
+END
+cat <<END > metadata/cache/cat/flat_hash-guessed-eapi-extension-1 || exit 1
+_mtime_=60
+_guessed_eapi_=kdebuild-1
+DEPENDENCIES=the/dependencies
+SLOT=the-slot
+DOWNLOADS=the-downloads
+RESTRICT=the-restrict
+HOMEPAGE=the-homepage
+LICENCES=the-licences
+SUMMARY=The Stale Description
+PLATFORMS=the-platforms
+MYOPTIONS=the-myoptions
+EAPI=kdebuild-1
+END
+TZ=UTC touch -t 197001010001 cat/flat_hash-guessed-eapi-extension/flat_hash-guessed-eapi-extension-1.exheres-0 || exit 2
+
+mkdir cat/flat_hash-no-guessed-eapi
+cat <<END > cat/flat_hash-no-guessed-eapi/flat_hash-no-guessed-eapi-1.ebuild || exit 1
+END
+cat <<END > metadata/cache/cat/flat_hash-no-guessed-eapi-1 || exit 1
+_mtime_=60
+DEPEND=the/depend
+RDEPEND=the/rdepend
+SLOT=the-slot
+SRC_URI=the-src-uri
+RESTRICT=the-restrict
+HOMEPAGE=the-homepage
+LICENSE=the-license
+DESCRIPTION=the-description-flat_hash-no-guessed-eapi
+KEYWORDS=the-keywords
+IUSE=the-iuse
+PDEPEND=the/pdepend
+PROVIDE=the/provide
+EAPI=0
+PROPERTIES=the-properties
+END
+TZ=UTC touch -t 197001010001 cat/flat_hash-no-guessed-eapi/flat_hash-no-guessed-eapi-1.ebuild || exit 2
+
mkdir cat/flat_hash-empty
cat <<END > cat/flat_hash-empty/flat_hash-empty-1.ebuild || exit 1
DESCRIPTION="The Generated Description flat_hash-empty"
END
cat <<END > metadata/cache/cat/flat_hash-empty-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -286,6 +399,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-stale-1 || exit 1
_mtime_=915152460
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -366,6 +480,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-bad-mtime-1 || exit 1
_mtime_=monkey
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -397,6 +512,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-no-eapi-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -425,6 +541,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-duplicate-key-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
DEPEND=the/depend
RDEPEND=the/rdepend
SLOT=the-slot
@@ -448,6 +565,7 @@ cat <<END > cat/flat_hash-eclass/flat_hash-eclass-1.ebuild || exit 1
END
cat <<END > metadata/cache/cat/flat_hash-eclass-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -479,6 +597,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclass-stale-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo 120
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -510,6 +629,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclass-wrong-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=bar 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -541,6 +661,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclass-gone-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=baz 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -564,6 +685,7 @@ cat <<END > cat/flat_hash-full-eclass/flat_hash-full-eclass-1.ebuild || exit 1
END
cat <<END > metadata/cache/cat/flat_hash-full-eclass-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -587,6 +709,7 @@ cat <<END > cat/flat_hash-full-eclass-nonstandard/flat_hash-full-eclass-nonstand
END
cat <<END > metadata/cache/cat/flat_hash-full-eclass-nonstandard-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 180 bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise ../extra_eclasses) 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -618,6 +741,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-full-eclass-stale-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 120
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -649,6 +773,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-full-eclass-wrong-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 180 bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -680,6 +805,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-full-eclass-gone-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=baz $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass) 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -711,6 +837,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclasses-truncated-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise eclass)
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -740,6 +867,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclasses-truncated-2 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -771,6 +899,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclasses-bad-mtime-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo bar
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -802,6 +931,7 @@ DEPEND=""
END
cat <<END > metadata/cache/cat/flat_hash-eclasses-spaces-1 || exit 1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=foo 180
DEPEND=the/depend
RDEPEND=the/rdepend
@@ -825,6 +955,7 @@ cat <<END > cat/flat_hash-exlib/flat_hash-exlib-1.ebuild || exit 1
END
cat <<END > metadata/cache/cat/flat_hash-exlib-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 180
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -844,6 +975,7 @@ cat <<END > cat/flat_hash-exlib-percat/flat_hash-exlib-percat-1.ebuild || exit 1
END
cat <<END > metadata/cache/cat/flat_hash-exlib-percat-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 180 bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise cat/exlibs) 180
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -871,6 +1003,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlib-stale-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 120
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -898,6 +1031,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlib-wrong-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 180 bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 180
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -925,6 +1059,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlib-gone-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=baz $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs) 180
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -952,6 +1087,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlibs-truncated-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise exlibs)
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -977,6 +1113,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlibs-truncated-2 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -1004,6 +1141,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlibs-bad-mtime-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo bar
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -1031,6 +1169,7 @@ DEPENDENCIES=""
END
cat <<END > metadata/cache/cat/flat_hash-exlibs-spaces-1 || exit 1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=foo 180
DEPENDENCIES=the/depend
SLOT=the-slot
@@ -1058,6 +1197,20 @@ DEPEND="cat/foo bar? ( cat/bar )"
END
TZ=UTC touch -t 197001010001 cat/write/write-1.ebuild || exit 2
+mkdir cat/write-eapi1
+cat <<END > cat/write-eapi1/write-eapi1-1.ebuild || exit 1
+EAPI="1"
+DESCRIPTION="A nice package"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="test"
+IUSE="bar"
+DEPEND="cat/foo bar? ( cat/bar )"
+END
+TZ=UTC touch -t 197001010001 cat/write-eapi1/write-eapi1-1.ebuild || exit 2
+
mkdir cat/write-eclasses
cat <<END > cat/write-eclasses/write-eclasses-1.ebuild || exit 1
inherit foo bar
@@ -1092,6 +1245,7 @@ mkdir -p cache/{test-repo,expected}/cat
cat <<END > cache/expected/cat/write-1
_mtime_=60
+_guessed_eapi_=0
DEPEND=cat/foo bar? ( cat/bar )
RDEPEND=cat/foo bar? ( cat/bar )
SLOT=0
@@ -1104,8 +1258,24 @@ EAPI=0
DEFINED_PHASES=-
END
+cat <<END > cache/expected/cat/write-eapi1-1
+_mtime_=60
+_guessed_eapi_=0
+DEPEND=cat/foo bar? ( cat/bar )
+RDEPEND=cat/foo bar? ( cat/bar )
+SLOT=0
+HOMEPAGE=http://example.com/
+LICENSE=GPL-2
+DESCRIPTION=A nice package
+KEYWORDS=test
+IUSE=bar
+EAPI=1
+DEFINED_PHASES=-
+END
+
cat <<END > cache/expected/cat/write-eclasses-1
_mtime_=60
+_guessed_eapi_=0
_eclasses_=bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise extra_eclasses) 180 foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise repo/eclass) 180
DEPEND=cat/foo bar? ( cat/bar ) cat/baz
RDEPEND=cat/foo bar? ( cat/bar )
@@ -1121,6 +1291,7 @@ END
cat <<END > cache/expected/cat/write-exlibs-1
_mtime_=60
+_guessed_eapi_=exheres-0
_exlibs_=bar $(${PALUDIS_EBUILD_DIR}/utils/canonicalise repo/cat/exlibs) 180 foo $(${PALUDIS_EBUILD_DIR}/utils/canonicalise repo/exlibs) 180
DEPENDENCIES=( build: cat/foo bar? ( cat/bar ) ) cat/baz ( build: bar? ( ) ) cat/baz ( build: bar? ( ) )
SLOT=0
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 2656979..3613928 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -144,7 +144,7 @@ EbuildID::EbuildID(const QualifiedPackageName & q, const VersionSpec & v,
const std::string & g,
const time_t t,
const std::tr1::shared_ptr<const EclassMtimes> & m) :
- PrivateImplementationPattern<EbuildID>(new Implementation<EbuildID>(q, v, e, r, f, g, t, m)),
+ PrivateImplementationPattern<EbuildID>(new Implementation<EbuildID>(q, v, e, r, f, g.empty() ? r->params().eapi_when_unknown() : g, t, m)),
_imp(PrivateImplementationPattern<EbuildID>::_imp)
{
}
@@ -217,10 +217,7 @@ EbuildID::need_keys_added() const
Log::get_instance()->message("e.ebuild.cache.no_usable", ll_qa, lc_no_context)
<< "No usable cache entry for '" + canonical_form(idcf_full);
- std::string eapi_str(_imp->guessed_eapi);
- if (eapi_str.empty())
- eapi_str = _imp->repository->params().eapi_when_unknown();
- _imp->eapi = EAPIData::get_instance()->eapi_from_string(eapi_str);
+ _imp->eapi = EAPIData::get_instance()->eapi_from_string(_imp->guessed_eapi);
if (_imp->eapi->supported())
{
@@ -774,6 +771,12 @@ EbuildID::set_eapi(const std::string & s) const
_imp->eapi = EAPIData::get_instance()->eapi_from_string(s);
}
+std::string
+EbuildID::guessed_eapi_name() const
+{
+ return _imp->guessed_eapi;
+}
+
std::tr1::shared_ptr<const ERepository>
EbuildID::e_repository() const
{
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 68ca3ec..a619c79 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -112,6 +112,7 @@ namespace paludis
virtual std::tr1::shared_ptr<const ERepository> e_repository() const;
void set_eapi(const std::string &) const;
+ std::string guessed_eapi_name() const;
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;