From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/zorry:master commit in: gobs/pym/
Date: Mon, 10 Oct 2011 23:30:32 +0000 (UTC) [thread overview]
Message-ID: <51b93e28e0fe10e4ee18dd485841650c194ae198.zorry@gentoo> (raw)
commit: 51b93e28e0fe10e4ee18dd485841650c194ae198
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 23:29:11 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 23:29:11 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=51b93e28
create emerge --info log file
---
gobs/pym/Scheduler.py | 9 +++++--
gobs/pym/build_log.py | 51 +++++++++++++++++++++++++++++++++++++++++++-----
gobs/pym/flags.py | 31 +++++++++++++++++++++++++++++
3 files changed, 82 insertions(+), 9 deletions(-)
diff --git a/gobs/pym/Scheduler.py b/gobs/pym/Scheduler.py
index cab701c..2b694fc 100644
--- a/gobs/pym/Scheduler.py
+++ b/gobs/pym/Scheduler.py
@@ -1325,7 +1325,7 @@ class Scheduler(PollScheduler):
def _do_merge_exit(self, merge):
pkg = merge.merge.pkg
settings = merge.merge.settings
- trees = self.trees[merge.merge.settings["ROOT"]]
+ trees = self.trees
init_buildlog = gobs_buildlog()
if merge.returncode != os.EX_OK:
build_dir = settings.get("PORTAGE_BUILDDIR")
@@ -1395,13 +1395,16 @@ class Scheduler(PollScheduler):
self._status_display.merges = len(self._task_queues.merge)
else:
settings = build.settings
+ trees = self.trees
+ pkg=build.pkg
+ init_buildlog = gobs_buildlog()
build_dir = settings.get("PORTAGE_BUILDDIR")
build_log = settings.get("PORTAGE_LOG_FILE")
self._failed_pkgs.append(self._failed_pkg(
build_dir=build_dir, build_log=build_log,
- pkg=build.pkg,
- returncode=build.returncode))
+ pkg, returncode=build.returncode))
+ init_buildlog.add_buildlog_main(settings, pkg, trees)
if not self._terminated_tasks:
self._failed_pkg_msg(self._failed_pkgs[-1], "emerge", "for")
self._status_display.failed = len(self._failed_pkgs)
diff --git a/gobs/pym/build_log.py b/gobs/pym/build_log.py
index 7ffe53a..4ad098b 100644
--- a/gobs/pym/build_log.py
+++ b/gobs/pym/build_log.py
@@ -11,12 +11,15 @@ from _emerge.main import parse_opts, load_emerge_config, \
getportageversion
from portage.util import writemsg, \
writemsg_level, writemsg_stdout
+from _emerge.actions import _info_pkgs_ver
from portage.exception import InvalidAtom
from portage.dep import Atom
from portage.dbapi._expand_new_virt import expand_new_virt
from portage.const import GLOBAL_CONFIG_PATH, NEWS_LIB_PATH
from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG
from portage.versions import catpkgsplit, cpv_getversion
+from portage import _encodings
+from portage import _unicode_encode
from gobs.repoman_gobs import gobs_repoman
import portage
from gobs.package import gobs_package
@@ -55,7 +58,8 @@ class gobs_buildlog(object):
build_dict['categories'] = categories
build_dict['package'] = package
build_dict['config_profile'] = self._config_profile
- final_use_list = list(pkg.use.enabled)
+ init_useflags = gobs_use_flags(settings, myportdb, pkg.cpv)
+ iuse_flags_list, final_use_list = init_useflags.get_flags_pkg(pkg, settings)
#print 'final_use_list', final_use_list
if final_use_list != []:
build_dict['build_useflags'] = final_use_list
@@ -82,8 +86,7 @@ class gobs_buildlog(object):
conn=CM.getConnection()
portdb = portage.portdbapi(mysettings=settings)
init_useflags = gobs_use_flags(settings, portdb, build_dict['cpv'])
- iuse_flags_list = list(pkg.iuse.all)
- final_use_list = list(pkg.use.enabled)
+ iuse_flags_list, final_use_list = init_useflags.get_flags_pkg(pkg, settings)
iuse = []
use_flags_list = []
use_enable_list = []
@@ -220,7 +223,6 @@ class gobs_buildlog(object):
lastSync = portage.grabfile(os.path.join(
settings["PORTDIR"], "metadata", "timestamp.chk"))
- msg.append("Timestamp of tree:", end=' ')
if lastSync:
msg.append("Timestamp of tree:" + lastSync[0] + "\n")
else:
@@ -341,7 +343,7 @@ class gobs_buildlog(object):
unset_vars = []
myvars.sort()
for x in myvars:
- if x in self._mysettings:
+ if x in settings:
if x != "USE":
default = myvars_ignore_defaults.get(x)
if default is not None and \
@@ -495,6 +497,40 @@ class gobs_buildlog(object):
tree="bintree")
shutil.rmtree(tmpdir)
print('emerge info list', msg)
+ return msg
+
+ def write_msg_file(self, msg, log_path):
+ """
+ Output msg to stdout if not self._background. If log_path
+ is not None then append msg to the log (appends with
+ compression if the filename extension of log_path
+ corresponds to a supported compression type).
+ """
+ msg_shown = False
+ if log_path is not None:
+ try:
+ f = open(_unicode_encode(log_path,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='ab')
+ f_real = f
+ except IOError as e:
+ if e.errno not in (errno.ENOENT, errno.ESTALE):
+ raise
+ if not msg_shown:
+ writemsg_level(msg, level=level, noiselevel=noiselevel)
+ else:
+
+ if log_path.endswith('.gz'):
+ # NOTE: The empty filename argument prevents us from
+ # triggering a bug in python3 which causes GzipFile
+ # to raise AttributeError if fileobj.name is bytes
+ # instead of unicode.
+ f = gzip.GzipFile(filename='', mode='ab', fileobj=f)
+
+ f.write(_unicode_encode(msg))
+ f.close()
+ if f_real is not f:
+ f_real.close()
def add_buildlog_main(self, settings, pkg, trees):
conn=CM.getConnection()
@@ -518,5 +554,8 @@ class gobs_buildlog(object):
else:
build_id = move_queru_buildlog(conn, build_dict['queue_id'], build_error, summary_error, build_log_dict)
# update_qa_repoman(conn, build_id, build_log_dict)
- self.action_info(settings, trees)
+ msg = self.action_info(settings, trees)
+ emerge_info_logfilename = settings.get("PORTAGE_LOG_FILE")[:-3] + "emerge_log.log"
+ for msg_line in msg:
+ self.write_msg_file(msg_line, emerge_info_logfilename)
print("build_id", build_id[0], "logged to db.")
diff --git a/gobs/pym/flags.py b/gobs/pym/flags.py
index ef63361..7ccf90b 100644
--- a/gobs/pym/flags.py
+++ b/gobs/pym/flags.py
@@ -118,6 +118,20 @@ class gobs_use_flags(object):
useforce = list(self._mysettings.useforce)
return use, use_expand_hidden, usemask, useforce
+ def get_all_cpv_use_pkg(self, pkg, settings):
+ """Uses portage to determine final USE flags and settings for an emerge
+ @type cpv: string
+ @param cpv: eg cat/pkg-ver
+ @rtype: lists
+ @return use, use_expand_hidden, usemask, useforce
+ """
+ # use = self._mysettings['PORTAGE_USE'].split()
+ use_list = list(pkg.use.enabled)
+ use_expand_hidden = settings["USE_EXPAND_HIDDEN"].split()
+ usemask = list(settings.usemask)
+ useforced = list(settings.useforce)
+ return use_list, use_expand_hidden, usemask, useforced
+
def get_flags(self):
"""Retrieves all information needed to filter out hidden, masked, etc.
USE flags for a given package.
@@ -154,6 +168,23 @@ class gobs_use_flags(object):
final_flags = self.filter_flags(final_use, use_expand_hidden, usemasked, useforced)
return iuse_flags, final_flags
+ def get_flags_pkg(self, pkg, settings):
+ """Retrieves all information needed to filter out hidden, masked, etc.
+ USE flags for a given package.
+ @type cpv: string
+ @param cpv: eg. cat/pkg-ver
+ @type final_setting: boolean
+ @param final_setting: used to also determine the final
+ enviroment USE flag settings and return them as well.
+ @rtype: list or list, list
+ @return IUSE or IUSE, final_flags
+ """
+ final_use, use_expand_hidden, usemasked, useforced = self.get_all_cpv_use_pkg(pkg, settings)
+ iuse_flags = self.filter_flags(list(pkg.iuse.all), use_expand_hidden, usemasked, useforced)
+ #flags = filter_flags(use_flags, use_expand_hidden, usemasked, useforced)
+ final_flags = self.filter_flags(final_use, use_expand_hidden, usemasked, useforced)
+ return iuse_flags, final_flags
+
def comper_useflags(self, build_dict):
iuse_flags, use_enable = self.get_flags()
iuse = []
next reply other threads:[~2011-10-10 23:30 UTC|newest]
Thread overview: 174+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 23:30 Magnus Granberg [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-04-25 0:34 [gentoo-commits] dev/zorry:master commit in: gobs/pym/ Magnus Granberg
2013-04-24 0:37 Magnus Granberg
2013-04-24 0:11 Magnus Granberg
2013-03-22 19:05 Magnus Granberg
2013-01-27 12:03 Magnus Granberg
2013-01-26 22:23 Magnus Granberg
2013-01-22 21:06 Magnus Granberg
2013-01-22 20:59 Magnus Granberg
2013-01-22 20:56 Magnus Granberg
2012-12-29 12:12 Magnus Granberg
2012-12-27 23:52 Magnus Granberg
2012-12-27 23:09 Magnus Granberg
2012-12-22 11:45 Magnus Granberg
2012-12-21 23:50 Magnus Granberg
2012-12-21 23:31 Magnus Granberg
2012-12-21 23:23 Magnus Granberg
2012-12-21 20:41 Magnus Granberg
2012-12-21 20:31 Magnus Granberg
2012-12-21 17:33 Magnus Granberg
2012-12-21 2:24 Magnus Granberg
2012-12-21 2:11 Magnus Granberg
2012-12-21 1:50 Magnus Granberg
2012-12-21 1:49 Magnus Granberg
2012-12-21 1:44 Magnus Granberg
2012-12-19 2:17 Magnus Granberg
2012-12-17 1:18 Magnus Granberg
2012-12-17 0:33 Magnus Granberg
2012-12-16 20:50 Magnus Granberg
2012-12-16 20:45 Magnus Granberg
2012-12-15 16:14 Magnus Granberg
2012-12-15 0:31 Magnus Granberg
2012-12-14 14:17 Magnus Granberg
2012-12-13 22:57 Magnus Granberg
2012-12-13 15:18 Magnus Granberg
2012-12-13 15:15 Magnus Granberg
2012-12-13 15:09 Magnus Granberg
2012-12-12 0:29 Magnus Granberg
2012-12-12 0:14 Magnus Granberg
2012-12-12 0:11 Magnus Granberg
2012-12-12 0:09 Magnus Granberg
2012-12-12 0:04 Magnus Granberg
2012-12-12 0:00 Magnus Granberg
2012-12-11 23:52 Magnus Granberg
2012-12-11 23:48 Magnus Granberg
2012-12-11 23:38 Magnus Granberg
2012-12-07 14:58 Magnus Granberg
2012-12-07 14:33 Magnus Granberg
2012-12-07 14:29 Magnus Granberg
2012-12-07 14:22 Magnus Granberg
2012-12-07 0:07 Magnus Granberg
2012-12-07 0:02 Magnus Granberg
2012-12-06 23:56 Magnus Granberg
2012-12-06 23:52 Magnus Granberg
2012-12-06 2:51 Magnus Granberg
2012-12-06 2:41 Magnus Granberg
2012-12-06 2:34 Magnus Granberg
2012-12-06 2:22 Magnus Granberg
2012-12-06 2:18 Magnus Granberg
2012-12-06 0:11 Magnus Granberg
2012-12-06 0:08 Magnus Granberg
2012-12-06 0:04 Magnus Granberg
2012-12-02 11:53 Magnus Granberg
2012-12-02 11:49 Magnus Granberg
2012-12-02 0:06 Magnus Granberg
2012-12-02 0:05 Magnus Granberg
2012-12-01 23:58 Magnus Granberg
2012-12-01 23:35 Magnus Granberg
2012-12-01 23:33 Magnus Granberg
2012-12-01 23:28 Magnus Granberg
2012-12-01 23:24 Magnus Granberg
2012-12-01 23:12 Magnus Granberg
2012-12-01 23:03 Magnus Granberg
2012-12-01 22:58 Magnus Granberg
2012-12-01 11:31 Magnus Granberg
2012-12-01 11:26 Magnus Granberg
2012-07-18 0:10 Magnus Granberg
2012-07-17 15:02 Magnus Granberg
2012-07-17 13:00 Magnus Granberg
2012-07-17 1:07 Magnus Granberg
2012-07-17 0:38 Magnus Granberg
2012-07-17 0:18 Magnus Granberg
2012-06-27 15:26 Magnus Granberg
2012-06-27 15:15 Magnus Granberg
2012-06-27 14:57 Magnus Granberg
2012-06-27 14:43 Magnus Granberg
2012-06-27 14:39 Magnus Granberg
2012-06-27 14:24 Magnus Granberg
2012-06-27 14:19 Magnus Granberg
2012-06-27 14:14 Magnus Granberg
2012-06-27 14:11 Magnus Granberg
2012-06-27 14:07 Magnus Granberg
2012-06-04 23:45 Magnus Granberg
2012-06-03 22:18 Magnus Granberg
2012-05-25 0:15 Magnus Granberg
2012-05-20 14:33 Magnus Granberg
2012-05-20 14:29 Magnus Granberg
2012-05-09 23:12 Magnus Granberg
2012-05-07 23:44 Magnus Granberg
2012-05-07 23:39 Magnus Granberg
2012-05-07 23:35 Magnus Granberg
2012-05-07 23:31 Magnus Granberg
2012-05-07 23:25 Magnus Granberg
2012-05-06 10:47 Magnus Granberg
2012-05-02 14:33 Magnus Granberg
2012-05-01 10:00 Magnus Granberg
2012-05-01 0:15 Magnus Granberg
2012-05-01 0:02 Magnus Granberg
2012-04-30 16:45 Magnus Granberg
2012-04-30 14:33 Magnus Granberg
2012-04-30 14:17 Magnus Granberg
2012-04-30 14:15 Magnus Granberg
2012-04-30 13:13 Magnus Granberg
2012-04-30 13:12 Magnus Granberg
2012-04-29 15:56 Magnus Granberg
2012-04-29 13:24 Magnus Granberg
2012-04-29 13:17 Magnus Granberg
2012-04-28 19:29 Magnus Granberg
2012-04-28 17:24 Magnus Granberg
2012-04-28 17:03 Magnus Granberg
2012-04-28 16:09 Magnus Granberg
2012-04-28 16:07 Magnus Granberg
2012-04-28 16:05 Magnus Granberg
2012-04-28 14:29 Magnus Granberg
2012-04-28 14:20 Magnus Granberg
2012-04-28 14:01 Magnus Granberg
2012-04-28 12:37 Magnus Granberg
2012-04-28 1:53 Magnus Granberg
2012-04-28 1:25 Magnus Granberg
2012-04-28 0:51 Magnus Granberg
2012-04-27 21:03 Magnus Granberg
2012-04-27 20:42 Magnus Granberg
2012-04-27 20:33 Magnus Granberg
2012-04-27 18:27 Magnus Granberg
2012-04-27 18:23 Magnus Granberg
2011-10-31 21:32 Magnus Granberg
2011-10-29 22:48 Magnus Granberg
2011-10-29 22:38 Magnus Granberg
2011-10-29 22:28 Magnus Granberg
2011-10-29 22:24 Magnus Granberg
2011-10-29 0:21 Magnus Granberg
2011-10-29 0:19 Magnus Granberg
2011-10-19 21:31 Magnus Granberg
2011-10-19 21:28 Magnus Granberg
2011-10-19 20:20 Magnus Granberg
2011-10-13 10:41 Magnus Granberg
2011-10-12 10:33 Magnus Granberg
2011-10-12 10:26 Magnus Granberg
2011-10-11 23:51 Magnus Granberg
2011-10-11 23:32 Magnus Granberg
2011-10-11 11:20 Magnus Granberg
2011-10-10 23:57 Magnus Granberg
2011-10-10 23:49 Magnus Granberg
2011-10-10 23:46 Magnus Granberg
2011-10-10 23:43 Magnus Granberg
2011-10-09 21:49 Magnus Granberg
2011-09-30 13:38 Magnus Granberg
2011-09-30 13:33 Magnus Granberg
2011-09-30 13:17 Magnus Granberg
2011-09-28 1:41 Magnus Granberg
2011-09-28 1:39 Magnus Granberg
2011-09-28 1:04 Magnus Granberg
2011-09-27 23:43 Magnus Granberg
2011-09-27 11:05 Magnus Granberg
2011-09-13 23:06 Magnus Granberg
2011-09-13 1:02 Magnus Granberg
2011-09-01 23:34 Magnus Granberg
2011-08-31 23:31 Magnus Granberg
2011-08-31 2:05 Magnus Granberg
2011-08-30 23:41 Magnus Granberg
2011-07-29 15:31 Magnus Granberg
2011-04-24 22:21 Magnus Granberg
2011-04-23 15:26 Magnus Granberg
2011-04-23 14:28 Magnus Granberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51b93e28e0fe10e4ee18dd485841650c194ae198.zorry@gentoo \
--to=zorry@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox