From 3495cb2ae881111c53c26df457d4f5c14ef417af6a523594a24f48f0e6c39e97 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Thu, 23 Oct 2025 11:48:02 +0200 Subject: [PATCH] Convert to libalternatives, bsc#1245883 --- python-Twisted.changes | 10 ++++++++++ python-Twisted.spec | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/python-Twisted.changes b/python-Twisted.changes index 1775a79..f417575 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Aug 12 12:32:55 UTC 2025 - Markéta Machová + +- Make the libalternatives transition conditional + +------------------------------------------------------------------- +Wed Jun 25 12:21:34 UTC 2025 - Markéta Machová + +- Convert to libalternatives + ------------------------------------------------------------------- Tue Oct 29 18:00:39 UTC 2024 - Dirk Müller diff --git a/python-Twisted.spec b/python-Twisted.spec index ef9de59..24c4b1a 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -1,7 +1,7 @@ # # spec file for package python-Twisted # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,13 +18,17 @@ %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" -%bcond_without test %define psuffix -test +%bcond_without test %else -%bcond_with test %define psuffix %{nil} +%bcond_with test +%endif +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives %endif - %{?sle15_python_module_pythons} Name: python-Twisted%{psuffix} Version: 24.10.0 @@ -54,8 +58,9 @@ BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: git-core BuildRequires: python-rpm-macros -Requires(post): update-alternatives -Requires(postun): update-alternatives +# twisted[tls] is so common, let's keep it tied to the main package for the time being. +Requires: python-Twisted-tls = %{version} +BuildArch: noarch # SECTION install requires Requires: python-Automat >= 0.8.0 Requires: python-attrs >= 19.2.0 @@ -65,8 +70,13 @@ Requires: python-incremental >= 24.7.0 Requires: python-typing_extensions >= 3.6.5 Requires: python-zope.interface >= 4.4.2 # /SECTION -# twisted[tls] is so common, let's keep it tied to the main package for the time being. -Requires: python-Twisted-tls = %{version} +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif %if %{with test} BuildRequires: %{python_module Twisted-all_non_platform = %{version}} BuildRequires: %{python_module Twisted-conch_nacl = %{version}} @@ -75,7 +85,6 @@ BuildRequires: %{python_module hypothesis} # declared nowhere but required to pass 8 tests with timezone checks BuildRequires: %{python_module pytz} %endif -BuildArch: noarch %python_subpackages %description @@ -216,6 +225,8 @@ rm %{buildroot}%{_bindir}/mailmail %{buildroot}%{_mandir}/man1/mailmail.1 # no manpage for twist yet: %python_clone -a %{buildroot}%{_bindir}/twist +# group all the alternatives under one master +%python_group_libalternatives twistd cftp ckeygen conch pyhtmlizer tkconch trial twist %endif %if %{with test} @@ -239,11 +250,20 @@ export OPENSSL_CONF='' %python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m twisted.trial twisted %endif +%pre +%python_libalternatives_reset_alternative twistd +# these were master alternatives until Dec 2020 +for f in cftp ckeygen conch pyhtmlizer tkconch trial twist; do + %python_libalternatives_reset_alternative $f +done + %post +%if !%{with libalternatives} # these were master alternatives until Dec 2020. Remove before the install as slave links for f in cftp ckeygen conch pyhtmlizer tkconch trial twist; do (update-alternatives --quiet --list $f 2>&1 >/dev/null) && update-alternatives --quiet --remove-all $f done +%endif %{python_install_alternative twistd cftp ckeygen conch pyhtmlizer tkconch trial twist twistd.1 cftp.1 ckeygen.1 conch.1 pyhtmlizer.1 tkconch.1 trial.1}