diff options
author | Marius Mauch <genone@gentoo.org> | 2007-01-25 15:49:26 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2007-01-25 15:49:26 +0000 |
commit | 3b08c21101b0801d7c5d6c145a27bef5cd42078c (patch) | |
tree | 2eea73b311d67b567410670630335796bf0a272c /pym/portage/elog_modules/mod_save_summary.py | |
parent | b4eed9540e19ee7038ac875f0e084f8256675580 (diff) | |
download | portage-3b08c21101b0801d7c5d6c145a27bef5cd42078c.tar.gz portage-3b08c21101b0801d7c5d6c145a27bef5cd42078c.tar.bz2 portage-3b08c21101b0801d7c5d6c145a27bef5cd42078c.zip |
Namespace sanitizing, step 1
svn path=/main/trunk/; revision=5778
Diffstat (limited to 'pym/portage/elog_modules/mod_save_summary.py')
-rw-r--r-- | pym/portage/elog_modules/mod_save_summary.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pym/portage/elog_modules/mod_save_summary.py b/pym/portage/elog_modules/mod_save_summary.py new file mode 100644 index 000000000..7cb310d95 --- /dev/null +++ b/pym/portage/elog_modules/mod_save_summary.py @@ -0,0 +1,23 @@ +import os, time +from portage_data import portage_uid, portage_gid + +def process(mysettings, cpv, logentries, fulltext): + if mysettings["PORT_LOGDIR"] != "": + elogdir = os.path.join(mysettings["PORT_LOGDIR"], "elog") + else: + elogdir = os.path.join(os.sep, "var", "log", "portage", "elog") + if not os.path.exists(elogdir): + os.makedirs(elogdir) + os.chown(elogdir, portage_uid, portage_gid) + os.chmod(elogdir, 02770) + + # TODO: Locking + elogfilename = elogdir+"/summary.log" + elogfile = open(elogfilename, "a") + elogfile.write(">>> Messages generated by process %d on %s for package %s:\n\n" % \ + (os.getpid(), time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time())), cpv)) + elogfile.write(fulltext) + elogfile.write("\n") + elogfile.close() + + return elogfilename |