From 1a1f2ebe9452af7b1d3e1eb60c26aa0c18459247 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 1/12] Fix the alembic migration, in postgresql quotes matter Signed-off-by: Pierre-Yves Chibon --- diff --git a/alembic/versions/5affe6f5d94f_new_api_token_acl.py b/alembic/versions/5affe6f5d94f_new_api_token_acl.py index a33b674..3b6d973 100644 --- a/alembic/versions/5affe6f5d94f_new_api_token_acl.py +++ b/alembic/versions/5affe6f5d94f_new_api_token_acl.py @@ -17,8 +17,8 @@ import sqlalchemy as sa def upgrade(): """ Insert the new ACL into the database. """ op.execute( - "INSERT INTO acls ('name', 'description') " - "VALUES ('pull_request_create', 'Open a new pull-request');" + 'INSERT INTO acls ("name", "description", "created") ' + "VALUES ('pull_request_create', 'Open a new pull-request', NOW());" ) From f8d23a53ad7e7f0c1693108cf55ecac16428c844 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 2/12] Clean up the MANIFEST.in file since we dropped some folders Signed-off-by: Pierre-Yves Chibon --- diff --git a/MANIFEST.in b/MANIFEST.in index 913e8f0..e986e73 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,22 +4,14 @@ recursive-include alembic * recursive-include doc * recursive-include files * recursive-include pagure * -recursive-include pagure-ci * recursive-include pagure-ev * -recursive-include pagure-loadjson * -recursive-include pagure-logcom * recursive-include pagure-milters * -recursive-include pagure-webhook * recursive-include tests * recursive-exclude alembic *.pyc recursive-exclude doc *.pyc recursive-exclude files *.pyc recursive-exclude pagure *.pyc -recursive-exclude pagure-ci *.pyc recursive-exclude pagure-ev *.pyc -recursive-exclude pagure-loadjson *.pyc -recursive-exclude pagure-logcom *.pyc recursive-exclude pagure-milters *.pyc -recursive-exclude pagure-webhook *.pyc recursive-exclude tests *.pyc From bc6e66790b4866b4dd81e7b8174c89c9c8796c20 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 3/12] Adjust the spec file, remove no longer needed lines and fix requirements Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure.spec b/files/pagure.spec index c8ac59f..a377ad3 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -14,7 +14,7 @@ BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-nose -BuildRequires: py-bcrypt +BuildRequires: python-bcrypt BuildRequires: python-alembic BuildRequires: python-arrow BuildRequires: python-binaryornot @@ -45,7 +45,7 @@ BuildRequires: python-sqlalchemy > 0.8 Requires: python-sqlalchemy > 0.8 BuildRequires: systemd -Requires: py-bcrypt +Requires: python-bcrypt Requires: python-alembic Requires: python-arrow Requires: python-binaryornot @@ -333,25 +333,21 @@ install -p -m 644 pagure-ev/pagure_ev.service \ %files webhook %license LICENSE -%{_libexecdir}/pagure-webhook/ %{_unitdir}/pagure_webhook.service %files ci %license LICENSE -%{_libexecdir}/pagure-ci/ %{_unitdir}/pagure_ci.service %files logcom %license LICENSE -%{_libexecdir}/pagure-logcom/ %{_unitdir}/pagure_logcom.service %files loadjson %license LICENSE -%{_libexecdir}/pagure-loadjson/ %{_unitdir}/pagure_loadjson.service From b2e832eec42b18c4adcc9c0e69d55227ce42260a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 4/12] Add example worker systemd service file Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure_worker.service.example b/files/pagure_worker.service.example new file mode 100644 index 0000000..c8f172a --- /dev/null +++ b/files/pagure_worker.service.example @@ -0,0 +1,21 @@ +# This is an example systemd's service file that can be used when using +# multiple queues to split the tasks based on their priorities. +# You'll need to adjust the in the ExectStart line with the +# name of the queue as you set it in the configuration file under the keys +# FAST_CELERY_QUEUE, MEDIUM_CELERY_QUEUE or SLOW_CELERY_QUEUE + +[Unit] +Description=Pagure worker for gitolite interactions +After=redis.target +Documentation=https://pagure.io/pagure + +[Service] +ExecStart=/usr/bin/celery worker -A pagure.lib.tasks --loglevel=info -Q +Environment="PAGURE_CONFIG=/etc/pagure/pagure.cfg" +Type=simple +User=git +Group=git +Restart=on-failure + +[Install] +WantedBy=multi-user.target From 117efc5e4d1b9659da93097b4bf77d3696441645 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 5/12] Port the spec file to the recent Fedora releases Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure.spec b/files/pagure.spec index a377ad3..f16bedd 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -11,16 +11,15 @@ BuildArch: noarch BuildRequires: systemd-devel BuildRequires: python2-devel -BuildRequires: python-setuptools -BuildRequires: python-nose +BuildRequires: python2-setuptools +BuildRequires: python2-bcrypt -BuildRequires: python-bcrypt +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) BuildRequires: python-alembic BuildRequires: python-arrow BuildRequires: python-binaryornot BuildRequires: python-bleach BuildRequires: python-blinker -BuildRequires: python-celery BuildRequires: python-chardet BuildRequires: python-cryptography BuildRequires: python-docutils @@ -28,8 +27,9 @@ BuildRequires: python-flask BuildRequires: python-flask-wtf BuildRequires: python-flask-multistatic BuildRequires: python-markdown +BuildRequires: python-nose BuildRequires: python-psutil -BuildRequires: python-pygit2 >= 0.22.1 +BuildRequires: python-pygit2 >= 0.20.1 BuildRequires: python-pygments BuildRequires: python-fedora BuildRequires: python-openid @@ -40,12 +40,47 @@ BuildRequires: python-wtforms BuildRequires: python-munch BuildRequires: python-enum34 BuildRequires: python-redis - +%else +BuildRequires: python2-alembic +BuildRequires: python2-arrow +BuildRequires: python2-binaryornot +BuildRequires: python2-bleach +BuildRequires: python2-blinker +BuildRequires: python2-chardet +BuildRequires: python2-cryptography +BuildRequires: python2-docutils +BuildRequires: python2-flask +BuildRequires: python2-flask-wtf +BuildRequires: python2-flask-multistatic +BuildRequires: python2-markdown +BuildRequires: python2-nose +BuildRequires: python2-psutil +BuildRequires: python2-pygit2 >= 0.20.1 +BuildRequires: python2-pygments +BuildRequires: python2-fedora +BuildRequires: python2-openid +BuildRequires: python2-openid-cla +BuildRequires: python2-openid-teams +BuildRequires: python2-straight-plugin +BuildRequires: python2-wtforms +BuildRequires: python2-munch +BuildRequires: python2-enum34 +BuildRequires: python2-redis +%endif + +%if (0%{?rhel} && 0%{?rhel} == 7) BuildRequires: python-sqlalchemy > 0.8 Requires: python-sqlalchemy > 0.8 +%else +BuildRequires: python2-sqlalchemy > 0.8 +Requires: python2-sqlalchemy > 0.8 +%endif BuildRequires: systemd +%endif -Requires: python-bcrypt + +Requires: python2-bcrypt +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-alembic Requires: python-arrow Requires: python-binaryornot @@ -72,6 +107,35 @@ Requires: python-wtforms Requires: python-munch Requires: python-redis Requires: mod_wsgi +%else +Requires: python2-alembic +Requires: python2-arrow +Requires: python2-binaryornot +Requires: python2-bleach +Requires: python2-blinker +Requires: python2-celery +Requires: python2-chardet +Requires: python2-cryptography +Requires: python2-docutils +Requires: python2-enum34 +Requires: python2-flask +Requires: python2-flask-wtf +Requires: python2-flask-multistatic +Requires: python2-markdown +Requires: python2-psutil +Requires: python2-pygit2 >= 0.22.1 +Requires: python2-pygments +Requires: python2-fedora +Requires: python2-openid +Requires: python2-openid-cla +Requires: python2-openid-teams +Requires: python2-straight-plugin +Requires: python2-wtforms +Requires: python2-munch +Requires: python2-redis +Requires: python2-mod_wsgi +%endif + %{?systemd_requires} @@ -90,7 +154,11 @@ create/merge pull-requests across or within projects. Summary: Milter to integrate pagure with emails BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-pymilter +%else +Requires: python2-pymilter +%endif %{?systemd_requires} # It would work with sendmail but we configure things (like the tempfile) # to work with postfix @@ -105,9 +173,15 @@ Summary: EventSource server for pagure BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-redis Requires: python-trollius Requires: python-trollius-redis +%else +Requires: python2-redis +Requires: python2-trollius +Requires: python2-trollius-redis +%endif %{?systemd_requires} %description ev Pagure comes with an eventsource server allowing live update of the pages @@ -119,9 +193,15 @@ Summary: Web-Hook server for pagure BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-redis Requires: python-trollius Requires: python-trollius-redis +%else +Requires: python2-redis +Requires: python2-trollius +Requires: python2-trollius-redis +%endif %{?systemd_requires} %description webhook Pagure comes with an webhook server allowing http callbacks for any action @@ -133,10 +213,17 @@ Summary: A CI service for pagure BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-redis Requires: python-trollius Requires: python-trollius-redis Requires: python-jenkins +%else +Requires: python2-redis +Requires: python2-trollius +Requires: python2-trollius-redis +Requires: python2-jenkins +%endif %{?systemd_requires} %description ci Pagure comes with a continuous integration service, currently supporting @@ -150,9 +237,15 @@ Summary: The logcom service for pagure BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-redis Requires: python-trollius Requires: python-trollius-redis +%else +Requires: python2-redis +Requires: python2-trollius +Requires: python2-trollius-redis +%endif %{?systemd_requires} %description logcom pagure-logcom contains the service that logs commits into the database so that @@ -164,9 +257,15 @@ Summary: The loadjson service for pagure BuildArch: noarch BuildRequires: systemd-devel +%if (0%{?fedora} && 0%{?fedora} <= 27) || (0%{?rhel} && 0%{?rhel} <= 7) Requires: python-redis Requires: python-trollius Requires: python-trollius-redis +%else +Requires: python2-redis +Requires: python2-trollius +Requires: python2-trollius-redis +%endif %{?systemd_requires} %description loadjson pagure-loadjson is the service allowing to update the database with the From c17a7813fb8ad99ae2422c17a456280a0c6d9590 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 6/12] Adjust the wsgi file for the new arch Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure.wsgi b/files/pagure.wsgi index 6bcc1ff..b34196e 100644 --- a/files/pagure.wsgi +++ b/files/pagure.wsgi @@ -24,5 +24,7 @@ os.environ['TEMP'] = '/var/tmp/' # The most important line to make the wsgi working -from pagure import APP as application +from pagure.flask_app import create_app + +application = create_app() #application.debug = True From 99cda89142a400d3958c94f7703a95f6dcce34f8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 7/12] Fix turning the read-only boolean on a fork Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/cli/admin.py b/pagure/cli/admin.py index 7ba5419..8447169 100644 --- a/pagure/cli/admin.py +++ b/pagure/cli/admin.py @@ -649,7 +649,7 @@ def do_read_only(args): pagure.lib.get_user(session, args.user) # Get the project - project = _get_project(args.project) + project = _get_project(args.project, user=args.user) if project is None: raise pagure.exceptions.PagureException( From e3db87287f675084bc9076c07bfcca222e856177 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 8/12] Do not only rely on the sse variable Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 951097e..bb7273d 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -735,7 +735,7 @@ function try_async_comment(form) { set_ui_for_comment(false); return true; } - if (!sse) { + if (!sse || source.readyState != 1) { $(form).off('submit'); form.submit(); return false; From 52b0a2d9d0ab2eddfec5f2539db13f87f1c293ca Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 9/12] Fix setting the version in the footer of the pages Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/master.html b/pagure/templates/master.html index e17605a..0bbb3aa 100644 --- a/pagure/templates/master.html +++ b/pagure/templates/master.html @@ -166,7 +166,7 @@

Copyright © 2014-2017 Red Hat pagure — - {{version}} — Documentation + {{ g.version }} — Documentation

SSH Hostkey/Fingerprint

From b53508ca0e63772748f4bbf153d3e94dbe0d8400 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 10/12] Adjust the description of the project tags input field Fixes https://pagure.io/pagure/issue/3132 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index ab55935..692e6ba 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -44,7 +44,10 @@
- tags for project (separated by commas) + + Tags for project itself, as a comma-separated list. Tags + for issues are managed further down on this page. +
{% if config.get('PRIVATE_PROJECTS', False) and repo.private %}
From 0e35e99cd013f1c9bf1cc9a440e1889e1865fb48 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 11/12] Support blaming a file is the identifier is a tag Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index a2a8601..6e14d0c 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -714,6 +714,9 @@ def view_blame_file(repo, filename, username=None, namespace=None): except ValueError: commit = repo_obj[repo_obj.head.target] + if isinstance(commit, pygit2.Tag): + commit = commit.get_object() + content = __get_file_in_tree( repo_obj, commit.tree, filename.split('/'), bail_on_tree=True) if not content: From 596646f2ce6ce76656f6478f83d6204c0bc89a65 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 16 2018 15:05:01 +0000 Subject: [PATCH 12/12] Ensure the git hooks are always executable in the rpm Signed-off-by: Pierre-Yves Chibon --- diff --git a/files/pagure.spec b/files/pagure.spec index f16bedd..4a33a95 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -276,6 +276,9 @@ in the future pull-requests) git repo. %prep %setup -q +# In case it gets broken in git at least the rpm will be good +chown +x pagure/hooks/files/* + %build %py2_build