aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-17 15:20:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-17 15:20:30 +0000
commit1fa666a802e747c38fda17c21a5e1ca40a752539 (patch)
treef8ae0c451b94f85b3f8e4320b4e5fbc45ad85866
parentf38efde598b209a7c532cbec5f34e9783873e679 (diff)
downloadpaludis-1fa666a802e747c38fda17c21a5e1ca40a752539.tar.gz
paludis-1fa666a802e747c38fda17c21a5e1ca40a752539.tar.xz
Emulate various Portage internals. Not actually useful, but it might make a few malcontents come up with some new material.
-rwxr-xr-xebuild/ebuild.bash1
-rw-r--r--paludis/ebuild.cc27
-rw-r--r--paludis/ebuild.hh5
3 files changed, 31 insertions, 2 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 40fb00a..9c41a09 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -210,6 +210,7 @@ ebuild_main()
else
ebuild_load_ebuild "${ebuild}"
for action in $@ ; do
+ export EBUILD_PHASE="${action}"
perform_hook ebuild_${action}_pre
ebuild_f_${action} || die "${action} failed"
if [[ ${action} == "init" ]] ; then
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index 3655c80..79a317c 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -17,13 +17,15 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "ebuild.hh"
+#include <paludis/ebuild.hh>
#include <paludis/util/system.hh>
#include <paludis/util/pstream.hh>
#include <paludis/util/log.hh>
#include <paludis/environment.hh>
#include <paludis/config_file.hh>
#include <paludis/portage_dep_parser.hh>
+#include <sys/resource.h>
+#include <sys/time.h>
/** \file
* Implementation for ebuild.hh things.
@@ -97,12 +99,33 @@ EbuildCommand::operator() ()
("PALUDIS_EBUILD_LOG_LEVEL", Log::get_instance()->log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))));
- if (do_run_command(cmd))
+ if (do_run_command(add_portage_vars(cmd)))
return success();
else
return failure();
}
+MakeEnvCommand
+EbuildCommand::add_portage_vars(const MakeEnvCommand & cmd) const
+{
+ return cmd
+ ("PORTAGE_ACTUAL_DISTDIR", stringify(params.get<ecpk_portdir>()))
+ ("PORTAGE_BASHRC", "/dev/null")
+ ("PORTAGE_BUILDDIR", BIGTEMPDIR "/paludis/" +
+ stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_category>()) + "/" +
+ stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
+ stringify(params.get<ecpk_db_entry>()->get<pde_version>()))
+ ("PORTAGE_CALLER", params.get<ecpk_environment>()->paludis_command())
+ ("PORTAGE_GID", "0")
+ ("PORTAGE_INST_GID", "0")
+ ("PORTAGE_INST_UID", "0")
+ ("PORTAGE_MASTER_PID", stringify(::getpid()))
+ ("PORTAGE_NICENCESS", stringify(::getpriority(PRIO_PROCESS, 0)))
+ ("PORTAGE_TMPDIR", BIGTEMPDIR)
+ ("PORTAGE_TMPFS", "/dev/shm")
+ ("PORTAGE_WORKDIR_MODE", "0700");
+}
+
bool
EbuildCommand::do_run_command(const std::string & cmd)
{
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index ae7aef4..4ab87c8 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -142,6 +142,11 @@ namespace paludis
virtual bool do_run_command(const std::string &);
/**
+ * Add Portage emulation vars.
+ */
+ virtual MakeEnvCommand add_portage_vars(const MakeEnvCommand &) const;
+
+ /**
* Extend the command to be run.
*/
virtual MakeEnvCommand extend_command(const MakeEnvCommand &) = 0;