Пример #1
0
def build_pkg_now():
    """


    :return:
    """
    if request.method == 'POST':
        pkgname = request.form['pkgname']
        dev = request.form['dev']
        if not pkgname or pkgname is None or pkgname == '':
            abort(500)
        pexists = status.all_packages
        pexists = pexists.ismember(pkgname)
        if not pexists:
            try:
                package.Package(name=pkgname)
                if os.path.exists('/var/tmp/antergos-packages/' + pkgname) or 'antergos-iso' in pkgname:
                    pexists = True
            except Exception:
                pass

        if pexists:
            is_logged_in = user.is_authenticated()
            p, a, rev_pending = get_build_info(1, 'completed', is_logged_in)
            # logger.info(rev_pending)
            pending = False
            for bnum in rev_pending.keys():
                bld_obj = build_obj.get_build_object(bnum=bnum)
                if pkgname == bld_obj.pkgname:
                    pending = True
                    break

            if pending:
                flash('Unable to build %s because it is in "pending review" status.' % pkgname, category='error')
            else:
                if '-x86_64' in pkgname or '-i686' in pkgname:
                    if not status.iso_building:
                        status.iso_flag = True
                        if 'minimal' in pkgname:
                            status.iso_minimal = True
                        else:
                            status.iso_minimal = False
                    else:
                        logger.info('RATE LIMIT ON ANTERGOS ISO IN EFFECT')
                        return redirect(redirect_url())

                q = status.hook_queue
                q.rpush(pkgname)
                hook_queue.enqueue_call(builder.handle_hook, timeout=84600)
                tl_event(
                    msg='<strong>%s</strong> added <strong>%s</strong> to the build queue.' % (dev, pkgname),
                    tl_type='0')
        else:
            flash('Package not found. Has the PKGBUILD been pushed to github?', category='error')

    return redirect(redirect_url())
Пример #2
0
def get_timeline(tlpage=None):
    event_ids = status.all_tl_events()
    timeline = []
    for event_id in event_ids:
        ev_obj = tl_event(event_id=event_id)
        allinfo = dict(event_id=ev_obj.event_id, date=ev_obj.date_str, msg=ev_obj.message, time=ev_obj.time_str,
                       tltype=ev_obj.tl_type)
        event = {event_id: allinfo}
        timeline.append(event)
    this_page, all_pages = get_paginated(timeline, 6, tlpage, True)

    return this_page, all_pages