From 3828f9dd1af3d2b21cb5757762ff96ecf7a6d015 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 9 Mar 2023 07:55:13 +0800 Subject: [PATCH] Modify rpmbuild directives for pyside compatibility. --- src/briefcase/platforms/linux/system.py | 28 ++++++---- .../linux/system/test_package__rpm.py | 51 +++++++++++-------- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/briefcase/platforms/linux/system.py b/src/briefcase/platforms/linux/system.py index bf8ef9b2f..17eb900e8 100644 --- a/src/briefcase/platforms/linux/system.py +++ b/src/briefcase/platforms/linux/system.py @@ -877,7 +877,23 @@ def _package_rpm(self, app: AppConfig, **kwargs): # tell you that it will remove the executable bit - # even if the executable bit isn't set. # We disable the processor that does this. - "%undefine __brp_mangle_shebangs", + "%global __brp_mangle_shebangs %{nil}", + # rpmbuild tries to strip binaries, which messes with + # binary wheels. Disable these checks. + "%global __brp_strip %{nil}", + "%global __brp_strip_static_archive %{nil}", + "%global __brp_strip_comment_note %{nil}", + # Disable RPATH checking, because check-rpaths can't deal with + # the structure of manylinux wheels + "%global __brp_check_rpaths %{nil}", + # Disable all the auto-detection that tries to magically + # determine requirements from the binaries + f"%global __requires_exclude_from ^%{{_libdir}}/{app.app_name}/.*$", + f"%global __provides_exclude_from ^%{{_libdir}}/{app.app_name}/.*$", + # Disable debug processing. + "%global _enable_debug_package 0", + "%global debug_package %{nil}", + "", # Base package metadata f"Name: {app.app_name}", f"Version: {app.version}", @@ -900,16 +916,6 @@ def _package_rpm(self, app: AppConfig, **kwargs): "%description", app.long_description, "", - # Disable all the auto-detection that tries to magically - # determine requirements from the binaries - f"%global __requires_exclude /usr/lib/{app.app_name}", - f"%global __provides_exclude /usr/lib/{app.app_name}", - # Disable all build post-processing so that binary - # wheels aren't munged. - "%global _enable_debug_package 0", - "%global debug_package %{nil}", - "%global __os_install_post /usr/lib/rpm/brp-compress %{nil}", - "", "%prep", "%autosetup", "", diff --git a/tests/platforms/linux/system/test_package__rpm.py b/tests/platforms/linux/system/test_package__rpm.py index 6e31ef443..032c9b717 100644 --- a/tests/platforms/linux/system/test_package__rpm.py +++ b/tests/platforms/linux/system/test_package__rpm.py @@ -168,7 +168,16 @@ def test_rpm_package(package_command, first_app_rpm, tmp_path): ) as f: assert f.read() == "\n".join( [ - "%undefine __brp_mangle_shebangs", + "%global __brp_mangle_shebangs %{nil}", + "%global __brp_strip %{nil}", + "%global __brp_strip_static_archive %{nil}", + "%global __brp_strip_comment_note %{nil}", + "%global __brp_check_rpaths %{nil}", + "%global __requires_exclude_from ^%{_libdir}/first-app/.*$", + "%global __provides_exclude_from ^%{_libdir}/first-app/.*$", + "%global _enable_debug_package 0", + "%global debug_package %{nil}", + "", "Name: first-app", "Version: 0.0.1", "Release: 1%{?dist}", @@ -186,12 +195,6 @@ def test_rpm_package(package_command, first_app_rpm, tmp_path): "Long description", "for the app", "", - "%global __requires_exclude /usr/lib/first-app", - "%global __provides_exclude /usr/lib/first-app", - "%global _enable_debug_package 0", - "%global debug_package %{nil}", - "%global __os_install_post /usr/lib/rpm/brp-compress %{nil}", - "", "%prep", "%autosetup", "", @@ -313,7 +316,16 @@ def test_rpm_re_package(package_command, first_app_rpm, tmp_path): ) as f: assert f.read() == "\n".join( [ - "%undefine __brp_mangle_shebangs", + "%global __brp_mangle_shebangs %{nil}", + "%global __brp_strip %{nil}", + "%global __brp_strip_static_archive %{nil}", + "%global __brp_strip_comment_note %{nil}", + "%global __brp_check_rpaths %{nil}", + "%global __requires_exclude_from ^%{_libdir}/first-app/.*$", + "%global __provides_exclude_from ^%{_libdir}/first-app/.*$", + "%global _enable_debug_package 0", + "%global debug_package %{nil}", + "", "Name: first-app", "Version: 0.0.1", "Release: 1%{?dist}", @@ -331,12 +343,6 @@ def test_rpm_re_package(package_command, first_app_rpm, tmp_path): "Long description", "for the app", "", - "%global __requires_exclude /usr/lib/first-app", - "%global __provides_exclude /usr/lib/first-app", - "%global _enable_debug_package 0", - "%global debug_package %{nil}", - "%global __os_install_post /usr/lib/rpm/brp-compress %{nil}", - "", "%prep", "%autosetup", "", @@ -477,7 +483,16 @@ def test_rpm_package_extra_requirements(package_command, first_app_rpm, tmp_path ) as f: assert f.read() == "\n".join( [ - "%undefine __brp_mangle_shebangs", + "%global __brp_mangle_shebangs %{nil}", + "%global __brp_strip %{nil}", + "%global __brp_strip_static_archive %{nil}", + "%global __brp_strip_comment_note %{nil}", + "%global __brp_check_rpaths %{nil}", + "%global __requires_exclude_from ^%{_libdir}/first-app/.*$", + "%global __provides_exclude_from ^%{_libdir}/first-app/.*$", + "%global _enable_debug_package 0", + "%global debug_package %{nil}", + "", "Name: first-app", "Version: 0.0.1", "Release: 42%{?dist}", @@ -497,12 +512,6 @@ def test_rpm_package_extra_requirements(package_command, first_app_rpm, tmp_path "Long description", "for the app", "", - "%global __requires_exclude /usr/lib/first-app", - "%global __provides_exclude /usr/lib/first-app", - "%global _enable_debug_package 0", - "%global debug_package %{nil}", - "%global __os_install_post /usr/lib/rpm/brp-compress %{nil}", - "", "%prep", "%autosetup", "",