From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SNrmg-0005qH-NR for garchives@archives.gentoo.org; Fri, 27 Apr 2012 20:28:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2A5B2E06E8; Fri, 27 Apr 2012 20:28:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D8350E06E8 for ; Fri, 27 Apr 2012 20:28:46 +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 1F9631B4050 for ; Fri, 27 Apr 2012 20:28:46 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D41A6E542C for ; Fri, 27 Apr 2012 20:28:44 +0000 (UTC) From: "Magnus Granberg" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" Message-ID: <1335558513.bbacf008a21877846c3be1b4e56603cb37a5aa55.zorry@gentoo> Subject: [gentoo-commits] dev/zorry:master commit in: gobs/bin/ X-VCS-Repository: dev/zorry X-VCS-Files: gobs/bin/gobs_updatedb~ X-VCS-Directories: gobs/bin/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: bbacf008a21877846c3be1b4e56603cb37a5aa55 X-VCS-Branch: master Date: Fri, 27 Apr 2012 20:28:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: c964b0b3-5763-4e72-9a5b-b9d104f28e4c X-Archives-Hash: 7efb05e6ff72391487331cf2df343020 commit: bbacf008a21877846c3be1b4e56603cb37a5aa55 Author: Magnus Granberg gentoo org> AuthorDate: Fri Apr 27 20:28:33 2012 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Fri Apr 27 20:28:33 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Ddev/zorry.git;a=3D= commit;h=3Dbbacf008 testing logfile update part4 --- gobs/bin/gobs_updatedb~ | 128 -----------------------------------------= ------ 1 files changed, 0 insertions(+), 128 deletions(-) diff --git a/gobs/bin/gobs_updatedb~ b/gobs/bin/gobs_updatedb~ deleted file mode 100755 index 0e7d20c..0000000 --- a/gobs/bin/gobs_updatedb~ +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/python -# Copyright 2006-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -""" This code will update the sql backend with needed info for - the Frontend and the Guest deamon. """ - -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 =3D get_conf_settings() -gobs_settings_dict=3Dreader.read_gobs_settings_all() -logfile =3D gobs_settings_dict['gobs_logfile'] - -# make a CM -from gobs.ConnectionManager import connectionManager -CM=3DconnectionManager(gobs_settings_dict) -#selectively import the pgsql/mysql querys -if CM.getName()=3D=3D'pgsql': - from gobs.pgsql import * - -from gobs.check_setup import check_make_conf -from gobs.arch import gobs_arch -from gobs.package import gobs_package -from gobs.categories import gobs_categories -from gobs.old_cpv import gobs_old_cpv -from gobs.categories import gobs_categories -from gobs.sync import git_pull, sync_tree -import portage - -def init_portage_settings(): -=09 - """ Get the BASE Setup/Config for portage.settings - @type: module - @module: The SQL Backend - @type: dict - @parms: config options from the config file (host_setup_root) - @rtype: settings - @returns new settings - """ - # check config setup - #git stuff - conn=3DCM.getConnection() - check_make_conf() - write_msg_file("Check configs done", logfile) - # Get default config from the configs table and default_config=3D1 - config_id =3D get_default_config(conn) # HostConfigDir =3D table conf= igs id - CM.putConnection(conn); - default_config_root =3D "/var/lib/gobs/" + gobs_settings_dict['gobs_git= reponame'] + "/" + config_id[0] + "/" - # Set config_root (PORTAGE_CONFIGROOT) to default_config_root - mysettings =3D portage.config(config_root =3D default_config_root) - write_msg_file(("Setting default config to:" config_id[0]), logfile) - return mysettings - -def update_cpv_db_pool(mysettings, package_line): - conn=3DCM.getConnection() - # Setup portdb, gobs_categories, gobs_old_cpv, package - myportdb =3D portage.portdbapi(mysettings=3Dmysettings) - init_categories =3D gobs_categories(mysettings) - init_package =3D gobs_package(mysettings, myportdb) - # split the cp to categories and package - element =3D package_line.split('/') - categories =3D element[0] - package =3D element[1] =20 - # Check if we don't have the cp in the package table - package_id =3D have_package_db(conn,categories, package) - if package_id is None: =20 - # Add new package with ebuilds - init_package.add_new_package_db(categories, package) - # Ceck if we have the cp in the package table - elif package_id is not None: - # Update the packages with ebuilds - init_package.update_package_db(categories, package, package_id) - # Update the metadata for categories - init_categories.update_categories_db(categories) - CM.putConnection(conn) - =09 -def update_cpv_db(mysettings): - """Code to update the cpv in the database. - @type:settings - @parms: portage.settings - @type: module - @module: The SQL Backend - @type: dict - @parms: config options from the config file - """ - print "Checking categories, package, ebuilds" - # Setup portdb, gobs_categories, gobs_old_cpv, package - myportdb =3D portage.portdbapi(mysettings=3Dmysettings) - package_id_list_tree =3D [] - # Will run some update checks and update package if needed - # Get categories/package list from portage - package_list_tree =3D myportdb.cp_all() - # Use all exept 2 cores when multiprocessing - pool_cores=3D multiprocessing.cpu_count() - if pool_cores > "3": - use_pool_cores =3D pool_cores - 2 - else - use_pool_cores =3D 1 - pool =3D multiprocessing.Pool(processes=3Duse_pool_cores) - # Run the update package for all package in the list in - # a multiprocessing pool - for package_line in sorted(package_list_tree): - pool.apply_async(update_cpv_db_pool, (mysettings, package_line,)) - pool.close() - pool.join()=20 - print "Checking categories, package and ebuilds done" - -def main(): - # Main - # Logging - logging.basicConfig(filename=3Dgobs_settings_dict['gobs_logfile'], leve= l=3Dlogging.INFO) - # Init settings for the default config - git_pull - if sync_tree(): - mysettings =3D init_portage_settings() - init_arch =3D gobs_arch() - init_arch.update_arch_db() - # Update the cpv db - update_cpv_db(mysettings) - CM.closeAllConnections() -=09 -if __name__ =3D=3D "__main__": - main() \ No newline at end of file