SHA256
8
0
forked from pool/libxml2
Files
libxml2/libxml2.spec

275 lines
9.1 KiB
RPMSpec
Raw Permalink Normal View History

#
# spec file for package libxml2
#
# Copyright (c) 2025 SUSE LLC
#
# 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.
Accepting request 668947 from home:mgorse:branches:devel:libraries:c_c++ - Version update to 2.9.9: * Security: + CVE-2018-9251 CVE-2018-14567 Fix infinite loop in LZMA decompression (boo#1088279 boo#1105166). + CVE-2018-14404 Fix nullptr deref with XPath logic ops (boo#1102046). * Bug fixes: + Fix building relative URIs + Problem with data in interleave in RelaxNG validation + Fix memory leak in xmlSwitchInputEncodingInt error path + Set doc on element obtained from freeElems + Fix HTML serialization with UTF-8 encoding + Use actual doc in xmlTextReaderRead*Xml + Unlink node before freeing it in xmlSAX2StartElement + Check return value of nodePush in xmlSAX2StartElement + Free input buffer in xmlHaltParser + Reset HTML parser input pointers on encoding failure + Fix xmlSchemaValidCtxtPtr reuse memory leak + Fix xmlTextReaderNext with preparsed document + HTML noscript should not close p + Don't change context node in xmlXPathRoot * Improvements: + Remove redefined starts and defines inside include elements + Allow choice within choice in nameClass in RELAX NG + Look inside divs for starts and defines inside include + Add newlines to 'xmllint --xpath' output + Don't include SAX.h from globals.h + Support xmlTextReaderNextSibling w/o preparsed doc + Improve restoring of context size and position + Simplify and harden nodeset filtering OBS-URL: https://build.opensuse.org/request/show/668947 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=132
2019-01-28 07:51:27 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define base_name libxml2
%define libname libxml2-2
%define flavor @BUILD_FLAVOR@%nil
%if "%{flavor}" == "python"
%define dash -
%define buildpython 1
%endif
%{?sle15allpythons}
Name: libxml2%{?dash}%{flavor}
Version: 2.13.8
Release: 0
License: MIT
Summary: A Library to Manipulate XML Files
URL: https://gitlab.gnome.org/GNOME/libxml2
Source0: https://download.gnome.org/sources/%{name}/2.13/libxml2-%{version}.tar.xz
Source1: baselibs.conf
# W3C Conformance tests
Source2: https://www.w3.org/XML/Test/xmlts20080827.tar.gz
### -- Upstream patches range from 0 to 999 -- ###
# PATCH-FIX-UPSTREAM libxml2-python3-unicode-errors.patch bsc#1064286 mcepl@suse.com
# remove segfault after doc.freeDoc()
Patch0: libxml2-python3-unicode-errors.patch
# PATCH-FIX-UPSTREAM libxml2-python3-string-null-check.patch bsc#1065270 mgorse@suse.com
# https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/15
Patch1: libxml2-python3-string-null-check.patch
Accepting request 1126893 from home:david.anes:branches:devel:libraries:c_c++ - Removed patches (already in upstream): * libxml2-CVE-2023-39615.patch * libxml2-CVE-2023-45322.patch * libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch * python312.patch - Update to 2.12.0: * Major changes: - Most of the known issues leading to quadratic behavior in the XML parser were fixed. Internal hash tables were rewritten to reduce memory consumption. - Starting with this release, it should be enough to add the --with-legacy configuration option to provide maximum ABI compatibility. - libxml2 will now store global variables in thread-local storage if supported by the compiler. This avoids allocating the data lazily which can result in a fatal error condition. - A new API function xmlCheckThreadLocalStorage was added so the allocation can be checked earlier if compiler TLS is not supported. - To prepare for future improvements, some API functions now expect or return a const xmlError struct. - Several cyclic dependencies in public header files were fixed. - Refactoring of the encoding code has been mostly completed. Calling xmlSwitchEncoding from client code is now fully supported, for example to override the encoding for the push parser. - When parsing data from memory, libxml2 will now stream data chunk by chunk instead of copying the whole buffer (possibly twice with encodings), reducing peak memory consumption considerably. OBS-URL: https://build.opensuse.org/request/show/1126893 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=206
2023-11-16 15:42:22 +00:00
#
### -- openSUSE patches range from 1000 to 1999 -- ###
# PATCH-FIX-OPENSUSE
#Patch1000:
#
### -- SUSE patches starts from 2000 -- ###
## TODO -- Is libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch really
## SUSE-specific? If so, shouldn't it be applied only for SLE distributions?
# PATCH-FIX-SUSE bsc#1135123 Added a new configurable variable XPATH_DEFAULT_MAX_NODESET_LENGTH to avoid nodeset limit
Patch2000: libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
# CVE-2025-6170 [bsc#1244700], stack buffer overflow may lead to a crash|CVE-2025-6021 [bsc#1244580], Integer Overflow in xmlBuildQName() Leads to Stack Buffer Overflow in libxml2
Patch2001: libxml2-CVE-2025-6170,6021.patch
# CVE-2025-49794 [bsc#1244554], heap use after free (UAF) can lead to Denial of service (DoS)|CVE-2025-49796 [bsc#1244557], type confusion may lead to Denial of service (DoS)
Patch2002: libxml2-CVE-2025-49794,49796.patch
# CVE-2025-49795 [bsc#1244555], null pointer dereference may lead to Denial of service (DoS)
Patch2003: libxml2-CVE-2025-49795.patch
#
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: readline-devel
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(zlib)
%if 0%{?buildpython}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module xml}
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(libxml-2.0)
# TW: generate subpackages for every python3 flavor
%define python_subpackage_only 1
%python_subpackages
%endif
%description
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
%package -n %{libname}
Summary: A Library to Manipulate XML Files
%description -n %{libname}
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
This library implements a number of existing standards related to
markup languages, including the XML standard, name spaces in XML, XML
Base, RFC 2396, XPath, XPointer, HTML4, XInclude, SGML catalogs, and
XML catalogs. In most cases, libxml tries to implement the
specification in a rather strict way. To some extent, it provides
support for the following specifications, but does not claim to
implement them: DOM, FTP client, HTTP client, and SAX.
The library also supports RelaxNG. Support for W3C XML Schemas is in
progress.
%package tools
Summary: Tools using libxml
Provides: %{base_name} = %{version}-%{release}
# Use hardcoded version to avoid unwanted behavior in the future.
Obsoletes: %{base_name} < 2.9.13
%description tools
This package contains xmllint, a very useful tool proving libxml's power.
%package devel
Summary: Development files for libxml2, an XML manipulation library
Requires: %{base_name} = %{version}
Requires: %{base_name}-tools = %{version}
Requires: %{libname} = %{version}
Requires: glibc-devel
Requires: libxml2 = %{version}
Requires: readline-devel
Requires: xz-devel
Requires: pkgconfig(liblzma)
Requires: pkgconfig(zlib)
%description devel
The XML C library can load and save extensible data structures
or manipulate any kind of XML files.
This subpackage contains header files for developing
applications that want to make use of libxml.
%package doc
Summary: Documentation for libxml, an XML manipulation library
Requires: %{libname} = %{version}
BuildArch: noarch
%description doc
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
%package -n python-libxml2
Summary: Python Bindings for %{name}
Requires: %{libname} = %{version}
Requires: python-extras
Provides: %{base_name}-python = %{version}-%{release}
Provides: python-libxml2-python = %{version}-%{release}
# Use hardcoded version to avoid unwanted behavior in the future.
Obsoletes: %{base_name}-python < 2.9.13
Obsoletes: python-libxml2-python < 2.9.13
%description -n python-libxml2
This 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
%autosetup -p1 -n libxml2-%{version}
sed -i '1 s|/usr/bin/env python|/usr/bin/python3|' doc/apibuild.py
%build
%if ! 0%{?buildpython}
# TODO -- Document why are we using the -fno-strict-aliasing extra flag.
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure \
--disable-silent-rules \
--disable-static \
--docdir=%{_docdir}/%{base_name} \
--without-python \
--with-history \
--enable-ipv6 \
--with-sax1 \
--with-regexps \
--with-threads \
--with-reader \
--with-ftp \
--with-http \
--with-legacy
%make_build BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
%else
%configure --with-python=%{__python3}
pushd python
%if 0%{suse_version} > 1500
export PYTHONPATH="."
%pyproject_wheel
%else
%python_build
%endif
popd
%endif
%install
%if ! 0%{?buildpython}
%make_install BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
find %{buildroot} -type f -name "*.la" -delete -print
mkdir -p "%{buildroot}/%{_docdir}/%{base_name}"
Accepting request 1084343 from home:david.anes:branches:devel:libraries:c_c++ - Rebased patches: * libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch - Update to 2.11.1: * Fixes build and ABI issues. - cmake: Fix va_copy detection (Luca Niccoli) - libxml.m4: Fix quoting - Link with --undefined-version - libxml2.syms: Revert removal of version information - Update to 2.11.0: * Major changes - Protection against entity expansion attacks, also known as "billion laughs" has been greatly improved. Malicious files should be detected reliably now and false positives should be reduced. It is possible though that large documents which make heavy use of entities are rejected now. - This release finally fixes symbol visibility on UNIX systems. Internal symbols will now be hidden. While these symbols were never declared in public headers, it was still possible to declare them manually. Now this won't work. - All symbol information has been removed from the ELF version script to fix link errors with --no-undefined-version. The version nodes are kept so it should still be possible to run binaries linked against older versions. - About 90 memory errors in code paths handling malloc failures have been fixed. While these issues shouldn't impact security, this improves robustness under memory pressure. - The XInclude engine has been reworked to properly support nested includes. - Several cases of quadratic behavior in the XML push parser have been fixed. OBS-URL: https://build.opensuse.org/request/show/1084343 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=194
2023-05-03 16:01:24 +00:00
cp -a NEWS README.md %{buildroot}%{_docdir}/%{base_name}/
ln -s libxml2/libxml %{buildroot}%{_includedir}/libxml
# Remove duplicated file Copyright as not found by fdupes
rm -fr %{buildroot}%{_docdir}/%{base_name}/Copyright
%fdupes %{buildroot}%{_datadir}
%else
pushd python
%if 0%{suse_version} > 1500
%pyproject_install
%else
%python_install
%endif
popd
chmod a-x python/tests/*.py
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%endif
%if ! 0%{?buildpython}
%check
# qemu-arm can't keep up atm, disabling check for arm
%ifnarch %{arm}
tar xzvf %{SOURCE2} # add conformance tests where they are expected
%make_build check
rm -rf xmlconf/ # remove the conformance tests afterwards
%endif
%ldconfig_scriptlets -n %{libname}
%files -n %{libname}
%{_libdir}/lib*.so.*
%license Copyright
%doc %dir %{_docdir}/%{base_name}
%doc %{_docdir}/%{base_name}/[ANRCT]*
# the -n %%base_name tag is necessary so that python_subpackages does not interfere
%files -n %{base_name}-tools
%{_bindir}/xmllint
%{_bindir}/xmlcatalog
%{_mandir}/man1/xmllint.1%{?ext_man}
%{_mandir}/man1/xmlcatalog.1%{?ext_man}
%files -n %{base_name}-devel
%{_bindir}/xml2-config
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/libxml.m4
%{_includedir}/libxml
%{_includedir}/libxml2
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%{_libdir}/cmake
%{_mandir}/man1/xml2-config.1%{?ext_man}
%files -n %{base_name}-doc
%{_datadir}/gtk-doc/html/*
%doc %{_docdir}/%{base_name}/*.html
# owning these directories prevents gtk-doc <-> libxml2 build loop:
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%else
%files %{python_files libxml2}
%doc python/libxml2class.txt
%doc doc/*.py
%doc python/README
%pycache_only %{python_sitearch}/__pycache__/*libxml2*
%{python_sitearch}/*libxml2*
%endif
%changelog