1
0

Accepting request 1123589 from devel:languages:python:mailman

OBS-URL: https://build.opensuse.org/request/show/1123589
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-HyperKitty?expand=0&rev=23
This commit is contained in:
2023-11-06 20:13:48 +00:00
committed by Git OBS Bridge
8 changed files with 868 additions and 180 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4d74aca3ec30546741ca62339ece72392e298f511d0a89e69bcedbfcdc8102cb
size 2691781

3
HyperKitty-1.3.8.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8fffccadba2cfe0d4119e9c746639ee46bc0cdae67bbf99c84081d2d0bbd87b8
size 2556166

View File

@@ -1,34 +0,0 @@
From 0e86f9cc40bf05cb819087f1fb0ee56f43968e1b Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Thu, 6 Oct 2022 14:01:54 +0200
Subject: [PATCH] Make it compatible with elasticsearch 8.0.0
---
hyperkitty/tests/views/test_search.py | 10 +++++++++-
tox.ini | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hyperkitty/tests/views/test_search.py b/hyperkitty/tests/views/test_search.py
index ad0e9632..cad76fe6 100644
--- a/hyperkitty/tests/views/test_search.py
+++ b/hyperkitty/tests/views/test_search.py
@@ -211,10 +211,18 @@ class SearchViewsTestCase(SearchEnabledTestCase):
# For elasticsearch backend
from elasticsearch import RequestError
+ from elasticsearch import VERSION
+ mayor, _minor, _p = VERSION
+
+ search_error = "dummy parsing failure"
+ if mayor > 7:
+ class ElasticError:
+ status = search_error
+ search_error = ElasticError
class CrashingIterator(list):
def __len__(self):
- raise RequestError(400, "dummy parsing failure", {})
+ raise RequestError(400, search_error, {})
query = Mock()
with self.settings(HAYSTACK_CONNECTIONS={

View File

@@ -0,0 +1,302 @@
# Rewritten from upstream .patch to avoid fuzzing
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/base.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/base.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/base.html
@@ -24,6 +24,11 @@
{% block additional_stylesheets %} {% endblock %}
{% block head_feed %}{% endblock %}
{% include 'hyperkitty/headers.html' %}
+ <meta property="og:site_name" content="{{ site_name }}">
+ {% block additional_og %}{% endblock %}
+ <meta property="og:url" content="{{ request.get_full_path }}">
+ <meta name="twitter:card" content="summary">
+ <meta name="twitter:url" content="{{ request.get_full_path }}">
</head>
<body>
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/errors/notimplemented.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/errors/notimplemented.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/errors/notimplemented.html
@@ -7,6 +7,11 @@
{% trans "Not implemented yet" %} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Not implemented yet" %}">
+<meta name="twitter:title" content="{% trans "Not implemented yet" %}">
+{% endblock %}
+
{% block content %}
<h1>{% trans "Not implemented" %}</h1>
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/errors/private.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/errors/private.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/errors/private.html
@@ -7,6 +7,11 @@
{% trans "Error: private list" %} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Error: private list" %} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:title" content="{% trans "Error: private list" %} - {{ mlist.display_name|default:mlist.name }}">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/index.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/index.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/index.html
@@ -9,6 +9,11 @@
{% trans 'Available lists' %} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans 'Available lists' %}">
+<meta name="twitter:title" content="{% trans 'Available lists' %}">
+{% endblock %}
+
{% block content %}
<div class="all-lists">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/message.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/message.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/message.html
@@ -1,12 +1,29 @@
{% extends "hyperkitty/base.html" %}
{% load i18n %}
{% load hk_generic %}
+{% load gravatar %}
{% block head_title %}
{{ message.subject }} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{{ message.subject }} - {{ mlist.display_name|default:mlist.name }}">
+<meta property="og:type" content="article">
+<meta property="og:image" content="{% gravatar_url message.sender.address 200 %}">
+<meta property="og:description" content="{{ message.content|escapeemail|truncatechars:199 }}…">
+<meta property="og:article:author" content="{{ message.sender_name|default:message.sender.address|escapeemail }}">
+<meta property="og:article:published_time" content="{{ message.date|date:'c' }}">
+<meta property="og:article:section" content="{{ mlist.display_name|default:mlist.name }}">
+{% for tag in message.thread.tags.distinct %}
+<meta property="og:article:tag" content="{{ tag.name }}">
+{% endfor %}
+<meta name="twitter:title" content="{{ message.subject }} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:description" content="{{ message.content|escapeemail|truncatechars:199 }}…">
+<meta name="twitter:image" content="{% gravatar_url message.sender.address 200 %}">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/message_new.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/message_new.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/message_new.html
@@ -8,6 +8,11 @@
{% trans "Create a new thread" %} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Create a new thread" %} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:title" content="{% trans "Create a new thread" %} - {{ mlist.display_name|default:mlist.name }}">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/overview.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/overview.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/overview.html
@@ -4,6 +4,13 @@
{% load static %}
{% load cache %}
+{% block additional_og %}
+<meta property="og:title" content="{{ mlist.display_name|default:mlist.name }}">
+<meta property="og:description" content="{{ mlist.description|default_if_none:''|truncatechars:199 }}…">
+<meta name="twitter:title" content="{{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:description" content="{{ mlist.description|default_if_none:''|truncatechars:199 }}…">
+{% endblock %}
+
{% block head_title %}
{{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/reattach.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/reattach.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/reattach.html
@@ -9,6 +9,11 @@
{% trans "Reattach a thread" %} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Reattach a thread" %} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:title" content="{% trans "Reattach a thread" %} - {{ mlist.display_name|default:mlist.name }}">
+{% endblock %}
+
{% block content %}
<div class="row reattach-thread">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/search_results.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/search_results.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/search_results.html
@@ -8,6 +8,11 @@
{% trans "Search results for" %} "{{ query }}"{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Search results for" %} "{{ query }}"{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %}">
+<meta name="twitter:title" content="{% trans "Search results for" %} "{{ query }}"{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %}">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/thread.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/thread.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/thread.html
@@ -3,12 +3,29 @@
{% load i18n %}
{% load hk_generic %}
{% load static %}
+{% load gravatar %}
{% block head_title %}
{{ subject }} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{{ subject }} - {{ mlist.display_name|default:mlist.name }}">
+<meta property="og:type" content="article">
+<meta property="og:image" content="{% gravatar_url starting_email.sender.address 200 %}">
+<meta property="og:description" content="{{ starting_email.content|escapeemail|truncatechars:199 }}…">
+<meta property="og:article:author" content="{{ starting_email.sender_name|default:starting_email.sender.address|escapeemail }}">
+<meta property="og:article:published_time" content="{{ starting_email.date|date:'c' }}">
+<meta property="og:article:section" content="{{ mlist.display_name|default:mlist.name }}">
+{% for tag in thread.tags.distinct %}
+<meta property="og:article:tag" content="{{ tag.name }}">
+{% endfor %}
+<meta name="twitter:title" content="{{ subject }} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:description" content="{{ starting_email.content|escapeemail|truncatechars:199 }}…">
+<meta name="twitter:image" content="{% gravatar_url starting_email.sender.address 200 %}">
+{% endblock %}
+
{% block content %}
<div class="row view-thread d-flex">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/thread_list.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/thread_list.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/thread_list.html
@@ -13,6 +13,13 @@
<link rel="alternate" type="application/rss+xml" title="{{ mlist.display_name }}" href="{% url 'hk_list_feed' mlist_fqdn=mlist.name %}"/>
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{{ list_title }} - {{ mlist.display_name|default:mlist.name }}">
+<meta property="og:description" content="{{ mlist.description|default_if_none:''|truncatechars:199 }}…">
+<meta name="twitter:title" content="{{ list_title }} - {{ mlist.display_name|default:mlist.name }}">
+<meta name="twitter:description" content="{{ mlist.description|default_if_none:''|truncatechars:199 }}…">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_posts.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/user_posts.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_posts.html
@@ -8,6 +8,11 @@
{% trans "Messages by" %} {{ fullname }}{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "Messages by" %} {{ fullname }}{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %}">
+<meta name="twitter:title" content="{% trans "Messages by" %} {{ fullname }}{% if mlist %} - {{ mlist.display_name|default:mlist.name }} {% endif %}">
+{% endblock %}
+
{% block content %}
<div class="row">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_profile/base.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/user_profile/base.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_profile/base.html
@@ -5,6 +5,11 @@
{% trans "User posting activity" %} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans "User posting activity" %}">
+<meta name="twitter:title" content="{% trans "User posting activity" %}">
+{% endblock %}
+
{% block content %}
<div class="user-profile">
Index: HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_public_profile.html
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/templates/hyperkitty/user_public_profile.html
+++ HyperKitty-1.3.8/hyperkitty/templates/hyperkitty/user_public_profile.html
@@ -1,12 +1,20 @@
{% extends "hyperkitty/base.html" %}
{% load i18n %}
{% load hk_generic %}
+{% load gravatar %}
{% block head_title %}
{% trans 'User Profile' %} {% trans "for" %} {{ fullname }} - {{ block.super }}
{% endblock %}
+{% block additional_og %}
+<meta property="og:title" content="{% trans 'User Profile' %} {% trans "for" %} {{ fullname }}">
+<meta property="og:image" content="{% gravatar_url addresses.0 200 %}">
+<meta name="twitter:title" content="{% trans 'User Profile' %} {% trans "for" %} {{ fullname }}">
+<meta name="twitter:image" content="{% gravatar_url addresses.0 200 %}">
+{% endblock %}
+
{% block content %}
<div class="user-profile user-public-profile">
Index: HyperKitty-1.3.8/hyperkitty/tests/views/test_accounts.py
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/tests/views/test_accounts.py
+++ HyperKitty-1.3.8/hyperkitty/tests/views/test_accounts.py
@@ -197,7 +197,7 @@ class AccountViewsTestCase(TestCase):
"?list=list@example.com")
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Dummy content", count=1, html=False)
- self.assertContains(response, "Dummy Sender", count=5, html=False)
+ self.assertContains(response, "Dummy Sender", count=7, html=False)
self.assertContains(
response,
'<a name="{}" href="{}">Dummy message</a>'.format(
Index: HyperKitty-1.3.8/hyperkitty/tests/views/test_message.py
===================================================================
--- HyperKitty-1.3.8.orig/hyperkitty/tests/views/test_message.py
+++ HyperKitty-1.3.8/hyperkitty/tests/views/test_message.py
@@ -124,8 +124,8 @@ class MessageViewsTestCase(TestCase):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Dummy message")
- self.assertContains(response, "Dummy Sender", count=1)
- self.assertContains(response, "Dummy Subject", count=2)
+ self.assertContains(response, "Dummy Sender", count=2)
+ self.assertContains(response, "Dummy Subject", count=4)
self.assertNotContains(response, "dummy@example.com")
self.assertContains(
response,

View File

@@ -0,0 +1,51 @@
diff --git a/hyperkitty/feed.py b/hyperkitty/feed.py
index 8242662c2158be7b34527cf933565588892ce25f..a9bd9ae546aa51f717b07b6c270b769e9e8c775f 100644
--- a/hyperkitty/feed.py
+++ b/hyperkitty/feed.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# HyperKitty. If not, see <http://www.gnu.org/licenses/>.
#
-# Author: Stasiek Michalski <stasiek@michalski.cc>
+# Author: Jacob Michalskie <jacob@michalskie.cc>
#
import re
@@ -43,20 +43,32 @@ def sanitize(x):
class MailingListFeed(Feed):
def get_object(self, request, mlist_fqdn):
- return get_object_or_404(MailingList, name=mlist_fqdn)
+ return {'mlist': get_object_or_404(MailingList, name=mlist_fqdn),
+ 'params': request.GET}
def title(self, obj):
- return sanitize(obj.display_name)
+ return sanitize(obj['mlist'].display_name)
def link(self, obj):
- return reverse("hk_list_overview", kwargs={"mlist_fqdn": obj.name})
+ return reverse("hk_list_overview",
+ kwargs={"mlist_fqdn": obj['mlist'].name})
def description(self, obj):
- return sanitize(obj.description)
+ return sanitize(obj['mlist'].description)
def items(self, obj):
len = getattr(settings, 'HYPERKITTY_MLIST_FEED_LENGTH', 30)
- return Email.objects.filter(mailinglist=obj).order_by('-date')[:len]
+ emails = Email.objects.filter(mailinglist=obj['mlist'])
+ if 'subject' in obj['params']:
+ emails = emails.filter(subject__regex=obj['params']['subject'])
+ if 'sender' in obj['params']:
+ emails = emails.filter(sender_name__regex=obj['params']['email'])
+ if 'threads' in obj['params']:
+ emails = emails.filter(thread_depth=0)
+ if 'limit' in obj['params']:
+ if int(obj['params']['limit']) < len:
+ len = int(obj['params']['limit'])
+ return emails.order_by('-date')[:len]
def item_title(self, item):
return sanitize(item.subject)

View File

@@ -10,17 +10,17 @@ changes so we can work with newer version.
This also strictly works on mistune>=3.0 since the older API won't
work for us anymore.
---
doc/news.rst | 1 +
hyperkitty/lib/haystack.py | 57 ++++++++++++++++++++++++++++++++++++++
hyperkitty/lib/renderer.py | 44 +++++++++++++++--------------
setup.py | 2 +-
4 files changed, 82 insertions(+), 22 deletions(-)
create mode 100644 hyperkitty/lib/haystack.py
Index: HyperKitty-1.3.7/hyperkitty/lib/haystack.py
===================================================================
diff --git a/hyperkitty/lib/haystack.py b/hyperkitty/lib/haystack.py
new file mode 100644
index 00000000..8dbe64a7
--- /dev/null
+++ HyperKitty-1.3.7/hyperkitty/lib/haystack.py
+++ b/hyperkitty/lib/haystack.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+#
@@ -80,67 +80,50 @@ Index: HyperKitty-1.3.7/hyperkitty/lib/haystack.py
+ backend = SqliteSearchBackend
+ query = SqliteSearchQuery
\ No newline at end of file
Index: HyperKitty-1.3.7/hyperkitty/lib/renderer.py
===================================================================
--- HyperKitty-1.3.7.orig/hyperkitty/lib/renderer.py
+++ HyperKitty-1.3.7/hyperkitty/lib/renderer.py
@@ -3,8 +3,8 @@ import re
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index cbb83b9a..2db2aee6 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -3,8 +3,9 @@ import re
from django.conf import settings
import mistune
-from mistune.plugins.extra import plugin_url
-from mistune.util import escape_html, escape_url
+from mistune.plugins.url import url
+from mistune.util import safe_entity
+from mistune.util import escape as escape_html
+from mistune.util import escape_url
class MyRenderer(mistune.HTMLRenderer):
@@ -28,11 +28,11 @@ class MyRenderer(mistune.HTMLRenderer):
f'<div class="quoted-switch"><a href="#">...</a></div>'
f'<blockquote class="blockquote quoted-text">{text}</blockquote>')
- def emphasis(self, marker, text):
+ def emphasis(self, text, marker):
"""Emphasis with marker included."""
return super().emphasis(marker + text + marker)
- def strong(self, marker, text):
+ def strong(self, text, marker):
"""Strong with marker included."""
return super().strong(marker + text + marker)
@@ -42,7 +42,7 @@ class MyRenderer(mistune.HTMLRenderer):
@@ -42,7 +43,7 @@ class MyRenderer(mistune.HTMLRenderer):
return '![{alt}]({src} {title})'.format(
src=src, title=title, alt=alt)
- def image(self, src, alt_text, title):
+ def image(self, alt, url, title=None):
+ def image(self, alt, src, title):
"""Render image if configured to do so.
HYPERKITTY_RENDER_INLINE_IMAGE configuration allows for
@@ -50,25 +50,28 @@ class MyRenderer(mistune.HTMLRenderer):
@@ -50,10 +51,10 @@ class MyRenderer(mistune.HTMLRenderer):
default since embeded images can cause problems.
"""
if getattr(settings, 'HYPERKITTY_RENDER_INLINE_IMAGE', False):
- return super().image(src, alt_text, title, )
- return self._md_style_img(src, title, alt_text)
+ return super().image(alt, url, title)
+ return self._md_style_img(url, title, alt)
+ return super().image(src, alt, title, )
+ return self._md_style_img(src, title, alt)
- def link(self, link, text=None, title=None):
+ def link(self, text, url, title=None):
+ def link(self, text=None, url=None, title=None):
"""URL link renderer that truncates the length of the URL.
This only does it for the URLs that are not hyperlinks by just literal
URLs (text=None) so text is same as URL.
@@ -61,14 +62,14 @@ class MyRenderer(mistune.HTMLRenderer):
It also adds target=“_blank” so that the URLs open in a new tab.
"""
- if text is None:
if text is None:
- text = link
+ # text can be none of same as url in case of autolink parsing. This
+ # will truncate the length of the URL in both cases but preserve
+ # the actual URL destination in the hyperlink.
+ if text is None or text == url:
+ text = url
if len(text) > 76:
- text = link[:76] + '...'
@@ -149,60 +132,22 @@ Index: HyperKitty-1.3.7/hyperkitty/lib/renderer.py
- s = '<a target="_blank" href="' + self._safe_url(link) + '"'
+ s = '<a target="_blank" href="' + self.safe_url(url) + '"'
if title:
- s += ' title="' + escape_html(title) + '"'
s += ' title="' + escape_html(title) + '"'
- return s + '>' + (text or link) + '</a>'
+ s += ' title="' + safe_entity(title) + '"'
+ return s + '>' + (text or url) + '</a>'
class InlineParser(mistune.inline_parser.InlineParser):
@@ -79,27 +82,13 @@ class InlineParser(mistune.inline_parser
emphasis or strong node.
"""
- def tokenize_emphasis(self, m, state):
- marker = m.group(1)
- text = m.group(2)
- if len(marker) == 1:
- return 'emphasis', marker, self.render(text, state)
- return 'strong', marker, self.render(text, state)
-
- # This is an override for a fix that should be in mistune.
- # https://github.com/lepture/mistune/pull/276
- def parse_auto_link(self, m, state):
- if state.get('_in_link'):
- return 'text', m.group(0)
-
- text = m.group(1)
- if ('@' in text and
- not text.lower().startswith('mailto:') and
- not text.lower().startswith('http')):
- link = 'mailto:' + text
- else:
- link = text
- return 'link', escape_url(link), text
+ def parse_emphasis(self, m, state):
+ end_pos = super().parse_emphasis(m, state)
+ last_token = state.tokens[-1].copy()
+ marker = m.group(0)
+ last_token['attrs'] = {'marker': marker}
+ state.tokens[-1] = last_token
+ return end_pos
def remove_header_rules(rules):
@@ -112,8 +101,8 @@ def remove_header_rules(rules):
@@ -113,7 +114,7 @@ def remove_header_rules(rules):
class BlockParser(mistune.block_parser.BlockParser):
"""A copy of Mistune's block parser with header parsing rules removed."""
- RULE_NAMES = remove_header_rules(
RULE_NAMES = remove_header_rules(
- mistune.block_parser.BlockParser.RULE_NAMES)
+ DEFAULT_RULES = remove_header_rules(
+ mistune.block_parser.BlockParser.DEFAULT_RULES)
# Signature Plugin looks for signature pattern in email content and converts it
@@ -141,10 +130,10 @@ def plugin_signature(md):
OUTLOOK_REPLY_PATTERN = re.compile(
@@ -163,10 +164,10 @@ def plugin_signature(md):
It only provides an HTML renderer because that is the only one needed.
"""
@@ -216,7 +161,7 @@ Index: HyperKitty-1.3.7/hyperkitty/lib/renderer.py
md.renderer.register('signature', render_html_signature)
@@ -189,18 +178,18 @@ def plugin_pgp_signature(md):
@@ -211,22 +212,23 @@ def plugin_pgp_signature(md):
It parses BEGIN PGP SIGNATURE and END PGP SIGNATURE and collapses content
in between them.
"""
@@ -235,12 +180,17 @@ Index: HyperKitty-1.3.7/hyperkitty/lib/renderer.py
- inline=InlineParser(renderer, hard_wrap=False),
+ inline=InlineParser(hard_wrap=False),
block=BlockParser(),
- plugins=[plugin_pgp_signature, plugin_signature, plugin_url])
+ plugins=[plugin_pgp_signature, plugin_signature, url])
+
plugins=[
plugin_pgp_signature,
plugin_signature,
plugin_outlook_reply,
- plugin_url
+ url
])
# The only difference between the markdown and this renderer is
@@ -208,10 +197,10 @@ markdown_renderer = mistune.Markdown(
@@ -235,10 +237,10 @@ markdown_renderer = mistune.Markdown(
# rules that results in a regularly formatted email.
text_renderer = mistune.Markdown(
renderer=renderer,
@@ -253,10 +203,10 @@ Index: HyperKitty-1.3.7/hyperkitty/lib/renderer.py
- plugin_url,
+ url,
])
Index: HyperKitty-1.3.7/setup.py
===================================================================
--- HyperKitty-1.3.7.orig/setup.py
+++ HyperKitty-1.3.7/setup.py
diff --git a/setup.py b/setup.py
index 2d8da168..d8c2d2fb 100755
--- a/setup.py
+++ b/setup.py
@@ -45,7 +45,7 @@ REQUIRES = [
"pytz>=2012",
"django-compressor>=1.3",
@@ -266,11 +216,293 @@ Index: HyperKitty-1.3.7/setup.py
"python-dateutil >= 2.0",
"networkx>=2.0",
"django-haystack>=2.8.0",
Index: HyperKitty-1.3.7/hyperkitty/tests/test_templatetags.py
===================================================================
--- HyperKitty-1.3.7.orig/hyperkitty/tests/test_templatetags.py
+++ HyperKitty-1.3.7/hyperkitty/tests/test_templatetags.py
@@ -147,15 +147,13 @@ class TestGravatar(TestCase):
--
GitLab
From 2312689ea67f631c2aae54013a3e6a57be7ef36d Mon Sep 17 00:00:00 2001
From: Abhilash Raj <raj.abhilash1@gmail.com>
Date: Wed, 5 Jul 2023 10:20:04 +0530
Subject: [PATCH 2/6] Remove the hack for urls with @ since it is fixed
upstream
---
hyperkitty/lib/renderer.py | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index 2db2aee6..6a86cc4c 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -87,21 +87,6 @@ class InlineParser(mistune.inline_parser.InlineParser):
return 'emphasis', marker, self.render(text, state)
return 'strong', marker, self.render(text, state)
- # This is an override for a fix that should be in mistune.
- # https://github.com/lepture/mistune/pull/276
- def parse_auto_link(self, m, state):
- if state.get('_in_link'):
- return 'text', m.group(0)
-
- text = m.group(1)
- if ('@' in text and
- not text.lower().startswith('mailto:') and
- not text.lower().startswith('http')):
- link = 'mailto:' + text
- else:
- link = text
- return 'link', escape_url(link), text
-
def remove_header_rules(rules):
rules = list(rules)
--
GitLab
From 373dadee496c70ee0c6384ef2ad467919e5315cb Mon Sep 17 00:00:00 2001
From: Abhilash Raj <raj.abhilash1@gmail.com>
Date: Wed, 5 Jul 2023 10:39:31 +0530
Subject: [PATCH 3/6] QA checks
---
hyperkitty/lib/renderer.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index 6a86cc4c..b233dcad 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -5,7 +5,6 @@ from django.conf import settings
import mistune
from mistune.plugins.url import url
from mistune.util import escape as escape_html
-from mistune.util import escape_url
class MyRenderer(mistune.HTMLRenderer):
--
GitLab
From 481e81d32c2e5ff1c9516fe41512bcfd3cf2c208 Mon Sep 17 00:00:00 2001
From: Abhilash Raj <raj.abhilash1@gmail.com>
Date: Wed, 5 Jul 2023 13:10:49 +0530
Subject: [PATCH 4/6] Fixes for more mistune 3.x compat
---
hyperkitty/lib/renderer.py | 32 ++++++++++++++-------------
hyperkitty/tests/test_templatetags.py | 3 +++
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index b233dcad..346472d2 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -5,6 +5,7 @@ from django.conf import settings
import mistune
from mistune.plugins.url import url
from mistune.util import escape as escape_html
+from mistune.util import safe_entity
class MyRenderer(mistune.HTMLRenderer):
@@ -24,15 +25,16 @@ class MyRenderer(mistune.HTMLRenderer):
quote-switched classed hyperlink that can collapse the next quote-text
using JS.
"""
+ print(text)
return (
f'<div class="quoted-switch"><a href="#">...</a></div>'
f'<blockquote class="blockquote quoted-text">{text}</blockquote>')
- def emphasis(self, marker, text):
+ def emphasis(self, text, marker):
"""Emphasis with marker included."""
return super().emphasis(marker + text + marker)
- def strong(self, marker, text):
+ def strong(self, text, marker):
"""Strong with marker included."""
return super().strong(marker + text + marker)
@@ -42,7 +44,7 @@ class MyRenderer(mistune.HTMLRenderer):
return '![{alt}]({src} {title})'.format(
src=src, title=title, alt=alt)
- def image(self, alt, src, title):
+ def image(self, alt, url, title=None):
"""Render image if configured to do so.
HYPERKITTY_RENDER_INLINE_IMAGE configuration allows for
@@ -50,10 +52,10 @@ class MyRenderer(mistune.HTMLRenderer):
default since embeded images can cause problems.
"""
if getattr(settings, 'HYPERKITTY_RENDER_INLINE_IMAGE', False):
- return super().image(src, alt, title, )
- return self._md_style_img(src, title, alt)
+ return super().image(alt, url, title)
+ return self._md_style_img(url, title, alt)
- def link(self, text=None, url=None, title=None):
+ def link(self, text, url, title=None):
"""URL link renderer that truncates the length of the URL.
This only does it for the URLs that are not hyperlinks by just literal
@@ -67,7 +69,7 @@ class MyRenderer(mistune.HTMLRenderer):
s = '<a target="_blank" href="' + self.safe_url(url) + '"'
if title:
- s += ' title="' + escape_html(title) + '"'
+ s += ' title="' + safe_entity(title) + '"'
return s + '>' + (text or url) + '</a>'
@@ -79,13 +81,13 @@ class InlineParser(mistune.inline_parser.InlineParser):
emphasis or strong node.
"""
- def tokenize_emphasis(self, m, state):
- marker = m.group(1)
- text = m.group(2)
- if len(marker) == 1:
- return 'emphasis', marker, self.render(text, state)
- return 'strong', marker, self.render(text, state)
-
+ def parse_emphasis(self, m, state):
+ end_pos = super().parse_emphasis(m, state)
+ last_token = state.tokens[-1].copy()
+ marker = m.group(0)
+ last_token['attrs'] = {'marker': marker}
+ state.tokens[-1] = last_token
+ return end_pos
def remove_header_rules(rules):
rules = list(rules)
@@ -97,7 +99,7 @@ def remove_header_rules(rules):
class BlockParser(mistune.block_parser.BlockParser):
"""A copy of Mistune's block parser with header parsing rules removed."""
- RULE_NAMES = remove_header_rules(
+ DEFAULT_RULES = remove_header_rules(
mistune.block_parser.BlockParser.DEFAULT_RULES)
diff --git a/hyperkitty/tests/test_templatetags.py b/hyperkitty/tests/test_templatetags.py
index 79372d84..b1d83177 100644
--- a/hyperkitty/tests/test_templatetags.py
+++ b/hyperkitty/tests/test_templatetags.py
@@ -156,6 +156,7 @@ On Fri, 09.11.12 11:27, Someone wrote:
> This is the first quoted line
> On Fri 07.25.12, Aperson wrote:
>> This is the second quoted line.
+
This is the response.
"""
expected = (
@@ -167,6 +168,8 @@ This is the response.
'</blockquote></blockquote>'
'<p>This is the response.</p>\n')
result = markdown_renderer(contents)
+ print('----------'*10)
+ print(result)
self.assertEqual(result.strip(), expected.strip())
def test_parse_heading_normal(self):
--
GitLab
From b2d809b446402296b5e1b830a7f408a6e464210d Mon Sep 17 00:00:00 2001
From: Abhilash Raj <raj.abhilash1@gmail.com>
Date: Wed, 12 Jul 2023 12:23:23 +0530
Subject: [PATCH 5/6] Fix the outlook_reply_plugin for mixtune 3.x
---
hyperkitty/lib/renderer.py | 29 ++++++++++++++-------------
hyperkitty/tests/test_templatetags.py | 12 +++--------
2 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index 346472d2..ddb2a77d 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -25,7 +25,6 @@ class MyRenderer(mistune.HTMLRenderer):
quote-switched classed hyperlink that can collapse the next quote-text
using JS.
"""
- print(text)
return (
f'<div class="quoted-switch"><a href="#">...</a></div>'
f'<blockquote class="blockquote quoted-text">{text}</blockquote>')
@@ -62,7 +61,10 @@ class MyRenderer(mistune.HTMLRenderer):
URLs (text=None) so text is same as URL.
It also adds target=“_blank” so that the URLs open in a new tab.
"""
- if text is None:
+ # text can be none of same as url in case of autolink parsing. This
+ # will truncate the length of the URL in both cases but preserve
+ # the actual URL destination in the hyperlink.
+ if text is None or text == url:
text = url
if len(text) > 76:
text = url[:76] + '...'
@@ -103,26 +105,26 @@ class BlockParser(mistune.block_parser.BlockParser):
mistune.block_parser.BlockParser.DEFAULT_RULES)
-OUTLOOK_REPLY_PATTERN = re.compile(
+OUTLOOK_REPLY_PATTERN = (
r'^-------- Original message --------\n'
- r'([\s\S]+)', # everything after newline.
- re.M
+ r'(?P<reply_text>[\s\S]+)' # everything after newline
)
def parse_outlook_reply(block, m, state):
"""Parser for outlook style replies."""
- text = m.group(0)
- return {
+ text = m.group('reply_text')
+ reply_token = '-------- Original message --------\n'
+ state.append_token({
'type': 'block_quote',
- 'children': [{'type': 'paragraph', 'text': text}]
- }
+ 'children': [{'type': 'paragraph', 'text': reply_token + text}],
+ })
+ return m.end() + 1
def plugin_outlook_reply(md):
- md.block.register_rule(
+ md.block.register(
'outlook_reply', OUTLOOK_REPLY_PATTERN, parse_outlook_reply)
- md.block.rules.insert(-1, 'outlook_reply')
# Signature Plugin looks for signature pattern in email content and converts it
@@ -209,12 +211,11 @@ markdown_renderer = mistune.Markdown(
renderer=renderer,
inline=InlineParser(hard_wrap=False),
block=BlockParser(),
-
plugins=[
+ plugin_outlook_reply,
plugin_pgp_signature,
plugin_signature,
- plugin_outlook_reply,
- url
+ url,
])
diff --git a/hyperkitty/tests/test_templatetags.py b/hyperkitty/tests/test_templatetags.py
index b1d83177..f567388d 100644
--- a/hyperkitty/tests/test_templatetags.py
+++ b/hyperkitty/tests/test_templatetags.py
@@ -147,9 +147,6 @@ class TestGravatar(TestCase):
class TestDecorate(TestCase):
@@ -280,14 +512,16 @@ Index: HyperKitty-1.3.7/hyperkitty/tests/test_templatetags.py
def test_parse_quote(self):
contents = """
On Fri, 09.11.12 11:27, Someone wrote:
> This is the first quoted line
> On Fri 07.25.12, Aperson wrote:
>> This is the second quoted line.
+
This is the response.
"""
expected = (
@@ -184,7 +182,7 @@ https://some.url/llasdfjaksdgfjsdfgkjasd
@@ -168,8 +165,6 @@ This is the response.
'</blockquote></blockquote>'
'<p>This is the response.</p>\n')
result = markdown_renderer(contents)
- print('----------'*10)
- print(result)
self.assertEqual(result.strip(), expected.strip())
def test_parse_heading_normal(self):
@@ -187,7 +182,7 @@ https://some.url/llasdfjaksdgfjsdfgkjasdfbgksdfjgbsdfkgjbsdflkgjbsdflgksjdhfbgks
result = markdown_renderer(contents)
self.assertEqual(
result.strip(),
@@ -296,11 +530,67 @@ Index: HyperKitty-1.3.7/hyperkitty/tests/test_templatetags.py
def test_autolink_small_url(self):
# Test that autolink doesn't add ... to URLs that aren't truncated.
@@ -219,6 +217,7 @@ https://some.url/example
# This is another sample text.
@@ -241,6 +236,7 @@ Subject: Testing if the quoted reply works with Outlook style.
This is the original text *with* some __markup__.
"""
result = markdown_renderer(contents)
+ print(result)
self.assertEqual(
result.strip(),
'<p># This is another sample text.</p>')
"""<p>This is the replied text.</p>
@@ -250,9 +246,7 @@ From: A person &lt;person(a)example.com&gt;
Date: 6/26/23 16:23 (GMT-05:00)
To: mytestlist@example.com
Subject: Testing if the quoted reply works with Outlook style.
-
-This is the original text <em>*with*</em> some <strong>__markup__</strong>.
-</p>
+This is the original text <em>*with*</em> some <strong>__markup__</strong>.</p>
</blockquote>""") # noqa: E501
--
GitLab
From af17c334a2a35d672c9c732ed9a37bc780fdb64d Mon Sep 17 00:00:00 2001
From: Abhilash Raj <raj.abhilash1@gmail.com>
Date: Wed, 12 Jul 2023 14:14:00 +0530
Subject: [PATCH 6/6] qa fixes
---
hyperkitty/lib/renderer.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hyperkitty/lib/renderer.py b/hyperkitty/lib/renderer.py
index ddb2a77d..7f1a3230 100644
--- a/hyperkitty/lib/renderer.py
+++ b/hyperkitty/lib/renderer.py
@@ -4,7 +4,6 @@ from django.conf import settings
import mistune
from mistune.plugins.url import url
-from mistune.util import escape as escape_html
from mistune.util import safe_entity
@@ -91,6 +90,7 @@ class InlineParser(mistune.inline_parser.InlineParser):
state.tokens[-1] = last_token
return end_pos
+
def remove_header_rules(rules):
rules = list(rules)
for rule in ('setex_header', 'axt_heading'):
@@ -107,7 +107,7 @@ class BlockParser(mistune.block_parser.BlockParser):
OUTLOOK_REPLY_PATTERN = (
r'^-------- Original message --------\n'
- r'(?P<reply_text>[\s\S]+)' # everything after newline
+ r'(?P<reply_text>[\s\S]+)' # everything after newline
)
--
GitLab

View File

@@ -1,8 +1,61 @@
-------------------------------------------------------------------
Mon Nov 6 12:05:07 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- forgot to use 2 defined variables:
%{django_haystack_min_version}
%{django_extensions_min_version}
-------------------------------------------------------------------
Mon Nov 6 11:47:26 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- make it easy to run a build without testsuite
osc build --without=testsuite
-------------------------------------------------------------------
Mon Nov 6 01:20:05 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- ensure that we can create the user and group
-------------------------------------------------------------------
Mon Nov 6 01:10:25 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- make user and group creation verbose so we actually see errors
-------------------------------------------------------------------
Mon Nov 6 00:05:35 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- make it easier to notice to keep buildrequires and runtime
requires version limits in sync. This will also help us to notice
early when the version of other libraries do not match the
requires encoded in the source code.
-------------------------------------------------------------------
Sun Nov 5 23:32:56 UTC 2023 - Marcus Rueckert <mrueckert@suse.de>
- refresh gl-mr300-add-opengraph-metadata.patch for version update
-------------------------------------------------------------------
Thu Nov 2 09:27:37 UTC 2023 - Andreas Schneider <asn@cryptomilk.org>
- Update to version 1.3.8
* See https://gitlab.com/mailman/hyperkitty/-/blob/v1.3.8/doc/news.rst
or the file news.ret included in this package
- Removed fix-elasticsearch8.patch
- Updated mistune3.patch
-------------------------------------------------------------------
Thu Oct 5 08:21:08 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Add mistune3.patch to fix compatibility with mistune 3.0
-------------------------------------------------------------------
Sun Jul 30 03:50:42 UTC 2023 - Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
- Add upstream patch gl-mr300-add-opengraph-metadata.patch:
* Add OpenGraph Metadata (https://gitlab.com/mailman/hyperkitty/-/merge_requests/300)
- Add upstream patch gl-mr470-introduce-feed-filtering.patch:
* Introduce feed filtering (https://gitlab.com/mailman/hyperkitty/-/merge_requests/470)
-------------------------------------------------------------------
Thu Jul 6 09:33:42 UTC 2023 - Andreas Schneider <asn@cryptomilk.org>

View File

@@ -15,6 +15,26 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_without testsuite
# keep in sync with setup.py
%global django_min_version 3.2
%global django_max_version 4.3
%global django_mailman3_min_version 1.3.10
%global django_gravatar2_min_version 1.0.6
%global djangorestframework_min_version 3.0.0
%global robot_detection_min_version 0.3
%global pytz_min_version 2012
%global django_compressor_min_version 1.3
%global mailmanclient_min_version 3.3.3
# original this was >= 2.0.0, < 3.0 but overwritten by mistune3.patch
%global mistune_min_version 3.0
%global python_dateutil_min_version 2.0
%global networkx_min_version 2.0
%global django_haystack_min_version 2.8.0
%global django_extensions_min_version 1.3.7
%global flufl_lock_min_version 4.0
%global django_q_min_version 1.0.0
%{?sle15_python_module_pythons}
%global webapps_dir /srv/www/webapps
@@ -32,6 +52,7 @@
%global hyperkitty_services hyperkitty-qcluster.service hyperkitty-runjob-daily.service hyperkitty-runjob-daily.timer hyperkitty-runjob-hourly.service hyperkitty-runjob-hourly.timer hyperkitty-runjob-minutely.service hyperkitty-runjob-minutely.timer hyperkitty-runjob-monthly.service hyperkitty-runjob-monthly.timer hyperkitty-runjob-quarter-hourly.service hyperkitty-runjob-quarter-hourly.timer hyperkitty-runjob-weekly.service hyperkitty-runjob-weekly.timer hyperkitty-runjob-yearly.service hyperkitty-runjob-yearly.timer
# keep in sync with python-mailman-web/python-postorious
%if 0%{?suse_version} >= 1550
# Newest python supported by mailman is Python 3.11
%define pythons python311
@@ -47,7 +68,7 @@
%endif
Name: python-HyperKitty
Version: 1.3.7
Version: 1.3.8
Release: 0
Summary: A web interface to access GNU Mailman v3 archives
License: GPL-3.0-only
@@ -68,20 +89,23 @@ Source30: README.SUSE.md
# PATCH-FIX-OPENSUSE hyperkitty-settings.patch mcepl@suse.com
# hard-code locations of configuration files
Patch0: hyperkitty-settings.patch
# PATCH-FIX-UPSTREAM fix-elasticsearch8.patch gl#mailman/hyperkitty#468
Patch1: fix-elasticsearch8.patch
# PATCH-FIX-UPSTREAM mistune3.patch gl#mailman/hyperkitty#541
Patch2: mistune3.patch
#
BuildRequires: %{python_module django-compressor >= 1.3}
# PATCH-FIX-UPSTREAM gl-mr300-add-opengraph-metadata.patch gl#mailman/hyperkitty#300
Patch98: gl-mr300-add-opengraph-metadata.patch
# PATCH-FIX-UPSTREAM gl-mr470-introduce-feed-filtering.patch gl#mailman/hyperkitty#470
Patch99: gl-mr470-introduce-feed-filtering.patch
#
BuildRequires: %{python_module Django >= %{django_min_version} with %python-Django < %{django_max_version}}
BuildRequires: %{python_module django-compressor >= %{django_compressor_min_version}}
BuildRequires: %{python_module Whoosh}
BuildRequires: %{python_module django-debug-toolbar >= 2.2}
BuildRequires: %{python_module django-extensions >= 1.3.7}
BuildRequires: %{python_module django-gravatar2 >= 1.0.6}
BuildRequires: %{python_module django-extensions >= %{django_extensions_min_version}}
BuildRequires: %{python_module django-gravatar2 >= %{django_gravatar2_min_version}}
BuildRequires: %{python_module isort}
BuildRequires: %{python_module libsass}
BuildRequires: %{python_module mailmanclient >= 3.3.2}
BuildRequires: %{python_module mistune >= 2.0}
BuildRequires: %{python_module mailmanclient >= %{mailmanclient_min_version}}
BuildRequires: %{python_module mistune >= %{mistune_min_version}}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module xapian-haystack >= 2.1.0}
BuildRequires: acl
@@ -97,23 +121,22 @@ BuildArch: noarch
BuildRequires: python3-packaging
%endif
# SECTION test requirements
BuildRequires: %{python_module Django >= 1.11}
BuildRequires: %{python_module Whoosh >= 2.5.7}
BuildRequires: %{python_module beautifulsoup4 >= 4.3.2}
BuildRequires: %{python_module django-haystack >= 2.8.0}
BuildRequires: %{python_module django-mailman3 >= 1.3.8}
BuildRequires: %{python_module django-q >= 1.3.9}
BuildRequires: %{python_module djangorestframework >= 3.0.0}
BuildRequires: %{python_module django-haystack >= %{django_haystack_min_version}}
BuildRequires: %{python_module django-mailman3 >= %{django_mailman3_min_version}}
BuildRequires: %{python_module django-q >= %{django_q_min_version}}
BuildRequires: %{python_module djangorestframework >= %{djangorestframework_min_version}}
BuildRequires: %{python_module elasticsearch}
BuildRequires: %{python_module flufl.lock}
BuildRequires: %{python_module flufl.lock >= %{flufl_lock_min_version}}
BuildRequires: %{python_module lxml}
BuildRequires: %{python_module mistune}
BuildRequires: %{python_module networkx >= 1.9.1}
BuildRequires: %{python_module mistune >= %{mistune_min_version}}
BuildRequires: %{python_module networkx >= %{networkx_min_version}}
BuildRequires: %{python_module pytest-django}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil >= 2.0}
BuildRequires: %{python_module pytz >= 2012}
BuildRequires: %{python_module robot-detection >= 0.3}
BuildRequires: %{python_module python-dateutil >= %{python_dateutil_min_version}}
BuildRequires: %{python_module pytz >= %{pytz_min_version}}
BuildRequires: %{python_module robot-detection >= %{robot_detection_min_version}}
# /SECTION
%description
@@ -121,25 +144,24 @@ A web interface to access GNU Mailman v3 archives.
%package -n %{hyperkitty_pkgname}
Summary: A web interface to access GNU Mailman v3 archives
Requires: %{mypython}-Django >= 1.11
Requires: %{mypython}-Whoosh
Requires: %{mypython}-django-compressor >= 1.3
# important sync with
Requires: (%{mypython}-Django >= %{django_min_version} with %{mypython}-Django < %{django_max_version})
Requires: %{mypython}-django-compressor >= %{django_compressor_min_version}
Requires: %{mypython}-django-debug-toolbar >= 2.2
Requires: %{mypython}-django-extensions >= 1.3.7
Requires: %{mypython}-django-gravatar2 >= 1.0.6
Requires: %{mypython}-django-extensions >= %{django_extensions_min_version}
Requires: %{mypython}-django-gravatar2 >= %{django_gravatar2_min_version}
Requires: %{mypython}-django-haystack >= 2.8.0
Requires: %{mypython}-django-mailman3 >= 1.3.7
Requires: %{mypython}-django-q >= 1.3.9
Requires: %{mypython}-djangorestframework >= 3.0.0
Requires: %{mypython}-flufl.lock
Requires: %{mypython}-libsass
Requires: %{mypython}-mailmanclient >= 3.3.2
Requires: %{mypython}-mistune
Requires: %{mypython}-networkx >= 1.9.1
Requires: %{mypython}-python-dateutil >= 2.0
Requires: %{mypython}-pytz >= 2012
Requires: %{mypython}-robot-detection >= 0.3
Requires: %{mypython}-xapian-haystack >= 2.1.0
Requires: %{mypython}-django-mailman3 >= %{django_mailman3_min_version}
Requires: %{mypython}-django-q >= %{django_q_min_version}
Requires: %{mypython}-djangorestframework >= %{djangorestframework_min_version}
Requires: %{mypython}-flufl.lock >= %{flufl_lock_min_version}
Requires: %{mypython}-mailmanclient >= %{mailmanclient_min_version}
Requires: %{mypython}-mistune >= %{mistune_min_version}
Requires: %{mypython}-networkx >= %{networkx_min_version}
Requires: %{mypython}-python-dateutil >= %{python_dateutil_min_version}
Requires: %{mypython}-pytz >= %{pytz_min_version}
Requires: %{mypython}-robot-detection >= %{robot_detection_min_version}
Requires: %{mypython}-xapian-haystack >= %{django_haystack_min_version}
%if "%{expand:%%%{mypython}_provides}" == "python3"
Provides: python3-%{hyperkitty_pkgname} = %{version}-%{release}
%endif
@@ -159,6 +181,8 @@ Requires: %{hyperkitty_pkgname}
Requires: acl
Requires: openssl
Requires: sudo
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
%description -n %{hyperkitty_pkgname}-web
A web user interface for GNU Mailman.
@@ -291,14 +315,16 @@ for job in \
sed -i "s#@HYPERKITTY_RUNJOB@#${hyperkitty_runjob_name}#g" %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.timer
done
%if %{with testuite}
%check
export PYTHONPATH="$(pwd)"
export LANG=C.UTF-8
%pytest
%endif
%pre -n %{hyperkitty_pkgname}-web
/usr/sbin/groupadd -r hyperkitty &>/dev/null || :
/usr/sbin/useradd -g hyperkitty -s /bin/false -r -c "HyperKitty" -d %{hyperkitty_basedir} hyperkitty &>/dev/null || :
/usr/sbin/groupadd -r hyperkitty || :
/usr/sbin/useradd -g hyperkitty -s /bin/false -r -c "HyperKitty" -d %{hyperkitty_basedir} hyperkitty || :
%service_add_pre %{hyperkitty_services}