forked from pool/pagure
- Update to 5.1.4
+ Fix the alembic migration creating the hook_mirror table + Close the DB session in one place for all hooks + Add more logging to the pagure_logcom service + Configure SMTP info for git_multimail + Use the PR UID previously read from environment - Backport fix from master to add compatibility with Markdown 3.0+ + Patch: 0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch - Backport fix from master to properly skip legacy hooks + Patch: 0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/pagure?expand=0&rev=10
This commit is contained in:
parent
8759e8fbe1
commit
11a7b3c0eb
@ -0,0 +1,85 @@
|
||||
From 8ed43b1f9581fd81a29cb2902baf92a80d19bfb8 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Wed, 12 Dec 2018 14:50:48 +0100
|
||||
Subject: [PATCH] Port pagure to markdown 3.0+ while remaining backward
|
||||
compatible
|
||||
|
||||
Lift the restriction in the requirements.txt
|
||||
|
||||
Fixes https://pagure.io/pagure/issue/3668
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/pfmarkdown.py | 26 ++++++++++++++++++++++----
|
||||
requirements.txt | 2 +-
|
||||
2 files changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/pagure/pfmarkdown.py b/pagure/pfmarkdown.py
|
||||
index 39820ab2..6e5355d9 100644
|
||||
--- a/pagure/pfmarkdown.py
|
||||
+++ b/pagure/pfmarkdown.py
|
||||
@@ -34,6 +34,16 @@ import pagure.lib.query
|
||||
from pagure.config import config as pagure_config
|
||||
|
||||
|
||||
+try:
|
||||
+ from markdown.inlinepatterns import ImagePattern as ImagePattern
|
||||
+
|
||||
+ MK_VERSION = 2
|
||||
+except ImportError:
|
||||
+ from markdown.inlinepatterns import ImageInlineProcessor as ImagePattern
|
||||
+
|
||||
+ MK_VERSION = 3
|
||||
+
|
||||
+
|
||||
# the (?<!\w) (and variants) we use a lot in all these regexes is a
|
||||
# negative lookbehind assertion. It means 'match when the preceding
|
||||
# character is not in the \w class'. This stops us from starting a
|
||||
@@ -325,11 +335,15 @@ class AutolinkPattern2(markdown.inlinepatterns.Pattern):
|
||||
return el
|
||||
|
||||
|
||||
-class ImagePatternLazyLoad(markdown.inlinepatterns.ImagePattern):
|
||||
+class ImagePatternLazyLoad(ImagePattern):
|
||||
""" Customize the image element matched for lazyloading. """
|
||||
|
||||
- def handleMatch(self, m):
|
||||
- el = super(ImagePatternLazyLoad, self).handleMatch(m)
|
||||
+ def handleMatch(self, m, *args):
|
||||
+ out = super(ImagePatternLazyLoad, self).handleMatch(m, *args)
|
||||
+ if MK_VERSION == 3:
|
||||
+ el = out[0]
|
||||
+ else:
|
||||
+ el = out
|
||||
|
||||
# Add a noscript tag with the untouched img tag
|
||||
noscript = markdown.util.etree.Element("noscript")
|
||||
@@ -348,7 +362,11 @@ class ImagePatternLazyLoad(markdown.inlinepatterns.ImagePattern):
|
||||
outel.append(img)
|
||||
outel.append(noscript)
|
||||
|
||||
- return outel
|
||||
+ output = outel
|
||||
+ if MK_VERSION == 3:
|
||||
+ output = (outel, out[1], out[2])
|
||||
+
|
||||
+ return output
|
||||
|
||||
|
||||
class PagureExtension(markdown.extensions.Extension):
|
||||
diff --git a/requirements.txt b/requirements.txt
|
||||
index 95dab43e..15475f68 100644
|
||||
--- a/requirements.txt
|
||||
+++ b/requirements.txt
|
||||
@@ -14,7 +14,7 @@ enum34;python_version<"3.4"
|
||||
flask
|
||||
flask-wtf
|
||||
kitchen
|
||||
-markdown < 3.0
|
||||
+markdown
|
||||
munch
|
||||
Pillow
|
||||
psutil
|
||||
--
|
||||
2.17.2
|
||||
|
104
0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch
Normal file
104
0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch
Normal file
@ -0,0 +1,104 @@
|
||||
From 99cafd173c40d83e06110621ee5f2d3bef82d2c0 Mon Sep 17 00:00:00 2001
|
||||
From: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
Date: Mon, 26 Nov 2018 12:02:10 +0100
|
||||
Subject: [PATCH] Bypass old hooks rather than using non-existing symlinks
|
||||
|
||||
When we moved to the runner architecture, we changed the way hooks are
|
||||
called. During this move, we changed all of our existing hooks into
|
||||
non-existing symlinks pointing to '/does/not/exists' and we were checking
|
||||
if the files on disk were matching this target or not.
|
||||
This created a few issue when releasing pagure:
|
||||
- python setup.py sdist resolve symlinks as part of the archive creation
|
||||
process
|
||||
Reported in https://pagure.io/pagure/issue/3782
|
||||
- Building pagure failed on some system because these symlinks does not
|
||||
exist
|
||||
Reported in https://pagure.io/pagure/issue/3706
|
||||
|
||||
So in this commit we are dropping the use of symlink and just making
|
||||
pagure ignore all the hook it could have created.
|
||||
|
||||
Fixes https://pagure.io/pagure/issue/3782
|
||||
Fixes https://pagure.io/pagure/issue/3706
|
||||
|
||||
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
|
||||
---
|
||||
pagure/hooks/__init__.py | 7 +++----
|
||||
pagure/lib/__init__.py | 20 +++++++++++++++++---
|
||||
pagure/lib/tasks.py | 4 +---
|
||||
3 files changed, 21 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py
|
||||
index 027f5822..d7409460 100644
|
||||
--- a/pagure/hooks/__init__.py
|
||||
+++ b/pagure/hooks/__init__.py
|
||||
@@ -411,10 +411,9 @@ def run_project_hooks(
|
||||
if hook.startswith(hooktype + "."):
|
||||
hookfile = os.path.join(hookdir, hook)
|
||||
|
||||
- # Determine if this is an actual hook, or if it's a remnant
|
||||
- # from a hook that was installed before it was moved to the
|
||||
- # runner system.
|
||||
- if os.path.realpath(hookfile) == pagure.lib.HOOK_DNE_TARGET:
|
||||
+ # By-pass all the old hooks that pagure may have created before
|
||||
+ # moving to the runner architecture
|
||||
+ if hook in pagure.lib.ORIGINAL_PAGURE_HOOK:
|
||||
continue
|
||||
|
||||
# Execute
|
||||
diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py
|
||||
index 0284201b..aebd07d4 100644
|
||||
--- a/pagure/lib/__init__.py
|
||||
+++ b/pagure/lib/__init__.py
|
||||
@@ -70,9 +70,23 @@ REDIS = None
|
||||
PAGURE_CI = None
|
||||
REPOTYPES = ("main", "docs", "tickets", "requests")
|
||||
_log = logging.getLogger(__name__)
|
||||
-# The target for hooks migrated to the Runner system, to be able to detect
|
||||
-# whether a hook was migrated without having to open and read the file
|
||||
-HOOK_DNE_TARGET = "/does/not/exist"
|
||||
+# List of all the possible hooks pagure could generate before it was moved
|
||||
+# to the runner architecture we now use.
|
||||
+# This list is kept so we can ignore all of these hooks.
|
||||
+ORIGINAL_PAGURE_HOOK = [
|
||||
+ "post-receive.default",
|
||||
+ "post-receive.fedmsg",
|
||||
+ "post-receive.irc",
|
||||
+ "post-receive.mail",
|
||||
+ "post-receive.mirror",
|
||||
+ "post-receive.pagure",
|
||||
+ "post-receive.pagure-requests",
|
||||
+ "post-receive.pagure-ticket",
|
||||
+ "post-receive.rtd",
|
||||
+ "pre-receive.pagure_no_new_branches",
|
||||
+ "pre-receive.pagureforcecommit",
|
||||
+ "pre-receive.pagureunsignedcommit",
|
||||
+]
|
||||
|
||||
|
||||
class Unspecified(object):
|
||||
diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py
|
||||
index 74c03291..2e73121f 100644
|
||||
--- a/pagure/lib/tasks.py
|
||||
+++ b/pagure/lib/tasks.py
|
||||
@@ -651,7 +651,6 @@ def move_to_repospanner(self, session, name, namespace, user, region):
|
||||
raise Exception("Project is already on repoSpanner")
|
||||
|
||||
# Make sure that no non-runner hooks are enabled for this project
|
||||
- compatible_targets = [pagure.lib.HOOK_DNE_TARGET]
|
||||
incompatible_hooks = []
|
||||
for repotype in pagure.lib.REPOTYPES:
|
||||
path = project.repopath(repotype)
|
||||
@@ -666,8 +665,7 @@ def move_to_repospanner(self, session, name, namespace, user, region):
|
||||
if hook.endswith(".sample"):
|
||||
# Ignore the samples that Git inserts
|
||||
continue
|
||||
- hookfile = os.path.join(hookpath, hook)
|
||||
- if os.path.realpath(hookfile) not in compatible_targets:
|
||||
+ if hook not in pagure.lib.ORIGINAL_PAGURE_HOOK:
|
||||
incompatible_hooks.append((repotype, hook))
|
||||
|
||||
if incompatible_hooks:
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6ea0bb3897df402a7a48ce3728fc9e1c42922bd0aa007b139ec6e7e8553d5a26
|
||||
size 21753377
|
3
pagure-5.1.4.tar.gz
Normal file
3
pagure-5.1.4.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:52ab207d59fc294e4957bba9561bdb78180db3a9f9032d06d3e252fe3ac55a17
|
||||
size 21754558
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 13 14:43:19 UTC 2018 - Neal Gompa <ngompa13@gmail.com>
|
||||
|
||||
- Update to 5.1.4
|
||||
+ Fix the alembic migration creating the hook_mirror table
|
||||
+ Close the DB session in one place for all hooks
|
||||
+ Add more logging to the pagure_logcom service
|
||||
+ Configure SMTP info for git_multimail
|
||||
+ Use the PR UID previously read from environment
|
||||
- Backport fix from master to add compatibility with Markdown 3.0+
|
||||
+ Patch: 0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch
|
||||
- Backport fix from master to properly skip legacy hooks
|
||||
+ Patch: 0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 11 16:56:20 UTC 2018 - Neal Gompa <ngompa13@gmail.com>
|
||||
|
||||
|
15
pagure.spec
15
pagure.spec
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
Name: pagure
|
||||
Version: 5.1.3
|
||||
Version: 5.1.4
|
||||
Release: 0
|
||||
Summary: A git-centered forge
|
||||
Group: Development/Tools/Version Control
|
||||
@ -40,6 +40,13 @@ Source1: https://raw.githubusercontent.com/fedora-infra/python-fedora
|
||||
# SUSE-specific README providing a quickstart guide
|
||||
Source10: pagure-README.SUSE
|
||||
|
||||
# Backports from upstream
|
||||
# Port pfmarkdown to Markdown v3 while remaining v2 compatible
|
||||
# From: https://pagure.io/pagure/c/8ed43b1f9581fd81a29cb2902baf92a80d19bfb8
|
||||
Patch0001: 0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch
|
||||
# Avoid the need for non-existent symlinks to trigger migration to new hooks
|
||||
# From: https://pagure.io/pagure/c/4937c4e266b2d1a2583b793128f87c66c96a7d5e
|
||||
Patch0002: 0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch
|
||||
|
||||
# SUSE-specific fixes
|
||||
# Change the defaults in the example config to match packaging
|
||||
@ -65,8 +72,7 @@ BuildRequires: python3-cryptography
|
||||
BuildRequires: python3-docutils
|
||||
BuildRequires: python3-Flask
|
||||
BuildRequires: python3-Flask-WTF
|
||||
# Pagure is currently not compatible with Markdown v3
|
||||
BuildRequires: python3-Markdown < 3
|
||||
BuildRequires: python3-Markdown
|
||||
BuildRequires: python3-nose
|
||||
BuildRequires: python3-Pillow
|
||||
BuildRequires: python3-psutil
|
||||
@ -97,8 +103,7 @@ Requires: python3-cryptography
|
||||
Requires: python3-docutils
|
||||
Requires: python3-Flask
|
||||
Requires: python3-Flask-WTF
|
||||
# Pagure is currently not compatible with Markdown v3
|
||||
Requires: python3-Markdown < 3
|
||||
Requires: python3-Markdown
|
||||
Requires: python3-Pillow
|
||||
Requires: python3-psutil
|
||||
Requires: python3-pygit2 >= 0.24.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user