File python-libxml2-python.spec of Package python-libxml2-python.23129

#
# spec file for package python-libxml2-python
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name:           python-libxml2-python
Version:        2.9.7
Release:        0
Summary:        Python Bindings for libxml2
License:        MIT
Group:          Development/Libraries/Python
Url:            http://xmlsoft.org
Source:         ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
Patch0:         python3.6-verify_fd.patch
Patch1:         libxml2-python3-unicode-errors.patch
# PATCH-FIX-UPSTREAM libxml2-python3-string-null-check.patch bsc#1065270 mgorse@suse.com -- don't return a NULL string for an invalid UTF-8 conversion.
Patch2:         libxml2-python3-string-null-check.patch
# PATCH-FIX-UPSTREAM bsc#1161517 CVE-2020-7595 Infinite loop in xmlStringLenDecodeEntities 
Patch4:         libxml2-CVE-2020-7595.patch
# PATCH-FIX-UPSTREAM bsc#1161521 CVE-2019-20388 Memory leak in xmlSchemaPreRun
Patch5:         libxml2-CVE-2019-20388.patch
# PATCH-FIX-UPSTREAM bsc#1176179 CVE-2020-24977 xmllint: global-buffer-overflow in xmlEncodeEntitiesInternal
Patch6:         libxml2-CVE-2020-24977.patch
# PATCH-FIX-SUSE bsc#1178823 Avoid quadratic checking of identity-constraints
Patch7:         libxml2-Avoid-quadratic-checking-of-identity-constraints.patch
# PATCH-FIX-UPSTREAM bsc#1185409 CVE-2021-3516 use-after-free in entities.c:xmlEncodeEntitiesInternal()
Patch8:         libxml2-CVE-2021-3516.patch
# PATCH-FIX-UPSTREAM bsc#1185410 CVE-2021-3517 heap-based buffer overflow entities.c:xmlEncodeEntitiesInternal()
Patch9:         libxml2-CVE-2021-3517.patch
# PATCH-FIX-UPSTREAM bsc#1185408 CVE-2021-3518 use-after-free in xinclude.c:xmlXIncludeDoProcess()
Patch10:        libxml2-CVE-2021-3518.patch
# PATCH-FIX-UPSTREAM bsc#1185698 CVE-2021-3537 NULL pointer dereference in valid.c:xmlValidBuildAContentModel
Patch11:        libxml2-CVE-2021-3537.patch
# PATCH-FIX-UPSTREAM bsc#1186015 CVE-2021-3541 Exponential entity expansion attack bypasses all existing protection mechanisms
Patch12:        libxml2-CVE-2021-3541.patch
# PATCH-FIX-UPSTREAM bsc#1196490 CVE-2022-23308 Use-after-free of ID and IDREF attributes
# - https://gitlab.gnome.org/GNOME/libxml2/-/commit/652dd12a858989b14eed4e84e453059cd3ba340e
Patch13:        libxml2-CVE-2022-23308.patch

BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module xml}
BuildRequires:  pkgconfig
BuildRequires:  python-rpm-macros
BuildRequires:  pkgconfig(libxml-2.0)
Requires:       libxml2-2 = %{version}
%ifpython2
Obsoletes:      libxml2-python < %{version}
Provides:       libxml2-python = %{version}
Obsoletes:      %{oldpython}-libxml2 < %{version}
Provides:       %{oldpython}-libxml2 = %{version}
%endif
%python_subpackages

%description
The libxml2-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxml2 library to manipulate XML files.

This library allows manipulation of XML files. It includes support for
reading, modifying, and writing XML and HTML files. There is DTD
support that includes parsing and validation even with complex DTDs,
either at parse time or later once the document has been modified.

%prep
%setup -q -n libxml2-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure \
    --with-fexceptions \
    --with-history \
    --enable-ipv6 \
    --with-sax1 \
    --with-regexps \
    --with-threads \
    --with-reader \
    --with-http

pushd python
%python_build
popd

%install
pushd python
%python_install
popd
chmod a-x python/tests/*.py
# Unwanted doc stuff
rm -fr %{buildroot}%{_datadir}/doc
rm -f python/tests/Makefile*

%files %{python_files}
%doc python/TODO
%doc python/libxml2class.txt
%doc python/tests
%{python_sitearch}/*

%changelog
openSUSE Build Service is sponsored by