示例#1
0
def store_binary_request(r):
    new_b = []
    for b in r.batches:
        if not b.build_failed: new_b.append(b)
    if new_b == []:
        return
    r.batches = new_b
    # store new queue and max_req_no for binary builders
    num = int(string.strip(open(path.max_req_no_file, "r").read())) + 1

    r.no = num
    q = B_Queue(path.req_queue_file)
    q.lock(0)
    q.read()
    q.add(r)
    q.write()
    q.dump(path.queue_stats_file)
    q.dump_html(path.queue_html_stats_file)
    q.write_signed(path.req_queue_signed_file)
    q.unlock()

    (fdno,
     tmpfname) = tempfile.mkstemp(dir=os.path.dirname(path.max_req_no_file))
    cnt_f = os.fdopen(fdno, "w")
    cnt_f.seek(0)
    cnt_f.write("%d\n" % num)
    cnt_f.flush()
    os.fsync(cnt_f.fileno())
    cnt_f.close()
    os.chmod(tmpfname, 0644)
    os.rename(tmpfname, path.max_req_no_file)
示例#2
0
def handle_notification(r, user):
    if not user.can_do("notify", r.builder):
        log.alert("user %s is not allowed to notify:%s" %
                  (user.login, r.builder))
    q = B_Queue(path.req_queue_file)
    q.lock(0)
    q.read()
    not_fin = filter(lambda (r): not r.is_done(), q.requests)
    r.apply_to(q)
    for r in not_fin:
        if r.is_done():
            util.clean_tmp(path.srpms_dir + '/' + r.id)
    now = time.time()

    def leave_it(r):
        # for ,,done'' set timeout to 4d
        if r.is_done() and r.time + 4 * 24 * 60 * 60 < now:
            return False
        # and for not ,,done'' set it to 20d
        if r.time + 20 * 24 * 60 * 60 < now:
            util.clean_tmp(path.srpms_dir + '/' + r.id)
            return False
        return True

    q.requests = filter(leave_it, q.requests)
    q.write()
    q.dump(path.queue_stats_file)
    q.dump_html(path.queue_html_stats_file)
    q.write_signed(path.req_queue_signed_file)
    q.unlock()
示例#3
0
def store_binary_request(r):
    new_b = []
    for b in r.batches:
        if not b.build_failed: new_b.append(b)
    if new_b == []:
        return
    r.batches = new_b
    # store new queue and max_req_no for binary builders
    num = int(string.strip(open(path.max_req_no_file, "r").read())) + 1

    r.no = num
    q = B_Queue(path.req_queue_file)
    q.lock(0)
    q.read()
    q.add(r)
    q.write()
    q.dump(path.queue_stats_file)
    q.dump_html(path.queue_html_stats_file)
    q.write_signed(path.req_queue_signed_file)
    q.unlock()

    (fdno, tmpfname) = tempfile.mkstemp(dir=os.path.dirname(path.max_req_no_file))
    cnt_f = os.fdopen(fdno, "w")
    cnt_f.seek(0)
    cnt_f.write("%d\n" % num)
    cnt_f.flush()
    os.fsync(cnt_f.fileno())
    cnt_f.close()
    os.chmod(tmpfname, 0644)
    os.rename(tmpfname, path.max_req_no_file)
def handle_notification(r, user):
    if not user.can_do("notify", r.builder):
        log.alert("user %s is not allowed to notify:%s" % (user.login, r.builder))
    q = B_Queue(path.req_queue_file)
    q.lock(0)
    q.read()
    not_fin = filter(lambda (r): not r.is_done(), q.requests)
    r.apply_to(q)
    for r in not_fin:
        if r.is_done():
            util.clean_tmp(path.srpms_dir + '/' + r.id)
    now = time.time()
    def leave_it(r):
        # for ,,done'' set timeout to 4d
        if r.is_done() and r.time + 4 * 24 * 60 * 60 < now:
            return False
        # and for not ,,done'' set it to 20d
        if r.time + 20 * 24 * 60 * 60 < now:
            util.clean_tmp(path.srpms_dir + '/' + r.id)
            return False
        return True
    q.requests = filter(leave_it, q.requests)
    q.write()
    q.dump(path.queue_stats_file)
    q.dump_html(path.queue_html_stats_file)
    q.write_signed(path.req_queue_signed_file)
    q.unlock()