Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/zorry:master commit in: /, gobs/bin/, gobs/pym/
Date: Tue, 19 Jun 2012 23:56:58
Message-Id: 1340149977.3a2001a4117478e0bfad38e48c67f5b840d37953.zorry@gentoo
1 commit: 3a2001a4117478e0bfad38e48c67f5b840d37953
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 19 23:52:57 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 19 23:52:57 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=3a2001a4
7
8 major update for logging and depend runs
9
10 ---
11 gobs/bin/gobs_host_jobs | 7 ++--
12 gobs/pym/build_log.py | 12 ++++--
13 gobs/pym/build_queru.py | 83 ++++++++++++++++++++++++++++------------------
14 gobs/pym/buildquerydb.py | 27 +++++++++-----
15 gobs/pym/check_setup.py | 15 +++++---
16 gobs/pym/depgraph.py | 19 +++++++----
17 gobs/pym/jobs.py | 50 ++++++++++++++++++----------
18 gobs/pym/package.py | 56 +++++++++++++++++++++---------
19 gobs/pym/pgsql.py | 7 ++++
20 gobs/pym/sync.py | 21 ++++++++----
21 gobs/pym/updatedb.py | 42 +++++++++++++----------
22 vlc-log.txt | 29 ++++++++++++++++
23 12 files changed, 244 insertions(+), 124 deletions(-)
24
25 diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
26 index ba309b5..2f1adc8 100755
27 --- a/gobs/bin/gobs_host_jobs
28 +++ b/gobs/bin/gobs_host_jobs
29 @@ -24,10 +24,9 @@ def main():
30 # Main
31 config_profile = gobs_settings_dict['gobs_config']
32 # Logging
33 - logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
34 - format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
35 - repeat = True
36 - logging.info("Job deamon started.")
37 + conn = CM.getConnection()
38 + add_gobs_logs(conn, "Job deamon started", "info", config_profile)
39 + CM.putConnection(conn)
40 while repeat:
41 jobs_main(config_profile)
42 repeat = False
43
44 diff --git a/gobs/pym/build_log.py b/gobs/pym/build_log.py
45 index 56fc029..ec1fdd4 100644
46 --- a/gobs/pym/build_log.py
47 +++ b/gobs/pym/build_log.py
48 @@ -47,7 +47,8 @@ class gobs_buildlog(object):
49 categories = cpvr_list[0]
50 package = cpvr_list[1]
51 ebuild_version = cpv_getversion(pkg.cpv)
52 - logging.info('cpv: %s', pkg.cpv)
53 + log_msg = "cpv: %s" % pkg.cpv
54 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
55 init_package = gobs_package(settings, myportdb)
56 package_id = have_package_db(conn, categories, package)
57 # print("package_id %s" % package_id, file=sys.stdout)
58 @@ -549,7 +550,8 @@ class gobs_buildlog(object):
59 for sum_log_line in sum_build_log_list:
60 summary_error = summary_error + " " + sum_log_line
61 build_log_dict['logfilename'] = settings.get("PORTAGE_LOG_FILE").split(self._config_profile)[1]
62 - logging.info("Logfile name: %s", settings.get("PORTAGE_LOG_FILE"))
63 + log_msg = "Logfile name: %s" % settings.get("PORTAGE_LOG_FILE")
64 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
65 if build_dict['queue_id'] is None:
66 build_id = self.add_new_ebuild_buildlog(settings, pkg, build_dict, build_error, summary_error, build_log_dict)
67 else:
68 @@ -562,7 +564,8 @@ class gobs_buildlog(object):
69 self.write_msg_file(msg_line, emerge_info_logfilename)
70 os.chmod(settings.get("PORTAGE_LOG_FILE"), 0o664)
71 os.chmod(emerge_info_logfilename, 0o664)
72 - logging.info("Package: %s logged to db.", pkg.cpv)
73 + log_msg = "Package: %s logged to db." % pkg.cpv
74 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
75 else:
76 # FIXME Remove the log some way so
77 # mergetask._locate_failure_log(x) works in action_build()
78 @@ -570,5 +573,6 @@ class gobs_buildlog(object):
79 # os.remove(settings.get("PORTAGE_LOG_FILE"))
80 #except:
81 # pass
82 - logging.info("Package %s NOT logged to db.", pkg.cpv)
83 + log_msg = "Package %s NOT logged to db." % pkg.cpv
84 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
85 CM.putConnection(conn)
86
87 diff --git a/gobs/pym/build_queru.py b/gobs/pym/build_queru.py
88 index 46d815c..4ed6110 100644
89 --- a/gobs/pym/build_queru.py
90 +++ b/gobs/pym/build_queru.py
91 @@ -20,7 +20,7 @@ import logging
92 from gobs.manifest import gobs_manifest
93 from gobs.depclean import main_depclean
94 from gobs.flags import gobs_use_flags
95 -from _emerge.depgraph import depgraph, backtrack_depgraph
96 +from gobs.depgraph import backtrack_depgraph
97 from portage import _encodings
98 from portage import _unicode_decode
99 from portage.versions import cpv_getkey
100 @@ -157,31 +157,31 @@ class queruaction(object):
101 mydepgraph.display_problems()
102 self.log_fail_queru(build_dict, settings)
103 return 1, settings, trees, mtimedb
104 - if mydepgraph._dynamic_config._needed_use_config_changes:
105 - repeat = True
106 - repeat_times = 0
107 - while repeat:
108 - mydepgraph._display_autounmask()
109 - settings, trees, mtimedb = load_emerge_config()
110 - myparams = create_depgraph_params(myopts, myaction)
111 - try:
112 - success, mydepgraph, favorites = backtrack_depgraph(
113 - settings, trees, myopts, myparams, myaction, myfiles, spinner)
114 - except portage.exception.PackageSetNotFound as e:
115 - root_config = trees[settings["ROOT"]]["root_config"]
116 - display_missing_pkg_set(root_config, e.value)
117 - if not success and mydepgraph._dynamic_config._needed_use_config_changes:
118 - print("repaet_times:", repeat_times)
119 - if repeat_times is 2:
120 - build_dict['type_fail'] = "Need use change"
121 - build_dict['check_fail'] = True
122 - mydepgraph.display_problems()
123 - repeat = False
124 - repeat = False
125 - else:
126 - repeat_times = repeat_times + 1
127 - else:
128 + if mydepgraph._dynamic_config._needed_use_config_changes:
129 + repeat = True
130 + repeat_times = 0
131 + while repeat:
132 + mydepgraph._display_autounmask()
133 + settings, trees, mtimedb = load_emerge_config()
134 + myparams = create_depgraph_params(myopts, myaction)
135 + try:
136 + success, mydepgraph, favorites = backtrack_depgraph(
137 + settings, trees, myopts, myparams, myaction, myfiles, spinner)
138 + except portage.exception.PackageSetNotFound as e:
139 + root_config = trees[settings["ROOT"]]["root_config"]
140 + display_missing_pkg_set(root_config, e.value)
141 + if not success and mydepgraph._dynamic_config._needed_use_config_changes:
142 + print("repaet_times:", repeat_times)
143 + if repeat_times is 2:
144 + build_dict['type_fail'] = "Need use change"
145 + build_dict['check_fail'] = True
146 + mydepgraph.display_problems()
147 + repeat = False
148 repeat = False
149 + else:
150 + repeat_times = repeat_times + 1
151 + else:
152 + repeat = False
153
154 if mydepgraph._dynamic_config._unsolvable_blockers:
155 mydepgraph.display_problems()
156 @@ -190,6 +190,18 @@ class queruaction(object):
157 self.log_fail_queru(build_dict, settings)
158 return 1, settings, trees, mtimedb
159
160 + if mydepgraph._dynamic_config._slot_collision_info:
161 + mydepgraph.display_problems()
162 + build_dict['type_fail'] = "Slot blocking"
163 + build_dict['check_fail'] = True
164 + self.log_fail_queru(build_dict, settings)
165 + return 1, settings, trees, mtimedb
166 +
167 + if not success:
168 + build_dict['type_fail'] = "Dep calc fail"
169 + build_dict['check_fail'] = True
170 + mydepgraph.display_problems()
171 +
172 if build_dict['check_fail'] is True:
173 self.log_fail_queru(build_dict, settings)
174 return 1, settings, trees, mtimedb
175 @@ -218,7 +230,8 @@ class queruaction(object):
176 clear_caches(trees)
177
178 retval = mergetask.merge()
179 - logging.info('retval %s', retval)
180 + log_msg = "mergetask.merge retval: %s" % retval
181 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
182 if retval:
183 build_dict['type_fail'] = 'merge fail'
184 build_dict['check_fail'] = True
185 @@ -621,7 +634,8 @@ class queruaction(object):
186 if ebuild_version_checksum_tree == build_dict['checksum']:
187 init_flags = gobs_use_flags(settings, portdb, cpv)
188 build_use_flags_list = init_flags.comper_useflags(build_dict)
189 - logging.info("build_use_flags_list %s", build_use_flags_list)
190 + log_msg = "build_use_flags_list %s" % build_use_flags_list
191 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
192 manifest_error = init_manifest.check_file_in_manifest(portdb, cpv, build_dict, build_use_flags_list)
193 if manifest_error is None:
194 build_dict['check_fail'] = False
195 @@ -650,11 +664,13 @@ class queruaction(object):
196 for flags in build_use_flags_list:
197 build_use_flags = build_use_flags + flags + " "
198 filetext = '=' + k + ' ' + build_use_flags
199 - logging.info('filetext: %s', filetext)
200 + log_msg = "filetext: %s" % filetext
201 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
202 with open("/etc/portage/package.use/gobs.use", "a") as f:
203 f.write(filetext)
204 f.write('\n')
205 - logging.info('build_cpv_list: %s', build_cpv_list)
206 + log_msg = "build_cpv_list: %s" % build_cpv_list
207 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
208 argscmd = []
209 if not "nooneshort" in build_dict['post_message']:
210 argscmd.append("--oneshot")
211 @@ -662,11 +678,13 @@ class queruaction(object):
212 argscmd.append("--usepkg")
213 for build_cpv in build_cpv_list:
214 argscmd.append(build_cpv)
215 - logging.info("argscmd: %s", argscmd)
216 + log_msg = "argscmd: %s" % argscmd
217 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
218 # Call main_emerge to build the package in build_cpv_list
219 build_fail = self.emerge_main(argscmd, build_dict)
220 # Run depclean
221 - logging.info('build_fail: %s', build_fail)
222 + log_msg = "build_fail: %s" % build_fail
223 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
224 if not "noclean" in build_dict['post_message']:
225 depclean_fail = main_depclean()
226 try:
227 @@ -688,7 +706,8 @@ class queruaction(object):
228 if build_dict is None:
229 CM.putConnection(conn)
230 return
231 - logging.info("build_dict: %s", build_dict)
232 + log_msg = "build_dict: %s" % build_dict
233 + add_gobs_logs(conn, log_msg, "info", self._config_profile)
234 if not build_dict['ebuild_id'] is None and build_dict['checksum'] is not None:
235 buildqueru_cpv_dict = self.make_build_list(build_dict, settings, portdb)
236 logging.info('buildqueru_cpv_dict: %s', buildqueru_cpv_dict)
237
238 diff --git a/gobs/pym/buildquerydb.py b/gobs/pym/buildquerydb.py
239 index d383fbc..44f3373 100644
240 --- a/gobs/pym/buildquerydb.py
241 +++ b/gobs/pym/buildquerydb.py
242 @@ -5,12 +5,12 @@
243
244 import sys
245 import os
246 -import logging
247
248 # Get the options from the config file set in gobs.readconf
249 from gobs.readconf import get_conf_settings
250 reader=get_conf_settings()
251 gobs_settings_dict=reader.read_gobs_settings_all()
252 +config_profile = gobs_settings_dict['gobs_config']
253 # make a CM
254 from gobs.ConnectionManager import connectionManager
255 CM=connectionManager(gobs_settings_dict)
256 @@ -35,7 +35,8 @@ def add_cpv_query_pool(mysettings, init_package, config_id, package_line):
257 element = package_line.split('/')
258 categories = element[0]
259 package = element[1]
260 - logging.info("C %s/%s", categories, package) # C = Checking
261 + log_msg = "C %s/%s" % categories package
262 + add_gobs_logs(conn, log_msg, "info", config_profile)
263 pkgdir = mysettings['PORTDIR'] + "/" + categories + "/" + package
264 config_id_list = []
265 config_id_list.append(config_id)
266 @@ -54,16 +55,18 @@ def add_cpv_query_pool(mysettings, init_package, config_id, package_line):
267 if ebuild_id is not None:
268 ebuild_id_list.append(ebuild_id)
269 init_package.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
270 - logging.info("C %s/%s ... Done.", categories, package)
271 + log_msg = "C %s/%s ... Done." % categories package
272 + add_gobs_logs(conn, log_msg, "info", config_profile)
273 CM.putConnection(conn)
274 return
275
276 def add_buildquery_main(config_id):
277 conn=CM.getConnection()
278 - logging.info("Adding build querys for: %s", config_id)
279 - git_pull()
280 + log_msg = "Adding build querys for: %s" % config_id
281 + add_gobs_logs(conn, log_msg, "info", config_profile)
282 check_make_conf()
283 - logging.info("Check configs done")
284 + log_msg = "Check configs done"
285 + add_gobs_logs(conn, log_msg, "info", config_profile)
286 # Get default config from the configs table and default_config=1
287 default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id + "/"
288 # Set config_root (PORTAGE_CONFIGROOT) to default_config_root
289 @@ -72,7 +75,8 @@ def add_buildquery_main(config_id):
290 init_package = gobs_package(mysettings, myportdb)
291 # get the cp list
292 package_list_tree = package_list_tree = myportdb.cp_all()
293 - logging.info("Setting default config to: %s", config_id)
294 + log_msg = "Setting default config to: %s" % config_id
295 + add_gobs_logs(conn, log_msg, "info", config_profile)
296 # Use all exept 2 cores when multiprocessing
297 pool_cores= multiprocessing.cpu_count()
298 if pool_cores >= 3:
299 @@ -84,15 +88,18 @@ def add_buildquery_main(config_id):
300 pool.apply_async(add_cpv_query_pool, (mysettings, init_package, config_id, package_line,))
301 pool.close()
302 pool.join()
303 - logging.info("Adding build querys for: %s ... Done.", config_id)
304 + log_msg = "Adding build querys for: %s ... Done." % config_id
305 + add_gobs_logs(conn, log_msg, "info", config_profile)
306 return True
307
308 def del_buildquery_main(config_id):
309 - logging.info("Removeing build querys for: %s", config_id)
310 + log_msg = "Removeing build querys for: %s" % config_id
311 + add_gobs_logs(conn, log_msg, "info", config_profile)
312 querue_id_list = get_queue_id_list_config(conn, config_id)
313 if querue_id_list is not None:
314 for querue_id in querue_id_list:
315 del_old_queue(conn, querue_id)
316 - logging.info("Removeing build querys for: %s ... Done.", config_id)
317 + log_msg = "Removeing build querys for: %s ... Done." % config_id
318 + add_gobs_logs(conn, log_msg, "info", config_profile)
319 CM.putConnection(conn)
320 return True
321
322 diff --git a/gobs/pym/check_setup.py b/gobs/pym/check_setup.py
323 index 3a5b404..609b6f8 100644
324 --- a/gobs/pym/check_setup.py
325 +++ b/gobs/pym/check_setup.py
326 @@ -2,14 +2,13 @@ from __future__ import print_function
327 import portage
328 import os
329 import errno
330 -import logging
331
332 -from git import *
333 from gobs.text import get_file_text
334
335 from gobs.readconf import get_conf_settings
336 reader=get_conf_settings()
337 gobs_settings_dict=reader.read_gobs_settings_all()
338 +config_profile = gobs_settings_dict['gobs_config']
339 # make a CM
340 from gobs.ConnectionManager import connectionManager
341 CM=connectionManager(gobs_settings_dict)
342 @@ -21,7 +20,8 @@ def check_make_conf():
343 # Get the config list
344 conn=CM.getConnection()
345 config_list_all = get_config_list_all(conn)
346 - logging.info("Checking configs for changes and errors")
347 + log_msg = "Checking configs for changes and errors"
348 + add_gobs_logs(conn, log_msg, "info", config_profile)
349 configsDict = {}
350 for config_id in config_list_all:
351 attDict={}
352 @@ -41,11 +41,13 @@ def check_make_conf():
353 except Exception as e:
354 attDict['config_error'] = e
355 attDict['active'] = 'False'
356 - logging.info("%s FAIL!", config_id[0])
357 + log_msg = "%s FAIL!" % config_id[0]
358 + add_gobs_logs(conn, log_msg, "info", config_profile)
359 else:
360 attDict['config_error'] = ''
361 attDict['active'] = 'True'
362 - logging.info("%s PASS", config_id[0])
363 + log_msg = "%s PASS" % config_id[0]
364 + add_gobs_logs(conn, log_msg, "info", config_profile)
365 # Get the checksum of make.conf
366 make_conf_checksum_tree = portage.checksum.sha256hash(make_conf_file)[0]
367 logging.info("make.conf checksum is %s on %s", make_conf_checksum_tree, config_id[0])
368 @@ -54,7 +56,8 @@ def check_make_conf():
369 configsDict[config_id[0]]=attDict
370 update__make_conf(conn, configsDict)
371 CM.putConnection(conn)
372 - logging.info("Checking configs for changes and errors ... Done")
373 + log_msg = "Checking configs for changes and errors ... Done"
374 + add_gobs_logs(conn, msg_log, "info", config_profile)
375
376 def check_make_conf_guest(config_profile):
377 conn=CM.getConnection()
378
379 diff --git a/gobs/pym/depgraph.py b/gobs/pym/depgraph.py
380 index 2d5f73c..7c46cde 100644
381 --- a/gobs/pym/depgraph.py
382 +++ b/gobs/pym/depgraph.py
383 @@ -3573,7 +3573,7 @@ class depgraph(object):
384 pkg = None
385
386 if self._dynamic_config._autounmask is True:
387 - reset_pkg(pkg)
388 + pkg = None
389
390 for autounmask_level in self._autounmask_levels():
391 if pkg is not None:
392 @@ -3944,18 +3944,23 @@ class depgraph(object):
393 node = child
394 else:
395 satisfied = is_active(token)
396 + stack[level].append(satisfied)
397 + node._children.append(portage.dep._RequiredUseLeaf(token, satisfied))
398 + print("satisfied:", satisfied)
399 if satisfied is False:
400 new_changes = {}
401 new_changes[token] = True
402 - if not pkg.use.mask.intersection(new_changes) or not \
403 - pkg.use.force.intersection(new_changes):
404 + print("new_changes:", new_changes)
405 + if pkg.use.mask.intersection(new_changes) or \
406 + pkg.use.force.intersection(new_changes):
407 + print("mask or force")
408 + else:
409 + print("new_changes2:", new_changes)
410 if token in pkg.use.enabled:
411 target_use[token] = False
412 elif not token in pkg.use.enabled:
413 - target_use[token] = True
414 -
415 - stack[level].append(satisfied)
416 - node._children.append(portage.dep._RequiredUseLeaf(token, satisfied))
417 + target_use[token] = True
418 + return target_use
419
420 if level != 0 or need_bracket:
421 raise InvalidDependString(
422
423 diff --git a/gobs/pym/jobs.py b/gobs/pym/jobs.py
424 index a49cae2..adea5a1 100644
425 --- a/gobs/pym/jobs.py
426 +++ b/gobs/pym/jobs.py
427 @@ -15,63 +15,77 @@ from gobs.sync import git_pull, sync_tree
428 from gobs.buildquerydb import add_buildquery_main, del_buildquery_main
429 from gobs.updatedb import update_db_main
430
431 -import logging
432 -
433 def jobs_main(config_profile):
434 conn = CM.getConnection()
435 job = check_job_list(conn, config_profile)
436 if job is None:
437 CM.putConnection(conn)
438 return
439 - logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_profile)
440 + log_msg = "Job: %s Type: %s", % job[1], job[0]
441 + add_gobs_logs(conn, log_msg, "info", config_profile)
442 if job[0] == "addbuildquery":
443 update_job_list(conn, "Runing", job[1])
444 - logging.info("Job %s is runing. Config: %s", job[0], config_profile)
445 + log_msg = "Job %s is runing.", % job[1]
446 + add_gobs_logs(conn, log_msg, "info", config_profile)
447 result = add_buildquery_main(config_profile)
448 if result is True:
449 update_job_list(conn, "Done", job[1])
450 - logging.info("Job %s is done. Config: %s", job[0], config_profile)
451 + log_msg = "Job %s is done..", % job[1]
452 + add_gobs_logs(conn, log_msg, "info", config_profile)
453 else:
454 update_job_list(conn, "Fail", job[1])
455 - logging.info("Job %s did fail. Config: %s", job[0], config_profile)
456 + log_msg = "Job %s did fail.", % job[1]
457 + add_gobs_logs(conn, log_msg, "info", config_profile)
458 elif job[0] == "delbuildquery":
459 update_job_list(conn, "Runing", job[1])
460 - logging.info("Job %s is runing. Config: %s", job[0], config_profile)
461 + log_msg = "Job %s is runing.", % job[1]
462 + add_gobs_logs(conn, log_msg, "info", config_profile)
463 result = del_buildquery_main(config_profile)
464 if result is True:
465 update_job_list(conn, "Done", job[1])
466 - logging.info("Job %s is done. Config: %s", job[0], config_profile)
467 + log_msg = "Job %s is done..", % job[1]
468 + add_gobs_logs(conn, log_msg, "info", config_profile)
469 else:
470 update_job_list(conn, "Fail", job[1])
471 - logging.info("Job %s did fail. Config: %s", job[0], config_profile)
472 + log_msg = "Job %s did fail.", % job[1]
473 + add_gobs_logs(conn, log_msg, "info", config_profile)
474 elif job[0] == "gitsync":
475 update_job_list(conn, "Runing", job[1])
476 - logging.info("Job %s is runing. Config: %s", job[0], config_profile)
477 + log_msg = "Job %s is runing.", % job[1]
478 + add_gobs_logs(conn, log_msg, "info", config_profile)
479 result = git_pull()
480 if result is True:
481 update_job_list(conn, "Done", job[1])
482 - logging.info("Job %s is done. Config: %s", job[0], config_profile)
483 + log_msg = "Job %s is done..", % job[1]
484 + add_gobs_logs(conn, log_msg, "info", config_profile)
485 else:
486 update_job_list(conn, "Fail", job[1])
487 - logging.info("Job %s did fail. Config: %s", job[0], config_profile)
488 + log_msg = "Job %s did fail.", % job[1]
489 + add_gobs_logs(conn, log_msg, "info", config_profile)
490 elif job[0] == "emergesync":
491 update_job_list(conn, "Runing", job[1])
492 - logging.info("Job %s is runing. Config: %s", job[0], config_profile)
493 + log_msg = "Job %s is runing.", % job[1]
494 + add_gobs_logs(conn, log_msg, "info", config_profile)
495 result = sync_tree()
496 if result is True:
497 update_job_list(conn, "Done", job[1])
498 - logging.info("Job %s is done. Config: %s", job[0], config_profile)
499 + log_msg = "Job %s is done..", % job[1]
500 + add_gobs_logs(conn, log_msg, "info", config_profile)
501 else:
502 update_job_list(conn, "Fail", job[1])
503 - logging.info("Job %s did fail. Config: %s", job[0], config_profile)
504 + log_msg = "Job %s did fail.", % job[1]
505 + add_gobs_logs(conn, log_msg, "info", config_profile)
506 elif job[0] == "updatedb":
507 update_job_list(conn, "Runing", job[1])
508 - logging.info("Job %s is runing. Config: %s", job[0], config_profile)
509 + log_msg = "Job %s is runing.", % job[1]
510 + add_gobs_logs(conn, log_msg, "info", config_profile)
511 result = update_db_main()
512 if result is True:
513 update_job_list(conn, "Done", job[1])
514 - logging.info("Job %s is done. Config: %s", job[0], config_profile)
515 + log_msg = "Job %s is done..", % job[1]
516 + add_gobs_logs(conn, log_msg, "info", config_profile)
517 else:
518 update_job_list(conn, "Fail", job[1])
519 - logging.info("Job %s did fail. Config: %s", job[0], config_profile)
520 + log_msg = "Job %s did fail.", % job[1]
521 + add_gobs_logs(conn, log_msg, "info", config_profile)
522 return
523 \ No newline at end of file
524
525 diff --git a/gobs/pym/package.py b/gobs/pym/package.py
526 index 7487494..c646cdb 100644
527 --- a/gobs/pym/package.py
528 +++ b/gobs/pym/package.py
529 @@ -1,5 +1,4 @@
530 from __future__ import print_function
531 -import logging
532 import portage
533 from gobs.flags import gobs_use_flags
534 from gobs.repoman_gobs import gobs_repoman
535 @@ -10,6 +9,7 @@ from gobs.readconf import get_conf_settings
536 from gobs.flags import gobs_use_flags
537 reader=get_conf_settings()
538 gobs_settings_dict=reader.read_gobs_settings_all()
539 +config_profile = gobs_settings_dict['gobs_config']
540 # make a CM
541 from gobs.ConnectionManager import connectionManager
542 CM=connectionManager(gobs_settings_dict)
543 @@ -89,7 +89,8 @@ class gobs_package(object):
544 # ebuild_version_metadata_tree and set ebuild_version_checksum_tree to 0
545 # so it can be updated next time we update the db
546 if ebuild_version_metadata_tree == []:
547 - logging.info(" QA: %s Have broken metadata", ebuild_line)
548 + log_msg = " QA: %s Have broken metadata" % ebuild_line
549 + add_gobs_logs(conn, log_msg, "info", config_profile)
550 ebuild_version_metadata_tree = ['','','','','','','','','','','','','','','','','','','','','','','','','']
551 ebuild_version_checksum_tree = ['0']
552 # add the ebuild to the dict packages
553 @@ -156,8 +157,10 @@ class gobs_package(object):
554 # Comper ebuild_version and add the ebuild_version to buildqueue
555 if portage.vercmp(v['ebuild_version_tree'], latest_ebuild_version) == 0:
556 add_new_package_buildqueue(conn,ebuild_id, config_id, use_flags_list, use_enable_list, message)
557 - logging.info("B %s/%s-%s USE: %s %s", v['categories'], v['package'], \
558 - latest_ebuild_version, use_enable, config_id) # B = Build cpv use-flags config
559 + B = Build cpv use-flags config
560 + log_msg = ("B %s/%s-%s USE: %s %s" % v['categories'] v['package'] \
561 + latest_ebuild_version use_enable config_id
562 + add_gobs_logs(conn, log_msg, "info", config_profile)
563 i = i +1
564 CM.putConnection(conn)
565
566 @@ -179,8 +182,12 @@ class gobs_package(object):
567 def add_new_package_db(self, categories, package):
568 conn=CM.getConnection()
569 # add new categories package ebuild to tables package and ebuilds
570 - logging.info("C %s/%s", categories, package) # C = Checking
571 - logging.info("N %s/%s", categories, package) # N = New Package
572 + # C = Checking
573 + # N = New Package
574 + log_msg = ("C %s/%s" % categories package
575 + add_gobs_logs(conn, log_msg, "info", config_profile)
576 + log_msg = ("N %s/%s" % categories package
577 + add_gobs_logs(conn, log_msg, "info", config_profile)
578 pkgdir = self._mysettings['PORTDIR'] + "/" + categories + "/" + package # Get PORTDIR + cp
579 categories_dir = self._mysettings['PORTDIR'] + "/" + categories + "/"
580 # Get the ebuild list for cp
581 @@ -209,7 +216,8 @@ class gobs_package(object):
582 manifest_error = init_manifest.digestcheck()
583 if manifest_error is not None:
584 qa_error.append(manifest_error)
585 - logging.info("QA: %s/%s %s", categories, package, qa_error)
586 + log_msg = ("QA: %s/%s %s" % categories package qa_error
587 + add_gobs_logs(conn, log_msg, "info", config_profile)
588 add_qa_repoman(conn,ebuild_id_list, qa_error, packageDict, config_id)
589 # Add the ebuild to the buildqueru table if needed
590 self.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
591 @@ -222,17 +230,21 @@ class gobs_package(object):
592 except:
593 manifest_checksum_tree = "0"
594 get_manifest_text = "0"
595 - logging.info("QA: Can't checksum the Manifest file. %c/%s", categories, package)
596 + log_msg = "QA: Can't checksum the Manifest file. %c/%s" % categories package
597 + add_gobs_logs(conn, log_msg, "info", config_profile)
598 else:
599 get_manifest_text = get_file_text(pkgdir + "/Manifest")
600 add_new_manifest_sql(conn,package_id, get_manifest_text, manifest_checksum_tree)
601 CM.putConnection(conn)
602 - logging.info("C %s/%s ... Done.", categories, package)
603 + log_msg = "C %s/%s ... Done." % categories package
604 + add_gobs_logs(conn, log_msg, "info", config_profile)
605
606 def update_package_db(self, categories, package, package_id):
607 conn=CM.getConnection()
608 # Update the categories and package with new info
609 - logging.info("C %s/%s", categories, package) # C = Checking
610 + # C = Checking
611 + log_msg = "C %s/%s" % categories package
612 + add_gobs_logs(conn, log_msg, "info", config_profile)
613 pkgdir = self._mysettings['PORTDIR'] + "/" + categories + "/" + package # Get PORTDIR with cp
614 # Get the checksum from the Manifest file.
615 try:
616 @@ -243,15 +255,19 @@ class gobs_package(object):
617 ebuild_list_tree = self._myportdb.cp_list((categories + "/" + package), use_cache=1, mytree=None)
618 if ebuild_list_tree == []:
619 CM.putConnection(conn)
620 - logging.info("QA: No Manifest file or ebuilds in %s/%s.", categories, package)
621 - logging.info("C %s/%s ... Done.", categories, package)
622 + log_msg = "QA: No Manifest file or ebuilds in %s/%s." % categories package
623 + add_gobs_logs(conn, log_msg, "info", config_profile)
624 + log_msg = "C %s/%s ... Done." % categories package
625 + add_gobs_logs(conn, log_msg, "info", config_profile)
626 return
627 # Get the checksum from the db in package table
628 manifest_checksum_db = get_manifest_db(conn,package_id)
629 # if we have the same checksum return else update the package
630 ebuild_list_tree = self._myportdb.cp_list((categories + "/" + package), use_cache=1, mytree=None)
631 if manifest_checksum_tree != manifest_checksum_db:
632 - logging.info("U %s/%s", categories, package) # U = Update
633 + # U = Update
634 + log_msg = "U %s/%s" % categories package
635 + add_gobs_logs(conn, log_msg, "info", config_profile)
636 # Get package_metadataDict and update the db with it
637 package_metadataDict = self.get_package_metadataDict(pkgdir, package)
638 update_new_package_metadata(conn,package_id, package_metadataDict)
639 @@ -272,9 +288,13 @@ class gobs_package(object):
640 # Get packageDict for ebuild
641 packageDict[ebuild_line] = self.get_packageDict(pkgdir, ebuild_line, categories, package, config_id)
642 if ebuild_version_manifest_checksum_db is None:
643 - logging.info("N %s/%s-%s", categories, package, ebuild_version_tree) # N = New ebuild
644 + # N = New ebuild
645 + log_msg = "N %s/%s-%s" % categories package ebuild_version_tree
646 + add_gobs_logs(conn, log_msg, "info", config_profile)
647 else:
648 - logging.info("U %s/%s-%s", categories, package, ebuild_version_tree) # U = Updated ebuild
649 + # U = Updated ebuild
650 + log_msg = "U %s/%s-%s" % categories package ebuild_version_tree
651 + add_gobs_logs(conn, log_msg, "info", config_profile)
652 # Fix so we can use add_new_package_sql(packageDict) to update the ebuilds
653 old_ebuild_list.append(ebuild_version_tree)
654 add_old_ebuild(conn,package_id, old_ebuild_list)
655 @@ -296,7 +316,8 @@ class gobs_package(object):
656 manifest_error = init_manifest.digestcheck()
657 if manifest_error is not None:
658 qa_error.append(manifest_error)
659 - logging.info("QA: %s/%s %s", categories, package, qa_error)
660 + log_msg = "QA: %s/%s %s" % categories, package, qa_error
661 + add_gobs_logs(conn, log_msg, "info", config_profile)
662 add_qa_repoman(conn,ebuild_id_list, qa_error, packageDict, config_id)
663 # Add the ebuild to the buildqueru table if needed
664 self.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
665 @@ -304,7 +325,8 @@ class gobs_package(object):
666 init_old_cpv = gobs_old_cpv(self._myportdb, self._mysettings)
667 init_old_cpv.mark_old_ebuild_db(categories, package, package_id)
668 CM.putConnection(conn)
669 - logging.info("C %s/%s ... Done.", categories, package)
670 + log_msg = "C %s/%s ... Done." % categories package
671 + add_gobs_logs(conn, log_msg, "info", config_profile)
672
673 def update_ebuild_db(self, build_dict):
674 conn=CM.getConnection()
675
676 diff --git a/gobs/pym/pgsql.py b/gobs/pym/pgsql.py
677 index 67451bb..be557d2 100644
678 --- a/gobs/pym/pgsql.py
679 +++ b/gobs/pym/pgsql.py
680 @@ -624,3 +624,10 @@ def update_job_list(connection, status, jobid):
681 sqlQ = 'UPDATE jobs_list SET status = %s WHERE jobnr = %s'
682 cursor.execute(sqlQ, (status, jobid,))
683 connection.commit()
684 +
685 +def add_gobs_logs(connection, log_msg, log_type, config):
686 + cursor = connection.cursor()
687 + sqlQ = 'INSERT INTO logs (host, type, msg, time) VALUES ( %s, %s, %s, now())'
688 + cursor.execute(sqlQ, (config, log_type, log_msg))
689 + connection.commit()
690 +
691
692 diff --git a/gobs/pym/sync.py b/gobs/pym/sync.py
693 index 0beeb22..953d379 100644
694 --- a/gobs/pym/sync.py
695 +++ b/gobs/pym/sync.py
696 @@ -2,7 +2,6 @@ from __future__ import print_function
697 import portage
698 import os
699 import errno
700 -import logging
701 import sys
702 from git import *
703 from _emerge.main import emerge_main
704 @@ -16,14 +15,19 @@ CM=connectionManager(gobs_settings_dict)
705 if CM.getName()=='pgsql':
706 from gobs.pgsql import *
707
708 +config_profile = gobs_settings_dict['gobs_config']
709 +
710 def git_pull():
711 - logging.info("Git pull")
712 + log_msg = "Git pull"
713 + add_gobs_logs(conn, log_msg, "info", config_profile)
714 repo = Repo("/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/")
715 repo_remote = repo.remotes.origin
716 repo_remote.pull()
717 master = repo.head.reference
718 - logging.info("Git log: %s", master.log())
719 - logging.info("Git pull ... Done.")
720 + log_msg = "Git log: %s" % master.log()
721 + add_gobs_logs(conn, log_msg, "info", config_profile)
722 + log_msg = "Git pull ... Done"
723 + add_gobs_logs(conn, log_msg, "info", config_profile)
724 return True
725
726 def sync_tree():
727 @@ -36,10 +40,12 @@ def sync_tree():
728 tmpcmdline.append("--sync")
729 tmpcmdline.append("--quiet")
730 tmpcmdline.append("--config-root=" + default_config_root)
731 - logging.info("Emerge --sync")
732 + log_msg = "Emerge --sync"
733 + add_gobs_logs(conn, log_msg, "info", config_profile)
734 fail_sync = emerge_main(args=tmpcmdline)
735 if fail_sync is True:
736 - logging.warning("Emerge --sync fail!")
737 + log_msg = "Emerge --sync fail!"
738 + add_gobs_logs(conn, log_msg, "warning", config_profile)
739 return False
740 else:
741 # Need to add a config dir so we can use profiles/base for reading the tree.
742 @@ -51,5 +57,6 @@ def sync_tree():
743 f.close()
744 except:
745 pass
746 - logging.info("Emerge --sync ... Done.")
747 + log_msg = "Emerge --sync ... Done."
748 + add_gobs_logs(conn, log_msg, "info", config_profile)
749 return True
750
751 diff --git a/gobs/pym/updatedb.py b/gobs/pym/updatedb.py
752 index 91cb79f..b522c24 100755
753 --- a/gobs/pym/updatedb.py
754 +++ b/gobs/pym/updatedb.py
755 @@ -6,13 +6,12 @@ from __future__ import print_function
756 import sys
757 import os
758 import multiprocessing
759 -import logging
760
761 # Get the options from the config file set in gobs.readconf
762 from gobs.readconf import get_conf_settings
763 reader = get_conf_settings()
764 gobs_settings_dict=reader.read_gobs_settings_all()
765 -logfile = gobs_settings_dict['gobs_logfile']
766 +config_profile = gobs_settings_dict['gobs_config']
767
768 # make a CM
769 from gobs.ConnectionManager import connectionManager
770 @@ -41,25 +40,22 @@ def init_portage_settings():
771 @returns new settings
772 """
773 # check config setup
774 - #git stuff
775 conn=CM.getConnection()
776 check_make_conf()
777 - logging.info("Check configs done")
778 + log_msg = "Check configs done"
779 + add_gobs_logs(conn, log_msg, "info", config_profile)
780 # Get default config from the configs table and default_config=1
781 config_id = get_default_config(conn) # HostConfigDir = table configs id
782 CM.putConnection(conn);
783 default_config_root = "/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
784 # Set config_root (PORTAGE_CONFIGROOT) to default_config_root
785 mysettings = portage.config(config_root = default_config_root)
786 - logging.info("Setting default config to: %s", config_id[0])
787 + log_msg = "Setting default config to: %s" % config_id[0]
788 + add_gobs_logs(conn, log_msg, "info", config_profile)
789 return mysettings
790
791 -def update_cpv_db_pool(mysettings, package_line):
792 +def update_cpv_db_pool(mysettings, myportdb, init_package, package_line):
793 conn=CM.getConnection()
794 - # Setup portdb, gobs_categories, gobs_old_cpv, package
795 - myportdb = portage.portdbapi(mysettings=mysettings)
796 - init_categories = gobs_categories(mysettings)
797 - init_package = gobs_package(mysettings, myportdb)
798 # split the cp to categories and package
799 element = package_line.split('/')
800 categories = element[0]
801 @@ -74,7 +70,9 @@ def update_cpv_db_pool(mysettings, package_line):
802 # Update the packages with ebuilds
803 init_package.update_package_db(categories, package, package_id)
804 # Update the metadata for categories
805 + init_categories = gobs_categories(mysettings)
806 init_categories.update_categories_db(categories)
807 + myportdb.close_caches()
808 CM.putConnection(conn)
809
810 def update_cpv_db():
811 @@ -87,9 +85,11 @@ def update_cpv_db():
812 @parms: config options from the config file
813 """
814 mysettings = init_portage_settings()
815 - logging.info("Checking categories, package, ebuilds")
816 - # Setup portdb, gobs_categories, gobs_old_cpv, package
817 + log_msg = "Checking categories, package, ebuilds"
818 + add_gobs_logs(conn, log_msg, "info", config_profile)
819 + # Setup portdb, package
820 myportdb = portage.portdbapi(mysettings=mysettings)
821 + init_package = gobs_package(mysettings, myportdb)
822 package_id_list_tree = []
823 # Will run some update checks and update package if needed
824 # Get categories/package list from portage
825 @@ -105,24 +105,27 @@ def update_cpv_db():
826 # a multiprocessing pool
827 for package_line in sorted(package_list_tree):
828 #update_cpv_db_pool(mysettings, package_line)
829 - # FIXME: Mem prob with the multiprocessing
830 - pool.apply_async(update_cpv_db_pool, (mysettings, package_line,))
831 + pool.apply_async(update_cpv_db_pool, (mysettings, myportdb, init_package, package_line,))
832 pool.close()
833 pool.join()
834 - logging.info("Checking categories, package and ebuilds ... done")
835 + log_msg = "Checking categories, package and ebuilds ... done"
836 + add_gobs_logs(conn, log_msg, "info", config_profile)
837
838 def update_db_main():
839 # Main
840 # Logging
841 - logging.info("Update db started.")
842 + log_msg = "Update db started."
843 + add_gobs_logs(conn, log_msg, "info", config_profile)
844 # Sync portage and profile/settings
845 resutalt = git_pull()
846 if resutalt is False:
847 - logging.info("Update db ... Fail.")
848 + log_msg = "Update db ... Fail."
849 + add_gobs_logs(conn, log_msg, "info", config_profile)
850 return False
851 resutalt = sync_tree()
852 if resutalt is False:
853 - logging.info("Update db ... Fail.")
854 + log_msg = "Update db ... Fail."
855 + add_gobs_logs(conn, log_msg, "info", config_profile)
856 return False
857 # Init settings for the default config
858 mysettings = init_portage_settings()
859 @@ -130,5 +133,6 @@ def update_db_main():
860 init_arch.update_arch_db()
861 # Update the cpv db
862 update_cpv_db()
863 - logging.info("Update db ... Done.")
864 + log_msg = "Update db ... Done."
865 + add_gobs_logs(conn, log_msg, "info", config_profile)
866 return True
867 \ No newline at end of file
868
869 diff --git a/vlc-log.txt b/vlc-log.txt
870 new file mode 100644
871 index 0000000..2af0aac
872 --- /dev/null
873 +++ b/vlc-log.txt
874 @@ -0,0 +1,29 @@
875 +-- logger module started --
876 +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
877 +qt4 error: cannot start Qt4 multiple times
878 +qt4 error: could not open device /dev/dvd
879 +main error: ES_OUT_RESET_PCR called
880 +main error: ES_OUT_RESET_PCR called
881 +-- logger module started --
882 +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
883 +qt4 error: cannot start Qt4 multiple times
884 +main error: ES_OUT_RESET_PCR called
885 +main error: ES_OUT_RESET_PCR called
886 +-- logger module stopped --
887 +-- logger module started --
888 +main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
889 +qt4 error: cannot start Qt4 multiple times
890 +main error: ES_OUT_RESET_PCR called
891 +main error: ES_OUT_RESET_PCR called
892 +main error: ES_OUT_RESET_PCR called
893 +qt4 error: Unable to load extensions module
894 +main error: ES_OUT_RESET_PCR called
895 +main error: ES_OUT_RESET_PCR called
896 +main error: ES_OUT_RESET_PCR called
897 +main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms)
898 +main error: ES_OUT_RESET_PCR called
899 +main error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 6195 ms ignored)
900 +main error: ES_OUT_RESET_PCR called
901 +main error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 6313 ms ignored)
902 +main error: ES_OUT_RESET_PCR called
903 +-- logger module stopped --