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 1SQyuZ-000754-Pw for garchives@archives.gentoo.org; Sun, 06 May 2012 10:41:56 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 26E5EE06C8; Sun, 6 May 2012 10:41:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D90A7E06C8 for ; Sun, 6 May 2012 10:41:47 +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 1C5CA1B405C for ; Sun, 6 May 2012 10:41:47 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D2440E5402 for ; Sun, 6 May 2012 10:41:45 +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: <1336300889.6d495fec6d0268d1eb7b793d0c26af6947b0f6e9.zorry@gentoo> Subject: [gentoo-commits] dev/zorry:master commit in: gobs/bin/, gobs/pym/ X-VCS-Repository: dev/zorry X-VCS-Files: gobs/bin/gobs_guest_jobs gobs/bin/gobs_host_jobs gobs/pym/depclean.py gobs/pym/jobs.py X-VCS-Directories: gobs/bin/ gobs/pym/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: 6d495fec6d0268d1eb7b793d0c26af6947b0f6e9 X-VCS-Branch: master Date: Sun, 6 May 2012 10:41:45 +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: 39e521bd-b006-47e5-a7fa-4dfcea0b2d00 X-Archives-Hash: 6351088140029997321e2ad0e1c6513a commit: 6d495fec6d0268d1eb7b793d0c26af6947b0f6e9 Author: Magnus Granberg gentoo org> AuthorDate: Sun May 6 10:41:29 2012 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Sun May 6 10:41:29 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Ddev/zorry.git;a=3D= commit;h=3D6d495fec move the jobs to jobs.py --- gobs/bin/gobs_guest_jobs | 67 ++++++---------------------------------- gobs/bin/gobs_host_jobs | 46 ++------------------------- gobs/pym/depclean.py | 12 +++++++ gobs/pym/jobs.py | 77 ++++++++++++++++++++++++++++++++++++++++= ++++++ 4 files changed, 102 insertions(+), 100 deletions(-) diff --git a/gobs/bin/gobs_guest_jobs b/gobs/bin/gobs_guest_jobs index 7c1fdeb..59c9da8 100755 --- a/gobs/bin/gobs_guest_jobs +++ b/gobs/bin/gobs_guest_jobs @@ -13,9 +13,8 @@ if CM.getName()=3D=3D'pgsql': from gobs.pgsql import * =20 from gobs.check_setup import check_configure_guest -from gobs.sync import git_pull, sync_tree from gobs.build_queru import queruaction -from gobs.buildquerydb import add_buildquery_main, del_buildquery_main +from gobs.jobs import jobs_main =20 import portage import sys @@ -28,64 +27,18 @@ def main_loop(config_profile): repeat =3D True logging.info("Job and build deamon started.") while repeat: - conn =3D CM.getConnection() - job =3D check_job_list(conn, config_profile) - if job is None: - CM.putConnection(conn) - if check_configure_guest(config_profile) is not True: - time.sleep(60) - continue - else: - init_queru =3D queruaction(config_profile) - p =3D Process(target=3Dinit_queru.procces_qureru) - p.start() - p.join() - continue + jobs_main(config_profile) + if check_configure_guest(config_profile) is not True: + time.sleep(60) + continue else: - logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_pr= ofile) - if job[0] =3D=3D "addbuildquery": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile) - elif job[0] =3D=3D "delbuildquery": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile) - elif job[0] =3D=3D "gitsync": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile) - elif job[0] =3D=3D "emergesync": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile)= =09 + init_queru =3D queruaction(config_profile) + p =3D Process(target=3Dinit_queru.procces_qureru) + p.start() + p.join() + continue =09 repeat =3D False time.sleep(60) - CM.putConnection(conn) return =20 def main(): diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs index ea39f3b..ba309b5 100755 --- a/gobs/bin/gobs_host_jobs +++ b/gobs/bin/gobs_host_jobs @@ -5,8 +5,7 @@ from __future__ import print_function =20 from gobs.readconf import get_conf_settings -from gobs.updatedb import update_db_main -from gobs.sync import git_pull, sync_tree +from gobs.jobs import jobs_main =20 reader =3D get_conf_settings() gobs_settings_dict=3Dreader.read_gobs_settings_all() @@ -30,47 +29,8 @@ def main(): repeat =3D True logging.info("Job deamon started.") while repeat: - conn =3D CM.getConnection() - job =3D check_job_list(conn, config_profile) - =09 - if job is None: - time.sleep(60) - CM.putConnection(conn) - continue - else: - logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_pr= ofile) - if job[0] =3D=3D "updatedb": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile) - elif job[0] =3D=3D "gitsync": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile) - elif job[0] =3D=3D "emergesync": - update_job_list(conn, "Runing", job[1]) - logging.info("Job %s is runing. Config: %s", job[0], config_profile= ) - result =3D 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) - else: - update_job_list(conn, "Fail", job[1]) - logging.info("Job %s did fail. Config: %s", job[0], config_profile= ) =09 - repeat =3D False - CM.putConnection(conn) + jobs_main(config_profile) + repeat =3D False time.sleep(60) CM.closeAllConnections() =20 diff --git a/gobs/pym/depclean.py b/gobs/pym/depclean.py index b6096b6..6173c20 100644 --- a/gobs/pym/depclean.py +++ b/gobs/pym/depclean.py @@ -1,5 +1,6 @@ from __future__ import print_function import errno +import logging import portage from portage._sets.base import InternalPackageSet from _emerge.main import parse_opts @@ -55,6 +56,17 @@ def main_depclean(): unmerge(root_config, myopts, "unmerge", cleanlist, mtimedb["ldpath"],= ordered=3Dordered, scheduler=3Dscheduler) print("Number removed: "+str(len(cleanlist))) return True + else: + logging.info("conflicting packages: %s", conflict_package_list) + tmpcmdline =3D [] + tmpcmdline.append("--depclean") + tmpcmdline.append("--exclude") + for conflict_package in conflict_package_list: + tmpcmdline.append(portage.versions.pkg_cp(conflict_package) + myaction, myopts, myfiles =3D parse_opts(tmpcmdline, silent=3DFalse) + unmerge(root_config, myopts, "unmerge", cleanlist, mtimedb["ldpath"],= ordered=3Dordered, scheduler=3Dscheduler) + print("Number removed: "+str(len(cleanlist))) + return True return True =20 def calc_depclean(settings, trees, ldpath_mtimes, diff --git a/gobs/pym/jobs.py b/gobs/pym/jobs.py new file mode 100644 index 0000000..a49cae2 --- /dev/null +++ b/gobs/pym/jobs.py @@ -0,0 +1,77 @@ +from __future__ import print_function + +# Get the options from the config file set in gobs.readconf +from gobs.readconf import get_conf_settings +reader=3Dget_conf_settings() +gobs_settings_dict=3Dreader.read_gobs_settings_all() + +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.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 =3D CM.getConnection() + job =3D 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_prof= ile) + if job[0] =3D=3D "addbuildquery": + update_job_list(conn, "Runing", job[1]) + logging.info("Job %s is runing. Config: %s", job[0], config_profile) + result =3D 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) + else: + update_job_list(conn, "Fail", job[1]) + logging.info("Job %s did fail. Config: %s", job[0], config_profile) + elif job[0] =3D=3D "delbuildquery": + update_job_list(conn, "Runing", job[1]) + logging.info("Job %s is runing. Config: %s", job[0], config_profile) + result =3D 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) + else: + update_job_list(conn, "Fail", job[1]) + logging.info("Job %s did fail. Config: %s", job[0], config_profile) + elif job[0] =3D=3D "gitsync": + update_job_list(conn, "Runing", job[1]) + logging.info("Job %s is runing. Config: %s", job[0], config_profile) + result =3D 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) + else: + update_job_list(conn, "Fail", job[1]) + logging.info("Job %s did fail. Config: %s", job[0], config_profile) + elif job[0] =3D=3D "emergesync": + update_job_list(conn, "Runing", job[1]) + logging.info("Job %s is runing. Config: %s", job[0], config_profile) + result =3D 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) + else: + update_job_list(conn, "Fail", job[1]) + logging.info("Job %s did fail. Config: %s", job[0], config_profile) + elif job[0] =3D=3D "updatedb": + update_job_list(conn, "Runing", job[1]) + logging.info("Job %s is runing. Config: %s", job[0], config_profile) + result =3D 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) + else: + update_job_list(conn, "Fail", job[1]) + logging.info("Job %s did fail. Config: %s", job[0], config_profile) + return \ No newline at end of file