From d0e1110fda670d329aabf21fcfd6ee672e198618 Mon Sep 17 00:00:00 2001 From: SidneyAn Date: Fri, 28 Dec 2018 18:58:42 +0800 Subject: [PATCH] upgrade python-django to CentOS 7.6 version [Patch 2/3] update to version 1.11.13-4 remove unnecessary patches Story: 2004522 Task: 28402 Depends-On: https://review.openstack.org/#/c/627590/ Change-Id: Icec77377cb40c253ad4f94a62595b35cae6b46e4 Signed-off-by: SidneyAn --- ...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, 67 insertions(+), 162 deletions(-) delete mode 100644 python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch delete 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 9650530af..8f89f25e9 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 -@@ -29,7 +29,7 @@ +@@ -22,7 +22,7 @@ Name: python-django - Version: 1.8.14 --Release: 1%{?dist} -+Release: 1.el7%{?_tis_dist}.%{tis_patch_ver} + Version: 1.11.13 +-Release: 4%{?dist} ++Release: 4.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 8d18985c6..77decbf30 100644 --- a/python/python-django/centos/meta_patches/PATCH_ORDER +++ b/python/python-django/centos/meta_patches/PATCH_ORDER @@ -2,4 +2,3 @@ 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 412bb9b66..7bf602006 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 -@@ -421,6 +421,8 @@ popd - %doc docs/_build/html/* +@@ -396,6 +396,8 @@ cd tests + # %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 20b00cf38..0737afa24 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,30 +3,23 @@ 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 | 2 ++ - 1 file changed, 2 insertions(+) + SPECS/python-django.spec | 1 + + 1 file changed, 1 insertion(+) 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 -@@ -41,6 +41,7 @@ Patch0: python-django-1.8.3-shell-completion.patch +@@ -32,6 +32,7 @@ Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-% # WRS - Patch1: session-filebase-backend-fix.patch -+Patch2: size-number-format.patch + Patch0: session-filebase-backend-fix.patch ++Patch1: 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 b93bbfe15..248edbfb0 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 | 6 ++++++ - 1 file changed, 6 insertions(+) + SPECS/python-django.spec | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) 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 -@@ -39,6 +39,9 @@ Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-% - - Patch0: python-django-1.8.3-shell-completion.patch +@@ -30,6 +30,9 @@ License: BSD + URL: http://www.djangoproject.com/ + Source0: https://files.pythonhosted.org/packages/source/D/Django/Django-%{version}.tar.gz +# WRS -+Patch1: session-filebase-backend-fix.patch ++Patch0: session-filebase-backend-fix.patch + BuildArch: noarch - BuildRequires: python2-devel -@@ -149,6 +152,9 @@ rm -rf Django.egg-info - %patch0 +@@ -146,7 +149,7 @@ principle. + %endif -+# WRS -+%patch1 -p1 -+ - # empty files - for f in \ - django/contrib/staticfiles/models.py \ + %prep +-%autosetup -n %{pkgname}-%{version} ++%autosetup -n %{pkgname}-%{version} -p1 + + + %build -- -1.9.1 +1.8.3.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 deleted file mode 100644 index e98189aa1..000000000 --- a/python/python-django/centos/meta_patches/spec-patch-to-remove-SmartyPants.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index fac77b181..000000000 --- a/python/python-django/centos/patches/remove-SmartyPantsHTMLTranslator.patch +++ /dev/null @@ -1,50 +0,0 @@ -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 67d2cd3ab..bf10245c6 100644 --- a/python/python-django/centos/patches/size-number-format.patch +++ b/python/python-django/centos/patches/size-number-format.patch @@ -2,24 +2,26 @@ 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 -@@ -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) +@@ -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) else: -- value = ugettext("%s PB") % filesize_number_format(bytes / PB) -+ value = ugettext("%s PiB") % filesize_number_format(bytes / PB) - - return avoid_wrapping(value) +- value = ugettext("%s PB") % filesize_number_format(bytes_ / PB) ++ value = ugettext("%s PiB") % filesize_number_format(bytes_ / PB) + if negative: + value = "-%s" % value + + diff --git a/python/python-django/centos/srpm_path b/python/python-django/centos/srpm_path index 1b60de931..19159ea9a 100644 --- a/python/python-django/centos/srpm_path +++ b/python/python-django/centos/srpm_path @@ -1 +1 @@ -mirror:Source/python-django-1.8.14-1.el7.src.rpm +mirror:Source/python-django-1.11.13-4.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 993d2fb42..17c47b470 100644 --- a/python/python-django/files/session-filebase-backend-fix.patch +++ b/python/python-django/files/session-filebase-backend-fix.patch @@ -4,52 +4,33 @@ Date: Mon, 11 Jul 2016 16:20:13 -0400 Subject: [PATCH 1/1] session-filebase-backend-fix --- - 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 + Django-1.11.13 | 1 + + django/contrib/sessions/backends/file.py | 3 +++ + 2 files changed, 4 insertions(+) + create mode 100644 Django-1.11.13 -diff --git a/Django-1.8.7 b/Django-1.8.7 -new file mode 120000 -index 0000000..2fa6e7c +diff --git a/Django-1.11.13 b/Django-1.11.13 +new file mode 100644 +index 0000000..b7c239f --- /dev/null -+++ b/Django-1.8.7 ++++ b/Django-1.11.13 @@ -0,0 +1 @@ -+Django-1.8.7 -\ No newline at end of file ++Django-1.11.13 + 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 -@@ -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) +@@ -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) + elif not isinstance(expiry, datetime.datetime): + expiry = self._last_modification() + datetime.timedelta(seconds=expiry) -+ return expiry + - def load(self): - session_data = {} - try: -@@ -89,9 +100,7 @@ class SessionStore(SessionBase): - self.create() + return expiry - # 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() + def load(self): -- -1.9.1 +1.8.3.1