[yocto] Patchwork and stable branches
My apologies for cross posting. I have noticed some behavior I was not expecting with OE's Patchwork in that it is hiding patches. I don't know if this is by design or a bug in our Patchwork. When a series of patches are submitted to the mailing list and are same fix but against different branches, all but the last patch entered are automatically marked as "suspended" and then hidden from the default view. I never noticed this before and is now adding a new dimension to the Stable branch maintenance process that I need to work around. I am catching these issues as I compare my in box to patchwork. regards, Armin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] filters: Escape State names when generating selector HTML
From: Andrew Donnellan States with names containing special characters are not correctly escaped when generating the select list. Use escape() to fix this. Signed-off-by: Andrew Donnellan (cherry picked from commit b3fa0c402e060622a5ed539a465d2fa98b1d2e13) Signed-off-by: Daniel Axtens [Fixup for 1.16 context, CVE-2019-13122 ] Signed-off-by: Armin Kuster --- patchwork/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchwork/filters.py b/patchwork/filters.py index 87c904f..b734207 100644 --- a/patchwork/filters.py +++ b/patchwork/filters.py @@ -212,7 +212,7 @@ class StateFilter(Filter): selected = ' selected="true"' str += '%s' % ( -state.id, selected, state.name) +state.id, selected, escape(state.name)) str += '' return mark_safe(str) -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] security fix CVE-2019-13122
This is an untested backported patch from stable/2.0 patchwork for the OE version. It is a function already being used in the file so I have high confidence it wont introduce any new issues. Andrew Donnellan (1): filters: Escape State names when generating selector HTML patchwork/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] patchwork
Off Topic @: The same chaos as with German Govt. (KVR and Finanzamt). Zoran ___ On Sun, May 12, 2019 at 8:05 PM akuster808 wrote: > > ok, so no Admins. This is unexceptionable. > > OE TSC and Board, I believe its your time to get involved. > > regards, > Armin > > On 5/3/19 10:18 AM, akuster808 wrote: > > Hello OE folk, > > > > My apologies for cross posting. > > > > Who is the Admin for Patchwork? > > > > I would like additional privileges to manage the "Yocto Project Layers" > > queue. > > > > Also, I would like additional privileges to add new branches for any > > oe, meta-oe queues & yp layers. > > > > kind regards, > > Armin > > > > -- > ___ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] patchwork
ok, so no Admins. This is unexceptionable. OE TSC and Board, I believe its your time to get involved. regards, Armin On 5/3/19 10:18 AM, akuster808 wrote: > Hello OE folk, > > My apologies for cross posting. > > Who is the Admin for Patchwork? > > I would like additional privileges to manage the "Yocto Project Layers" > queue. > > Also, I would like additional privileges to add new branches for any > oe, meta-oe queues & yp layers. > > kind regards, > Armin > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] patchwork
Hello OE folk, My apologies for cross posting. Who is the Admin for Patchwork? I would like additional privileges to manage the "Yocto Project Layers" queue. Also, I would like additional privileges to add new branches for any oe, meta-oe queues & yp layers. kind regards, Armin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork: support wsgi
From: Changqing Li provide option of use like nginx + wsgi, this file is backported from patchwork upstream https://github.com/getpatchwork/patchwork Signed-off-by: Changqing Li --- patchwork/wsgi.py | 30 ++ 1 file changed, 30 insertions(+) create mode 100644 patchwork/wsgi.py diff --git a/patchwork/wsgi.py b/patchwork/wsgi.py new file mode 100644 index 000..714ea12 --- /dev/null +++ b/patchwork/wsgi.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Patchwork - automated patch tracking system +# Copyright (C) 2010 Martin F. Krafft +# +# This file is part of the Patchwork package. +# +# Patchwork is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Patchwork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Patchwork; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Released under the GNU General Public License v2 or later. + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ['DJANGO_SETTINGS_MODULE'] = 'patchwork.settings.production' + +application = get_wsgi_application() -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork/templates/patchwork/series.html: Add link column
Clicking on a patch name in Series view displays the patch at the botton section in same page, but there is no easy way to get a direct link to the patch, for example: to share the link. This change includes the column "Link" where a direct link to the patch is displayed and labeled with the patch id, that can be copied or clicked to displayed the patch detail on a new tab. [YOCTO #11888] Signed-off-by: Jose Lamego --- patchwork/templates/patchwork/series.html | 4 1 file changed, 4 insertions(+) diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html index 6c374f7..6c4608b 100644 --- a/patchwork/templates/patchwork/series.html +++ b/patchwork/templates/patchwork/series.html @@ -110,6 +110,7 @@ function toggle_headers(link_id, headers_id) {% endif %} Name + Link Submitter State @@ -126,6 +127,9 @@ function toggle_headers(link_id, headers_id) {{ patch.name|default:"[no subject]"|truncatechars:100 }} +{{ patch.id }} {{ patch.submitter|personify:project }} {{ patch.state }} -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] htdocs/js/series.js: Style active tab in series data bar
There is no visual indication on which is the active tab at the Series data bar, providing a poor UX. This change adds the "active" styling to the Series data bar. [YOCTO #11886] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index 857d288..ebfbbdf 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -9,6 +9,7 @@ $(document).ready(function(){ testsView=document.getElementById('tests_results') covContent=document.getElementsByClassName('content')[0] covTab=document.getElementById('cover-letter-tab') +patchesTab=document.getElementById('patches-tab') var patches = new Array() if ($( patchesInput[0] ).value){ patches=json_decode($( patchesInput[0] ).value, true) @@ -21,17 +22,21 @@ $(document).ready(function(){ revTab.style.padding='15px' patchView.style.display='none' if (covContent){ +covTab.classList.add('active') coverView.style.display='block' patchList.style.display='none' } else{ covTab.innerHTML = 'Cover letter N/A' +patchesTab.classList.add('active') coverView.style.display='none' patchList.style.display='block' } seriesForms.style.display='none' -document.getElementById('cover-letter-tab').onclick=function(){ +covTab.onclick=function(){ +covTab.classList.add('active') +patchesTab.classList.remove('active') coverView.style.display='block' patchView.style.display='none' patchList.style.display='none' @@ -41,7 +46,9 @@ $(document).ready(function(){ } } -document.getElementById('patches-tab').onclick=function(){ +patchesTab.onclick=function(){ +covTab.classList.remove('active') +patchesTab.classList.add('active') coverView.style.display='none' patchList.style.display='block' patchView.style.display="none" -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] htdocs/js/series.js: Default to cover letter view only if one is available
Cover letter content section is displayed by default at the Series view even if no cover letter is available, providing a poor UX. This change makes the Cover letter content section to be displayed by default if a cover letter is available, otherwise the Patches list is to be displayed by default at the Series view and the Cover letter tab will include a "N/A" legend and an informative tooltip when hover over the mouse cursor. [YOCTO #11887] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index e9516be..857d288 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -7,6 +7,8 @@ $(document).ready(function(){ patchesInput=$( "input[name^='patches']" ) seriesForms=document.getElementById('seriesForm') testsView=document.getElementById('tests_results') +covContent=document.getElementsByClassName('content')[0] +covTab=document.getElementById('cover-letter-tab') var patches = new Array() if ($( patchesInput[0] ).value){ patches=json_decode($( patchesInput[0] ).value, true) @@ -17,9 +19,16 @@ $(document).ready(function(){ revTab.style.border='none' revTab.style.background='transparent' revTab.style.padding='15px' -coverView.style.display='block' patchView.style.display='none' -patchList.style.display='none' +if (covContent){ +coverView.style.display='block' +patchList.style.display='none' +} +else{ +covTab.innerHTML = 'Cover letter N/A' +coverView.style.display='none' +patchList.style.display='block' +} seriesForms.style.display='none' document.getElementById('cover-letter-tab').onclick=function(){ -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] htdocs/css/style.css: fix select style in FF and IE
Series view displays the "Revision" select element not in line with the general patchwork style/design when viewed using Firefox or Internet Explorer browsers due to a known incompatibility of this browsers with Boostrap library (for example, an arrow head inside a button is displayed next to the "Revision" select element when using FF). This change hides the out-of-style items by using browser-specific css properties "moz-appearance" and "ms-expand". [YOCTO #11886] Signed-off-by: Jose Lamego --- htdocs/css/style.css | 9 + 1 file changed, 9 insertions(+) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 52e2422..633f13e 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -549,3 +549,12 @@ pre.test-result { margin: 0px; border: 0px; } + +#revs-list{ +-moz-appearance: none; +text-indent: 0.01px; +text-overflow: '' +} +#revs-list::-ms-expand{ +display: none; +} -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail: keep branch name in subject for series
patches with different branch names included in their name are wrongly appended as succesive revisions of the same patch in a series. This is due to the patches being assigned to the same series after their prefixes got removed during series naming/search. This change looks for an updated release name list from the Yocto wiki and keeps the release name in the series naming/search, effectively creating individual series for patches targeted to diferent releases. [YOCTO #10716] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 28 patchwork/models.py| 5 - 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 1d27f24..ed081b5 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -678,6 +678,34 @@ prefixes_re = re.compile(r'^\[[^\]]*\]\s*') def strip_prefixes(subject): +# get last releases names from Yocto wiki page to keep them +# as part of the series name if present, since such patches +# are branch-specific +try: +from lxml import html +import requests + +page = requests.get( +'https://wiki.yoctoproject.org/wiki/Stable_branch_maintenance') +tree = html.fromstring(page.content) +branches = tree.xpath('//table[@class="wikitable"]//td[count(\ +//th[contains(., "Branch name")]/preceding-sibling::th)+1]//text()') +# uncomment the following line to keep only last two branch names +# branches=branches[0:2] +branches[:] = [branch.replace('\n', '') for branch in branches] +subject = re.sub((r',?\d+/\d+\]'), ']', subject) +for branch in branches: +if "[" + branch + "]" in subject: +prefixes_re = re.compile(r'^\s*\[[^\]]*\]\s*') +branch_re = r"(?<=\[" + branch + "\])\s*(.*)" +branch_search = re.search(branch_re, subject) +if branch_search: +return "[" + branch + "] " + prefixes_re.sub( +'', branch_search.group(0)) +except ImportError: +pass + +prefixes_re = re.compile(r'^\[[^\]]*\]\s*') return prefixes_re.sub('', subject) diff --git a/patchwork/models.py b/patchwork/models.py index 7dd8120..d08e189 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1047,13 +1047,16 @@ def _on_revision_complete(sender, revision, **kwargs): if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name n = re.compile(r'((\[.*\]\s?)*\[.*\w+.*' - '(?P\W+\d+\/\d+)+\s*\]\s?)' + '(?P(\[|,)+\d+\/\d+\s*)\]\s?)' '|(?P\[\d+\/\d+\]\s?)') if n.match(name): name = re.sub( n.match(name).group("comb_pref") or re.escape(n.match(name).group("ind_pref")), '', name) +re.sub(r'\[\]', '', name) +re.sub(r'\[\[+', '\[', name) +re.sub(r'\]\]+', '\]', name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter if c == 1: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH V2] tools/test-series: automate test-build process for series
Testing patch series' for appropriate integration and further build against a branch requires several manual steps, providing a poor code maintainer experience and increasing overall patch integration workflow. This change adds a script to automate the test-build process for one or more patch series by downloading one or more series from patchwork, applying it/them to a test branch, uploading the test branch to a repository and starting a build at a Yocto Autobuilder. Then a message is posted at the series view in patchwork with a link to the builder's web page. The build results can later be queried at the autobuilder api using the "reason" field, where the script includes the tested series' ID and the date when it was started as unique identifier. [YOCTO #8714] Signed-off-by: Jose Lamego --- Notes: Changes in V2: - Updated script description to be more clear about its purpose. - Moved the script to a new directory that now also contains a requirements file. - Removed hardcoded paths and pointed the default paths into current user's home directory. - Default autobuilder URL points to https://autobuilder.yocto.io - Use subprocess' checkout_output function instead of Popen+PIPE - Removed if/else argument validation by setting default values - Added publish_build function to use git-pw command to post a notification for the started build at the series view in patchwork. The posted message at the test-results section can later be updated with a direct link to the build results when available. tools/test-series/requirements.txt | 3 + tools/test-series/test-series | 496 + 2 files changed, 499 insertions(+) create mode 100644 tools/test-series/requirements.txt create mode 100755 tools/test-series/test-series diff --git a/tools/test-series/requirements.txt b/tools/test-series/requirements.txt new file mode 100644 index 000..14d817a --- /dev/null +++ b/tools/test-series/requirements.txt @@ -0,0 +1,3 @@ +beautifulsoup4 +lxml +python-requests >= 2.4.2 diff --git a/tools/test-series/test-series b/tools/test-series/test-series new file mode 100755 index 000..e037fce --- /dev/null +++ b/tools/test-series/test-series @@ -0,0 +1,496 @@ +#!/usr/bin/env python3 +# +# Patch series test build automation script +# +# Copyright (C) 2015-2017 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# +# Requirements: +# - Using pip: +# +# $ pip install beautifulsoup4 lxml +# +# Setup: +# +# - Path to a local git repository directory that can +# push to a remote repository must be provided. +# - if no local "git patchwork.default.url" is set, +# http://patchwork.openembedded.org will be used + +import argparse +import git +import os +import sys +import subprocess +from datetime import datetime +import getpass +import requests +import re + +# * Default values * # +sourceDir = os.path.dirname(os.path.realpath(__file__)) +default_user = getpass.getuser() +default_patchwork_dir = "/home/%s/patchwork/patchwork" % default_user +default_patchwork_url = "https://patchwork.openembedded.org"; +default_builder = "nightly-oecore" +default_autobuilder_dir = "/home/%s/yocto-autobuilder" % default_user +default_autobuilder_url = "https://autobuilder.yocto.io"; +default_password = "password" +default_repo_name = "origin" +default_repo_url = None +default_base_branch = "master" +# delete test-branch after starting build +default_delete_branch = False +# push branch to repoUrl +default_no_push = False +# skip starting the build +default_no_build = False +default_update_basebranch = False +default_test_success_only = False +test_name = "test-build" +initial_result = "pending" + + +class TestSeriesAPI(object): + +def __init__(self, cmd): +self.cmd = cmd + +def _checkout_to_branch(self, branch): +try: +msg = subprocess.check_output(['git', 'checkout', branch] + ).decode('utf-8').strip() +if msg != "": +print("I: %s" % msg) +return 0 +except subprocess.CalledProcessError: +return 1 + +def _get_current_branch(self): +try: +msg = subprocess.check_output(['git', 'symbolic-ref', 'HEAD'
[yocto] [patchwork][RFC][PATCH] tools/test-series: automate test builds for series
Testing patch series' for appropriate integration and further build against a branch requires several manual steps, providing a poor code maintainer experience and increasing overall patch integration workflow. This change adds a script to automate downloading one or more series from patchwork, applying them to a test branch, uploading the test branch to a repository and starting a build at a Yocto Autobuilder. The build results can later be queried at the autobuilder api using the "reason" field, where the script includes the tested series' ID and the date when it was started as unique identifier. [YOCTO #8714] Signed-off-by: Jose Lamego --- tools/test-series | 530 ++ 1 file changed, 530 insertions(+) create mode 100755 tools/test-series diff --git a/tools/test-series b/tools/test-series new file mode 100755 index 000..acecf36 --- /dev/null +++ b/tools/test-series @@ -0,0 +1,530 @@ +#!/usr/bin/env python3 + +# Open Embedded Patch series test build script +# +# Copyright (C) 2015-2017 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# +# Requirements: +# - Using pip: +# +# $ pip install beautifulsoup4 lxml +# +# Setup: +# +# - Path to a local git repository directory that can +# push to a remote repository must be provided. +# - if no local "git patchwork.default.url" is set, +# http://patchwork.openembedded.org will be used + +import argparse +import signal +import git +import os +import sys +import subprocess +from datetime import datetime +import getpass +import requests + +PIPE = subprocess.PIPE +sourceDir = os.path.dirname(os.path.realpath(__file__)) +pwDir = "/home/jose/repos/patchwork/patchwork" +defaultAbDir = "/home/jose/repos/yocto-autobuilder" +defaultBuilder = "nightly-oecore" +defaultAbUrl = "http://yoctogdc.amr.corp.intel.com:8010"; +defaultRepoName = "origin" +defaultBaseBranch = "master" +defaultTestBranch = "test-series" + datetime.now().strftime('-%Y%b%d-%H%M%S') +logFile = "%s/test-series.log" % sourceDir +defaultAbUser = getpass.getuser() +defaultAbPassword = "passpass" +# keepBranch value determines if created branches are keep when exiting script +keepBranch = True +# list of branches created by this script +testBranches = [] +# list of series to be applied +multiSeries = [] +# push branch to repoUrl +push = True + + +class TestSeriesAPI(object): + +def __init__(self, cmd): +self.cmd = cmd + +def _checkout_to_branch(self, branch): +process = subprocess.Popen(['git', 'checkout', branch], + stdout=PIPE, stderr=PIPE) +stdoutput, stderroutput = process.communicate() +if stderroutput: +emsg = stderroutput.decode('utf-8').strip() +if 'Already' in emsg or 'Switched' in emsg: +print("I: %s" % emsg) +return 0 +elif 'error' in emsg or 'fatal:'in emsg: +print("E: %s" % emsg) +return 1 +if stdoutput: +print("I: %s" % stdoutput.decode('utf-8').strip()) +return 0 + +def _get_current_branch(self): +process = subprocess.Popen(['git', 'symbolic-ref', 'HEAD'], + stdout=PIPE, stderr=PIPE) +stdoutput, stderroutput = process.communicate() +stdoutput = stdoutput.decode('utf-8').strip() +if 'refs/heads/' in stdoutput: +return stdoutput[11:] +else: +print("E: Failed to get current branch name.") +return None + +def _name_test_branch(self, series): +if not series: +name = defaultTestBranch +print("I: No series (-s) and no test-branch name (-tb) found. \ +Using automatically generated name \"%s\"." % name) +else: +name = "test_" + "-".join([str(serie) for serie in series]) + \ +datetime.now().strftime('-%Y%b%d-%H%M%S') +print("I: no test-branch name provided (-tb). Using the \ +automatically generated \"%s\"." % name) +return name + +def update_branch(self, branch): +if not branch: +print("I: target branch (--base-branch) not found. Atempting to \ +update current branch.") +branch = self._get_current_branch() +if not branch: +return 1 +prereq = self._chec
[yocto] [patchwork][PATCH v5] models.py: Improve Series naming when no cover letter is provided
The number/order prefix from a patch Subject line is inapropriately included when naming a Series where a cover letter is not provided and an additional prefix is present at the Subject. This change improves the substitution regex to omit the number/order prefix but include any other prefix that may be present. [YOCTO #11305] Signed-off-by: Jose Lamego --- Notes: Changes in V5: Fixed argument formatting in re.sub function Changes in V4: use group naming in regex instead of integer indexing for readibility purposes Changes in V3: remove the number/order prefix without changing any other other existing prefix, as this may be required for mapping the patch to additional branches other than master. patchwork/models.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index ddc3254..7dd8120 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1046,8 +1046,14 @@ def _on_revision_complete(sender, revision, **kwargs): # so we can update the name for series without a cover letter if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name -n = re.compile(r'(\[\d+\/\d+\]\s?)') -name = n.sub('', name) +n = re.compile(r'((\[.*\]\s?)*\[.*\w+.*' + '(?P\W+\d+\/\d+)+\s*\]\s?)' + '|(?P\[\d+\/\d+\]\s?)') +if n.match(name): +name = re.sub( +n.match(name).group("comb_pref") or +re.escape(n.match(name).group("ind_pref")), +'', name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter if c == 1: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v4] models.py: Improve Series naming when no cover letter is provided
The number/order prefix from a patch Subject line is inapropriately included when naming a Series where a cover letter is not provided and an additional prefix is present at the Subject. This change improves the substitution regex to omit the number/order prefix but include any other prefix that may be present. [YOCTO #11305] Signed-off-by: Jose Lamego --- Notes: Changes in V4: use group naming in regex instead of integer indexing for readibility purposes Changes in V3: remove the number/order prefix without changing any other other existing prefix, as this may be required for mapping the patch to additional branches other than master. patchwork/models.py | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index ddc3254..ae9ed9f 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1046,8 +1046,14 @@ def _on_revision_complete(sender, revision, **kwargs): # so we can update the name for series without a cover letter if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name -n = re.compile(r'(\[\d+\/\d+\]\s?)') -name = n.sub('', name) +n = re.compile(r'((\[.*\]\s?)*\[.*\w+.*' + '(?P\W+\d+\/\d+)+\s*\]\s?)' + '|(?P\[\d+\/\d+\]\s?)') +if n.match(name): +name = re.sub( +r'n.match(name).group("comb_pref") or ' +'re.escape(n.match(name).group("ind_pref")', +name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter if c == 1: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v3] models.py: Improve Series naming when no cover letter is provided
The number/order prefix from a patch Subject line is inapropriately included when naming a Series where a cover letter is not provided and an additional prefix is present at the Subject. This change improves the substitution regex to omit the number/order prefix but include any other prefix that may be present. [YOCTO #11305] Signed-off-by: Jose Lamego --- Notes: Changes in V3: remove the number/order prefix without changing any other other existing prefix, as this may be required for mapping the patch to additional branches other than master. patchwork/models.py | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index ddc3254..7944b98 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1046,8 +1046,12 @@ def _on_revision_complete(sender, revision, **kwargs): # so we can update the name for series without a cover letter if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name -n = re.compile(r'(\[\d+\/\d+\]\s?)') -name = n.sub('', name) +n = re.compile( +r'((\[.*\]\s?)*\[.*\w+.*(\W+\d+\/\d+)+\s*\]\s?)|(\[\d+\/\d+\]\s?)') +if n.match(name): +name = re.sub( +r'n.match(name).group(3) or re.escape(n.match(name).group(4)', +name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter if c == 1: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2] models.py: Improve Series naming when no cover letter is provided
The number/order prefix from a patch Subject line is inapropriately included when naming a Series where a cover letter is not provided and an additional prefix is present at the Subject. This change improves the substitution regex to omit the number/order and any other prefix that may be present. [YOCTO #11305] Signed-off-by: Jose Lamego --- Notes: Changes in v2: Ommit all of the prefixes that may be present in first patch to name the series patchwork/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchwork/models.py b/patchwork/models.py index ddc3254..a34e0fc 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1046,7 +1046,7 @@ def _on_revision_complete(sender, revision, **kwargs): # so we can update the name for series without a cover letter if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name -n = re.compile(r'(\[\d+\/\d+\]\s?)') +n = re.compile(r'(\[.*\]\s?)') name = n.sub('', name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [[patchwork][PATCH] models.py: Improve Series naming when no cover letter is provided
The number/order prefix from a patch Subject line is inapropriately included when naming a Series where a cover letter is not provided and an additional prefix is present at the Subject. This change improves the substitution regex to omit the number/order prefix but include any other prefix that may be present. [YOCTO #11305] Signed-off-by: Jose Lamego --- patchwork/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchwork/models.py b/patchwork/models.py index ddc3254..8b72f4a 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1046,8 +1046,8 @@ def _on_revision_complete(sender, revision, **kwargs): # so we can update the name for series without a cover letter if series.name == SERIES_DEFAULT_NAME: name = series.latest_revision().ordered_patches()[0].name -n = re.compile(r'(\[\d+\/\d+\]\s?)') -name = n.sub('', name) +n = re.compile(r'(\[\s*\w*\s*v\d+)(\W*\d+\/\d+)(\s*\]\s?.)*') +name = n.sub(r'\g<1>\g<3>', name) c = len(series.latest_revision().ordered_patches()) # For one-patch series (1/1) without cover letter if c == 1: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v4] parsemail.py: Improve find_series_for_mail
Patch Series that are sent as replies to other Series with different patch quantity are not appropriately detected as such, breaking the thread and causing missing revisions. This change improves the find_series_for_mail function to appropriately detect when a message is part of a thread by performing an additional patch-query and detecting cover letters that are replies to cover letters. [YOCTO #10959] Signed-off-by: Jose Lamego --- Notes: Changes in version 4: Only consider messages with Subject starting with "[" as possible cover letters, filtering out reply messages patchwork/bin/parsemail.py | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 61c18b2..a68baa2 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,9 +399,9 @@ def find_content(project, mail): (x, n) = parse_series_marker(prefixes) refs = build_references_list(mail) is_root = refs == [] -is_cover_letter = is_root and x == 0 patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) +is_cover_letter = x == 0 and patch_prefix is_patch = patchbuf is not None and patch_prefix drop_patch = not is_attachment and \ @@ -441,7 +441,7 @@ def find_content(project, mail): (ret.series, ret.revision, ret.patch_order, n) = \ find_series_for_mail(project, series_name, msgid, is_patch, - ret.patch_order, n, refs) + ret.patch_order, n, refs, is_cover_letter) ret.revision.n_patches = n or 1 date = mail_date(mail) @@ -535,7 +535,7 @@ def find_patch_order(revisions, previous_patch, order, n_patches): # - we need to create new revisions when the mail is actually a new version # of a previous patch def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, - refs): + refs, is_cover_letter): if refs == []: root_msgid = msgid else: @@ -560,6 +560,20 @@ def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, revision = revision.duplicate(exclude_patches=(order,)) # series has been updated, grab the new instance series = revision.series +else: +try: +prev_patch = SeriesRevisionPatch.objects.get( +revision=revision, order=order).patch +if prev_patch and not prev_patch.msgid == msgid: +# this is a new patch in the thread +revision = revision.duplicate(exclude_patches=(order,)) +series = revision.series +except SeriesRevisionPatch.DoesNotExist: +pass +elif is_cover_letter and not refs == []: +revision = revision.duplicate( +exclude_patches=range(1, revision.n_patches+1),) +series = revision.series except IndexError: if not name: name = SERIES_DEFAULT_NAME -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2] create-pull-request: add "-t in-reply-to" option
The create-pull-request script creates patches as replies to a cover letter, in the form of an email thread. If further revisions are sent to the mailing list without referencing to the first revision, these new revisions are not identified at the mailing list as part of the original thread, but as a new thread instead. This change adds the "[-t in_reply_to]" option, where "in_reply_to" is the original cover letter's Message-Id, so this reference is added to the new cover letter to ensure the thread continuity. [YOCTO #11294] Signed-off-by: Jose Lamego --- scripts/create-pull-request | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/create-pull-request b/scripts/create-pull-request index e82858b..8f0be99 100755 --- a/scripts/create-pull-request +++ b/scripts/create-pull-request @@ -34,7 +34,7 @@ RFC=0 usage() { CMD=$(basename $0) cat <" EOM } REMOTE="$CPR_CONTRIB_REMOTE" # Parse and validate arguments -while getopts "b:acd:hi:m:o:p:r:s:u:l:" OPT; do +while getopts "b:acd:hi:m:o:p:r:s:u:l:t:" OPT; do case $OPT in b) BRANCH="$OPTARG" @@ -108,7 +110,10 @@ while getopts "b:acd:hi:m:o:p:r:s:u:l:" OPT; do a) CPR_CONTRIB_AUTO_PUSH="1" ;; - esac +t) +IN_REPLY_TO="$OPTARG" +;; +esac done if [ -z "$REMOTE" ]; then @@ -205,7 +210,11 @@ if [ -n "$RELDIR" ]; then fi # Generate the patches and cover letter -git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null +if [ -n "$IN_REPLY_TO" ]; then +git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --in-reply-to="$IN_REPLY_TO" --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null +else +git format-patch $extraopts -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null +fi if [ -z "$(ls -A $ODIR 2> /dev/null)" ]; then echo "ERROR: $ODIR is empty, no cover letter and patches was generated!" -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail.py: Improve clean_subject function
PATCH prefix is not appropriately identified as such if it is not sepparated from following word in an email Subject line. This leads to wrong patch naming. This change allows for appropriate patch naming by checking during clean_subject function if "PATCH" prefix in Subject line is not sepparated from following word and adding a space between them. Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 6 ++ 1 file changed, 6 insertions(+) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 3c3046d..2f5aecb 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -633,6 +633,12 @@ def clean_subject(subject, drop_prefixes=None): in the subject. If drop_prefixes is provided, remove those too, comparing case-insensitively.""" +# Check if PATCH prefix is followed by anoter word without a sepparation +# space. Add missing space to allow appropriate parsing +if patch_pref.match(subject): +index = subject.find(patch_pref.match(subject).group(1)) +subject = subject[:index + 5] + ' ' + subject[index + 5:] + subject = clean_header(subject) if drop_prefixes is None: -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v3] parsemail.py: Improve find_series_for_mail
Patch Series that are sent as replies to other Series with different patch quantity are not appropriately detected as such, breaking the thread and causing missing revisions. This change improves the find_series_for_mail function to appropriately detect when a message is part of a thread by performing an additional patch-query and detecting cover letters that are replies to cover letters. [YOCTO #10959] Signed-off-by: Jose Lamego --- Notes: changes in v3: a couple of typos fixed patchwork/bin/parsemail.py | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 61c18b2..3c3046d 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,7 +399,7 @@ def find_content(project, mail): (x, n) = parse_series_marker(prefixes) refs = build_references_list(mail) is_root = refs == [] -is_cover_letter = is_root and x == 0 +is_cover_letter = x == 0 patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) is_patch = patchbuf is not None and patch_prefix @@ -441,7 +441,7 @@ def find_content(project, mail): (ret.series, ret.revision, ret.patch_order, n) = \ find_series_for_mail(project, series_name, msgid, is_patch, - ret.patch_order, n, refs) + ret.patch_order, n, refs, is_cover_letter) ret.revision.n_patches = n or 1 date = mail_date(mail) @@ -535,7 +535,7 @@ def find_patch_order(revisions, previous_patch, order, n_patches): # - we need to create new revisions when the mail is actually a new version # of a previous patch def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, - refs): + refs, is_cover_letter): if refs == []: root_msgid = msgid else: @@ -560,6 +560,20 @@ def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, revision = revision.duplicate(exclude_patches=(order,)) # series has been updated, grab the new instance series = revision.series +else: +try: +prev_patch = SeriesRevisionPatch.objects.get( +revision=revision, order=order).patch +if prev_patch and not prev_patch.msgid == msgid: +# this is a new patch in the thread +revision = revision.duplicate(exclude_patches=(order,)) +series = revision.series +except SeriesRevisionPatch.DoesNotExist: +pass +elif is_cover_letter and not refs == []: +revision = revision.duplicate( +exclude_patches=range(1, revision.n_patches+1),) +series = revision.series except IndexError: if not name: name = SERIES_DEFAULT_NAME -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2] parsemail.py: Improve find_series_for_mail
Patch Series that are sent as replies to other Series with different patch quantity are not appropriately detected as such, breaking the thread and causing missing revisions. This change improves the find_series_for_mail function to appropriately detect when a message is part of a thread by performing an additional patch-query and detecting cover letters that are replies to cover letters. [YOCTO #10959] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 61c18b2..9cf8e03 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,7 +399,7 @@ def find_content(project, mail): (x, n) = parse_series_marker(prefixes) refs = build_references_list(mail) is_root = refs == [] -is_cover_letter = is_root and x == 0 +is_cover_letter = x == 0 patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) is_patch = patchbuf is not None and patch_prefix @@ -441,7 +441,7 @@ def find_content(project, mail): (ret.series, ret.revision, ret.patch_order, n) = \ find_series_for_mail(project, series_name, msgid, is_patch, - ret.patch_order, n, refs) + ret.patch_order, n, refs, is_cover_letter) ret.revision.n_patches = n or 1 date = mail_date(mail) @@ -535,7 +535,7 @@ def find_patch_order(revisions, previous_patch, order, n_patches): # - we need to create new revisions when the mail is actually a new version # of a previous patch def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, - refs): + refs, is_cover_letter): if refs == []: root_msgid = msgid else: @@ -560,6 +560,20 @@ def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, revision = revision.duplicate(exclude_patches=(order,)) # series has been updated, grab the new instance series = revision.series +else: +try: +prev_patch = SeriesRevisionPatch.objects.get( +revision=revision, order=order)patch +if prev_patch and not prev_patch.msgid == msgid: +# this is a new patch in the thread +revision = revision.duplicate(exclude_patches=(order,)) +series = revision.series +except SeriesRevisionPatch.DoesNotExist: +pass +elif is_cover_letter and not refs == []: +revision = revision.duplicate( +exclude_patches=range(1, revision.n_patches+1),) +series = revision.series. except IndexError: if not name: name = SERIES_DEFAULT_NAME -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail.py: Improve find_series_for_mail
Patch Series that are sent as replies to other Series with different patch quantity are not appropriately detected as such, breaking the thread and causing missing revisions. This change improves the find_series_for_mail function to appropriately detect when a message is part of a thread by performing an additional patch-query and detecting cover letters that are replies to cover letters. [YOCTO #10959] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 61c18b2..98db40a 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,7 +399,7 @@ def find_content(project, mail): (x, n) = parse_series_marker(prefixes) refs = build_references_list(mail) is_root = refs == [] -is_cover_letter = is_root and x == 0 +is_cover_letter = x == 0 patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) is_patch = patchbuf is not None and patch_prefix @@ -441,7 +441,7 @@ def find_content(project, mail): (ret.series, ret.revision, ret.patch_order, n) = \ find_series_for_mail(project, series_name, msgid, is_patch, - ret.patch_order, n, refs) + ret.patch_order, n, refs, is_cover_letter) ret.revision.n_patches = n or 1 date = mail_date(mail) @@ -535,7 +535,7 @@ def find_patch_order(revisions, previous_patch, order, n_patches): # - we need to create new revisions when the mail is actually a new version # of a previous patch def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, - refs): + refs, is_cover_letter): if refs == []: root_msgid = msgid else: @@ -560,6 +560,19 @@ def find_series_for_mail(project, name, msgid, is_patch, order, n_patches, revision = revision.duplicate(exclude_patches=(order,)) # series has been updated, grab the new instance series = revision.series +else: +try: +prev_patch = SeriesRevisionPatch.objects.get( +revision=revision, order=order)patch +if prev_patch and not prev_patch.msgid == msgid: +# this is a new patch in the thread +revision = revision.duplicate(exclude_patches=(order,)) +series = revision.series+except SeriesRevisionPatch.DoesNotExist: +pass +elif is_cover_letter and not refs == []: +revision = revision.duplicate( +exclude_patches=range(1, revision.n_patches+1),) +series = revision.series. except IndexError: if not name: name = SERIES_DEFAULT_NAME -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail.py: Improve status-change-through-email
Patch status can be edited through email by project maintainers only without any feedback if this is attempted by any other user, providing a poor user experience. This change extends the patch-status-through-email functionality to be performed by the series submitter also, and provides a system-generated message if an attempt was made through a message using an email address not recognized neither as project maintainer or series submitter in patchwork. [YOCTO #11027] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 73 +++--- 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index ebfa849..61c18b2 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -838,31 +838,56 @@ def parse_mail(mail): comment.msgid = msgid comment.save() LOGGER.debug('Comment saved') - -# if comment's author has project-maintainer permissions, -# parse comment content and process the status-change command -# if it is found -if author.user and project in \ -(author.user).profile.maintainer_projects.all(): -cmd = None -comment_re = re.compile('^\[Patchwork-Status:\s*(Under Review|\ -Rejected|RFC|Not Applicable|Changes Requested|Awaiting Upstream|Superseded|\ -Deferred)\]$', re.M | re.I) -# if multiple valid status-change commands are found, use last one -for match in comment_re.finditer(comment.content): -cmd = re.sub(r'(\[Patchwork-Status:\s*)(.*)(\])', r'\2', - "{}".format(match.group(0))) -if cmd is not None: -new_state = State.objects.get(name=cmd.title()) -mod_patch = Patch.objects.get(pk=comment.patch.pk) -if new_state and mod_patch.state != new_state: -mod_patch.state = new_state -mod_patch.save() -cmd_message = 'This is a system generated Comment: Patch \ -%s status was updated to "%s" due to request in comment.' % ( - comment.patch.pk, cmd) +# look for a status-change command string in the comment +cmd = None +comment_re = re.compile('^(?:\n|\r\n?)\[Patchwork-Status:\s*\ +(Under Review|Rejected|RFC|Not Applicable|Changes Requested|Awaiting \ +Upstream|Superseded|Deferred)\](?:\n|\r\n?)$', re.M | re.I) +# if multiple valid status-change commands are found, use last one +for match in comment_re.finditer(comment.content): +cmd = re.sub( +r'((?:\n|\r\n?)\[Patchwork-Status:\s*)(.*)(\](?:\n|\r\n?))', +r'\2', "{}".format(match.group(0))) +# if a status-change command string is found, see if comment's author +# has either project-maintainer permissions or is the series submitter +# and process the command if true. +if cmd is not None: +refs = build_references_list(mail) +if not refs == []: +if not series: +series = SeriesRevision.objects.filter( +series__project=project, +root_msgid=refs[-1]).reverse()[0].series +if (author.user and project in +(author.user).profile.maintainer_projects.all()) or ( +author and author == series.submitter): +new_state = State.objects.get(name=cmd.title()) +mod_patch = Patch.objects.get(pk=comment.patch.pk) +if new_state and mod_patch.state != new_state: +mod_patch.state = new_state +mod_patch.save() +cmd_message = 'This is a system generated Comment: \ +Patch %s status was updated to "%s"\ndue to request in comment body.' % ( +comment.patch.pk, cmd) +cmd_msgid = "%s: System generated by comment %s" % ( +datetime.datetime.now().strftime("\ +%d%b%Y.%H:%M:%S.%f"), comment.pk) +new_comment = Comment(pk=None, patch=comment.patch, + content=cmd_message, + date=datetime.datetime.now(), + submitter=comment.submitter, + msgid=cmd_msgid) +new_comment.save() +else: +# notify that a patch-status change was attempted without +# apropriate submitter/maintainer permissions +cmd_message = 'This is a system generated Comment: \ +A command to change a patch-status through\nemail was detected in comment, \ +but the sender email does not belong either to\na project maintainer or
[yocto] [patchwork][PATCH 2/2] pagination.html: Add archive parameter to links
paginator links do not include current "archive" status parameter, which may lead to inaccurate data displayed in next views. This change includes "archive" parameter from the paginator class to all of the pagination links. [YOCTO #11200] Signed-off-by: Jose Lamego --- patchwork/templates/patchwork/pagination.html | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/patchwork/templates/patchwork/pagination.html b/patchwork/templates/patchwork/pagination.html index b8b76b3..e4f802b 100644 --- a/patchwork/templates/patchwork/pagination.html +++ b/patchwork/templates/patchwork/pagination.html @@ -4,7 +4,7 @@ {% if page.has_previous %} - « {% else %} « @@ -12,7 +12,7 @@ {% if page.paginator.trailing_set %} {% for p in page.paginator.trailing_set %} - {{ p }} + {{ p }} {% endfor %} ... {% endif %} @@ -21,7 +21,7 @@ {% ifequal p page.number %} {{ p }} {% else %} -{{ p }} {% endifequal %} {% endfor %} @@ -29,13 +29,13 @@ {% if page.paginator.leading_set %} … {% for p in page.paginator.leading_set %} -{{ p }} +{{ p }} {% endfor %} {% endif %} {% if page.has_next %} - » {% else %} -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 1/2] patchwork/paginator.py: Add archive parameter
paginator links do not keep "archive" filtering parameter from current view, which may lead to inaccurate data displayed in the next views. This change adds the "archive" parameter read from the current request to the paginator class. [YOCTO #11200] Signed-off-by: Jose Lamego --- patchwork/paginator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patchwork/paginator.py b/patchwork/paginator.py index 0f6d684..88fca29 100644 --- a/patchwork/paginator.py +++ b/patchwork/paginator.py @@ -93,3 +93,4 @@ class Paginator(paginator.Paginator): self.leading_set.reverse() self.long_page = len( self.current_page.object_list) >= LONG_PAGE_THRESHOLD +self.archive = request.GET.get("archive") -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 0/2] patchwork: keep archive query parameter in views
patchwork pagination links do not keep "archive" filtering parameter, which may lead to inaccurate data displayed in the next views. These changes read the "archive" parameter from current GET request and add it to the pagination links. [YOCTO #11200] Jose Lamego (2): patchwork/paginator.py: Add archive parameter pagination.html: Add archive parameter to links patchwork/paginator.py| 1 + patchwork/templates/patchwork/pagination.html | 10 +- 2 files changed, 6 insertions(+), 5 deletions(-) -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] series.py: return bundle objects only when authenticated
If a non-authenticated user tries to get a series view from patchwork web UI, a 500 error message is displayed caused by the database access attempted when filtering the bundle objects. This change allows not-logged users to acces series view by returning an empty bundle variable, instead of trying to access the database. Signed-off-by: Jose Lamego --- patchwork/views/series.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/patchwork/views/series.py b/patchwork/views/series.py index cb3b721..765d2e5 100644 --- a/patchwork/views/series.py +++ b/patchwork/views/series.py @@ -48,7 +48,10 @@ class SeriesView(View): revisions = get_list_or_404(SeriesRevision, series=series) patchform = PatchForm(project=series.project) createbundleform = CreateBundleForm() -bundles = Bundle.objects.filter(owner=request.user) +if request.user.is_authenticated(): +bundles = Bundle.objects.filter(owner=request.user) +else: +bundles="" for revision in revisions: revision.patch_list = revision.ordered_patches().\ select_related('state', 'submitter') -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 3/3] patch-list: call tablecheckbox plugin from patch-list
This change calls the tablecheckbox.js plugin to add functionality in a patch-list to allow user to select single / multiple / all table row(s) by clicking. [YOCTO #10819] Signed-off-by: Jose Lamego --- patchwork/templates/patchwork/patch-list.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html index ec52231..fe6f99f 100644 --- a/patchwork/templates/patchwork/patch-list.html +++ b/patchwork/templates/patchwork/patch-list.html @@ -38,8 +38,10 @@ $(document).ready(function() { $('#patchlist').stickyTableHeaders(); +$( '.table' ).tablecheckbox(); }); + {% csrf_token %} -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 2/3] jquery.tablecheckbox: add plugin for multiselect functionality
Selecting multiple items in a patch list must be done manually, one item at a time, resulting in a poor user experience. This change adds the jquery.tablecheckbox.js plugin that allows to select single / multiple / all table row(s) by clicking. [YOCTO #10819] Signed-off-by: Jose Lamego --- htdocs/js/jquery.tablecheckbox.js | 165 ++ 1 file changed, 165 insertions(+) create mode 100644 htdocs/js/jquery.tablecheckbox.js diff --git a/htdocs/js/jquery.tablecheckbox.js b/htdocs/js/jquery.tablecheckbox.js new file mode 100644 index 000..8a50541 --- /dev/null +++ b/htdocs/js/jquery.tablecheckbox.js @@ -0,0 +1,165 @@ +(function($) { +/** + * A jQuery plugin that lets you easily enhance data tables with selectable rows. + * + * + * @author Marco Kerwitz + * @seehttps://github.com/kerwitz/jquery.tablecheckbox + */ +$.fn.tablecheckbox = function(options) { +var _private = { +/** + * The configuration of this plugin. + * + * Overload with custom values when calling the plugin: + * $('table').tableCheckbox({selectedRowClass: 'selected-row'}); + * + * @var object + */ +config: $.extend({ +// The class that will be applied to selected rows. +selectedRowClass: 'warning', +// The selector used to find the checkboxes on the table. You may customize this in +// order to match your table layout if it differs from the assumed one. +checkboxSelector: 'td:first-of-type input[type="checkbox"],th:first-of-type input[type="checkbox"]', +// A callback that is used to determine wether a checkbox is selected or not. +isChecked: function($checkbox) { +return $checkbox.is(':checked'); +} +}, options), +/** + * Variables used across multiple tables. + * + * @var object + */ +registry: { +shiftKeyIsPressed: false +}, +helpers: { +/** + * Returns the selection methods available in the current browser. + * + * @author Grinn, http://stackoverflow.com/users/152648/grinn + * @author Gert Grenander, http://stackoverflow.com/users/339850/gert-grenander + * @see http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript + */ +selection: window.getSelection ? window.getSelection() : document.selection ? document.selection : null, +/** + * Removes any text selection the user made. + * + * @author Marco Kerwitz + */ +removeTextSelection: function() { +if (!!_private.helpers.selection) { +_private.helpers.selection.empty +? _private.helpers.selection.empty() +: _private.helpers.selection.removeAllRanges(); +} +}, +/** + * Returns wether or not a text selection currently exists. + * + * @author Marco Kerwitz + * @todo This will return false positives when the user selected text outside of + * the table and then tries to select rows. + * @return {boolean} + */ +hasSelection: function() { +return !!_private.helpers.selection && _private.helpers.selection.toString().length; +} +} +}; +// Initiate a event callback that we can use to tell wether the user is pressing the shift +// key or not. +$(document).on('keydown.tsc keyup.tsc', function(e) { +_private.registry.shiftKeyIsPressed = e.shiftKey; +}); +return this.each(function() { +var $table = $(this), +$headCheckbox = $table.find('thead tr ' + _private.config.checkboxSelector), +$checkboxes = $table.find('tr ' + _private.config.checkboxSelector).not($headCheckbox), +$lastRow = []; +// Listen for changes on the checkbox in the table header and apply its current state +// to all checkboxe on the table. +$headCheckbox.on('change', function(e) { +var $allRows = $table.find('tbody tr'); +$checkboxes +.prop('checked', _private.config.isChecked($headCheckbox)) +.trigger('change'); +$table.trigger( +_private.config.isChecked($headCheckbox) ? 'multirowselect' : 'multirowdeselect', +
[yocto] [patchwork][PATCH 1/3] series.js: support shift-select range
Selecting multiple patches in a range at the series view must be performed on one-by-one basis, providing apoor user-experience. This change allows to select patches in a range by clicking the first patch, then shift-clicking the last patch in the desired range. [YOCTO #10819] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 31 +++ 1 file changed, 31 insertions(+) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index c4bbb0e..6571b0e 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -82,6 +82,37 @@ $(document).ready(function(){ }) }) +var lastChecked = null +var $chkboxes = $( "input[name^='patch_id']" ) + +$chkboxes.click(function(e){ +if(!lastChecked) { +lastChecked = this; +return; +} + +if(e.shiftKey) { +var start = $chkboxes.index(this); +var end = $chkboxes.index(lastChecked); +var min_val = Math.min(start,end) +var max_val = Math.max(start,end)+1 + +$chkboxes.slice(min_val, max_val).prop('checked', lastChecked.checked); +for (i=min_val; ihttps://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 0/3] Support range select in patch-list
Selecting multiple items in a patch list must be done manually, one item at a time, providing a poor user experience. These changes add the jquery.tablecheckbox plugin and call it from the patch-list tables to allow users to select single / multiple / all table row(s) by clicking. A function specific to the series view is used to provide the mentioned feature too. [YOCTO #10819] Jose Lamego (3): series.js: support shift-select range jquery.tablecheckbox: add plugin for multiselect functionality patch-list: call tablecheckbox plugin from patch-list htdocs/js/jquery.tablecheckbox.js | 165 ++ htdocs/js/series.js | 31 + patchwork/templates/patchwork/patch-list.html | 2 + 3 files changed, 198 insertions(+) create mode 100644 htdocs/js/jquery.tablecheckbox.js -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 2/3] series.html: add patch and bundle edition forms and checkboxes
This change adds patch and bundle edition forms, and patch selection checkboxes. [YOCTO #10822] Signed-off-by: Jose Lamego --- patchwork/templates/patchwork/series.html | 172 ++ 1 file changed, 130 insertions(+), 42 deletions(-) diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html index 0ba1f14..3c2cad9 100644 --- a/patchwork/templates/patchwork/series.html +++ b/patchwork/templates/patchwork/series.html @@ -2,6 +2,9 @@ {% load person %} {% load static %} +{% load patch %} +{% load listurl %} + {% block title %}{{project.name}}{% endblock %} {% block headers %} @@ -78,67 +81,152 @@ function toggle_headers(link_id, headers_id) -{% if cover_letter %} - Cover Letter - - - {{ cover_letter }} - - -{% else %} - No cover letter was found for this series. -{% endif %} +{% if cover_letter %} + Cover Letter + + + {{ cover_letter }} + + +{% else %} + No cover letter was found for this series. +{% endif %} -{% for revision in revisions %} - - -Patches download mbox - - - +{% for revision in revisions %} + +Patches download mbox + + - # + {% if user.is_authenticated %} + + + + {% endif %} Name Submitter State - -{% for patch in revision.patch_list %} - - - {{ patch.name|default:"[no subject]"|truncatechars:100 }} - {{ patch.submitter|personify:project }} - {{ patch.state }} - -{% endfor %} - + {% for patch in revision.patch_list %} + + +{% if user.is_authenticated %} + + + +{% endif %} +{{ patch.name|default:"[no subject]"|truncatechars:100 }} +{{ patch.submitter|personify:project }} +{{ patch.state }} + + + {% endfor %} + - -{% if revision.test_results %} -Tests - - - -{% for test_result in revision.test_results %} -{% include "patchwork/test-result.html" %} -{% endfor %} - +{% endfor %} + + +{% if user.is_authenticated %} + + {% if patchform %} + + Series patches edit + +{% csrf_token %} + + + +Change state: + + {{ patchform.state }} + {{ patchform.state.errors }} + + + +Delegate to: + +{{ patchform.delegate }} +{{ patchform.delegate.errors }} + + + +Archive: + + {{ patchform.archived }} + {{ patchform.archived.errors }} + + + + + + Update + + + + + + {% endif %} {% endif %} +{% if createbundleform %} + +Bundling + + +Create bundle: + + {% if createbundleform.non_field_errors %} +{{createbundleform.non_field_errors}} + {% endif %} + +{% csrf_token %} + + +{% if createbundleform.name.errors %} + {{createbundleform.name.errors}} +{% endif %} +{{ createbundleform.name }} + + + + + {% if bundles %} + + Add to bundle: + + +{% csrf_token %} + + + + {% for bundle in bundles %} +{{bundle.name}} + {% endfor %} + + + + + + {% endif %} + + +{% endif %} -{% endfor %} - - {% endblock %} -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 3/3] series.js: add patch-selection-checkbox control functions
This change adds control functions for individual and multiple selection checkboxes. [YOCTO #10822] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 145 1 file changed, 125 insertions(+), 20 deletions(-) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index bd75790..c4bbb0e 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -1,27 +1,47 @@ $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip() revTab=document.getElementById('revs-list') -coverView=document.getElementById('cover-letter-view'), -patchView=document.getElementById('patch-view'), +coverView=document.getElementById('cover-letter-view') +patchView=document.getElementById('patch-view') patchList=document.getElementById('patches-list') - +patchesInput=$( "input[name^='patches']" ) +seriesForms=document.getElementById('seriesForm') +var patches = new Array() +if ($( patchesInput[0] ).value){ +patches=json_decode($( patchesInput[0] ).value, true) +} +else{ +patches=[] +} revTab.style.border='none' revTab.style.background='transparent' revTab.style.padding='15px' coverView.style.display='block' patchView.style.display='none' patchList.style.display='none' +seriesForms.style.display='none' document.getElementById('cover-letter-tab').onclick=function(){ coverView.style.display='block' patchView.style.display='none' patchList.style.display='none' +patches=[] +for (i=0; i') +}) +}) + +$( "input[name^='patch_id']" ).change(function(){ +patchView.style.display="none" +uncheck_allSel() +var p_id=$(this).attr('name').replace('patch_id:', '') +if ($(this).prop('checked')){ +insert_patchId(p_id) +for (i=0; ihttps://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 1/3] series.py: add patch and bundle edition actions to view
This change adds patch and bundle edition actions to the series view. [YOCTO # 10822] Signed-off-by: Jose Lamego --- patchwork/views/series.py | 88 --- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/patchwork/views/series.py b/patchwork/views/series.py index 7645596..cb3b721 100644 --- a/patchwork/views/series.py +++ b/patchwork/views/series.py @@ -17,6 +17,7 @@ # along with Patchwork; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +from django.http import HttpResponseForbidden from django.conf import settings from django.shortcuts import render, render_to_response from django.shortcuts import get_object_or_404, get_list_or_404 @@ -25,6 +26,7 @@ from patchwork.models import Patch, Project, Bundle from patchwork.models import Series, SeriesRevision, TestResult from patchwork.requestcontext import PatchworkRequestContext from patchwork.forms import PatchForm, CreateBundleForm +import json class SeriesListView(View): @@ -44,6 +46,9 @@ class SeriesView(View): def get(self, request, *args, **kwargs): series = get_object_or_404(Series, pk=kwargs['series']) revisions = get_list_or_404(SeriesRevision, series=series) +patchform = PatchForm(project=series.project) +createbundleform = CreateBundleForm() +bundles = Bundle.objects.filter(owner=request.user) for revision in revisions: revision.patch_list = revision.ordered_patches().\ select_related('state', 'submitter') @@ -56,19 +61,20 @@ class SeriesView(View): 'project': series.project, 'cover_letter': revision.cover_letter, 'revisions': revisions, +'patchform': patchform, +'createbundleform': createbundleform, +'bundles': bundles, }) def post(self, request, *args, **kwargs): init_data = request.POST -pa_id = init_data.get('patch', None) -curr_rev = init_data.get('rev', None) -patch = get_object_or_404(Patch, id=pa_id) +patches = json.loads(init_data.get('patches')) series = get_object_or_404(Series, pk=kwargs['series']) -context = PatchworkRequestContext(request) -context.project = patch.project -editable = patch.is_editable(request.user) - revisions = get_list_or_404(SeriesRevision, series=series) +context = PatchworkRequestContext(request) +context.project = series.project +form = None +createbundleform = None for revision in revisions: revision.patch_list = revision.ordered_patches().\ select_related('state', 'submitter') @@ -76,11 +82,6 @@ class SeriesView(View): .filter(revision=revision, patch=None) \ .order_by('test__name').select_related('test') -form = None -createbundleform = None - -if editable: -form = PatchForm(instance=patch) if request.user.is_authenticated(): createbundleform = CreateBundleForm() @@ -90,42 +91,57 @@ class SeriesView(View): action = action.lower() if action == 'createbundle': -bundle = Bundle(owner=request.user, project=patch.project) +bundle = Bundle(owner=request.user, project=series.project) createbundleform = CreateBundleForm(instance=bundle, data=request.POST) if createbundleform.is_valid(): createbundleform.save() -bundle.append_patch(patch) -bundle.save() -createbundleform = CreateBundleForm() -context.add_message('Bundle %s created' % bundle.name) elif action == 'addtobundle': bundle = get_object_or_404( Bundle, id=request.POST.get('bundle_id')) -try: -bundle.append_patch(patch) -bundle.save() -context.add_message('Patch added to bundle "%s"' % -bundle.name) -except Exception as ex: -context.add_message("Couldn't add patch '%s' to bundle %s:\ - %s" % (patch.name, bundle.name, ex.message)) - -# all other actions require edit privs -elif not editable: -return HttpResponseForbidden() - -elif action is None: -form = PatchForm(data=request.POST, instance=patch) -if form.is_valid(): -form.save() -context.add_message('Patch ID: %s updated' % patch.pk) + +for pa_id in patches: +patch = get_object_or_404(Patch, id=pa_id) +editable = patch.is_editable(re
[yocto] [patchwork][PATCH 0/3] Series: Add multiple select/change controls
Patches displayed at Series view must be individually opened to allow change status or add them to a bundle, increasing needed time and providing a poor user experience. These changes add to Series view multiple select controls and the required functionality for status change, bundle addition and new bundle creation. [YOCTO #10822] Jose Lamego (3): series.py: add patch and bundle edition actions to view series.html: add patch and bundle edition forms and checkboxes series.js: add patch-selection-checkbox control functions htdocs/js/series.js | 145 + patchwork/templates/patchwork/series.html | 172 ++ patchwork/views/series.py | 88 --- 3 files changed, 307 insertions(+), 98 deletions(-) -- 2.7.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail: Split PATCH prefix if not single
PATCH prefix is not appropriately identified as such if it is not sepparated from following word in an email Subject line. This leads to wrong email parsing and revisions not appended to initial series. This change allows appropriate email parsing by checking if PATCH prefix in Subject line is not sepparated from following word and adding a space between them. [YOCTO #10823] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index c9eb05c..6e13beb 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -578,11 +578,18 @@ def find_patch_for_comment(project, refs): split_re = re.compile(r'[,\s]+') +patch_pref = re.re.compile(r'^.*\[(\s*PATCH\w+).*', re.I) def split_prefixes(prefix): """ Turn a prefix string into a list of prefix tokens """ +# Check if PATCH prefix is followed by anoter word without a sepparation +# space. Add missing space to allow appropriate parsing +if patch_pref.match(prefix): +index = prefix.find(patch_pref.match(prefix).group(1)) +prefix = prefix[:index + 5] + ' ' + prefix[index + 5:] + matches = split_re.split(prefix) return [s for s in matches if s != ''] -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail: Process email with duplicated message-id
Current email parsing filters-out messages with a message-id that already exists in db, producing that some valid patch revisions are not processed in patchwork. This change allows for valid patches with duplicated message-id to be processed by modifying the message-id in patchwork only when email content in new message is different from that in the existing patch. [YOCTO #10756] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index c9eb05c..3d642a7 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -221,6 +221,7 @@ class MailContent: self.revision = None self.patch_order = 1# place of the patch in the series self.filenames = [] # files touched by a diff +self.msgid = None def build_references_from_headers(in_reply_to, references): @@ -419,6 +420,18 @@ def find_content(project, mail): if is_cover_letter or is_patch: msgid = mail.get('Message-Id').strip() +# check if msgid already exists in db +ex_msgid=get_object_by_msgid(Patch, msgid) +if not ex_msgid: +ex_msgid=get_object_by_msgid(Comment, msgid) +if ex_msgid and ex_msgid.content: +# modify msgid to allow processing new message only if it +# contains different content than existing Patch or Comment +if patchbuf and patchbuf!=ex_msgid.content: +refs.append(msgid) +msgid=datetime.datetime.now().isoformat() + '-' + msgid + +ret.msgid=msgid # Series get a generic name when they don't start by a cover letter or # when they haven't received the root message yet. Except when it's # only 1 patch, then the series takes the patch subject as name. @@ -762,8 +775,6 @@ def parse_mail(mail): LOGGER.error('Failed to find a project for mail') return 1 -msgid = mail.get('Message-Id').strip() - (author, save_required) = find_author(mail) content = find_content(project, mail) @@ -773,6 +784,7 @@ def parse_mail(mail): comment = content.comment series = content.series revision = content.revision +msgid = (content.msgid or mail.get('Message-Id').strip()) series_revision_complete.connect(on_revision_complete) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2 0/2] Series-view: Enable status/bundle edition
These changes enable patch status updating, adding a patch to an existing bundle and creating a new bundle from the series view. [YOCTO #10973] Changes in v2: Fixed javascript formatting and pep8 compliance. Jose Lamego (2): series.js: Get patch id and pass it to POST request series.py: Add POST call htdocs/js/series.js | 25 -- patchwork/views/series.py | 83 +-- 2 files changed, 104 insertions(+), 4 deletions(-) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2 2/2] series.py: Add POST call
Current series view is missing a POST call, avoiding users to update or edit patch status or bundles. This change adds POST call to series view, including the target patch id, which is taken from request context. [YOCTO #10973] Signed-off-by: Jose Lamego --- patchwork/views/series.py | 83 +-- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/patchwork/views/series.py b/patchwork/views/series.py index 1c14074..5fe8a74 100644 --- a/patchwork/views/series.py +++ b/patchwork/views/series.py @@ -18,9 +18,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from django.conf import settings -from django.shortcuts import render, get_object_or_404, get_list_or_404 +from django.shortcuts import render, render_to_response +from django.shortcuts import get_object_or_404, get_list_or_404 from django.views.generic import View -from patchwork.models import Project, Series, SeriesRevision, TestResult +from patchwork.models import Patch, Project, Bundle, +from patchwork.models import Series, SeriesRevision, TestResult +from patchwork.requestcontext import PatchworkRequestContext +from patchwork.forms import PatchForm, CreateBundleForm class SeriesListView(View): @@ -53,3 +57,78 @@ class SeriesView(View): 'cover_letter': revision.cover_letter, 'revisions': revisions, }) + +def post(self, request, *args, **kwargs): +init_data = request.POST +pa_id = init_data.get('patch', None) +curr_rev = init_data.get('rev', None) +patch = get_object_or_404(Patch, id=pa_id) +series = get_object_or_404(Series, pk=kwargs['series']) +context = PatchworkRequestContext(request) +context.project = patch.project +editable = patch.is_editable(request.user) + +revisions = get_list_or_404(SeriesRevision, series=series) +for revision in revisions: +revision.patch_list = revision.ordered_patches().\ +select_related('state', 'submitter') +revision.test_results = TestResult.objects \ +.filter(revision=revision, patch=None) \ +.order_by('test__name').select_related('test') + +form = None +createbundleform = None + +if editable: +form = PatchForm(instance=patch) +if request.user.is_authenticated(): +createbundleform = CreateBundleForm() + +if request.method == 'POST': +action = request.POST.get('action', None) +if action: +action = action.lower() + +if action == 'createbundle': +bundle = Bundle(owner=request.user, project=patch.project) +createbundleform = CreateBundleForm(instance=bundle, +data=request.POST) +if createbundleform.is_valid(): +createbundleform.save() +bundle.append_patch(patch) +bundle.save() +createbundleform = CreateBundleForm() +context.add_message('Bundle %s created' % bundle.name) + +elif action == 'addtobundle': +bundle = get_object_or_404( +Bundle, id=request.POST.get('bundle_id')) +try: +bundle.append_patch(patch) +bundle.save() +context.add_message('Patch added to bundle "%s"' % +bundle.name) +except Exception as ex: +context.add_message("Couldn't add patch '%s' to bundle %s:\ + %s" % (patch.name, bundle.name, ex.message)) + +# all other actions require edit privs +elif not editable: +return HttpResponseForbidden() + +elif action is None: +form = PatchForm(data=request.POST, instance=patch) +if form.is_valid(): +form.save() +context.add_message('Patch ID: %s updated' % patch.pk) + +context['series'] = series +context['patchform'] = form +context['createbundleform'] = createbundleform +context['project'] = patch.project +context['revisions'] = revisions +context['test_results'] = TestResult.objects \ +.filter(revision=None, patch=patch) \ +.order_by('test__name').select_related('test') + +return render_to_response('patchwork/series.html', context) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2 1/2] series.js: Get patch id and pass it to POST request
Patch forms in series view do not pass selected patch id as request element during a POST call, so no status/bundle updates can be performed from such view. This change includes the selected patch id as a request element and pass it to POST call through a hidden input field. [YOCTO #10973] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index 4f4f477..bd75790 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -1,5 +1,5 @@ $(document).ready(function(){ -$('[data-toggle="tooltip"]').tooltip(); +$('[data-toggle="tooltip"]').tooltip() revTab=document.getElementById('revs-list') coverView=document.getElementById('cover-letter-view'), patchView=document.getElementById('patch-view'), @@ -34,10 +34,31 @@ $(document).ready(function(){ }) $('.patch-link').on('click', function(){ +var pa=this.getAttribute("data-url") +var curr_rev=document.getElementById('revs-list').value +pa=pa.match(/\d+/)[0] coverView.style.display='none' patchView.style.display='block' patchView.innerHTML= 'Loading patch...' -$("#patch-view").load(this.getAttribute("data-url") + " #patch-body") +$("#patch-view").load( +this.getAttribute("data-url") + " #patch-body", function() { +forms=document.forms +for (i=0; ihttps://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] git-pw: include bundle sub-command
From: Leonardo Sandoval This new command allows to fetch bundles (set of selected patches by the user) and print them into the stdout. For the moment, bundles must be public (otherwise these wont be found) Command line example: openembedded-core$ git pw bundle newbundle --username lsandov1 Signed-off-by: Leonardo Sandoval --- git-pw/git-pw | 52 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/git-pw/git-pw b/git-pw/git-pw index f5fbdcb..554dfae 100755 --- a/git-pw/git-pw +++ b/git-pw/git-pw @@ -126,6 +126,11 @@ class Command(object): 'need_project' : False, 'need_auth': False, }, +'bundle': { +'need_git_repo': True, +'need_project' : False, +'need_auth': False, +}, 'list': { 'need_git_repo': True, 'need_project' : True, @@ -295,13 +300,25 @@ class Patch(RestObject): def url(self, url='/'): return '/patches/' + str(self.id) + url +class Bundle(RestObject): + +def __init__(self, patchwork, bundle_name, user): +super(Bundle, self).__init__(patchwork) +self.bundle_name = str(bundle_name) +self.user = str(user) + +def url(self, url='/'): +return '/bundle/' + self.user + '/' + self.bundle_name + url + class Patchwork(object): +api_version= 'api/1.0' + def __init__(self, web_root, project_linkname, user): if not web_root.endswith('/'): web_root += '/' -self.api_base = web_root + 'api/1.0' +self.api_base = web_root + self.api_version self.web_root = web_root self.project = Project(self, project_linkname) self.user = user @@ -372,6 +389,9 @@ class Patchwork(object): def get_patch(self, patch_id): return Patch(self, patch_id) +def get_bundle(self, bundle_name, name): +return Bundle(self, bundle_name, name) + class Terminal(object): DEFAULT_WIDTH = 80 @@ -578,15 +598,13 @@ class GitPatchwork(object): # auth mechanism. In any case, using HTTPS is a must. username = None password = None -user = None try: username = config.get(section, 'user') password = config.get(section, 'password') -user = User(username, password) except: pass -if not user and self.cmd.need_auth: +if not password and self.cmd.need_auth: die('No authentication configured.\n\n' "Please set up credentials, e.g.:\n\n" " git config patchwork.%(config)s.user myusername\n" @@ -594,6 +612,8 @@ class GitPatchwork(object): 'config': self.cmd.config, }) +user = User(username, password) + self.pw = Patchwork(web_root, project, user) self.pw.setup() @@ -679,6 +699,20 @@ class GitPatchwork(object): raise die('No patch with id %d.' % self.cmd.patch_id) +def do_bundle(self): +user = self.cmd.username or self.pw.user.username +if not user: +die('Either define a patchwork user at .git/config or set it through --username') + +bundle = self.pw.get_bundle(self.cmd.bundle_name, user) + +try: +return self._print_mbox(bundle.absolute_url('/mbox/').replace(self.pw.api_version,'')) +except HttpError as e: +if e.status_code != 404: +raise +die('No user %s bundle with name %s.' % (self.cmd.user, self.cmd.bundle_name)) + def do_list(self): project = self.pw.get_project() params = { @@ -973,6 +1007,16 @@ if __name__ == '__main__': parser_add_mbox_options(mbox_patch_parser) +# bundle +bundle_parser = subparsers.add_parser('bundle', +help='retrieve a mbox file of a bundle and print it on stdout') +bundle_parser.add_argument('--username', '-u', metavar='username', +type=str, help='the patchwork\'s user that created the bundle, use git\'s configured if omitted') +bundle_parser.add_argument('bundle_name', metavar='bundle_name', +type=str, help='the bundle to retrieve') + +parser_add_mbox_options(bundle_parser) + # poll-events poll_events_parser = subparsers.add_parser('poll-events', help='list events since the last invocation') -- 2.1.4 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 2/2] series.py: Add POST call
Current view is missing a POST call, avoiding users to update or edit patch status or bundles. This change adds POST call to series view, including the target patch id, which is taken from request context. [YOCTO #10973] Signed-off-by: Jose Lamego --- patchwork/views/series.py | 84 +-- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/patchwork/views/series.py b/patchwork/views/series.py index 1c14074..0a70232 100644 --- a/patchwork/views/series.py +++ b/patchwork/views/series.py @@ -18,9 +18,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from django.conf import settings -from django.shortcuts import render, get_object_or_404, get_list_or_404 +from django.shortcuts import render, render_to_response +from django.shortcuts import get_object_or_404, get_list_or_404 +from django.http import HttpResponseForbidden from django.views.generic import View -from patchwork.models import Project, Series, SeriesRevision, TestResult +from patchwork.models import Patch, Project, Bundle +from patchwork.models import Series, SeriesRevision, TestResult +from patchwork.requestcontext import PatchworkRequestContext +from patchwork.forms import PatchForm, CreateBundleForm class SeriesListView(View): @@ -53,3 +58,78 @@ class SeriesView(View): 'cover_letter': revision.cover_letter, 'revisions': revisions, }) + +def post(self, request, *args, **kwargs): +init_data = request.POST +pa_id = init_data.get('patch', None) +curr_rev = init_data.get('rev', None) +patch = get_object_or_404(Patch, id=pa_id) +series = get_object_or_404(Series, pk=kwargs['series']) +context = PatchworkRequestContext(request) +context.project = patch.project +editable = patch.is_editable(request.user) + +revisions = get_list_or_404(SeriesRevision, series=series) +for revision in revisions: +revision.patch_list = revision.ordered_patches().\ +select_related('state', 'submitter') +revision.test_results = TestResult.objects \ +.filter(revision=revision, patch=None) \ +.order_by('test__name').select_related('test') + +form = None +createbundleform = None + +if editable: +form = PatchForm(instance=patch) +if request.user.is_authenticated(): +createbundleform = CreateBundleForm() + +if request.method == 'POST': +action = request.POST.get('action', None) +if action: +action = action.lower() + +if action == 'createbundle': +bundle = Bundle(owner=request.user, project=patch.project) +createbundleform = CreateBundleForm(instance=bundle, +data=request.POST) +if createbundleform.is_valid(): +createbundleform.save() +bundle.append_patch(patch) +bundle.save() +createbundleform = CreateBundleForm() +context.add_message('Bundle %s created' % bundle.name) + +elif action == 'addtobundle': +bundle = get_object_or_404( +Bundle, id=request.POST.get('bundle_id')) +try: +bundle.append_patch(patch) +bundle.save() +context.add_message('Patch added to bundle "%s"' % +bundle.name) +except Exception as ex: +context.add_message("Couldn't add patch '%s' to bundle %s:\ + %s" % (patch.name, bundle.name, ex.message)) + +# all other actions require edit privs +elif not editable: +return HttpResponseForbidden() + +elif action is None: +form = PatchForm(data=request.POST, instance=patch) +if form.is_valid(): +form.save() +context.add_message('Patch ID: %s updated' % patch.pk) + +context['series'] = series +context['patchform'] = form +context['createbundleform'] = createbundleform +context['project'] = patch.project +context['revisions'] = revisions +context['test_results'] = TestResult.objects \ +.filter(revision=None, patch=patch) \ +.order_by('test__name').select_related('test') + +return render_to_response('patchwork/series.html', context) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 1/2] series.js: Get patch id and pass it to POST request
Patch forms in series view do not pass selected patch id as context element during a POST call, so no status/bundle updates can be performed from such view. This change includes the selected patch id as a context element and pass it to POST call through a hidden input field. [YOCTO #10973] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/js/series.js b/htdocs/js/series.js index 4f4f477..1795bc3 100644 --- a/htdocs/js/series.js +++ b/htdocs/js/series.js @@ -1,5 +1,5 @@ $(document).ready(function(){ -$('[data-toggle="tooltip"]').tooltip(); +$('[data-toggle="tooltip"]').tooltip() revTab=document.getElementById('revs-list') coverView=document.getElementById('cover-letter-view'), patchView=document.getElementById('patch-view'), @@ -34,10 +34,30 @@ $(document).ready(function(){ }) $('.patch-link').on('click', function(){ +var pa=this.getAttribute("data-url") +var curr_rev=document.getElementById('revs-list').value +pa=pa.match(/\d+/)[0] coverView.style.display='none' patchView.style.display='block' patchView.innerHTML= 'Loading patch...' -$("#patch-view").load(this.getAttribute("data-url") + " #patch-body") +$("#patch-view").load( +this.getAttribute("data-url") + " #patch-body", function() { +forms=document.forms +for (i=0 i < document.forms.length i++){ +var n=(i + 1) +var patch_field=document.createElement("input") +patch_field.type="hidden" +patch_field.name="patch" +patch_field.value=pa +var div=document.createElement("div") +var this_form=document.forms.item(i) +if (typeof this_form !== "undefined"){ +this_form.appendChild(div) +div.appendChild(patch_field) +} +} +} +) }) }) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 0/2] Series-view: Enable status/bundle edition
This changes enable patch status updating, adding a patch to an existing bundle and creating a new bundle from the series view. [YOCTO #10973] Jose Lamego (2): series.js: Get patch id and pass it to POST request series.py: Add POST call htdocs/js/series.js | 24 -- patchwork/views/series.py | 84 +-- 2 files changed, 104 insertions(+), 4 deletions(-) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] parsemail: Set patch state from email metadata
Patch state can only be set/changed at patchwork web interface, resulting in a poor user experience for project maintainers. This change allows project maintainers to change a patch status directly from an email message sent as a reply to the related mailing list thread by including a the string "[Patchwork-Status: ]" [YOCTO #10624] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 31 +++ 1 file changed, 31 insertions(+) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 1ce0cdf..eb92243 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -820,6 +820,37 @@ def parse_mail(mail): comment.save() LOGGER.debug('Comment saved') +# if comment's author has project-maintainer permissions, +# parse comment content and process the status-change command +# if it is found +if project in (author.user).profile.maintainer_projects.all(): +cmd = None +comment_re = re.compile('^\[Patchwork-Status:\s*(Under Review|\ +Rejected|RFC|Not Applicable|Changes Requested|Awaiting Upstream|Superseded|\ +Deferred)\]$', re.M | re.I) +# if multiple valid status-change commands are found, use last one +for match in comment_re.finditer(comment.content): +cmd = re.sub(r'(\[Patchwork-Status:\s*)(.*)(\])', r'\2', + "{}".format(match.group(0))) +if cmd is not None: +new_state = State.objects.get(name=cmd.title()) +mod_patch = Patch.objects.get(pk=comment.patch.pk) +if new_state and mod_patch.state != new_state: +mod_patch.state = new_state +mod_patch.save() +cmd_message = 'This is a system generated Comment: Patch \ +%s status was updated to "%s" due to request in comment.' % ( + comment.patch.pk, cmd) +cmd_msgid = "%s: System generated by comment %s" % ( +datetime.datetime.now().strftime("\ +%d%b%Y.%H:%M:%S.%f"), comment.pk) +new_comment = Comment(pk=None, patch=comment.patch, + content=cmd_message, + date=datetime.datetime.now(), + submitter=comment.submitter, + msgid=cmd_msgid) +new_comment.save() + series_revision_complete.disconnect(on_revision_complete) return 0 -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] Patchwork and incoming patch testing
Hi all, As some of you are aware some of my colleagues and I have been working on improving how incoming patches are handled - initially for OE-Core but we hope to arrive at something that will be useful for other layers as well. The aim was to do so without adversely affecting existing workflows, so that means building on top of the things we already have. It's taken a bit longer than we'd originally planned - we embarked on this a little over a year ago [1] - but now I am happy to be able to show some meaningful progress. A few months ago we upgraded OE's patchwork instance [2], moving not just to a later version but to a fork of patchwork where a bunch of new functionality was being developed for freedesktop.org [3], notably support for capturing and presenting patch series instead of just individual patches. There were some teething problems but we've now resolved most of them. Unfortunately work on said freedesktop.org fork appears to have stalled so for now we have forked it ourselves [4]; long term we'll have to see if we can merge back with patchwork upstream - at least for small fixes we'll try to push those back up independent of any wholesale merge. In any event we are now finally in the position where our patchwork instance can be relied upon to collect emails, and the UI is much improved. This should give us a bit more visibility into where patches are at in the process, although we are still working on a few places where patch series status needs to be updated (e.g. when a patch goes into testing). On top of patchwork we have built a simple smoke-testing framework called "patchtest" [5] along with a suite of corresponding tests for OE [6]. These tests are fairly simplistic at this point but check the basics such as whether a patch has been properly signed off, etc. We should soon start seeing replies sent to the mailing list and to submitters with results if there are any failures, saving us from noticing and pointing out some of the more obvious classes of mistakes. The tests are easy to run locally without the rest of the infrastructure and can be extended without difficulty, and I expect we'll continue to work on those as time progresses. Contributions would be very welcome. My sincere thanks to José Lamego, Leonardo Sandoval, Daniela Plascencia, Belen Barros Pena, Michael Halstead, Damien Lespiau, Patrick Ohly and others that have been part of implementing this, and to everyone else who has put up with the delays. Please let us know if you have issues with any part of this process or suggestions on how to improve it. We're tracking improvements in the Yocto Project bugzilla [7] so you can see what's being worked on there if you're interested. Cheers, Paul [1] Earlier announcement: https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg72952.html [2] OE's patchwork instance: http://patchwork.openembedded.org [3] Freedesktop.org patchwork fork: https://github.com/dlespiau/patchwork [4] Our patchwork fork: http://git.yoctoproject.org/cgit/cgit.cgi/patchwork/ [5] Patchtest main repository: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest/ [6] OE test suite for patchtest: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe/ [7] Yocto Project bugzilla area for patchwork/patchtest: https://bugzilla.yoctoproject.org/describecomponents.cgi?product=Patchwork%2FPatchtest -- Paul Eggleton Intel Open Source Technology Centre -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork/bin/parsemail: Improve new patch filtering
From: Jose Lamego Patchwork may incorrectly identify emails containing patch-like content or that are replies/forwards from a previous message as patches, thus wrongly creating a new series revision. This change makes "[PATCH" prefix in subject mandatory for emails to be considered as possible new patches, and makes any email with a subject starting with any character other than a square bracket ("[") to be handled as a possible comment to an existing patch. [YOCTO #10764] [YOCTO #10877] Signed-off-by: Jose Lamego --- Notes: v2 renamed to reflect that the subject filtering now includes ruling-out emails with a Subject header not starting with the expected square bracket patchwork/bin/parsemail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 1c2c774..94c7669 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,7 +399,8 @@ def find_content(project, mail): refs = build_references_list(mail) is_root = refs == [] is_cover_letter = is_root and x == 0 -is_patch = patchbuf is not None +patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) +is_patch = patchbuf is not None and patch_prefix drop_patch = not is_attachment and \ project.git_send_email_only and not is_git_send_email(mail) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
On 01/09/2017 04:49 AM, Patrick Ohly wrote: >... > > I'm wondering if we can address two bugs with the same fix, something > that requires that the Subject line is starting with a set of tags plus > the [PATCH] tag. For example: > > patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) > Based on Patrick's suggestion, v2 of this patch would require for any new email message to be handled as a likely new patch (message content still needs to be parsed as usual): - Message subject MUST start only with any of the accepted OE layer's prefixes; in other words, subject must start with square bracket "[" plus prefix (maybe only the bracket will be enough). and - Message subject MUST contain the "[PATCH" prefix. messages with a subject that starts with any other character (including "Re: " and "Fwd: " or that do not include the "[PATCH" prefix will be handled either as a comment to an existing patch or as an ordinary mailing list post, depending on the included email references and content parsing. I see no conflicts with steps on the wiki "How to submit a patch to OpenEmbedded": http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded Please provide feedback on this approach before I implement a test in the staging instance. -- Jose Lamego | OTC Embedded Platforms & Tools | GDC signature.asc Description: OpenPGP digital signature -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
I just want to make sure that we dont pile collection of patches that we end up maintaining forever. On Mon, Jan 9, 2017 at 12:34 PM, Jose Lamego wrote: > > > On 01/09/2017 02:30 PM, Khem Raj wrote: >> On Mon, Jan 9, 2017 at 12:21 PM, Jose Lamego >> wrote: >>> >>> >>> On 01/09/2017 12:44 PM, Khem Raj wrote: >>>> On Fri, Jan 6, 2017 at 6:50 AM, Jose Lamego >>>> wrote: >>>>> From: Jose Lamego >>>>> >>>>> Reviewing patches from a series requires heavy usage of the >>>>> browser navigation buttons, providing a poor UX. >>>>> >>>>> This changes allows viewing content from each patch in a series, >>>>> without leaving the series view. >>>>> >>>> >>>> The patch looks fine to me. Are you also posting these to upstream >>>> patchwork ? >>> >>> Thanks for the review Khem. These changes currently are going only to >>> the Yocto-Patchwork repository [1]. Upstream [2] has been not-maintained >>> for a while. >> >> The upstream is >> http://jk.ozlabs.org/projects/patchwork/ >> > Yes, freedesktop's patchwork forked from ozlabs' but diverged some time > ago. I haven't try to apply these changes on top of that (maybe worth it). >>> >>> You can view a working example of the view in patchwork-staging [3]. >>> Production will be updated soon. >>> >>> [1] https://git.yoctoproject.org/git/patchwork >>> [2] https://github.com/dlespiau/patchwork >>> [3] https://patchwork-staging.openembedded.org >>>> >>>>> [YOCTO #10627] >>>>> >>>>> Signed-off-by: Jose Lamego >>>>> --- >>>>> htdocs/js/series.js | 43 +++ >>>>> patchwork/templates/patchwork/patch.html | 15 ++-- >>>>> patchwork/templates/patchwork/series.html | 114 >>>>> -- >>>>> 3 files changed, 113 insertions(+), 59 deletions(-) >>>>> create mode 100644 htdocs/js/series.js >>>>> >>>>> diff --git a/htdocs/js/series.js b/htdocs/js/series.js >>>>> new file mode 100644 >>>>> index 000..4f4f477 >>>>> --- /dev/null >>>>> +++ b/htdocs/js/series.js >>>>> @@ -0,0 +1,43 @@ >>>>> +$(document).ready(function(){ >>>>> +$('[data-toggle="tooltip"]').tooltip(); >>>>> +revTab=document.getElementById('revs-list') >>>>> +coverView=document.getElementById('cover-letter-view'), >>>>> +patchView=document.getElementById('patch-view'), >>>>> +patchList=document.getElementById('patches-list') >>>>> + >>>>> +revTab.style.border='none' >>>>> +revTab.style.background='transparent' >>>>> +revTab.style.padding='15px' >>>>> +coverView.style.display='block' >>>>> +patchView.style.display='none' >>>>> +patchList.style.display='none' >>>>> + >>>>> +document.getElementById('cover-letter-tab').onclick=function(){ >>>>> +coverView.style.display='block' >>>>> +patchView.style.display='none' >>>>> +patchList.style.display='none' >>>>> +} >>>>> + >>>>> +document.getElementById('patches-tab').onclick=function(){ >>>>> +coverView.style.display='none' >>>>> +patchList.style.display='block' >>>>> +patchView.style.display="none" >>>>> +} >>>>> + >>>>> +$('#revs-list').on('change', function(e){ >>>>> +var optionSelected=$("option:selected", this) >>>>> +jQuery('.tab-content div.tab-pane.fade.in.active'). >>>>> +removeClass(' in active') >>>>> +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). >>>>> +addClass(' in active') >>>>> +patchView.style.display='none' >>>>> +}) >>>>> + >>>>> +$('.patch-link').on('click',
Re: [yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
On 01/09/2017 02:30 PM, Khem Raj wrote: > On Mon, Jan 9, 2017 at 12:21 PM, Jose Lamego > wrote: >> >> >> On 01/09/2017 12:44 PM, Khem Raj wrote: >>> On Fri, Jan 6, 2017 at 6:50 AM, Jose Lamego >>> wrote: >>>> From: Jose Lamego >>>> >>>> Reviewing patches from a series requires heavy usage of the >>>> browser navigation buttons, providing a poor UX. >>>> >>>> This changes allows viewing content from each patch in a series, >>>> without leaving the series view. >>>> >>> >>> The patch looks fine to me. Are you also posting these to upstream >>> patchwork ? >> >> Thanks for the review Khem. These changes currently are going only to >> the Yocto-Patchwork repository [1]. Upstream [2] has been not-maintained >> for a while. > > The upstream is > http://jk.ozlabs.org/projects/patchwork/ > Yes, freedesktop's patchwork forked from ozlabs' but diverged some time ago. I haven't try to apply these changes on top of that (maybe worth it). >> >> You can view a working example of the view in patchwork-staging [3]. >> Production will be updated soon. >> >> [1] https://git.yoctoproject.org/git/patchwork >> [2] https://github.com/dlespiau/patchwork >> [3] https://patchwork-staging.openembedded.org >>> >>>> [YOCTO #10627] >>>> >>>> Signed-off-by: Jose Lamego >>>> --- >>>> htdocs/js/series.js | 43 +++ >>>> patchwork/templates/patchwork/patch.html | 15 ++-- >>>> patchwork/templates/patchwork/series.html | 114 >>>> -- >>>> 3 files changed, 113 insertions(+), 59 deletions(-) >>>> create mode 100644 htdocs/js/series.js >>>> >>>> diff --git a/htdocs/js/series.js b/htdocs/js/series.js >>>> new file mode 100644 >>>> index 000..4f4f477 >>>> --- /dev/null >>>> +++ b/htdocs/js/series.js >>>> @@ -0,0 +1,43 @@ >>>> +$(document).ready(function(){ >>>> +$('[data-toggle="tooltip"]').tooltip(); >>>> +revTab=document.getElementById('revs-list') >>>> +coverView=document.getElementById('cover-letter-view'), >>>> +patchView=document.getElementById('patch-view'), >>>> +patchList=document.getElementById('patches-list') >>>> + >>>> +revTab.style.border='none' >>>> +revTab.style.background='transparent' >>>> +revTab.style.padding='15px' >>>> +coverView.style.display='block' >>>> +patchView.style.display='none' >>>> +patchList.style.display='none' >>>> + >>>> +document.getElementById('cover-letter-tab').onclick=function(){ >>>> +coverView.style.display='block' >>>> +patchView.style.display='none' >>>> +patchList.style.display='none' >>>> +} >>>> + >>>> +document.getElementById('patches-tab').onclick=function(){ >>>> +coverView.style.display='none' >>>> +patchList.style.display='block' >>>> +patchView.style.display="none" >>>> +} >>>> + >>>> +$('#revs-list').on('change', function(e){ >>>> +var optionSelected=$("option:selected", this) >>>> +jQuery('.tab-content div.tab-pane.fade.in.active'). >>>> +removeClass(' in active') >>>> +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). >>>> +addClass(' in active') >>>> +patchView.style.display='none' >>>> +}) >>>> + >>>> +$('.patch-link').on('click', function(){ >>>> +coverView.style.display='none' >>>> +patchView.style.display='block' >>>> +patchView.innerHTML= >>>> +'Loading patch...' >>>> +$("#patch-view").load(this.getAttribute("data-url") + " >>>> #patch-body") >>>> +}) >>>> +}) >>>> diff --git a/patchwork/templates/patchwork/patch.html >>>&g
Re: [yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
On Mon, Jan 9, 2017 at 12:21 PM, Jose Lamego wrote: > > > On 01/09/2017 12:44 PM, Khem Raj wrote: >> On Fri, Jan 6, 2017 at 6:50 AM, Jose Lamego >> wrote: >>> From: Jose Lamego >>> >>> Reviewing patches from a series requires heavy usage of the >>> browser navigation buttons, providing a poor UX. >>> >>> This changes allows viewing content from each patch in a series, >>> without leaving the series view. >>> >> >> The patch looks fine to me. Are you also posting these to upstream patchwork >> ? > > Thanks for the review Khem. These changes currently are going only to > the Yocto-Patchwork repository [1]. Upstream [2] has been not-maintained > for a while. The upstream is http://jk.ozlabs.org/projects/patchwork/ > > You can view a working example of the view in patchwork-staging [3]. > Production will be updated soon. > > [1] https://git.yoctoproject.org/git/patchwork > [2] https://github.com/dlespiau/patchwork > [3] https://patchwork-staging.openembedded.org >> >>> [YOCTO #10627] >>> >>> Signed-off-by: Jose Lamego >>> --- >>> htdocs/js/series.js | 43 +++ >>> patchwork/templates/patchwork/patch.html | 15 ++-- >>> patchwork/templates/patchwork/series.html | 114 >>> -- >>> 3 files changed, 113 insertions(+), 59 deletions(-) >>> create mode 100644 htdocs/js/series.js >>> >>> diff --git a/htdocs/js/series.js b/htdocs/js/series.js >>> new file mode 100644 >>> index 000..4f4f477 >>> --- /dev/null >>> +++ b/htdocs/js/series.js >>> @@ -0,0 +1,43 @@ >>> +$(document).ready(function(){ >>> +$('[data-toggle="tooltip"]').tooltip(); >>> +revTab=document.getElementById('revs-list') >>> +coverView=document.getElementById('cover-letter-view'), >>> +patchView=document.getElementById('patch-view'), >>> +patchList=document.getElementById('patches-list') >>> + >>> +revTab.style.border='none' >>> +revTab.style.background='transparent' >>> +revTab.style.padding='15px' >>> +coverView.style.display='block' >>> +patchView.style.display='none' >>> +patchList.style.display='none' >>> + >>> +document.getElementById('cover-letter-tab').onclick=function(){ >>> +coverView.style.display='block' >>> +patchView.style.display='none' >>> +patchList.style.display='none' >>> +} >>> + >>> +document.getElementById('patches-tab').onclick=function(){ >>> +coverView.style.display='none' >>> +patchList.style.display='block' >>> +patchView.style.display="none" >>> +} >>> + >>> +$('#revs-list').on('change', function(e){ >>> +var optionSelected=$("option:selected", this) >>> +jQuery('.tab-content div.tab-pane.fade.in.active'). >>> +removeClass(' in active') >>> +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). >>> +addClass(' in active') >>> +patchView.style.display='none' >>> +}) >>> + >>> +$('.patch-link').on('click', function(){ >>> +coverView.style.display='none' >>> +patchView.style.display='block' >>> +patchView.innerHTML= >>> +'Loading patch...' >>> +$("#patch-view").load(this.getAttribute("data-url") + " >>> #patch-body") >>> +}) >>> +}) >>> diff --git a/patchwork/templates/patchwork/patch.html >>> b/patchwork/templates/patchwork/patch.html >>> index 5ce540d..59df19d 100644 >>> --- a/patchwork/templates/patchwork/patch.html >>> +++ b/patchwork/templates/patchwork/patch.html >>> @@ -7,6 +7,7 @@ >>> {% block title %}{{patch.name}}{% endblock %} >>> >>> {% block body %} >>> + >>> >>> function toggle_headers(link_id, headers_id) >>> { >>> @@ -25,10 +26,12 @@ function toggle_headers(link_id, headers_id) >>> >>> } >>> >>>
Re: [yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
On 01/09/2017 12:44 PM, Khem Raj wrote: > On Fri, Jan 6, 2017 at 6:50 AM, Jose Lamego > wrote: >> From: Jose Lamego >> >> Reviewing patches from a series requires heavy usage of the >> browser navigation buttons, providing a poor UX. >> >> This changes allows viewing content from each patch in a series, >> without leaving the series view. >> > > The patch looks fine to me. Are you also posting these to upstream patchwork ? Thanks for the review Khem. These changes currently are going only to the Yocto-Patchwork repository [1]. Upstream [2] has been not-maintained for a while. You can view a working example of the view in patchwork-staging [3]. Production will be updated soon. [1] https://git.yoctoproject.org/git/patchwork [2] https://github.com/dlespiau/patchwork [3] https://patchwork-staging.openembedded.org > >> [YOCTO #10627] >> >> Signed-off-by: Jose Lamego >> --- >> htdocs/js/series.js | 43 +++ >> patchwork/templates/patchwork/patch.html | 15 ++-- >> patchwork/templates/patchwork/series.html | 114 >> -- >> 3 files changed, 113 insertions(+), 59 deletions(-) >> create mode 100644 htdocs/js/series.js >> >> diff --git a/htdocs/js/series.js b/htdocs/js/series.js >> new file mode 100644 >> index 000..4f4f477 >> --- /dev/null >> +++ b/htdocs/js/series.js >> @@ -0,0 +1,43 @@ >> +$(document).ready(function(){ >> +$('[data-toggle="tooltip"]').tooltip(); >> +revTab=document.getElementById('revs-list') >> +coverView=document.getElementById('cover-letter-view'), >> +patchView=document.getElementById('patch-view'), >> +patchList=document.getElementById('patches-list') >> + >> +revTab.style.border='none' >> +revTab.style.background='transparent' >> +revTab.style.padding='15px' >> +coverView.style.display='block' >> +patchView.style.display='none' >> +patchList.style.display='none' >> + >> +document.getElementById('cover-letter-tab').onclick=function(){ >> +coverView.style.display='block' >> +patchView.style.display='none' >> +patchList.style.display='none' >> +} >> + >> +document.getElementById('patches-tab').onclick=function(){ >> +coverView.style.display='none' >> +patchList.style.display='block' >> +patchView.style.display="none" >> +} >> + >> +$('#revs-list').on('change', function(e){ >> +var optionSelected=$("option:selected", this) >> +jQuery('.tab-content div.tab-pane.fade.in.active'). >> +removeClass(' in active') >> +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). >> +addClass(' in active') >> +patchView.style.display='none' >> +}) >> + >> +$('.patch-link').on('click', function(){ >> +coverView.style.display='none' >> +patchView.style.display='block' >> +patchView.innerHTML= >> +'Loading patch...' >> +$("#patch-view").load(this.getAttribute("data-url") + " >> #patch-body") >> +}) >> +}) >> diff --git a/patchwork/templates/patchwork/patch.html >> b/patchwork/templates/patchwork/patch.html >> index 5ce540d..59df19d 100644 >> --- a/patchwork/templates/patchwork/patch.html >> +++ b/patchwork/templates/patchwork/patch.html >> @@ -7,6 +7,7 @@ >> {% block title %}{{patch.name}}{% endblock %} >> >> {% block body %} >> + >> >> function toggle_headers(link_id, headers_id) >> { >> @@ -25,10 +26,12 @@ function toggle_headers(link_id, headers_id) >> >> } >> >> - >> + >> {{ patch.name }} >> >> Submitted by {{ patch.submitter|personify:project }} on {{ >> patch.date }} >> +| >> +Patch ID: {{ patch.id }} >> >> >> Details >> @@ -134,10 +137,10 @@ function toggle_headers(link_id, headers_id) >> >> {% csrf_token %} >> >> - >> -{% for bundle in bundles %} >> - {{bundle.name}} >> -{% endfor %} >> + >> + {% for bun
Re: [yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
On Fri, Jan 6, 2017 at 6:50 AM, Jose Lamego wrote: > From: Jose Lamego > > Reviewing patches from a series requires heavy usage of the > browser navigation buttons, providing a poor UX. > > This changes allows viewing content from each patch in a series, > without leaving the series view. > The patch looks fine to me. Are you also posting these to upstream patchwork ? > [YOCTO #10627] > > Signed-off-by: Jose Lamego > --- > htdocs/js/series.js | 43 +++ > patchwork/templates/patchwork/patch.html | 15 ++-- > patchwork/templates/patchwork/series.html | 114 > -- > 3 files changed, 113 insertions(+), 59 deletions(-) > create mode 100644 htdocs/js/series.js > > diff --git a/htdocs/js/series.js b/htdocs/js/series.js > new file mode 100644 > index 000..4f4f477 > --- /dev/null > +++ b/htdocs/js/series.js > @@ -0,0 +1,43 @@ > +$(document).ready(function(){ > +$('[data-toggle="tooltip"]').tooltip(); > +revTab=document.getElementById('revs-list') > +coverView=document.getElementById('cover-letter-view'), > +patchView=document.getElementById('patch-view'), > +patchList=document.getElementById('patches-list') > + > +revTab.style.border='none' > +revTab.style.background='transparent' > +revTab.style.padding='15px' > +coverView.style.display='block' > +patchView.style.display='none' > +patchList.style.display='none' > + > +document.getElementById('cover-letter-tab').onclick=function(){ > +coverView.style.display='block' > +patchView.style.display='none' > +patchList.style.display='none' > +} > + > +document.getElementById('patches-tab').onclick=function(){ > +coverView.style.display='none' > +patchList.style.display='block' > +patchView.style.display="none" > +} > + > +$('#revs-list').on('change', function(e){ > +var optionSelected=$("option:selected", this) > +jQuery('.tab-content div.tab-pane.fade.in.active'). > +removeClass(' in active') > +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). > +addClass(' in active') > +patchView.style.display='none' > +}) > + > +$('.patch-link').on('click', function(){ > +coverView.style.display='none' > +patchView.style.display='block' > +patchView.innerHTML= > +'Loading patch...' > +$("#patch-view").load(this.getAttribute("data-url") + " #patch-body") > +}) > +}) > diff --git a/patchwork/templates/patchwork/patch.html > b/patchwork/templates/patchwork/patch.html > index 5ce540d..59df19d 100644 > --- a/patchwork/templates/patchwork/patch.html > +++ b/patchwork/templates/patchwork/patch.html > @@ -7,6 +7,7 @@ > {% block title %}{{patch.name}}{% endblock %} > > {% block body %} > + > > function toggle_headers(link_id, headers_id) > { > @@ -25,10 +26,12 @@ function toggle_headers(link_id, headers_id) > > } > > - > + > {{ patch.name }} > > Submitted by {{ patch.submitter|personify:project }} on {{ > patch.date }} > +| > +Patch ID: {{ patch.id }} > > > Details > @@ -134,10 +137,10 @@ function toggle_headers(link_id, headers_id) > > {% csrf_token %} > > - > -{% for bundle in bundles %} > - {{bundle.name}} > -{% endfor %} > + > + {% for bundle in bundles %} > + {{bundle.name}} > + {% endfor %} > > > > @@ -219,5 +222,5 @@ function toggle_headers(link_id, headers_id) > > > {% endfor %} > - > + > {% endblock %} > diff --git a/patchwork/templates/patchwork/series.html > b/patchwork/templates/patchwork/series.html > index c0a5261..6c35212 100644 > --- a/patchwork/templates/patchwork/series.html > +++ b/patchwork/templates/patchwork/series.html > @@ -1,6 +1,7 @@ > {% extends "base.html" %} > > {% load person %} > +{% load static %} > > {% block title %}{{project.name}}{% endblock %} > {% block headers %} > @@ -9,64 +10,70 @@ $(function () { > pw.setup_series({ patches: 'series-patchlist' }); > }); > > + > {% endblock %} > > {% block body %} > -{{ series.name }} > - > - > - Submitted by {{ series.submitter|personify:project }} on {{ > series.submitted }} > - > - > -Details > + {{ series.name }} > + > + > +Submitted by {{ series.submitter|personify:project }} on {{ > series.submitted }} > +| > +Reviewer: {{ series.reviewer }} > +| > +Updated on: {{ series.last_updated }} > +| > +Series ID: {{ series.pk }} > + > > - > - > -Reviewer > -{% if series.reviewer %} > -{{ series.reviewer.name }} > -{% else %} > -None > -{% endif %} > - > - > -Submitted > -{{ series.submitted }} > - > - > -Last Updated > -{{ series.last_updated }} > - > - > -Revision > -{{ series.last_revision.version }} > - > - > + id="series-navigation"> > + > + > + data-toggle="col
Re: [yocto] [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
On Fri, 2017-01-06 at 17:03 -0600, Jose Lamego wrote: > Patchwork may incorrectly identify emails containing patch-like content as > patches. > This change makes "[PATCH" prefix in subject mandatory for emails to be > considered as new patches. > > [YOCTO #10764] > > Signed-off-by: Jose Lamego > --- > patchwork/bin/parsemail.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py > index 476118d..8d6529c 100755 > --- a/patchwork/bin/parsemail.py > +++ b/patchwork/bin/parsemail.py > @@ -399,7 +399,8 @@ def find_content(project, mail): > refs = build_references_list(mail) > is_root = refs == [] > is_cover_letter = is_root and x == 0 > -is_patch = patchbuf is not None > +patch_prefix = re.search('\[\s*PATCH', mail.get('Subject')) > +is_patch = patchbuf is not None and patch_prefix This is indeed enough to weed out diffs that were inlined in normal discussions (example from YOCTO #10764). But we also have other examples and another bug (YOCTO #10877) where a reply to a patch caused patchwork to create a new entry: Subject: Re: [OE-core] [PATCH v2 1/2] grub_git: extend recipe for proper target deployment ... Ping! I'm wondering if we can address two bugs with the same fix, something that requires that the Subject line is starting with a set of tags plus the [PATCH] tag. For example: patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) -- Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter. -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
Patchwork may incorrectly identify emails containing patch-like content as patches. This change makes "[PATCH" prefix in subject mandatory for emails to be considered as new patches. [YOCTO #10764] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 476118d..8d6529c 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -399,7 +399,8 @@ def find_content(project, mail): refs = build_references_list(mail) is_root = refs == [] is_cover_letter = is_root and x == 0 -is_patch = patchbuf is not None +patch_prefix = re.search('\[\s*PATCH', mail.get('Subject')) +is_patch = patchbuf is not None and patch_prefix drop_patch = not is_attachment and \ project.git_send_email_only and not is_git_send_email(mail) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork/templates/patchwork/series: Improve series view
From: Jose Lamego Reviewing patches from a series requires heavy usage of the browser navigation buttons, providing a poor UX. This changes allows viewing content from each patch in a series, without leaving the series view. [YOCTO #10627] Signed-off-by: Jose Lamego --- htdocs/js/series.js | 43 +++ patchwork/templates/patchwork/patch.html | 15 ++-- patchwork/templates/patchwork/series.html | 114 -- 3 files changed, 113 insertions(+), 59 deletions(-) create mode 100644 htdocs/js/series.js diff --git a/htdocs/js/series.js b/htdocs/js/series.js new file mode 100644 index 000..4f4f477 --- /dev/null +++ b/htdocs/js/series.js @@ -0,0 +1,43 @@ +$(document).ready(function(){ +$('[data-toggle="tooltip"]').tooltip(); +revTab=document.getElementById('revs-list') +coverView=document.getElementById('cover-letter-view'), +patchView=document.getElementById('patch-view'), +patchList=document.getElementById('patches-list') + +revTab.style.border='none' +revTab.style.background='transparent' +revTab.style.padding='15px' +coverView.style.display='block' +patchView.style.display='none' +patchList.style.display='none' + +document.getElementById('cover-letter-tab').onclick=function(){ +coverView.style.display='block' +patchView.style.display='none' +patchList.style.display='none' +} + +document.getElementById('patches-tab').onclick=function(){ +coverView.style.display='none' +patchList.style.display='block' +patchView.style.display="none" +} + +$('#revs-list').on('change', function(e){ +var optionSelected=$("option:selected", this) +jQuery('.tab-content div.tab-pane.fade.in.active'). +removeClass(' in active') +jQuery('.tab-content div#'+this.value+'.tab-pane.fade'). +addClass(' in active') +patchView.style.display='none' +}) + +$('.patch-link').on('click', function(){ +coverView.style.display='none' +patchView.style.display='block' +patchView.innerHTML= +'Loading patch...' +$("#patch-view").load(this.getAttribute("data-url") + " #patch-body") +}) +}) diff --git a/patchwork/templates/patchwork/patch.html b/patchwork/templates/patchwork/patch.html index 5ce540d..59df19d 100644 --- a/patchwork/templates/patchwork/patch.html +++ b/patchwork/templates/patchwork/patch.html @@ -7,6 +7,7 @@ {% block title %}{{patch.name}}{% endblock %} {% block body %} + function toggle_headers(link_id, headers_id) { @@ -25,10 +26,12 @@ function toggle_headers(link_id, headers_id) } - + {{ patch.name }} Submitted by {{ patch.submitter|personify:project }} on {{ patch.date }} +| +Patch ID: {{ patch.id }} Details @@ -134,10 +137,10 @@ function toggle_headers(link_id, headers_id) {% csrf_token %} - -{% for bundle in bundles %} - {{bundle.name}} -{% endfor %} + + {% for bundle in bundles %} + {{bundle.name}} + {% endfor %} @@ -219,5 +222,5 @@ function toggle_headers(link_id, headers_id) {% endfor %} - + {% endblock %} diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html index c0a5261..6c35212 100644 --- a/patchwork/templates/patchwork/series.html +++ b/patchwork/templates/patchwork/series.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load person %} +{% load static %} {% block title %}{{project.name}}{% endblock %} {% block headers %} @@ -9,64 +10,70 @@ $(function () { pw.setup_series({ patches: 'series-patchlist' }); }); + {% endblock %} {% block body %} -{{ series.name }} - - - Submitted by {{ series.submitter|personify:project }} on {{ series.submitted }} - - -Details + {{ series.name }} + + +Submitted by {{ series.submitter|personify:project }} on {{ series.submitted }} +| +Reviewer: {{ series.reviewer }} +| +Updated on: {{ series.last_updated }} +| +Series ID: {{ series.pk }} + - - -Reviewer -{% if series.reviewer %} -{{ series.reviewer.name }} -{% else %} -None -{% endif %} - - -Submitted -{{ series.submitted }} - - -Last Updated -{{ series.last_updated }} - - -Revision -{{ series.last_revision.version }} - - + + + + + Toggle navigation + + + + + + + + + + {% for revision in revisions %} + + Revision {{ revision.version }} + + {% endfor %} + + + +Cover letter + + + + Patches ({{ series.latest_revision.n_patches }}) + + + + + + + {% if cover
Re: [yocto] [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
On 12/05/2016 02:30 AM, Patrick Ohly wrote: > On Fri, 2016-12-02 at 14:29 -0600, Jose Lamego wrote: >> Patch Series created without a cover letter are named using a >> non-descriptive generic string. >> >> This change names the series using either the first 30 characters in >> patch #1 plus the remaining patches number, or the patch name for >> one-patch (1/1) series. >> >> [YOCTO #10625] >> >> Signed-off-by: Jose Lamego >> --- >> patchwork/models.py | 13 + >> 1 file changed, 13 insertions(+) > > When you send different versions of your patches, can you include a > revision history? Otherwise, it's hard to see what changes between the > different iterations. > > git notes can be used for that for single-commit changes. See "git > format-patch --notes" and "git notes". Got it, thanks for the tip. > >> diff --git a/patchwork/models.py b/patchwork/models.py >> index 3f531e6..1521641 100644 >> --- a/patchwork/models.py >> +++ b/patchwork/models.py >> @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): >> def _on_revision_complete(sender, revision, **kwargs): >> series = revision.series >> >> +# Now we know how many patches are in the revision, >> +# so we can update the name for series without a cover letter >> +if series.name == SERIES_DEFAULT_NAME: >> +name = series.latest_revision().ordered_patches()[0].name >> +n = re.compile(r'(\[\d+\/\d+\]\s?)') >> +name = n.sub('', name) >> +c = len(series.latest_revision().ordered_patches()) >> +# For one-patch series (1/1) without cover letter >> +if c == 1: >> +series.name = name >> +elif c > 1: >> +series.name = "\"%s...\" and %s more" % (name[:30], c-1) >> + >> # update series.last_revision >> series.last_revision = series.latest_revision() >> series.save() > > Looks reasonable to me, but I don't really know the code. Were you > testing this and noticed cases with c == 0, i.e. cases where the last > series,name change didn't make sense? > Correct. There are cases where only a cover letter is sent (for example, consolidated pull requests) so the patches number is 0. -- Jose Lamego | OTC Embedded Platforms & Tools | GDC signature.asc Description: OpenPGP digital signature -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
On Fri, 2016-12-02 at 14:29 -0600, Jose Lamego wrote: > Patch Series created without a cover letter are named using a > non-descriptive generic string. > > This change names the series using either the first 30 characters in > patch #1 plus the remaining patches number, or the patch name for > one-patch (1/1) series. > > [YOCTO #10625] > > Signed-off-by: Jose Lamego > --- > patchwork/models.py | 13 + > 1 file changed, 13 insertions(+) When you send different versions of your patches, can you include a revision history? Otherwise, it's hard to see what changes between the different iterations. git notes can be used for that for single-commit changes. See "git format-patch --notes" and "git notes". > diff --git a/patchwork/models.py b/patchwork/models.py > index 3f531e6..1521641 100644 > --- a/patchwork/models.py > +++ b/patchwork/models.py > @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): > def _on_revision_complete(sender, revision, **kwargs): > series = revision.series > > +# Now we know how many patches are in the revision, > +# so we can update the name for series without a cover letter > +if series.name == SERIES_DEFAULT_NAME: > +name = series.latest_revision().ordered_patches()[0].name > +n = re.compile(r'(\[\d+\/\d+\]\s?)') > +name = n.sub('', name) > +c = len(series.latest_revision().ordered_patches()) > +# For one-patch series (1/1) without cover letter > +if c == 1: > +series.name = name > +elif c > 1: > +series.name = "\"%s...\" and %s more" % (name[:30], c-1) > + > # update series.last_revision > series.last_revision = series.latest_revision() > series.save() Looks reasonable to me, but I don't really know the code. Were you testing this and noticed cases with c == 0, i.e. cases where the last series,name change didn't make sense? -- Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter. -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
Patch Series created without a cover letter are named using a non-descriptive generic string. This change names the series using either the first 30 characters in patch #1 plus the remaining patches number, or the patch name for one-patch (1/1) series. [YOCTO #10625] Signed-off-by: Jose Lamego --- patchwork/models.py | 13 + 1 file changed, 13 insertions(+) diff --git a/patchwork/models.py b/patchwork/models.py index 3f531e6..1521641 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): def _on_revision_complete(sender, revision, **kwargs): series = revision.series +# Now we know how many patches are in the revision, +# so we can update the name for series without a cover letter +if series.name == SERIES_DEFAULT_NAME: +name = series.latest_revision().ordered_patches()[0].name +n = re.compile(r'(\[\d+\/\d+\]\s?)') +name = n.sub('', name) +c = len(series.latest_revision().ordered_patches()) +# For one-patch series (1/1) without cover letter +if c == 1: +series.name = name +elif c > 1: +series.name = "\"%s...\" and %s more" % (name[:30], c-1) + # update series.last_revision series.last_revision = series.latest_revision() series.save() signature.asc Description: OpenPGP digital signature -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v3] patchwork.models: Include first patch's name in series name
Patch Series created without a cover letter are named using a non-descriptive generic string. This change names the series using either the first 30 characters in patch #1 plus the remaining patches number, or the patch name for one-patch (1/1) series. [YOCTO #10625] Signed-off-by: Jose Lamego --- patchwork/models.py | 13 + 1 file changed, 13 insertions(+) diff --git a/patchwork/models.py b/patchwork/models.py index 3f531e6..1521641 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): def _on_revision_complete(sender, revision, **kwargs): series = revision.series +# Now we know how many patches are in the revision, +# so we can update the name for series without a cover letter +if series.name == SERIES_DEFAULT_NAME: +name = series.latest_revision().ordered_patches()[0].name +n = re.compile(r'(\[\d+\/\d+\]\s?)') +name = n.sub('', name) +c = len(series.latest_revision().ordered_patches()) +# For one-patch series (1/1) without cover letter +if c == 1: +series.name = name +else: +series.name = "\"%s...\" and %s more" % (name[:30], c-1) + # update series.last_revision series.last_revision = series.latest_revision() series.save() -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH v2] patchwork/models: Include first patch's name in series name
Patch Series created without a cover letter are named using a non-descriptive generic string. This change names the series using either the first 30 characters in patch #1 plus the remaining patches number, or the patch name for one-patch (1/1) series. [Yocto #10625] Signed-off-by: Jose Lamego --- patchwork/models.py | 16 1 file changed, 16 insertions(+) diff --git a/patchwork/models.py b/patchwork/models.py index 3f531e6..2dfd884 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1042,6 +1042,22 @@ def _series_supersede_previous_patches(series): def _on_revision_complete(sender, revision, **kwargs): series = revision.series +# Now we know how many patches are in the revision, +# so we can update the name for series without a cover letter +if series.name == SERIES_DEFAULT_NAME: +try: +name = series.latest_revision().ordered_patches()[0].name +n = re.compile(r'(\[\d+\/\d+\]\s?)') +name = n.sub('', name) +c = len(series.latest_revision().ordered_patches()) +# For one-patch series (1/1) without cover letter +if c == 1: +series.name = name +else: +series.name = "\"%s...\" and %s more" % (name[:30], c-1) +except: +pass + # update series.last_revision series.last_revision = series.latest_revision() series.save() -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] README: Describe repository and links
This change creates the README file with repository description and links. Signed-off-by: Jose Lamego --- README | 17 + 1 file changed, 17 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000..fbd8d18 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +Patchwork += + +This fork from the freedesktop.org edition of patchwork is hosted and used by Open Embedded at +https://patchwork.openembedded.org/ + +Patchwork is a web patch tracking system for projects using a mailing list for contributions and reviews. + + +Where to Send Patches += + +Patchwork patches must be sent to the Yocto Project mailing list including the "[patchwork]" prefix in the message subject, for example: [yocto][patchwork][patch 1/2] file.txt: change description + +Git repository: git://git.yoctoproject.org/patchwork +Mailing list: yocto@yoctoproject.org + -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH] patchwork.models: Include first patch's name in series name
Patch Series created without a cover letter are named using a non-descriptive generic string. This change names the series using the first 30 characters in patch #1 and the remaining patches number. [Yocto #10625] Signed-off-by: Jose Lamego --- patchwork/models.py | 13 + 1 file changed, 13 insertions(+) diff --git a/patchwork/models.py b/patchwork/models.py index 3f531e6..fecf5cc 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): def _on_revision_complete(sender, revision, **kwargs): series = revision.series +# Now we know how many patches are in the revision, +# so we can update the name for series without a cover letter +if series.name == SERIES_DEFAULT_NAME: +try: +name = series.latest_revision().ordered_patches()[0].name +n = re.compile(r'(\[\d+\/\d+\]\s?)') +name = n.sub('', name) +c = len(series.latest_revision().ordered_patches()) - 1 +series.name = "\"%s...\" and %s more" % (name[:30], + c) +except: +pass + # update series.last_revision series.last_revision = series.latest_revision() series.save() -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 2/2] patchwork.bin.parsemail: Improve pull-request regex
Some patch messages containinig pull-request information are being skipped due to formatting variations. This change improves the pull-request search to include those small variants. Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index c10bed5..476118d 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -195,8 +195,8 @@ def mail_headers(mail): def find_pull_request(content): git_re = re.compile(r'^The following changes since commit.*' + -r'^are available in the git repository at:\n' -r'^\s*([\S]+://[^\n]+)$', +r'^are available in the git repository at:.*'+ +r'^\s*([\S]+://[^\n]+)[$]*', re.DOTALL | re.MULTILINE) match = git_re.search(content) if match: -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 1/2] patchwork.bin.parsemail: Use oldest header references
References list for previous emails only include first found header, causing that some root messages for series are skipped and corresponding series revision numbering gets corrupted. This change forces references list to use last header found, allowing for Patch emails created with send-pull-request script to be appropriately appended to last revision. [Yocto #9941] Signed-off-by: Jose Lamego --- patchwork/bin/parsemail.py | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py index 47b535f..c10bed5 100755 --- a/patchwork/bin/parsemail.py +++ b/patchwork/bin/parsemail.py @@ -284,9 +284,18 @@ def build_references_from_db(msgid): def build_references_from_mail(mail): -return build_references_from_headers(mail.get('In-Reply-To', None), - mail.get('References', None)) - +replies = "" +references = "" +parser = HeaderParser() +headers = parser.parsestr(mail.as_string()) +for h in headers.items(): +# Patch emails created with send-pull-Request script +# may contain two set of references, so use only the last found +if h[0] == 'In-Reply-To': +replies = "%s" % h[1] +if h[0] == 'References': +references = "%s" % h[1] +return build_references_from_headers(replies, references) def build_references_list(mail): """Construct the list of msgids from 'mail' to the root of the thread""" -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] [patchwork][PATCH 0/2] Parsemail: Improve references/pull-request search
These changes are to improve the way email-chain references are created and pull-request information to be included even with small formatting variations. Jose Lamego (2): patchwork.bin.parsemail: Use oldest header references patchwork.bin.parsemail: Improve pull-request regex patchwork/bin/parsemail.py | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) -- 1.9.1 -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] Patchwork upgrade tonight
After 2 weeks of testing and some performance tuning we are going to proceed with the Patchwork upgrade. Data entered into the current version in the next few hours may need to be re-entered after the upgrade. All features of the current Patchwork install work in the new version. So while there are still issues surrounding detection of patch series there are no known regressions. Series detection can be addressed after the upgrade. The rollback plan can be executed very quickly if needed. Please reach out if you have concerns. -- Michael Halstead Linux Foundation / SysAdmin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Patchwork users: Help test new version
On Mon, Jun 20, 2016 at 10:47:16AM -0700, Michael Halstead wrote: > Hello, > > OpenEmbedded is nearly ready to upgrade to a new version of Patchwork. > The new version offers several new features that will allow OpenEmbedded > to improve developer workflow and automated checks on incoming patches. > > If you are a Patchwork user please visit > https://patchwork-next.openembedded.org/ and take a look. If you find > anything amiss please e-mail me directly and include patchwork in the > subject line. > > Thank you for your help upgrading this important system! I was using it to update meta-oe/master-next in last few days and it seems to work the same as old patchwork for me. But quite often I've noticed very slow response, is it running on slower HW while testing or is the new version just a lot slower? -- Martin 'JaMa' Jansa jabber: martin.ja...@gmail.com signature.asc Description: Digital signature -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Patchwork users: Help test new version
On 06/20/2016 10:47 AM, Michael Halstead wrote: > Hello, > > OpenEmbedded is nearly ready to upgrade to a new version of Patchwork. > The new version offers several new features that will allow OpenEmbedded > to improve developer workflow and automated checks on incoming patches. > > If you are a Patchwork user please visit > https://patchwork-next.openembedded.org/ and take a look. If you find > anything amiss please e-mail me directly and include patchwork in the > subject line. great. I will take a look. > > Thank you for your help upgrading this important system! > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
[yocto] Patchwork users: Help test new version
Hello, OpenEmbedded is nearly ready to upgrade to a new version of Patchwork. The new version offers several new features that will allow OpenEmbedded to improve developer workflow and automated checks on incoming patches. If you are a Patchwork user please visit https://patchwork-next.openembedded.org/ and take a look. If you find anything amiss please e-mail me directly and include patchwork in the subject line. Thank you for your help upgrading this important system! -- Michael Halstead Linux Foundation / SysAdmin -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto