RE: [PATCH] sql: Fix table lists
Thanks Stephen. I see the following section in the docs https://patchwork.readthedocs.io/en/latest/deployment/installation/#mail-transfer-agent-mta: """ This assumes your Postfix process is running as the nobody user. If this is not correct (use of postfix user is also common), you should change both the username in the createuser command above and substitute the username in the grant-all-postgres.sql script with the appropriate alternative. """ But I believe that it doesn’t have to be the user running the postfix process, It's the permissions defined by postfix's conf default_privs: http://www.postfix.org/postconf.5.html#default_privs Can you confirm my thought? Thanks, Ali > -Original Message- > From: Stephen Finucane > Sent: Friday, September 6, 2019 4:31 PM > To: Ali Alnubani ; patchwork@lists.ozlabs.org > Cc: Thomas Monjalon > Subject: Re: [PATCH] sql: Fix table lists > > On Wed, 2019-09-04 at 13:40 +, Ali Alnubani wrote: > > The patch adds missing commas in the table lists where missing, and > > removes where unnecessary. > > This fixes errors such as the following when feeding the script to > > psql: > > > > ``` > > psql:lib/sql/grant-all.postgres.sql:37: ERROR: syntax error at or > > near "patchwork_emailconfirmation" > > LINE 19: patchwork_emailconfirmation, ... > > ``` > > > > Fixes: ca0e79d4db34 ("sql: Sort 'grant-all' scripts alphabetically") > > > > Signed-off-by: Ali Alnubani > > Nicely done. Applied and backported to stable/2.1. > > Thanks! > > Stephen ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [PATCH 1/3] Drop support for Python 3.4, add Python 3.7
On Tue, 2019-09-03 at 18:03 +0100, Stephen Finucane wrote: > It's no longer supported upstream and the *second* last Ubuntu LTS > release provides something newer. Time to move on. > > Signed-off-by: Stephen Finucane I've applied this albeit with a couple of other fixes I missed (.travis.yml and a release note) since it was blocking some dependency updates. Stephen ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
[PATCH] requirements: Switch to compatible releases
In commit ab0c443691, we switched from using commit ranges to fixed ranges. This was a good idea in so far as it ensures we're providing an application with dependencies that are guaranteed to work. However, Patchwork as a project isn't active enough to warrant the continued busy work effort necessary to keep bumping these versions and it's probably about time to abandon the experiment. However, rather than switching back to version ranges, use the compatible releases feature introduced in PEP 440 [1]. This gives us most of the benefits of ranges but with a nicer syntax. [1] https://www.python.org/dev/peps/pep-0440/#compatible-release Signed-off-by: Stephen Finucane Cc: Daniel Axtens --- requirements-dev.txt | 14 +++--- requirements-prod.txt | 14 +++--- requirements-test.txt | 10 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 35ead6f9..ee0e10b6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,8 @@ -Django==2.2.5; python_version >= '3.5' -Django==1.11.24; python_version < '3.0' # pyup: ignore -djangorestframework==3.9.2 -django-filter==2.1.0; python_version >= '3.5' -django-filter==1.1.0; python_version < '3.0' # pyup: ignore -django-debug-toolbar==1.11 -django-dbbackup==3.2.0 +Django~=2.2; python_version >= '3.5' +Django~=1.11; python_version < '3.0' # pyup: ignore +djangorestframework~=3.9 +django-filter~=2.1; python_version >= '3.5' +django-filter~=1.1; python_version < '3.0' # pyup: ignore +django-debug-toolbar~=1.11 +django-dbbackup~=3.2 -r requirements-test.txt diff --git a/requirements-prod.txt b/requirements-prod.txt index ba950f7a..92b44079 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,7 +1,7 @@ -Django==2.2.5; python_version >= '3.5' -Django==1.11.24; python_version < '3.0' # pyup: ignore -djangorestframework==3.9.2 -django-filter==2.1.0; python_version >= '3.5' -django-filter==1.1.0; python_version < '3.0' # pyup: ignore -psycopg2-binary==2.8.2 -sqlparse==0.3.0 +Django~=2.2; python_version >= '3.5' +Django~=1.11; python_version < '3.0' # pyup: ignore +djangorestframework~=3.9 +django-filter~=2.1; python_version >= '3.5' +django-filter~=1.1; python_version < '3.0' # pyup: ignore +psycopg2-binary~=2.8 +sqlparse~=0.3 diff --git a/requirements-test.txt b/requirements-test.txt index 0ad3c8aa..ace4ec13 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,5 @@ -mysqlclient==1.3.14 -psycopg2-binary==2.8.2 -sqlparse==0.3.0 -python-dateutil==2.8.0 -openapi-core==0.8.0 +mysqlclient~=1.3.14 +psycopg2-binary~=2.8 +sqlparse~=0.3.0 +python-dateutil~=2.8 +openapi-core~=0.8 -- 2.21.0 ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [PATCH] sql: Fix table lists
On Sun, 2019-09-08 at 07:13 +, Ali Alnubani wrote: > Thanks Stephen. > > I see the following section in the docs > https://patchwork.readthedocs.io/en/latest/deployment/installation/#mail-transfer-agent-mta: > """ > This assumes your Postfix process is running as the nobody user. If > this is not correct (use of postfix user is also common), you should > change both the username in the createuser command above and > substitute the username in the grant-all-postgres.sql script with the > appropriate alternative. > """ > But I believe that it doesn’t have to be the user running the postfix process, > It's the permissions defined by postfix's conf default_privs: > http://www.postfix.org/postconf.5.html#default_privs > > Can you confirm my thought? To be honest, I'll have to let somone else answer this. I wrote that quite a long time ago and haven't really touched it since, so I've long since forgotten the reason I included that /o\ What you've said does make sense though, so if you've tested it and it works as expected or you can find a blog that says the same thing, I'd be happy to accept a patch to correct this. Sorry I can't be of more help, Stephen > Thanks, > Ali > > > -Original Message- > > From: Stephen Finucane > > Sent: Friday, September 6, 2019 4:31 PM > > To: Ali Alnubani ; patchwork@lists.ozlabs.org > > Cc: Thomas Monjalon > > Subject: Re: [PATCH] sql: Fix table lists > > > > On Wed, 2019-09-04 at 13:40 +, Ali Alnubani wrote: > > > The patch adds missing commas in the table lists where missing, and > > > removes where unnecessary. > > > This fixes errors such as the following when feeding the script to > > > psql: > > > > > > ``` > > > psql:lib/sql/grant-all.postgres.sql:37: ERROR: syntax error at or > > > near "patchwork_emailconfirmation" > > > LINE 19: patchwork_emailconfirmation, ... > > > ``` > > > > > > Fixes: ca0e79d4db34 ("sql: Sort 'grant-all' scripts alphabetically") > > > > > > Signed-off-by: Ali Alnubani > > > > Nicely done. Applied and backported to stable/2.1. > > > > Thanks! > > > > Stephen ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [PATCH 2/3] docker: Simplify MySQL reset
On Tue, 2019-09-03 at 18:03 +0100, Stephen Finucane wrote: > Just use the hardcoded configuration. > > Signed-off-by: Stephen Finucane Trivial fix. Applied. ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
Re: [PATCH 3/3] docker: Use pyenv for Python versions
On Tue, 2019-09-03 at 18:03 +0100, Stephen Finucane wrote: > This is slightly slower to initially configure but requires less hacking > to get the same environment and should be a lot more maintainable (just > a simple modification to change the Python version). > > Signed-off-by: Stephen Finucane This is somewhat more complex than the other two patches in the series, but I've been playing around with it locally and it seems to do what I wanted. I've gone ahead and applied this on the assumption that we can easily revert it if necessary. Stephen ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
[PATCH 0/2] Add writeable 'bundles' API
Hopefully self-explanatory. This closes another gap with the web UI and REST API. Stephen Finucane (2): REST: Add 'has_version' helper REST: Allow creating, updating, deleting of bundles docs/api/schemas/latest/patchwork.yaml| 170 +++- docs/api/schemas/patchwork.j2 | 181 +- docs/api/schemas/v1.0/patchwork.yaml | 5 +- docs/api/schemas/v1.1/patchwork.yaml | 5 +- docs/api/schemas/v1.2/patchwork.yaml | 170 +++- patchwork/api/base.py | 12 +- patchwork/api/bundle.py | 84 +++- patchwork/api/utils.py| 14 ++ patchwork/models.py | 11 ++ patchwork/tests/api/test_bundle.py| 118 +++- patchwork/tests/api/utils.py | 16 +- ...pdate-bundle-via-api-2946d8c4e730d545.yaml | 4 + 12 files changed, 754 insertions(+), 36 deletions(-) create mode 100644 patchwork/api/utils.py create mode 100644 releasenotes/notes/update-bundle-via-api-2946d8c4e730d545.yaml -- 2.21.0 ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork
[PATCH 2/2] REST: Allow creating, updating, deleting of bundles
Allow users to create a new bundle, change the name, public flag and patches of an existing bundle, and delete an existing bundle. Some small nits with existing tests are resolved. Signed-off-by: Stephen Finucane --- docs/api/schemas/latest/patchwork.yaml| 170 +++- docs/api/schemas/patchwork.j2 | 181 +- docs/api/schemas/v1.0/patchwork.yaml | 5 +- docs/api/schemas/v1.1/patchwork.yaml | 5 +- docs/api/schemas/v1.2/patchwork.yaml | 170 +++- patchwork/api/bundle.py | 84 +++- patchwork/models.py | 11 ++ patchwork/tests/api/test_bundle.py| 118 +++- patchwork/tests/api/utils.py | 16 +- ...pdate-bundle-via-api-2946d8c4e730d545.yaml | 4 + 10 files changed, 737 insertions(+), 27 deletions(-) create mode 100644 releasenotes/notes/update-bundle-via-api-2946d8c4e730d545.yaml diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index 45a61180..e6c6bb4a 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -1,5 +1,6 @@ # DO NOT EDIT THIS FILE. It is generated from a template. Changes should be -# proposed against the template. +# proposed against the template and updated files generated using the +# 'generate_schema.py' tool --- openapi: '3.0.0' info: @@ -72,6 +73,35 @@ paths: $ref: '#/components/schemas/Bundle' tags: - bundles +post: + description: Create a bundle. + operationId: bundles_create + security: +- basicAuth: [] +- apiKeyAuth: [] + requestBody: +$ref: '#/components/requestBodies/Bundle' + responses: +'201': + description: '' + content: +application/json: + schema: +$ref: '#/components/schemas/Bundle' +'400': + description: Invalid Request + content: +application/json: + schema: +$ref: '#/components/schemas/ErrorBundleCreateUpdate' +'403': + description: Forbidden + content: +application/json: + schema: +$ref: '#/components/schemas/Error' + tags: +- bundles /api/bundles/{id}/: get: description: Show a bundle. @@ -99,6 +129,92 @@ paths: $ref: '#/components/schemas/Error' tags: - bundles +patch: + description: Update a bundle (partial). + operationId: bundles_partial_update + security: +- basicAuth: [] +- apiKeyAuth: [] + parameters: +- in: path + name: id + description: A unique integer value identifying this bundle. + required: true + schema: +title: ID +type: integer + requestBody: +$ref: '#/components/requestBodies/Bundle' + responses: +'200': + description: '' + content: +application/json: + schema: +$ref: '#/components/schemas/Bundle' +'400': + description: Bad request + content: +application/json: + schema: +$ref: '#/components/schemas/ErrorBundleCreateUpdate' +'403': + description: Forbidden + content: +application/json: + schema: +$ref: '#/components/schemas/Error' +'404': + description: Not found + content: +application/json: + schema: +$ref: '#/components/schemas/Error' + tags: +- bundles +put: + description: Update a bundle. + operationId: bundles_update + security: +- basicAuth: [] +- apiKeyAuth: [] + parameters: +- in: path + name: id + description: A unique integer value identifying this bundle. + required: true + schema: +title: ID +type: integer + requestBody: +$ref: '#/components/requestBodies/Bundle' + responses: +'200': + description: '' + content: +application/json: + schema: +$ref: '#/components/schemas/Bundle' +'400': + description: Bad request + content: +application/json: + schema: +$ref: '#/components/schemas/ErrorBundleCreateUpdate' +'403': + description: Forbidden + content: +application/json: + schema: +$ref: '#/components/schemas/Error' +'404': + description: Not found + content: +application/json: + schema: +$ref: '#/components/schemas/Error' + tags: +
[PATCH 1/2] REST: Add 'has_version' helper
We're going to use this functionality elsewhere shortly. Signed-off-by: Stephen Finucane --- patchwork/api/base.py | 12 +++- patchwork/api/utils.py | 14 ++ 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 patchwork/api/utils.py diff --git a/patchwork/api/base.py b/patchwork/api/base.py index 943afa21..89a43114 100644 --- a/patchwork/api/base.py +++ b/patchwork/api/base.py @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -from distutils.version import StrictVersion from django.conf import settings from django.shortcuts import get_object_or_404 @@ -13,6 +12,8 @@ from rest_framework.response import Response from rest_framework.serializers import HyperlinkedIdentityField from rest_framework.serializers import HyperlinkedModelSerializer +from patchwork.api import utils + class LinkHeaderPagination(PageNumberPagination): """Provide pagination based on rfc5988. @@ -90,17 +91,10 @@ class BaseHyperlinkedModelSerializer(HyperlinkedModelSerializer): instance) request = self.context.get('request') -if not request or not request.version: -# without version information, we have to assume the latest -return data - -requested_version = StrictVersion(request.version) - for version in getattr(self.Meta, 'versioned_fields', {}): # if the user has requested a version lower that than in which the # field was added, we drop it -required_version = StrictVersion(version) -if required_version > requested_version: +if not utils.has_version(request, version): for field in self.Meta.versioned_fields[version]: data.pop(field) diff --git a/patchwork/api/utils.py b/patchwork/api/utils.py new file mode 100644 index ..7d46e846 --- /dev/null +++ b/patchwork/api/utils.py @@ -0,0 +1,14 @@ +# Patchwork - automated patch tracking system +# Copyright (C) 2018 Stephen Finucane +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from distutils.version import StrictVersion + + +def has_version(request, version): +if not request.version: +# without version information, we have to assume the latest +return True + +return StrictVersion(request.version) >= StrictVersion(version) -- 2.21.0 ___ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork