commit: 3a2001a4117478e0bfad38e48c67f5b840d37953
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 19 23:52:57 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Tue Jun 19 23:52:57 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=3a2001a4
major update for logging and depend runs
---
gobs/bin/gobs_host_jobs | 7 ++--
gobs/pym/build_log.py | 12 ++++--
gobs/pym/build_queru.py | 83 ++++++++++++++++++++++++++++------------------
gobs/pym/buildquerydb.py | 27 +++++++++-----
gobs/pym/check_setup.py | 15 +++++---
gobs/pym/depgraph.py | 19 +++++++----
gobs/pym/jobs.py | 50 ++++++++++++++++++----------
gobs/pym/package.py | 56 +++++++++++++++++++++---------
gobs/pym/pgsql.py | 7 ++++
gobs/pym/sync.py | 21 ++++++++----
gobs/pym/updatedb.py | 42 +++++++++++++----------
vlc-log.txt | 29 ++++++++++++++++
12 files changed, 244 insertions(+), 124 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
index ba309b5..2f1adc8 100755
--- a/gobs/bin/gobs_host_jobs
+++ b/gobs/bin/gobs_host_jobs
@@ -24,10 +24,9 @@ def main():
# Main
config_profile = gobs_settings_dict['gobs_config']
# Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
- format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
- repeat = True
- logging.info("Job deamon started.")
+ conn = CM.getConnection()
+ add_gobs_logs(conn, "Job deamon started", "info", config_profile)
+ CM.putConnection(conn)
while repeat:
jobs_main(config_profile)
repeat = False
diff --git a/gobs/pym/build_log.py b/gobs/pym/build_log.py
index 56fc029..ec1fdd4 100644
--- a/gobs/pym/build_log.py
+++ b/gobs/pym/build_log.py
@@ -47,7 +47,8 @@ class gobs_buildlog(object):
categories = cpvr_list[0]
package = cpvr_list[1]
ebuild_version = cpv_getversion(pkg.cpv)
- logging.info('cpv: %s', pkg.cpv)
+ log_msg = "cpv: %s" % pkg.cpv
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
init_package = gobs_package(settings, myportdb)
package_id = have_package_db(conn, categories, package)
# print("package_id %s" % package_id, file=sys.stdout)
@@ -549,7 +550,8 @@ class gobs_buildlog(object):
for sum_log_line in sum_build_log_list:
summary_error = summary_error + " " + sum_log_line
build_log_dict['logfilename'] = settings.get("PORTAGE_LOG_FILE").split(self._config_profile)[1]
- logging.info("Logfile name: %s", settings.get("PORTAGE_LOG_FILE"))
+ log_msg = "Logfile name: %s" % settings.get("PORTAGE_LOG_FILE")
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
if build_dict['queue_id'] is None:
build_id = self.add_new_ebuild_buildlog(settings, pkg, build_dict, build_error, summary_error, build_log_dict)
else:
@@ -562,7 +564,8 @@ class gobs_buildlog(object):
self.write_msg_file(msg_line, emerge_info_logfilename)
os.chmod(settings.get("PORTAGE_LOG_FILE"), 0o664)
os.chmod(emerge_info_logfilename, 0o664)
- logging.info("Package: %s logged to db.", pkg.cpv)
+ log_msg = "Package: %s logged to db." % pkg.cpv
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
else:
# FIXME Remove the log some way so
# mergetask._locate_failure_log(x) works in action_build()
@@ -570,5 +573,6 @@ class gobs_buildlog(object):
# os.remove(settings.get("PORTAGE_LOG_FILE"))
#except:
# pass
- logging.info("Package %s NOT logged to db.", pkg.cpv)
+ log_msg = "Package %s NOT logged to db." % pkg.cpv
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
CM.putConnection(conn)
diff --git a/gobs/pym/build_queru.py b/gobs/pym/build_queru.py
index 46d815c..4ed6110 100644
--- a/gobs/pym/build_queru.py
+++ b/gobs/pym/build_queru.py
@@ -20,7 +20,7 @@ import logging
from gobs.manifest import gobs_manifest
from gobs.depclean import main_depclean
from gobs.flags import gobs_use_flags
-from _emerge.depgraph import depgraph, backtrack_depgraph
+from gobs.depgraph import backtrack_depgraph
from portage import _encodings
from portage import _unicode_decode
from portage.versions import cpv_getkey
@@ -157,31 +157,31 @@ class queruaction(object):
mydepgraph.display_problems()
self.log_fail_queru(build_dict, settings)
return 1, settings, trees, mtimedb
- if mydepgraph._dynamic_config._needed_use_config_changes:
- repeat = True
- repeat_times = 0
- while repeat:
- mydepgraph._display_autounmask()
- settings, trees, mtimedb = load_emerge_config()
- myparams = create_depgraph_params(myopts, myaction)
- try:
- success, mydepgraph, favorites = backtrack_depgraph(
- settings, trees, myopts, myparams, myaction, myfiles, spinner)
- except portage.exception.PackageSetNotFound as e:
- root_config = trees[settings["ROOT"]]["root_config"]
- display_missing_pkg_set(root_config, e.value)
- if not success and mydepgraph._dynamic_config._needed_use_config_changes:
- print("repaet_times:", repeat_times)
- if repeat_times is 2:
- build_dict['type_fail'] = "Need use change"
- build_dict['check_fail'] = True
- mydepgraph.display_problems()
- repeat = False
- repeat = False
- else:
- repeat_times = repeat_times + 1
- else:
+ if mydepgraph._dynamic_config._needed_use_config_changes:
+ repeat = True
+ repeat_times = 0
+ while repeat:
+ mydepgraph._display_autounmask()
+ settings, trees, mtimedb = load_emerge_config()
+ myparams = create_depgraph_params(myopts, myaction)
+ try:
+ success, mydepgraph, favorites = backtrack_depgraph(
+ settings, trees, myopts, myparams, myaction, myfiles, spinner)
+ except portage.exception.PackageSetNotFound as e:
+ root_config = trees[settings["ROOT"]]["root_config"]
+ display_missing_pkg_set(root_config, e.value)
+ if not success and mydepgraph._dynamic_config._needed_use_config_changes:
+ print("repaet_times:", repeat_times)
+ if repeat_times is 2:
+ build_dict['type_fail'] = "Need use change"
+ build_dict['check_fail'] = True
+ mydepgraph.display_problems()
+ repeat = False
repeat = False
+ else:
+ repeat_times = repeat_times + 1
+ else:
+ repeat = False
if mydepgraph._dynamic_config._unsolvable_blockers:
mydepgraph.display_problems()
@@ -190,6 +190,18 @@ class queruaction(object):
self.log_fail_queru(build_dict, settings)
return 1, settings, trees, mtimedb
+ if mydepgraph._dynamic_config._slot_collision_info:
+ mydepgraph.display_problems()
+ build_dict['type_fail'] = "Slot blocking"
+ build_dict['check_fail'] = True
+ self.log_fail_queru(build_dict, settings)
+ return 1, settings, trees, mtimedb
+
+ if not success:
+ build_dict['type_fail'] = "Dep calc fail"
+ build_dict['check_fail'] = True
+ mydepgraph.display_problems()
+
if build_dict['check_fail'] is True:
self.log_fail_queru(build_dict, settings)
return 1, settings, trees, mtimedb
@@ -218,7 +230,8 @@ class queruaction(object):
clear_caches(trees)
retval = mergetask.merge()
- logging.info('retval %s', retval)
+ log_msg = "mergetask.merge retval: %s" % retval
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
if retval:
build_dict['type_fail'] = 'merge fail'
build_dict['check_fail'] = True
@@ -621,7 +634,8 @@ class queruaction(object):
if ebuild_version_checksum_tree == build_dict['checksum']:
init_flags = gobs_use_flags(settings, portdb, cpv)
build_use_flags_list = init_flags.comper_useflags(build_dict)
- logging.info("build_use_flags_list %s", build_use_flags_list)
+ log_msg = "build_use_flags_list %s" % build_use_flags_list
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
manifest_error = init_manifest.check_file_in_manifest(portdb, cpv, build_dict, build_use_flags_list)
if manifest_error is None:
build_dict['check_fail'] = False
@@ -650,11 +664,13 @@ class queruaction(object):
for flags in build_use_flags_list:
build_use_flags = build_use_flags + flags + " "
filetext = '=' + k + ' ' + build_use_flags
- logging.info('filetext: %s', filetext)
+ log_msg = "filetext: %s" % filetext
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
with open("/etc/portage/package.use/gobs.use", "a") as f:
f.write(filetext)
f.write('\n')
- logging.info('build_cpv_list: %s', build_cpv_list)
+ log_msg = "build_cpv_list: %s" % build_cpv_list
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
argscmd = []
if not "nooneshort" in build_dict['post_message']:
argscmd.append("--oneshot")
@@ -662,11 +678,13 @@ class queruaction(object):
argscmd.append("--usepkg")
for build_cpv in build_cpv_list:
argscmd.append(build_cpv)
- logging.info("argscmd: %s", argscmd)
+ log_msg = "argscmd: %s" % argscmd
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
# Call main_emerge to build the package in build_cpv_list
build_fail = self.emerge_main(argscmd, build_dict)
# Run depclean
- logging.info('build_fail: %s', build_fail)
+ log_msg = "build_fail: %s" % build_fail
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
if not "noclean" in build_dict['post_message']:
depclean_fail = main_depclean()
try:
@@ -688,7 +706,8 @@ class queruaction(object):
if build_dict is None:
CM.putConnection(conn)
return
- logging.info("build_dict: %s", build_dict)
+ log_msg = "build_dict: %s" % build_dict
+ add_gobs_logs(conn, log_msg, "info", self._config_profile)
if not build_dict['ebuild_id'] is None and build_dict['checksum'] is not None:
buildqueru_cpv_dict = self.make_build_list(build_dict, settings, portdb)
logging.info('buildqueru_cpv_dict: %s', buildqueru_cpv_dict)
diff --git a/gobs/pym/buildquerydb.py b/gobs/pym/buildquerydb.py
index d383fbc..44f3373 100644
--- a/gobs/pym/buildquerydb.py
+++ b/gobs/pym/buildquerydb.py
@@ -5,12 +5,12 @@
import sys
import os
-import logging
# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
reader=get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
+config_profile = gobs_settings_dict['gobs_config']
# make a CM
from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
@@ -35,7 +35,8 @@ def add_cpv_query_pool(mysettings, init_package, config_id, package_line):
element = package_line.split('/')
categories = element[0]
package = element[1]
- logging.info("C %s/%s", categories, package) # C = Checking
+ log_msg = "C %s/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
pkgdir = mysettings['PORTDIR'] + "/" + categories + "/" + package
config_id_list = []
config_id_list.append(config_id)
@@ -54,16 +55,18 @@ def add_cpv_query_pool(mysettings, init_package, config_id, package_line):
if ebuild_id is not None:
ebuild_id_list.append(ebuild_id)
init_package.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
- logging.info("C %s/%s ... Done.", categories, package)
+ log_msg = "C %s/%s ... Done." % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
CM.putConnection(conn)
return
def add_buildquery_main(config_id):
conn=CM.getConnection()
- logging.info("Adding build querys for: %s", config_id)
- git_pull()
+ log_msg = "Adding build querys for: %s" % config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
check_make_conf()
- logging.info("Check configs done")
+ log_msg = "Check configs done"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Get default config from the configs table and default_config=1
default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
@@ -72,7 +75,8 @@ def add_buildquery_main(config_id):
init_package = gobs_package(mysettings, myportdb)
# get the cp list
package_list_tree = package_list_tree = myportdb.cp_all()
- logging.info("Setting default config to: %s", config_id)
+ log_msg = "Setting default config to: %s" % config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Use all exept 2 cores when multiprocessing
pool_cores= multiprocessing.cpu_count()
if pool_cores >= 3:
@@ -84,15 +88,18 @@ def add_buildquery_main(config_id):
pool.apply_async(add_cpv_query_pool, (mysettings, init_package, config_id, package_line,))
pool.close()
pool.join()
- logging.info("Adding build querys for: %s ... Done.", config_id)
+ log_msg = "Adding build querys for: %s ... Done." % config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return True
def del_buildquery_main(config_id):
- logging.info("Removeing build querys for: %s", config_id)
+ log_msg = "Removeing build querys for: %s" % config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
querue_id_list = get_queue_id_list_config(conn, config_id)
if querue_id_list is not None:
for querue_id in querue_id_list:
del_old_queue(conn, querue_id)
- logging.info("Removeing build querys for: %s ... Done.", config_id)
+ log_msg = "Removeing build querys for: %s ... Done." % config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
CM.putConnection(conn)
return True
diff --git a/gobs/pym/check_setup.py b/gobs/pym/check_setup.py
index 3a5b404..609b6f8 100644
--- a/gobs/pym/check_setup.py
+++ b/gobs/pym/check_setup.py
@@ -2,14 +2,13 @@ from __future__ import print_function
import portage
import os
import errno
-import logging
-from git import *
from gobs.text import get_file_text
from gobs.readconf import get_conf_settings
reader=get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
+config_profile = gobs_settings_dict['gobs_config']
# make a CM
from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
@@ -21,7 +20,8 @@ def check_make_conf():
# Get the config list
conn=CM.getConnection()
config_list_all = get_config_list_all(conn)
- logging.info("Checking configs for changes and errors")
+ log_msg = "Checking configs for changes and errors"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
configsDict = {}
for config_id in config_list_all:
attDict={}
@@ -41,11 +41,13 @@ def check_make_conf():
except Exception as e:
attDict['config_error'] = e
attDict['active'] = 'False'
- logging.info("%s FAIL!", config_id[0])
+ log_msg = "%s FAIL!" % config_id[0]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
attDict['config_error'] = ''
attDict['active'] = 'True'
- logging.info("%s PASS", config_id[0])
+ log_msg = "%s PASS" % config_id[0]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Get the checksum of make.conf
make_conf_checksum_tree = portage.checksum.sha256hash(make_conf_file)[0]
logging.info("make.conf checksum is %s on %s", make_conf_checksum_tree, config_id[0])
@@ -54,7 +56,8 @@ def check_make_conf():
configsDict[config_id[0]]=attDict
update__make_conf(conn, configsDict)
CM.putConnection(conn)
- logging.info("Checking configs for changes and errors ... Done")
+ log_msg = "Checking configs for changes and errors ... Done"
+ add_gobs_logs(conn, msg_log, "info", config_profile)
def check_make_conf_guest(config_profile):
conn=CM.getConnection()
diff --git a/gobs/pym/depgraph.py b/gobs/pym/depgraph.py
index 2d5f73c..7c46cde 100644
--- a/gobs/pym/depgraph.py
+++ b/gobs/pym/depgraph.py
@@ -3573,7 +3573,7 @@ class depgraph(object):
pkg = None
if self._dynamic_config._autounmask is True:
- reset_pkg(pkg)
+ pkg = None
for autounmask_level in self._autounmask_levels():
if pkg is not None:
@@ -3944,18 +3944,23 @@ class depgraph(object):
node = child
else:
satisfied = is_active(token)
+ stack[level].append(satisfied)
+ node._children.append(portage.dep._RequiredUseLeaf(token, satisfied))
+ print("satisfied:", satisfied)
if satisfied is False:
new_changes = {}
new_changes[token] = True
- if not pkg.use.mask.intersection(new_changes) or not \
- pkg.use.force.intersection(new_changes):
+ print("new_changes:", new_changes)
+ if pkg.use.mask.intersection(new_changes) or \
+ pkg.use.force.intersection(new_changes):
+ print("mask or force")
+ else:
+ print("new_changes2:", new_changes)
if token in pkg.use.enabled:
target_use[token] = False
elif not token in pkg.use.enabled:
- target_use[token] = True
-
- stack[level].append(satisfied)
- node._children.append(portage.dep._RequiredUseLeaf(token, satisfied))
+ target_use[token] = True
+ return target_use
if level != 0 or need_bracket:
raise InvalidDependString(
diff --git a/gobs/pym/jobs.py b/gobs/pym/jobs.py
index a49cae2..adea5a1 100644
--- a/gobs/pym/jobs.py
+++ b/gobs/pym/jobs.py
@@ -15,63 +15,77 @@ from gobs.sync import git_pull, sync_tree
from gobs.buildquerydb import add_buildquery_main, del_buildquery_main
from gobs.updatedb import update_db_main
-import logging
-
def jobs_main(config_profile):
conn = CM.getConnection()
job = check_job_list(conn, config_profile)
if job is None:
CM.putConnection(conn)
return
- logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_profile)
+ log_msg = "Job: %s Type: %s", % job[1], job[0]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
if job[0] == "addbuildquery":
update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is runing.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
result = add_buildquery_main(config_profile)
if result is True:
update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is done..", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ log_msg = "Job %s did fail.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
elif job[0] == "delbuildquery":
update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is runing.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
result = del_buildquery_main(config_profile)
if result is True:
update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is done..", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ log_msg = "Job %s did fail.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
elif job[0] == "gitsync":
update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is runing.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
result = git_pull()
if result is True:
update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is done..", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ log_msg = "Job %s did fail.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
elif job[0] == "emergesync":
update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is runing.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
result = sync_tree()
if result is True:
update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is done..", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ log_msg = "Job %s did fail.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
elif job[0] == "updatedb":
update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is runing.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
result = update_db_main()
if result is True:
update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ log_msg = "Job %s is done..", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ log_msg = "Job %s did fail.", % job[1]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return
\ No newline at end of file
diff --git a/gobs/pym/package.py b/gobs/pym/package.py
index 7487494..c646cdb 100644
--- a/gobs/pym/package.py
+++ b/gobs/pym/package.py
@@ -1,5 +1,4 @@
from __future__ import print_function
-import logging
import portage
from gobs.flags import gobs_use_flags
from gobs.repoman_gobs import gobs_repoman
@@ -10,6 +9,7 @@ from gobs.readconf import get_conf_settings
from gobs.flags import gobs_use_flags
reader=get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
+config_profile = gobs_settings_dict['gobs_config']
# make a CM
from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
@@ -89,7 +89,8 @@ class gobs_package(object):
# ebuild_version_metadata_tree and set ebuild_version_checksum_tree to 0
# so it can be updated next time we update the db
if ebuild_version_metadata_tree == []:
- logging.info(" QA: %s Have broken metadata", ebuild_line)
+ log_msg = " QA: %s Have broken metadata" % ebuild_line
+ add_gobs_logs(conn, log_msg, "info", config_profile)
ebuild_version_metadata_tree = ['','','','','','','','','','','','','','','','','','','','','','','','','']
ebuild_version_checksum_tree = ['0']
# add the ebuild to the dict packages
@@ -156,8 +157,10 @@ class gobs_package(object):
# Comper ebuild_version and add the ebuild_version to buildqueue
if portage.vercmp(v['ebuild_version_tree'], latest_ebuild_version) == 0:
add_new_package_buildqueue(conn,ebuild_id, config_id, use_flags_list, use_enable_list, message)
- logging.info("B %s/%s-%s USE: %s %s", v['categories'], v['package'], \
- latest_ebuild_version, use_enable, config_id) # B = Build cpv use-flags config
+ B = Build cpv use-flags config
+ log_msg = ("B %s/%s-%s USE: %s %s" % v['categories'] v['package'] \
+ latest_ebuild_version use_enable config_id
+ add_gobs_logs(conn, log_msg, "info", config_profile)
i = i +1
CM.putConnection(conn)
@@ -179,8 +182,12 @@ class gobs_package(object):
def add_new_package_db(self, categories, package):
conn=CM.getConnection()
# add new categories package ebuild to tables package and ebuilds
- logging.info("C %s/%s", categories, package) # C = Checking
- logging.info("N %s/%s", categories, package) # N = New Package
+ # C = Checking
+ # N = New Package
+ log_msg = ("C %s/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
+ log_msg = ("N %s/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
pkgdir = self._mysettings['PORTDIR'] + "/" + categories + "/" + package # Get PORTDIR + cp
categories_dir = self._mysettings['PORTDIR'] + "/" + categories + "/"
# Get the ebuild list for cp
@@ -209,7 +216,8 @@ class gobs_package(object):
manifest_error = init_manifest.digestcheck()
if manifest_error is not None:
qa_error.append(manifest_error)
- logging.info("QA: %s/%s %s", categories, package, qa_error)
+ log_msg = ("QA: %s/%s %s" % categories package qa_error
+ add_gobs_logs(conn, log_msg, "info", config_profile)
add_qa_repoman(conn,ebuild_id_list, qa_error, packageDict, config_id)
# Add the ebuild to the buildqueru table if needed
self.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
@@ -222,17 +230,21 @@ class gobs_package(object):
except:
manifest_checksum_tree = "0"
get_manifest_text = "0"
- logging.info("QA: Can't checksum the Manifest file. %c/%s", categories, package)
+ log_msg = "QA: Can't checksum the Manifest file. %c/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
get_manifest_text = get_file_text(pkgdir + "/Manifest")
add_new_manifest_sql(conn,package_id, get_manifest_text, manifest_checksum_tree)
CM.putConnection(conn)
- logging.info("C %s/%s ... Done.", categories, package)
+ log_msg = "C %s/%s ... Done." % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
def update_package_db(self, categories, package, package_id):
conn=CM.getConnection()
# Update the categories and package with new info
- logging.info("C %s/%s", categories, package) # C = Checking
+ # C = Checking
+ log_msg = "C %s/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
pkgdir = self._mysettings['PORTDIR'] + "/" + categories + "/" + package # Get PORTDIR with cp
# Get the checksum from the Manifest file.
try:
@@ -243,15 +255,19 @@ class gobs_package(object):
ebuild_list_tree = self._myportdb.cp_list((categories + "/" + package), use_cache=1, mytree=None)
if ebuild_list_tree == []:
CM.putConnection(conn)
- logging.info("QA: No Manifest file or ebuilds in %s/%s.", categories, package)
- logging.info("C %s/%s ... Done.", categories, package)
+ log_msg = "QA: No Manifest file or ebuilds in %s/%s." % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
+ log_msg = "C %s/%s ... Done." % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return
# Get the checksum from the db in package table
manifest_checksum_db = get_manifest_db(conn,package_id)
# if we have the same checksum return else update the package
ebuild_list_tree = self._myportdb.cp_list((categories + "/" + package), use_cache=1, mytree=None)
if manifest_checksum_tree != manifest_checksum_db:
- logging.info("U %s/%s", categories, package) # U = Update
+ # U = Update
+ log_msg = "U %s/%s" % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Get package_metadataDict and update the db with it
package_metadataDict = self.get_package_metadataDict(pkgdir, package)
update_new_package_metadata(conn,package_id, package_metadataDict)
@@ -272,9 +288,13 @@ class gobs_package(object):
# Get packageDict for ebuild
packageDict[ebuild_line] = self.get_packageDict(pkgdir, ebuild_line, categories, package, config_id)
if ebuild_version_manifest_checksum_db is None:
- logging.info("N %s/%s-%s", categories, package, ebuild_version_tree) # N = New ebuild
+ # N = New ebuild
+ log_msg = "N %s/%s-%s" % categories package ebuild_version_tree
+ add_gobs_logs(conn, log_msg, "info", config_profile)
else:
- logging.info("U %s/%s-%s", categories, package, ebuild_version_tree) # U = Updated ebuild
+ # U = Updated ebuild
+ log_msg = "U %s/%s-%s" % categories package ebuild_version_tree
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Fix so we can use add_new_package_sql(packageDict) to update the ebuilds
old_ebuild_list.append(ebuild_version_tree)
add_old_ebuild(conn,package_id, old_ebuild_list)
@@ -296,7 +316,8 @@ class gobs_package(object):
manifest_error = init_manifest.digestcheck()
if manifest_error is not None:
qa_error.append(manifest_error)
- logging.info("QA: %s/%s %s", categories, package, qa_error)
+ log_msg = "QA: %s/%s %s" % categories, package, qa_error
+ add_gobs_logs(conn, log_msg, "info", config_profile)
add_qa_repoman(conn,ebuild_id_list, qa_error, packageDict, config_id)
# Add the ebuild to the buildqueru table if needed
self.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
@@ -304,7 +325,8 @@ class gobs_package(object):
init_old_cpv = gobs_old_cpv(self._myportdb, self._mysettings)
init_old_cpv.mark_old_ebuild_db(categories, package, package_id)
CM.putConnection(conn)
- logging.info("C %s/%s ... Done.", categories, package)
+ log_msg = "C %s/%s ... Done." % categories package
+ add_gobs_logs(conn, log_msg, "info", config_profile)
def update_ebuild_db(self, build_dict):
conn=CM.getConnection()
diff --git a/gobs/pym/pgsql.py b/gobs/pym/pgsql.py
index 67451bb..be557d2 100644
--- a/gobs/pym/pgsql.py
+++ b/gobs/pym/pgsql.py
@@ -624,3 +624,10 @@ def update_job_list(connection, status, jobid):
sqlQ = 'UPDATE jobs_list SET status = %s WHERE jobnr = %s'
cursor.execute(sqlQ, (status, jobid,))
connection.commit()
+
+def add_gobs_logs(connection, log_msg, log_type, config):
+ cursor = connection.cursor()
+ sqlQ = 'INSERT INTO logs (host, type, msg, time) VALUES ( %s, %s, %s, now())'
+ cursor.execute(sqlQ, (config, log_type, log_msg))
+ connection.commit()
+
diff --git a/gobs/pym/sync.py b/gobs/pym/sync.py
index 0beeb22..953d379 100644
--- a/gobs/pym/sync.py
+++ b/gobs/pym/sync.py
@@ -2,7 +2,6 @@ from __future__ import print_function
import portage
import os
import errno
-import logging
import sys
from git import *
from _emerge.main import emerge_main
@@ -16,14 +15,19 @@ CM=connectionManager(gobs_settings_dict)
if CM.getName()=='pgsql':
from gobs.pgsql import *
+config_profile = gobs_settings_dict['gobs_config']
+
def git_pull():
- logging.info("Git pull")
+ log_msg = "Git pull"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
repo = Repo("/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/")
repo_remote = repo.remotes.origin
repo_remote.pull()
master = repo.head.reference
- logging.info("Git log: %s", master.log())
- logging.info("Git pull ... Done.")
+ log_msg = "Git log: %s" % master.log()
+ add_gobs_logs(conn, log_msg, "info", config_profile)
+ log_msg = "Git pull ... Done"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return True
def sync_tree():
@@ -36,10 +40,12 @@ def sync_tree():
tmpcmdline.append("--sync")
tmpcmdline.append("--quiet")
tmpcmdline.append("--config-root=" + default_config_root)
- logging.info("Emerge --sync")
+ log_msg = "Emerge --sync"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
fail_sync = emerge_main(args=tmpcmdline)
if fail_sync is True:
- logging.warning("Emerge --sync fail!")
+ log_msg = "Emerge --sync fail!"
+ add_gobs_logs(conn, log_msg, "warning", config_profile)
return False
else:
# Need to add a config dir so we can use profiles/base for reading the tree.
@@ -51,5 +57,6 @@ def sync_tree():
f.close()
except:
pass
- logging.info("Emerge --sync ... Done.")
+ log_msg = "Emerge --sync ... Done."
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return True
diff --git a/gobs/pym/updatedb.py b/gobs/pym/updatedb.py
index 91cb79f..b522c24 100755
--- a/gobs/pym/updatedb.py
+++ b/gobs/pym/updatedb.py
@@ -6,13 +6,12 @@ from __future__ import print_function
import sys
import os
import multiprocessing
-import logging
# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
reader = get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
-logfile = gobs_settings_dict['gobs_logfile']
+config_profile = gobs_settings_dict['gobs_config']
# make a CM
from gobs.ConnectionManager import connectionManager
@@ -41,25 +40,22 @@ def init_portage_settings():
@returns new settings
"""
# check config setup
- #git stuff
conn=CM.getConnection()
check_make_conf()
- logging.info("Check configs done")
+ log_msg = "Check configs done"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Get default config from the configs table and default_config=1
config_id = get_default_config(conn) # HostConfigDir = table configs id
CM.putConnection(conn);
default_config_root = "/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
mysettings = portage.config(config_root = default_config_root)
- logging.info("Setting default config to: %s", config_id[0])
+ log_msg = "Setting default config to: %s" % config_id[0]
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return mysettings
-def update_cpv_db_pool(mysettings, package_line):
+def update_cpv_db_pool(mysettings, myportdb, init_package, package_line):
conn=CM.getConnection()
- # Setup portdb, gobs_categories, gobs_old_cpv, package
- myportdb = portage.portdbapi(mysettings=mysettings)
- init_categories = gobs_categories(mysettings)
- init_package = gobs_package(mysettings, myportdb)
# split the cp to categories and package
element = package_line.split('/')
categories = element[0]
@@ -74,7 +70,9 @@ def update_cpv_db_pool(mysettings, package_line):
# Update the packages with ebuilds
init_package.update_package_db(categories, package, package_id)
# Update the metadata for categories
+ init_categories = gobs_categories(mysettings)
init_categories.update_categories_db(categories)
+ myportdb.close_caches()
CM.putConnection(conn)
def update_cpv_db():
@@ -87,9 +85,11 @@ def update_cpv_db():
@parms: config options from the config file
"""
mysettings = init_portage_settings()
- logging.info("Checking categories, package, ebuilds")
- # Setup portdb, gobs_categories, gobs_old_cpv, package
+ log_msg = "Checking categories, package, ebuilds"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
+ # Setup portdb, package
myportdb = portage.portdbapi(mysettings=mysettings)
+ init_package = gobs_package(mysettings, myportdb)
package_id_list_tree = []
# Will run some update checks and update package if needed
# Get categories/package list from portage
@@ -105,24 +105,27 @@ def update_cpv_db():
# a multiprocessing pool
for package_line in sorted(package_list_tree):
#update_cpv_db_pool(mysettings, package_line)
- # FIXME: Mem prob with the multiprocessing
- pool.apply_async(update_cpv_db_pool, (mysettings, package_line,))
+ pool.apply_async(update_cpv_db_pool, (mysettings, myportdb, init_package, package_line,))
pool.close()
pool.join()
- logging.info("Checking categories, package and ebuilds ... done")
+ log_msg = "Checking categories, package and ebuilds ... done"
+ add_gobs_logs(conn, log_msg, "info", config_profile)
def update_db_main():
# Main
# Logging
- logging.info("Update db started.")
+ log_msg = "Update db started."
+ add_gobs_logs(conn, log_msg, "info", config_profile)
# Sync portage and profile/settings
resutalt = git_pull()
if resutalt is False:
- logging.info("Update db ... Fail.")
+ log_msg = "Update db ... Fail."
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return False
resutalt = sync_tree()
if resutalt is False:
- logging.info("Update db ... Fail.")
+ log_msg = "Update db ... Fail."
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return False
# Init settings for the default config
mysettings = init_portage_settings()
@@ -130,5 +133,6 @@ def update_db_main():
init_arch.update_arch_db()
# Update the cpv db
update_cpv_db()
- logging.info("Update db ... Done.")
+ log_msg = "Update db ... Done."
+ add_gobs_logs(conn, log_msg, "info", config_profile)
return True
\ No newline at end of file
diff --git a/vlc-log.txt b/vlc-log.txt
new file mode 100644
index 0000000..2af0aac
--- /dev/null
+++ b/vlc-log.txt
@@ -0,0 +1,29 @@
+-- logger module started --
+main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
+qt4 error: cannot start Qt4 multiple times
+qt4 error: could not open device /dev/dvd
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+-- logger module started --
+main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
+qt4 error: cannot start Qt4 multiple times
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+-- logger module stopped --
+-- logger module started --
+main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
+qt4 error: cannot start Qt4 multiple times
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+qt4 error: Unable to load extensions module
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms)
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 6195 ms ignored)
+main error: ES_OUT_RESET_PCR called
+main error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 6313 ms ignored)
+main error: ES_OUT_RESET_PCR called
+-- logger module stopped --
|