forked from pool/pagure
- Backport fixes for STARTTLS support
+ Patch: 0002-starttls-support-via-SMTP_STARTTLS-provide-additiona.patch + Patch: 0001-Do-not-assume-there-is-a-SMTP_STARTTLS-configuration.patch - Backport fix for docs repo access grant + Patch: 0001-Fix-repotype-spelling.patch - Backport fix for visual bug on API docs formatting + Patch: 0001-api-fix-apidoc-format-on-api_view_issues_history_det.patch - Backport fix to changing pull mirror settings + Patch: 0001-Allow-editing-the-URL-a-project-is-mirrored-from.patch - Backport fix to add descriptions to API scopes + Patch: 0001-Show-the-ACL-name-in-addition-to-the-description-whe.patch - Backport fix to make heatmap UI functional again + Patch: 0001-Bring-back-JS-library-used-for-the-heatmap.patch - Backport fix for handling headers + Patch: 0001-Ensure-the-title-name-of-the-headers-are-strings.patch - Backport fix for burndown graph title + Patch: 0001-Fix-the-title-of-the-graph-showing-the-evolution-of-.patch - Backport fix for permissions on authorized_keys file + Patch: 0001-Make-sure-authorized_keys-file-has-mode-600.patch - Add patch to use whitenoise for rendering static assets + Patch: 0101-Use-WhiteNoise-to-serve-static-assets-for-the-Pagure.patch - Refresh default configuration patch + Patch: pagure-5.0-default-example-cfg.patch OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/pagure?expand=0&rev=39
This commit is contained in:
parent
36ab9a2663
commit
524e667a5f
@ -1,7 +1,7 @@
|
||||
From 4196a3772693a79f1e5db12fa937bcee8280e248 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Mon, 18 May 2020 15:57:05 +0200
|
||||
Subject: [PATCH] Add support for smtp server requiring starttls to work
|
||||
Subject: [PATCH 1/2] Add support for smtp server requiring starttls to work
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
|
206
0001-Allow-editing-the-URL-a-project-is-mirrored-from.patch
Normal file
206
0001-Allow-editing-the-URL-a-project-is-mirrored-from.patch
Normal file
@ -0,0 +1,206 @@
|
||||
From c78ea50ecfb6cb9c2be7aa9eabedf1f5c6292e84 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Sat, 30 May 2020 22:30:54 +0200
|
||||
Subject: [PATCH] Allow editing the URL a project is mirrored from
|
||||
|
||||
When a project is mirrored from a remote location to a local pagure
|
||||
instance, we so far had no way to edit this url, for example for
|
||||
when the upstream project changes location.
|
||||
With this commit we're able to fix this.
|
||||
|
||||
Fixes https://pagure.io/pagure/issue/4647
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/forms.py | 4 +
|
||||
pagure/templates/settings.html | 9 ++
|
||||
pagure/ui/repo.py | 2 +
|
||||
...test_pagure_flask_ui_repo_mirrored_from.py | 128 ++++++++++++++++++
|
||||
4 files changed, 143 insertions(+)
|
||||
create mode 100644 tests/test_pagure_flask_ui_repo_mirrored_from.py
|
||||
|
||||
diff --git a/pagure/forms.py b/pagure/forms.py
|
||||
index 228a0206..6daa8a81 100644
|
||||
--- a/pagure/forms.py
|
||||
+++ b/pagure/forms.py
|
||||
@@ -159,6 +159,10 @@ class ProjectFormSimplified(PagureForm):
|
||||
private = wtforms.BooleanField(
|
||||
"Private", [wtforms.validators.Optional()], false_values=FALSE_VALUES
|
||||
)
|
||||
+ mirrored_from = wtforms.StringField(
|
||||
+ "Mirrored from",
|
||||
+ [wtforms.validators.optional(), wtforms.validators.Length(max=255)],
|
||||
+ )
|
||||
|
||||
|
||||
class ProjectForm(ProjectFormSimplified):
|
||||
diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html
|
||||
index a09d722d..55df03a0 100644
|
||||
--- a/pagure/templates/settings.html
|
||||
+++ b/pagure/templates/settings.html
|
||||
@@ -160,6 +160,15 @@
|
||||
<span class="c-indicator"></span>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
+ {% if repo.mirrored_from %}
|
||||
+ <fieldset class="form-group">
|
||||
+ <label for="tags">Mirrored from</label>
|
||||
+ <input class="form-control" name="mirrored_from" value="{{ repo.mirrored_from }}" />
|
||||
+ <small class="text-muted">
|
||||
+ The (public) url from which this repository is mirrored.
|
||||
+ </small>
|
||||
+ </fieldset>
|
||||
+ {% endif %}
|
||||
<button class="btn btn-primary" type="submit" title="Update description">
|
||||
Update
|
||||
</button>
|
||||
diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py
|
||||
index 5b522b5a..040b2bc5 100644
|
||||
--- a/pagure/ui/repo.py
|
||||
+++ b/pagure/ui/repo.py
|
||||
@@ -1421,6 +1421,8 @@ def update_project(repo, username=None, namespace=None):
|
||||
repo.url = form.url.data.strip()
|
||||
if repo.private:
|
||||
repo.private = form.private.data
|
||||
+ if repo.mirrored_from:
|
||||
+ repo.mirrored_from = form.mirrored_from.data
|
||||
pagure.lib.query.update_tags(
|
||||
flask.g.session,
|
||||
repo,
|
||||
diff --git a/tests/test_pagure_flask_ui_repo_mirrored_from.py b/tests/test_pagure_flask_ui_repo_mirrored_from.py
|
||||
new file mode 100644
|
||||
index 00000000..2c33053a
|
||||
--- /dev/null
|
||||
+++ b/tests/test_pagure_flask_ui_repo_mirrored_from.py
|
||||
@@ -0,0 +1,128 @@
|
||||
+# -*- coding: utf-8 -*-
|
||||
+
|
||||
+"""
|
||||
+ (c) 2020 - Copyright Red Hat Inc
|
||||
+
|
||||
+ Authors:
|
||||
+ Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
+
|
||||
+"""
|
||||
+
|
||||
+from __future__ import unicode_literals, absolute_import
|
||||
+
|
||||
+import datetime
|
||||
+import os
|
||||
+import shutil
|
||||
+import sys
|
||||
+import tempfile
|
||||
+import time
|
||||
+import unittest
|
||||
+
|
||||
+import pygit2
|
||||
+import six
|
||||
+from mock import patch, MagicMock, ANY, call
|
||||
+
|
||||
+sys.path.insert(
|
||||
+ 0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
|
||||
+)
|
||||
+
|
||||
+import pagure.lib.git
|
||||
+import tests
|
||||
+
|
||||
+from pagure.lib.repo import PagureRepo
|
||||
+
|
||||
+
|
||||
+class PagureUiRepoMirroredFromTests(tests.Modeltests):
|
||||
+ """ Tests for pagure project that are mirrored from a remote location
|
||||
+ """
|
||||
+
|
||||
+ maxDiff = None
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ """ Set up the environnment, ran before every tests. """
|
||||
+ super(PagureUiRepoMirroredFromTests, self).setUp()
|
||||
+
|
||||
+ tests.create_projects(self.session)
|
||||
+ tests.create_projects_git(os.path.join(self.path, "repos"), bare=True)
|
||||
+
|
||||
+ # Make the test project mirrored from elsewhere
|
||||
+ self.project = pagure.lib.query.get_authorized_project(
|
||||
+ self.session, "test"
|
||||
+ )
|
||||
+ self.project.mirrored_from = "https://example.com/foo/bar.git"
|
||||
+ self.session.add(self.project)
|
||||
+ self.session.commit()
|
||||
+
|
||||
+ def test_settings_shows(self):
|
||||
+ """ Ensure that the box to edit the mirrored from value shows up
|
||||
+ in the settings.
|
||||
+ """
|
||||
+ user = tests.FakeUser(username="pingou")
|
||||
+ with tests.user_set(self.app.application, user):
|
||||
+ output = self.app.get("/test/settings")
|
||||
+ self.assertEqual(output.status_code, 200)
|
||||
+ output_text = output.get_data(as_text=True)
|
||||
+ self.assertIn(
|
||||
+ '<input class="form-control" name="mirrored_from" '
|
||||
+ 'value="https://example.com/foo/bar.git" />',
|
||||
+ output_text,
|
||||
+ )
|
||||
+ self.assertIn(
|
||||
+ "The (public) url from which this repository is mirrored.",
|
||||
+ output_text,
|
||||
+ )
|
||||
+
|
||||
+ def test_settings_not_show(self):
|
||||
+ """ Ensure that the box to edit the mirrored from value does not
|
||||
+ show up in the settings when it shouldn't.
|
||||
+ """
|
||||
+ user = tests.FakeUser(username="pingou")
|
||||
+ with tests.user_set(self.app.application, user):
|
||||
+ output = self.app.get("/test2/settings")
|
||||
+ self.assertEqual(output.status_code, 200)
|
||||
+ output_text = output.get_data(as_text=True)
|
||||
+ self.assertNotIn(
|
||||
+ '<input class="form-control" name="mirrored_from" ',
|
||||
+ output_text,
|
||||
+ )
|
||||
+ self.assertNotIn(
|
||||
+ "The (public) url from which this repository is mirrored.",
|
||||
+ output_text,
|
||||
+ )
|
||||
+
|
||||
+ def test_edit_mirrored_from(self):
|
||||
+ """ Ensure that we can successfully edit the content of the
|
||||
+ mirrored_from field.
|
||||
+ """
|
||||
+ user = tests.FakeUser(username="pingou")
|
||||
+ with tests.user_set(self.app.application, user):
|
||||
+ output = self.app.get("/test/settings")
|
||||
+ self.assertEqual(output.status_code, 200)
|
||||
+ output_text = output.get_data(as_text=True)
|
||||
+ self.assertIn(
|
||||
+ '<input class="form-control" name="mirrored_from" '
|
||||
+ 'value="https://example.com/foo/bar.git" />',
|
||||
+ output_text,
|
||||
+ )
|
||||
+
|
||||
+ csrf_token = self.get_csrf(output=output)
|
||||
+
|
||||
+ data = {
|
||||
+ "csrf_token": csrf_token,
|
||||
+ "description": "test repo",
|
||||
+ "mirrored_from": "https://example2.com/bar.git",
|
||||
+ }
|
||||
+ output = self.app.post(
|
||||
+ "/test/update", data=data, follow_redirects=True
|
||||
+ )
|
||||
+ self.assertEqual(output.status_code, 200)
|
||||
+ output_text = output.get_data(as_text=True)
|
||||
+ self.assertIn(
|
||||
+ '<input class="form-control" name="mirrored_from" '
|
||||
+ 'value="https://example2.com/bar.git" />',
|
||||
+ output_text,
|
||||
+ )
|
||||
+
|
||||
+
|
||||
+if __name__ == "__main__":
|
||||
+ unittest.main(verbosity=2)
|
||||
--
|
||||
2.26.1
|
||||
|
9594
0001-Bring-back-JS-library-used-for-the-heatmap.patch
Normal file
9594
0001-Bring-back-JS-library-used-for-the-heatmap.patch
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,30 @@
|
||||
From a5a0e792e8491f416d3188c42861ba0c62e94a79 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Wed, 3 Jun 2020 20:19:48 +0200
|
||||
Subject: [PATCH] Do not assume there is a SMTP_STARTTLS configuration key set
|
||||
|
||||
This is a new key that was introduced in 5.10.0 and that isn't set
|
||||
in the default_config. So we cannot assume it is defined and thus
|
||||
the code needs to not make this assumption either.
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/lib/notify.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py
|
||||
index 2c4ee30f..0c124db9 100644
|
||||
--- a/pagure/lib/notify.py
|
||||
+++ b/pagure/lib/notify.py
|
||||
@@ -506,7 +506,7 @@ def send_email(
|
||||
pagure_config["SMTP_PORT"],
|
||||
)
|
||||
|
||||
- if pagure_config["SMTP_STARTTLS"]:
|
||||
+ if pagure_config.get("SMTP_STARTTLS"):
|
||||
context = ssl.create_default_context()
|
||||
keyfile = pagure_config.get("SMTP_KEYFILE") or None
|
||||
certfile = pagure_config.get("SMTP_CERTFILE") or None
|
||||
--
|
||||
2.26.2
|
||||
|
28
0001-Ensure-the-title-name-of-the-headers-are-strings.patch
Normal file
28
0001-Ensure-the-title-name-of-the-headers-are-strings.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 8f8e201bf25e5ee1fd359ecf97eb41d09320bcb2 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Wed, 3 Jun 2020 20:21:31 +0200
|
||||
Subject: [PATCH] Ensure the title/name of the headers are strings
|
||||
|
||||
Whether this is running py2 or py3, the headers should be strings.
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/ui/clone.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pagure/ui/clone.py b/pagure/ui/clone.py
|
||||
index 61615cc8..33732a41 100644
|
||||
--- a/pagure/ui/clone.py
|
||||
+++ b/pagure/ui/clone.py
|
||||
@@ -205,7 +205,7 @@ def proxy_raw_git(project):
|
||||
break
|
||||
header = line.split(b": ", 1)
|
||||
header[0] = header[0].decode("utf-8")
|
||||
- headers[header[0].lower()] = header[1]
|
||||
+ headers[str(header[0].lower())] = header[1]
|
||||
|
||||
if len(headers) == 0:
|
||||
raise Exception("No response at all received")
|
||||
--
|
||||
2.26.2
|
||||
|
30
0001-Fix-repotype-spelling.patch
Normal file
30
0001-Fix-repotype-spelling.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 86c9a6f729968432b9f0dd785548fbe8065f6f4b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||
Date: Fri, 22 May 2020 11:49:10 +0200
|
||||
Subject: [PATCH] Fix repotype spelling
|
||||
|
||||
---
|
||||
pagure/internal/__init__.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py
|
||||
index 4f106e8b..3fa7edfa 100644
|
||||
--- a/pagure/internal/__init__.py
|
||||
+++ b/pagure/internal/__init__.py
|
||||
@@ -157,11 +157,11 @@ def check_ssh_access():
|
||||
return flask.jsonify({"access": False})
|
||||
_log.info("Checking ACLs on project: %s" % project.fullname)
|
||||
|
||||
- if repotype not in ["main", "doc"] and not pagure.utils.is_repo_user(
|
||||
+ if repotype not in ["main", "docs"] and not pagure.utils.is_repo_user(
|
||||
project, remoteuser
|
||||
):
|
||||
# Deploy keys are not allowed on ticket and PR repos but they are
|
||||
- # allowed for main and doc repos.
|
||||
+ # allowed for main and docs repos.
|
||||
_log.info("%s is not a contributor to this project" % remoteuser)
|
||||
return flask.jsonify({"access": False})
|
||||
|
||||
--
|
||||
2.26.1
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 907ba17242490b767c21cec877dd3ad322526ef6 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Wed, 3 Jun 2020 20:23:45 +0200
|
||||
Subject: [PATCH] Fix the title of the graph showing the evolution of the
|
||||
number of open tickets on a project
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/static/issues_stats.js | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pagure/static/issues_stats.js b/pagure/static/issues_stats.js
|
||||
index 32b4c2a9..5e81a3ab 100644
|
||||
--- a/pagure/static/issues_stats.js
|
||||
+++ b/pagure/static/issues_stats.js
|
||||
@@ -70,7 +70,7 @@ function issues_history_stats_plot(data) {
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
- text: 'Evolution of the number of commits over the last year'
|
||||
+ text: 'Evolution of the number of open tickets over the last year'
|
||||
}
|
||||
}
|
||||
});
|
||||
--
|
||||
2.26.2
|
||||
|
30
0001-Make-sure-authorized_keys-file-has-mode-600.patch
Normal file
30
0001-Make-sure-authorized_keys-file-has-mode-600.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 2691e9d47d45be9a72798bd84166d09b5c3c8d82 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Durigan Junior <sergiodj@sergiodj.net>
|
||||
Date: Sun, 7 Jun 2020 17:16:15 -0400
|
||||
Subject: [PATCH] Make sure authorized_keys file has mode 600.
|
||||
|
||||
Only the pagure user needs to be able to read and write the file.
|
||||
---
|
||||
pagure/lib/tasks.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py
|
||||
index eaef5cdb..73323ef7 100644
|
||||
--- a/pagure/lib/tasks.py
|
||||
+++ b/pagure/lib/tasks.py
|
||||
@@ -1270,6 +1270,7 @@ def add_key_to_authorized_keys(self, session, ssh_folder, username, sshkey):
|
||||
sshkey.strip(),
|
||||
)
|
||||
)
|
||||
+ os.chmod(fullpath, 0o600)
|
||||
|
||||
|
||||
@conn.task(queue=pagure_config.get("AUTHORIZED_KEYS_QUEUE", None), bind=True)
|
||||
@@ -1294,3 +1295,4 @@ def remove_key_from_authorized_keys(self, session, ssh_folder, sshkey):
|
||||
|
||||
with open(fullpath, "w") as stream:
|
||||
stream.write("\n".join(output))
|
||||
+ os.chmod(fullpath, 0o600)
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 98d320cad34ed2defadeb4828a9d5d7690a06ffd Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Sun, 31 May 2020 21:16:36 +0200
|
||||
Subject: [PATCH] Show the ACL name in addition to the description when
|
||||
creating API tokens
|
||||
|
||||
So in addition to the description of the ACL, we will now show the
|
||||
actual name of the ACL, which hopefully will help people when they
|
||||
meet documentation that says: create a token with the update_issue ACL.
|
||||
|
||||
Relates to https://pagure.io/pagure/issue/4765
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/templates/add_token.html | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pagure/templates/add_token.html b/pagure/templates/add_token.html
|
||||
index 02f5a80a..bf8a571b 100644
|
||||
--- a/pagure/templates/add_token.html
|
||||
+++ b/pagure/templates/add_token.html
|
||||
@@ -44,7 +44,7 @@
|
||||
<label class="c-input c-checkbox">
|
||||
<input type="checkbox" name="acls" value="{{ acl.name }}">
|
||||
<span class="c-indicator"></span>
|
||||
- {{ acl.description }}
|
||||
+ {{ acl.description }} <span class="small">({{ acl.name }})</span>
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
--
|
||||
2.26.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 656ef585dce90201f6e5e13f527284672a5fd7ee Mon Sep 17 00:00:00 2001
|
||||
From: Julen Landa Alustiza <jlanda@fedoraproject.org>
|
||||
Date: Wed, 27 May 2020 13:18:17 +0200
|
||||
Subject: [PATCH] api: fix apidoc format on
|
||||
api_view_issues_history_detailed_stats Fixes web api doc view template issues
|
||||
|
||||
---
|
||||
pagure/api/issue.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/pagure/api/issue.py b/pagure/api/issue.py
|
||||
index 99e3c7e6..3f9af2a6 100644
|
||||
--- a/pagure/api/issue.py
|
||||
+++ b/pagure/api/issue.py
|
||||
@@ -1568,6 +1568,7 @@ def api_view_issues_history_detailed_stats(
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
::
|
||||
+
|
||||
{
|
||||
"stats": {
|
||||
"2020-03-26T19:21:51.348451": {
|
||||
--
|
||||
2.26.1
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 27ab4efb3bfad27e036602e88c7d5de666c3d80b Mon Sep 17 00:00:00 2001
|
||||
From: midipix <writeonce@midipix.org>
|
||||
Date: Thu, 21 May 2020 15:09:30 +0000
|
||||
Subject: [PATCH 2/2] starttls support via SMTP_STARTTLS: provide additional
|
||||
documentation.
|
||||
|
||||
---
|
||||
doc/configuration.rst | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/doc/configuration.rst b/doc/configuration.rst
|
||||
index 25dee387..942aeb83 100644
|
||||
--- a/doc/configuration.rst
|
||||
+++ b/doc/configuration.rst
|
||||
@@ -938,6 +938,8 @@ sending emails.
|
||||
|
||||
Defaults to: ``localhost``.
|
||||
|
||||
+See also the SMTP_STARTTLS section.
|
||||
+
|
||||
|
||||
SMTP_PORT
|
||||
^^^^^^^^^
|
||||
@@ -967,6 +969,13 @@ SMTP_STARTTLS
|
||||
This configuration key specifies instructs pagure to starts connecting to
|
||||
the SMTP server via a `starttls` command.
|
||||
|
||||
+When enabling STARTTLS in conjunction with a local smtp server, you should
|
||||
+replace ``localhost`` with a host name that is included in the server's
|
||||
+certificate. If the server only relays messages originating from ``localhost``,
|
||||
+then you should also ensure that the above host name resolves to the same
|
||||
+tcp address as ``localhost``, for instance by adding an appropriate record
|
||||
+to */etc/hosts*.
|
||||
+
|
||||
Defaults to: ``False``
|
||||
|
||||
|
||||
--
|
||||
2.26.1
|
||||
|
179
0101-Use-WhiteNoise-to-serve-static-assets-for-the-Pagure.patch
Normal file
179
0101-Use-WhiteNoise-to-serve-static-assets-for-the-Pagure.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From 89f18ee38de1e6cb3ac482f865e6352ed340d763 Mon Sep 17 00:00:00 2001
|
||||
From: Neal Gompa <ngompa13@gmail.com>
|
||||
Date: Sun, 31 May 2020 11:56:38 -0400
|
||||
Subject: [PATCH] Use WhiteNoise to serve static assets for the Pagure web
|
||||
interface
|
||||
|
||||
In order to make it easier to run Pagure in a containerized environment,
|
||||
the web frontend needs to be capable of serving all of the frontend static
|
||||
files. This change introduces WhiteNoise as a dependency that would enable
|
||||
the Flask application itself to serve the static assets correctly.
|
||||
|
||||
This makes it possible to run a Pagure server without Apache or Nginx at all
|
||||
in a containerized environment for all of the main functions.
|
||||
|
||||
Note that the releases folder is still not served through WhiteNoise, and
|
||||
deployments that have uploading releases enabled will need something to
|
||||
serve them.
|
||||
|
||||
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
|
||||
---
|
||||
files/pagure-apache-httpd.conf | 3 ---
|
||||
files/pagure-nginx.conf | 9 ---------
|
||||
files/pagure.spec | 13 ++-----------
|
||||
pagure/docs_server.py | 9 +++++++++
|
||||
pagure/flask_app.py | 7 +++++++
|
||||
requirements.txt | 1 +
|
||||
6 files changed, 19 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/files/pagure-apache-httpd.conf b/files/pagure-apache-httpd.conf
|
||||
index cf61e7f4..5724deb4 100644
|
||||
--- a/files/pagure-apache-httpd.conf
|
||||
+++ b/files/pagure-apache-httpd.conf
|
||||
@@ -33,8 +33,6 @@
|
||||
#SSLCertificateChainFile /etc/pki/tls/....intermediate.crt
|
||||
#SSLCertificateKeyFile /etc/pki/tls/....key
|
||||
|
||||
- #Alias /static /usr/lib/pythonX.Y/site-packages/pagure/static/
|
||||
-
|
||||
#<Location />
|
||||
#WSGIProcessGroup paguredocs
|
||||
#<IfModule mod_authz_core.c>
|
||||
@@ -64,7 +62,6 @@
|
||||
#SSLCertificateChainFile /etc/pki/tls/....intermediate.crt
|
||||
#SSLCertificateKeyFile /etc/pki/tls/....key
|
||||
|
||||
- #Alias /static /usr/lib/pythonX.Y/site-packages/pagure/static/
|
||||
#Alias /releases /var/www/releases
|
||||
|
||||
## Section used to support cloning git repo over http (https in this case)
|
||||
diff --git a/files/pagure-nginx.conf b/files/pagure-nginx.conf
|
||||
index fe3ff832..a5d196a6 100644
|
||||
--- a/files/pagure-nginx.conf
|
||||
+++ b/files/pagure-nginx.conf
|
||||
@@ -27,11 +27,6 @@
|
||||
#try_files $uri @pagure_docs;
|
||||
#}
|
||||
|
||||
- #location /static {
|
||||
- #alias /usr/lib/pythonX.Y/site-packages/pagure/static/;
|
||||
- #try_files $uri $uri/;
|
||||
- #}
|
||||
-
|
||||
#}
|
||||
|
||||
#server {
|
||||
@@ -63,10 +58,6 @@
|
||||
#try_files $uri @pagure;
|
||||
#}
|
||||
|
||||
- #location /static {
|
||||
- #alias /usr/lib/pythonX.Y/site-packages/pagure/static/;
|
||||
- #}
|
||||
-
|
||||
#location /releases {
|
||||
#alias /var/www/releases/;
|
||||
#autoindex on;
|
||||
diff --git a/files/pagure.spec b/files/pagure.spec
|
||||
index 5c084436..24fd5b37 100644
|
||||
--- a/files/pagure.spec
|
||||
+++ b/files/pagure.spec
|
||||
@@ -75,6 +75,7 @@ Requires: python%{python_pkgversion}-requests
|
||||
Requires: python%{python_pkgversion}-six
|
||||
Requires: python%{python_pkgversion}-sqlalchemy >= 0.8
|
||||
Requires: python%{python_pkgversion}-straight-plugin
|
||||
+Requires: python%{python_pkgversion}-whitenoise
|
||||
Requires: python%{python_pkgversion}-wtforms
|
||||
%endif
|
||||
|
||||
@@ -365,22 +366,12 @@ sed -e "s|#!/usr/bin/env python|#!%{__python}|" -i \
|
||||
# Switch interpreter for systemd units
|
||||
sed -e "s|/usr/bin/python|%{__python}|g" -i $RPM_BUILD_ROOT/%{_unitdir}/*.service
|
||||
|
||||
-%if 0%{?rhel} && 0%{?rhel} < 8
|
||||
-# Change to correct static file path for apache httpd and nginx
|
||||
-sed -e "s/pythonX.Y/python%{python2_version}/g" -i \
|
||||
- $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/pagure.conf \
|
||||
- $RPM_BUILD_ROOT/%{_sysconfdir}/nginx/conf.d/pagure.conf
|
||||
-%else
|
||||
+%if ! (0%{?rhel} && 0%{?rhel} < 8)
|
||||
# Switch all systemd units to use the correct celery
|
||||
sed -e "s|/usr/bin/celery|/usr/bin/celery-3|g" -i $RPM_BUILD_ROOT/%{_unitdir}/*.service
|
||||
|
||||
# Switch all systemd units to use the correct gunicorn
|
||||
sed -e "s|/usr/bin/gunicorn|/usr/bin/gunicorn-3|g" -i $RPM_BUILD_ROOT/%{_unitdir}/*.service
|
||||
-
|
||||
-# Change to correct static file path for apache httpd and nginx
|
||||
-sed -e "s/pythonX.Y/python%{python3_version}/g" -i \
|
||||
- $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/pagure.conf \
|
||||
- $RPM_BUILD_ROOT/%{_sysconfdir}/nginx/conf.d/pagure.conf
|
||||
%endif
|
||||
|
||||
# Make log directories
|
||||
diff --git a/pagure/docs_server.py b/pagure/docs_server.py
|
||||
index fd7b2778..dc5e297b 100644
|
||||
--- a/pagure/docs_server.py
|
||||
+++ b/pagure/docs_server.py
|
||||
@@ -17,6 +17,7 @@ import flask
|
||||
import pygit2
|
||||
|
||||
from binaryornot.helpers import is_binary_string
|
||||
+from whitenoise import WhiteNoise
|
||||
|
||||
import pagure.config
|
||||
import pagure.doc_utils
|
||||
@@ -29,6 +30,14 @@ import pagure.forms
|
||||
# Create the application.
|
||||
APP = flask.Flask(__name__)
|
||||
|
||||
+# Setup WhiteNoise for serving static files
|
||||
+here = os.path.abspath(
|
||||
+ os.path.join(os.path.dirname(os.path.abspath(__file__)))
|
||||
+)
|
||||
+APP.wsgi_app = WhiteNoise(
|
||||
+ APP.wsgi_app, root=os.path.join(here, "static"), prefix="/static"
|
||||
+)
|
||||
+
|
||||
# set up FAS
|
||||
APP.config = pagure.config.reload_config()
|
||||
|
||||
diff --git a/pagure/flask_app.py b/pagure/flask_app.py
|
||||
index 7d533b63..34eb4783 100644
|
||||
--- a/pagure/flask_app.py
|
||||
+++ b/pagure/flask_app.py
|
||||
@@ -21,6 +21,8 @@ import warnings
|
||||
import flask
|
||||
import pygit2
|
||||
|
||||
+from whitenoise import WhiteNoise
|
||||
+
|
||||
import pagure.doc_utils
|
||||
import pagure.exceptions
|
||||
import pagure.forms
|
||||
@@ -188,6 +190,11 @@ def create_app(config=None):
|
||||
app.jinja_loader = jinja2.ChoiceLoader(templ_loaders)
|
||||
app.register_blueprint(themeblueprint)
|
||||
|
||||
+ # Setup WhiteNoise for serving static files
|
||||
+ app.wsgi_app = WhiteNoise(
|
||||
+ app.wsgi_app, root=os.path.join(here, "static"), prefix="/static"
|
||||
+ )
|
||||
+
|
||||
app.before_request(set_request)
|
||||
app.after_request(after_request)
|
||||
app.teardown_request(end_request)
|
||||
diff --git a/requirements.txt b/requirements.txt
|
||||
index dcde36ce..fa538676 100644
|
||||
--- a/requirements.txt
|
||||
+++ b/requirements.txt
|
||||
@@ -33,6 +33,7 @@ sqlalchemy >= 0.8
|
||||
# 1.4.0 is broken, 1.4.0-post-1 works but gives odd results on newer setuptools
|
||||
# the latest version 1.5.0 is also known to work
|
||||
straight.plugin
|
||||
+whitenoise
|
||||
wtforms
|
||||
|
||||
# Required only for the `oidc` authentication backend
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,6 +1,6 @@
|
||||
diff -rup pagure/files/gitolite3.rc pagure.cfg-defs/files/gitolite3.rc
|
||||
--- pagure/files/gitolite3.rc 2020-05-08 21:32:56.673172022 -0400
|
||||
+++ pagure.cfg-defs/files/gitolite3.rc 2020-05-08 21:37:03.018641878 -0400
|
||||
--- pagure/files/gitolite3.rc 2020-06-21 09:19:34.924187087 -0400
|
||||
+++ pagure.cfg-defs/files/gitolite3.rc 2020-06-21 09:20:06.922455887 -0400
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
@ -11,8 +11,8 @@ diff -rup pagure/files/gitolite3.rc pagure.cfg-defs/files/gitolite3.rc
|
||||
# default umask gives you perms of '0700'; see the rc file docs for
|
||||
# how/why you might change this
|
||||
diff -rup pagure/files/pagure-apache-httpd.conf pagure.cfg-defs/files/pagure-apache-httpd.conf
|
||||
--- pagure/files/pagure-apache-httpd.conf 2020-05-08 21:33:38.860594994 -0400
|
||||
+++ pagure.cfg-defs/files/pagure-apache-httpd.conf 2020-05-08 21:39:33.815153778 -0400
|
||||
--- pagure/files/pagure-apache-httpd.conf 2020-06-21 09:19:34.926187104 -0400
|
||||
+++ pagure.cfg-defs/files/pagure-apache-httpd.conf 2020-06-21 09:20:06.923455896 -0400
|
||||
@@ -29,9 +29,9 @@
|
||||
## Use secure TLSv1.1 and TLSv1.2 ciphers
|
||||
#Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
|
||||
@ -24,9 +24,9 @@ diff -rup pagure/files/pagure-apache-httpd.conf pagure.cfg-defs/files/pagure-apa
|
||||
+ #SSLCertificateChainFile /etc/ssl/....intermediate.crt
|
||||
+ #SSLCertificateKeyFile /etc/ssl/....key
|
||||
|
||||
#Alias /static /usr/lib/pythonX.Y/site-packages/pagure/static/
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
#<Location />
|
||||
#WSGIProcessGroup paguredocs
|
||||
@@ -58,9 +58,9 @@
|
||||
## Use secure TLSv1.1 and TLSv1.2 ciphers
|
||||
#Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
|
||||
|
||||
@ -37,9 +37,9 @@ diff -rup pagure/files/pagure-apache-httpd.conf pagure.cfg-defs/files/pagure-apa
|
||||
+ #SSLCertificateChainFile /etc/ssl/....intermediate.crt
|
||||
+ #SSLCertificateKeyFile /etc/ssl/....key
|
||||
|
||||
#Alias /static /usr/lib/pythonX.Y/site-packages/pagure/static/
|
||||
#Alias /releases /var/www/releases
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
#</IfModule>
|
||||
#</Location>
|
||||
|
||||
@ -49,8 +49,8 @@ diff -rup pagure/files/pagure-apache-httpd.conf pagure.cfg-defs/files/pagure-apa
|
||||
#</Directory>
|
||||
|
||||
diff -rup pagure/files/pagure.cfg.sample pagure.cfg-defs/files/pagure.cfg.sample
|
||||
--- pagure/files/pagure.cfg.sample 2020-05-08 21:32:56.679172082 -0400
|
||||
+++ pagure.cfg-defs/files/pagure.cfg.sample 2020-05-08 22:03:36.961622933 -0400
|
||||
--- pagure/files/pagure.cfg.sample 2020-06-21 09:19:34.927187112 -0400
|
||||
+++ pagure.cfg-defs/files/pagure.cfg.sample 2020-06-21 09:20:06.923455896 -0400
|
||||
@@ -72,25 +72,33 @@ DOC_APP_URL = 'http://docs.localhost.loc
|
||||
|
||||
### The URL to use to clone git repositories.
|
||||
@ -121,10 +121,9 @@ diff -rup pagure/files/pagure.cfg.sample pagure.cfg-defs/files/pagure.cfg.sample
|
||||
|
||||
### Path to the gitolite.rc file
|
||||
GL_RC = None
|
||||
Only in pagure.cfg-defs/files: pagure.cfg.sample.orig
|
||||
diff -rup pagure/files/pagure_docs_web.service pagure.cfg-defs/files/pagure_docs_web.service
|
||||
--- pagure/files/pagure_docs_web.service 2020-05-08 21:33:38.862595014 -0400
|
||||
+++ pagure.cfg-defs/files/pagure_docs_web.service 2020-05-08 21:41:42.996448966 -0400
|
||||
--- pagure/files/pagure_docs_web.service 2020-06-21 09:19:34.928187121 -0400
|
||||
+++ pagure.cfg-defs/files/pagure_docs_web.service 2020-06-21 09:20:06.924455904 -0400
|
||||
@@ -5,7 +5,7 @@ Documentation=https://pagure.io/pagure
|
||||
|
||||
|
||||
@ -135,8 +134,8 @@ diff -rup pagure/files/pagure_docs_web.service pagure.cfg-defs/files/pagure_docs
|
||||
User=git
|
||||
Group=git
|
||||
diff -rup pagure/files/pagure-nginx.conf pagure.cfg-defs/files/pagure-nginx.conf
|
||||
--- pagure/files/pagure-nginx.conf 2020-05-08 21:33:38.860594994 -0400
|
||||
+++ pagure.cfg-defs/files/pagure-nginx.conf 2020-05-08 21:43:48.199704257 -0400
|
||||
--- pagure/files/pagure-nginx.conf 2020-06-21 09:19:34.926187104 -0400
|
||||
+++ pagure.cfg-defs/files/pagure-nginx.conf 2020-06-21 09:20:06.924455904 -0400
|
||||
@@ -12,15 +12,15 @@
|
||||
#access_log /var/log/nginx/pagure_docs.access.log;
|
||||
#error_log /var/log/nginx/pagure_docs.error.log;
|
||||
@ -156,7 +155,7 @@ diff -rup pagure/files/pagure-nginx.conf pagure.cfg-defs/files/pagure-nginx.conf
|
||||
#}
|
||||
|
||||
#location / {
|
||||
@@ -48,15 +48,15 @@
|
||||
@@ -43,15 +43,15 @@
|
||||
#access_log /var/log/nginx/pagure.access.log;
|
||||
#error_log /var/log/nginx/pagure.error.log;
|
||||
|
||||
@ -175,7 +174,7 @@ diff -rup pagure/files/pagure-nginx.conf pagure.cfg-defs/files/pagure-nginx.conf
|
||||
#}
|
||||
|
||||
#location / {
|
||||
@@ -68,7 +68,7 @@
|
||||
@@ -59,7 +59,7 @@
|
||||
#}
|
||||
|
||||
#location /releases {
|
||||
@ -185,8 +184,8 @@ diff -rup pagure/files/pagure-nginx.conf pagure.cfg-defs/files/pagure-nginx.conf
|
||||
#}
|
||||
|
||||
diff -rup pagure/files/pagure_web.service pagure.cfg-defs/files/pagure_web.service
|
||||
--- pagure/files/pagure_web.service 2020-05-08 21:33:38.862595014 -0400
|
||||
+++ pagure.cfg-defs/files/pagure_web.service 2020-05-08 21:41:26.941287994 -0400
|
||||
--- pagure/files/pagure_web.service 2020-06-21 09:19:34.928187121 -0400
|
||||
+++ pagure.cfg-defs/files/pagure_web.service 2020-06-21 09:20:06.924455904 -0400
|
||||
@@ -5,7 +5,7 @@ Documentation=https://pagure.io/pagure
|
||||
|
||||
|
||||
|
@ -1,3 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jun 21 12:57:17 UTC 2020 - Neal Gompa <ngompa13@gmail.com>
|
||||
|
||||
- Backport fixes for STARTTLS support
|
||||
+ Patch: 0002-starttls-support-via-SMTP_STARTTLS-provide-additiona.patch
|
||||
+ Patch: 0001-Do-not-assume-there-is-a-SMTP_STARTTLS-configuration.patch
|
||||
- Backport fix for docs repo access grant
|
||||
+ Patch: 0001-Fix-repotype-spelling.patch
|
||||
- Backport fix for visual bug on API docs formatting
|
||||
+ Patch: 0001-api-fix-apidoc-format-on-api_view_issues_history_det.patch
|
||||
- Backport fix to changing pull mirror settings
|
||||
+ Patch: 0001-Allow-editing-the-URL-a-project-is-mirrored-from.patch
|
||||
- Backport fix to add descriptions to API scopes
|
||||
+ Patch: 0001-Show-the-ACL-name-in-addition-to-the-description-whe.patch
|
||||
- Backport fix to make heatmap UI functional again
|
||||
+ Patch: 0001-Bring-back-JS-library-used-for-the-heatmap.patch
|
||||
- Backport fix for handling headers
|
||||
+ Patch: 0001-Ensure-the-title-name-of-the-headers-are-strings.patch
|
||||
- Backport fix for burndown graph title
|
||||
+ Patch: 0001-Fix-the-title-of-the-graph-showing-the-evolution-of-.patch
|
||||
- Backport fix for permissions on authorized_keys file
|
||||
+ Patch: 0001-Make-sure-authorized_keys-file-has-mode-600.patch
|
||||
- Add patch to use whitenoise for rendering static assets
|
||||
+ Patch: 0101-Use-WhiteNoise-to-serve-static-assets-for-the-Pagure.patch
|
||||
- Refresh default configuration patch
|
||||
+ Patch: pagure-5.0-default-example-cfg.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 20 23:34:26 UTC 2020 - Neal Gompa <ngompa13@gmail.com>
|
||||
|
||||
|
31
pagure.spec
31
pagure.spec
@ -40,11 +40,35 @@ Source1: https://raw.githubusercontent.com/fedora-infra/python-fedora
|
||||
# SUSE-specific README providing a quickstart guide
|
||||
Source10: pagure-README.SUSE
|
||||
|
||||
|
||||
# Backports from upstream
|
||||
## Backport fix to make stats page work
|
||||
Patch0001: 0001-Make-the-stats-page-use-the-new-stats-API-endpoint.patch
|
||||
## Backport support for STARTTLS support for SMTP servers
|
||||
Patch0002: 0001-Add-support-for-smtp-server-requiring-starttls-to-wo.patch
|
||||
Patch0003: 0002-starttls-support-via-SMTP_STARTTLS-provide-additiona.patch
|
||||
Patch0004: 0001-Do-not-assume-there-is-a-SMTP_STARTTLS-configuration.patch
|
||||
## Fix access grants for docs repo
|
||||
Patch0005: 0001-Fix-repotype-spelling.patch
|
||||
## Fix visual bug on api documentation formatting
|
||||
Patch0006: 0001-api-fix-apidoc-format-on-api_view_issues_history_det.patch
|
||||
## Add setting for changing pull mirror source for projects
|
||||
Patch0007: 0001-Allow-editing-the-URL-a-project-is-mirrored-from.patch
|
||||
## Add descriptions to API scopes listed at API token creation page
|
||||
Patch0008: 0001-Show-the-ACL-name-in-addition-to-the-description-whe.patch
|
||||
## Restore heatmap JS library
|
||||
Patch0009: 0001-Bring-back-JS-library-used-for-the-heatmap.patch
|
||||
## Ensure header keys are rendered as strings
|
||||
Patch0010: 0001-Ensure-the-title-name-of-the-headers-are-strings.patch
|
||||
## Fix title of burndown graph
|
||||
Patch0011: 0001-Fix-the-title-of-the-graph-showing-the-evolution-of-.patch
|
||||
## Fix permissions for generated authorized_keys file
|
||||
Patch0012: 0001-Make-sure-authorized_keys-file-has-mode-600.patch
|
||||
|
||||
# Changes proposed upstream
|
||||
## Use whitenoise to render static assets
|
||||
## From: https://pagure.io/pagure/pull-request/4885
|
||||
Patch0101: 0101-Use-WhiteNoise-to-serve-static-assets-for-the-Pagure.patch
|
||||
|
||||
# SUSE-specific fixes
|
||||
## Change the defaults in the example config to match packaging
|
||||
@ -86,6 +110,7 @@ BuildRequires: python3-straight-plugin
|
||||
BuildRequires: python3-WTForms
|
||||
BuildRequires: python3-munch
|
||||
BuildRequires: python3-redis
|
||||
BuildRequires: python3-whitenoise
|
||||
|
||||
# We require OpenSSH 7.4+ for SHA256 support
|
||||
Requires: openssh >= 7.4
|
||||
@ -116,6 +141,7 @@ Requires: python3-straight-plugin
|
||||
Requires: python3-WTForms
|
||||
Requires: python3-munch
|
||||
Requires: python3-redis
|
||||
Requires: python3-whitenoise
|
||||
|
||||
# Required for celery
|
||||
Requires: python3-pytz
|
||||
@ -464,11 +490,6 @@ sed -e "s|#!/usr/bin/env python|#!%{__python3}|" -i \
|
||||
# Switch interpreter for systemd units to correct Python interpreter
|
||||
sed -e "s|/usr/bin/python|%{__python3}|g" -i %{buildroot}/%{_unitdir}/*.service
|
||||
|
||||
# Change to correct static file path for apache httpd and nginx
|
||||
sed -e "s/pythonX.Y/python%{python3_version}/g" -i \
|
||||
%{buildroot}/%{_sysconfdir}/apache2/vhosts.d/pagure.conf \
|
||||
%{buildroot}/%{_sysconfdir}/nginx/vhosts.d/pagure.conf
|
||||
|
||||
# Make symlinks for default theme packages
|
||||
mv %{buildroot}/%{python3_sitelib}/pagure/themes/default %{buildroot}/%{python3_sitelib}/pagure/themes/upstream
|
||||
ln -sr %{buildroot}/%{python3_sitelib}/pagure/themes/upstream %{buildroot}/%{python3_sitelib}/pagure/themes/default
|
||||
|
Loading…
Reference in New Issue
Block a user