aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-23 14:32:00 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-23 14:32:00 +0000
commit7534eff5c856e6a83b849852473660288e4562b8 (patch)
tree17d334d6f25018ec8eadc3536522358beaacf00b
parent3e41bd4a467b050508e2a165ded50f4cdd4a8ed8 (diff)
downloadpaludis-7534eff5c856e6a83b849852473660288e4562b8.tar.gz
paludis-7534eff5c856e6a83b849852473660288e4562b8.tar.xz
Allow environment.conf to specify the userpriv username. Allow environment.conf to enable auto masking of packages that will break Portage.
-rw-r--r--doc/configuration.html.skel18
-rw-r--r--paludis/environments/paludis/paludis_config.cc39
-rw-r--r--paludis/environments/paludis/paludis_config.hh2
-rw-r--r--paludis/environments/paludis/paludis_environment.cc6
-rw-r--r--paludis/environments/paludis/paludis_environment.hh2
5 files changed, 65 insertions, 2 deletions
diff --git a/doc/configuration.html.skel b/doc/configuration.html.skel
index e3acc74..a4e346e 100644
--- a/doc/configuration.html.skel
+++ b/doc/configuration.html.skel
@@ -63,6 +63,24 @@ are used are:</p>
<p>If no <code>specpath</code> file is present, the original directory is
used.</p>
+<h3>The environment.conf File</h3>
+
+<p>The <code>environment.conf</code> file controls various options related to
+general operation. Recognised keys are:</p>
+
+<dl>
+ <dt><code>reduced_username</code></dt>
+ <dd>The username to use when dropping priviledges. Defaults to
+ <code>paludisbuild</code>. This user's default group (which is also called
+ <code>paludisbuild</code> if you installed using ebuilds) must have read,
+ write and execute access to distfiles and build directories.</dd>
+
+ <dt><code>portage_compatible</code></dt>
+ <dd>If set to a non-empty string, Paludis will mask any ebuild that is known
+ to break Portage. Currently this means any version containing <code>-scm</code>
+ or <code>-try</code> and any <code>EAPI</code> containing the string <code>paludis</code>.</dd>
+</dl>
+
<h3>The use.conf File</h3>
<p>User <code>USE</code> preferences are controlled by the <code>use.conf</code>
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 6e6b4ce..b0a2bd9 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -124,20 +124,45 @@ namespace paludis
mutable std::tr1::shared_ptr<uid_t> reduced_uid;
mutable std::tr1::shared_ptr<gid_t> reduced_gid;
+ mutable bool has_environment_conf;
+ mutable bool accept_breaks_portage;
+ mutable std::string reduced_username;
+
Implementation(PaludisEnvironment * const);
void need_sets_expanded() const;
+ void need_environment_conf() const;
};
Implementation<PaludisConfig>::Implementation(PaludisEnvironment * e) :
env(e),
paludis_command("paludis"),
config_dir("(unset)"),
- sets_expanded(false)
+ sets_expanded(false),
+ has_environment_conf(false),
+ accept_breaks_portage(true),
+ reduced_username("paludisbuild")
{
}
void
+ Implementation<PaludisConfig>::need_environment_conf() const
+ {
+ if (has_environment_conf)
+ return;
+
+ Context context("When loading environment.conf:");
+ if (! (FSEntry(config_dir) / "environment.conf").exists())
+ return;
+
+ KeyValueConfigFile f(FSEntry(config_dir) / "environment.conf");
+ if (! f.get("reduced_username").empty())
+ reduced_username = f.get("reduced_username");
+
+ accept_breaks_portage = f.get("portage_compatible").empty();
+ }
+
+ void
Implementation<PaludisConfig>::need_sets_expanded() const
{
if (sets_expanded)
@@ -1113,6 +1138,16 @@ PaludisConfig::reduced_gid() const
std::string
PaludisConfig::reduced_username() const
{
- return getenv_with_default("PALUDIS_REDUCED_USERNAME", "paludisbuild");
+ _imp->need_environment_conf();
+
+ return getenv_with_default("PALUDIS_REDUCED_USERNAME", _imp->reduced_username);
+}
+
+bool
+PaludisConfig::accept_breaks_portage() const
+{
+ _imp->need_environment_conf();
+
+ return _imp->accept_breaks_portage;
}
diff --git a/paludis/environments/paludis/paludis_config.hh b/paludis/environments/paludis/paludis_config.hh
index 29c4438..14c4918 100644
--- a/paludis/environments/paludis/paludis_config.hh
+++ b/paludis/environments/paludis/paludis_config.hh
@@ -213,6 +213,8 @@ namespace paludis
*/
std::string root() const;
+ bool accept_breaks_portage() const;
+
///\name Userpriv
///\{
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 45213e1..25ec3c4 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -329,6 +329,12 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
}
bool
+PaludisEnvironment::accept_breaks_portage() const
+{
+ return _imp->config->accept_breaks_portage();
+}
+
+bool
PaludisEnvironment::accept_keyword(const KeywordName & keyword, const PackageDatabaseEntry * const d,
const bool override_tilde_keywords) const
{
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 15d7735..b6400a8 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -96,6 +96,8 @@ namespace paludis
virtual void clear_forced_use();
+ virtual bool accept_breaks_portage() const;
+
/**
* The config directory.
*/