1 |
slords |
1.1 |
diff -Nur plague-0.4.5.4-orig/server/BuildMaster.py plague-0.4.5.4/server/BuildMaster.py |
2 |
|
|
--- plague-0.4.5.4-orig/server/BuildMaster.py 2008-09-08 00:00:53.000000000 +0200 |
3 |
|
|
+++ plague-0.4.5.4/server/BuildMaster.py 2008-09-08 00:19:17.000000000 +0200 |
4 |
|
|
@@ -83,6 +83,9 @@ |
5 |
|
|
self._db_ping_interval = self._cfg.get_int('Database','ping_interval') |
6 |
|
|
self._db_ping_job = PeriodicJob(self._db_ping_interval,self._ping_db) |
7 |
|
|
|
8 |
|
|
+ self._cleanup_db_job = PeriodicJob(24*3600,self._cleanup_db) |
9 |
|
|
+ self._finish_signed_job = PeriodicJob(3600,self._finish_signed) |
10 |
|
|
+ |
11 |
|
|
threading.Thread.__init__(self) |
12 |
|
|
self.setName("BuildMaster") |
13 |
|
|
|
14 |
|
|
@@ -415,6 +418,28 @@ |
15 |
|
|
def is_paused(self): |
16 |
|
|
return self._paused |
17 |
|
|
|
18 |
|
|
+ def _cleanup_db(self): |
19 |
|
|
+ expiretime = int(time.time()-14*24*3600) |
20 |
|
|
+ print "DB cleanup: %d" % expiretime |
21 |
|
|
+ self._cursor.execute("DELETE FROM jobs WHERE (status='failed' OR status='finished') AND endtime<=%d" % expiretime) |
22 |
|
|
+ self._dbcx.commit() |
23 |
|
|
+ |
24 |
|
|
+ def _finish_signed(self): # only for Fedora Extras pushscript |
25 |
|
|
+ print "Checking needsign" |
26 |
|
|
+ self._cursor.execute("SELECT * FROM jobs WHERE status='needsign'") |
27 |
|
|
+ self._dbcx.commit() |
28 |
|
|
+ rows = self._dbcx.fetchall(self._cursor) |
29 |
|
|
+ for row in rows: |
30 |
|
|
+ uid = row['uid'] |
31 |
|
|
+ target = row['target_distro']+'-'+row['target_target']+'-'+row['target_repo'] |
32 |
|
|
+ (n,v,r) = (row['package'],row['rpm_version'],row['rpm_release']) |
33 |
|
|
+ pkgroot = os.path.join(self._repodir,target,n,'%s-%s'%(v,r)) |
34 |
|
|
+ if not os.path.exists(pkgroot) or \ |
35 |
|
|
+ os.path.exists(os.path.join(pkgroot,'PUSHED')): |
36 |
|
|
+ print pkgroot, 'PUSHED => mark as finished' |
37 |
|
|
+ self._cursor.execute("UPDATE jobs SET status='finished' WHERE uid=%d" % uid) |
38 |
|
|
+ self._dbcx.commit() |
39 |
|
|
+ |
40 |
|
|
def run(self): |
41 |
|
|
DebugUtils.registerThreadName(self) |
42 |
|
|
|
43 |
|
|
@@ -441,6 +466,9 @@ |
44 |
|
|
self._start_new_jobs() |
45 |
|
|
self._start_requeued_jobs() |
46 |
|
|
|
47 |
|
|
+ self._cleanup_db_job.run() |
48 |
|
|
+ self._finish_signed_job.run() |
49 |
|
|
+ |
50 |
|
|
last_time = time.time() |
51 |
|
|
while not self._have_work() and time.time() <= last_time + 5: |
52 |
|
|
time.sleep(0.25) |
53 |
|
|
diff -Nur plague-0.4.5.4-orig/server/UserInterface.py plague-0.4.5.4/server/UserInterface.py |
54 |
|
|
--- plague-0.4.5.4-orig/server/UserInterface.py 2008-09-07 19:02:30.000000000 +0200 |
55 |
|
|
+++ plague-0.4.5.4/server/UserInterface.py 2008-09-08 00:09:16.000000000 +0200 |
56 |
|
|
@@ -606,6 +606,7 @@ |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
def finish(self, uid_list): |
60 |
|
|
+ return (-1, "Feature disabled.") |
61 |
|
|
user = AuthedXMLRPCServer.get_authinfo() |
62 |
|
|
if not user or not user.own_jobs: |
63 |
|
|
return (-1, "Insufficient privileges.") |
64 |
|
|
diff -Nur plague-0.4.5.4-orig/www/success.psp plague-0.4.5.4/www/success.psp |
65 |
|
|
--- plague-0.4.5.4-orig/www/success.psp 2008-01-31 15:30:57.000000000 +0100 |
66 |
|
|
+++ plague-0.4.5.4/www/success.psp 2008-09-08 00:09:16.000000000 +0200 |
67 |
|
|
@@ -10,8 +10,8 @@ |
68 |
|
|
try: |
69 |
|
|
# show any jobs that have successfully built |
70 |
|
|
args = {} |
71 |
|
|
- args['status'] = ['add_to_repo', 'needsign', 'repowait', 'repodone'] |
72 |
|
|
- args['orderby'] = ['status', 'endtime desc'] |
73 |
|
|
+ args['status'] = ['add_to_repo', 'finished', 'repowait', 'needsign', 'repodone'] |
74 |
|
|
+ args['orderby'] = ['endtime desc'] |
75 |
|
|
args['maxrows'] = 100 |
76 |
|
|
(e, msg, jobs) = server.list_jobs(args) |
77 |
|
|
except socket.error, e: |