summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/elog/mod_save.py9
-rw-r--r--pym/portage/elog/mod_save_summary.py9
2 files changed, 16 insertions, 2 deletions
diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 40ba26765..36654b3f2 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -8,8 +8,9 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
+from portage.data import portage_gid
from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
-from portage.util import normalize_path
+from portage.util import ensure_dirs, normalize_path
def process(mysettings, key, logentries, fulltext):
@@ -18,6 +19,12 @@ def process(mysettings, key, logentries, fulltext):
else:
logdir = os.path.join(os.sep, "var", "log", "portage")
+ if not os.path.isdir(logdir):
+ # Only initialize group/mode if the directory doesn't
+ # exist, so that we don't override permissions if they
+ # were previously set by the administrator.
+ ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+
cat = mysettings['CATEGORY']
pf = mysettings['PF']
diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index 67bd76e55..f090deaf0 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -8,9 +8,10 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
+from portage.data import portage_gid
from portage.localization import _
from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
-from portage.util import apply_permissions, normalize_path
+from portage.util import apply_permissions, ensure_dirs, normalize_path
def process(mysettings, key, logentries, fulltext):
if mysettings.get("PORT_LOGDIR"):
@@ -18,6 +19,12 @@ def process(mysettings, key, logentries, fulltext):
else:
logdir = os.path.join(os.sep, "var", "log", "portage")
+ if not os.path.isdir(logdir):
+ # Only initialize group/mode if the directory doesn't
+ # exist, so that we don't override permissions if they
+ # were previously set by the administrator.
+ ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+
elogdir = os.path.join(logdir, "elog")
_ensure_log_subdirs(logdir, elogdir)