From aca80cc31324ed5c43841eb3728b3ccddc4c0743 Mon Sep 17 00:00:00 2001 From: Shuo Wang Date: Mon, 25 Sep 2023 16:22:24 +0800 Subject: [PATCH] update to 23.8.0 Signed-off-by: Shuo Wang --- ....0rc1-remove-hatch-fancy-pypi-readme.patch | 45 +++++ ...bject-from-gi.repository-in-Python-3.patch | 32 ---- ...-23.8.0rc1-fix-and-skip-tests-fedora.patch | 181 ++++++++++++++++++ ...-11786-fix-misuse-of-mktime-in-tests.patch | 120 ++++++++++++ python-twisted.spec | 28 ++- sources | 2 +- 6 files changed, 369 insertions(+), 39 deletions(-) create mode 100644 0001-23.8.0rc1-remove-hatch-fancy-pypi-readme.patch delete mode 100644 0001-Import-gobject-from-gi.repository-in-Python-3.patch create mode 100644 0002-23.8.0rc1-fix-and-skip-tests-fedora.patch create mode 100644 0003-11786-fix-misuse-of-mktime-in-tests.patch diff --git a/0001-23.8.0rc1-remove-hatch-fancy-pypi-readme.patch b/0001-23.8.0rc1-remove-hatch-fancy-pypi-readme.patch new file mode 100644 index 0000000..41a3f96 --- /dev/null +++ b/0001-23.8.0rc1-remove-hatch-fancy-pypi-readme.patch @@ -0,0 +1,45 @@ +diff -up twisted-twisted-23.8.0rc1/pyproject.toml.orig twisted-twisted-23.8.0rc1/pyproject.toml +--- twisted-twisted-23.8.0rc1/pyproject.toml.orig 2023-08-21 15:45:30.453610722 -0600 ++++ twisted-twisted-23.8.0rc1/pyproject.toml 2023-08-21 15:45:54.818500317 -0600 +@@ -1,7 +1,7 @@ + [build-system] + requires = [ + "hatchling >= 1.10.0", +- "hatch-fancy-pypi-readme >= 22.5.0", ++# "hatch-fancy-pypi-readme >= 22.5.0", + "incremental >= 22.10.0", + ] + build-backend = "hatchling.build" +@@ -173,19 +173,19 @@ source = "code" + path = "src/twisted/__init__.py" + search-paths = ["src"] + +-[tool.hatch.metadata.hooks.fancy-pypi-readme] +-content-type = "text/x-rst" +-fragments = [ +- { path = "README.rst" }, +-] +- +-[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +-# Munge links of the form `NEWS `_ to point at the appropriate +-# location on GitHub so that they function when the long description is +-# displayed on PyPI. +-pattern = '`([^`]+)\s+<(?!https?://)([^>]+)>`_' +-replacement = '`\1 `_' +-ignore-case = true ++#[tool.hatch.metadata.hooks.fancy-pypi-readme] ++#content-type = "text/x-rst" ++#fragments = [ ++# { path = "README.rst" }, ++#] ++# ++#[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] ++## Munge links of the form `NEWS `_ to point at the appropriate ++## location on GitHub so that they function when the long description is ++## displayed on PyPI. ++#pattern = '`([^`]+)\s+<(?!https?://)([^>]+)>`_' ++#replacement = '`\1 `_' ++#ignore-case = true + + [tool.hatch.build.targets.wheel] + packages = [ diff --git a/0001-Import-gobject-from-gi.repository-in-Python-3.patch b/0001-Import-gobject-from-gi.repository-in-Python-3.patch deleted file mode 100644 index 015f672..0000000 --- a/0001-Import-gobject-from-gi.repository-in-Python-3.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2e99044f6785e9bd0c252cee4349feab9bb9bb66 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= -Date: Wed, 22 May 2019 18:13:32 +0200 -Subject: [PATCH 1/2] Import gobject from gi.repository in Python 3 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Robert-André Mauchin ---- - src/twisted/internet/gtk2reactor.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/twisted/internet/gtk2reactor.py b/src/twisted/internet/gtk2reactor.py -index faf123464..19d97445c 100644 ---- a/src/twisted/internet/gtk2reactor.py -+++ b/src/twisted/internet/gtk2reactor.py -@@ -43,7 +43,10 @@ try: - except (ImportError, AttributeError): - pass # maybe we're using pygtk before this hack existed. - --import gobject # type: ignore[import] -+try: -+ import gobject # type: ignore[import] -+except ImportError: -+ from gi.repository import GObject as gobject - - if hasattr(gobject, "threads_init"): - # recent versions of python-gtk expose this. python-gtk=2.4.1 --- -2.21.0 - diff --git a/0002-23.8.0rc1-fix-and-skip-tests-fedora.patch b/0002-23.8.0rc1-fix-and-skip-tests-fedora.patch new file mode 100644 index 0000000..56fbf77 --- /dev/null +++ b/0002-23.8.0rc1-fix-and-skip-tests-fedora.patch @@ -0,0 +1,181 @@ +diff -up twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_cftp.py.orig twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_cftp.py +--- twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_cftp.py.orig 2023-08-17 13:10:32.000000000 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_cftp.py 2023-08-21 15:30:15.276801640 -0600 +@@ -1436,6 +1436,7 @@ exit + @skipIf(skipTests, "don't run w/o spawnProcess or cryptography") + @skipIf(not which("ssh"), "no ssh command-line client available") + @skipIf(not which("sftp"), "no sftp command-line client available") ++@skipIf(True, "no networking in Fedora buildsystem") + class OurServerSftpClientTests(CFTPClientTestBase): + """ + Test the sftp server against sftp command line client. +@@ -1479,11 +1480,11 @@ class OurServerSftpClientTests(CFTPClien + # first need to check if we can set it. If we can, -V will just print + # the version without doing anything else; if we can't, we will get a + # configuration error. +- d = getProcessValue("ssh", ("-o", "PubkeyAcceptedKeyTypes=ssh-dss", "-V"), env) ++ d = getProcessValue("ssh", ("-o", "PubkeyAcceptedKeyTypes=ssh-rsa", "-V"), env) + + def hasPAKT(status): + if status == 0: +- args = ("-o", "PubkeyAcceptedKeyTypes=ssh-dss") ++ args = ("-o", "PubkeyAcceptedKeyTypes=+ssh-rsa") + else: + args = () + # Pass -F /dev/null to avoid the user's configuration file from +@@ -1497,7 +1498,9 @@ class OurServerSftpClientTests(CFTPClien + "-o", + "UserKnownHostsFile=kh_test", + "-o", +- "HostKeyAlgorithms=ssh-rsa", ++ "HostKeyAlgorithms=+ssh-rsa", ++ "-o", ++ "PubkeyAcceptedKeyTypes=+ssh-rsa", + "-o", + "Port=%i" % (port,), + "-b", +diff -up twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_checkers.py.orig twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_checkers.py +--- twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_checkers.py.orig 2023-08-17 13:10:32.000000000 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_checkers.py 2023-08-21 15:31:16.696516038 -0600 +@@ -12,6 +12,8 @@ from collections import namedtuple + from io import BytesIO + from typing import Optional + ++from unittest import skipIf ++ + cryptSkip: Optional[str] + try: + import crypt +@@ -53,6 +55,7 @@ else: + euidSkip = "Cannot run without effective UIDs (questionable)" + + ++@skipIf(True, "disable in Fedora buildsys") + class HelperTests(TestCase): + """ + Tests for helper functions L{verifyCryptedPassword}, L{_pwdGetByName} and +diff -up twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_conch.py.orig twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_conch.py +--- twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_conch.py.orig 2023-08-21 14:08:33.889470644 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/conch/test/test_conch.py 2023-08-21 15:37:03.953906330 -0600 +@@ -421,7 +421,7 @@ class ForwardingMixin(ConchServerSetupMi + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -L%i:127.0.0.1:%i" % (localPort, self.echoPort) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -L%i:127.0.0.1:%i" % (localPort, self.echoPort) + ) + d.addCallback(self.assertEqual, b"test\n") + return d +@@ -434,7 +434,7 @@ class ForwardingMixin(ConchServerSetupMi + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -R %i:127.0.0.1:%i" % (localPort, self.echoPort) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -R %i:127.0.0.1:%i" % (localPort, self.echoPort) + ) + d.addCallback(self.assertEqual, b"test\n") + return d +@@ -572,12 +572,12 @@ class OpenSSHClientMixin: + # the version without doing anything else; if we can't, we will get a + # configuration error. + d = getProcessValue( +- which("ssh")[0], ("-o", "PubkeyAcceptedKeyTypes=ssh-dss", "-V") ++ which("ssh")[0], ("-o", "PubkeyAcceptedKeyTypes=ssh-rsa", "-V") + ) + + def hasPAKT(status): + if status == 0: +- opts = "-oPubkeyAcceptedKeyTypes=ssh-dss " ++ opts = "-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa " + else: + opts = "" + +@@ -592,7 +592,8 @@ class OpenSSHClientMixin: + "-oUserKnownHostsFile=kh_test " + "-oPasswordAuthentication=no " + # Always use the RSA key, since that's the one in kh_test. +- "-oHostKeyAlgorithms=ssh-rsa " ++ "-oHostKeyAlgorithms=+ssh-rsa " ++ "-oPubkeyAcceptedKeyTypes=+ssh-rsa " + "-a " + "-i dsa_test " + ) +@@ -614,6 +615,7 @@ class OpenSSHClientMixin: + return d.addCallback(hasPAKT) + + ++@skipIf(True, "broken on Fedora, possibly crypto policies") + class OpenSSHKeyExchangeTests(ConchServerSetupMixin, OpenSSHClientMixin, TestCase): + """ + Tests L{SSHTransportBase}'s key exchange algorithm compatibility with +@@ -706,6 +708,7 @@ class OpenSSHKeyExchangeTests(ConchServe + ) + + ++@skipIf(True, "no networking in Fedora buildsystem") + class OpenSSHClientForwardingTests(ForwardingMixin, OpenSSHClientMixin, TestCase): + """ + Connection forwarding tests run against the OpenSSL command line client. +@@ -719,12 +722,13 @@ class OpenSSHClientForwardingTests(Forwa + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -L%i:[::1]:%i" % (localPort, self.echoPortV6) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -L%i:[::1]:%i" % (localPort, self.echoPortV6) + ) + d.addCallback(self.assertEqual, b"test\n") + return d + + ++@skipIf(True, "broken on Fedora, possibly crypto policies") + class OpenSSHClientRekeyTests(RekeyTestsMixin, OpenSSHClientMixin, TestCase): + """ + Rekeying tests run against the OpenSSL command line client. +@@ -755,6 +759,8 @@ class CmdLineClientTests(ForwardingMixin + "--user-authentications publickey " + "-a " + "-i dsa_test " ++ "-oHostKeyAlgorithms=+ssh-rsa " ++ "-oPubkeyAcceptedKeyTypes=+ssh-rsa " + "-v ".format(port) + sshArgs + " 127.0.0.1 " + remoteCommand + ) + cmds = _makeArgs(conchArgs + cmd.split()) +diff -up twisted-twisted-23.8.0rc1/src/twisted/test/test_failure.py.orig twisted-twisted-23.8.0rc1/src/twisted/test/test_failure.py +--- twisted-twisted-23.8.0rc1/src/twisted/test/test_failure.py.orig 2023-08-21 15:55:10.002981483 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/test/test_failure.py 2023-08-21 15:55:37.576855813 -0600 +@@ -16,7 +16,10 @@ from io import StringIO + from traceback import FrameSummary + from unittest import skipIf + +-from cython_test_exception_raiser import raiser # type: ignore[import] ++try: ++ from cython_test_exception_raiser import raiser # type: ignore[import] ++except ImportError: ++ raiser = None + + from twisted.python import failure, reflect + from twisted.trial.unittest import SynchronousTestCase +diff -up twisted-twisted-23.8.0rc1/src/twisted/test/test_main.py.orig twisted-twisted-23.8.0rc1/src/twisted/test/test_main.py +--- twisted-twisted-23.8.0rc1/src/twisted/test/test_main.py.orig 2023-08-21 20:14:02.191530938 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/test/test_main.py 2023-08-21 20:33:15.969191736 -0600 +@@ -13,7 +13,9 @@ from twisted.internet import defer, reac + from twisted.test.test_process import Accumulator + from twisted.trial.unittest import TestCase + ++from unittest import skipIf + ++@skipIf(True, "PYTHONPATH lost on sub process, just skip these vs passing this in") + class MainTests(TestCase): + """Test that twisted scripts can be invoked as modules.""" + +diff -up twisted-twisted-23.8.0rc1/src/twisted/test/test_udp.py.orig twisted-twisted-23.8.0rc1/src/twisted/test/test_udp.py +--- twisted-twisted-23.8.0rc1/src/twisted/test/test_udp.py.orig 2023-08-21 15:00:03.709147004 -0600 ++++ twisted-twisted-23.8.0rc1/src/twisted/test/test_udp.py 2023-08-21 15:53:12.994514370 -0600 +@@ -602,6 +602,7 @@ class MulticastTests(TestCase): + o.transport.setTTL(2) + self.assertEqual(o.transport.getTTL(), 2) + ++ @skipIf(True, "no networking in Fedora buildsystem") + def test_loopback(self): + """ + Test that after loopback mode has been set, multicast packets are diff --git a/0003-11786-fix-misuse-of-mktime-in-tests.patch b/0003-11786-fix-misuse-of-mktime-in-tests.patch new file mode 100644 index 0000000..f247967 --- /dev/null +++ b/0003-11786-fix-misuse-of-mktime-in-tests.patch @@ -0,0 +1,120 @@ +From 75e5e6ba1793efdfef2e2cfada0425bad5f0bcfa Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 9 Dec 2022 10:16:42 -0800 +Subject: [PATCH 4/6] #11786 fix misuse of mktime in tests + +(cherry picked from commit da3bf3dc29f067e7019b2a1c205834ab64b2139a) +--- + src/twisted/logger/test/test_format.py | 27 +++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/src/twisted/logger/test/test_format.py b/src/twisted/logger/test/test_format.py +index dbfbe1af1a..0671b6662c 100644 +--- a/src/twisted/logger/test/test_format.py ++++ b/src/twisted/logger/test/test_format.py +@@ -166,16 +166,17 @@ class TimeFormattingTests(unittest.TestCase): + def testForTimeZone(name: str, expectedDST: str, expectedSTD: str) -> None: + setTZ(name) + +- localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1)) + localSTD = mktime((2007, 1, 31, 0, 0, 0, 2, 31, 0)) +- +- self.assertEqual(formatTime(localDST), expectedDST) + self.assertEqual(formatTime(localSTD), expectedSTD) + ++ if expectedDST: ++ localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1)) ++ self.assertEqual(formatTime(localDST), expectedDST) ++ + # UTC + testForTimeZone( + "UTC+00", +- "2006-06-30T00:00:00+0000", ++ None, + "2007-01-31T00:00:00+0000", + ) + +@@ -196,7 +197,7 @@ class TimeFormattingTests(unittest.TestCase): + # No DST + testForTimeZone( + "CST+06", +- "2006-06-30T00:00:00-0600", ++ None, + "2007-01-31T00:00:00-0600", + ) + +@@ -211,7 +212,7 @@ class TimeFormattingTests(unittest.TestCase): + """ + If C{timeFormat} argument is L{None}, we get the default output. + """ +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + self.assertEqual(formatTime(t, timeFormat=None), "-") + self.assertEqual(formatTime(t, timeFormat=None, default="!"), "!") + +@@ -219,7 +220,7 @@ class TimeFormattingTests(unittest.TestCase): + """ + Alternate time format in output. + """ +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + self.assertEqual(formatTime(t, timeFormat="%Y/%W"), "2013/38") + + def test_formatTimePercentF(self) -> None: +@@ -246,7 +247,7 @@ class ClassicLogFormattingTests(unittest.TestCase): + addTZCleanup(self) + setTZ("UTC+00") + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event = dict(log_format="XYZZY", log_time=t) + self.assertEqual( + formatEventAsClassicLogText(event), +@@ -539,7 +540,7 @@ class EventAsTextTests(unittest.TestCase): + except CapturedError: + f = Failure() + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event: LogEvent = { + "log_format": "ABCD", + "log_system": "fake_system", +@@ -573,7 +574,7 @@ class EventAsTextTests(unittest.TestCase): + except CapturedError: + f = Failure() + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event: LogEvent = { + "log_format": "ABCD", + "log_system": "fake_system", +@@ -601,7 +602,7 @@ class EventAsTextTests(unittest.TestCase): + except CapturedError: + f = Failure() + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event: LogEvent = { + "log_format": "ABCD", + "log_time": t, +@@ -628,7 +629,7 @@ class EventAsTextTests(unittest.TestCase): + except CapturedError: + f = Failure() + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event: LogEvent = { + "log_format": "ABCD", + "log_time": t, +@@ -657,7 +658,7 @@ class EventAsTextTests(unittest.TestCase): + except CapturedError: + f = Failure() + +- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1)) ++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1)) + event: LogEvent = { + "log_format": "ABCD", + "log_time": t, +-- +2.39.2 + diff --git a/python-twisted.spec b/python-twisted.spec index ba4fe82..3cd36c2 100644 --- a/python-twisted.spec +++ b/python-twisted.spec @@ -1,14 +1,19 @@ %global srcname twisted +%bcond_with python_bootstrap +%bcond_with test + Summary: Twisted is a networking engine written in Python Name: python-%{srcname} -Version: 22.4.0 -Release: 5%{?dist} +Version: 23.8.0 +Release: 1%{?dist} License: MIT URL: http://twistedmatrix.com/ Source0: https://github.com/twisted/twisted/archive/%{srcname}-%{version}/%{srcname}-%{version}.tar.gz -Patch0001: 0001-Import-gobject-from-gi.repository-in-Python-3.patch +Patch0001: 0003-11786-fix-misuse-of-mktime-in-tests.patch +Patch3001: 0001-23.8.0rc1-remove-hatch-fancy-pypi-readme.patch +Patch3002: 0002-23.8.0rc1-fix-and-skip-tests-fedora.patch BuildArch: noarch @@ -19,9 +24,12 @@ and more. %package -n python3-%{srcname} Summary: Twisted is a networking engine written in Python -BuildRequires: gcc -BuildRequires: git-core BuildRequires: python3-devel >= 3.3 +BuildRequires: python3-pyasn1-modules python3-cryptography python3-pynacl +BuildRequires: python3-pyOpenSSL python3-bcrypt python3-subunit +%if %{with test} +BuildRequires: python3-hamcrest python3-h2 python3-hypothesis python3-service-identity +%endif Recommends: python3-%{srcname}+tls %description -n python3-%{srcname} @@ -54,8 +62,13 @@ ln -s ./twistd %{buildroot}%{_bindir}/twistd-3 %pyproject_save_files %{srcname} echo "%ghost %{python3_sitelib}/twisted/plugins/dropin.cache" >> %{pyproject_files} +find %{buildroot} -name LICENSE | xargs -I {} rm -f {} + %check -PATH=%{buildroot}%{_bindir}:$PATH PYTHONPATH=%{pyproject_build_lib} %{buildroot}%{_bindir}/trial twisted ||: +%if %{with test} +PATH=%{buildroot}%{_bindir}:$PATH PYTHONPATH="$PWD/src:%{?with_python_bootstrap:$PYTHONPATH}" \ + %{buildroot}%{_bindir}/trial twisted +%endif %files -n python3-twisted -f %{pyproject_files} %license LICENSE @@ -81,6 +94,9 @@ PATH=%{buildroot}%{_bindir}:$PATH PYTHONPATH=%{pyproject_build_lib} %{buildroot} %{_mandir}/man1/twistd.1* %changelog +* Mon Sep 25 2023 Shuo Wang - 23.8.0-1 +- update to 23.8.0 + * Tue Sep 19 2023 OpenCloudOS Release Engineering - 22.4.0-5 - Rebuilt for python 3.11 diff --git a/sources b/sources index 4dddcc9..aa0e61a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (twisted-22.4.0.tar.gz) = 776d36040bcefb9ca65e471d9058fe1067ffc8171a501cb451e9d4824a88dd83f79dc9b27a127ca898451587454ee661000acbce6c4c39b069aeadd64710f103 +SHA512 (twisted-23.8.0.tar.gz) = 29991277b382e332bd91b7ee71d77e753ac766ce8d3ab5867c5fbd9197f2f8dcb06833dbb6bbff56b3a123a1b2218f1c45ec29232b0045d80651a7db1634eece -- Gitee