Refactor spec file, add Python 3.13 support (RHBZ#2300979)

This commit is contained in:
František Zatloukal 2024-07-30 13:19:59 +02:00
parent 6bbf7fbef8
commit 42b6f22017
2 changed files with 49 additions and 17 deletions

View File

@ -12,12 +12,6 @@
%define _lto_cflags %{nil}
%endif
# Disable LTO on aarch64 (borked since GCC14)
# https://bugzilla.redhat.com/show_bug.cgi?id=2260867
%ifarch aarch64
%define _lto_cflags %{nil}
%endif
# Big endian platforms
%ifarch ppc ppc64 s390 s390x
%global big_endian 1
@ -65,6 +59,9 @@ Patch20: spidermonkey_checks_disable.patch
# s390x/ppc64 fixes
Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch
# Tests Fixes
Patch30: tests-Replace-pipes-with-shlex-for-Python-3.13.patch
BuildRequires: cargo
%if !0%{?rhel}
BuildRequires: ccache
@ -106,10 +103,7 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%autosetup -n firefox-%{version}/js/src -N
pushd ../..
%autopatch -p1
%autosetup -n firefox-%{version} -p1
# Purge the bundled six library incompatible with Python 3.12
rm third_party/python/six/six.py
@ -122,6 +116,10 @@ mkdir third_party/python/looseversion
ln -s /usr/lib/python%{python3_version}/site-packages/looseversion/__init__.py third_party/python/looseversion/looseversion.py
echo "vendored:third_party/python/looseversion" >> python/sites/mach.txt
# Make the buildsys work with Python 3.13
sed -i 's|import pipes|import shlex|' third_party/python/virtualenv/virtualenv/discovery/cached_py_info.py
sed -i 's|pipes.quote(|shlex.quote(|' third_party/python/virtualenv/virtualenv/discovery/cached_py_info.py
# Copy out the LICENSE file
cp LICENSE js/src/
@ -136,22 +134,20 @@ rm -rf js/src/devtools/automation/variants/
rm -rf js/src/octane/
rm -rf js/src/ctypes/libffi/
popd
%build
%if 0%{?build_with_lto}
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
export CARGO_PROFILE_RELEASE_LTO=true
%endif
pushd js/src/
# Use bundled autoconf
export M4=m4
export AWK=awk
export AC_MACRODIR=/builddir/build/BUILD/firefox-%{version}/build/autoconf/
export AC_MACRODIR=../../build/autoconf/
sh ../../build/autoconf/autoconf.sh --localdir=/builddir/build/BUILD/firefox-%{version}/js/src configure.in > configure
sh ../../build/autoconf/autoconf.sh --localdir=. configure.in > configure
chmod +x configure
%configure \
--with-system-icu \
--with-system-zlib \
@ -168,6 +164,7 @@ chmod +x configure
%make_build
%install
pushd js/src/
%make_install
# Fix permissions
@ -221,6 +218,7 @@ ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
%check
pushd js/src/
# Run SpiderMonkey tests
%if 0%{?require_tests}
%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
@ -243,8 +241,8 @@ ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
%endif
%files
%doc README.html
%license LICENSE
%doc js/src/README.html
%license js/src/LICENSE
%{_libdir}/libmozjs-%{major}.so.0*
%files devel

View File

@ -0,0 +1,34 @@
From c5c18929b01d331fc095c16b260e222574da38ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
Date: Tue, 30 Jul 2024 12:59:41 +0200
Subject: [PATCH] tests: Replace pipes with shlex for Python 3.13
---
js/src/tests/lib/results.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py
index f9c7746..5d914c0 100644
--- a/js/src/tests/lib/results.py
+++ b/js/src/tests/lib/results.py
@@ -1,7 +1,7 @@
from __future__ import print_function
import json
-import pipes
+import shlex
import re
from .progressbar import NullProgressBar, ProgressBar
@@ -11,7 +11,7 @@ from .structuredlog import TestLogger
def escape_cmdline(args):
- return " ".join([pipes.quote(a) for a in args])
+ return " ".join([shlex.quote(a) for a in args])
class TestOutput:
--
2.45.2