aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-28 20:58:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-28 20:58:20 +0000
commitc52338eefbb54ab15490f65fa9207da2f96448b6 (patch)
tree4258c3fab4af9e4d2ec28a9f80690a9680af839f /paludis/repositories
parentb8cc1f18652e2c39f4c7cad5e322e13f4686ed21 (diff)
downloadpaludis-c52338eefbb54ab15490f65fa9207da2f96448b6.tar.gz
paludis-c52338eefbb54ab15490f65fa9207da2f96448b6.tar.xz
Distribution definable defaults. Fixes: ticket:263
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/cran/Makefile.am1
-rw-r--r--paludis/repositories/fake/fake_repository.cc3
-rw-r--r--paludis/repositories/gentoo/Makefile.am1
-rw-r--r--paludis/repositories/gentoo/ebuild/Makefile.am1
-rw-r--r--paludis/repositories/gentoo/make_ebuild_repository.cc27
-rw-r--r--paludis/repositories/gentoo/portage_repository.cc10
-rw-r--r--paludis/repositories/gentoo/portage_repository_profile.cc41
-rw-r--r--paludis/repositories/virtuals/registration.cc8
8 files changed, 58 insertions, 34 deletions
diff --git a/paludis/repositories/cran/Makefile.am b/paludis/repositories/cran/Makefile.am
index 65a1f4427..2df63107c 100644
--- a/paludis/repositories/cran/Makefile.am
+++ b/paludis/repositories/cran/Makefile.am
@@ -99,6 +99,7 @@ TESTS_ENVIRONMENT = env \
CRAN_BASH_DIR="$(top_srcdir)/paludis/repositories/cran/cran/" \
PALUDIS_SKIP_CONFIG="yes" \
PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \
+ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
TEST_SCRIPT_DIR="$(srcdir)/" \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
bash $(top_srcdir)/test/run_test.sh
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index cee51fa60..e9a42a6f7 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -20,6 +20,7 @@
#include "fake_repository.hh"
#include <paludis/util/collection_concrete.hh>
#include <paludis/portage_dep_parser.hh>
+#include <paludis/distribution.hh>
using namespace paludis;
@@ -37,7 +38,7 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
.mirrors_interface(0)
.environment_variable_interface(0)
.provides_interface(0)
- .virtuals_interface(this)
+ .virtuals_interface(DistributionData::get_instance()->default_distribution()->support_old_style_virtuals ? this : 0)
.config_interface(0)
.destination_interface(0)
.licenses_interface(0)
diff --git a/paludis/repositories/gentoo/Makefile.am b/paludis/repositories/gentoo/Makefile.am
index 803a87256..97436bc4b 100644
--- a/paludis/repositories/gentoo/Makefile.am
+++ b/paludis/repositories/gentoo/Makefile.am
@@ -214,6 +214,7 @@ check_SCRIPTS = \
TESTS_ENVIRONMENT = env \
PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \
PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \
+ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
PALUDIS_SKIP_CONFIG="yes" \
TEST_SCRIPT_DIR="$(srcdir)/" \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
diff --git a/paludis/repositories/gentoo/ebuild/Makefile.am b/paludis/repositories/gentoo/ebuild/Makefile.am
index 58630e551..64ea73078 100644
--- a/paludis/repositories/gentoo/ebuild/Makefile.am
+++ b/paludis/repositories/gentoo/ebuild/Makefile.am
@@ -51,6 +51,7 @@ libexecprog_SCRIPTS = \
TESTS_ENVIRONMENT = env \
PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/gentoo/ebuild/" \
PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \
+ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
PALUDIS_EBUILD_LOG_LEVEL="warning" \
TOP_BUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/`" \
TEST_SCRIPT_DIR="$(srcdir)/" \
diff --git a/paludis/repositories/gentoo/make_ebuild_repository.cc b/paludis/repositories/gentoo/make_ebuild_repository.cc
index 44522ec9b..1e41c1882 100644
--- a/paludis/repositories/gentoo/make_ebuild_repository.cc
+++ b/paludis/repositories/gentoo/make_ebuild_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;
@@ -99,7 +100,13 @@ paludis::make_ebuild_repository(
if (master_repository)
distdir = stringify(master_repository->params().distdir);
else
- distdir = location + "/distfiles";
+ {
+ distdir = DistributionData::get_instance()->default_distribution()->default_ebuild_distdir;
+ if (distdir.empty())
+ distdir = location + "/distfiles";
+ else if ('/' != distdir.at(0))
+ distdir = location + "/" + distdir;
+ }
}
std::string pkgdir;
@@ -133,15 +140,19 @@ paludis::make_ebuild_repository(
std::string write_cache;
if (m->end() == m->find("write_cache") || ((write_cache = m->find("write_cache")->second)).empty())
- write_cache = "/var/empty";
+ write_cache = DistributionData::get_instance()->default_distribution()->default_ebuild_write_cache;
std::string names_cache;
if (m->end() == m->find("names_cache") || ((names_cache = m->find("names_cache")->second)).empty())
{
- Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '"
- + repo_file + "'. You should read http://paludis.pioto.org/cachefiles.html and select an "
- "appropriate value.");
- names_cache = "/var/empty";
+ names_cache = DistributionData::get_instance()->default_distribution()->default_ebuild_names_cache;
+ if (names_cache.empty())
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '"
+ + repo_file + "'. You should read http://paludis.pioto.org/cachefiles.html and select an "
+ "appropriate value.");
+ names_cache = "/var/empty";
+ }
}
std::string sync;
@@ -163,11 +174,11 @@ paludis::make_ebuild_repository(
std::string buildroot;
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
- buildroot = "/var/tmp/paludis";
+ buildroot = DistributionData::get_instance()->default_distribution()->default_ebuild_build_root;
std::string layout;
if (m->end() == m->find("layout") || ((layout = m->find("layout")->second)).empty())
- layout = "traditional";
+ layout = DistributionData::get_instance()->default_distribution()->default_ebuild_layout;
return tr1::shared_ptr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create()
.entry_format("ebuild")
diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc
index c205f9fa8..df1965aa7 100644
--- a/paludis/repositories/gentoo/portage_repository.cc
+++ b/paludis/repositories/gentoo/portage_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/repositories/gentoo/layout.hh>
#include <paludis/config_file.hh>
+#include <paludis/distribution.hh>
#include <paludis/dep_spec.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/environment.hh>
@@ -258,7 +259,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
.world_interface(0)
.environment_variable_interface(this)
.mirrors_interface(this)
- .virtuals_interface(this)
+ .virtuals_interface(DistributionData::get_instance()->default_distribution()->support_old_style_virtuals ? this : 0)
.provides_interface(0)
.contents_interface(0)
.config_interface(0)
@@ -916,9 +917,10 @@ PortageRepository::set_profile(const ProfilesIterator & iter)
_imp->profile_ptr = iter->profile;
- if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
- _imp->params.environment->package_database()->fetch_repository(
- RepositoryName("virtuals"))->invalidate();
+ if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals)
+ if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
+ _imp->params.environment->package_database()->fetch_repository(
+ RepositoryName("virtuals"))->invalidate();
}
void
diff --git a/paludis/repositories/gentoo/portage_repository_profile.cc b/paludis/repositories/gentoo/portage_repository_profile.cc
index a7ed04074..b0685f7d2 100644
--- a/paludis/repositories/gentoo/portage_repository_profile.cc
+++ b/paludis/repositories/gentoo/portage_repository_profile.cc
@@ -32,6 +32,7 @@
#include <paludis/match_package.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/version_metadata.hh>
+#include <paludis/distribution.hh>
#include <list>
#include <algorithm>
@@ -215,7 +216,8 @@ Implementation<PortageRepositoryProfile>::load_profile_directory_recursively(con
load_spec_use_file(dir / "package.use.force", stacked_values_list.back().package_use_force);
packages_file.add_file(dir / "packages");
- virtuals_file.add_file(dir / "virtuals");
+ if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals)
+ virtuals_file.add_file(dir / "virtuals");
package_mask_file.add_file(dir / "package.mask");
}
@@ -396,27 +398,28 @@ Implementation<PortageRepositoryProfile>::make_vars_from_file_vars()
" failed due to exception: " + e.message() + " (" + e.what() + ")");
}
- try
- {
- for (ProfileFile::Iterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ;
- line != line_end ; ++line)
+ if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals)
+ try
{
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
- if (tokens.size() < 2)
- continue;
+ for (ProfileFile::Iterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ;
+ line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
+ if (tokens.size() < 2)
+ continue;
- QualifiedPackageName v(tokens[0]);
- virtuals.erase(v);
- virtuals.insert(std::make_pair(v, tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(tokens[1],
- pds_pm_eapi_0))));
+ QualifiedPackageName v(tokens[0]);
+ virtuals.erase(v);
+ virtuals.insert(std::make_pair(v, tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(tokens[1],
+ pds_pm_eapi_0))));
+ }
+ }
+ catch (const Exception & e)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Loading virtuals "
+ " failed due to exception: " + e.message() + " (" + e.what() + ")");
}
- }
- catch (const Exception & e)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Loading virtuals "
- " failed due to exception: " + e.message() + " (" + e.what() + ")");
- }
for (ProfileFile::Iterator line(package_mask_file.begin()), line_end(package_mask_file.end()) ;
line != line_end ; ++line)
diff --git a/paludis/repositories/virtuals/registration.cc b/paludis/repositories/virtuals/registration.cc
index 67d0f0e79..4012108e5 100644
--- a/paludis/repositories/virtuals/registration.cc
+++ b/paludis/repositories/virtuals/registration.cc
@@ -20,6 +20,7 @@
#include <paludis/repositories/repository_maker.hh>
#include <paludis/repositories/virtuals/installed_virtuals_repository.hh>
#include <paludis/repositories/virtuals/virtuals_repository.hh>
+#include <paludis/distribution.hh>
#include "config.h"
using namespace paludis;
@@ -33,8 +34,11 @@ extern "C"
void register_repositories(RepositoryMaker * maker)
{
- maker->register_maker("virtuals", &VirtualsRepository::make_virtuals_repository);
- maker->register_maker("installed_virtuals", &InstalledVirtualsRepository::make_installed_virtuals_repository);
+ if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals)
+ {
+ maker->register_maker("virtuals", &VirtualsRepository::make_virtuals_repository);
+ maker->register_maker("installed_virtuals", &InstalledVirtualsRepository::make_installed_virtuals_repository);
+ }
}
#endif