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: Mon, 30 Apr 2012 12:08:48
Message-Id: 1335787533.bbae8b8f038b93563a7bfc5dec8f2adc6db65edd.zorry@gentoo
1 commit: bbae8b8f038b93563a7bfc5dec8f2adc6db65edd
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Mon Apr 30 12:05:33 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Mon Apr 30 12:05:33 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=bbae8b8f
7
8 adding git pull and emerge sync
9
10 ---
11 gobs/bin/gobs_guest_jobs | 22 +++++++++++++++++++++-
12 gobs/bin/gobs_host_jobs | 22 +++++++++++++++++++++-
13 gobs/pym/sync.py | 5 +++--
14 3 files changed, 45 insertions(+), 4 deletions(-)
15
16 diff --git a/gobs/bin/gobs_guest_jobs b/gobs/bin/gobs_guest_jobs
17 index 2c497d6..43b8cc1 100755
18 --- a/gobs/bin/gobs_guest_jobs
19 +++ b/gobs/bin/gobs_guest_jobs
20 @@ -13,7 +13,7 @@ if CM.getName()=='pgsql':
21 from gobs.pgsql import *
22
23 from gobs.check_setup import check_configure_guest
24 -from gobs.sync import git_pull
25 +from gobs.sync import git_pull, sync_tree
26 from gobs.build_queru import queruaction
27 from gobs.buildquerydb import add_buildquery_main, del_buildquery_main
28
29 @@ -62,6 +62,26 @@ def main_loop(config_profile):
30 else:
31 update_job_list(conn, "Fail", job[1])
32 logging.info("Job %s did fail. Config: %s", job[0], config_profile)
33 + elif job[0] == "gitsync":
34 + update_job_list(conn, "Runing", job[1])
35 + logging.info("Job %s is runing. Config: %s", job[0], config_profile)
36 + result = git_pull()
37 + if result is True:
38 + update_job_list(conn, "Done", job[1])
39 + logging.info("Job %s is done. Config: %s", job[0], config_profile)
40 + else:
41 + update_job_list(conn, "Fail", job[1])
42 + logging.info("Job %s did fail. Config: %s", job[0], config_profile)
43 + elif job[0] == "emergesync":
44 + update_job_list(conn, "Runing", job[1])
45 + logging.info("Job %s is runing. Config: %s", job[0], config_profile)
46 + result = sync_tree()
47 + if result is True:
48 + update_job_list(conn, "Done", job[1])
49 + logging.info("Job %s is done. Config: %s", job[0], config_profile)
50 + else:
51 + update_job_list(conn, "Fail", job[1])
52 + logging.info("Job %s did fail. Config: %s", job[0], config_profile)
53 repeat = False
54 time.sleep(10)
55 CM.putConnection(conn)
56
57 diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
58 index 812b942..ea39f3b 100755
59 --- a/gobs/bin/gobs_host_jobs
60 +++ b/gobs/bin/gobs_host_jobs
61 @@ -6,7 +6,7 @@ from __future__ import print_function
62
63 from gobs.readconf import get_conf_settings
64 from gobs.updatedb import update_db_main
65 -from gobs.buildquerydb import add_buildquery_main, del_buildquery_main
66 +from gobs.sync import git_pull, sync_tree
67
68 reader = get_conf_settings()
69 gobs_settings_dict=reader.read_gobs_settings_all()
70 @@ -49,6 +49,26 @@ def main():
71 else:
72 update_job_list(conn, "Fail", job[1])
73 logging.info("Job %s did fail. Config: %s", job[0], config_profile)
74 + elif job[0] == "gitsync":
75 + update_job_list(conn, "Runing", job[1])
76 + logging.info("Job %s is runing. Config: %s", job[0], config_profile)
77 + result = git_pull()
78 + if result is True:
79 + update_job_list(conn, "Done", job[1])
80 + logging.info("Job %s is done. Config: %s", job[0], config_profile)
81 + else:
82 + update_job_list(conn, "Fail", job[1])
83 + logging.info("Job %s did fail. Config: %s", job[0], config_profile)
84 + elif job[0] == "emergesync":
85 + update_job_list(conn, "Runing", job[1])
86 + logging.info("Job %s is runing. Config: %s", job[0], config_profile)
87 + result = sync_tree()
88 + if result is True:
89 + update_job_list(conn, "Done", job[1])
90 + logging.info("Job %s is done. Config: %s", job[0], config_profile)
91 + else:
92 + update_job_list(conn, "Fail", job[1])
93 + logging.info("Job %s did fail. Config: %s", job[0], config_profile)
94 repeat = False
95 CM.putConnection(conn)
96 time.sleep(60)
97
98 diff --git a/gobs/pym/sync.py b/gobs/pym/sync.py
99 index a39ff4d..ee4bd66 100644
100 --- a/gobs/pym/sync.py
101 +++ b/gobs/pym/sync.py
102 @@ -18,12 +18,13 @@ if CM.getName()=='pgsql':
103
104 def git_pull():
105 logging.info("Git pull")
106 - repo = Repo("/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/")
107 + repo = Repo("/var/cache/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/")
108 repo_remote = repo.remotes.origin
109 repo_remote.pull()
110 master = repo.head.reference
111 - print(master.log())
112 + logging.info("Git log: %s", master.log())
113 logging.info("Git pull ... Done.")
114 + return True
115
116 def sync_tree():
117 conn=CM.getConnection()