reorganize

This commit is contained in:
Raven 2024-06-29 12:12:15 +06:00
parent 260f9562d8
commit f803d7ca8e
38 changed files with 5220 additions and 0 deletions

View File

@ -0,0 +1,169 @@
From fc0d2b5f15f58dae817816ba02e20ebf7017b842 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Mon, 18 Dec 2023 10:14:30 -0600
Subject: [PATCH] Revert "generate: Add fallback for missing "since""
This reverts commit 4fa286d504df8dd970a175db806a7f9156cdf527.
https://gitlab.gnome.org/GNOME/gi-docgen/-/issues/179
---
gidocgen/gdgenerate.py | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 75175a5..21095c6 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -146,7 +146,7 @@ def gen_index_func(func, namespace, md=None):
if func.available_since is not None:
available_since = func.available_since
else:
- available_since = namespace.version
+ available_since = None
if func.deprecated:
(version, msg) = func.deprecated_since
deprecated_since = version
@@ -170,7 +170,7 @@ def gen_index_property(prop, namespace, md=None):
if prop.available_since is not None:
available_since = prop.available_since
else:
- available_since = namespace.version
+ available_since = None
if prop.deprecated:
(version, msg) = prop.deprecated_since
deprecated_since = version
@@ -193,7 +193,7 @@ def gen_index_signal(signal, namespace, md=None):
if signal.available_since is not None:
available_since = signal.available_since
else:
- available_since = namespace.version
+ available_since = None
if signal.deprecated:
(version, msg) = signal.deprecated_since
deprecated_since = version
@@ -394,7 +394,7 @@ class TemplateConstant:
self.stability = const.stability
self.attributes = const.attributes
- self.available_since = const.available_since or namespace.version
+ self.available_since = const.available_since
if const.deprecated:
(version, msg) = const.deprecated_since
self.deprecated_since = {
@@ -455,7 +455,7 @@ class TemplateProperty:
self.description = MISSING_DESCRIPTION
self.stability = prop.stability
- self.available_since = prop.available_since or namespace.version
+ self.available_since = prop.available_since
if prop.deprecated:
(version, msg) = prop.deprecated_since
self.deprecated_since = {
@@ -800,7 +800,7 @@ class TemplateSignal:
self.stability = signal.stability
self.attributes = signal.attributes
- self.available_since = signal.available_since or namespace.version
+ self.available_since = signal.available_since
if signal.deprecated:
(version, msg) = signal.deprecated_since
self.deprecated_since = {
@@ -857,7 +857,7 @@ class TemplateMethod:
self.return_value = TemplateReturnValue(namespace, method, method.return_value)
self.stability = method.stability
- self.available_since = method.available_since or type_.available_since
+ self.available_since = method.available_since
if method.deprecated:
(version, msg) = method.deprecated_since
self.deprecated_since = {
@@ -1006,7 +1006,7 @@ class TemplateClassMethod:
self.stability = method.stability
self.attributes = method.attributes
- self.available_since = method.available_since or cls.available_since
+ self.available_since = method.available_since
if method.deprecated:
(version, msg) = method.deprecated_since
self.deprecated_since = {
@@ -1080,13 +1080,7 @@ class TemplateFunction:
self.stability = func.stability
self.attributes = func.attributes
- if func.available_since is None:
- if type_ is None:
- self.available_since = namespace.version
- else:
- self.available_since = type_.available_since
- else:
- self.available_since = func.available_since
+ self.available_since = func.available_since
if func.deprecated:
(version, msg) = func.deprecated_since
self.deprecated_since = {
@@ -1171,7 +1165,7 @@ class TemplateCallback:
self.stability = cb.stability
self.attributes = cb.attributes
- self.available_since = cb.available_since or namespace.version
+ self.available_since = cb.available_since
if cb.deprecated:
(version, msg) = cb.deprecated_since
self.deprecated_since = {
@@ -1315,7 +1309,7 @@ class TemplateInterface:
self.stability = interface.stability
self.attributes = interface.attributes
- self.available_since = interface.available_since or namespace.version
+ self.available_since = interface.available_since
if interface.deprecated:
(version, msg) = interface.deprecated_since
self.deprecated_since = {
@@ -1471,7 +1465,7 @@ class TemplateClass:
self.stability = cls.stability
self.attributes = cls.attributes
- self.available_since = cls.available_since or namespace.version
+ self.available_since = cls.available_since
if cls.deprecated:
(version, msg) = cls.deprecated_since
self.deprecated_since = {
@@ -1693,7 +1687,7 @@ class TemplateRecord:
self.stability = record.stability
self.attributes = record.attributes
- self.available_since = record.available_since or namespace.version
+ self.available_since = record.available_since
if record.deprecated:
(version, msg) = record.deprecated_since
self.deprecated_since = {
@@ -1772,7 +1766,7 @@ class TemplateUnion:
self.stability = union.stability
self.attributes = union.attributes
- self.available_since = union.available_since or namespace.version
+ self.available_since = union.available_since
if union.deprecated:
(version, msg) = union.deprecated_since
self.deprecated_since = {
@@ -1849,7 +1843,7 @@ class TemplateAlias:
self.stability = alias.stability
self.attributes = alias.attributes
- self.available_since = alias.available_since or namespace.version
+ self.available_since = alias.available_since
if alias.deprecated:
(version, msg) = alias.deprecated_since
self.deprecated_since = {
@@ -1912,7 +1906,7 @@ class TemplateEnum:
self.stability = enum.stability
self.attributes = enum.attributes
- self.available_since = enum.available_since or namespace.version
+ self.available_since = enum.available_since
if enum.deprecated:
(version, msg) = enum.deprecated_since
self.deprecated_since = {
--
2.43.0

View File

@ -0,0 +1,239 @@
diff -Naur gi-docgen-2022.2-original/gidocgen/templates/basic/basic.toml gi-docgen-2022.2/gidocgen/templates/basic/basic.toml
--- gi-docgen-2022.2-original/gidocgen/templates/basic/basic.toml 2022-11-07 09:50:06.000000000 -0500
+++ gi-docgen-2022.2/gidocgen/templates/basic/basic.toml 2022-11-11 08:23:51.069820380 -0500
@@ -42,35 +42,4 @@
"solarized-light.css",
"solarized-dark.css",
"search.js",
- "RedHatDisplay-Black.woff",
- "RedHatDisplay-Black.woff2",
- "RedHatDisplay-BlackItalic.woff",
- "RedHatDisplay-BlackItalic.woff2",
- "RedHatDisplay-Bold.woff",
- "RedHatDisplay-Bold.woff2",
- "RedHatDisplay-BoldItalic.woff",
- "RedHatDisplay-BoldItalic.woff2",
- "RedHatDisplay-Italic.woff",
- "RedHatDisplay-Italic.woff2",
- "RedHatDisplay-Medium.woff",
- "RedHatDisplay-Medium.woff2",
- "RedHatDisplay-MediumItalic.woff",
- "RedHatDisplay-MediumItalic.woff2",
- "RedHatDisplay-Regular.woff",
- "RedHatDisplay-Regular.woff2",
- "RedHatText-Bold.woff",
- "RedHatText-Bold.woff2",
- "RedHatText-BoldItalic.woff",
- "RedHatText-BoldItalic.woff2",
- "RedHatText-Italic.woff",
- "RedHatText-Italic.woff2",
- "RedHatText-Medium.woff",
- "RedHatText-Medium.woff2",
- "RedHatText-MediumItalic.woff",
- "RedHatText-MediumItalic.woff2",
- "RedHatText-Regular.woff",
- "RedHatText-Regular.woff2",
- "SourceCodePro-It.ttf.woff",
- "SourceCodePro-Regular.ttf.woff",
- "SourceCodePro-Semibold.ttf.woff",
]
diff -Naur gi-docgen-2022.2-original/gidocgen/templates/basic/fonts.css gi-docgen-2022.2/gidocgen/templates/basic/fonts.css
--- gi-docgen-2022.2-original/gidocgen/templates/basic/fonts.css 2022-11-07 09:50:06.000000000 -0500
+++ gi-docgen-2022.2/gidocgen/templates/basic/fonts.css 2022-11-11 08:23:51.069820380 -0500
@@ -14,9 +14,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-Regular.woff2") format("woff2"),
- url("RedHatDisplay-Regular.woff") format("woff");
+ src: local('RedHatDisplay-Regular');
font-style: normal;
font-weight: 400;
font-display: fallback;
@@ -24,9 +22,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-RegularItalic.woff2") format("woff2"),
- url("RedHatDisplay-RegularItalic.woff") format("woff");
+ src: local('RedHatDisplay-RegularItalic');
font-style: italic;
font-weight: 400;
font-display: fallback;
@@ -34,9 +30,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-Medium.woff2") format("woff2"),
- url("RedHatDisplay-Medium.woff") format("woff");
+ src: local('RedHatDisplay-Medium');
font-style: normal;
font-weight: 500;
font-display: fallback;
@@ -44,9 +38,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-MediumItalic.woff2") format("woff2"),
- url("RedHatDisplay-MediumItalic.woff") format("woff");
+ src: local('RedHatDisplay-MediumItalic');
font-style: italic;
font-weight: 500;
font-display: fallback;
@@ -54,9 +46,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-Bold.woff2") format("woff2"),
- url("RedHatDisplay-Bold.woff") format("woff");
+ src: local('RedHatDisplay-Bold');
font-style: normal;
font-weight: 700;
font-display: fallback;
@@ -64,9 +54,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-BoldItalic.woff2") format("woff2"),
- url("RedHatDisplay-BoldItalic.woff") format("woff");
+ src: local('RedHatDisplay-BoldItalic');
font-style: italic;
font-weight: 700;
font-display: fallback;
@@ -75,9 +63,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-Black.woff2") format("woff2"),
- url("RedHatDisplay-Black.woff") format("woff");
+ src: local('RedHatDisplay-Black');
font-style: normal;
font-weight: 900;
font-display: fallback;
@@ -85,9 +71,7 @@
@font-face {
font-family: "Red Hat Display";
- src: local('RedHatDisplayWeb'),
- url("RedHatDisplay-BlackItalic.woff2") format("woff2"),
- url("RedHatDisplay-BlackItalic.woff") format("woff");
+ src: local('RedHatDisplay-BlackItalic');
font-style: italic;
font-weight: 900;
font-display: fallback;
@@ -95,9 +79,7 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-Regular.woff2") format("woff2"),
- url("RedHatText-Regular.woff") format("woff");
+ src: local('RedHatText-Regular');
font-style: normal;
font-weight: 400;
font-display: fallback;
@@ -105,9 +87,7 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-Italic.woff2") format("woff2"),
- url("RedHatText-Italic.woff") format("woff");
+ src: local('RedHatText-Italic');
font-style: italic;
font-weight: 400;
font-display: fallback;
@@ -115,9 +95,7 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-Medium.woff2") format("woff2"),
- url("RedHatText-Medium.woff") format("woff");
+ src: local('RedHatText-Medium');
font-style: normal;
font-weight: 700;
font-display: fallback;
@@ -125,9 +103,7 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-MediumItalic.woff2") format("woff2"),
- url("RedHatText-MediumItalic.woff") format("woff");
+ src: local('RedHatText-MediumItalic');
font-style: italic;
font-weight: 700;
font-display: fallback;
@@ -135,9 +111,7 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-Bold.woff2") format("woff2"),
- url("RedHatText-Bold.woff") format("woff");
+ src: local('RedHatText-Bold');
font-style: normal;
font-weight: 900;
font-display: fallback;
@@ -145,22 +119,17 @@
@font-face {
font-family: "Red Hat Text";
- src: local('RedHatTextWeb'),
- url("RedHatText-BoldItalic.woff2") format("woff2"),
- url("RedHatText-BoldItalic.woff") format("woff");
+ src: local('RedHatText-BoldItalic');
font-style: italic;
font-weight: 900;
font-display: fallback;
}
-/* Do not fall back to locally installed SourceCodePro, as there are
- * known bad copies being distributed to this day
- */
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 400;
- src: url("SourceCodePro-Regular.ttf.woff") format('woff');
+ src: local('SourceCodePro-Regular');
font-display: swap;
}
@@ -168,7 +137,7 @@
font-family: 'Source Code Pro';
font-style: italic;
font-weight: 400;
- src: url("SourceCodePro-It.ttf.woff") format('woff');
+ src: local('SourceCodePro-It');
font-display: swap;
}
@@ -176,6 +145,6 @@
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 600;
- src: url("SourceCodePro-Semibold.ttf.woff") format('woff');
+ src: local('SourceCodePro-Semibold');
font-display: swap;
}
diff -Naur gi-docgen-2022.2-original/setup.cfg gi-docgen-2022.2/setup.cfg
--- gi-docgen-2022.2-original/setup.cfg 2022-11-07 09:50:06.000000000 -0500
+++ gi-docgen-2022.2/setup.cfg 2022-11-11 08:24:25.200224213 -0500
@@ -74,8 +74,6 @@
templates/basic/*.html
templates/basic/*.js
templates/basic/*.png
- templates/basic/*.woff2
- templates/basic/*.woff
py.typed
[bdist_wheel]

View File

@ -0,0 +1,346 @@
## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 2;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond_with doc_pdf
Name: gi-docgen
Version: 2023.3
Release: %autorelease
Summary: Documentation tool for GObject-based libraries
# Based on the “Copyright and Licensing terms” in README.md, on the contents of
# .reuse/dep5, and on inspection of SPDX headers or other file contents with
# assistance from licensecheck.
#
# The entire source is (Apache-2.0 OR GPL-3.0-or-later) except the following files that are
# packaged or are used to generate packaged files:
#
# (Apache-2.0 OR GPL-3.0-or-later) AND BSD-2-Clause:
# - gidocgen/mdext.py
#
# MIT:
# - gidocgen/templates/basic/fzy.js
# - gidocgen/templates/basic/solarized-{dark,light}.js
#
# CC0-1.0:
# - gi-docgen.pc.in (from which gi-docgen.pc is generated)
# - gidocgen/templates/basic/*.png
# - docs/CODEOWNERS (-doc subpackage)
# - examples/*.toml (-doc subpackage)
#
# Note that CC0-1.0 is allowed in Fedora for content only; all of the above
# files may reasonably be called content.
#
# Additionally, CC0-1.0 appears in certain sample configuration snippets within
# the following files, which are otherwise (Apache-2.0 OR GPL-3.0-or-later):
# - docs/project-configuration.rst
# - docs/tutorial.rst
# On one hand, these are copied from real projects; on the other hand, they are
# very trivial. Its not obvious whether they should be considered “real”
# CC0-1.0 content or not.
#
# The identifier LGPL-2.1-or-later also appears in a sample configuration
# template in docs/tutorial.rst, but the configuration in question is filled
# with placeholder values and is not copied from a real project, so its
# reasonable to consider LGPL-2.1-or-later a placeholder rather than a real
# license as well.
#
# -----
#
# Additionally, the following sources are under licenses other than (Apache-2.0
# OR GPL-3.0-or-later), but are not packaged in any of the binary RPMs:
#
# CC0-1.0:
# - .editorconfig (not installed)
# - .gitlab-ci.yml (not installed)
# - gi-docgen.doap (not installed)
# - MANIFEST.in (not installed)
# - pytest.ini (not installed; test only)
# - tests/data/config/*.toml (not installed; test only)
#
# CC-BY-SA-3.0:
# - docs/gi-docgen.{png,svg} (for HTML docs; not currently packaged)
# - code-of-conduct.md (not installed)
#
# OFL-1.1:
# - gidocgen/templates/basic/*.{woff,woff2} (removed in prep)
#
# GPL-2.0-or-later:
# - tests/data/gir/{Utility-1.0,Regress-1.0}.gir (not installed; test only)
#
# LGPL-2.0-or-later:
# - tests/data/gir/{GLib,GObject,Gio}-2.0.gir (not installed; test only)
#
# LGPL-2.0-or-later OR MPL-1.1:
# - tests/data/gir/cairo-1.0.gir (not installed; test only)
License: %{shrink:
(Apache-2.0 OR GPL-3.0-or-later) AND
BSD-2-Clause AND
MIT AND
CC0-1.0
}
URL: https://gitlab.gnome.org/GNOME/gi-docgen
Source: %{url}/-/archive/%{version}/gi-docgen-%{version}.tar.bz2
# We are prohibited from bundling fonts, and we are prohibited from shipping
# fonts in web font formats; see
# https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy/#_web_fonts.
#
# Since upstream uses *only* web fonts, we need a patch. We havent offered it
# upstream since upstream has no reason NOT to use web fonts.
#
# This patch removes all references to WOFF/WOFF2 font files (which we still
# must remove in %%prep) and ensures the CSS correctly references corresponding
# local system fonts.
Patch0: gi-docgen-2022.2-no-web-fonts.patch
# https://gitlab.gnome.org/GNOME/gi-docgen/-/issues/179
Patch1: fix-broken-since-obsoletes.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3dist(pytest)
# Documentation
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
%endif
# Unbundling fonts:
BuildRequires: font(redhatdisplay)
BuildRequires: font(redhatdisplayblack)
BuildRequires: font(redhatdisplaymedium)
BuildRequires: font(redhattext)
BuildRequires: font(redhattextmedium)
BuildRequires: font(sourcecodepro)
BuildRequires: font(sourcecodeprosemibold)
# Unbundling fonts:
Requires: gi-docgen-fonts = %{version}-%{release}
# Trivial fork of https://github.com/jhawthorn/fzy.js (looks like it was
# basically just wrapped in an IIFE). Given that modification, its not clear
# how we could unbundle it, either downstream or with some kind of upstream
# support.
#
# Its not clear what version was used for the fork.
Provides: bundled(js-fzy)
%description
GI-DocGen is a document generator for GObject-based libraries. GObject is the
base type system of the GNOME project. GI-Docgen reuses the introspection data
generated by GObject-based libraries to generate the API reference of these
libraries, as well as other ancillary documentation.
GI-DocGen is not a general purpose documentation tool for C libraries.
While GI-DocGen can be used to generate API references for most GObject/C
libraries that expose introspection data, its main goal is to generate the
reference for GTK and its immediate dependencies. Any and all attempts at
making this tool more generic, or to cover more use cases, will be weighted
heavily against its primary goal.
GI-DocGen is still in development. The recommended use of GI-DocGen is to add
it as a sub-project to your Meson build system, and vendor it when releasing
dist archives.
You should not depend on a system-wide installation until GI-DocGen is declared
stable.
%package fonts
Summary: Metapackage providing fonts for gi-docgen output
# Really, there is nothing copyrightable in this metapackage, so we give it the
# overall license of the project.
License: Apache-2.0 OR GPL-3.0-or-later
Requires: font(redhatdisplay)
Requires: font(redhatdisplayblack)
Requires: font(redhatdisplaymedium)
Requires: font(redhattext)
Requires: font(redhattextmedium)
Requires: font(sourcecodepro)
Requires: font(sourcecodeprosemibold)
%description fonts
Because web fonts from upstream are not bundled in the gi-docgen package,
documentation packages generated with gi-docgen must depend on this metapackage
to ensure the proper system fonts are present.
%package doc
Summary: Documentation for gi-docgen
License: (Apache-2.0 OR GPL-3.0-or-later) AND CC0-1.0
%description doc
Documentation for gi-docgen.
%generate_buildrequires
%pyproject_buildrequires
%prep
%autosetup -p1
# Remove all bundled fonts. See gi-docgen-*-no-web-fonts.patch.
find . -type f \( -name '*.woff' -o -name '*.woff2' \) -print -delete
%build
%pyproject_wheel
%if %{with doc_pdf}
sphinx-build -b latex -j%{?_smp_build_ncpus} docs %{_vpath_builddir}/_latex
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'
%endif
%install
%pyproject_install
%pyproject_save_files gidocgen
install -t '%{buildroot}%{_pkgdocdir}' -D -m 0644 -p \
CHANGES.md \
CONTRIBUTING.md \
docs/CODEOWNERS \
README.md
%if %{with doc_pdf}
install -t '%{buildroot}%{_pkgdocdir}' -p -m 0644 \
'%{_vpath_builddir}/_latex/gi-docgen.pdf'
%endif
cp -rp examples '%{buildroot}%{_pkgdocdir}/'
%check
%pytest
%files -f %{pyproject_files}
%license LICENSES/ .reuse/dep5
%{_bindir}/gi-docgen
%{_mandir}/man1/gi-docgen.1*
# Normally, this would go in a -devel package, but there is little point in
# providing a -devel package for *just* the .pc file when there are no
# libraries or headers.
%{_datadir}/pkgconfig/gi-docgen.pc
%files fonts
# Empty; this is a metapackage
%files doc
%license LICENSES/ .reuse/dep5
%doc %{_pkgdocdir}/
%changelog
* Mon Dec 18 2023 Michael Catanzaro <mcatanzaro@redhat.com> - 2023.3-2
- Add patch to fix broken Since/Obsoletes
* Sun Nov 26 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2023.3-1
- Update to 2023.3 (close RHBZ#2251397)
* Sun Nov 26 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2023.1-6
- Package LICENSES/ as a directory
* Sun Nov 26 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2023.1-2
- Dont assume %%_smp_mflags is -j%%_smp_build_ncpus
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2023.1-1
- Update to 2023.1 (close RHBZ#2158850)
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.2-4
- Revert "Temporarily add explicit BR on pyproject-rpm-macros"
* Sat Jan 07 2023 Miro Hrončok <miro@hroncok.cz> - 2022.2-3
- Use tomllib (tomli) instated of deprecated python3-toml
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.2-2
- Update License to SPDX
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.2-1
- Update to 2022.2 (close RHBZ#2140725)
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-11
- Drop explicit -r for pyproject_buildrequires; no longer needed
* Sat Jan 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-10
- Drop code-of-conduct.md from the -doc subpackage
* Wed Nov 16 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-9
- Initial package for EPEL9 (close RHBZ#2072649)
* Thu Nov 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-8
- Temporarily add explicit BR on pyproject-rpm-macros
* Tue Aug 23 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-7
- Parallelize sphinx-build
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2022.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 2022.1-5
- Rebuilt for Python 3.11
* Wed Apr 20 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-4
- Drop “forge” macros, which are not doing much here
* Sat Apr 16 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-3
- Update spec file comment
* Sat Apr 16 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-2
- Stop numbering patches
* Wed Feb 16 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2022.1-1
- Update to 2022.1 (close RHBZ#2053858)
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2021.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Nov 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.8-2
- Reduce LaTeX PDF build verbosity
* Thu Oct 21 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.8-1
- Update to 2021.8 (close RHBZ#2016447)
* Thu Oct 21 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.7-5
- Reduce macro indirection in the spec file
* Wed Sep 29 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.7-4
- Improve comments about test availability
* Mon Sep 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.7-3
- Build PDF docs instead of HTML
* Sun Sep 12 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.7-2
- Drop BR on pyproject-rpm-macros, now implied by python3-devel
* Mon Aug 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.7-1
- Update to 2021.7
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2021.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2021.6-1
- Initial package

View File

@ -0,0 +1,23 @@
From 50aa08176e44178eeffcb7a66f37d7cad074f51b Mon Sep 17 00:00:00 2001
From: zhubo <zhubo.z@bytedance.com>
Date: Fri, 29 Dec 2023 23:16:57 +0800
Subject: [PATCH] Add kvazaar to REQUIRES_PRIVATE
---
CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d996845e39..3a3f51d86f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,6 +234,9 @@ endif()
if (X265_FOUND AND NOT (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_X265_PLUGIN))
list(APPEND REQUIRES_PRIVATE "x265")
endif()
+if (KVAZAAR_FOUND AND NOT (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_KVAZAAR_PLUGIN))
+ list(APPEND REQUIRES_PRIVATE "kvazaar")
+endif()
if ((AOM_DECODER_FOUND AND NOT (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_AOM_DECODER_PLUGIN))
OR (AOM_ENCODER_FOUND AND NOT (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_AOM_ENCODER_PLUGIN)))
list(APPEND REQUIRES_PRIVATE "aom")

View File

@ -0,0 +1,42 @@
From 877de6b398198bca387df791b9232922c5721c80 Mon Sep 17 00:00:00 2001
From: zhailiangliang <zhailiangliang@loongson.cn>
Date: Thu, 21 Dec 2023 15:45:29 +0800
Subject: [PATCH] fix memory leaks in function JpegEncoder::Encode
---
examples/encoder_jpeg.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/examples/encoder_jpeg.cc b/examples/encoder_jpeg.cc
index 6a8bae163a..b82f8aa39b 100644
--- a/examples/encoder_jpeg.cc
+++ b/examples/encoder_jpeg.cc
@@ -179,6 +179,9 @@ bool JpegEncoder::Encode(const struct heif_image_handle* handle,
uint32_t skip = (exifdata[0]<<24) | (exifdata[1]<<16) | (exifdata[2]<<8) | exifdata[3];
if (skip > (exifsize - 4)) {
fprintf(stderr, "Invalid EXIF data (offset too large)\n");
+ free(exifdata);
+ jpeg_destroy_compress(&cinfo);
+ fclose(fp);
return false;
}
skip += 4;
@@ -188,6 +191,9 @@ bool JpegEncoder::Encode(const struct heif_image_handle* handle,
if (size > std::numeric_limits<uint32_t>::max()) {
fprintf(stderr, "EXIF larger than 4GB is not supported");
+ free(exifdata);
+ jpeg_destroy_compress(&cinfo);
+ fclose(fp);
return false;
}
@@ -258,6 +264,8 @@ bool JpegEncoder::Encode(const struct heif_image_handle* handle,
if (heif_image_get_bits_per_pixel(image, heif_channel_Y) != 8) {
fprintf(stderr, "JPEG writer cannot handle image with >8 bpp.\n");
+ jpeg_destroy_compress(&cinfo);
+ fclose(fp);
return false;
}

View File

@ -0,0 +1,21 @@
From 90955e3118d687fa8c36747a7b349caebc82707d Mon Sep 17 00:00:00 2001
From: zhailiangliang <zhailiangliang@loongson.cn>
Date: Thu, 11 Jan 2024 17:48:52 +0800
Subject: [PATCH] Fix potential memory leak in file heif_convert.cc
---
examples/heif_convert.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/examples/heif_convert.cc b/examples/heif_convert.cc
index 0e3cb4d2de..e57573235c 100644
--- a/examples/heif_convert.cc
+++ b/examples/heif_convert.cc
@@ -609,6 +609,7 @@ int main(int argc, char** argv)
const char* auxTypeC = nullptr;
err = heif_image_handle_get_auxiliary_type(aux_handle, &auxTypeC);
if (err.code) {
+ heif_image_release(aux_image);
heif_image_handle_release(aux_handle);
heif_image_handle_release(handle);
std::cerr << "Could not get type of auxiliary image: " << err.message << "\n";

View File

@ -0,0 +1,141 @@
From 9598ddeb3dff4e51a9989067e912baf502410cee Mon Sep 17 00:00:00 2001
From: Heiko Lewin <hlewin@worldiety.de>
Date: Sun, 10 Mar 2024 13:32:18 +0100
Subject: [PATCH] encoder_kvazaar.cc: Fix some memory leaks
---
libheif/plugins/encoder_kvazaar.cc | 50 +++++++++++++-----------------
1 file changed, 22 insertions(+), 28 deletions(-)
diff --git a/libheif/plugins/encoder_kvazaar.cc b/libheif/plugins/encoder_kvazaar.cc
index eada77f9fe..158f174b04 100644
--- a/libheif/plugins/encoder_kvazaar.cc
+++ b/libheif/plugins/encoder_kvazaar.cc
@@ -361,6 +361,11 @@ static void copy_plane(kvz_pixel* out_p,
}
+template<typename T, typename D>
+std::unique_ptr<T, D> make_guard(T* ptr, D&& deleter) {
+ return std::unique_ptr<T, D>(ptr, deleter);
+}
+
static struct heif_error kvazaar_encode_image(void* encoder_raw, const struct heif_image* image,
heif_image_input_class input_class)
{
@@ -380,7 +385,8 @@ static struct heif_error kvazaar_encode_
return err;
}
- kvz_config* config = api->config_alloc();
+ auto uconfig = make_guard(api->config_alloc(), [api](kvz_config* cfg) { api->config_destroy(cfg); });
+ kvz_config* config = uconfig.get();
api->config_init(config); // param, encoder->preset.c_str(), encoder->tune.c_str());
#if HAVE_KVAZAAR_ENABLE_LOGGING
config->enable_logging_output = 0;
@@ -541,9 +547,9 @@ static struct heif_error kvazaar_encode_
}
*/
- kvz_picture* pic = api->picture_alloc_csp(kvzChroma, encoded_width, encoded_height);
+ auto upic = make_guard(api->picture_alloc_csp(kvzChroma, encoded_width, encoded_height), [api](kvz_picture* pic) { api->picture_free(pic); });
+ kvz_picture* pic = upic.get();
if (!pic) {
- api->config_destroy(config);
return heif_error{
heif_error_Encoder_plugin_error,
heif_suberror_Encoder_encoding,
@@ -573,11 +579,9 @@ static struct heif_error kvazaar_encode_
encoded_width >> chroma_stride_shift, encoded_height >> chroma_height_shift);
}
- kvz_encoder* kvzencoder = api->encoder_open(config);
+ auto uencoder = make_guard(api->encoder_open(config), [api](kvz_encoder* e) { api->encoder_close(e); });
+ kvz_encoder* kvzencoder = uencoder.get();
if (!kvzencoder) {
- api->picture_free(pic);
- api->config_destroy(config);
-
return heif_error{
heif_error_Encoder_plugin_error,
heif_suberror_Encoder_encoding,
@@ -586,14 +590,18 @@ static struct heif_error kvazaar_encode_
}
kvz_data_chunk* data = nullptr;
+ auto free_data = [api](kvz_data_chunk** data){
+ if(*data) {
+ api->chunk_free(*data);
+ *data = nullptr;
+ }
+ };
+ auto data_deleter = std::unique_ptr<kvz_data_chunk*, decltype(free_data)>(&data, free_data);
+
uint32_t data_len;
int success;
success = api->encoder_headers(kvzencoder, &data, &data_len);
if (!success) {
- api->picture_free(pic);
- api->config_destroy(config);
- api->encoder_close(kvzencoder);
-
return heif_error{
heif_error_Encoder_plugin_error,
heif_suberror_Encoder_encoding,
@@ -602,17 +610,13 @@ static struct heif_error kvazaar_encode_
}
append_chunk_data(data, encoder->output_data);
+ free_data(&data);
success = api->encoder_encode(kvzencoder,
pic,
&data, &data_len,
nullptr, nullptr, nullptr);
if (!success) {
- api->chunk_free(data);
- api->picture_free(pic);
- api->config_destroy(config);
- api->encoder_close(kvzencoder);
-
return heif_error{
heif_error_Encoder_plugin_error,
heif_suberror_Encoder_encoding,
@@ -621,6 +625,7 @@ static struct heif_error kvazaar_encode_
}
append_chunk_data(data, encoder->output_data);
+ free_data(&data);
for (;;) {
success = api->encoder_encode(kvzencoder,
@@ -628,11 +633,6 @@ static struct heif_error kvazaar_encode_
&data, &data_len,
nullptr, nullptr, nullptr);
if (!success) {
- api->chunk_free(data);
- api->picture_free(pic);
- api->config_destroy(config);
- api->encoder_close(kvzencoder);
-
return heif_error{
heif_error_Encoder_plugin_error,
heif_suberror_Encoder_encoding,
@@ -645,16 +645,10 @@ static struct heif_error kvazaar_encode_
}
append_chunk_data(data, encoder->output_data);
+ free_data(&data);
}
(void) success;
-
- api->chunk_free(data);
-
- api->encoder_close(kvzencoder);
- api->picture_free(pic);
- api->config_destroy(config);
-
return heif_error_ok;
}

View File

@ -0,0 +1,22 @@
From a911b26a902c5f89fee2dc20ac4dfaafcb8144ec Mon Sep 17 00:00:00 2001
From: Andrey Semashev <Lastique@users.noreply.github.com>
Date: Fri, 15 Mar 2024 17:46:48 +0300
Subject: [PATCH] Fix compilation with libsvtav1 2.0.0.
---
libheif/plugins/encoder_svt.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libheif/plugins/encoder_svt.cc b/libheif/plugins/encoder_svt.cc
index 4597d7b8fc..1ff3bce2d5 100644
--- a/libheif/plugins/encoder_svt.cc
+++ b/libheif/plugins/encoder_svt.cc
@@ -646,7 +646,7 @@ struct heif_error svt_encode_image(void* encoder_raw, const struct heif_image* i
if (nclx) {
svt_config.color_description_present_flag = true;
-#if SVT_AV1_VERSION_MAJOR == 1
+#if SVT_AV1_VERSION_MAJOR >= 1
svt_config.color_primaries = static_cast<EbColorPrimaries>(nclx->color_primaries);
svt_config.transfer_characteristics = static_cast<EbTransferCharacteristics>(nclx->transfer_characteristics);
svt_config.matrix_coefficients = static_cast<EbMatrixCoefficients>(nclx->matrix_coefficients);

View File

@ -0,0 +1,36 @@
From bef5f0f49f9024957189b5b465cd4d07078cd06f Mon Sep 17 00:00:00 2001
From: Brad Hards <bradh@frogmouth.net>
Date: Sat, 6 Jan 2024 13:59:21 +1100
Subject: [PATCH] kvazaar: protect against unexpected chroma values
Resolves #1089
---
libheif/plugins/encoder_kvazaar.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libheif/plugins/encoder_kvazaar.cc b/libheif/plugins/encoder_kvazaar.cc
index 408f1bf84d..eada77f9fe 100644
--- a/libheif/plugins/encoder_kvazaar.cc
+++ b/libheif/plugins/encoder_kvazaar.cc
@@ -35,6 +35,7 @@ extern "C" {
static const char* kError_unspecified_error = "Unspecified encoder error";
static const char* kError_unsupported_bit_depth = "Bit depth not supported by kvazaar";
+static const char* kError_unsupported_chroma = "Unsupported chroma type";
//static const char* kError_unsupported_image_size = "Images smaller than 16 pixels are not supported";
@@ -492,6 +493,13 @@ static struct heif_error kvazaar_encode_image(void* encoder_raw, const struct he
input_chroma_width = input_width;
input_chroma_height = input_height;
}
+ else {
+ return heif_error{
+ heif_error_Encoder_plugin_error,
+ heif_suberror_Unsupported_image_type,
+ kError_unsupported_chroma
+ };
+ }
if (chroma != heif_chroma_monochrome) {
int w = heif_image_get_width(image, heif_channel_Y);

View File

@ -0,0 +1,22 @@
From dfd88deb1d80b4195ef16cddad256f33b46fbe29 Mon Sep 17 00:00:00 2001
From: Brad Hards <bradh@frogmouth.net>
Date: Wed, 17 Jan 2024 11:47:15 +1100
Subject: [PATCH] examples: fix leak in PNG decoder
This shows up with heif-enc (e.g. with --avif) under valgrind
---
examples/decoder_png.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/examples/decoder_png.cc b/examples/decoder_png.cc
index 5742f02653..c3eeed88a8 100644
--- a/examples/decoder_png.cc
+++ b/examples/decoder_png.cc
@@ -419,6 +419,7 @@ InputImage loadPNG(const char* filename, int output_bit_depth)
} // for
delete[] row_pointers;
+ fclose(fh);
input_image.image = std::shared_ptr<heif_image>(image,
[](heif_image* img) { heif_image_release(img); });

View File

@ -0,0 +1,17 @@
diff -up libheif-1.16.2/tests/encode.cc.no-hevc libheif-1.16.2/tests/encode.cc
--- libheif-1.16.2/tests/encode.cc.no-hevc 2023-05-22 21:00:47.000000000 +0200
+++ libheif-1.16.2/tests/encode.cc 2023-09-08 14:22:08.408234336 +0200
@@ -148,11 +148,13 @@ static void test_ispe_size(heif_compress
TEST_CASE( "ispe odd size", "[heif_context]" ) {
+#if 0
// HEVC encoders typically encode with even dimensions only
test_ispe_size(heif_compression_HEVC, heif_orientation_normal, 121,99, 122,100);
test_ispe_size(heif_compression_HEVC, heif_orientation_rotate_180, 121,99, 122,100);
test_ispe_size(heif_compression_HEVC, heif_orientation_rotate_90_cw, 121,99, 122,100);
test_ispe_size(heif_compression_HEVC, heif_orientation_rotate_90_cw, 120,100, 120,100);
+#endif
// AVIF encoders typically encode with odd dimensions
test_ispe_size(heif_compression_AV1, heif_orientation_normal, 121,99, 121,99);

338
base/libheif/libheif.spec Normal file
View File

@ -0,0 +1,338 @@
%global somajor 1
# Unable to ship this in Fedora
%bcond_with hevc
%bcond_with check
Name: libheif
Version: 1.17.6
Release: 1%{?dist}
Summary: HEIF and AVIF file format decoder and encoder
License: LGPL-3.0-or-later and MIT
URL: https://github.com/strukturag/libheif
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: libheif-no-hevc-tests.patch
# Fix for CVE-2024-25269 (https://github.com/strukturag/libheif/issues/1073)
Patch1: https://github.com/strukturag/libheif/commit/877de6b398198bca387df791b9232922c5721c80.patch
# Fix compilation with libsvtav1 2.0.0.
Patch2: https://github.com/strukturag/libheif/commit/a911b26a902c5f89fee2dc20ac4dfaafcb8144ec.patch
# Backport memory leaks fix from master
Patch3: https://github.com/strukturag/libheif/commit/9598ddeb3dff4e51a9989067e912baf502410cee.patch
Patch4: https://github.com/strukturag/libheif/commit/dfd88deb1d80b4195ef16cddad256f33b46fbe29.patch
Patch5: https://github.com/strukturag/libheif/commit/90955e3118d687fa8c36747a7b349caebc82707d.patch
Patch6: https://github.com/strukturag/libheif/commit/bef5f0f49f9024957189b5b465cd4d07078cd06f.patch
Patch7: https://github.com/strukturag/libheif/commit/50aa08176e44178eeffcb7a66f37d7cad074f51b.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: ninja-build
BuildRequires: pkgconfig(aom)
BuildRequires: pkgconfig(dav1d)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libopenjp2)
BuildRequires: pkgconfig(libpng)
%if ! (0%{?rhel} && 0%{?rhel} <= 9)
BuildRequires: pkgconfig(libsharpyuv)
BuildRequires: pkgconfig(rav1e)
BuildRequires: pkgconfig(SvtAv1Enc)
%endif
%description
libheif is an ISO/IEC 23008-12:2017 HEIF and AVIF (AV1 Image File Format)
file format decoder and encoder.
%files
%license COPYING
%doc README.md
%{_libdir}/*.so.%{somajor}{,.*}
%dir %{_libdir}/%{name}
%if ! (0%{?rhel} && 0%{?rhel} <= 9)
%{_libdir}/%{name}/%{name}-rav1e.so
%{_libdir}/%{name}/%{name}-svtenc.so
%endif
# ----------------------------------------------------------------------
%package -n heif-pixbuf-loader
Summary: HEIF image loader for GTK+ applications
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: gdk-pixbuf2%{?_isa}
%description -n heif-pixbuf-loader
This package provides a plugin to load HEIF files in GTK+ applications.
%files -n heif-pixbuf-loader
%{_libdir}/gdk-pixbuf-2.0/*/loaders/libpixbufloader-heif.so
# ----------------------------------------------------------------------
%package tools
Summary: Tools for manipulating HEIF files
License: MIT
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: shared-mime-info
%description tools
This package provides tools for manipulating HEIF files.
%files tools
%{_bindir}/heif-*
%{_mandir}/man1/heif-*
%{_datadir}/thumbnailers/heif.thumbnailer
# ----------------------------------------------------------------------
%if %{with hevc}
%package hevc
Summary: HEVC codec support for HEIC files
BuildRequires: pkgconfig(libde265)
BuildRequires: pkgconfig(x265)
Supplements: %{name}
%description hevc
This package adds support for HEVC-encoded HEIC files to applications
that use %{name} to read HEIF image files.
%files hevc
%{_libdir}/%{name}/%{name}-libde265.so
%{_libdir}/%{name}/%{name}-x265.so
%endif
# ----------------------------------------------------------------------
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%files devel
%{_includedir}/%{name}/
%{_libdir}/cmake/%{name}/
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/*.so
# ----------------------------------------------------------------------
%prep
%setup -q
%if %{without hevc}
%patch0 -p1
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
rm -rf third-party/
%build
%cmake \
-GNinja \
-DPLUGIN_DIRECTORY=%{_libdir}/%{name} \
-DWITH_DAV1D=ON \
-DWITH_DAV1D_PLUGIN=OFF \
-DWITH_JPEG_DECODER=ON \
-DWITH_JPEG_ENCODER=ON \
-DWITH_OpenJPEG_DECODER=ON \
-DWITH_OpenJPEG_DECODER_PLUGIN=OFF \
-DWITH_OpenJPEG_ENCODER=ON \
-DWITH_OpenJPEG_ENCODER_PLUGIN=OFF \
%if ! (0%{?rhel} && 0%{?rhel} <= 9)
-DWITH_RAV1E=ON \
-DWITH_SvtEnc=ON \
%endif
-DWITH_UNCOMPRESSED_CODEC=ON \
%{?with_check:-DBUILD_TESTING=ON -DWITH_REDUCED_VISIBILITY=OFF} \
%{?with_hevc:-DWITH_LIBDE265_PLUGIN:BOOL=ON -DWITH_X265_PLUGIN:BOOL=ON} \
-Wno-dev
%cmake_build
%install
%cmake_install
%if %{with check}
%check
# Tests are not yet ported to CMake
%ctest
%endif
%changelog
* Sat Apr 13 2024 Robert-André Mauchin <zebob.m@gmail.com> - 1.17.6-`1
- Update to 1.17.6
- Security fix for CVE-2024-25269
- Close: rhbz#2255512
- Fix: rhbz#2267897
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 12 2024 Fabio Valentini <decathorpe@gmail.com> - 1.17.5-2
- Rebuild for dav1d 1.3.0
* Fri Dec 15 2023 Dominik Mierzejewski <dominik@greysector.net> - 1.17.5-2
- Update to 1.17.5 (rhbz#2244583)
- Backport fixes for: CVE-2023-49460 (rhbz#2253575, rhbz#2253576)
CVE-2023-49462 (rhbz#2253567, rhbz#2253568)
CVE-2023-49463 (rhbz#2253565, rhbz#2253566)
CVE-2023-49464 (rhbz#2253562, rhbz#2253563)
- Simplify conditionals for rav1e and svt-av1 encoders
- Enable JPEG2000 and dav1d decoders/encoders
* Fri Sep 08 2023 Dominik Mierzejewski <dominik@greysector.net> - 1.16.2-2
- Enable uncompressed codec (rhbz#2237849)
- Run tests conditionally (requires making all symbols visible)
- Disable HEVC tests when building without HEVC codec
* Fri Jul 28 2023 Orion Poplawski <orion@nwra.com> - 1.16.2-1
- Update to 1.16.2
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.16.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri May 05 2023 Neal Gompa <ngompa@fedoraproject.org> - 1.16.1-1
- Update to 1.16.1
* Sun Apr 30 2023 Dominik Mierzejewski <dominik@greysector.net> - 1.15.2-2
- backport fix for issue#590
* Tue Apr 11 2023 Sandro <devel@penguinpee.nl> - 1.15.2-1
- Update to 1.15.2 (RHBZ#2183664)
- Drop patch
* Fri Mar 17 2023 Neal Gompa <ngompa@fedoraproject.org> - 1.15.1-2
- Adapt for Fedora
* Fri Feb 17 2023 Leigh Scott <leigh123linux@gmail.com> - 1.15.1-1
- Update to 1.15.1
* Sat Jan 07 2023 Leigh Scott <leigh123linux@gmail.com> - 1.14.2-1
- Update to 1.14.2
- Switch back to autotools to build due to cmake issues (rfbz#6550}
* Thu Jan 05 2023 Leigh Scott <leigh123linux@gmail.com> - 1.14.1-1
- Update to 1.14.1
* Mon Dec 19 2022 Leigh Scott <leigh123linux@gmail.com> - 1.14.0-4
- Don't build rav1e and SVT-AV1 as plugins (rfbz#6532)
* Mon Dec 05 2022 Nicolas Chauvet <kwizart@gmail.com> - 1.14.0-3
- Fix for SvtAv1Enc in devel - rfbz#6521
* Wed Nov 23 2022 Nicolas Chauvet <kwizart@gmail.com> - 1.14.0-2
- Enable svt-av1 on el9
* Tue Nov 15 2022 Leigh Scott <leigh123linux@gmail.com> - 1.14.0-1
- Update to 1.14.0
* Fri Sep 02 2022 Leigh Scott <leigh123linux@gmail.com> - 1.13.0-1
- Update to 1.13.0
* Sun Aug 07 2022 RPM Fusion Release Engineering <sergiomb@rpmfusion.org> - 1.12.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild and ffmpeg
5.1
* Thu Jun 23 2022 Robert-André Mauchin <zebob.m@gmail.com> - 1.12.0-5
- Rebuilt for new dav1d, rav1e and jpegxl
* Wed Feb 09 2022 RPM Fusion Release Engineering <sergiomb@rpmfusion.org> - 1.12.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Nov 25 2021 Nicolas Chauvet <kwizart@gmail.com> - 1.12.0-3
- Rebuilt
* Tue Aug 03 2021 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.12.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Jun 14 2021 Leigh Scott <leigh123linux@gmail.com> - 1.12.0-1
- Update to 1.12.0
* Sun Jun 13 2021 Robert-André Mauchin <zebob.m@gmail.com> - 1.11.0-3
- Rebuild for new aom
* Wed Apr 14 2021 Leigh Scott <leigh123linux@gmail.com> - 1.11.0-2
- Rebuild for new x265
* Sat Feb 20 2021 Leigh Scott <leigh123linux@gmail.com> - 1.11.0-1
- Update to 1.11.0
* Wed Feb 03 2021 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.10.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Dec 19 2020 Leigh Scott <leigh123linux@gmail.com> - 1.10.0-1
- Update to 1.10.0
* Mon Dec 14 2020 Leigh Scott <leigh123linux@gmail.com> - 1.9.1-3
- Actually do the dav1d rebuild
* Mon Dec 14 2020 Robert-André Mauchin <zebob.m@gmail.com> - 1.9.1-2
- Rebuild for dav1d SONAME bump
* Tue Oct 27 2020 Leigh Scott <leigh123linux@gmail.com> - 1.9.1-1
- Update to 1.9.1
* Fri Aug 28 2020 Leigh Scott <leigh123linux@gmail.com> - 1.8.0-1
- Update to 1.8.0
* Tue Aug 18 2020 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.7.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 08 2020 Leigh Scott <leigh123linux@gmail.com> - 1.7.0-2
- Rebuilt
* Thu Jun 04 2020 Leigh Scott <leigh123linux@gmail.com> - 1.7.0-1
- Update to 1.7.0
* Sun May 31 2020 Leigh Scott <leigh123linux@gmail.com> - 1.6.2-3
- Rebuild for new x265 version
* Sun Feb 23 2020 RPM Fusion Release Engineering <leigh123linux@googlemail.com> - 1.6.2-2
- Rebuild for x265
* Mon Feb 10 2020 Leigh Scott <leigh123linux@gmail.com> - 1.6.2-1
- Update to 1.6.2
* Tue Feb 04 2020 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Nov 28 2019 Leigh Scott <leigh123linux@googlemail.com> - 1.6.0-1
- Update to 1.6.0
- Rebuilt for x265
* Sun Nov 03 2019 Leigh Scott <leigh123linux@googlemail.com> - 1.5.1-1
- Update to 1.5.1
* Fri Aug 09 2019 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Jul 02 2019 Nicolas Chauvet <kwizart@gmail.com> - 1.4.0-3
- Rebuilt for x265
* Mon Mar 04 2019 RPM Fusion Release Engineering <leigh123linux@gmail.com> - 1.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Feb 28 2019 Leigh Scott <leigh123linux@googlemail.com> - 1.4.0-1
- Update to 1.4.0
* Thu Jan 03 2019 Leigh Scott <leigh123linux@googlemail.com> - 1.3.2-2
- Rebuild for new x265 for el7
* Thu Nov 29 2018 Leigh Scott <leigh123linux@googlemail.com> - 1.3.2-1
- First build

View File

@ -0,0 +1,65 @@
%define oname Markdown
%global pkgname markdown
Summary: Python implementation of the markdown text-to-HTML conversion tool
Name: python-markdown
Version: 3.5.1
Release: 1%{dist}
Source: https://files.pythonhosted.org/packages/source/M/Markdown/%oname-%version.tar.gz
License: BSD
Group: Development/Python
BuildRequires: python%{python3_pkgversion}-devel
#BuildRequires: python-pkg-resources
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: python%{python3_pkgversion}-nose
BuildRequires: python%{python3_pkgversion}-yaml
BuildRequires: pyproject-rpm-macros
Url: http://www.freewisdom.org/projects/python-markdown/
%global _description %{expand:
This is a Python implementation of John Gruber's Markdown. It is almost
completely compliant with the reference implementation, though there
are a few known issues
Markdown is a text-to-HTML conversion tool for web writers. Markdown
allows you to write using an easy-to-read, easy-to-write plain text format,
then convert it to structurally valid XHTML (or HTML).}
%description
%_description
%package -n python%{python3_pkgversion}-%{pkgname}
Summary: %{summary}
BuildArch: noarch
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pkgname}}
%description -n python%{python3_pkgversion}-%{pkgname} %_description
%prep
%setup -q -n %oname-%version
# remove shebangs
find markdown -type f -name '*.py' \
-exec sed -i -e '/^#!/{1D}' {} \;
# fix line-ending
find docs -type f \
-exec sed -i 's/\r//' {} \;
sed -i '/importlib-metadata>=4.4/d' pyproject.toml
sed -i '/importlib-metadata>=4.4/d' Markdown.egg-info/requires.txt
%build
%pyproject_wheel
%install
%pyproject_install
# rename binary
mv %{buildroot}%{_bindir}/markdown_py{,-%{python3_version}}
%files -n python%{python3_pkgversion}-%{pkgname}
%{python3_sitelib}/*
%{_bindir}/markdown_py-%{python3_version}

View File

@ -11,6 +11,7 @@ BuildRequires: pyproject-rpm-macros
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-wheel BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-pytest
%global _description %{expand: %global _description %{expand:

View File

@ -0,0 +1,71 @@
## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 1;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
Name: python-pygdbmi
Version: 0.11.0.0
Release: %autorelease
Summary: Get Structured Output from GDB's Machine Interface
License: MIT
URL: https://github.com/cs01/pygdbmi
Source0: %{url}/archive/v%{version}/%{name}-v%{version}.tar.gz
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: gdb
%global _description \
GDB/MI is a line based machine oriented \
text interface to GDB and is activated by \
specifying using the --interpreter command \
line option (see Mode Options). It is\
specifically intended to support the development\
of systems which use the debugger as just one\
small component of a larger system.
%description %{_description}
%package -n python%{python3_pkgversion}-pygdbmi
Summary: %{summary}
%description -n python%{python3_pkgversion}-pygdbmi %{_description}
%prep
%autosetup -n pygdbmi-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files pygdbmi
%check
%pytest
%files -n python%{python3_pkgversion}-pygdbmi
%doc README.md
%license LICENSE
%{python3_sitelib}/pygdbmi
%{python3_sitelib}/pygdbmi-%{version}.dist-info
%changelog
* Sun Sep 24 2023 Steve Cossette <farchord@gmail.com> - 0.11.0.0-1
- Initial import (fedora#2239637).

View File

@ -0,0 +1,39 @@
%define pypi_name sentry_sdk
Name: python-sentry-sdk
Version: 1.45.0
Release: 1%{dist}
Summary: Python client for Sentry (https://sentry.io)
License: MIT
Group: Development/Python
URL: https://pypi.org/project/sentry-sdk/
Source0: https://files.pythonhosted.org/packages/source/s/sentry-sdk/sentry-sdk-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}dist(pip)
%description
Python client for Sentry (https://sentry.io).
%package -n python%{python3_pkgversion}-sentry-sdk
Summary: Python3 client for Sentry (https://sentry.io)
Group: Development/Python
%description -n python%{python3_pkgversion}-sentry-sdk
Python 3 client for Sentry (https://sentry.io).
%prep
%autosetup -p1 -n sentry-sdk-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files %{pypi_name}
%files -n python%{python3_pkgversion}-sentry-sdk -f %{pyproject_files}
%doc README.md
%license LICENSE

View File

@ -0,0 +1,32 @@
From 7b9f460346a259862189f84a30fedd96ca70e1c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Wed, 22 May 2019 18:13:32 +0200
Subject: [PATCH 1/4] 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 <zebob.m@gmail.com>
---
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 faf1234645..19d97445c4 100644
--- a/src/twisted/internet/gtk2reactor.py
+++ b/src/twisted/internet/gtk2reactor.py
@@ -42,7 +42,10 @@ try:
except (ImportError, AttributeError):
pass # maybe we're using pygtk before this hack existed.
-import gobject
+try:
+ import gobject
+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
# (wrapping glib-2.4.7) does. python-gtk=2.0.0 (wrapping
--
2.39.2

View File

@ -0,0 +1,393 @@
From f62266fdd5feeec45d2037411fa0c83964e751a7 Mon Sep 17 00:00:00 2001
From: Tom Most <twm@freecog.net>
Date: Mon, 3 Jun 2019 22:03:22 -0700
Subject: [PATCH 2/4] Fix CVE-2020-10108 and CVE-2020-10109
Refactor to reduce duplication
(cherry picked from commit d2f6dd9b3766509f40c980aac67ca8475da67c6f)
Fix several request smuggling attacks.
1. Requests with multiple Content-Length headers were allowed (thanks
to Jake Miller from Bishop Fox and ZeddYu Lu) and now fail with a 400;
2. Requests with a Content-Length header and a Transfer-Encoding
header honored the first header (thanks to Jake Miller from Bishop
Fox) and now fail with a 400;
3. Requests whose Transfer-Encoding header had a value other than
"chunked" and "identity" (thanks to ZeddYu Lu) were allowed and now fail
with a 400.
(cherry picked from commit 4a7d22e490bb8ff836892cc99a1f54b85ccb0281)
---
src/twisted/web/http.py | 64 +++++--
src/twisted/web/newsfragments/9770.bugfix | 1 +
src/twisted/web/test/test_http.py | 215 +++++++++++++++++-----
3 files changed, 223 insertions(+), 57 deletions(-)
create mode 100644 src/twisted/web/newsfragments/9770.bugfix
diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
index fe88d33739..71188a8d50 100644
--- a/src/twisted/web/http.py
+++ b/src/twisted/web/http.py
@@ -2170,6 +2170,51 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
self.allContentReceived()
self._dataBuffer.append(data)
+ def _maybeChooseTransferDecoder(self, header, data):
+ """
+ If the provided header is C{content-length} or
+ C{transfer-encoding}, choose the appropriate decoder if any.
+
+ Returns L{True} if the request can proceed and L{False} if not.
+ """
+
+ def fail():
+ self._respondToBadRequestAndDisconnect()
+ self.length = None
+
+ # Can this header determine the length?
+ if header == b'content-length':
+ try:
+ length = int(data)
+ except ValueError:
+ fail()
+ return False
+ newTransferDecoder = _IdentityTransferDecoder(
+ length, self.requests[-1].handleContentChunk, self._finishRequestBody)
+ elif header == b'transfer-encoding':
+ # XXX Rather poorly tested code block, apparently only exercised by
+ # test_chunkedEncoding
+ if data.lower() == b'chunked':
+ length = None
+ newTransferDecoder = _ChunkedTransferDecoder(
+ self.requests[-1].handleContentChunk, self._finishRequestBody)
+ elif data.lower() == b'identity':
+ return True
+ else:
+ fail()
+ return False
+ else:
+ # It's not a length related header, so exit
+ return True
+
+ if self._transferDecoder is not None:
+ fail()
+ return False
+ else:
+ self.length = length
+ self._transferDecoder = newTransferDecoder
+ return True
+
def headerReceived(self, line):
"""
@@ -2191,21 +2236,10 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
header = header.lower()
data = data.strip()
- if header == b'content-length':
- try:
- self.length = int(data)
- except ValueError:
- self._respondToBadRequestAndDisconnect()
- self.length = None
- return False
- self._transferDecoder = _IdentityTransferDecoder(
- self.length, self.requests[-1].handleContentChunk, self._finishRequestBody)
- elif header == b'transfer-encoding' and data.lower() == b'chunked':
- # XXX Rather poorly tested code block, apparently only exercised by
- # test_chunkedEncoding
- self.length = None
- self._transferDecoder = _ChunkedTransferDecoder(
- self.requests[-1].handleContentChunk, self._finishRequestBody)
+
+ if not self._maybeChooseTransferDecoder(header, data):
+ return False
+
reqHeaders = self.requests[-1].requestHeaders
values = reqHeaders.getRawHeaders(header)
if values is not None:
diff --git a/src/twisted/web/newsfragments/9770.bugfix b/src/twisted/web/newsfragments/9770.bugfix
new file mode 100644
index 0000000000..4f1be97de8
--- /dev/null
+++ b/src/twisted/web/newsfragments/9770.bugfix
@@ -0,0 +1 @@
+Fix several request smuggling attacks: requests with multiple Content-Length headers were allowed (thanks to Jake Miller from Bishop Fox and ZeddYu Lu) and now fail with a 400; requests with a Content-Length header and a Transfer-Encoding header honored the first header (thanks to Jake Miller from Bishop Fox) and now fail with a 400; requests whose Transfer-Encoding header had a value other than "chunked" and "identity" (thanks to ZeddYu Lu) were allowed and now fail a 400.
\ No newline at end of file
diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
index 6001d1e40d..8f2c1bac21 100644
--- a/src/twisted/web/test/test_http.py
+++ b/src/twisted/web/test/test_http.py
@@ -1441,7 +1441,8 @@ class ParsingTests(unittest.TestCase):
"""
Execute a web request based on plain text content.
- @param httpRequest: Content for the request which is processed.
+ @param httpRequest: Content for the request which is processed. Each
+ L{"\n"} will be replaced with L{"\r\n"}.
@type httpRequest: C{bytes}
@param requestFactory: 2-argument callable returning a Request.
@@ -1480,6 +1481,32 @@ class ParsingTests(unittest.TestCase):
return channel
+ def assertRequestRejected(self, requestLines):
+ """
+ Execute a HTTP request and assert that it is rejected with a 400 Bad
+ Response and disconnection.
+
+ @param requestLines: Plain text lines of the request. These lines will
+ be joined with newlines to form the HTTP request that is processed.
+ @type requestLines: C{list} of C{bytes}
+ """
+ httpRequest = b"\n".join(requestLines)
+ processed = []
+
+ class MyRequest(http.Request):
+ def process(self):
+ processed.append(self)
+ self.finish()
+
+ channel = self.runRequest(httpRequest, MyRequest, success=False)
+ self.assertEqual(
+ channel.transport.value(),
+ b"HTTP/1.1 400 Bad Request\r\n\r\n",
+ )
+ self.assertTrue(channel.transport.disconnecting)
+ self.assertEqual(processed, [])
+
+
def test_invalidNonAsciiMethod(self):
"""
When client sends invalid HTTP method containing
@@ -1603,45 +1630,24 @@ class ParsingTests(unittest.TestCase):
def test_tooManyHeaders(self):
"""
- L{HTTPChannel} enforces a limit of C{HTTPChannel.maxHeaders} on the
+ C{HTTPChannel} enforces a limit of C{HTTPChannel.maxHeaders} on the
number of headers received per request.
"""
- processed = []
- class MyRequest(http.Request):
- def process(self):
- processed.append(self)
-
requestLines = [b"GET / HTTP/1.0"]
for i in range(http.HTTPChannel.maxHeaders + 2):
requestLines.append(networkString("%s: foo" % (i,)))
requestLines.extend([b"", b""])
- channel = self.runRequest(b"\n".join(requestLines), MyRequest, 0)
- self.assertEqual(processed, [])
- self.assertEqual(
- channel.transport.value(),
- b"HTTP/1.1 400 Bad Request\r\n\r\n")
+ self.assertRequestRejected(requestLines)
def test_invalidContentLengthHeader(self):
"""
- If a Content-Length header with a non-integer value is received, a 400
- (Bad Request) response is sent to the client and the connection is
- closed.
+ If a I{Content-Length} header with a non-integer value is received,
+ a 400 (Bad Request) response is sent to the client and the connection
+ is closed.
"""
- processed = []
- class MyRequest(http.Request):
- def process(self):
- processed.append(self)
- self.finish()
-
- requestLines = [b"GET / HTTP/1.0", b"Content-Length: x", b"", b""]
- channel = self.runRequest(b"\n".join(requestLines), MyRequest, 0)
- self.assertEqual(
- channel.transport.value(),
- b"HTTP/1.1 400 Bad Request\r\n\r\n")
- self.assertTrue(channel.transport.disconnecting)
- self.assertEqual(processed, [])
+ self.assertRequestRejected([b"GET / HTTP/1.0", b"Content-Length: x", b"", b""])
def test_invalidHeaderNoColon(self):
@@ -1649,24 +1655,12 @@ class ParsingTests(unittest.TestCase):
If a header without colon is received a 400 (Bad Request) response
is sent to the client and the connection is closed.
"""
- processed = []
- class MyRequest(http.Request):
- def process(self):
- processed.append(self)
- self.finish()
-
- requestLines = [b"GET / HTTP/1.0", b"HeaderName ", b"", b""]
- channel = self.runRequest(b"\n".join(requestLines), MyRequest, 0)
- self.assertEqual(
- channel.transport.value(),
- b"HTTP/1.1 400 Bad Request\r\n\r\n")
- self.assertTrue(channel.transport.disconnecting)
- self.assertEqual(processed, [])
+ self.assertRequestRejected([b"GET / HTTP/1.0", b"HeaderName ", b"", b""])
def test_headerLimitPerRequest(self):
"""
- L{HTTPChannel} enforces the limit of C{HTTPChannel.maxHeaders} per
+ C{HTTPChannel} enforces the limit of C{HTTPChannel.maxHeaders} per
request so that headers received in an earlier request do not count
towards the limit when processing a later request.
"""
@@ -2152,6 +2146,143 @@ Hello,
self.flushLoggedErrors(AttributeError)
+ def assertDisconnectingBadRequest(self, request):
+ """
+ Assert that the given request bytes fail with a 400 bad
+ request without calling L{Request.process}.
+
+ @param request: A raw HTTP request
+ @type request: L{bytes}
+ """
+ class FailedRequest(http.Request):
+ processed = False
+ def process(self):
+ FailedRequest.processed = True
+
+ channel = self.runRequest(request, FailedRequest, success=False)
+ self.assertFalse(FailedRequest.processed, "Request.process called")
+ self.assertEqual(
+ channel.transport.value(),
+ b"HTTP/1.1 400 Bad Request\r\n\r\n")
+ self.assertTrue(channel.transport.disconnecting)
+
+
+ def test_duplicateContentLengths(self):
+ """
+ A request which includes multiple C{content-length} headers
+ fails with a 400 response without calling L{Request.process}.
+ """
+ self.assertRequestRejected([
+ b'GET /a HTTP/1.1',
+ b'Content-Length: 56',
+ b'Content-Length: 0',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ ])
+
+
+ def test_duplicateContentLengthsWithPipelinedRequests(self):
+ """
+ Two pipelined requests, the first of which includes multiple
+ C{content-length} headers, trigger a 400 response without
+ calling L{Request.process}.
+ """
+ self.assertRequestRejected([
+ b'GET /a HTTP/1.1',
+ b'Content-Length: 56',
+ b'Content-Length: 0',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ b'GET /a HTTP/1.1',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ ])
+
+
+ def test_contentLengthAndTransferEncoding(self):
+ """
+ A request that includes both C{content-length} and
+ C{transfer-encoding} headers fails with a 400 response without
+ calling L{Request.process}.
+ """
+ self.assertRequestRejected([
+ b'GET /a HTTP/1.1',
+ b'Transfer-Encoding: chunked',
+ b'Content-Length: 0',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ ])
+
+
+ def test_contentLengthAndTransferEncodingWithPipelinedRequests(self):
+ """
+ Two pipelined requests, the first of which includes both
+ C{content-length} and C{transfer-encoding} headers, triggers a
+ 400 response without calling L{Request.process}.
+ """
+ self.assertRequestRejected([
+ b'GET /a HTTP/1.1',
+ b'Transfer-Encoding: chunked',
+ b'Content-Length: 0',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ b'GET /a HTTP/1.1',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ ])
+
+
+ def test_unknownTransferEncoding(self):
+ """
+ A request whose C{transfer-encoding} header includes a value
+ other than C{chunked} or C{identity} fails with a 400 response
+ without calling L{Request.process}.
+ """
+ self.assertRequestRejected([
+ b'GET /a HTTP/1.1',
+ b'Transfer-Encoding: unknown',
+ b'Host: host.invalid',
+ b'',
+ b'',
+ ])
+
+
+ def test_transferEncodingIdentity(self):
+ """
+ A request with a valid C{content-length} and a
+ C{transfer-encoding} whose value is C{identity} succeeds.
+ """
+ body = []
+
+ class SuccessfulRequest(http.Request):
+ processed = False
+ def process(self):
+ body.append(self.content.read())
+ self.setHeader(b'content-length', b'0')
+ self.finish()
+
+ request = b'''\
+GET / HTTP/1.1
+Host: host.invalid
+Content-Length: 2
+Transfer-Encoding: identity
+
+ok
+'''
+ channel = self.runRequest(request, SuccessfulRequest, False)
+ self.assertEqual(body, [b'ok'])
+ self.assertEqual(
+ channel.transport.value(),
+ b'HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n',
+ )
+
+
class QueryArgumentsTests(unittest.TestCase):
def testParseqs(self):
--
2.39.2

View File

@ -0,0 +1,86 @@
From 2552b2e8c9f73b5cdef8842e4e3701bac19c12c6 Mon Sep 17 00:00:00 2001
From: Adi Roiban <adi.roiban@chevah.com>
Date: Mon, 24 Jan 2022 19:09:04 +0000
Subject: [PATCH 3/4] Fix CVE-2022-21716
Initial fix for Twisted version string DoS.
(cherry picked from commit de90dfe1519e996dd150de751c670f8e03daa089)
Update after review.
(cherry picked from commit 9b98116372f5d211ddb9f68916d4ae73bf3c8da7)
Fix typo.
(cherry picked from commit a4523b444760f07e609636264a61a2a07ca0bde5)
---
src/twisted/conch/ssh/transport.py | 9 +++++++++
src/twisted/conch/test/test_transport.py | 21 +++++++++++++++++++++
src/twisted/newsfragments/10284.bugfix | 2 ++
3 files changed, 32 insertions(+)
create mode 100644 src/twisted/newsfragments/10284.bugfix
diff --git a/src/twisted/conch/ssh/transport.py b/src/twisted/conch/ssh/transport.py
index bd76b0a845..6d02df52dd 100644
--- a/src/twisted/conch/ssh/transport.py
+++ b/src/twisted/conch/ssh/transport.py
@@ -677,6 +677,15 @@ class SSHTransportBase(protocol.Protocol):
"""
self.buf = self.buf + data
if not self.gotVersion:
+
+ if len(self.buf) > 4096:
+ self.sendDisconnect(
+ DISCONNECT_CONNECTION_LOST,
+ b"Peer version string longer than 4KB. "
+ b"Preventing a denial of service attack.",
+ )
+ return
+
if self.buf.find(b'\n', self.buf.find(b'SSH-')) == -1:
return
diff --git a/src/twisted/conch/test/test_transport.py b/src/twisted/conch/test/test_transport.py
index 98a3515a75..449dd3f8df 100644
--- a/src/twisted/conch/test/test_transport.py
+++ b/src/twisted/conch/test/test_transport.py
@@ -522,6 +522,27 @@ class BaseSSHTransportTests(BaseSSHTransportBaseCase, TransportTestCase):
r')*$')
self.assertRegex(softwareVersion, softwareVersionRegex)
+ def test_dataReceiveVersionNotSentMemoryDOS(self):
+ """
+ When the peer is not sending its SSH version but keeps sending data,
+ the connection is disconnected after 4KB to prevent buffering too
+ much and running our of memory.
+ """
+ sut = MockTransportBase()
+ sut.makeConnection(self.transport)
+
+ # Data can be received over multiple chunks.
+ sut.dataReceived(b"SSH-2-Server-Identifier")
+ sut.dataReceived(b"1234567890" * 406)
+ sut.dataReceived(b"1235678")
+ self.assertFalse(self.transport.disconnecting)
+
+ # Here we are going over the limit.
+ sut.dataReceived(b"1234567")
+ # Once a lot of data is received without an SSH version string,
+ # the transport is disconnected.
+ self.assertTrue(self.transport.disconnecting)
+ self.assertIn(b"Preventing a denial of service attack", self.transport.value())
def test_sendPacketPlain(self):
"""
diff --git a/src/twisted/newsfragments/10284.bugfix b/src/twisted/newsfragments/10284.bugfix
new file mode 100644
index 0000000000..b2316f1e68
--- /dev/null
+++ b/src/twisted/newsfragments/10284.bugfix
@@ -0,0 +1,2 @@
+twisted.conch.ssh.transport.SSHTransportBase now disconnects the remote peer if the
+SSH version string is not sent in the first 4096 bytes.
--
2.39.2

View File

@ -0,0 +1,437 @@
From c26f9865d02ac6cf43a560a25a6201439c33640d Mon Sep 17 00:00:00 2001
From: Tom Most <twm@freecog.net>
Date: Sat, 5 Mar 2022 23:26:55 -0800
Subject: [PATCH 4/4] Fix CVE-2022-24801
Some tests for GHSA-c2jg-hw38-jrqq
(cherry picked from commit 22b067793cbcd0fb5dee04cfd9115fa85a7ca110)
Replace obs-fold with a single space
(cherry picked from commit 79ee8c564ca0d4c2910c8859e0a6014d2dc40005)
Strip only spaces and tabs from header values
(cherry picked from commit c3a4e1d015740c1d87a3ec7d57570257e75b0062)
Reject non-digit Content-Length
(cherry picked from commit 8ebfa8f6577431226e109ff98ba48f5152a2c416)
Test for malformed chunk size and extensions
(cherry picked from commit f22d0d9c889822adb7eaf84b42a20ff5f7c4d421)
Reject malformed chunk sizes
(cherry picked from commit 0275152f147506c82868ff1dabd9bf655ab67946)
We should deprecate http.fromChunk
(cherry picked from commit 2a5763d5b168372abb591c0eb6323ed4dfe8a4fc)
Correct chunk extension byte validation
Go back to the RFC to figure out the correct allowed ranges.
(cherry picked from commit fa9caa54d63399b4ccdfbf0429ba1b504ccc7c89)
Address review feedback
(cherry picked from commit 2bbd6c89110f0d44d2bb109c14d787f65bca9df8)
---
src/twisted/web/http.py | 83 ++++++++++++-
src/twisted/web/test/test_http.py | 193 +++++++++++++++++++++++++++++-
2 files changed, 268 insertions(+), 8 deletions(-)
diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
index 71188a8d50..e988601789 100644
--- a/src/twisted/web/http.py
+++ b/src/twisted/web/http.py
@@ -340,10 +340,39 @@ def toChunk(data):
+def _ishexdigits(b):
+ """
+ Is the string case-insensitively hexidecimal?
+
+ It must be composed of one or more characters in the ranges a-f, A-F
+ and 0-9.
+ """
+ for c in b:
+ if c not in b"0123456789abcdefABCDEF":
+ return False
+ return b != b""
+
+
+def _hexint(b):
+ """
+ Decode a hexadecimal integer.
+
+ Unlike L{int(b, 16)}, this raises L{ValueError} when the integer has
+ a prefix like C{b'0x'}, C{b'+'}, or C{b'-'}, which is desirable when
+ parsing network protocols.
+ """
+ if not _ishexdigits(b):
+ raise ValueError(b)
+ return int(b, 16)
+
+
def fromChunk(data):
"""
Convert chunk to string.
+ Note that this function is not specification compliant: it doesn't handle
+ chunk extensions.
+
@type data: C{bytes}
@return: tuple of (result, remaining) - both C{bytes}.
@@ -352,7 +381,7 @@ def fromChunk(data):
byte string.
"""
prefix, rest = data.split(b'\r\n', 1)
- length = int(prefix, 16)
+ length = _hexint(prefix)
if length < 0:
raise ValueError("Chunk length must be >= 0, not %d" % (length,))
if rest[length:length + 2] != b'\r\n':
@@ -1774,6 +1803,46 @@ class _IdentityTransferDecoder(object):
raise _DataLoss()
+_chunkExtChars = (
+ b"\t !\"#$%&'()*+,-./0123456789:;<=>?@"
+ b"ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`"
+ b"abcdefghijklmnopqrstuvwxyz{|}~"
+ b"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+ b"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+ b"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+ b"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+ b"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+ b"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+ b"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+ b"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+)
+"""
+Characters that are valid in a chunk extension.
+
+See RFC 7230 section 4.1.1::
+
+ chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
+
+ chunk-ext-name = token
+ chunk-ext-val = token / quoted-string
+
+And section 3.2.6::
+
+ token = 1*tchar
+
+ tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
+ / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
+ / DIGIT / ALPHA
+ ; any VCHAR, except delimiters
+
+ quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
+ qdtext = HTAB / SP /%x21 / %x23-5B / %x5D-7E / obs-text
+ obs-text = %x80-FF
+
+We don't check if chunk extensions are well-formed beyond validating that they
+don't contain characters outside this range.
+"""
+
class _ChunkedTransferDecoder(object):
"""
@@ -1826,10 +1895,14 @@ class _ChunkedTransferDecoder(object):
line, rest = data.split(b'\r\n', 1)
parts = line.split(b';')
try:
- self.length = int(parts[0], 16)
+ self.length = _hexint(parts[0])
except ValueError:
raise _MalformedChunkedDataError(
"Chunk-size must be an integer.")
+ if len(parts) > 1 and parts[1].translate(None, _chunkExtChars) != b"":
+ raise _MalformedChunkedDataError(
+ "Invalid characters in chunk extensions: %r." % parts[1]
+ )
if self.length == 0:
self.state = 'TRAILER'
else:
@@ -2156,7 +2229,7 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
self.setRawMode()
elif line[0] in b' \t':
# Continuation of a multi line header.
- self.__header = self.__header + b'\n' + line
+ self.__header += b" " + line.lstrip(b" \t")
# Regular header line.
# Processing of header line is delayed to allow accumulating multi
# line headers.
@@ -2184,6 +2257,8 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
# Can this header determine the length?
if header == b'content-length':
+ if not data.isdigit():
+ return fail()
try:
length = int(data)
except ValueError:
@@ -2235,7 +2310,7 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
return False
header = header.lower()
- data = data.strip()
+ data = data.strip(b" \t")
if not self._maybeChooseTransferDecoder(header, data):
return False
diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
index 8f2c1bac21..d6f1fc0673 100644
--- a/src/twisted/web/test/test_http.py
+++ b/src/twisted/web/test/test_http.py
@@ -1300,6 +1300,43 @@ class ChunkedTransferEncodingTests(unittest.TestCase):
p.dataReceived(b'3; x-foo=bar\r\nabc\r\n')
self.assertEqual(L, [b'abc'])
+ def test_extensionsMalformed(self):
+ """
+ L{_ChunkedTransferDecoder.dataReceived} raises
+ L{_MalformedChunkedDataError} when the chunk extension fields contain
+ invalid characters.
+
+ This is a potential request smuggling vector: see GHSA-c2jg-hw38-jrqq.
+ """
+ invalidControl = (
+ b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\n\x0b\x0c\r\x0e\x0f"
+ b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+ )
+ invalidDelimiter = b"\\"
+ invalidDel = b"\x7f"
+ for b in invalidControl + invalidDelimiter + invalidDel:
+ data = b"3; " + bytes((b,)) + b"\r\nabc\r\n"
+ p = http._ChunkedTransferDecoder(
+ lambda b: None, # pragma: nocov
+ lambda b: None, # pragma: nocov
+ )
+ self.assertRaises(http._MalformedChunkedDataError, p.dataReceived, data)
+
+ def test_malformedChunkSizeHex(self):
+ """
+ L{_ChunkedTransferDecoder.dataReceived} raises
+ L{_MalformedChunkedDataError} when the chunk size is prefixed with
+ "0x", as if it were a Python integer literal.
+
+ This is a potential request smuggling vector: see GHSA-c2jg-hw38-jrqq.
+ """
+ p = http._ChunkedTransferDecoder(
+ lambda b: None, # pragma: nocov
+ lambda b: None, # pragma: nocov
+ )
+ self.assertRaises(
+ http._MalformedChunkedDataError, p.dataReceived, b"0x3\r\nabc\r\n"
+ )
def test_finish(self):
"""
@@ -1389,6 +1426,8 @@ class ChunkingTests(unittest.TestCase, ResponseTestMixin):
chunked = b''.join(http.toChunk(s))
self.assertEqual((s, b''), http.fromChunk(chunked))
self.assertRaises(ValueError, http.fromChunk, b'-5\r\nmalformed!\r\n')
+ self.assertRaises(ValueError, http.fromChunk, b"0xa\r\nmalformed!\r\n")
+ self.assertRaises(ValueError, http.fromChunk, b"0XA\r\nmalformed!\r\n")
def testConcatenatedChunks(self):
chunked = b''.join([b''.join(http.toChunk(t)) for t in self.strings])
@@ -1579,7 +1618,12 @@ class ParsingTests(unittest.TestCase):
Line folded headers are handled by L{HTTPChannel} by replacing each
fold with a single space by the time they are made available to the
L{Request}. Any leading whitespace in the folded lines of the header
- value is preserved.
+ value is replaced with a single space, per:
+
+ A server that receives an obs-fold in a request message ... MUST
+ ... replace each received obs-fold with one or more SP octets prior
+ to interpreting the field value or forwarding the message
+ downstream.
See RFC 7230 section 3.2.4.
"""
@@ -1616,17 +1660,66 @@ class ParsingTests(unittest.TestCase):
)
self.assertEqual(
request.requestHeaders.getRawHeaders(b"space"),
- [b"space space"],
+ [b"space space"],
)
self.assertEqual(
request.requestHeaders.getRawHeaders(b"spaces"),
- [b"spaces spaces spaces"],
+ [b"spaces spaces spaces"],
)
self.assertEqual(
request.requestHeaders.getRawHeaders(b"tab"),
- [b"t \ta \tb"],
+ [b"t a b"],
)
+ def test_headerStripWhitespace(self):
+ """
+ Leading and trailing space and tab characters are stripped from
+ headers. Other forms of whitespace are preserved.
+
+ See RFC 7230 section 3.2.3 and 3.2.4.
+ """
+ processed = []
+
+ class MyRequest(http.Request):
+ def process(self):
+ processed.append(self)
+ self.finish()
+
+ requestLines = [
+ b"GET / HTTP/1.0",
+ b"spaces: spaces were stripped ",
+ b"tabs: \t\ttabs were stripped\t\t",
+ b"spaces-and-tabs: \t \t spaces and tabs were stripped\t \t",
+ b"line-tab: \v vertical tab was preserved\v\t",
+ b"form-feed: \f form feed was preserved \f ",
+ b"",
+ b"",
+ ]
+
+ self.runRequest(b"\n".join(requestLines), MyRequest, 0)
+ [request] = processed
+ # All leading and trailing whitespace is stripped from the
+ # header-value.
+ self.assertEqual(
+ request.requestHeaders.getRawHeaders(b"spaces"),
+ [b"spaces were stripped"],
+ )
+ self.assertEqual(
+ request.requestHeaders.getRawHeaders(b"tabs"),
+ [b"tabs were stripped"],
+ )
+ self.assertEqual(
+ request.requestHeaders.getRawHeaders(b"spaces-and-tabs"),
+ [b"spaces and tabs were stripped"],
+ )
+ self.assertEqual(
+ request.requestHeaders.getRawHeaders(b"line-tab"),
+ [b"\v vertical tab was preserved\v"],
+ )
+ self.assertEqual(
+ request.requestHeaders.getRawHeaders(b"form-feed"),
+ [b"\f form feed was preserved \f"],
+ )
def test_tooManyHeaders(self):
"""
@@ -2182,6 +2275,58 @@ Hello,
])
+ def test_contentLengthMalformed(self):
+ """
+ A request with a non-integer C{Content-Length} header fails with a 400
+ response without calling L{Request.process}.
+ """
+ self.assertRequestRejected(
+ [
+ b"GET /a HTTP/1.1",
+ b"Content-Length: MORE THAN NINE THOUSAND!",
+ b"Host: host.invalid",
+ b"",
+ b"",
+ b"x" * 9001,
+ ]
+ )
+
+ def test_contentLengthTooPositive(self):
+ """
+ A request with a C{Content-Length} header that begins with a L{+} fails
+ with a 400 response without calling L{Request.process}.
+
+ This is a potential request smuggling vector: see GHSA-c2jg-hw38-jrqq.
+ """
+ self.assertRequestRejected(
+ [
+ b"GET /a HTTP/1.1",
+ b"Content-Length: +100",
+ b"Host: host.invalid",
+ b"",
+ b"",
+ b"x" * 100,
+ ]
+ )
+
+ def test_contentLengthNegative(self):
+ """
+ A request with a C{Content-Length} header that is negative fails with
+ a 400 response without calling L{Request.process}.
+
+ This is a potential request smuggling vector: see GHSA-c2jg-hw38-jrqq.
+ """
+ self.assertRequestRejected(
+ [
+ b"GET /a HTTP/1.1",
+ b"Content-Length: -100",
+ b"Host: host.invalid",
+ b"",
+ b"",
+ b"x" * 200,
+ ]
+ )
+
def test_duplicateContentLengthsWithPipelinedRequests(self):
"""
Two pipelined requests, the first of which includes multiple
@@ -4140,3 +4285,43 @@ class HTTPClientSanitizationTests(unittest.SynchronousTestCase):
transport.value().splitlines(),
[b": ".join([sanitizedBytes, sanitizedBytes])]
)
+
+
+class HexHelperTests(unittest.SynchronousTestCase):
+ """
+ Test the L{http._hexint} and L{http._ishexdigits} helper functions.
+ """
+
+ badStrings = (b"", b"0x1234", b"feds", b"-123" b"+123")
+
+ def test_isHex(self):
+ """
+ L{_ishexdigits()} returns L{True} for nonempy bytestrings containing
+ hexadecimal digits.
+ """
+ for s in (b"10", b"abcdef", b"AB1234", b"fed", b"123467890"):
+ self.assertIs(True, http._ishexdigits(s))
+
+ def test_decodes(self):
+ """
+ L{_hexint()} returns the integer equivalent of the input.
+ """
+ self.assertEqual(10, http._hexint(b"a"))
+ self.assertEqual(0x10, http._hexint(b"10"))
+ self.assertEqual(0xABCD123, http._hexint(b"abCD123"))
+
+ def test_isNotHex(self):
+ """
+ L{_ishexdigits()} returns L{False} for bytestrings that don't contain
+ hexadecimal digits, including the empty string.
+ """
+ for s in self.badStrings:
+ self.assertIs(False, http._ishexdigits(s))
+
+ def test_decodeNotHex(self):
+ """
+ L{_hexint()} raises L{ValueError} for bytestrings that can't
+ be decoded.
+ """
+ for s in self.badStrings:
+ self.assertRaises(ValueError, http._hexint, s)
--
2.39.2

View File

@ -0,0 +1,428 @@
%global pypi_name twisted
%global common_description %{expand:
Twisted is a networking engine written in Python, supporting numerous protocols.
It contains a web server, numerous chat clients, chat servers, mail servers
and more.}
Name: python-%{pypi_name}
Version: 19.10.0
Release: 4%{?dist}
Summary: Twisted is a networking engine written in Python
License: MIT
URL: http://twistedmatrix.com/
Source0: %{pypi_source Twisted %{version} tar.bz2}
# Import gobject from gi.repository for Python 3
# https://twistedmatrix.com/trac/ticket/9642
Patch1: 0001-Import-gobject-from-gi.repository-in-Python-3.patch
# https://github.com/twisted/twisted/commit/d2f6dd9b3766509f40c980aac67ca8475da67c6f
# https://github.com/twisted/twisted/commit/4a7d22e490bb8ff836892cc99a1f54b85ccb0281
Patch2: 0002-Fix-CVE-2020-10108-and-CVE-2020-10109.patch
# https://github.com/twisted/twisted/commit/de90dfe1519e996dd150de751c670f8e03daa089
# https://github.com/twisted/twisted/commit/9b98116372f5d211ddb9f68916d4ae73bf3c8da7
# https://github.com/twisted/twisted/commit/a4523b444760f07e609636264a61a2a07ca0bde5
Patch3: 0003-Fix-CVE-2022-21716.patch
# https://github.com/twisted/twisted/commit/22b067793cbcd0fb5dee04cfd9115fa85a7ca110
# https://github.com/twisted/twisted/commit/79ee8c564ca0d4c2910c8859e0a6014d2dc40005
# https://github.com/twisted/twisted/commit/c3a4e1d015740c1d87a3ec7d57570257e75b0062
# https://github.com/twisted/twisted/commit/8ebfa8f6577431226e109ff98ba48f5152a2c416
# https://github.com/twisted/twisted/commit/f22d0d9c889822adb7eaf84b42a20ff5f7c4d421
# https://github.com/twisted/twisted/commit/0275152f147506c82868ff1dabd9bf655ab67946
# https://github.com/twisted/twisted/commit/2a5763d5b168372abb591c0eb6323ed4dfe8a4fc
# https://github.com/twisted/twisted/commit/fa9caa54d63399b4ccdfbf0429ba1b504ccc7c89
# https://github.com/twisted/twisted/commit/2bbd6c89110f0d44d2bb109c14d787f65bca9df8
Patch4: 0004-Fix-CVE-2022-24801.patch
%description
%{common_description}
%package -n python%{python3_pkgversion}-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
BuildRequires: gcc
BuildRequires: python%{python3_pkgversion}-devel >= 3.3
BuildRequires: python%{python3_pkgversion}dist(appdirs) >= 1.4.0
BuildRequires: python%{python3_pkgversion}dist(automat) >= 0.3.0
BuildRequires: python%{python3_pkgversion}dist(attrs) >= 17.4.0
BuildRequires: python%{python3_pkgversion}dist(constantly) >= 15.1
BuildRequires: python%{python3_pkgversion}dist(cryptography) >= 2.3
BuildRequires: (python%{python3_pkgversion}dist(h2) >= 3.0 with python%{python3_pkgversion}dist(h2) < 4.0)
BuildRequires: python%{python3_pkgversion}dist(hyperlink) >= 17.1.1
BuildRequires: python%{python3_pkgversion}dist(idna) >= 2.5
BuildRequires: python%{python3_pkgversion}dist(incremental) >= 16.10.1
BuildRequires: (python%{python3_pkgversion}dist(priority) >= 1.1.0 with python%{python3_pkgversion}dist(priority) < 2.0)
BuildRequires: python%{python3_pkgversion}dist(pyasn1)
BuildRequires: python%{python3_pkgversion}dist(pyopenssl) >= 16.0.0
BuildRequires: python%{python3_pkgversion}dist(pyserial) >= 3.0
BuildRequires: python%{python3_pkgversion}dist(service-identity) >= 18.1.0
BuildRequires: python%{python3_pkgversion}dist(setuptools)
BuildRequires: python3dist(sphinx) >= 1.3.1
BuildRequires: python%{python3_pkgversion}dist(zope.interface) >= 4.4.2
BuildRequires: python%{python3_pkgversion}dist(pyhamcrest) >= 1.9.0
Recommends: python%{python3_pkgversion}dist(service-identity) >= 18.1.0
%description -n python%{python3_pkgversion}-%{pypi_name}
%{common_description}
%prep
%autosetup -p1 -n Twisted-%{version}
%build
find -name '*.pyx' -exec cython {} \;
%py3_build
# generate html docs
PYTHONPATH=${PWD}/src/ sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
# no-manual-page-for-binary
mkdir -p %{buildroot}%{_mandir}/man1/
for s in conch core mail; do
cp -a docs/$s/man/*.1 %{buildroot}%{_mandir}/man1/
done
%py3_install
# Packages that install arch-independent twisted plugins install here.
# https://bugzilla.redhat.com/show_bug.cgi?id=1252140
mkdir -p %{buildroot}%{python3_sitelib}/twisted/plugins
# Move and symlink python3 scripts
# no-manual-page-for-binary: man page is trial and twistd
mv %{buildroot}%{_bindir}/trial %{buildroot}%{_bindir}/trial-%{python3_version}
ln -s ./trial-%{python3_version} %{buildroot}%{_bindir}/trial-3
ln -s ./trial-%{python3_version} %{buildroot}%{_bindir}/trial
mv %{buildroot}%{_bindir}/twistd %{buildroot}%{_bindir}/twistd-%{python3_version}
ln -s ./twistd-%{python3_version} %{buildroot}%{_bindir}/twistd-3
ln -s ./twistd-%{python3_version} %{buildroot}%{_bindir}/twistd
# non-executable-script
# pop3testserver.py: applies to py2.4 and that is the current default
# scripttest.py: is noop
chmod +x %{buildroot}%{python3_sitearch}/twisted/mail/test/pop3testserver.py
chmod +x %{buildroot}%{python3_sitearch}/twisted/trial/test/scripttest.py
# ambiguous shebangs
pathfix.py -pn -i %{__python3} %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch}
%check
# can't get this to work within the buildroot yet due to multicast
# https://twistedmatrix.com/trac/ticket/7494
PATH=%{buildroot}%{_bindir}:$PATH PYTHONPATH=%{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/trial twisted ||:
%files -n python%{python3_pkgversion}-twisted
%doc CONTRIBUTING NEWS.rst README.rst html
%license LICENSE
%{_bindir}/trial-3*
%{_bindir}/twistd-3*
%{python3_sitearch}/twisted
%{python3_sitearch}/Twisted-%{version}-py%{python3_version}.egg-info
%dir %{python3_sitelib}/twisted/
%dir %{python3_sitelib}/twisted/plugins/
%{_bindir}/cftp
%{_bindir}/ckeygen
%{_bindir}/conch
%{_bindir}/mailmail
%{_bindir}/pyhtmlizer
%{_bindir}/tkconch
%{_bindir}/trial
%{_bindir}/twist
%{_bindir}/twistd
%{_mandir}/man1/cftp.1*
%{_mandir}/man1/ckeygen.1*
%{_mandir}/man1/conch.1*
%{_mandir}/man1/mailmail.1*
%{_mandir}/man1/pyhtmlizer.1*
%{_mandir}/man1/tkconch.1*
%{_mandir}/man1/trial.1*
%{_mandir}/man1/twistd.1*
%changelog
* Wed Apr 12 2023 Carl George <carl@george.computer> - 19.10.0-4
- Backport fix for CVE-2022-24801, resolves: rhbz#2073116
* Mon Nov 28 17:45:05 CLT 2022 Diego Herrera <dherrera@redhat.com> - 19.10.0-3
- Backported CVE-2022-21716 fix from upstream
* Tue Mar 17 16:31:05 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 19.10.0-2
- Security fix for CVE-2020-10108 (#1813439, #1813442)
- Security fix for CVE-2020-10109 (#1813447, #1813450)
* Tue Mar 17 15:15:48 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 19.10.0-1
- Update to 19.10.0
- Revert removal of %%{python3_sitelib}/twisted/plugins/
* Sun Oct 13 23:35:33 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 19.7.0-2
- Drop Python 2 support (#1761204)
* Wed Jul 24 2019 Stephen Smoogen <smooge@fedoraproject.org> - 19.2.1-1.1
- Cut down python-cryptography to the version shipped in RHEL and see if that works.
* Mon Jun 24 2019 Troy Dawson <tdawson@redhat.com> - 1.0.2-9.1
- Make python2 optional
- Do not build python2 for RHEL8
* Sun Jun 09 18:40:31 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 19.2.1-1
- Release 19.2.1
* Wed May 22 18:26:29 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 19.2.0-3
- Add patch to import gobject from gi.repository for Python 3
- Fix #1712748
* Tue May 14 16:00:42 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 19.2.0-2
- Add patch regenerating raiser.c to use with Python 3.8a4
- Fix #11709817
* Wed Apr 10 17:38:50 CET 2019 Robert-André Mauchin <zebob.m@gmail.com> - 19.2.0-1
- Release 19.2.0 (#1698490)
* Thu Mar 07 2019 Robert-André Mauchin <zebob.m@gmail.com> - 18.9.0-1
- Release 18.9.0
- Run tests
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 18.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Oct 22 2018 Miro Hrončok <mhroncok@redhat.com> - 18.7.0-3
- Recommend pythonX-service-identity
* Sat Jul 21 2018 Robert-André Mauchin <zebob.m@gmail.com> - 18.7.0-2
- Remove erroneous symlink to binaries
* Sun Jul 15 2018 Robert-André Mauchin <zebob.m@gmail.com> - 18.7.0-1
- Update to 18.7.0
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 18.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jun 27 2018 Robert-André Mauchin <zebob.m@gmail.com> - 18.4.0-1
- Update to 18.4.0
- Default binaries to Python 3
- Drop old Obsoletes/Provides
- Refresh BR
- Remove useless macros
- Use python_enable_dependency_generator
* Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 16.4.1-11
- Rebuilt for Python 3.7
* Wed May 23 2018 Miro Hrončok <mhroncok@redhat.com> - 16.4.1-10
- Fix ambiguous shebangs
* Fri Apr 27 2018 Petr Viktorin <pviktori@redhat.com> - 16.4.1-9
- No longer require python-crypto
* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 16.4.1-8
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 16.4.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 16.4.1-6
- Cleanup spec file conditionals
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 16.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 16.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 16.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Dec 13 2016 Stratakis Charalampos <cstratak@redhat.com> - 16.4.1-2
- rebuilt
* Wed Oct 26 2016 Jonathan Steffan <jsteffan@fedoraproject.org> - 16.4.1-1
- Update to 16.4.1
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 16.3.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Fri Jul 8 2016 Jonathan Steffan <jsteffan@fedoraproject.org> - 16.3.0-1
- Update to 16.3.0
- mahole, tap2deb, tap2rpm are removed upstream
* Sun Jun 26 2016 Jonathan Steffan <jsteffan@fedoraproject.org> - 16.2.0-2
- Add rpmlint notes
- Fix unneeded py3 conditional for py2 script chmod
* Sun Jun 26 2016 Jonathan Steffan <jsteffan@fedoraproject.org> - 16.2.0-1
- Update to 16.2.0
- Update upstream source location
* Thu Jun 2 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 16.1.1-3
- Drop tkinter dependency (only required for tkconch)
- Use python3 conditionals
- Move BR under the proper subpackage
* Tue May 10 2016 Petr Viktorin <pviktori@redhat.com> - 16.1.1-2
- Update to better conform to Python packaging guidelines
* Thu May 05 2016 Julien Enselme <jujens@jujens.eu> - 16.1.1-1
- Update to 16.1.1 (#1287381)
* Thu Mar 10 2016 Julien Enselme <jujens@jujens.eu> - 15.5.0-2
- Add python3 support
* Thu Mar 10 2016 Julien Enselme <jujens@jujens.eu> - 15.5.0-1
- Update to 15.5.0 (#1287381)
- Use new python macros
- Remove deprecated %%clean section
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 15.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Nov 27 2015 Tom Prince <tom.prince@twistedmatrix.com> - 15.4.0-2
- Add arch-independent plugin directory to package. (RHBZ#1252140)
* Thu Oct 29 2015 Tom Prince <tom.prince@twistedmatrix.com> - 15.4.0-1
- Update to 15.4.0
- Include test certificates.
* Mon Jul 20 2015 Jonathan Steffan <jsteffan@fedoraproject.org> - 15.2.1-1
- Update to 15.2.1
* Sat May 09 2015 Jonathan Steffan <jsteffan@fedoraproject.org> - 15.1.0-1
- Update to 15.1.0 (RHBZ#1187921,RHBZ#1192707)
- Require python-service-identity (RHBZ#1119067)
- Obsolete python-twisted-core-doc (RHBZ#1187025)
* Sat Nov 22 2014 Jonathan Steffan <jsteffan@fedoraproject.org> - 14.0.2-1
- Update to 14.0.2 (RHBZ#1143002)
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 14.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Jonathan Steffan <jsteffan@fedoraproject.org> - 14.0.0-1
- Update to 14.0.0
- Ship Twisted as a fully featured package without subpackages on the advice
of upstream and to mirror what pypi provides
- Explictly build for python2 with new macros
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Sep 03 2012 Julian Sikorski <belegdol@fedoraproject.org> - 12.2.0-1
- Updated to 12.2.0
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sun Jun 17 2012 Julian Sikorski <belegdol@fedoraproject.org> - 12.1.0-1
- Updated to 12.1.0
* Sun Feb 12 2012 Julian Sikorski <belegdol@fedoraproject.org> - 12.0.0-1
- Updated to 12.0.0
* Sat Jan 07 2012 Julian Sikorski <belegdol@fedoraproject.org> - 11.1.0-2
- Rebuilt for gcc-4.7
* Fri Nov 18 2011 Julian Sikorski <belegdol@fedoraproject.org> - 11.1.0-1
- Updated to 11.1.0
- Dropped obsolete Group, Buildroot, %%clean and %%defattr
* Sat Apr 30 2011 Julian Sikorski <belegdol@fedoraproject.org> - 11.0.0-1
- Updated to 11.0.0
- Added comment on how to obtain the PKG-INFO file
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 10.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Sat Jan 15 2011 Julian Sikorski <belegdol@fedoraproject.org> - 10.2.0-1
- Updated to 10.2.0
* Mon Nov 08 2010 Julian Sikorski <belegdol@fedoraproject.org> - 10.1.0-3
- Use python_sitelib instead of python-sitearch
- The aforementioned macros are defined in Fedora 13 and above
* Sun Nov 07 2010 Julian Sikorski <belegdol@fedoraproject.org> - 10.1.0-2
- Added egg-info file
* Tue Sep 21 2010 Julian Sikorski <belegdol@fedoraproject.org> - 10.1.0-1
- Updated to 10.1.0
- Switched to macros for versioned dependencies
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Dec 29 2008 Matthias Saou <http://freshrpms.net/> 8.2.0-1
- Update to 8.2.0.
- Change back spec cosmetic details from Paul's to Thomas' preference.
* Wed Jul 16 2008 Matthias Saou <http://freshrpms.net/> 8.1.0-2
- Update to 8.1.0.
- Minor spec file cleanups.
- Merge back changes from Paul Howarth.
* Wed May 21 2008 Thomas Vander Stichele <thomas at apestaart dot org>
- 2.5.0-1
- update to 2.5.0 release (only the umbrella package was missing)
* Tue Jan 16 2007 Thomas Vander Stichele <thomas at apestaart dot org>
- 2.4.0-3
- list packages in README.fedora
* Wed Jan 03 2007 Thomas Vander Stichele <thomas at apestaart dot org>
- 2.4.0-2
- add a README.fedora
- made noarch, since it doesn't actually install any python twisted/ module
code
- fixed provides/obsoletes
* Wed Jun 07 2006 Thomas Vander Stichele <thomas at apestaart dot org>
- 2.4.0-1
- this is now a pure umbrella package
* Mon Oct 10 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.1.0-1
- upstream release
* Tue Aug 23 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.1-1
- upstream release
* Mon Apr 04 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0-2
- add zsh support
* Fri Mar 25 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0-1
- final release
* Thu Mar 17 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0-0.2.a3
- dropped web2
* Wed Mar 16 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0-0.1.a3
- upstream release
* Sat Mar 12 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0-0.1.a2
- new prerelease; FE versioning
* Mon Feb 07 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 2.0.0a1-1
- prep for split
* Fri Aug 20 2004 Jeff Pitman <symbiont+pyvault@berlios.de> 1.3.0-1
- new version
* Mon Apr 19 2004 Jeff Pitman <symbiont+pyvault@berlios.de> 1.2.0-3
- vaultize
* Mon Apr 12 2004 Jeff Pitman <symbiont+pyvault@berlios.de> 1.2.0-2
- require pyOpenSSL, SOAPpy, openssh-clients, crypto, dia so trial can run

View File

@ -0,0 +1,40 @@
From b673271710047acb1976002e4b84d06b7cefd3d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
Date: Wed, 17 Jan 2024 13:20:49 +0100
Subject: [PATCH 1/2] Revert "egl: add automatic zink fallback loading between
hw and sw drivers"
This reverts commit 8cd44b8843877a2f7d559d123eb3694841f16fdc.
---
src/egl/main/eglapi.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d50be23e871..b1a48668b76 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -695,17 +695,10 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (disp->Options.ForceSoftware)
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
else {
- bool success = false;
- if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) {
- disp->Options.Zink = EGL_TRUE;
- success = _eglDriver.Initialize(disp);
- }
- if (!success) {
- disp->Options.Zink = EGL_FALSE;
- disp->Options.ForceSoftware = EGL_TRUE;
- if (!_eglDriver.Initialize(disp))
- RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
- }
+ disp->Options.Zink = EGL_FALSE;
+ disp->Options.ForceSoftware = EGL_TRUE;
+ if (!_eglDriver.Initialize(disp))
+ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
}
}
--
2.43.0

View File

@ -0,0 +1,41 @@
From d3ab117c837e537fe0b7077bb9e4c3f018153945 Mon Sep 17 00:00:00 2001
Message-ID: <d3ab117c837e537fe0b7077bb9e4c3f018153945.1700681619.git.kai@dev.carbon-project.org>
From: =?UTF-8?q?Kai=20Wasserb=C3=A4ch?= <kai@dev.carbon-project.org>
Date: Wed, 22 Nov 2023 20:21:11 +0100
Subject: [PATCH] fix: ac/llvm: LLVM 18_ do not use llvm::createLoopSinkPass(),
removed upstream
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is no alternative named in upstream commit
<https://github.com/llvm/llvm-project/commit/b9975cec0ea0a2f10d65b7bd1197d9e1706cbd3d>,
that removes the legacy pass, therefore this commit should be considered
a workaround.
Workaround-for: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10192
Reference: https://github.com/llvm/llvm-project/pull/72811
Reference: https://github.com/llvm/llvm-project/commit/b9975cec0ea0a2f10d65b7bd1197d9e1706cbd3d
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
---
src/amd/llvm/ac_llvm_helper.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
index 40a4399e705..b995152ee36 100644
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -307,8 +307,9 @@ LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_library_inf
unwrap(passmgr)->add(createSROAPass());
#endif
/* TODO: restore IPSCCP */
- if (LLVM_VERSION_MAJOR >= 16)
+ #if LLVM_VERSION_MAJOR >= 16 && LLVM_VERSION_MAJOR < 18
unwrap(passmgr)->add(createLoopSinkPass());
+ #endif
/* TODO: restore IPSCCP */
unwrap(passmgr)->add(createLICMPass());
unwrap(passmgr)->add(createCFGSimplificationPass());
--
2.42.0

View File

@ -0,0 +1,103 @@
From 9b9d225931b69532aa1b43abdaf29c826bc47b26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
Date: Wed, 17 Jan 2024 13:21:08 +0100
Subject: [PATCH 2/2] Revert "glx: add automatic zink fallback loading between
hw and sw drivers"
This reverts commit 7d9ea77b4598e23d4415b529924f1cbdca6e33bd.
---
src/glx/glxext.c | 33 ++++++++-------------------------
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 39d5f08bdcf..5036fd137c1 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -763,11 +763,10 @@ glx_screen_cleanup(struct glx_screen *psc)
** If that works then fetch the per screen configs data.
*/
static Bool
-AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink)
+AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
{
struct glx_screen *psc;
GLint i, screens;
- unsigned screen_count = 0;
/*
** First allocate memory for the array of per screen configs.
@@ -804,21 +803,17 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink)
if (psc == NULL)
psc = applegl_create_screen(i, priv);
#else
- if (psc == NULL && !zink)
+ if (psc == NULL)
{
psc = indirect_create_screen(i, priv);
indirect = true;
}
#endif
priv->screens[i] = psc;
- if (psc)
- screen_count++;
if(indirect) /* Load extensions required only for indirect glx */
glxSendClientInfo(priv, i);
}
- if (zink && !screen_count)
- return GL_FALSE;
SyncHandle();
return GL_TRUE;
}
@@ -880,9 +875,9 @@ __glXInitialize(Display * dpy)
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
+ Bool zink;
const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
- Bool zink = env && !strcmp(env, "zink");
- Bool try_zink = False;
+ zink = env && !strcmp(env, "zink");
dpyPriv->drawHash = __glxHashCreate();
@@ -904,13 +899,10 @@ __glXInitialize(Display * dpy)
#endif /* HAVE_DRI3 */
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
- if (!dpyPriv->dri3Display && !dpyPriv->dri2Display)
- try_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) &&
- !getenv("GALLIUM_DRIVER");
}
#endif /* GLX_USE_DRM */
if (glx_direct)
- dpyPriv->driswDisplay = driswCreateDisplay(dpy, zink | try_zink);
+ dpyPriv->driswDisplay = driswCreateDisplay(dpy, zink);
#ifdef GLX_USE_WINDOWSGL
if (glx_direct && glx_accel)
@@ -925,18 +917,9 @@ __glXInitialize(Display * dpy)
}
#endif
- if (!AllocAndFetchScreenConfigs(dpy, dpyPriv, zink | try_zink)) {
- Bool fail = True;
- if (try_zink) {
- free(dpyPriv->screens);
- dpyPriv->driswDisplay->destroyDisplay(dpyPriv->driswDisplay);
- dpyPriv->driswDisplay = driswCreateDisplay(dpy, false);
- fail = !AllocAndFetchScreenConfigs(dpy, dpyPriv, False);
- }
- if (fail) {
- free(dpyPriv);
- return NULL;
- }
+ if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
+ free(dpyPriv);
+ return NULL;
}
glxSendClientInfo(dpyPriv, -1);
--
2.43.0

View File

@ -0,0 +1,117 @@
Subject: RE: Question about Mesa MLAA license
From: Jorge Jimenez <iryoku@gmail.com>
Date: 01/08/2013 12:50 PM
To: Tom Callaway <tcallawa@redhat.com>
CC: "jorge@iryoku.com" <jorge@iryoku.com>
Yes to both questions.
Thanks,
Jorge
From: Tom Callaway <tcallawa@redhat.com>
Sent: January 8, 2013 6:49 PM
To: Jorge Jimenez <iryoku@gmail.com>
CC: jorge@iryoku.com
Subject: Re: Question about Mesa MLAA license
On 01/08/2013 12:39 PM, Jorge Jimenez wrote:
> Hi Tom,
>
> What we meant with that is that we made an exception for clause 2.
> Instead of clause 2, in the case of the Mesa project, you have to name
> the technique Jimenez's MLAA in the config options of Mesa. We did that
> just to allow them to solve license issues. This exception should be for
> the Mesa project, and any project using Mesa, like Fedora.
>
> We want to widespread usage of our MLAA, so we want to avoid any kind of
> license complications. Hope current one is good for Fedora, if not
> please tell, and we'll see what we can do!
Okay, a few more questions:
* If Fedora decides to simply reproduce the quoted statement:
"Uses Jimenez's MLAA. Copyright (C) 2010 by Jorge Jimenez, Belen Masia,
Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
Specifically, if this is done as part of documentation included with
Mesa, is that sufficient to meet clause 2 even if the Mesa config option
is not set as described in your exception?
* Currently, the Mesa config option for MLAA says: "Morphological
anti-aliasing based on Jimenez\' MLAA. 0 to disable, 8 for default
quality". Is this in compliance with your exception?
Thanks again,
~tom
==
Fedora Project
Subject: RE: Question about Mesa MLAA license
From: Jorge Jimenez <iryoku@gmail.com>
Date: 01/08/2013 12:39 PM
To: "jorge@iryoku.com" <jorge@iryoku.com>, Tom Callaway <tcallawa@redhat.com>
Hi Tom,
What we meant with that is that we made an exception for clause 2.
Instead of clause 2, in the case of the Mesa project, you have to name
the technique Jimenez's MLAA in the config options of Mesa. We did that
just to allow them to solve license issues. This exception should be for
the Mesa project, and any project using Mesa, like Fedora.
We want to widespread usage of our MLAA, so we want to avoid any kind of
license complications. Hope current one is good for Fedora, if not
please tell, and we'll see what we can do!
Cheers,
Jorge
From: Tom Callaway <tcallawa@redhat.com>
Sent: January 8, 2013 6:30 PM
To: jorge@iryoku.com
Subject: Question about Mesa MLAA license
Jorge,
Thanks for all of your fantastic graphics work! I have been auditing
Fedora (a popular distribution of Linux) for license compliance and I
came across your MLAA code in Mesa.
The license says:
* 2. Redistributions in binary form must reproduce the following
statement:
*
* "Uses Jimenez's MLAA. Copyright (C) 2010 by Jorge Jimenez, Belen Masia,
* Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
*
* Only for use in the Mesa project, this point 2 is filled by naming the
* technique Jimenez's MLAA in the Mesa config options.
That wording is unclear. When you say "Only for use in the Mesa
project...", it seems like you could either be saying:
- This code may only be used as part of Mesa.
OR
- In Mesa, you can comply with clause 2 by simply selecting "Jimenez's
MLAA" in the Mesa config options.
*****
If the first item is true, then we may have to remove the MLAA code from
Fedora's copy of Mesa. However, looking at the license on your SMAA
code, I do not believe it to be the case. Please let me know either way!
Thanks in advance,
Tom Callaway
Fedora Legal
==
Fedora Project

View File

@ -0,0 +1,11 @@
diff -up mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf
--- mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma 2022-11-25 10:32:32.175879868 +1000
+++ mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf 2022-11-25 10:32:43.743067470 +1000
@@ -653,6 +653,7 @@ TODO: document the other workarounds.
<application name="gnome-shell" executable="gnome-shell">
<option name="adaptive_sync" value="false" />
<option name="v3d_nonmsaa_texture_size_limit" value="true" />
+ <option name="mesa_glthread" value="false"/>
</application>
<application name="Desktop — Plasma" executable="plasmashell">
<option name="adaptive_sync" value="false" />

View File

@ -0,0 +1,42 @@
meson: C type error in strtod_l/strtof_l probe
Future compilers will fail compilation due to the C type error:
…/testfile.c: In function 'main':
…/testfile.c:12:30: error: passing argument 2 of 'strtod_l' from incompatible pointer type
12 | double d = strtod_l(s, end, loc);
| ^~~
| |
| char *
/usr/include/stdlib.h:416:43: note: expected 'char ** restrict' but argument is of type 'char *'
416 | char **__restrict __endptr, locale_t __loc)
| ~~~~~~~~~~~~~~~~~~^~~~~~~~
…/testfile.c:13:29: error: passing argument 2 of 'strtof_l' from incompatible pointer type
13 | float f = strtof_l(s, end, loc);
| ^~~
| |
| char *
/usr/include/stdlib.h:420:42: note: expected 'char ** restrict' but argument is of type 'char *'
420 | char **__restrict __endptr, locale_t __loc)
| ~~~~~~~~~~~~~~~~~~^~~~~~~~
This means that the probe no longer tests is objective and always
fails.
Submitted upstream: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26927>
diff --git a/meson.build b/meson.build
index 35cc5f1cd5fd9079..1a5d2ba492be0b31 100644
--- a/meson.build
+++ b/meson.build
@@ -1425,8 +1425,8 @@ if cc.links('''
locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
const char *s = "1.0";
char *end;
- double d = strtod_l(s, end, loc);
- float f = strtof_l(s, end, loc);
+ double d = strtod_l(s, &end, loc);
+ float f = strtof_l(s, &end, loc);
freelocale(loc);
return 0;
}''',

View File

@ -0,0 +1,12 @@
diff -Naur a/meson.build b/meson.build
--- a/meson.build 2024-01-11 02:39:55.000000000 +0600
+++ b/meson.build 2024-06-20 19:40:32.151202733 +0600
@@ -882,7 +882,7 @@
pre_args += '-DALLOW_KCMP'
endif
-prog_python = import('python').find_installation('python3')
+prog_python = import('python').find_installation('python3.11')
has_mako = run_command(
prog_python, '-c',
'''

1836
extras/mesa/mesa.spec Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
diff -up mesa-22.3.3/src/gallium/drivers/radeonsi/driinfo_radeonsi.h.dma mesa-22.3.3/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
--- mesa-22.3.3/src/gallium/drivers/radeonsi/driinfo_radeonsi.h.dma 2023-01-25 06:17:54.993167334 +1000
+++ mesa-22.3.3/src/gallium/drivers/radeonsi/driinfo_radeonsi.h 2023-01-25 06:17:57.363203425 +1000
@@ -1,7 +1,6 @@
// DriConf options specific to radeonsi
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_ADAPTIVE_SYNC(true)
-DRI_CONF_MESA_GLTHREAD_DRIVER(true)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG

View File

@ -0,0 +1,39 @@
From a077c14f150f1c4f670dce381ac2eb548f1a4ac2 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Wed, 10 Jan 2024 17:24:30 +0100
Subject: [PATCH] zink: Fix resizable BAR detection logic
This was broken in two ways:
* When looking for the MAX biggest_ram it was actually comparing
a candidate against biggest_vis_ram
* mem_props.memoryTypes[] should be accessed with the memory type
index as found in heap_map
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10341
Cc: 23.3 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26979>
---
src/gallium/drivers/zink/zink_screen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 5a6d17cb4fa3..6697d7ab938c 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -3258,10 +3258,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
{
uint64_t biggest_vis_vram = 0;
for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL_VISIBLE]; i++)
- biggest_vis_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size);
+ biggest_vis_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE][i]].heapIndex].size);
uint64_t biggest_vram = 0;
for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]; i++)
- biggest_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size);
+ biggest_vram = MAX2(biggest_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[screen->heap_map[ZINK_HEAP_DEVICE_LOCAL][i]].heapIndex].size);
/* determine if vis vram is roughly equal to total vram */
if (biggest_vis_vram > biggest_vram * 0.9)
screen->resizable_bar = true;
--
GitLab