diff --git a/CVE-2021-32839.patch b/CVE-2021-32839.patch deleted file mode 100644 index 9a2282a..0000000 --- a/CVE-2021-32839.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 8238a9e450ed1524e40cb3a8b0b3c00606903aeb Mon Sep 17 00:00:00 2001 -From: Andi Albrecht -Date: Tue, 7 Sep 2021 12:27:28 +0200 -Subject: [PATCH] Optimize regular expression for identifying line breaks in - comments. - ---- - sqlparse/filters/others.py | 5 ++++- - tests/test_format.py | 17 +++++++++++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py -index e0e1ca19..6905f2d6 100644 ---- a/sqlparse/filters/others.py -+++ b/sqlparse/filters/others.py -@@ -22,7 +22,10 @@ def get_next_comment(): - def _get_insert_token(token): - """Returns either a whitespace or the line breaks from token.""" - # See issue484 why line breaks should be preserved. -- m = re.search(r'((\r\n|\r|\n)+) *$', token.value) -+ # Note: The actual value for a line break is replaced by \n -+ # in SerializerUnicode which will be executed in the -+ # postprocessing state. -+ m = re.search(r'((\r|\n)+) *$', token.value) - if m is not None: - return sql.Token(T.Whitespace.Newline, m.groups()[0]) - else: -diff --git a/tests/test_format.py b/tests/test_format.py -index 7117d9d6..70bb8055 100644 ---- a/tests/test_format.py -+++ b/tests/test_format.py -@@ -84,6 +84,23 @@ def test_strip_comments_multi(self): - res = sqlparse.format(sql, strip_comments=True) - assert res == 'select (select 2)' - -+ def test_strip_comments_preserves_linebreak(self): -+ sql = 'select * -- a comment\r\nfrom foo' -+ res = sqlparse.format(sql, strip_comments=True) -+ assert res == 'select *\nfrom foo' -+ sql = 'select * -- a comment\nfrom foo' -+ res = sqlparse.format(sql, strip_comments=True) -+ assert res == 'select *\nfrom foo' -+ sql = 'select * -- a comment\rfrom foo' -+ res = sqlparse.format(sql, strip_comments=True) -+ assert res == 'select *\nfrom foo' -+ sql = 'select * -- a comment\r\n\r\nfrom foo' -+ res = sqlparse.format(sql, strip_comments=True) -+ assert res == 'select *\n\nfrom foo' -+ sql = 'select * -- a comment\n\nfrom foo' -+ res = sqlparse.format(sql, strip_comments=True) -+ assert res == 'select *\n\nfrom foo' -+ - def test_strip_ws(self): - f = lambda sql: sqlparse.format(sql, strip_whitespace=True) - s = 'select\n* from foo\n\twhere ( 1 = 2 )\n' diff --git a/python-sqlparse.spec b/python-sqlparse.spec index 5a0b2a1..3374913 100644 --- a/python-sqlparse.spec +++ b/python-sqlparse.spec @@ -1,14 +1,12 @@ %global _empty_manifest_terminate_build 0 Name: python-sqlparse -Version: 0.4.1 -Release: 3 +Version: 0.4.2 +Release: 1 Summary: A non-validating SQL parser. -License: BSD-3-Clause +License: BSD URL: https://github.com/andialbrecht/sqlparse -Patch001: CVE-2021-32839.patch -Source0: https://files.pythonhosted.org/packages/a2/54/da10f9a0235681179144a5ca02147428f955745e9393f859dec8d0d05b41/sqlparse-0.4.1.tar.gz +Source0: https://files.pythonhosted.org/packages/32/fe/8a8575debfd924c8160295686a7ea661107fc34d831429cce212b6442edb/sqlparse-0.4.2.tar.gz BuildArch: noarch - %description A non-validating SQL parser. @@ -22,19 +20,17 @@ BuildRequires: python3-pbr BuildRequires: python3-pip BuildRequires: python3-wheel BuildRequires: python3-pytest - %description -n python3-sqlparse A non-validating SQL parser. %package help Summary: A non-validating SQL parser. Provides: python3-sqlparse-doc - %description help A non-validating SQL parser. %prep -%autosetup -n sqlparse-%{version} -p1 +%autosetup -n sqlparse-%{version} %build %py3_build @@ -69,7 +65,7 @@ mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %check -%{__python3} -m pytest +%{__python3} setup.py test %files -n python3-sqlparse -f filelist.lst %dir %{python3_sitelib}/* @@ -78,6 +74,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Fri May 20 2022 renliang - 0.4.2-1 +- Upgrade package python3-sqlparse to version 0.4.2 + * Mon May 9 2022 yaoxin - 0.4.1-3 - License compliance rectification diff --git a/sqlparse-0.4.1.tar.gz b/sqlparse-0.4.1.tar.gz deleted file mode 100644 index bc3748b..0000000 Binary files a/sqlparse-0.4.1.tar.gz and /dev/null differ diff --git a/sqlparse-0.4.2.tar.gz b/sqlparse-0.4.2.tar.gz new file mode 100644 index 0000000..30d6f13 Binary files /dev/null and b/sqlparse-0.4.2.tar.gz differ