All of lore.kernel.org
 help / color / mirror / Atom feed
* Patchwork Workflow improvement
@ 2010-01-23  8:43 Holger Hans Peter Freyther
  2010-01-23  9:22 ` Holger Hans Peter Freyther
                   ` (5 more replies)
  0 siblings, 6 replies; 22+ messages in thread
From: Holger Hans Peter Freyther @ 2010-01-23  8:43 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: Text/Plain, Size: 589 bytes --]

Hi All,

right now I'm writing a Qt 4.6 based application that might help us a bit with 
the patchwork queue.

The idea of the script is to have two things at the end:
	1.) a branch with all the patches that applied and that can be published
	2.) a list of patches that don't apply.


What people are supposed to:

1.) Cherry pick from the branch
2.) Send updated patches, close the reports on patchwork...



The current version is able to download the information of all pending 
patches, the next thing is to do is to apply them and keep track of the 
result...



[-- Attachment #2: main.cc --]
[-- Type: text/x-c++src, Size: 3874 bytes --]

/*
 * Copyright (C) 2010 Holger Hans Peter Freyther
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <QApplication>
#include <QWebFrame>
#include <QWebElement>
#include <QWebPage>

class Worker : public QObject {
    Q_OBJECT
public:
    Worker()
        : m_currentPage(1)
    {
        m_page = new QWebPage(this);
        connect(m_page, SIGNAL(loadFinished(bool)), SLOT(loadFinished(bool)));
    }

    void start()
    {
        qWarning("Trying to download page %d from patchwork", m_currentPage);
        QUrl url("http://patchwork.openembedded.org/project/openembedded/list/?order=date&page=" + QByteArray::number(m_currentPage));
        m_page->mainFrame()->load(url);
    }

    void startNext()
    {
        ++m_currentPage;
        start();
    }

    void handleCurrentPatch(QWebElement patch)
    {
        QWebElement link = patch.findFirst("a");
        QList<QWebElement> table = patch.findAll("td").toList();
        QString date, author, state;

        if (table.size() == 5) {
            date = table[1].toPlainText();
            author = table[2].toPlainText();
            state = table[4].toPlainText();
        }

        qWarning("\tDate: %s Author: '%s' State: %s '%s'", qPrintable(date), qPrintable(author), qPrintable(state), qPrintable(link.toPlainText()));
    }

    // query for all patches..
    void handleCurrentPage()
    {
        QWebElementCollection patches = m_page->mainFrame()->findAllElements("tr[id*=patch_row]");
        foreach(QWebElement element, patches)
            handleCurrentPatch(element);
    }

public Q_SLOTS:
    void loadFinished(bool result)
    {
        // Verify that we got the page we wanted
        QWebElement currentPage = m_page->mainFrame()->findFirstElement("span[title='Current Page']");
        if (currentPage.isNull()) {
            qWarning("Failed to find the current page.");
            return QApplication::exit(-1);
        }
        int currentPageNo = currentPage.toPlainText().toInt();
        if (currentPageNo != m_currentPage) {
            qWarning("The end was reached.");
            return QApplication::exit(0);
        }

        qWarning("Finished the download of page %d with status: %d", m_currentPage, result);
        handleCurrentPage();

        startNext();
    }

private:
    QWebPage* m_page;
    int m_currentPage;
};

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    Worker worker;
    worker.start();
    app.exec();
}

#include "main.moc"

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-01-24 13:02 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-23  8:43 Patchwork Workflow improvement Holger Hans Peter Freyther
2010-01-23  9:22 ` Holger Hans Peter Freyther
2010-01-23  9:26 ` Holger Hans Peter Freyther
2010-01-23  9:56 ` Holger Hans Peter Freyther
2010-01-23 14:53   ` Paul Menzel
2010-01-23 15:12     ` Koen Kooi
2010-01-23 16:46     ` Holger Hans Peter Freyther
2010-01-23 16:53       ` pwclient (was: Patchwork Workflow improvement) Paul Menzel
2010-01-23 21:29         ` pwclient Paul Menzel
2010-01-23 10:42 ` Patchwork Workflow improvement Koen Kooi
2010-01-23 12:19   ` New state for patches not complying with commit policy (was: Patchwork Workflow improvement) Paul Menzel
2010-01-23 14:10     ` New state for patches not complying with commit policy Koen Kooi
2010-01-23 16:11     ` New state for patches not complying with commit policy (was: Patchwork Workflow improvement) Phil Blundell
2010-01-23 18:00       ` New state for patches not complying with commit policy Koen Kooi
2010-01-23 12:56   ` Patchwork Workflow improvement Holger Hans Peter Freyther
2010-01-23 23:40     ` Khem Raj
2010-01-23 23:42       ` Khem Raj
2010-01-24  0:28         ` Rolf Leggewie
2010-01-24 13:00           ` Useful Git hooks for ensuring code quality. (was: Patchwork Workflow improvement) Paul Menzel
2010-01-23 15:19 ` Patchwork Workflow improvement Petr Štetiar
2010-01-23 16:40   ` Holger Hans Peter Freyther
2010-01-23 16:34 ` Rolf Leggewie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.