summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/make.conf.55
-rw-r--r--pym/_emerge/__init__.py20
-rw-r--r--pym/portage/__init__.py1
3 files changed, 24 insertions, 2 deletions
diff --git a/man/make.conf.5 b/man/make.conf.5
index ef5913a85..2b5a7645f 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -130,6 +130,11 @@ Options to append to the end of the \fBemerge\fR(1) command line on every invoca
These options will not be appended to the command line if \-\-ignore\-default\-opts
is specified.
.TP
+.B EMERGE_LOG_DIR
+Controls the location of emerge.log and emerge-fetch.log.
+.br
+Defaults to /var/log.
+.TP
.B EPAUSE_IGNORE
Defines whether or not to ignore short pauses that occur when displaying
important informational messages. This variable is unset by default.
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 8ef667a07..a3921b629 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -238,13 +238,15 @@ shortmapping={
"v":"--verbose", "V":"--version"
}
+_emerge_log_dir = '/var/log'
+
def emergelog(xterm_titles, mystr, short_msg=None):
if xterm_titles and short_msg:
if "HOSTNAME" in os.environ:
short_msg = os.environ["HOSTNAME"]+": "+short_msg
xtermTitle(short_msg)
try:
- file_path = "/var/log/emerge.log"
+ file_path = os.path.join(_emerge_log_dir, 'emerge.log')
mylogfile = open(file_path, "a")
portage.util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
@@ -10137,7 +10139,7 @@ class Scheduler(PollScheduler):
_bad_resume_opts = set(["--ask", "--changelog",
"--resume", "--skipfirst"])
- _fetch_log = "/var/log/emerge-fetch.log"
+ _fetch_log = os.path.join(_emerge_log_dir, 'emerge-fetch.log')
class _iface_class(SlotObject):
__slots__ = ("dblinkEbuildPhase", "dblinkDisplayMerge",
@@ -16181,6 +16183,20 @@ def emerge_main():
def emergelog(*pargs, **kargs):
pass
+ else:
+ if 'EMERGE_LOG_DIR' in settings:
+ try:
+ # At least the parent needs to exist for the lock file.
+ portage.util.ensure_dirs(settings['EMERGE_LOG_DIR'])
+ except portage.exception.PortageException, e:
+ writemsg_level("!!! Error creating directory for " + \
+ "EMERGE_LOG_DIR='%s':\n!!! %s\n" % \
+ (settings['EMERGE_LOG_DIR'], e),
+ noiselevel=-1, level=logging.ERROR)
+ else:
+ global _emerge_log_dir
+ _emerge_log_dir = settings['EMERGE_LOG_DIR']
+
if not "--pretend" in myopts:
emergelog(xterm_titles, "Started emerge on: "+\
time.strftime("%b %d, %Y %H:%M:%S", time.localtime()))
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index cd8adbba4..575e75c4b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1135,6 +1135,7 @@ class config(object):
"ACCEPT_KEYWORDS", "AUTOCLEAN",
"CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT",
"CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS",
+ "EMERGE_LOG_DIR",
"EMERGE_WARNING_DELAY", "FETCHCOMMAND", "FETCHCOMMAND_FTP",
"FETCHCOMMAND_HTTP", "FETCHCOMMAND_SFTP",
"GENTOO_MIRRORS", "NOCONFMEM", "O",