]> git.pld-linux.org Git - projects/pld-builder.new.git/commitdiff
- work in progress...; sleep
authorMichal Moskal <michal@moskal.me>
Mon, 9 Jun 2003 00:55:58 +0000 (00:55 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    PLD_Builder/acl.py -> 1.2
    PLD_Builder/path.py -> 1.2
    PLD_Builder/request.py -> 1.6
    PLD_Builder/srpm_builder.py -> 1.1
    admin/fresh-queue.sh -> 1.2

PLD_Builder/acl.py
PLD_Builder/path.py
PLD_Builder/request.py
PLD_Builder/srpm_builder.py [new file with mode: 0644]
admin/fresh-queue.sh

index da799fb3c8055700dd4da1ff0dd3eef498ea1298..988860cb30c3d8d2dce0e3662a90af9855f88a77 100644 (file)
@@ -57,6 +57,7 @@ class ACL_Conf:
       user = User(p, login)
       for e in user.emails:
         self.users[e] = user
+      self.users[login] = user
   
   def user(self, ems):
     for e in ems:
index 9c1d1c00ce38b650a8c0d816b525e031855ad5fc..63ee05c58891892425a830760956fdda986f0c03 100644 (file)
@@ -10,3 +10,4 @@ acl_conf = conf_dir + "acl.conf"
 queue_file = spool_dir + "queue"
 processed_ids_file = spool_dir + "processed_ids"
 counter_file = spool_dir + "counter"
+srpms_dir = spool_dir + "srpms/"
index 7c6487e3c456d4b2fc8aa71d095f1cc574f22838..ef5c15209ef46df16ec3020ef569c3b89536295b 100644 (file)
@@ -101,10 +101,17 @@ class Batch:
     print "  batch: %s/%s" % (self.src_rpm, self.spec)
     print "    info: %s" % self.info
     print "    branch: %s" % self.branch
-    print "    with: %s" % string.join(self.bconds_with)
-    print "    without: %s" % string.join(self.bconds_without)
+    print "    bconds: %s" % self.bconds_string()
     print "    for: %s" % string.join(self.builders)
 
+  def bconds_string(self):
+    r = ""
+    for b in self.bconds_with:
+      r = r + " --with " + b
+    for b in self.bconds_without:
+      r = r + " --without " + b
+    return r
+    
   def write_to(self, f):
     f.write("""
          <batch>
diff --git a/PLD_Builder/srpm_builder.py b/PLD_Builder/srpm_builder.py
new file mode 100644 (file)
index 0000000..033c200
--- /dev/null
@@ -0,0 +1,63 @@
+import email
+import string
+import time
+import os
+import StringIO
+import sys
+
+import gpg
+import request
+import log
+import path
+from acl import acl
+from lock import lock
+from bqueue import B_Queue
+
+import chroot # needs to be fixed
+
+def pick_request(q):
+  def mycmp(r1, r2):
+    if r1.kind != 'group' or r2.kind != 'group':
+      raise "non-group requests"
+    pri_diff = cmp(r1.priority, r2.priority)
+    if pri_diff == 0:
+      return cmp(r1.time, r2.time)
+    else:
+      return pri_diff
+  q.batches.sort(mycmp)
+  ret = q.batches[0]
+  q.batches = q.batches[1:]
+  return ret
+
+
+def handle_request(r):
+  def build_srpm(b):
+    builder_opts = "-nu --clean"
+    f = chroot.popen("cd rpm/SPECS; ./builder %s -bs %s -r %s %s 2>&1" % \
+                 (build_opts, b.bconds_string(), b.branch, b.spec))
+    log = StringIO.StringIO()
+    log.write(f.read())
+    res = f.close()
+    log.seek(0)
+    files = []
+    for l in log.readlines():
+      re.search(r"^Wrote: (/home.*\.rpm)")
+      #finish me
+
+
+  user = acl.user(r.requester)
+  log.notice("started processing %s" % r.id)
+  os.mkdir(path.srpms_dir + r.id)
+  
+def main():
+  lock("building-srpm")
+  q = B_Queue(path.queue_file)
+  if not q.lock(1): return
+  q.read()
+  if q.batches == []: return
+  r = pick_request(q)
+  q.write()
+  q.unlock()
+  handle_request(r)
+
+main()
index 808053fea2d76efa2e3e00ddcbce558f9bd7a1a2..4a47628901dc33e459a0039409e97c853e5792a9 100755 (executable)
@@ -6,7 +6,7 @@ if [ "$1" != "y" ] ; then
   exit 1
 fi
 
-mkdir -p spool log lock
+mkdir -p spool/srpms log lock
 echo 1 > spool/counter
 echo -n > spool/processed_ids
 echo '<queue/>' > spool/queue
This page took 0.086977 seconds and 4 git commands to generate.