From 9f41b6d9dbf46e47feab388671128fcf96e9ed55 Mon Sep 17 00:00:00 2001 From: SidneyAn Date: Tue, 15 Jan 2019 01:53:23 +0800 Subject: [PATCH] Revert "upgrade python-django to CentOS 7.6 version" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d0e1110fda670d329aabf21fcfd6ee672e198618. Patch [2/2] Revert Reason As part of CentOS 7.6 upgrade tasks, I have upgraded python-django from 1.8.14-1 to 1.11.13 from 3rd-party repo "https://dl.fedoraproject.org/pub/epel/testing/7/SRPMS/Packages/p/" However lately CentOS repo made a refreshment and we noticed in official repo, python-django still keeps version 1.8.14-1. “http://vault.centos.org/7.6.1810/cloud/Source/openstack-pike/common/” so we revert previous change d0e1110fda670d329aabf21fcfd6ee672e198618. Story: 2004522 Task: 28853 Depends-On: https://review.openstack.org/#/c/629970/ Change-Id: Iadd18f4293e82cd50493a524bde96af455765b04 --- ...te-package-versioning-for-TIS-format.patch | 8 +-- .../centos/meta_patches/PATCH_ORDER | 1 + ...-build-failures-due-to-unwanted-sgid.patch | 4 +- .../meta-size-number-format.patch | 19 ++++--- .../spec-include-TiS-patches.patch | 32 +++++------ .../spec-patch-to-remove-SmartyPants.patch | 20 +++++++ .../remove-SmartyPantsHTMLTranslator.patch | 50 +++++++++++++++++ .../centos/patches/size-number-format.patch | 40 +++++++------- python/python-django/centos/srpm_path | 2 +- .../files/session-filebase-backend-fix.patch | 53 +++++++++++++------ 10 files changed, 162 insertions(+), 67 deletions(-) create mode 100644 python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch create mode 100644 python/python-django/centos/patches/remove-SmartyPantsHTMLTranslator.patch diff --git a/python/python-django/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch b/python/python-django/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch index 8f89f25e9..9650530af 100644 --- a/python/python-django/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch +++ b/python/python-django/centos/meta_patches/0001-Update-package-versioning-for-TIS-format.patch @@ -11,12 +11,12 @@ diff --git a/SPECS/python-django.spec b/SPECS/python-django.spec index d0e54bb..5cf8579 100644 --- a/SPECS/python-django.spec +++ b/SPECS/python-django.spec -@@ -22,7 +22,7 @@ +@@ -29,7 +29,7 @@ Name: python-django - Version: 1.11.13 --Release: 4%{?dist} -+Release: 4.el7%{?_tis_dist}.%{tis_patch_ver} + Version: 1.8.14 +-Release: 1%{?dist} ++Release: 1.el7%{?_tis_dist}.%{tis_patch_ver} Summary: A high-level Python Web framework Group: Development/Languages diff --git a/python/python-django/centos/meta_patches/PATCH_ORDER b/python/python-django/centos/meta_patches/PATCH_ORDER index 77decbf30..8d18985c6 100644 --- a/python/python-django/centos/meta_patches/PATCH_ORDER +++ b/python/python-django/centos/meta_patches/PATCH_ORDER @@ -2,3 +2,4 @@ spec-include-TiS-patches.patch 0001-Update-package-versioning-for-TIS-format.patch fix-build-failures-due-to-unwanted-sgid.patch meta-size-number-format.patch +spec-patch-to-remove-SmartyPants.patch \ No newline at end of file diff --git a/python/python-django/centos/meta_patches/fix-build-failures-due-to-unwanted-sgid.patch b/python/python-django/centos/meta_patches/fix-build-failures-due-to-unwanted-sgid.patch index 7bf602006..412bb9b66 100644 --- a/python/python-django/centos/meta_patches/fix-build-failures-due-to-unwanted-sgid.patch +++ b/python/python-django/centos/meta_patches/fix-build-failures-due-to-unwanted-sgid.patch @@ -12,8 +12,8 @@ diff --git a/SPECS/python-django.spec b/SPECS/python-django.spec index 5cf8579..79557de 100644 --- a/SPECS/python-django.spec +++ b/SPECS/python-django.spec -@@ -396,6 +396,8 @@ cd tests - # %doc docs/_build/html/* +@@ -421,6 +421,8 @@ popd + %doc docs/_build/html/* %files bash-completion +%dir %attr(0755,root,root) %{_datadir}/bash-completion diff --git a/python/python-django/centos/meta_patches/meta-size-number-format.patch b/python/python-django/centos/meta_patches/meta-size-number-format.patch index 0737afa24..20b00cf38 100644 --- a/python/python-django/centos/meta_patches/meta-size-number-format.patch +++ b/python/python-django/centos/meta_patches/meta-size-number-format.patch @@ -3,23 +3,30 @@ From: Wei Zhou Date: Wed, 11 Oct 2017 22:23:10 -0500 Subject: [PATCH 1/1] meta size number format -Signed-off-by: SidneyAn --- - SPECS/python-django.spec | 1 + - 1 file changed, 1 insertion(+) + SPECS/python-django.spec | 2 ++ + 1 file changed, 2 insertions(+) diff --git a/SPECS/python-django.spec b/SPECS/python-django.spec index 79557de..5bef0ec 100644 --- a/SPECS/python-django.spec +++ b/SPECS/python-django.spec -@@ -32,6 +32,7 @@ Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-% +@@ -41,6 +41,7 @@ Patch0: python-django-1.8.3-shell-completion.patch # WRS - Patch0: session-filebase-backend-fix.patch -+Patch1: size-number-format.patch + Patch1: session-filebase-backend-fix.patch ++Patch2: size-number-format.patch BuildArch: noarch + BuildRequires: python2-devel +@@ -154,6 +155,7 @@ rm -rf Django.egg-info + # WRS + %patch1 -p1 ++%patch2 -p1 + + # empty files + for f in \ -- 1.8.3.1 diff --git a/python/python-django/centos/meta_patches/spec-include-TiS-patches.patch b/python/python-django/centos/meta_patches/spec-include-TiS-patches.patch index 248edbfb0..b93bbfe15 100644 --- a/python/python-django/centos/meta_patches/spec-include-TiS-patches.patch +++ b/python/python-django/centos/meta_patches/spec-include-TiS-patches.patch @@ -3,34 +3,34 @@ From: Scott Little Date: Fri, 26 Aug 2016 15:10:15 -0400 Subject: [PATCH 1/1] WRS: spec-include-TiS-patches.patch -Signed-off-by: SidneyAn --- - SPECS/python-django.spec | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) + SPECS/python-django.spec | 6 ++++++ + 1 file changed, 6 insertions(+) diff --git a/SPECS/python-django.spec b/SPECS/python-django.spec index 269991d..d0e54bb 100644 --- a/SPECS/python-django.spec +++ b/SPECS/python-django.spec -@@ -30,6 +30,9 @@ License: BSD - URL: http://www.djangoproject.com/ - Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-%{version}.tar.gz +@@ -39,6 +39,9 @@ Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-% + + Patch0: python-django-1.8.3-shell-completion.patch +# WRS -+Patch0: session-filebase-backend-fix.patch ++Patch1: session-filebase-backend-fix.patch + BuildArch: noarch + BuildRequires: python2-devel +@@ -149,6 +152,9 @@ rm -rf Django.egg-info -@@ -146,7 +149,7 @@ principle. - %endif + %patch0 - %prep --%autosetup -n %{pkgname}-%{version} -+%autosetup -n %{pkgname}-%{version} -p1 - - - %build ++# WRS ++%patch1 -p1 ++ + # empty files + for f in \ + django/contrib/staticfiles/models.py \ -- -1.8.3.1 +1.9.1 diff --git a/python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch b/python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch new file mode 100644 index 000000000..e98189aa1 --- /dev/null +++ b/python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch @@ -0,0 +1,20 @@ +diff --git a/SPECS/python-django.spec b/SPECS/python-django.spec +index 5bef0ec..827d08f 100644 +--- a/SPECS/python-django.spec ++++ b/SPECS/python-django.spec +@@ -42,6 +42,7 @@ Patch0: python-django-1.8.3-shell-completion.patch + # WRS + Patch1: session-filebase-backend-fix.patch + Patch2: size-number-format.patch ++Patch3: remove-SmartyPantsHTMLTranslator.patch + + BuildArch: noarch + BuildRequires: python2-devel +@@ -156,6 +157,7 @@ rm -rf Django.egg-info + # WRS + %patch1 -p1 + %patch2 -p1 ++%patch3 -p1 + + # empty files + for f in \ diff --git a/python/python-django/centos/patches/remove-SmartyPantsHTMLTranslator.patch b/python/python-django/centos/patches/remove-SmartyPantsHTMLTranslator.patch new file mode 100644 index 000000000..fac77b181 --- /dev/null +++ b/python/python-django/centos/patches/remove-SmartyPantsHTMLTranslator.patch @@ -0,0 +1,50 @@ +From 3624581259cecf7ca2d695fbebc27fed2a4d941c Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 5 Oct 2017 16:38:20 -0400 +Subject: [PATCH] No smartypants + + +diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py +index fd93194..aa3afbb 100644 +--- a/docs/_ext/djangodocs.py ++++ b/docs/_ext/djangodocs.py +@@ -12,7 +12,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder + from sphinx.util.compat import Directive + from sphinx.util.console import bold + from sphinx.util.nodes import set_source_info +-from sphinx.writers.html import SmartyPantsHTMLTranslator ++from sphinx.writers.html import HTMLTranslator + + # RE for option descriptions without a '--' prefix + simple_option_desc_re = re.compile( +@@ -227,7 +227,7 @@ class VersionDirective(Directive): + return ret + + +-class DjangoHTMLTranslator(SmartyPantsHTMLTranslator): ++class DjangoHTMLTranslator(HTMLTranslator): + """ + Django-specific reST to HTML tweaks. + """ +@@ -260,10 +260,10 @@ class DjangoHTMLTranslator(SmartyPantsHTMLTranslator): + # + def visit_literal_block(self, node): + self.no_smarty += 1 +- SmartyPantsHTMLTranslator.visit_literal_block(self, node) ++ HTMLTranslator.visit_literal_block(self, node) + + def depart_literal_block(self, node): +- SmartyPantsHTMLTranslator.depart_literal_block(self, node) ++ HTMLTranslator.depart_literal_block(self, node) + self.no_smarty -= 1 + + # +@@ -300,7 +300,7 @@ class DjangoHTMLTranslator(SmartyPantsHTMLTranslator): + old_ids = node.get('ids', []) + node['ids'] = ['s-' + i for i in old_ids] + node['ids'].extend(old_ids) +- SmartyPantsHTMLTranslator.visit_section(self, node) ++ HTMLTranslator.visit_section(self, node) + node['ids'] = old_ids + + diff --git a/python/python-django/centos/patches/size-number-format.patch b/python/python-django/centos/patches/size-number-format.patch index bf10245c6..67d2cd3ab 100644 --- a/python/python-django/centos/patches/size-number-format.patch +++ b/python/python-django/centos/patches/size-number-format.patch @@ -2,26 +2,24 @@ diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters. index cd2457d..dc10ea3 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py -@@ -896,15 +896,15 @@ def filesizeformat(bytes_): - if bytes_ < KB: - value = ungettext("%(size)d byte", "%(size)d bytes", bytes_) % {'size': bytes_} - elif bytes_ < MB: -- value = ugettext("%s KB") % filesize_number_format(bytes_ / KB) -+ value = ugettext("%s KiB") % filesize_number_format(bytes_ / KB) - elif bytes_ < GB: -- value = ugettext("%s MB") % filesize_number_format(bytes_ / MB) -+ value = ugettext("%s MiB") % filesize_number_format(bytes_ / MB) - elif bytes_ < TB: -- value = ugettext("%s GB") % filesize_number_format(bytes_ / GB) -+ value = ugettext("%s GiB") % filesize_number_format(bytes_ / GB) - elif bytes_ < PB: -- value = ugettext("%s TB") % filesize_number_format(bytes_ / TB) -+ value = ugettext("%s TiB") % filesize_number_format(bytes_ / TB) +@@ -905,15 +905,15 @@ def filesizeformat(bytes): + if bytes < KB: + value = ungettext("%(size)d byte", "%(size)d bytes", bytes) % {'size': bytes} + elif bytes < MB: +- value = ugettext("%s KB") % filesize_number_format(bytes / KB) ++ value = ugettext("%s KiB") % filesize_number_format(bytes / KB) + elif bytes < GB: +- value = ugettext("%s MB") % filesize_number_format(bytes / MB) ++ value = ugettext("%s MiB") % filesize_number_format(bytes / MB) + elif bytes < TB: +- value = ugettext("%s GB") % filesize_number_format(bytes / GB) ++ value = ugettext("%s GiB") % filesize_number_format(bytes / GB) + elif bytes < PB: +- value = ugettext("%s TB") % filesize_number_format(bytes / TB) ++ value = ugettext("%s TiB") % filesize_number_format(bytes / TB) else: -- value = ugettext("%s PB") % filesize_number_format(bytes_ / PB) -+ value = ugettext("%s PiB") % filesize_number_format(bytes_ / PB) +- value = ugettext("%s PB") % filesize_number_format(bytes / PB) ++ value = ugettext("%s PiB") % filesize_number_format(bytes / PB) + + return avoid_wrapping(value) - if negative: - value = "-%s" % value - - diff --git a/python/python-django/centos/srpm_path b/python/python-django/centos/srpm_path index 19159ea9a..1b60de931 100644 --- a/python/python-django/centos/srpm_path +++ b/python/python-django/centos/srpm_path @@ -1 +1 @@ -mirror:Source/python-django-1.11.13-4.el7.src.rpm +mirror:Source/python-django-1.8.14-1.el7.src.rpm diff --git a/python/python-django/files/session-filebase-backend-fix.patch b/python/python-django/files/session-filebase-backend-fix.patch index 17c47b470..993d2fb42 100644 --- a/python/python-django/files/session-filebase-backend-fix.patch +++ b/python/python-django/files/session-filebase-backend-fix.patch @@ -4,33 +4,52 @@ Date: Mon, 11 Jul 2016 16:20:13 -0400 Subject: [PATCH 1/1] session-filebase-backend-fix --- - Django-1.11.13 | 1 + - django/contrib/sessions/backends/file.py | 3 +++ - 2 files changed, 4 insertions(+) - create mode 100644 Django-1.11.13 + Django-1.8.7 | 1 + + django/contrib/sessions/backends/file.py | 15 ++++++++++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) + create mode 120000 Django-1.8.7 -diff --git a/Django-1.11.13 b/Django-1.11.13 -new file mode 100644 -index 0000000..b7c239f +diff --git a/Django-1.8.7 b/Django-1.8.7 +new file mode 120000 +index 0000000..2fa6e7c --- /dev/null -+++ b/Django-1.11.13 ++++ b/Django-1.8.7 @@ -0,0 +1 @@ -+Django-1.11.13 - ++Django-1.8.7 +\ No newline at end of file diff --git a/django/contrib/sessions/backends/file.py b/django/contrib/sessions/backends/file.py index 41469c4..2b10b3e 100644 --- a/django/contrib/sessions/backends/file.py +++ b/django/contrib/sessions/backends/file.py -@@ -78,6 +78,9 @@ class SessionStore(SessionBase): - expiry = session_data.get('_session_expiry') - if not expiry: - expiry = self._last_modification() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE) +@@ -71,6 +71,17 @@ class SessionStore(SessionBase): + modification = datetime.datetime.fromtimestamp(modification) + return modification + ++ def _expiry_date(self, session_data): ++ """ ++ Return the expiry time of the file storing the session's content. ++ """ ++ expiry = session_data.get('_session_expiry') ++ if not expiry: ++ expiry = self._last_modification() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE) + elif not isinstance(expiry, datetime.datetime): + expiry = self._last_modification() + datetime.timedelta(seconds=expiry) ++ return expiry + - return expiry - def load(self): + session_data = {} + try: +@@ -89,9 +100,7 @@ class SessionStore(SessionBase): + self.create() + + # Remove expired sessions. +- expiry_age = self.get_expiry_age( +- modification=self._last_modification(), +- expiry=session_data.get('_session_expiry')) ++ expiry_age = self.get_expiry_age(expiry=self._expiry_date(session_data)) + if expiry_age < 0: + session_data = {} + self.delete() -- -1.8.3.1 +1.9.1