1 |
slords |
1.1 |
diff -Nur plague-0.4.4.1-orig/server/BuildMaster.py plague-0.4.4.1/server/BuildMaster.py |
2 |
|
|
--- plague-0.4.4.1-orig/server/BuildMaster.py 2005-11-29 07:16:52.000000000 +0100 |
3 |
|
|
+++ plague-0.4.4.1/server/BuildMaster.py 2008-01-03 19:49:49.000000000 +0100 |
4 |
|
|
@@ -65,6 +65,10 @@ |
5 |
|
|
self._building_jobs = {} |
6 |
|
|
self._building_jobs_lock = threading.Lock() |
7 |
|
|
|
8 |
|
|
+ self._next_db_cleanup = time.time() |
9 |
|
|
+ self._next_finish_check = time.time()+3600 |
10 |
|
|
+ self._repodir = repodir |
11 |
|
|
+ |
12 |
|
|
self._dbcx = self._db_manager.dbcx() |
13 |
|
|
self._cursor = self._dbcx.cursor() |
14 |
|
|
|
15 |
|
|
@@ -392,6 +399,28 @@ |
16 |
|
|
def is_paused(self): |
17 |
|
|
return self._paused |
18 |
|
|
|
19 |
|
|
+ def _cleanup_db(self): |
20 |
|
|
+ expiretime = int(time.time()-14*24*3600) |
21 |
|
|
+ print "DB cleanup: %d" % expiretime |
22 |
|
|
+ self._cursor.execute("DELETE FROM jobs WHERE (status='failed' OR status='finished') AND endtime<=%d" % expiretime) |
23 |
|
|
+ self._dbcx.commit() |
24 |
|
|
+ |
25 |
|
|
+ def _finish_signed(self): # only for Fedora Extras pushscript |
26 |
|
|
+ print "Checking needsign" |
27 |
|
|
+ self._cursor.execute("SELECT * FROM jobs WHERE status='needsign'") |
28 |
|
|
+ self._dbcx.commit() |
29 |
|
|
+ rows = self._dbcx.fetchall(self._cursor) |
30 |
|
|
+ for row in rows: |
31 |
|
|
+ uid = row['uid'] |
32 |
|
|
+ target = row['target_distro']+'-'+row['target_target']+'-'+row['target_repo'] |
33 |
|
|
+ (n,v,r) = (row['package'],row['version'],row['release']) |
34 |
|
|
+ pkgroot = os.path.join(self._repodir,target,n,'%s-%s'%(v,r)) |
35 |
|
|
+ if not os.path.exists(pkgroot) or \ |
36 |
|
|
+ os.path.exists(os.path.join(pkgroot,'PUSHED')): |
37 |
|
|
+ print pkgroot, 'PUSHED => mark as finished' |
38 |
|
|
+ self._cursor.execute("UPDATE jobs SET status='finished' WHERE uid=%d" % uid) |
39 |
|
|
+ self._dbcx.commit() |
40 |
|
|
+ |
41 |
|
|
def run(self): |
42 |
|
|
DebugUtils.registerThreadName(self) |
43 |
|
|
while self.should_stop == False: |
44 |
|
|
@@ -412,7 +441,15 @@ |
45 |
|
|
self._start_new_jobs() |
46 |
|
|
self._start_requeued_jobs() |
47 |
|
|
|
48 |
|
|
+ if time.time() > self._next_db_cleanup: |
49 |
|
|
+ self._next_db_cleanup = time.time()+24*3600; |
50 |
|
|
+ self._cleanup_db() |
51 |
|
|
+ # Only for Fedora Extras pushscript. |
52 |
|
|
+ if time.time() > self._next_finish_check: |
53 |
|
|
+ self._next_finish_check = time.time()+3600; |
54 |
|
|
+ self._finish_signed() |
55 |
|
|
+ |
56 |
|
|
last_time = time.time() |
57 |
|
|
while not self._have_work() and time.time() <= last_time + 5: |
58 |
|
|
time.sleep(0.25) |
59 |
|
|
|
60 |
|
|
diff -Nur plague-0.4.4.1-orig/server/UserInterface.py plague-0.4.4.1/server/UserInterface.py |
61 |
|
|
--- plague-0.4.4.1-orig/server/UserInterface.py 2005-11-28 18:46:21.000000000 +0100 |
62 |
|
|
+++ plague-0.4.4.1/server/UserInterface.py 2008-01-03 19:50:55.000000000 +0100 |
63 |
|
|
@@ -607,6 +607,7 @@ |
64 |
|
|
|
65 |
|
|
|
66 |
|
|
def finish(self, uid_list): |
67 |
|
|
+ return (-1, "Feature disabled.") |
68 |
|
|
user = AuthedXMLRPCServer.get_authinfo() |
69 |
|
|
if not user or not user.own_jobs: |
70 |
|
|
return (-1, "Insufficient privileges.") |
71 |
|
|
diff -Nur plague-0.4.4.1-orig/www/success.psp plague-0.4.4.1/www/success.psp |
72 |
|
|
--- plague-0.4.4.1-patched/www/success.psp 2005-08-31 21:31:00.000000000 +0200 |
73 |
|
|
+++ plague-0.4.4.1/www/success.psp 2008-01-05 06:16:22.000000000 +0100 |
74 |
|
|
@@ -10,8 +10,8 @@ |
75 |
|
|
try: |
76 |
|
|
# show any jobs that have successfully built |
77 |
|
|
args = {} |
78 |
|
|
- args['status'] = ['add_to_repo', 'needsign', 'repowait', 'repodone'] |
79 |
|
|
- args['orderby'] = ['status', 'endtime desc'] |
80 |
|
|
+ args['status'] = ['add_to_repo', 'finished', 'repowait', 'needsign', 'repodone'] |
81 |
|
|
+ args['orderby'] = ['endtime desc'] |
82 |
|
|
args['maxrows'] = 100 |
83 |
|
|
(e, msg, jobs) = server.list_jobs(args) |
84 |
|
|
except socket.error, e: |