From 11a7b3c0eb5d61d211ea38496593c0a9a4fdb5d7d861377667911a55997b0b46 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 13 Dec 2018 15:09:43 +0000 Subject: [PATCH] - 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 --- ...arkdown-3.0-while-remaining-backward.patch | 85 ++++++++++++++ ...-rather-than-using-non-existing-syml.patch | 104 ++++++++++++++++++ pagure-5.1.3.tar.gz | 3 - pagure-5.1.4.tar.gz | 3 + pagure.changes | 14 +++ pagure.spec | 15 ++- 6 files changed, 216 insertions(+), 8 deletions(-) create mode 100644 0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch create mode 100644 0002-Bypass-old-hooks-rather-than-using-non-existing-syml.patch delete mode 100644 pagure-5.1.3.tar.gz create mode 100644 pagure-5.1.4.tar.gz diff --git a/0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch b/0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch new file mode 100644 index 0000000..99a5c9d --- /dev/null +++ b/0001-Port-pagure-to-markdown-3.0-while-remaining-backward.patch @@ -0,0 +1,85 @@ +From 8ed43b1f9581fd81a29cb2902baf92a80d19bfb8 Mon Sep 17 00:00:00 2001 +From: Pierre-Yves Chibon +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 +--- + 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 (? +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 +--- + 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 + diff --git a/pagure-5.1.3.tar.gz b/pagure-5.1.3.tar.gz deleted file mode 100644 index e721099..0000000 --- a/pagure-5.1.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6ea0bb3897df402a7a48ce3728fc9e1c42922bd0aa007b139ec6e7e8553d5a26 -size 21753377 diff --git a/pagure-5.1.4.tar.gz b/pagure-5.1.4.tar.gz new file mode 100644 index 0000000..413e36a --- /dev/null +++ b/pagure-5.1.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52ab207d59fc294e4957bba9561bdb78180db3a9f9032d06d3e252fe3ac55a17 +size 21754558 diff --git a/pagure.changes b/pagure.changes index 2285f6b..596617a 100644 --- a/pagure.changes +++ b/pagure.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Dec 13 14:43:19 UTC 2018 - Neal Gompa + +- 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 diff --git a/pagure.spec b/pagure.spec index db7df73..3c5a77c 100644 --- a/pagure.spec +++ b/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