Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13652 - in main/trunk: man pym/_emerge pym/portage
Date: Thu, 18 Jun 2009 19:55:19
Message-Id: E1MHNhe-00039L-AW@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-06-18 19:55:17 +0000 (Thu, 18 Jun 2009)
3 New Revision: 13652
4
5 Modified:
6 main/trunk/man/make.conf.5
7 main/trunk/pym/_emerge/__init__.py
8 main/trunk/pym/portage/__init__.py
9 Log:
10 Add a EMERGE_LOG_DIR variable to control the location of emerge.log and
11 emerge-fetch.log. This was requested by Eitan Mosenkis <eitan@××××××××.net>
12 for use in his 'online image builder' soc project.
13
14
15 Modified: main/trunk/man/make.conf.5
16 ===================================================================
17 --- main/trunk/man/make.conf.5 2009-06-17 22:04:43 UTC (rev 13651)
18 +++ main/trunk/man/make.conf.5 2009-06-18 19:55:17 UTC (rev 13652)
19 @@ -130,6 +130,11 @@
20 These options will not be appended to the command line if \-\-ignore\-default\-opts
21 is specified.
22 .TP
23 +.B EMERGE_LOG_DIR
24 +Controls the location of emerge.log and emerge-fetch.log.
25 +.br
26 +Defaults to /var/log.
27 +.TP
28 .B EPAUSE_IGNORE
29 Defines whether or not to ignore short pauses that occur when displaying
30 important informational messages. This variable is unset by default.
31
32 Modified: main/trunk/pym/_emerge/__init__.py
33 ===================================================================
34 --- main/trunk/pym/_emerge/__init__.py 2009-06-17 22:04:43 UTC (rev 13651)
35 +++ main/trunk/pym/_emerge/__init__.py 2009-06-18 19:55:17 UTC (rev 13652)
36 @@ -238,13 +238,15 @@
37 "v":"--verbose", "V":"--version"
38 }
39
40 +_emerge_log_dir = '/var/log'
41 +
42 def emergelog(xterm_titles, mystr, short_msg=None):
43 if xterm_titles and short_msg:
44 if "HOSTNAME" in os.environ:
45 short_msg = os.environ["HOSTNAME"]+": "+short_msg
46 xtermTitle(short_msg)
47 try:
48 - file_path = "/var/log/emerge.log"
49 + file_path = os.path.join(_emerge_log_dir, 'emerge.log')
50 mylogfile = open(file_path, "a")
51 portage.util.apply_secpass_permissions(file_path,
52 uid=portage.portage_uid, gid=portage.portage_gid,
53 @@ -10137,7 +10139,7 @@
54 _bad_resume_opts = set(["--ask", "--changelog",
55 "--resume", "--skipfirst"])
56
57 - _fetch_log = "/var/log/emerge-fetch.log"
58 + _fetch_log = os.path.join(_emerge_log_dir, 'emerge-fetch.log')
59
60 class _iface_class(SlotObject):
61 __slots__ = ("dblinkEbuildPhase", "dblinkDisplayMerge",
62 @@ -16181,6 +16183,20 @@
63 def emergelog(*pargs, **kargs):
64 pass
65
66 + else:
67 + if 'EMERGE_LOG_DIR' in settings:
68 + try:
69 + # At least the parent needs to exist for the lock file.
70 + portage.util.ensure_dirs(settings['EMERGE_LOG_DIR'])
71 + except portage.exception.PortageException, e:
72 + writemsg_level("!!! Error creating directory for " + \
73 + "EMERGE_LOG_DIR='%s':\n!!! %s\n" % \
74 + (settings['EMERGE_LOG_DIR'], e),
75 + noiselevel=-1, level=logging.ERROR)
76 + else:
77 + global _emerge_log_dir
78 + _emerge_log_dir = settings['EMERGE_LOG_DIR']
79 +
80 if not "--pretend" in myopts:
81 emergelog(xterm_titles, "Started emerge on: "+\
82 time.strftime("%b %d, %Y %H:%M:%S", time.localtime()))
83
84 Modified: main/trunk/pym/portage/__init__.py
85 ===================================================================
86 --- main/trunk/pym/portage/__init__.py 2009-06-17 22:04:43 UTC (rev 13651)
87 +++ main/trunk/pym/portage/__init__.py 2009-06-18 19:55:17 UTC (rev 13652)
88 @@ -1135,6 +1135,7 @@
89 "ACCEPT_KEYWORDS", "AUTOCLEAN",
90 "CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT",
91 "CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS",
92 + "EMERGE_LOG_DIR",
93 "EMERGE_WARNING_DELAY", "FETCHCOMMAND", "FETCHCOMMAND_FTP",
94 "FETCHCOMMAND_HTTP", "FETCHCOMMAND_SFTP",
95 "GENTOO_MIRRORS", "NOCONFMEM", "O",