From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D7FD11381F3 for ; Sat, 1 Dec 2012 23:58:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5049FE04C8; Sat, 1 Dec 2012 23:58:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B6124E04C8 for ; Sat, 1 Dec 2012 23:58:10 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 92C8133D9CD for ; Sat, 1 Dec 2012 23:58:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3F62CE5436 for ; Sat, 1 Dec 2012 23:58:08 +0000 (UTC) From: "Magnus Granberg" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" Message-ID: <1354406274.b76f0d127571cc4a43a6ebe7b93e0ead2c356bcc.zorry@gentoo> Subject: [gentoo-commits] dev/zorry:master commit in: gobs/pym/ X-VCS-Repository: dev/zorry X-VCS-Files: gobs/pym/check_setup.py gobs/pym/pgsql_querys.py X-VCS-Directories: gobs/pym/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: b76f0d127571cc4a43a6ebe7b93e0ead2c356bcc X-VCS-Branch: master Date: Sat, 1 Dec 2012 23:58:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8eaf0c3e-46c5-4f3e-83cc-abde4a06dd22 X-Archives-Hash: d73e1d0b58782a0a2447818fe47e5549 commit: b76f0d127571cc4a43a6ebe7b93e0ead2c356bcc Author: Magnus Granberg gentoo org> AuthorDate: Sat Dec 1 23:57:54 2012 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Sat Dec 1 23:57:54 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=b76f0d12 fix check_make_conf --- gobs/pym/check_setup.py | 15 ++++++++------- gobs/pym/pgsql_querys.py | 11 +++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gobs/pym/check_setup.py b/gobs/pym/check_setup.py index 4d62909..b1a185c 100644 --- a/gobs/pym/check_setup.py +++ b/gobs/pym/check_setup.py @@ -19,14 +19,15 @@ if CM.getName()=='pgsql': def check_make_conf(): # Get the config list conn=CM.getConnection() - config_list_all = get_config_list_all(conn) + config_id_list_all = get_config_list_all(conn) 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: + for config_id in config_id_list_all: attDict={} # Set the config dir - check_config_dir = "/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/" + config = get_config(conn, config_id): + check_config_dir = "/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config + "/" make_conf_file = check_config_dir + "etc/portage/make.conf" # Check if we can open the file and close it # Check if we have some error in the file (portage.util.getconfig) @@ -41,20 +42,20 @@ def check_make_conf(): except Exception as e: attDict['config_error'] = e attDict['active'] = 'False' - log_msg = "%s FAIL!" % (config_id[0],) + log_msg = "%s FAIL!" % (config,) add_gobs_logs(conn, log_msg, "info", config_profile) else: attDict['config_error'] = '' attDict['active'] = 'True' - log_msg = "%s PASS" % (config_id[0],) + log_msg = "%s PASS" % (config,) 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] - log_msg = "make.conf checksum is %s on %s" % (make_conf_checksum_tree, config_id[0],) + log_msg = "make.conf checksum is %s on %s" % (make_conf_checksum_tree, config,) add_gobs_logs(conn, log_msg, "info", config_profile) attDict['make_conf_text'] = get_file_text(make_conf_file) attDict['make_conf_checksum_tree'] = make_conf_checksum_tree - configsDict[config_id[0]]=attDict + configsDict[config_id]=attDict update_make_conf(conn, configsDict) log_msg = "Checking configs for changes and errors ... Done" add_gobs_logs(conn, log_msg, "info", config_profile) diff --git a/gobs/pym/pgsql_querys.py b/gobs/pym/pgsql_querys.py index b74d18c..3c0813d 100644 --- a/gobs/pym/pgsql_querys.py +++ b/gobs/pym/pgsql_querys.py @@ -37,14 +37,21 @@ def update_job_list(connection, status, job_id): # Queryes to handel the configs* tables def get_config_list_all(connection): cursor = connection.cursor() - sqlQ = 'SELECT config FROM configs' + sqlQ = 'SELECT config_id FROM configs' cursor.execute(sqlQ) entries = cursor.fetchall() return entries +def get_config(connection, config_id): + cursor = connection.cursor() + sqlQ ='SELECT config FROM configs WHERE config_id = %s' + cursor.execute(sqlQ, (config_id,)) + config = cursor.fetchone() + return config[0] + def update_make_conf(connection, configsDict): cursor = connection.cursor() - sqlQ = 'UPDATE configs_metadata SET checksum = %s, make_conf_text = %s, active = %s, config_error = %s WHERE config_id = (SELECT config_id FROM configs WHERE config = %s)' + sqlQ = 'UPDATE configs_metadata SET checksum = %s, make_conf_text = %s, active = %s, config_error = %s WHERE config_id = %s' for k, v in configsDict.iteritems(): cursor.execute(sqlQ, (v['make_conf_checksum_tree'], v['make_conf_text'], v['active'], v['config_error'], k,)) connection.commit()