aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-05 14:02:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-05 14:02:13 +0000
commite2dd1b0d8f78d512b590c2d8ffc43f67e744dbe2 (patch)
tree45506de2a0fc72462810a66df0728ba6aa883529
parenteb5e4287cbce8cc37b302259530e249881769f11 (diff)
downloadpaludis-e2dd1b0d8f78d512b590c2d8ffc43f67e744dbe2.tar.gz
paludis-e2dd1b0d8f78d512b590c2d8ffc43f67e744dbe2.tar.xz
r3303@snowflake: ciaranm | 2007-06-05 15:00:42 +0100
Exheres layout work
-rw-r--r--paludis/distribution.cc4
-rw-r--r--paludis/distribution.sr5
-rw-r--r--paludis/distributions/gentoo.conf5
-rw-r--r--paludis/portage_dep_parser.cc10
-rw-r--r--paludis/repositories/gentoo/Makefile.am2
-rw-r--r--paludis/repositories/gentoo/ebin.cc2
-rw-r--r--paludis/repositories/gentoo/ebin.sr2
-rw-r--r--paludis/repositories/gentoo/ebin_entries.cc8
-rw-r--r--paludis/repositories/gentoo/ebuild.cc4
-rw-r--r--paludis/repositories/gentoo/ebuild.sr1
-rw-r--r--paludis/repositories/gentoo/ebuild/builtin_fetchbin.bash14
-rw-r--r--paludis/repositories/gentoo/ebuild/builtin_initbin.bash4
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc108
-rw-r--r--paludis/repositories/gentoo/exheres_layout.cc448
-rw-r--r--paludis/repositories/gentoo/exheres_layout.hh118
-rw-r--r--paludis/repositories/gentoo/layout.cc33
-rw-r--r--paludis/repositories/gentoo/layout.hh48
-rw-r--r--paludis/repositories/gentoo/make_ebin_repository.cc47
-rw-r--r--paludis/repositories/gentoo/make_ebuild_repository.cc22
-rw-r--r--paludis/repositories/gentoo/portage_repository.cc61
-rw-r--r--paludis/repositories/gentoo/portage_repository_params.sr3
-rw-r--r--paludis/repositories/gentoo/portage_repository_profile.cc11
-rw-r--r--paludis/repositories/gentoo/portage_repository_profile.hh3
-rw-r--r--paludis/repositories/gentoo/traditional_layout.cc126
-rw-r--r--paludis/repositories/gentoo/traditional_layout.hh35
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc2
-rw-r--r--src/output/console_query_task.cc6
27 files changed, 947 insertions, 185 deletions
diff --git a/paludis/distribution.cc b/paludis/distribution.cc
index 832d0b0..1ed95b5 100644
--- a/paludis/distribution.cc
+++ b/paludis/distribution.cc
@@ -73,8 +73,8 @@ namespace paludis
.default_ebuild_names_cache(k.get("default_ebuild_names_cache"))
.default_ebuild_build_root(k.get("default_ebuild_build_root"))
.default_ebuild_layout(k.get("default_ebuild_layout"))
- .eapi_when_unknown(k.get("eapi_when_unknown"))
- .eapi_when_unspecified(k.get("eapi_when_unspecified"))
+ .default_ebuild_eapi_when_unknown(k.get("default_ebuild_eapi_when_unknown"))
+ .default_ebuild_eapi_when_unspecified(k.get("default_ebuild_eapi_when_unspecified"))
))));
}
}
diff --git a/paludis/distribution.sr b/paludis/distribution.sr
index 8221e26..eb616eb 100644
--- a/paludis/distribution.sr
+++ b/paludis/distribution.sr
@@ -12,9 +12,8 @@ make_class_Distribution()
key default_ebuild_names_cache std::string
key default_ebuild_build_root std::string
key default_ebuild_layout std::string
-
- key eapi_when_unknown std::string
- key eapi_when_unspecified std::string
+ key default_ebuild_eapi_when_unknown std::string
+ key default_ebuild_eapi_when_unspecified std::string
allow_named_args
diff --git a/paludis/distributions/gentoo.conf b/paludis/distributions/gentoo.conf
index 1779d2d..f574db9 100644
--- a/paludis/distributions/gentoo.conf
+++ b/paludis/distributions/gentoo.conf
@@ -9,7 +9,6 @@ default_ebuild_write_cache = /var/empty
default_ebuild_names_cache =
default_ebuild_build_root = /var/tmp/paludis
default_ebuild_layout = traditional
-
-eapi_when_unknown = 0
-eapi_when_unspecified = 0
+default_ebuild_eapi_when_unknown = 0
+default_ebuild_eapi_when_unspecified = 0
diff --git a/paludis/portage_dep_parser.cc b/paludis/portage_dep_parser.cc
index 366b163..7349bad 100644
--- a/paludis/portage_dep_parser.cc
+++ b/paludis/portage_dep_parser.cc
@@ -581,6 +581,8 @@ PortageDepParser::_parse(const std::string & s, bool disallow_any_use, const I_
tr1::shared_ptr<DependencySpecTree::ConstItem>
PortageDepParser::parse_depend(const std::string & s, const EAPI & e)
{
+ Context c("When parsing dependency string '" + s + "' using EAPI '" + e.name + "':");
+
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' dependencies");
@@ -592,6 +594,8 @@ PortageDepParser::parse_depend(const std::string & s, const EAPI & e)
tr1::shared_ptr<ProvideSpecTree::ConstItem>
PortageDepParser::parse_provide(const std::string & s, const EAPI & e)
{
+ Context c("When parsing provide string '" + s + "' using EAPI '" + e.name + "':");
+
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' provides");
@@ -602,6 +606,8 @@ PortageDepParser::parse_provide(const std::string & s, const EAPI & e)
tr1::shared_ptr<RestrictSpecTree::ConstItem>
PortageDepParser::parse_restrict(const std::string & s, const EAPI & e)
{
+ Context c("When parsing restrict string '" + s + "' using EAPI '" + e.name + "':");
+
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' restrictions");
@@ -612,6 +618,8 @@ PortageDepParser::parse_restrict(const std::string & s, const EAPI & e)
tr1::shared_ptr<URISpecTree::ConstItem>
PortageDepParser::parse_uri(const std::string & s, const EAPI & e)
{
+ Context c("When parsing URI string '" + s + "' using EAPI '" + e.name + "':");
+
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' URIs");
@@ -622,6 +630,8 @@ PortageDepParser::parse_uri(const std::string & s, const EAPI & e)
tr1::shared_ptr<LicenseSpecTree::ConstItem>
PortageDepParser::parse_license(const std::string & s, const EAPI & e)
{
+ Context c("When parsing license string '" + s + "' using EAPI '" + e.name + "':");
+
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' licenses");
diff --git a/paludis/repositories/gentoo/Makefile.am b/paludis/repositories/gentoo/Makefile.am
index 39caeeb..353862f 100644
--- a/paludis/repositories/gentoo/Makefile.am
+++ b/paludis/repositories/gentoo/Makefile.am
@@ -65,6 +65,7 @@ paludis_repositories_gentoo_include_HEADERS = \
vdb_unmerger.hh \
layout.hh \
traditional_layout.hh \
+ exheres_layout.hh \
eapi_phase.hh
libpaludisgentoorepository_la_SOURCES = \
@@ -94,6 +95,7 @@ libpaludisgentoorepository_la_SOURCES = \
vdb_unmerger.cc \
layout.cc \
traditional_layout.cc \
+ exheres_layout.cc \
eapi_phase.cc \
$(paludis_repositories_gentoo_include_HEADERS)
diff --git a/paludis/repositories/gentoo/ebin.cc b/paludis/repositories/gentoo/ebin.cc
index b9ba6f3..c9752e7 100644
--- a/paludis/repositories/gentoo/ebin.cc
+++ b/paludis/repositories/gentoo/ebin.cc
@@ -113,7 +113,7 @@ EbinCommand::operator() ()
.with_setenv("CATEGORY", stringify(params.db_entry->name.category))
.with_setenv("REPOSITORY", stringify(params.db_entry->repository))
.with_setenv("PORTDIR", stringify(params.portdir))
- .with_setenv("PKGDIR", stringify(params.pkgdir))
+ .with_setenv("DISTDIR", stringify(params.distdir))
.with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
stringify(PALUDIS_VERSION_MICRO) +
diff --git a/paludis/repositories/gentoo/ebin.sr b/paludis/repositories/gentoo/ebin.sr
index 9246fbf..30097e1 100644
--- a/paludis/repositories/gentoo/ebin.sr
+++ b/paludis/repositories/gentoo/ebin.sr
@@ -6,7 +6,7 @@ make_class_EbinCommandParams()
key environment "const Environment *"
key db_entry "const PackageDatabaseEntry *"
key portdir FSEntry
- key pkgdir FSEntry
+ key distdir FSEntry
key buildroot FSEntry
doxygen_comment << "END"
diff --git a/paludis/repositories/gentoo/ebin_entries.cc b/paludis/repositories/gentoo/ebin_entries.cc
index 0cd09a1..882435e 100644
--- a/paludis/repositories/gentoo/ebin_entries.cc
+++ b/paludis/repositories/gentoo/ebin_entries.cc
@@ -217,13 +217,13 @@ EbinEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.db_entry(&e)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
_imp->params.location)
- .pkgdir(_imp->params.pkgdir)
+ .distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot));
bool fetch_userpriv_ok(_imp->environment->reduced_gid() != getgid());
if (fetch_userpriv_ok)
{
- FSEntry f(_imp->params.pkgdir);
+ FSEntry f(_imp->params.distdir);
Context c("When checking permissions on '" + stringify(f) + "' for userpriv:");
if (f.exists())
@@ -412,7 +412,7 @@ EbinEntries::merge(const MergeOptions & m)
metadata->ebuild_interface->inherited()->end(), " ") << std::endl;
}
- FSEntry pkg_file_name(_imp->params.pkgdir / (
+ FSEntry pkg_file_name(_imp->params.distdir / (
stringify(_imp->portage_repository->name()) + "--" +
stringify(m.package.name.category) + "--" +
stringify(m.package.name.package) + "-" +
@@ -428,7 +428,7 @@ EbinEntries::merge(const MergeOptions & m)
.db_entry(&m.package)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
_imp->params.location)
- .pkgdir(_imp->params.pkgdir)
+ .distdir(_imp->params.distdir)
.buildroot(_imp->params.buildroot));
EbinMergeCommand merge_cmd(
diff --git a/paludis/repositories/gentoo/ebuild.cc b/paludis/repositories/gentoo/ebuild.cc
index 141b2ea..85c34c2 100644
--- a/paludis/repositories/gentoo/ebuild.cc
+++ b/paludis/repositories/gentoo/ebuild.cc
@@ -98,6 +98,7 @@ EbuildCommand::operator() ()
params.eclassdirs->end(), " "))
.with_setenv("PORTDIR", stringify(params.portdir))
.with_setenv("DISTDIR", stringify(params.distdir))
+ .with_setenv("EAPI", stringify(params.eapi->name))
.with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
stringify(PALUDIS_VERSION_MICRO) +
@@ -128,8 +129,7 @@ EbuildCommand::operator() ()
std::string
EbuildCommand::ebuild_file() const
{
- return stringify(params.ebuild_dir) + "/" +
- stringify(params.db_entry->name.package) + "-" + stringify(params.db_entry->version) + ".ebuild";
+ return stringify(params.ebuild_file);
}
Command
diff --git a/paludis/repositories/gentoo/ebuild.sr b/paludis/repositories/gentoo/ebuild.sr
index 8a19d56..f2e8e7f 100644
--- a/paludis/repositories/gentoo/ebuild.sr
+++ b/paludis/repositories/gentoo/ebuild.sr
@@ -7,6 +7,7 @@ make_class_EbuildCommandParams()
key db_entry "const PackageDatabaseEntry *"
key eapi "tr1::shared_ptr<const EAPI>"
key ebuild_dir FSEntry
+ key ebuild_file FSEntry
key files_dir FSEntry
key eclassdirs "tr1::shared_ptr<const FSEntryCollection>"
key portdir FSEntry
diff --git a/paludis/repositories/gentoo/ebuild/builtin_fetchbin.bash b/paludis/repositories/gentoo/ebuild/builtin_fetchbin.bash
index 90242b1..17af258 100644
--- a/paludis/repositories/gentoo/ebuild/builtin_fetchbin.bash
+++ b/paludis/repositories/gentoo/ebuild/builtin_fetchbin.bash
@@ -18,22 +18,22 @@
builtin_fetchbin()
{
- [[ -d "${PKGDIR}" ]] || die "PKGDIR \"${PKGDIR}\" is not a directory"
+ [[ -d "${DISTDIR}" ]] || die "DISTDIR \"${DISTDIR}\" is not a directory"
local a nofetch unique_aa old_aa
for a in ${FLAT_BIN_URI} ; do
local aa=${a##*/}
hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
- if [[ -f "${PKGDIR}/${aa}" ]] && [[ "0" != $(getfsize "${PKGDIR}/${aa}") ]] ; then
+ if [[ -f "${DISTDIR}/${aa}" ]] && [[ "0" != $(getfsize "${DISTDIR}/${aa}") ]] ; then
if [[ "${old_aa}" != "${aa}" ]] ; then
ebuild_section "Already have ${aa}"
old_aa="${aa}"
fi
else
- if [[ -f "${PKGDIR}/${aa}" ]] ; then
+ if [[ -f "${DISTDIR}/${aa}" ]] ; then
ebuild_section "Trying to remove existing ${aa}..."
- rm -f "${PKGDIR}/${aa}"
+ rm -f "${DISTDIR}/${aa}"
fi
if ! hasq fetchbin ${RESTRICT} ; then
@@ -48,7 +48,7 @@ builtin_fetchbin()
[[ -x "${prg}" ]] && break
done
if [[ -x "${prg}" ]] ; then
- ${prg} "${a}" "${PKGDIR}/${aa}"
+ ${prg} "${a}" "${DISTDIR}/${aa}"
else
eerror "Don't know how to fetch '${a}'"
fi
@@ -62,7 +62,7 @@ builtin_fetchbin()
done
for a in ${unique_aa} ; do
- [[ -f ${PKGDIR}/${a} ]] || nofetch="${nofetch} ${a}"
+ [[ -f ${DISTDIR}/${a} ]] || nofetch="${nofetch} ${a}"
done
if [[ -n "${nofetch}" ]] ; then
@@ -80,7 +80,7 @@ builtin_fetchbin()
ebuild_f_fetchbin()
{
local old_sandbox_write="${SANDBOX_WRITE}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${PKGDIR}"
+ [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${DISTDIR}"
if hasq "fetchbin" ${RESTRICT} ; then
ebuild_section "Skipping builtin_fetchbin (RESTRICT)"
elif hasq "fetchbin" ${SKIP_FUNCTIONS} ; then
diff --git a/paludis/repositories/gentoo/ebuild/builtin_initbin.bash b/paludis/repositories/gentoo/ebuild/builtin_initbin.bash
index 5e7075c..bdd9650 100644
--- a/paludis/repositories/gentoo/ebuild/builtin_initbin.bash
+++ b/paludis/repositories/gentoo/ebuild/builtin_initbin.bash
@@ -22,12 +22,12 @@ builtin_initbin()
local a
for a in P PV PR PN PVR PF CATEGORY PORTDIR \
- PKGDIR KV PALUDIS_TMPDIR PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR \
+ DISTDIR KV PALUDIS_TMPDIR PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR \
CHOST PALUDIS_COMMAND ROOT PALUDIS_LOADSAVEENV_DIR ; do
[[ -z "${!a}" ]] && die "\$${a} unset or empty"
done
- for a in PKGDIR ; do
+ for a in DISTDIR ; do
[[ -d "${!a}" ]] || die "\$${a} (\"${!a}\") not a directory"
done
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index cd68e3d..b10ce00 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -23,7 +23,6 @@
#include <paludis/repositories/gentoo/ebuild.hh>
#include <paludis/repositories/gentoo/eapi_phase.hh>
-#include <paludis/distribution.hh>
#include <paludis/eapi.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/environment.hh>
@@ -100,7 +99,7 @@ EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
tr1::shared_ptr<EbuildVersionMetadata> result(new EbuildVersionMetadata);
- FSEntry ebuild_file(_imp->portage_repository->layout()->package_directory(q) / (stringify(q.package) + "-" + stringify(v) + ".ebuild"));
+ FSEntry ebuild_file(_imp->portage_repository->layout()->package_file(q, v));
FSEntry cache_file(_imp->params.cache);
cache_file /= stringify(q.category);
@@ -148,45 +147,64 @@ EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
"No usable cache entry for '" + stringify(q) +
"-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
- tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(
- DistributionData::get_instance()->distribution_from_string(
- _imp->environment->default_distribution())->eapi_when_unknown));
- EAPIPhases phases(eapi->supported->ebuild_phases->ebuild_metadata);
-
- int c(std::distance(phases.begin_phases(), phases.end_phases()));
- if (1 != c)
- throw EAPIConfigurationError("EAPI '" + eapi->name + "' defines "
- + (c == 0 ? "no" : stringify(c)) + " ebuild variable phases but expected exactly one");
+ std::string eapi_str(_imp->portage_repository->layout()->eapi_string_if_known(q, v));
+ if (eapi_str.empty())
+ eapi_str = _imp->params.eapi_when_unknown;
+ tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(eapi_str));
PackageDatabaseEntry e(q, v, _imp->portage_repository->name());
- EbuildMetadataCommand cmd(EbuildCommandParams::create()
- .environment(_imp->environment)
- .db_entry(&e)
- .ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
- .files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
- .eclassdirs(_imp->params.eclassdirs)
- .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- .distdir(_imp->params.distdir)
- .buildroot(_imp->params.buildroot)
- .commands(join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "))
- .sandbox(phases.begin_phases()->option("sandbox"))
- .userpriv(phases.begin_phases()->option("userpriv"))
- .eapi(eapi));
- if (! cmd())
- Log::get_instance()->message(ll_warning, lc_no_context,
- "No usable metadata for '" + stringify(q)
- + "-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
+ if (eapi->supported)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Generating metadata command for '"
+ << e << "' using EAPI '" << eapi->name << "'";
+
+ EAPIPhases phases(eapi->supported->ebuild_phases->ebuild_metadata);
+
+ int c(std::distance(phases.begin_phases(), phases.end_phases()));
+ if (1 != c)
+ throw EAPIConfigurationError("EAPI '" + eapi->name + "' defines "
+ + (c == 0 ? "no" : stringify(c)) + " ebuild variable phases but expected exactly one");
+
+ EbuildMetadataCommand cmd(EbuildCommandParams::create()
+ .environment(_imp->environment)
+ .db_entry(&e)
+ .ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
+ .ebuild_file(ebuild_file)
+ .files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
+ .distdir(_imp->params.distdir)
+ .buildroot(_imp->params.buildroot)
+ .commands(join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "))
+ .sandbox(phases.begin_phases()->option("sandbox"))
+ .userpriv(phases.begin_phases()->option("userpriv"))
+ .eapi(eapi));
+
+ if (! cmd())
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "No usable metadata for '" + stringify(q)
+ + "-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
- if (0 == ((result = cmd.metadata())))
- throw InternalError(PALUDIS_HERE, "cmd.metadata() is zero pointer???");
+ if (0 == ((result = cmd.metadata())))
+ throw InternalError(PALUDIS_HERE, "cmd.metadata() is zero pointer???");
- if (_imp->params.write_cache.basename() != "empty" && result->eapi->supported)
+ Log::get_instance()->message(ll_debug, lc_context) << "Generated metadata for '"
+ << e << "' has EAPI '" << result->eapi->name << "'";
+
+ 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);
+ metadata_cache.save(result);
+ }
+ }
+ else
{
- EbuildFlatMetadataCache metadata_cache(write_cache_file, ebuild_file, _imp->master_mtime,
- _imp->eclass_mtimes, false);
- metadata_cache.save(result);
+ Log::get_instance()->message(ll_debug, lc_context) << "Can't run metadata command for '"
+ << e << "' because EAPI '" << eapi->name << "' is unknown";
+ result->eapi = eapi;
}
}
@@ -529,6 +547,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.environment(_imp->params.environment)
.db_entry(&e)
.ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
+ .ebuild_file(_imp->portage_repository->layout()->package_file(q, v))
.files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
.eclassdirs(_imp->params.eclassdirs)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
@@ -612,6 +631,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.environment(_imp->params.environment)
.db_entry(&e)
.ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
+ .ebuild_file(_imp->portage_repository->layout()->package_file(q, v))
.files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
.eclassdirs(_imp->params.eclassdirs)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
@@ -664,6 +684,7 @@ EbuildEntries::get_environment_variable(const QualifiedPackageName & q,
.environment(_imp->params.environment)
.db_entry(&for_package)
.ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
+ .ebuild_file(_imp->portage_repository->layout()->package_file(q, v))
.files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
.eclassdirs(_imp->params.eclassdirs)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
@@ -700,14 +721,26 @@ EbuildEntries::merge(const MergeOptions &)
bool
EbuildEntries::is_package_file(const QualifiedPackageName & n, const FSEntry & e) const
{
- return is_file_with_prefix_extension(e, stringify(n.package) + "-", ".ebuild", IsFileWithOptions());
+ if (_imp->portage_repository->layout()->eapi_ebuild_suffix())
+ return (0 == e.basename().compare(0, stringify(n.package).length() + 1, stringify(n.package) + "-")) &&
+ std::string::npos != e.basename().rfind('.') &&
+ e.basename().at(e.basename().length() - 1) != '~' &&
+ e.is_regular_file_or_symlink_to_regular_file();
+ else
+ return is_file_with_prefix_extension(e, stringify(n.package) + "-", ".ebuild", IsFileWithOptions());
}
VersionSpec
EbuildEntries::extract_package_file_version(const QualifiedPackageName & n, const FSEntry & e) const
{
Context context("When extracting version from '" + stringify(e) + "':");
- return VersionSpec(strip_leading_string(strip_trailing_string(e.basename(), ".ebuild"), stringify(n.package) + "-"));
+ if (_imp->portage_repository->layout()->eapi_ebuild_suffix())
+ {
+ std::string::size_type p(e.basename().rfind('.'));
+ return VersionSpec(strip_leading_string(e.basename().substr(0, p), stringify(n.package) + "-"));
+ }
+ else
+ return VersionSpec(strip_leading_string(strip_trailing_string(e.basename(), ".ebuild"), stringify(n.package) + "-"));
}
bool
@@ -745,6 +778,7 @@ EbuildEntries::pretend(const QualifiedPackageName & q, const VersionSpec & v,
.environment(_imp->params.environment)
.db_entry(&e)
.ebuild_dir(_imp->portage_repository->layout()->package_directory(q))
+ .ebuild_file(_imp->portage_repository->layout()->package_file(q, v))
.files_dir(_imp->portage_repository->layout()->package_directory(q) / "files")
.eclassdirs(_imp->params.eclassdirs)
.portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
diff --git a/paludis/repositories/gentoo/exheres_layout.cc b/paludis/repositories/gentoo/exheres_layout.cc
new file mode 100644
index 0000000..adcf26d
--- /dev/null
+++ b/paludis/repositories/gentoo/exheres_layout.cc
@@ -0,0 +1,448 @@
+/* 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/repositories/gentoo/exheres_layout.hh>
+#include <paludis/repositories/gentoo/portage_repository_entries.hh>
+#include <paludis/repositories/gentoo/portage_repository_exceptions.hh>
+#include <paludis/config_file.hh>
+#include <paludis/hashed_containers.hh>
+#include <paludis/package_database.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/iterator.hh>
+#include <paludis/util/strip.hh>
+
+#include <paludis/util/tr1_functional.hh>
+#include <functional>
+#include <algorithm>
+
+using namespace paludis;
+
+typedef MakeHashedMap<CategoryNamePart, bool>::Type CategoryMap;
+typedef MakeHashedMap<QualifiedPackageName, bool>::Type PackagesMap;
+typedef MakeHashedMap<QualifiedPackageName, tr1::shared_ptr<VersionSpecCollection> >::Type VersionsMap;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<ExheresLayout>
+ {
+ const RepositoryName name;
+ const FSEntry tree_root;
+
+ mutable bool has_category_names;
+ mutable CategoryMap category_names;
+ mutable PackagesMap package_names;
+ mutable VersionsMap version_specs;
+
+ mutable tr1::shared_ptr<CategoryNamePartCollection> category_names_collection;
+ tr1::shared_ptr<const PortageRepositoryEntries> entries;
+
+ tr1::shared_ptr<FSEntryCollection> arch_list_files;
+ tr1::shared_ptr<FSEntryCollection> repository_mask_files;
+ tr1::shared_ptr<FSEntryCollection> profiles_desc_files;
+ tr1::shared_ptr<FSEntryCollection> mirror_files;
+ tr1::shared_ptr<FSEntryCollection> use_desc_dirs;
+
+ Implementation(const RepositoryName & n, const FSEntry & t,
+ tr1::shared_ptr<const PortageRepositoryEntries> e) :
+ name(n),
+ tree_root(t),
+ has_category_names(false),
+ entries(e),
+ arch_list_files(new FSEntryCollection::Concrete),
+ repository_mask_files(new FSEntryCollection::Concrete),
+ profiles_desc_files(new FSEntryCollection::Concrete),
+ mirror_files(new FSEntryCollection::Concrete),
+ use_desc_dirs(new FSEntryCollection::Concrete)
+ {
+ }
+ };
+}
+
+ExheresLayout::ExheresLayout(const RepositoryName & name, const FSEntry & tree_root,
+ tr1::shared_ptr<const PortageRepositoryEntries> e,
+ tr1::shared_ptr<const FSEntry> f) :
+ Layout(f),
+ PrivateImplementationPattern<ExheresLayout>(new Implementation<ExheresLayout>(name, tree_root, e))
+{
+ if (master_repository_location())
+ {
+ _imp->arch_list_files->push_back(*master_repository_location() / "metadata" / "arch.conf");
+ _imp->repository_mask_files->push_back(*master_repository_location() / "metadata" / "repository_mask.conf");
+ _imp->profiles_desc_files->push_back(*master_repository_location() / "metadata" / "profiles_desc.conf");
+ _imp->mirror_files->push_back(*master_repository_location() / "metadata" / "mirrors.conf");
+ _imp->use_desc_dirs->push_back(*master_repository_location() / "metadata" / "desc");
+ }
+
+ _imp->arch_list_files->push_back(_imp->tree_root / "metadata" / "arch.conf");
+ _imp->repository_mask_files->push_back(_imp->tree_root / "metadata" / "repository_mask.conf");
+ _imp->profiles_desc_files->push_back(_imp->tree_root / "metadata" / "profiles_desc.conf");
+ _imp->mirror_files->push_back(_imp->tree_root / "metadata" / "mirrors.conf");
+ _imp->use_desc_dirs->push_back(_imp->tree_root / "metadata" / "desc");
+}
+
+ExheresLayout::~ExheresLayout()
+{
+}
+
+void
+ExheresLayout::need_category_names() const
+{
+ if (_imp->has_category_names)
+ return;
+
+ Context context("When loading category names for " + stringify(_imp->name) + ":");
+
+ Log::get_instance()->message(ll_debug, lc_context, "need_category_names");
+
+ bool found_one(false);
+
+ std::list<FSEntry> cats_list;
+ if (master_repository_location())
+ cats_list.push_back(*master_repository_location() / "metadata" / "categories.conf");
+ cats_list.push_back(_imp->tree_root / "metadata" / "categories.conf");
+
+ for (std::list<FSEntry>::const_iterator i(cats_list.begin()), i_end(cats_list.end()) ;
+ i != i_end ; ++i)
+ {
+ if (! i->exists())
+ continue;
+
+ LineConfigFile cats(*i, LineConfigFileOptions());
+
+ for (LineConfigFile::Iterator line(cats.begin()), line_end(cats.end()) ;
+ line != line_end ; ++line)
+ {
+ try
+ {
+ _imp->category_names.insert(std::make_pair(CategoryNamePart(*line), false));
+ }
+ catch (const NameError & e)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping line '"
+ + *line + "' in '" + stringify(*i) + "' due to exception '"
+ + stringify(e.message()) + "' ('" + e.what() + ")");
+ }
+ }
+
+ found_one = true;
+ }
+
+ if (! found_one)
+ throw PortageRepositoryConfigurationError("No categories file available for repository '"
+ + stringify(_imp->name) + "', and this layout does not allow auto-generation");
+
+ _imp->has_category_names = true;
+}
+
+void
+ExheresLayout::need_version_specs(const QualifiedPackageName & n) const
+{
+ if (_imp->package_names[n])
+ return;
+
+ Context context("When loading versions for '" + stringify(n) + "' in "
+ + stringify(_imp->name) + ":");
+
+ tr1::shared_ptr<VersionSpecCollection> v(new VersionSpecCollection::Concrete);
+
+ FSEntry path(_imp->tree_root / "packages" / stringify(n.category) / stringify(n.package));
+
+ for (DirIterator e(path), e_end ; e != e_end ; ++e)
+ {
+ if (! _imp->entries->is_package_file(n, *e))
+ continue;
+
+ try
+ {
+ if (! v->insert(VersionSpec(_imp->entries->extract_package_file_version(n, *e))))
+ Log::get_instance()->message(ll_warning, lc_context, "Ignoring entry '" + stringify(*e)
+ + "' for '" + stringify(n) + "' in repository '" + stringify(_imp->name)
+ + "' because another equivalent version already exists");
+ }
+ catch (const Exception & ee)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping entry '"
+ + stringify(*e) + "' for '" + stringify(n) + "' in repository '"
+ + stringify(_imp->name) + "' due to exception '" + ee.message() + "' ("
+ + ee.what() + ")'");
+ }
+ }
+
+ _imp->version_specs.insert(std::make_pair(n, v));
+ _imp->package_names[n] = true;
+}
+
+bool
+ExheresLayout::has_category_named(const CategoryNamePart & c) const
+{
+ Context context("When checking for category '" + stringify(c) + "' in '" + stringify(_imp->name) + "':");
+
+ need_category_names();
+ return _imp->category_names.end() != _imp->category_names.find(c);
+}
+
+bool
+ExheresLayout::has_package_named(const QualifiedPackageName & q) const
+{
+ Context context("When checking for package '" + stringify(q) + "' in '" + stringify(_imp->name) + ":");
+
+ need_category_names();
+
+ CategoryMap::iterator cat_iter(_imp->category_names.find(q.category));
+
+ if (_imp->category_names.end() == cat_iter)
+ return false;
+
+ if (cat_iter->second)
+ {
+ /* this category's package names are fully loaded */
+ return _imp->package_names.find(q) != _imp->package_names.end();
+ }
+ else
+ {
+ /* package names are only partially loaded or not loaded */
+ if (_imp->package_names.find(q) != _imp->package_names.end())
+ return true;
+
+ FSEntry fs(_imp->tree_root);
+ fs /= "packages";
+ fs /= stringify(q.category);
+ fs /= stringify(q.package);
+ if (! fs.is_directory_or_symlink_to_directory())
+ return false;
+ _imp->package_names.insert(std::make_pair(q, false));
+ return true;
+ }
+}
+
+void
+ExheresLayout::need_category_names_collection() const
+{
+ if (_imp->category_names_collection)
+ return;
+
+ need_category_names();
+
+ _imp->category_names_collection.reset(new CategoryNamePartCollection::Concrete);
+ std::copy(_imp->category_names.begin(), _imp->category_names.end(),
+ transform_inserter(_imp->category_names_collection->inserter(),
+ tr1::mem_fn(&std::pair<const CategoryNamePart, bool>::first)));
+}
+
+tr1::shared_ptr<const CategoryNamePartCollection>
+ExheresLayout::category_names() const
+{
+ Context context("When fetching category names in " + stringify(stringify(_imp->name)) + ":");
+
+ need_category_names_collection();
+ return _imp->category_names_collection;
+}
+
+tr1::shared_ptr<const QualifiedPackageNameCollection>
+ExheresLayout::package_names(const CategoryNamePart & c) const
+{
+ using namespace tr1::placeholders;
+
+ /* this isn't particularly fast because it isn't called very often. avoid
+ * changing the data structures used to make this faster at the expense of
+ * slowing down single item queries. */
+
+ Context context("When fetching package names in category '" + stringify(c)
+ + "' in '" + stringify(_imp->name) + "':");
+
+ need_category_names();
+
+ if (_imp->category_names.end() == _imp->category_names.find(c))
+ return tr1::shared_ptr<QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
+
+ if ((_imp->tree_root / "packages" / stringify(c)).is_directory_or_symlink_to_directory())
+ for (DirIterator d(_imp->tree_root / "packages" / stringify(c)), d_end ; d != d_end ; ++d)
+ {
+ try
+ {
+ if (! d->is_directory_or_symlink_to_directory())
+ continue;
+
+ if (DirIterator() == std::find_if(DirIterator(*d), DirIterator(),
+ tr1::bind(&PortageRepositoryEntries::is_package_file, _imp->entries.get(),
+ c + PackageNamePart(d->basename()), _1)))
+ continue;
+
+ _imp->package_names.insert(std::make_pair(c + PackageNamePart(d->basename()), false));
+ }
+ catch (const NameError & e)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping entry '" +
+ d->basename() + "' in category '" + stringify(c) + "' in repository '"
+ + stringify(_imp->name) + "' (" + e.message() + ")");
+ }
+ }
+
+ _imp->category_names[c] = true;
+
+ tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
+
+ for (PackagesMap::const_iterator p(_imp->package_names.begin()), p_end(_imp->package_names.end()) ;
+ p != p_end ; ++p)
+ if (p->first.category == c)
+ result->insert(p->first);
+
+ return result;
+}
+
+tr1::shared_ptr<const VersionSpecCollection>
+ExheresLayout::version_specs(const QualifiedPackageName & n) const
+{
+ Context context("When fetching versions of '" + stringify(n) + "' in " + stringify(_imp->name) + ":");
+
+ if (has_package_named(n))
+ {
+ need_version_specs(n);
+ return _imp->version_specs.find(n)->second;
+ }
+ else
+ return tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
+}
+
+bool
+ExheresLayout::has_version(const QualifiedPackageName & q, const VersionSpec & v) const
+{
+ Context context("When checking for version '" + stringify(v) + "' in '"
+ + stringify(q) + "' in " + stringify(_imp->name) + ":");
+
+ if (has_package_named(q))
+ {
+ need_version_specs(q);
+ tr1::shared_ptr<VersionSpecCollection> vv(_imp->version_specs.find(q)->second);
+ return vv->end() != vv->find(v);
+ }
+ else
+ return false;
+}
+
+FSEntry
+ExheresLayout::info_packages_file(const FSEntry & dir) const
+{
+ return dir / "info_packages.conf";
+}
+
+FSEntry
+ExheresLayout::info_variables_file(const FSEntry & dir) const
+{
+ return dir / "info_variables.conf";
+}
+
+FSEntry
+ExheresLayout::package_directory(const QualifiedPackageName & qpn) const
+{
+ return _imp->tree_root / "packages" / stringify(qpn.category) / stringify(qpn.package);
+}
+
+FSEntry
+ExheresLayout::category_directory(const CategoryNamePart & cat) const
+{
+ return _imp->tree_root / "packages" / stringify(cat);
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+ExheresLayout::arch_list_files() const
+{
+ return _imp->arch_list_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+ExheresLayout::repository_mask_files() const
+{
+ return _imp->repository_mask_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+ExheresLayout::profiles_desc_files() const
+{
+ return _imp->profiles_desc_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+ExheresLayout::mirror_files() const
+{
+ return _imp->mirror_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+ExheresLayout::use_desc_dirs() const
+{
+ return _imp->use_desc_dirs;
+}
+
+bool
+ExheresLayout::eapi_ebuild_suffix() const
+{
+ return true;
+}
+
+FSEntry
+ExheresLayout::package_file(const QualifiedPackageName & q, const VersionSpec & v) const
+{
+ for (DirIterator d(package_directory(q)), d_end ; d != d_end ; ++d)
+ {
+ std::string::size_type p(d->basename().rfind('.'));
+ if (std::string::npos == p)
+ continue;
+
+ std::string prefix(stringify(q.package) + "-" + stringify(v));
+ if (0 == d->basename().compare(0, p, prefix))
+ if (_imp->entries->is_package_file(q, *d))
+ return *d;
+ }
+
+ throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, _imp->name)));
+}
+
+std::string
+ExheresLayout::eapi_string_if_known(const QualifiedPackageName & q, const VersionSpec & v) const
+{
+ for (DirIterator d(package_directory(q)), d_end ; d != d_end ; ++d)
+ {
+ std::string::size_type p(d->basename().rfind('.'));
+ if (std::string::npos == p)
+ continue;
+
+ std::string prefix(stringify(q.package) + "-" + stringify(v));
+ if (0 == d->basename().compare(0, p, prefix))
+ if (_imp->entries->is_package_file(q, *d))
+ return d->basename().substr(p + 1);
+ }
+
+ return "";
+}
+
+FSEntry
+ExheresLayout::profiles_base_dir() const
+{
+ return _imp->tree_root / "profiles";
+}
+
+
diff --git a/paludis/repositories/gentoo/exheres_layout.hh b/paludis/repositories/gentoo/exheres_layout.hh
new file mode 100644
index 0000000..49b1d9b
--- /dev/null
+++ b/paludis/repositories/gentoo/exheres_layout.hh
@@ -0,0 +1,118 @@
+/* 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_REPOSITORIES_GENTOO_EXHERES_LAYOUT_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GENTOO_EXHERES_LAYOUT_HH 1
+
+#include <paludis/repositories/gentoo/layout.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace paludis
+{
+ class PortageRepositoryEntries;
+
+ /**
+ * The Exheres tree layout for a PortageRepository.
+ *
+ * \ingroup grpportagerepository
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE ExheresLayout :
+ public Layout,
+ private PrivateImplementationPattern<ExheresLayout>
+ {
+ private:
+ void need_category_names() const;
+ void need_category_names_collection() const;
+ void need_version_specs(const QualifiedPackageName &) const;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ ExheresLayout(const RepositoryName &, const FSEntry &,
+ tr1::shared_ptr<const PortageRepositoryEntries>,
+ tr1::shared_ptr<const FSEntry>);
+
+ virtual ~ExheresLayout();
+
+ ///\}
+
+ virtual bool has_category_named(const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool has_package_named(const QualifiedPackageName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const CategoryNamePartCollection> category_names() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const QualifiedPackageNameCollection> package_names(
+ const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const VersionSpecCollection> version_specs(
+ const QualifiedPackageName & n) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool has_version(const QualifiedPackageName &, const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry info_packages_file(const FSEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry info_variables_file(const FSEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry package_directory(const QualifiedPackageName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry category_directory(const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry package_file(const QualifiedPackageName &, const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string eapi_string_if_known(const QualifiedPackageName &, const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> arch_list_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> repository_mask_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> profiles_desc_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> mirror_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> use_desc_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool eapi_ebuild_suffix() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry profiles_base_dir() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+}
+
+#endif
diff --git a/paludis/repositories/gentoo/layout.cc b/paludis/repositories/gentoo/layout.cc
index ecfbe12..b94d5c1 100644
--- a/paludis/repositories/gentoo/layout.cc
+++ b/paludis/repositories/gentoo/layout.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/gentoo/layout.hh>
#include <paludis/repositories/gentoo/traditional_layout.hh>
+#include <paludis/repositories/gentoo/exheres_layout.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor-impl.hh>
@@ -29,13 +30,14 @@ using namespace paludis;
template class VirtualConstructor<std::string,
tr1::shared_ptr<Layout> (*) (const RepositoryName &, const FSEntry &,
- tr1::shared_ptr<const PortageRepositoryEntries>),
+ tr1::shared_ptr<const PortageRepositoryEntries>,
+ tr1::shared_ptr<const FSEntry>),
virtual_constructor_not_found::ThrowException<NoSuchLayoutType> >;
template class InstantiationPolicy<LayoutMaker, instantiation_method::SingletonTag>;
-Layout::Layout() :
- _profiles_dirs(new FSEntryCollection::Concrete)
+Layout::Layout(tr1::shared_ptr<const FSEntry> l) :
+ _master_repository_location(l)
{
}
@@ -43,22 +45,10 @@ Layout::~Layout()
{
}
-Layout::ProfilesDirsIterator
-Layout::begin_profiles_dirs() const
+tr1::shared_ptr<const FSEntry>
+Layout::master_repository_location() const
{
- return ProfilesDirsIterator(_profiles_dirs->begin());
-}
-
-Layout::ProfilesDirsIterator
-Layout::end_profiles_dirs() const
-{
- return ProfilesDirsIterator(_profiles_dirs->end());
-}
-
-void
-Layout::add_profiles_dir(const FSEntry & f)
-{
- _profiles_dirs->push_back(f);
+ return _master_repository_location;
}
namespace
@@ -66,15 +56,17 @@ namespace
template <typename T_>
tr1::shared_ptr<Layout>
make_layout(const RepositoryName & n, const FSEntry & b,
- tr1::shared_ptr<const PortageRepositoryEntries> e)
+ tr1::shared_ptr<const PortageRepositoryEntries> e,
+ tr1::shared_ptr<const FSEntry> f)
{
- return tr1::shared_ptr<Layout>(new T_(n, b, e));
+ return tr1::shared_ptr<Layout>(new T_(n, b, e, f));
}
}
LayoutMaker::LayoutMaker()
{
register_maker("traditional", &make_layout<TraditionalLayout>);
+ register_maker("exheres", &make_layout<ExheresLayout>);
}
NoSuchLayoutType::NoSuchLayoutType(const std::string & format) throw () :
@@ -82,3 +74,4 @@ NoSuchLayoutType::NoSuchLayoutType(const std::string & format) throw () :
{
}
+
diff --git a/paludis/repositories/gentoo/layout.hh b/paludis/repositories/gentoo/layout.hh
index e7fe91d..e3eae90 100644
--- a/paludis/repositories/gentoo/layout.hh
+++ b/paludis/repositories/gentoo/layout.hh
@@ -27,7 +27,6 @@
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/virtual_constructor.hh>
-#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <paludis/util/tr1_memory.hh>
namespace paludis
@@ -43,13 +42,13 @@ namespace paludis
class PALUDIS_VISIBLE Layout
{
private:
- tr1::shared_ptr<FSEntryCollection> _profiles_dirs;
+ tr1::shared_ptr<const FSEntry> _master_repository_location;
protected:
///\name Basic operations
///\{
- Layout();
+ Layout(tr1::shared_ptr<const FSEntry> master_repository_location);
///\}
@@ -61,14 +60,10 @@ namespace paludis
///\}
- ///\name Configuration options
+ ///\name Configuration information
///\{
- void add_profiles_dir(const FSEntry &);
-
- typedef libwrapiter::ForwardIterator<Layout, const FSEntry> ProfilesDirsIterator;
- ProfilesDirsIterator begin_profiles_dirs() const;
- ProfilesDirsIterator end_profiles_dirs() const;
+ tr1::shared_ptr<const FSEntry> master_repository_location() const;
///\}
@@ -95,25 +90,43 @@ namespace paludis
virtual bool has_version(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry package_mask_file(const FSEntry & dir) const
+ virtual FSEntry info_packages_file(const FSEntry &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry arch_list_file(const FSEntry & dir) const
+ virtual FSEntry info_variables_file(const FSEntry &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry mirrors_file(const FSEntry &) const
+ virtual FSEntry package_directory(const QualifiedPackageName &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry info_packages_file(const FSEntry &) const
+ virtual FSEntry category_directory(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry info_variables_file(const FSEntry &) const
+ virtual FSEntry package_file(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry package_directory(const QualifiedPackageName &) const
+ virtual std::string eapi_string_if_known(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual FSEntry category_directory(const CategoryNamePart &) const
+ virtual tr1::shared_ptr<const FSEntryCollection> arch_list_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual tr1::shared_ptr<const FSEntryCollection> repository_mask_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual tr1::shared_ptr<const FSEntryCollection> profiles_desc_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual tr1::shared_ptr<const FSEntryCollection> mirror_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual tr1::shared_ptr<const FSEntryCollection> use_desc_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual bool eapi_ebuild_suffix() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual FSEntry profiles_base_dir() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -144,7 +157,8 @@ namespace paludis
class PALUDIS_VISIBLE LayoutMaker :
public VirtualConstructor<std::string,
tr1::shared_ptr<Layout> (*) (const RepositoryName &, const FSEntry &,
- tr1::shared_ptr<const PortageRepositoryEntries>),
+ tr1::shared_ptr<const PortageRepositoryEntries>,
+ tr1::shared_ptr<const FSEntry>),
virtual_constructor_not_found::ThrowException<NoSuchLayoutType> >,
public InstantiationPolicy<LayoutMaker, instantiation_method::SingletonTag>
{
diff --git a/paludis/repositories/gentoo/make_ebin_repository.cc b/paludis/repositories/gentoo/make_ebin_repository.cc
index 83dd9a3..955c7f8 100644
--- a/paludis/repositories/gentoo/make_ebin_repository.cc
+++ b/paludis/repositories/gentoo/make_ebin_repository.cc
@@ -23,6 +23,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/repositories/gentoo/portage_repository_exceptions.hh>
#include <paludis/environment.hh>
+#include <paludis/distribution.hh>
using namespace paludis;
@@ -80,17 +81,6 @@ paludis::make_ebin_repository(
tr1::shared_ptr<FSEntryCollection> eclassdirs(new FSEntryCollection::Concrete);
- std::string pkgdir;
- if (m->end() == m->find("pkgdir") || ((pkgdir = m->find("pkgdir")->second)).empty())
- {
- if (master_repository)
- pkgdir = stringify(master_repository->params().pkgdir);
- else
- pkgdir = location + "/packages";
- }
- if (pkgdir == "/var/empty" || pkgdir.empty())
- throw PortageRepositoryConfigurationError("Key 'pkgdir' not specified or empty");
-
std::string setsdir;
if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
setsdir = location + "/sets";
@@ -112,6 +102,22 @@ paludis::make_ebin_repository(
names_cache = "/var/empty";
}
+ std::string distdir;
+ if (m->end() == m->find("distdir") || ((distdir = m->find("distdir")->second)).empty())
+ {
+ if (master_repository)
+ distdir = stringify(master_repository->params().distdir);
+ else
+ {
+ distdir = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_distdir;
+ if (distdir.empty())
+ distdir = location + "/distfiles";
+ else if ('/' != distdir.at(0))
+ distdir = location + "/" + distdir;
+ }
+ }
+
std::string sync;
if (m->end() != m->find("sync"))
sync = m->find("sync")->second;
@@ -126,7 +132,18 @@ paludis::make_ebin_repository(
std::string layout;
if (m->end() == m->find("layout") || ((layout = m->find("layout")->second)).empty())
- layout = "traditional";
+ layout = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_layout;
+
+ std::string eapi_when_unknown;
+ if (m->end() == m->find("eapi_when_unknown") || ((eapi_when_unknown = m->find("eapi_when_unknown")->second)).empty())
+ eapi_when_unknown = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_eapi_when_unknown;
+
+ std::string eapi_when_unspecified;
+ if (m->end() == m->find("eapi_when_unspecified") || ((eapi_when_unspecified = m->find("eapi_when_unspecified")->second)).empty())
+ eapi_when_unspecified = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_eapi_when_unspecified;
if (m->end() != m->find("sync_exclude"))
{
@@ -139,7 +156,8 @@ paludis::make_ebin_repository(
std::string buildroot;
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
- buildroot = "/var/tmp/paludis";
+ buildroot = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_build_root;
return tr1::shared_ptr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create()
.entry_format("ebin")
@@ -152,7 +170,6 @@ paludis::make_ebin_repository(
.names_cache(names_cache)
.eclassdirs(tr1::shared_ptr<const FSEntryCollection>(new FSEntryCollection::Concrete))
.distdir(FSEntry("/var/empty"))
- .pkgdir(pkgdir)
.securitydir(securitydir)
.setsdir(setsdir)
.newsdir(newsdir)
@@ -161,6 +178,8 @@ paludis::make_ebin_repository(
.master_repository(master_repository)
.enable_destinations(true)
.write_bin_uri_prefix(write_bin_uri_prefix)
+ .eapi_when_unspecified(eapi_when_unspecified)
+ .eapi_when_unknown(eapi_when_unknown)
.buildroot(buildroot)));
}
diff --git a/paludis/repositories/gentoo/make_ebuild_repository.cc b/paludis/repositories/gentoo/make_ebuild_repository.cc
index 2ca32b4..e2e5f7e 100644
--- a/paludis/repositories/gentoo/make_ebuild_repository.cc
+++ b/paludis/repositories/gentoo/make_ebuild_repository.cc
@@ -110,15 +110,6 @@ paludis::make_ebuild_repository(
}
}
- std::string pkgdir;
- if (m->end() == m->find("pkgdir") || ((pkgdir = m->find("pkgdir")->second)).empty())
- {
- if (master_repository)
- pkgdir = stringify(master_repository->params().pkgdir);
- else
- pkgdir = location + "/packages";
- }
-
std::string setsdir;
if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
setsdir = location + "/sets";
@@ -144,6 +135,16 @@ paludis::make_ebuild_repository(
write_cache = DistributionData::get_instance()->distribution_from_string(
env->default_distribution())->default_ebuild_write_cache;
+ std::string eapi_when_unknown;
+ if (m->end() == m->find("eapi_when_unknown") || ((eapi_when_unknown = m->find("eapi_when_unknown")->second)).empty())
+ eapi_when_unknown = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_eapi_when_unknown;
+
+ std::string eapi_when_unspecified;
+ if (m->end() == m->find("eapi_when_unspecified") || ((eapi_when_unspecified = m->find("eapi_when_unspecified")->second)).empty())
+ eapi_when_unspecified = DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution())->default_ebuild_eapi_when_unspecified;
+
std::string names_cache;
if (m->end() == m->find("names_cache") || ((names_cache = m->find("names_cache")->second)).empty())
{
@@ -196,7 +197,6 @@ paludis::make_ebuild_repository(
.names_cache(names_cache)
.eclassdirs(eclassdirs)
.distdir(distdir)
- .pkgdir(pkgdir)
.securitydir(securitydir)
.setsdir(setsdir)
.newsdir(newsdir)
@@ -205,6 +205,8 @@ paludis::make_ebuild_repository(
.master_repository(master_repository)
.enable_destinations(false)
.write_bin_uri_prefix("")
+ .eapi_when_unknown(eapi_when_unknown)
+ .eapi_when_unspecified(eapi_when_unspecified)
.buildroot(buildroot)));
}
diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc
index 81da75a..2cad69f 100644
--- a/paludis/repositories/gentoo/portage_repository.cc
+++ b/paludis/repositories/gentoo/portage_repository.cc
@@ -45,6 +45,7 @@
#include <paludis/query.hh>
#include <paludis/repository_name_cache.hh>
#include <paludis/syncer.hh>
+#include <paludis/eapi.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
@@ -54,6 +55,7 @@
#include <paludis/util/pstream.hh>
#include <paludis/util/random.hh>
#include <paludis/util/save.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/system.hh>
@@ -142,13 +144,10 @@ namespace paludis
entries_ptr(PortageRepositoryEntriesMaker::get_instance()->find_maker(
params.entry_format)(params.environment, r, p)),
layout(LayoutMaker::get_instance()->find_maker(
- params.layout)(r->name(), params.location, entries_ptr))
+ params.layout)(r->name(), params.location, entries_ptr, params.master_repository ?
+ make_shared_ptr(new FSEntry(params.master_repository->params().location)) :
+ tr1::shared_ptr<FSEntry>()))
{
- if (params.master_repository)
- layout->add_profiles_dir(params.master_repository->params().location / "profiles");
-
- if ((params.location / "profiles").exists())
- layout->add_profiles_dir(params.location / "profiles");
}
Implementation<PortageRepository>::~Implementation()
@@ -162,7 +161,8 @@ namespace paludis
return;
profile_ptr.reset(new PortageRepositoryProfile(
- params.environment, repo, repo->name(), *params.profiles));
+ params.environment, repo, repo->name(), *params.profiles,
+ EAPIData::get_instance()->eapi_from_string(params.eapi_when_unknown)->supported->want_arch_var));
}
void
@@ -174,15 +174,16 @@ namespace paludis
Context context("When loading profiles.desc:");
bool found_one(false);
- for (Layout::ProfilesDirsIterator p(layout->begin_profiles_dirs()), p_end(layout->end_profiles_dirs()) ;
+ tr1::shared_ptr<const FSEntryCollection> profiles_desc_files(layout->profiles_desc_files());
+ for (FSEntryCollection::Iterator p(profiles_desc_files->begin()), p_end(profiles_desc_files->end()) ;
p != p_end ; ++p)
{
- if (! (*p / "profiles.desc").exists())
+ if (! p->exists())
continue;
found_one = true;
- LineConfigFile f(*p / "profiles.desc", LineConfigFileOptions());
+ LineConfigFile f(*p, LineConfigFileOptions());
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; line != line_end ; ++line)
{
std::vector<std::string> tokens;
@@ -192,13 +193,14 @@ namespace paludis
continue;
FSEntryCollection::Concrete profiles;
- profiles.push_back(*p / tokens.at(1));
+ profiles.push_back(layout->profiles_base_dir() / tokens.at(1));
profiles_desc.push_back(RepositoryPortageInterface::ProfilesDescLine::create()
.arch(tokens.at(0))
.path(*profiles.begin())
.status(tokens.at(2))
.profile(tr1::shared_ptr<PortageRepositoryProfile>(new PortageRepositoryProfile(
- params.environment, repo, repo->name(), profiles))));
+ params.environment, repo, repo->name(), profiles,
+ EAPIData::get_instance()->eapi_from_string(params.eapi_when_unknown)->supported->want_arch_var))));
}
}
@@ -277,6 +279,8 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
// fairly slow to calculate.
tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
+ config_info->add_kv("entry_format", _imp->params.entry_format);
+ config_info->add_kv("layout", _imp->params.layout);
config_info->add_kv("location", stringify(_imp->params.location));
config_info->add_kv("profiles", join(_imp->params.profiles->begin(),
_imp->params.profiles->end(), " "));
@@ -286,7 +290,6 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
config_info->add_kv("write_cache", stringify(_imp->params.write_cache));
config_info->add_kv("names_cache", stringify(_imp->params.names_cache));
config_info->add_kv("distdir", stringify(_imp->params.distdir));
- config_info->add_kv("pkgdir", stringify(_imp->params.pkgdir));
config_info->add_kv("securitydir", stringify(_imp->params.securitydir));
config_info->add_kv("setsdir", stringify(_imp->params.setsdir));
config_info->add_kv("newsdir", stringify(_imp->params.newsdir));
@@ -295,6 +298,8 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
config_info->add_kv("buildroot", stringify(_imp->params.buildroot));
config_info->add_kv("sync", _imp->params.sync);
config_info->add_kv("sync_options", _imp->params.sync_options);
+ config_info->add_kv("eapi_when_unknown", _imp->params.eapi_when_unknown);
+ config_info->add_kv("eapi_when_unspecified", _imp->params.eapi_when_unspecified);
if (_imp->params.master_repository)
config_info->add_kv("master_repository", stringify(_imp->params.master_repository->name()));
@@ -394,15 +399,15 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
Context context("When querying repository mask for '" + stringify(q) + "-"
+ stringify(v) + "':");
- for (Layout::ProfilesDirsIterator p(_imp->layout->begin_profiles_dirs()), p_end(_imp->layout->end_profiles_dirs()) ;
+ tr1::shared_ptr<const FSEntryCollection> repository_mask_files(_imp->layout->repository_mask_files());
+ for (FSEntryCollection::Iterator p(repository_mask_files->begin()), p_end(repository_mask_files->end()) ;
p != p_end ; ++p)
{
- FSEntry fff(_imp->layout->package_mask_file(*p));
- Context context_local("When reading '" + stringify(fff) + "':");
+ Context context_local("When reading '" + stringify(*p) + "':");
- if (fff.exists())
+ if (p->exists())
{
- LineConfigFile ff(fff, LineConfigFileOptions());
+ LineConfigFile ff(*p, LineConfigFileOptions());
for (LineConfigFile::Iterator line(ff.begin()), line_end(ff.end()) ;
line != line_end ; ++line)
{
@@ -480,14 +485,14 @@ PortageRepository::do_arch_flags() const
_imp->arch_flags.reset(new UseFlagNameCollection::Concrete);
bool found_one(false);
- for (Layout::ProfilesDirsIterator p(_imp->layout->begin_profiles_dirs()), p_end(_imp->layout->end_profiles_dirs()) ;
+ tr1::shared_ptr<const FSEntryCollection> arch_list_files(_imp->layout->arch_list_files());
+ for (FSEntryCollection::Iterator p(arch_list_files->begin()), p_end(arch_list_files->end()) ;
p != p_end ; ++p)
{
- FSEntry a(_imp->layout->arch_list_file(*p));
- if (! a.exists())
+ if (! p->exists())
continue;
- LineConfigFile archs(a, LineConfigFileOptions());
+ LineConfigFile archs(*p, LineConfigFileOptions());
std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(_imp->arch_flags->inserter()));
found_one = true;
}
@@ -527,12 +532,13 @@ PortageRepository::need_mirrors() const
if (! _imp->has_mirrors)
{
bool found_one(false);
- for (Layout::ProfilesDirsIterator p(_imp->layout->begin_profiles_dirs()), p_end(_imp->layout->end_profiles_dirs()) ;
+ tr1::shared_ptr<const FSEntryCollection> mirror_files(_imp->layout->mirror_files());
+ for (FSEntryCollection::Iterator p(mirror_files->begin()), p_end(mirror_files->end()) ;
p != p_end ; ++p)
{
- if (_imp->layout->mirrors_file(*p).exists())
+ if (p->exists())
{
- LineConfigFile mirrors(_imp->layout->mirrors_file(*p), LineConfigFileOptions());
+ LineConfigFile mirrors(*p, LineConfigFileOptions());
for (LineConfigFile::Iterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
{
std::vector<std::string> entries;
@@ -958,9 +964,12 @@ PortageRepository::do_describe_use_flag(const UseFlagName & f,
const PackageDatabaseEntry & e) const
{
if (_imp->use_desc.empty())
- for (Layout::ProfilesDirsIterator p(_imp->layout->begin_profiles_dirs()), p_end(_imp->layout->end_profiles_dirs()) ;
+ {
+ tr1::shared_ptr<const FSEntryCollection> use_desc_dirs(_imp->layout->use_desc_dirs());
+ for (FSEntryCollection::Iterator p(use_desc_dirs->begin()), p_end(use_desc_dirs->end()) ;
p != p_end ; ++p)
_imp->use_desc.push_back(tr1::shared_ptr<UseDesc>(new UseDesc(*p)));
+ }
std::string result;
for (std::list<tr1::shared_ptr<UseDesc> >::const_iterator i(_imp->use_desc.begin()),
diff --git a/paludis/repositories/gentoo/portage_repository_params.sr b/paludis/repositories/gentoo/portage_repository_params.sr
index 60acd42..3e90450 100644
--- a/paludis/repositories/gentoo/portage_repository_params.sr
+++ b/paludis/repositories/gentoo/portage_repository_params.sr
@@ -14,7 +14,6 @@ make_class_PortageRepositoryParams()
key write_cache FSEntry
key names_cache FSEntry
key distdir FSEntry
- key pkgdir FSEntry
key eclassdirs "tr1::shared_ptr<const FSEntryCollection>"
key setsdir FSEntry
key securitydir FSEntry
@@ -25,6 +24,8 @@ make_class_PortageRepositoryParams()
key master_repository "tr1::shared_ptr<const PortageRepository>"
key enable_destinations bool
key write_bin_uri_prefix std::string
+ key eapi_when_unknown std::string
+ key eapi_when_unspecified std::string
doxygen_comment << "END"
/**
diff --git a/paludis/repositories/gentoo/portage_repository_profile.cc b/paludis/repositories/gentoo/portage_repository_profile.cc
index ec770ea..f482486 100644
--- a/paludis/repositories/gentoo/portage_repository_profile.cc
+++ b/paludis/repositories/gentoo/portage_repository_profile.cc
@@ -159,7 +159,8 @@ namespace paludis
///\{
Implementation(const Environment * const e, const PortageRepository * const p,
- const RepositoryName & name, const FSEntryCollection & dirs) :
+ const RepositoryName & name, const FSEntryCollection & dirs,
+ bool arch_is_special) :
env(e),
repository(p),
system_packages(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
@@ -175,7 +176,8 @@ namespace paludis
make_vars_from_file_vars();
load_special_make_defaults_vars();
add_use_expand_to_use();
- handle_profile_arch_var();
+ if (arch_is_special)
+ handle_profile_arch_var();
}
~Implementation()
@@ -581,9 +583,10 @@ Implementation<PortageRepositoryProfile>::handle_profile_arch_var()
PortageRepositoryProfile::PortageRepositoryProfile(
const Environment * const env, const PortageRepository * const p, const RepositoryName & name,
- const FSEntryCollection & location) :
+ const FSEntryCollection & location,
+ bool arch_is_special) :
PrivateImplementationPattern<PortageRepositoryProfile>(
- new Implementation<PortageRepositoryProfile>(env, p, name, location))
+ new Implementation<PortageRepositoryProfile>(env, p, name, location, arch_is_special))
{
}
diff --git a/paludis/repositories/gentoo/portage_repository_profile.hh b/paludis/repositories/gentoo/portage_repository_profile.hh
index e1407c2..bbc4e37 100644
--- a/paludis/repositories/gentoo/portage_repository_profile.hh
+++ b/paludis/repositories/gentoo/portage_repository_profile.hh
@@ -58,7 +58,8 @@ namespace paludis
PortageRepositoryProfile(const Environment * const env,
const PortageRepository * const,
const RepositoryName & name,
- const FSEntryCollection & location);
+ const FSEntryCollection & location,
+ bool arch_is_special);
~PortageRepositoryProfile();
///\}
diff --git a/paludis/repositories/gentoo/traditional_layout.cc b/paludis/repositories/gentoo/traditional_layout.cc
index 09de664..6e3def4 100644
--- a/paludis/repositories/gentoo/traditional_layout.cc
+++ b/paludis/repositories/gentoo/traditional_layout.cc
@@ -22,6 +22,7 @@
#include <paludis/repositories/gentoo/portage_repository_entries.hh>
#include <paludis/config_file.hh>
#include <paludis/hashed_containers.hh>
+#include <paludis/package_database.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -58,21 +59,48 @@ namespace paludis
mutable tr1::shared_ptr<CategoryNamePartCollection> category_names_collection;
tr1::shared_ptr<const PortageRepositoryEntries> entries;
+ tr1::shared_ptr<FSEntryCollection> arch_list_files;
+ tr1::shared_ptr<FSEntryCollection> repository_mask_files;
+ tr1::shared_ptr<FSEntryCollection> profiles_desc_files;
+ tr1::shared_ptr<FSEntryCollection> mirror_files;
+ tr1::shared_ptr<FSEntryCollection> use_desc_dirs;
+
Implementation(const RepositoryName & n, const FSEntry & t,
tr1::shared_ptr<const PortageRepositoryEntries> e) :
name(n),
tree_root(t),
has_category_names(false),
- entries(e)
+ entries(e),
+ arch_list_files(new FSEntryCollection::Concrete),
+ repository_mask_files(new FSEntryCollection::Concrete),
+ profiles_desc_files(new FSEntryCollection::Concrete),
+ mirror_files(new FSEntryCollection::Concrete),
+ use_desc_dirs(new FSEntryCollection::Concrete)
{
}
};
}
TraditionalLayout::TraditionalLayout(const RepositoryName & name, const FSEntry & tree_root,
- tr1::shared_ptr<const PortageRepositoryEntries> e) :
+ tr1::shared_ptr<const PortageRepositoryEntries> e,
+ tr1::shared_ptr<const FSEntry> f) :
+ Layout(f),
PrivateImplementationPattern<TraditionalLayout>(new Implementation<TraditionalLayout>(name, tree_root, e))
{
+ if (master_repository_location())
+ {
+ _imp->arch_list_files->push_back(*master_repository_location() / "profiles" / "arch.list");
+ _imp->repository_mask_files->push_back(*master_repository_location() / "profiles" / "package.mask");
+ _imp->profiles_desc_files->push_back(*master_repository_location() / "profiles" / "profiles.desc");
+ _imp->mirror_files->push_back(*master_repository_location() / "profiles" / "thirdpartymirrors");
+ _imp->use_desc_dirs->push_back(*master_repository_location() / "profiles");
+ }
+
+ _imp->arch_list_files->push_back(_imp->tree_root / "profiles" / "arch.list");
+ _imp->repository_mask_files->push_back(_imp->tree_root / "profiles" / "package.mask");
+ _imp->profiles_desc_files->push_back(_imp->tree_root / "profiles" / "profiles.desc");
+ _imp->mirror_files->push_back(_imp->tree_root / "profiles" / "thirdpartymirrors");
+ _imp->use_desc_dirs->push_back(_imp->tree_root / "profiles");
}
TraditionalLayout::~TraditionalLayout()
@@ -91,13 +119,18 @@ TraditionalLayout::need_category_names() const
bool found_one(false);
- for (ProfilesDirsIterator p(begin_profiles_dirs()), p_end(end_profiles_dirs()) ;
- p != p_end ; ++p)
+ std::list<FSEntry> cats_list;
+ if (master_repository_location())
+ cats_list.push_back(*master_repository_location() / "profiles" / "categories");
+ cats_list.push_back(_imp->tree_root / "profiles" / "categories");
+
+ for (std::list<FSEntry>::const_iterator i(cats_list.begin()), i_end(cats_list.end()) ;
+ i != i_end ; ++i)
{
- if (! (*p / "categories").exists())
+ if (! i->exists())
continue;
- LineConfigFile cats(*p / "categories", LineConfigFileOptions());
+ LineConfigFile cats(*i, LineConfigFileOptions());
for (LineConfigFile::Iterator line(cats.begin()), line_end(cats.end()) ;
line != line_end ; ++line)
@@ -109,7 +142,7 @@ TraditionalLayout::need_category_names() const
catch (const NameError & e)
{
Log::get_instance()->message(ll_warning, lc_context, "Skipping line '"
- + *line + "' in '" + stringify(*p / "categories") + "' due to exception '"
+ + *line + "' in '" + stringify(*i) + "' due to exception '"
+ stringify(e.message()) + "' ('" + e.what() + ")");
}
}
@@ -330,43 +363,92 @@ TraditionalLayout::has_version(const QualifiedPackageName & q, const VersionSpec
}
FSEntry
-TraditionalLayout::package_mask_file(const FSEntry & dir) const
+TraditionalLayout::info_packages_file(const FSEntry & dir) const
{
- return dir / "package.mask";
+ return dir / "info_pkgs";
}
FSEntry
-TraditionalLayout::arch_list_file(const FSEntry & dir) const
+TraditionalLayout::info_variables_file(const FSEntry & dir) const
{
- return dir / "arch.list";
+ return dir / "info_vars";
}
FSEntry
-TraditionalLayout::mirrors_file(const FSEntry & dir) const
+TraditionalLayout::package_directory(const QualifiedPackageName & qpn) const
{
- return dir / "thirdpartymirrors";
+ return _imp->tree_root / stringify(qpn.category) / stringify(qpn.package);
}
FSEntry
-TraditionalLayout::info_packages_file(const FSEntry & dir) const
+TraditionalLayout::category_directory(const CategoryNamePart & cat) const
{
- return dir / "info_pkgs";
+ return _imp->tree_root / stringify(cat);
}
-FSEntry
-TraditionalLayout::info_variables_file(const FSEntry & dir) const
+tr1::shared_ptr<const FSEntryCollection>
+TraditionalLayout::arch_list_files() const
{
- return dir / "info_vars";
+ return _imp->arch_list_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+TraditionalLayout::repository_mask_files() const
+{
+ return _imp->repository_mask_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+TraditionalLayout::profiles_desc_files() const
+{
+ return _imp->profiles_desc_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+TraditionalLayout::mirror_files() const
+{
+ return _imp->mirror_files;
+}
+
+tr1::shared_ptr<const FSEntryCollection>
+TraditionalLayout::use_desc_dirs() const
+{
+ return _imp->use_desc_dirs;
+}
+
+bool
+TraditionalLayout::eapi_ebuild_suffix() const
+{
+ return false;
}
FSEntry
-TraditionalLayout::package_directory(const QualifiedPackageName & qpn) const
+TraditionalLayout::package_file(const QualifiedPackageName & q, const VersionSpec & v) const
{
- return _imp->tree_root / stringify(qpn.category) / stringify(qpn.package);
+ for (DirIterator d(package_directory(q)), d_end ; d != d_end ; ++d)
+ {
+ std::string::size_type p(d->basename().rfind('.'));
+ if (std::string::npos == p)
+ continue;
+
+ std::string prefix(stringify(q.package) + "-" + stringify(v));
+ if (0 == d->basename().compare(0, p, prefix))
+ if (_imp->entries->is_package_file(q, *d))
+ return *d;
+ }
+
+ throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, _imp->name)));
+}
+
+std::string
+TraditionalLayout::eapi_string_if_known(const QualifiedPackageName &, const VersionSpec &) const
+{
+ return "";
}
FSEntry
-TraditionalLayout::category_directory(const CategoryNamePart & cat) const
+TraditionalLayout::profiles_base_dir() const
{
- return _imp->tree_root / stringify(cat);
+ return _imp->tree_root / "profiles";
}
+
diff --git a/paludis/repositories/gentoo/traditional_layout.hh b/paludis/repositories/gentoo/traditional_layout.hh
index 7cb4f7b..26c6ce2 100644
--- a/paludis/repositories/gentoo/traditional_layout.hh
+++ b/paludis/repositories/gentoo/traditional_layout.hh
@@ -48,7 +48,8 @@ namespace paludis
///\{
TraditionalLayout(const RepositoryName &, const FSEntry &,
- tr1::shared_ptr<const PortageRepositoryEntries>);
+ tr1::shared_ptr<const PortageRepositoryEntries>,
+ tr1::shared_ptr<const FSEntry>);
virtual ~TraditionalLayout();
@@ -74,25 +75,43 @@ namespace paludis
virtual bool has_version(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry package_mask_file(const FSEntry & dir) const
+ virtual FSEntry info_packages_file(const FSEntry &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry arch_list_file(const FSEntry & dir) const
+ virtual FSEntry info_variables_file(const FSEntry &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry mirrors_file(const FSEntry &) const
+ virtual FSEntry package_directory(const QualifiedPackageName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry info_packages_file(const FSEntry &) const
+ virtual FSEntry category_directory(const CategoryNamePart &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry info_variables_file(const FSEntry &) const
+ virtual FSEntry package_file(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry package_directory(const QualifiedPackageName &) const
+ virtual std::string eapi_string_if_known(const QualifiedPackageName &, const VersionSpec &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual FSEntry category_directory(const CategoryNamePart &) const
+ virtual tr1::shared_ptr<const FSEntryCollection> arch_list_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> repository_mask_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> profiles_desc_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> mirror_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual tr1::shared_ptr<const FSEntryCollection> use_desc_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual bool eapi_ebuild_suffix() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual FSEntry profiles_base_dir() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index 5ff9180..b6074f8 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -993,6 +993,7 @@ VDBRepository::_uninstall(const QualifiedPackageName & q, const VersionSpec & v,
.environment(_imp->env)
.db_entry(&e)
.ebuild_dir(pkg_dir)
+ .ebuild_file(pkg_dir / (stringify(e.name.package) + "-" + stringify(e.version) + ".ebuild"))
.files_dir(pkg_dir)
.eclassdirs(eclassdirs)
.portdir(_imp->location)
@@ -1057,6 +1058,7 @@ VDBRepository::do_config(const QualifiedPackageName & q, const VersionSpec & v)
.environment(_imp->env)
.db_entry(&e)
.ebuild_dir(pkg_dir)
+ .ebuild_file(pkg_dir / (stringify(e.name.package) + "-" + stringify(e.version) + ".ebuild"))
.files_dir(pkg_dir)
.eclassdirs(eclassdirs)
.portdir(_imp->location)
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 485fb05..675431b 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -201,6 +201,12 @@ ConsoleQueryTask::display_metadata(const PackageDepSpec &, const PackageDatabase
tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(e.repository)->
version_metadata(e.name, e.version));
+ if (! metadata->eapi->supported)
+ {
+ display_metadata_key("EAPI", "EAPI", metadata->eapi->name);
+ return;
+ }
+
display_metadata_uri("Homepage", "HOMEPAGE", metadata->homepage(), true);
display_metadata_key("Description", "DESCRIPTION", metadata->description);