Date: Thursday, October 20, 2022 @ 19:00:30 Author: dvzrv Revision: 1333007
upgpkg: postorius 1.3.6.r155.g1fad482b-1: Update to current HEAD. Upstream has not done any release in a long time, even after providing them with fixes for django 4.0 and django 4.1 and contacting them about this multiple times. Backporting patches has become extremely cumbersome, as they do not cleanly apply on top of the source tarball (e.g. setuptools seems to change setup.py). So we are permanently switching to git sources and do not bother with backporting up to 30% of the 150 commits on top of 1.3.6 for our own sanity. Remove all now included (backported) patches. Switch to PEP517. Remove tests from package files. Remove unnecessary quotes and curly braces. Added: postorius/trunk/postorius-1.3.6-settings.patch Modified: postorius/trunk/PKGBUILD Deleted: postorius/trunk/postorius-1.3.2-settings.patch postorius/trunk/postorius-1.3.6-django4.0.patch ---------------------------------+ PKGBUILD | 72 +++++++++------- postorius-1.3.2-settings.patch | 31 ------- postorius-1.3.6-django4.0.patch | 163 -------------------------------------- postorius-1.3.6-settings.patch | 76 +++++++++++++++++ 4 files changed, 115 insertions(+), 227 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-10-20 18:40:06 UTC (rev 1333006) +++ PKGBUILD 2022-10-20 19:00:30 UTC (rev 1333007) @@ -1,8 +1,9 @@ # Maintainer: David Runge <[email protected]> pkgname=postorius -pkgver=1.3.6 -pkgrel=3 +pkgver=1.3.6.r155.g1fad482b +_commit=1fad482b5830c7910e250ab2933180bd96276921 # somewhere on master past 1.3.6 +pkgrel=1 pkgdesc="The New Mailman Web UI" arch=(any) url="https://gitlab.com/mailman/postorius" @@ -9,47 +10,48 @@ license=(GPL3) depends=(python-cmarkgfm python-django python-django-mailman3 python-mailmanclient python-readme-renderer) -makedepends=(git python-setuptools) -checkdepends=(mailman3 python-beautifulsoup4 python-isort python-mock -python-pytest python-pytest-django python-vcrpy) -optdepends=('mailman3: for configuring a local mailman instance' - 'uwsgi-plugin-python: for running inside uwsgi') +makedepends=(git python-build python-installer python-setuptools python-wheel) +checkdepends=(mailman3 python-beautifulsoup4 python-isort python-pytest +python-pytest-django python-vcrpy) +optdepends=( + 'python-django-debug-toolbar: for debugging' + 'mailman3: for configuring a local mailman instance' + 'uwsgi-plugin-python: for running inside uwsgi' +) replaces=(python-django-postorius) -backup=("etc/uwsgi/${pkgname}.ini" - "etc/webapps/${pkgname}/settings_local.py" - "etc/webapps/${pkgname}/urls.py" +backup=( + etc/uwsgi/${pkgname}.ini + etc/webapps/$pkgname/settings_local.py + etc/webapps/$pkgname/urls.py ) -install="${pkgname}.install" -# the signature for the pypi sdist tarball for 1.3.6 is missing the chain of trust: -# https://gitlab.com/mailman/postorius/-/issues/537 -# source=("https://files.pythonhosted.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz"{,.asc} +install=$pkgname.install source=( - git+https://gitlab.com/mailman/$pkgname#tag=$pkgver?signed - $pkgname-1.3.2-settings.patch + git+https://gitlab.com/mailman/$pkgname#commit=$_commit + $pkgname-1.3.6-settings.patch $pkgname.sysusers $pkgname.tmpfiles $pkgname.uwsgi - $pkgname-1.3.6-django4.0.patch ) sha512sums=('SKIP' - '53713874043e368c71543966e878ff7a49f03088b7ebcff9487935bef2c20a57a561a122dd6b4cbde126c25b935871288dadd7693b831a94b8f27da52afeaa0c' + '0fc6611c4d8846a387c1ec3d74b01cba9bc10e22abc6fa6aa4bff11711b66155623fd356adbd548244998e0c76e936b3488141d1c13a70ad7df04b327cb474bf' '3884b818da2deb148279e50316f720c95f0aaa529777b1b3662d8ab253cda823a90682a9eb47e941ca5ba80eefcb9a2d4afacd29f0340d7f9828b36ebcee23b3' '44925c7ce6d1c13bd5bdd2cb449fa978b8eaadaac7ecff74075c23a13478decc4acd1f2cd0399bf55c312d6a08985a3e80f6e7a6e85be9e3dcb93ffb526ca9fb' - 'c042f00d0d8dc72dadd19023152e55246c4d7a4b9d53bca3a05e7b8cb38cac5116417440d4ae82350820c7cb0cd414dcce45fa6af9be19296c4ebd0862dba896' - '3ebb4f0f02d1ef793504b6e2fb7f2cecf5ed3acc8c1fdda6fa2fc2808644aa55f979203d070aa1ca1f1f8430a6e9c30ee653ede99523600f499db872a0640fce') + 'c042f00d0d8dc72dadd19023152e55246c4d7a4b9d53bca3a05e7b8cb38cac5116417440d4ae82350820c7cb0cd414dcce45fa6af9be19296c4ebd0862dba896') b2sums=('SKIP' - 'c4017fe87b8743ae516e360be97efd767d726b043733a6dd880503e796e28f65c9ad5924b0fef53281e4fa73a1a329e818baedbe5dbbc0dc07db2af0cf25f1b7' + 'ea175042786a1c2647fccc2026544c552ba56850582251a367873288daff136812556c47b3836cc040c684dbc129abe7fcdbf2faab896ffc5f864b378ffd5f00' '1ef6dc98c6751e6d65e49812d08d813879b791a7f13622ea31ecadae6dd1859a918761d7723732ed2e4872b9cae61b84c8dbfec2dd2522de9f0929a1ee1cec24' '502d59cb0009b7cdf108a1611d17470d1a73c2d06bf6d9509799b63d4bbb4bb0a2cb71a39eddb0dc5990ee6489625174de6ce2d7e04e77a601c90a6da6d69c84' - '4b80d60c88d46edd0e6e61ad2ff37ba3568c6c56a2abd449f903f7302aeec4a3bc91bbd3ee846731513fa1906df2e3d7d1c52b75a55214051fb96b048f9b4999' - 'a74dc3e0c818e753320f15fa063bdfa531b6c3405475f2da45a7203c1c188819d90adc164f917577ac09a5216255a896c1fa0d11ea1aa2f680bd73fddd246422') + '4b80d60c88d46edd0e6e61ad2ff37ba3568c6c56a2abd449f903f7302aeec4a3bc91bbd3ee846731513fa1906df2e3d7d1c52b75a55214051fb96b048f9b4999') validpgpkeys=('541EA0448453394FF77A0ECC9D9B2BA061D0A67C') # Abhilash Raj <[email protected]> +pkgver() { + cd $pkgname + git describe --long | sed 's/\([^-]*-g\)/r\1/;s/v//g;s/-/./g' +} + prepare() { - # patch global paths into settings.py - patch -d $pkgname -p1 -i ../$pkgname-1.3.2-settings.patch - # make compatible with django 4.0: https://gitlab.com/mailman/postorius/-/merge_requests/694 - patch -d $pkgname -p1 -i ../$pkgname-1.3.6-django4.0.patch + # become FHS compliant and disable the use of debug + patch -d $pkgname -p1 -i ../$pkgname-1.3.6-settings.patch touch settings_local.py } @@ -56,20 +58,24 @@ build() { cd $pkgname - python setup.py build + python -m build --wheel --no-isolation } check() { cd $pkgname/example_project - - export PYTHONPATH="../build/lib:$PYTHONPATH" - PYTHONDONTWRITEBYTECODE=1 - pytest -vv ../build/lib/$pkgname + # disable broken tests: https://gitlab.com/mailman/postorius/-/issues/556 + pytest -vv ../src/$pkgname/tests -k "not test_change_subscription_from_address_to_primary and not test_access_list_options_multiple_subscriptions" } package() { + local site_packages=$(python -c "import site; print(site.getsitepackages()[0])") + cd $pkgname - python setup.py install --optimize=1 --root="$pkgdir" + python -m installer --destdir="$pkgdir" dist/*.whl + + # remove tests + rm -frv "$pkgdir/$site_packages/$pkgname/tests/" + # django project install -vDm 644 example_project/{__init__,manage,settings,wsgi}.py -t "$pkgdir/usr/share/webapps/$pkgname" # symlink locale and static dirs to state dir Deleted: postorius-1.3.2-settings.patch =================================================================== --- postorius-1.3.2-settings.patch 2022-10-20 18:40:06 UTC (rev 1333006) +++ postorius-1.3.2-settings.patch 2022-10-20 19:00:30 UTC (rev 1333007) @@ -1,31 +0,0 @@ -diff --git c/example_project/settings.py w/example_project/settings.py -index c54af7e..d05535b 100644 ---- c/example_project/settings.py -+++ w/example_project/settings.py -@@ -136,7 +136,7 @@ WSGI_APPLICATION = 'wsgi.application' - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', -- 'NAME': os.path.join(BASE_DIR, 'postorius.db'), -+ 'NAME': '/var/lib/postorius/data/postorius.db', - } - } - -@@ -180,7 +180,7 @@ USE_TZ = True - # Don't put anything in this directory yourself; store your static files - # in apps' "static/" subdirectories and in STATICFILES_DIRS. - # Example: "/var/www/example.com/static/" --STATIC_ROOT = os.path.join(BASE_DIR, 'static') -+STATIC_ROOT = '/var/lib/postorius/static' - - # URL prefix for static files. - # Example: "http://example.com/static/", "http://static.example.com/" -@@ -259,7 +259,7 @@ LOGGING = { - 'level': 'INFO', - #'class': 'logging.handlers.RotatingFileHandler', - 'class': 'logging.handlers.WatchedFileHandler', -- 'filename': os.path.join(BASE_DIR, 'logs', 'postorius.log'), -+ 'filename': '/var/log/postorius/postorius.log', - 'formatter': 'verbose', - }, - }, Deleted: postorius-1.3.6-django4.0.patch =================================================================== --- postorius-1.3.6-django4.0.patch 2022-10-20 18:40:06 UTC (rev 1333006) +++ postorius-1.3.6-django4.0.patch 2022-10-20 19:00:30 UTC (rev 1333007) @@ -1,163 +0,0 @@ -From 7c9c080333d5340c2c031ad4258489fe3f91b64a Mon Sep 17 00:00:00 2001 -From: David Runge <[email protected]> -Date: Sun, 20 Feb 2022 15:42:27 +0100 -Subject: [PATCH 1/4] forms/fields compatibility with django >= 4.0 - -src/postorius/forms/fields.py: -Use `django.utils.encoding.smart_str` (introduced with django 4.0) by -default and fall back to `django.utils.encoding.smart_text` (django < -4.0) otherwise. ---- - src/postorius/forms/fields.py | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/src/postorius/forms/fields.py b/src/postorius/forms/fields.py -index f1578615..6235260b 100644 ---- a/src/postorius/forms/fields.py -+++ b/src/postorius/forms/fields.py -@@ -19,7 +19,14 @@ - - - from django import forms --from django.utils.encoding import smart_text -+ -+ -+try: -+ from django.utils.encoding import smart_str -+except ImportError: -+ # django < 4.0 -+ from django.utils.encoding import smart_text as smart_str -+ - from django.utils.translation import gettext_lazy as _ - - from postorius.utils import with_empty_choice -@@ -62,7 +69,7 @@ class ListOfStringsField(forms.Field): - line = line.strip() - if not line: - continue -- result.append(smart_text(line)) -+ result.append(smart_str(line)) - return result - - --- -GitLab - - -From 1b711c0adb063f165e00ed604a398c769f34b9e3 Mon Sep 17 00:00:00 2001 -From: David Runge <[email protected]> -Date: Sun, 20 Feb 2022 15:45:19 +0100 -Subject: [PATCH 2/4] Move the upper boundary for django to < 4.1 - -setup.py: -As postorius is compatible with django 4.0, set the upper boundary to < -4.1. ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 9a900eee..18374c10 100644 ---- a/setup.py -+++ b/setup.py -@@ -54,7 +54,7 @@ setup( - include_package_data=True, - install_requires=[ - 'django-mailman3>=1.3.7', -- 'django>=2.2,<3.3', -+ 'django>=2.2,<4.1', - 'mailmanclient>=3.3.3', - 'readme_renderer[md]', - ], --- -GitLab - - -From 3dfa2cca5ea7d764e69e6a4c37feb3808755b69d Mon Sep 17 00:00:00 2001 -From: David Runge <[email protected]> -Date: Sun, 20 Feb 2022 15:46:30 +0100 -Subject: [PATCH 3/4] Add python 3.10 and django 4.0 support to tox - -tox.ini: -Add environments for python 3.10 and django 4.0 ---- - tox.ini | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/tox.ini b/tox.ini -index 744dbbc8..bce92d5a 100644 ---- a/tox.ini -+++ b/tox.ini -@@ -1,5 +1,5 @@ - [tox] --envlist = py{36,37,38,39}-django{22,31,32,-latest},qa -+envlist = py{36,37,38,39,310}-django{22,31,32,-latest},qa - - [testenv] - usedevelop = True -@@ -20,6 +20,7 @@ deps = - django30: Django>=3.0,<3.1 - django31: Django>=3.1,<3.2 - django32: Django>=3.2,<3.3 -+ django40: Django>=4.0,<4.1 - django-latest: https://github.com/django/django/archive/main.tar.gz - commands = - pytest {posargs:../src} -@@ -31,7 +32,7 @@ setenv = - basepython = python3 - deps = - {[testenv]deps} -- Django>=3.2,<3.3 -+ Django>=3.2,<4.1 - coverage - commands = - coverage run -m pytest {posargs:../src/postorius} --- -GitLab - - -From b5e9c49cf710295f53b340f22c7d2ec5cbb7a9da Mon Sep 17 00:00:00 2001 -From: David Runge <[email protected]> -Date: Sun, 20 Feb 2022 15:47:44 +0100 -Subject: [PATCH 4/4] Add python 3.10 and django 4.0 targets to gitlab CI - -.gitlab-ci.yml: -Run tests against latest django using python 3.10. -Add test targets against django 3.2 and 4.0 on python 3.10. ---- - .gitlab-ci.yml | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml -index ba6cea8c..9e9da7f4 100644 ---- a/.gitlab-ci.yml -+++ b/.gitlab-ci.yml -@@ -66,13 +66,23 @@ py39-django32: - script: - - tox -e py39-django32 - --py39-django-latest: -+py310-django32: -+ stage: test -+ script: -+ - tox -e py310-django32 -+ -+py310-django40: -+ stage: test -+ script: -+ - tox -e py310-django40 -+ -+py310-django-latest: - stage: test - allow_failure: true - script: - - printf "Remove all django version restriction from setup.py.\n" - - sed -E 's/django[<=>,.[:digit:]]+/django/' -i setup.py -- - tox -e py39-django-latest -+ - tox -e py310-django-latest - - coverage: - stage: test --- -GitLab - Added: postorius-1.3.6-settings.patch =================================================================== --- postorius-1.3.6-settings.patch (rev 0) +++ postorius-1.3.6-settings.patch 2022-10-20 19:00:30 UTC (rev 1333007) @@ -0,0 +1,76 @@ +diff --git i/example_project/settings.py w/example_project/settings.py +index 1fae6bee..8ad39d28 100644 +--- i/example_project/settings.py ++++ w/example_project/settings.py +@@ -26,16 +26,10 @@ For the full list of settings and their values, see + https://docs.djangoproject.com/en/1.9/ref/settings/ + """ + +-# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +-import os +- + # Compatibility with Bootstrap 3 + from django.contrib.messages import constants as messages + + +-BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +- +- + # Quick-start development settings - unsuitable for production + # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ + +@@ -43,7 +37,7 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) + SECRET_KEY = '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0' + + # SECURITY WARNING: don't run with debug turned on in production! +-DEBUG = True ++DEBUG = False + + ADMINS = ( + #('Admin', '[email protected]'), +@@ -85,15 +79,15 @@ INSTALLED_APPS = ( + 'allauth.socialaccount.providers.stackexchange', + + # Dev only dependencies. Do not include in any production site. +- 'debug_toolbar', +- 'requests_panel', ++ # 'debug_toolbar', ++ # 'requests_panel', + ) + + + MIDDLEWARE = [ + 'django.contrib.sessions.middleware.SessionMiddleware', + # NOTE: Do not include DebugToolbarMiddleware in any production site. +- 'debug_toolbar.middleware.DebugToolbarMiddleware', ++ # 'debug_toolbar.middleware.DebugToolbarMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.locale.LocaleMiddleware', +@@ -142,7 +136,7 @@ WSGI_APPLICATION = 'wsgi.application' + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', +- 'NAME': os.path.join(BASE_DIR, 'postorius.db'), ++ 'NAME': '/var/lib/postorius/data/postorius.db', + } + } + +@@ -190,7 +184,7 @@ USE_TZ = True + # Don't put anything in this directory yourself; store your static files + # in apps' "static/" subdirectories and in STATICFILES_DIRS. + # Example: "/var/www/example.com/static/" +-STATIC_ROOT = os.path.join(BASE_DIR, 'static') ++STATIC_ROOT = '/var/lib/postorius/static' + + # URL prefix for static files. + # Example: "http://example.com/static/", "http://static.example.com/" +@@ -269,7 +263,7 @@ LOGGING = { + 'level': 'INFO', + #'class': 'logging.handlers.RotatingFileHandler', + 'class': 'logging.handlers.WatchedFileHandler', +- 'filename': os.path.join(BASE_DIR, 'logs', 'postorius.log'), ++ 'filename': '/var/log/postorius/postorius.log', + 'formatter': 'verbose', + }, + },
