From 400a9bbd5f7e4e8ea207718e48d42927aa5077279c83b02eff70cb8520846da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Wed, 10 Feb 2021 12:44:14 +0000 Subject: [PATCH] Accepting request 868375 from home:bnavigator:branches:GNOME:Factory - Fix split-provides for python3-avahi-gtk: avahi-python is provided/obsoleted by the primary python38-avahi package. avahi-discover is the only extra file provided here, not avahi-bookmarks - Build python bindings subpackages for all flavors * use the python-rpm-macros singlespec system: The macro %python_subpackages together with %python_subpackage_only creates the pythonXY-avahi bindings package for all python flavors on Tumbleweed (currently python36, python38) * Put the avahi-bookmarks command under updates-alternatives control to avoid package conflicts between flavors * outside of build_core, the build continues to use but not install everything in the primary python3 flavor. * For distros without multiple python3 flavors and/or older python-rpm-macros, the status quo is unchanged. OBS-URL: https://build.opensuse.org/request/show/868375 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/avahi?expand=0&rev=179 --- avahi-glib2.changes | 8 +++ avahi-glib2.spec | 115 ++++++++++++++++++++++++++++++++++---------- avahi-mono.spec | 115 ++++++++++++++++++++++++++++++++++---------- avahi-qt5.spec | 115 ++++++++++++++++++++++++++++++++++---------- avahi.changes | 15 ++++++ avahi.spec | 115 ++++++++++++++++++++++++++++++++++---------- 6 files changed, 383 insertions(+), 100 deletions(-) diff --git a/avahi-glib2.changes b/avahi-glib2.changes index 235459c..5f1efe2 100644 --- a/avahi-glib2.changes +++ b/avahi-glib2.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Jan 13 00:38:53 UTC 2021 - Benjamin Greiner + +- Fix split-provides for python3-avahi-gtk: avahi-python is + provided/obsoleted by the primary python38-avahi package. + avahi-discover is the only extra file provided here, not + avahi-bookmarks + ------------------------------------------------------------------- Mon Aug 31 10:21:27 UTC 2020 - Antonio Larrosa diff --git a/avahi-glib2.spec b/avahi-glib2.spec index 0fe1d59..354d058 100644 --- a/avahi-glib2.spec +++ b/avahi-glib2.spec @@ -1,7 +1,7 @@ # # spec file for package avahi-glib2 # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -39,6 +39,9 @@ %if %{build_glib2} %define debug_package_requires libavahi-ui%{avahi_ui_sover} = %{version}-%{release} %endif +%{?!python_module:%define python_module() python3-%{**}} +%define skip_python2 1 +%define oldpython python Name: avahi-glib2 Version: 0.8 Release: 0 @@ -83,10 +86,6 @@ BuildRequires: libexpat-devel # libtool is needed to build all variants: bootstrap is unconditional in the build section BuildRequires: libtool BuildRequires: pkgconfig -# Even if we are not building python bindings, we need python to build service types database: -BuildRequires: python3-dbm -BuildRequires: python3-dbus-python -BuildRequires: python3-devel BuildRequires: translation-update-upstream # FIXME: on upgrade, ensure to verify if -DGTK_DISABLE_DEPRECATED=1 can remain in avahi=ui/Makefile.am (GtkStock deprecated with GTK+ 3.9.10). %if !%{build_glib2} && !%{build_mono} && !%{build_qt5} @@ -101,12 +100,8 @@ BuildRequires: dbus-1-devel BuildRequires: doxygen BuildRequires: graphviz BuildRequires: libevent-devel >= 2.1.5 -BuildRequires: python3-dbm BuildRequires: zlib-devel BuildRequires: pkgconfig(systemd) -# For python bindings and utilities: -#BuildRequires: python3-dbus-python -#Requires: dbus-1 Requires: nss-mdns Requires(pre): shadow # @@ -141,6 +136,27 @@ BuildRequires: libavahi-devel = %{version} BuildRequires: pkgconfig(Qt5Core) Requires: libavahi-client%{avahi_client_sover} >= %{version} %endif +%if %{build_core} +BuildRequires: %{python_module dbm} +BuildRequires: %{python_module dbus-python} +BuildRequires: python-rpm-macros +%if 0%{?python38_version_nodots} +# if python multiflavor is in place yet, use it to generate subpackages +%define python_subpackage_only 1 +%python_subpackages +%else +# Same defaults for all build targets +%define python_sitelib %python3_sitelib +%define python_files() -n python3-%{**} +%endif +%else +# Even if we don't install the python bindings outside of build_core, we need the default python3 to build the service types database: +%define pythons python3 +BuildRequires: python3-dbm +BuildRequires: python3-dbus-python +# avoid error from unused python_subpackages +%define python_files() -n python3-%{**} +%endif %description Avahi is an implementation of the DNS Service Discovery and Multicast @@ -224,6 +240,26 @@ Howl compatibility layer for Avahi. Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%if 0%{?python_subpackage_only} +%package -n python-avahi +Summary: A set of Avahi utilities written in Python +Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python-Twisted +Requires: python-dbm +Requires: python-dbus-python +# Old name used for <= 10.3: +%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" +Provides: avahi-python = %{version} +Obsoletes: %{oldpython}-avahi < %{version} +Obsoletes: avahi-python < %{version} +%endif + +%description -n python-avahi +Avahi is an implementation of the DNS Service Discovery and Multicast +DNS specifications for Zeroconf Computing. + +%else %package -n python3-avahi Summary: A set of Avahi utilities written in Python Group: Development/Languages/Python @@ -234,11 +270,12 @@ Requires: python3-dbus-python # Old name used for <= 10.3: Provides: avahi-python = %{version} Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi +Obsoletes: python-avahi < %{version} %description -n python3-avahi Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%endif %package autoipd Summary: IPv4LL Service for Zeroconf and Bonjour @@ -365,6 +402,7 @@ Obsoletes: avahi-glib2-utils-gtk < %{version} Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +# This is the avahi-discover command, only provided for the primary python3 flavor %package -n python3-avahi-gtk Summary: A set of Avahi utilities written in Python Using python-gtk Group: Development/Languages/Python @@ -372,13 +410,10 @@ Requires: python3-avahi = %{version} Requires: python3-gobject Requires(post): coreutils Requires(postun): coreutils -# Old name used for <= 10.3: -Provides: avahi-python = %{version} -Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi-gtk +Provides: %{oldpython}-avahi-gtk = %{version} +Obsoletes: %{oldpython}-avahi-gtk < %{version} # Provide split-provides for update from <= 11.0: -Provides: python-avahi:%{_bindir}/avahi-bookmarks -Obsoletes: python-avahi < %{version} +Provides: %{oldpython}-avahi:%{_bindir}/avahi-discover %description -n python3-avahi-gtk Avahi is an implementation of the DNS Service Discovery and Multicast @@ -502,7 +537,8 @@ sed -i "s:-DGTK_DISABLE_DEPRECATED=1::" avahi-ui/Makefile.am %build autoreconf -f -i intltoolize -f -export PYTHON=%{_bindir}/python3 +%{python_expand # configure for every python flavor +export PYTHON=%{_bindir}/$python %configure\ --libexecdir=%{_prefix}/lib\ --disable-static\ @@ -547,6 +583,10 @@ export PYTHON=%{_bindir}/python3 --with-avahi-priv-access-group=avahi\ --with-autoipd-user=avahi-autoipd\ --with-autoipd-group=avahi-autoipd + +cp -r avahi-python avahi-python-%{$python_bin_suffix} +} + %if %{build_glib2} && !%{build_core} for DIR in avahi-glib avahi-gobject avahi-ui avahi-discover-standalone avahi-python man ; do cd $DIR @@ -559,6 +599,13 @@ cd avahi-sharp %make_build cd ../avahi-ui-sharp %endif +%if %{build_core} +%{python_expand # build for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_build +cd .. +} +%endif %make_build %install @@ -586,6 +633,13 @@ cd .. %make_build install-pkgconfigDATA DESTDIR=%{buildroot} %endif %if %{build_core} +%{python_expand # install for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_install +cd .. +} +%python_clone -a %{buildroot}%{_bindir}/avahi-bookmarks +%python_clone -a %{buildroot}%{_mandir}/man1/avahi-bookmarks.1 # do not remove this unless you plan to fix _all_ the references to # it. all (multiple) previous attempts have failed already #rm "%{buildroot}/%{_libdir}/libavahi-common.la" @@ -736,6 +790,21 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %desktop_database_post %if %{build_core} +%if 0%{?python_subpackage_only} +# this is rewritten by python_subpackages into the appropriate flavor +%post -n python-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python-avahi +%python_uninstall_alternative avahi-bookmarks +%else +%post -n python3-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python3-avahi +%python_uninstall_alternative avahi-bookmarks +%endif + %files %license LICENSE %doc docs/* @@ -794,14 +863,10 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %files -n libhowl%{avahi_libhowl_sover} %{_libdir}/libhowl.so.* -%files -n python3-avahi -%{_bindir}/avahi-bookmarks -%{_mandir}/man1/avahi-bookmarks.1%{ext_man} -%dir %{python3_sitelib}/avahi -%{python3_sitelib}/avahi/__init__.py* -%dir %{python3_sitelib}/avahi/__pycache__ -%{python3_sitelib}/avahi/__pycache__/__init__* -%{python3_sitelib}/avahi/ServiceTypeDatabase.py +%files %{python_files avahi} +%python_alternative %{_bindir}/avahi-bookmarks +%python_alternative %{_mandir}/man1/avahi-bookmarks.1%{ext_man} +%{python_sitelib}/avahi %files autoipd %doc avahi-autoipd/README.SUSE diff --git a/avahi-mono.spec b/avahi-mono.spec index 2eb119d..c733ea1 100644 --- a/avahi-mono.spec +++ b/avahi-mono.spec @@ -1,7 +1,7 @@ # # spec file for package avahi-mono # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -39,6 +39,9 @@ %if %{build_glib2} %define debug_package_requires libavahi-ui%{avahi_ui_sover} = %{version}-%{release} %endif +%{?!python_module:%define python_module() python3-%{**}} +%define skip_python2 1 +%define oldpython python Name: avahi-mono Version: 0.8 Release: 0 @@ -83,10 +86,6 @@ BuildRequires: libexpat-devel # libtool is needed to build all variants: bootstrap is unconditional in the build section BuildRequires: libtool BuildRequires: pkgconfig -# Even if we are not building python bindings, we need python to build service types database: -BuildRequires: python3-dbm -BuildRequires: python3-dbus-python -BuildRequires: python3-devel BuildRequires: translation-update-upstream # FIXME: on upgrade, ensure to verify if -DGTK_DISABLE_DEPRECATED=1 can remain in avahi=ui/Makefile.am (GtkStock deprecated with GTK+ 3.9.10). %if !%{build_glib2} && !%{build_mono} && !%{build_qt5} @@ -101,12 +100,8 @@ BuildRequires: dbus-1-devel BuildRequires: doxygen BuildRequires: graphviz BuildRequires: libevent-devel >= 2.1.5 -BuildRequires: python3-dbm BuildRequires: zlib-devel BuildRequires: pkgconfig(systemd) -# For python bindings and utilities: -#BuildRequires: python3-dbus-python -#Requires: dbus-1 Requires: nss-mdns Requires(pre): shadow # @@ -141,6 +136,27 @@ BuildRequires: libavahi-devel = %{version} BuildRequires: pkgconfig(Qt5Core) Requires: libavahi-client%{avahi_client_sover} >= %{version} %endif +%if %{build_core} +BuildRequires: %{python_module dbm} +BuildRequires: %{python_module dbus-python} +BuildRequires: python-rpm-macros +%if 0%{?python38_version_nodots} +# if python multiflavor is in place yet, use it to generate subpackages +%define python_subpackage_only 1 +%python_subpackages +%else +# Same defaults for all build targets +%define python_sitelib %python3_sitelib +%define python_files() -n python3-%{**} +%endif +%else +# Even if we don't install the python bindings outside of build_core, we need the default python3 to build the service types database: +%define pythons python3 +BuildRequires: python3-dbm +BuildRequires: python3-dbus-python +# avoid error from unused python_subpackages +%define python_files() -n python3-%{**} +%endif %description This package provides Mono bindings for avahi. Avahi is an @@ -223,6 +239,26 @@ Howl compatibility layer for Avahi. Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%if 0%{?python_subpackage_only} +%package -n python-avahi +Summary: A set of Avahi utilities written in Python +Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python-Twisted +Requires: python-dbm +Requires: python-dbus-python +# Old name used for <= 10.3: +%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" +Provides: avahi-python = %{version} +Obsoletes: %{oldpython}-avahi < %{version} +Obsoletes: avahi-python < %{version} +%endif + +%description -n python-avahi +Avahi is an implementation of the DNS Service Discovery and Multicast +DNS specifications for Zeroconf Computing. + +%else %package -n python3-avahi Summary: A set of Avahi utilities written in Python Group: Development/Languages/Python @@ -233,11 +269,12 @@ Requires: python3-dbus-python # Old name used for <= 10.3: Provides: avahi-python = %{version} Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi +Obsoletes: python-avahi < %{version} %description -n python3-avahi Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%endif %package autoipd Summary: IPv4LL Service for Zeroconf and Bonjour @@ -364,6 +401,7 @@ Obsoletes: avahi-glib2-utils-gtk < %{version} Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +# This is the avahi-discover command, only provided for the primary python3 flavor %package -n python3-avahi-gtk Summary: A set of Avahi utilities written in Python Using python-gtk Group: Development/Languages/Python @@ -371,13 +409,10 @@ Requires: python3-avahi = %{version} Requires: python3-gobject Requires(post): coreutils Requires(postun): coreutils -# Old name used for <= 10.3: -Provides: avahi-python = %{version} -Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi-gtk +Provides: %{oldpython}-avahi-gtk = %{version} +Obsoletes: %{oldpython}-avahi-gtk < %{version} # Provide split-provides for update from <= 11.0: -Provides: python-avahi:%{_bindir}/avahi-bookmarks -Obsoletes: python-avahi < %{version} +Provides: %{oldpython}-avahi:%{_bindir}/avahi-discover %description -n python3-avahi-gtk Avahi is an implementation of the DNS Service Discovery and Multicast @@ -502,7 +537,8 @@ sed -i "s:-DGTK_DISABLE_DEPRECATED=1::" avahi-ui/Makefile.am %build autoreconf -f -i intltoolize -f -export PYTHON=%{_bindir}/python3 +%{python_expand # configure for every python flavor +export PYTHON=%{_bindir}/$python %configure\ --libexecdir=%{_prefix}/lib\ --disable-static\ @@ -547,6 +583,10 @@ export PYTHON=%{_bindir}/python3 --with-avahi-priv-access-group=avahi\ --with-autoipd-user=avahi-autoipd\ --with-autoipd-group=avahi-autoipd + +cp -r avahi-python avahi-python-%{$python_bin_suffix} +} + %if %{build_glib2} && !%{build_core} for DIR in avahi-glib avahi-gobject avahi-ui avahi-discover-standalone avahi-python man ; do cd $DIR @@ -559,6 +599,13 @@ cd avahi-sharp %make_build cd ../avahi-ui-sharp %endif +%if %{build_core} +%{python_expand # build for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_build +cd .. +} +%endif %make_build %install @@ -586,6 +633,13 @@ cd .. %make_build install-pkgconfigDATA DESTDIR=%{buildroot} %endif %if %{build_core} +%{python_expand # install for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_install +cd .. +} +%python_clone -a %{buildroot}%{_bindir}/avahi-bookmarks +%python_clone -a %{buildroot}%{_mandir}/man1/avahi-bookmarks.1 # do not remove this unless you plan to fix _all_ the references to # it. all (multiple) previous attempts have failed already #rm "%{buildroot}/%{_libdir}/libavahi-common.la" @@ -736,6 +790,21 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %desktop_database_post %if %{build_core} +%if 0%{?python_subpackage_only} +# this is rewritten by python_subpackages into the appropriate flavor +%post -n python-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python-avahi +%python_uninstall_alternative avahi-bookmarks +%else +%post -n python3-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python3-avahi +%python_uninstall_alternative avahi-bookmarks +%endif + %files %license LICENSE %doc docs/* @@ -794,14 +863,10 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %files -n libhowl%{avahi_libhowl_sover} %{_libdir}/libhowl.so.* -%files -n python3-avahi -%{_bindir}/avahi-bookmarks -%{_mandir}/man1/avahi-bookmarks.1%{ext_man} -%dir %{python3_sitelib}/avahi -%{python3_sitelib}/avahi/__init__.py* -%dir %{python3_sitelib}/avahi/__pycache__ -%{python3_sitelib}/avahi/__pycache__/__init__* -%{python3_sitelib}/avahi/ServiceTypeDatabase.py +%files %{python_files avahi} +%python_alternative %{_bindir}/avahi-bookmarks +%python_alternative %{_mandir}/man1/avahi-bookmarks.1%{ext_man} +%{python_sitelib}/avahi %files autoipd %doc avahi-autoipd/README.SUSE diff --git a/avahi-qt5.spec b/avahi-qt5.spec index 64cffc0..dc65e91 100644 --- a/avahi-qt5.spec +++ b/avahi-qt5.spec @@ -1,7 +1,7 @@ # # spec file for package avahi-qt5 # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -39,6 +39,9 @@ %if %{build_glib2} %define debug_package_requires libavahi-ui%{avahi_ui_sover} = %{version}-%{release} %endif +%{?!python_module:%define python_module() python3-%{**}} +%define skip_python2 1 +%define oldpython python Name: avahi-qt5 Version: 0.8 Release: 0 @@ -83,10 +86,6 @@ BuildRequires: libexpat-devel # libtool is needed to build all variants: bootstrap is unconditional in the build section BuildRequires: libtool BuildRequires: pkgconfig -# Even if we are not building python bindings, we need python to build service types database: -BuildRequires: python3-dbm -BuildRequires: python3-dbus-python -BuildRequires: python3-devel BuildRequires: translation-update-upstream # FIXME: on upgrade, ensure to verify if -DGTK_DISABLE_DEPRECATED=1 can remain in avahi=ui/Makefile.am (GtkStock deprecated with GTK+ 3.9.10). %if !%{build_glib2} && !%{build_mono} && !%{build_qt5} @@ -101,12 +100,8 @@ BuildRequires: dbus-1-devel BuildRequires: doxygen BuildRequires: graphviz BuildRequires: libevent-devel >= 2.1.5 -BuildRequires: python3-dbm BuildRequires: zlib-devel BuildRequires: pkgconfig(systemd) -# For python bindings and utilities: -#BuildRequires: python3-dbus-python -#Requires: dbus-1 Requires: nss-mdns Requires(pre): shadow # @@ -141,6 +136,27 @@ BuildRequires: libavahi-devel = %{version} BuildRequires: pkgconfig(Qt5Core) Requires: libavahi-client%{avahi_client_sover} >= %{version} %endif +%if %{build_core} +BuildRequires: %{python_module dbm} +BuildRequires: %{python_module dbus-python} +BuildRequires: python-rpm-macros +%if 0%{?python38_version_nodots} +# if python multiflavor is in place yet, use it to generate subpackages +%define python_subpackage_only 1 +%python_subpackages +%else +# Same defaults for all build targets +%define python_sitelib %python3_sitelib +%define python_files() -n python3-%{**} +%endif +%else +# Even if we don't install the python bindings outside of build_core, we need the default python3 to build the service types database: +%define pythons python3 +BuildRequires: python3-dbm +BuildRequires: python3-dbus-python +# avoid error from unused python_subpackages +%define python_files() -n python3-%{**} +%endif %description Avahi is an implementation of the DNS Service Discovery and Multicast @@ -224,6 +240,26 @@ Howl compatibility layer for Avahi. Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%if 0%{?python_subpackage_only} +%package -n python-avahi +Summary: A set of Avahi utilities written in Python +Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python-Twisted +Requires: python-dbm +Requires: python-dbus-python +# Old name used for <= 10.3: +%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" +Provides: avahi-python = %{version} +Obsoletes: %{oldpython}-avahi < %{version} +Obsoletes: avahi-python < %{version} +%endif + +%description -n python-avahi +Avahi is an implementation of the DNS Service Discovery and Multicast +DNS specifications for Zeroconf Computing. + +%else %package -n python3-avahi Summary: A set of Avahi utilities written in Python Group: Development/Languages/Python @@ -234,11 +270,12 @@ Requires: python3-dbus-python # Old name used for <= 10.3: Provides: avahi-python = %{version} Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi +Obsoletes: python-avahi < %{version} %description -n python3-avahi Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%endif %package autoipd Summary: IPv4LL Service for Zeroconf and Bonjour @@ -365,6 +402,7 @@ Obsoletes: avahi-glib2-utils-gtk < %{version} Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +# This is the avahi-discover command, only provided for the primary python3 flavor %package -n python3-avahi-gtk Summary: A set of Avahi utilities written in Python Using python-gtk Group: Development/Languages/Python @@ -372,13 +410,10 @@ Requires: python3-avahi = %{version} Requires: python3-gobject Requires(post): coreutils Requires(postun): coreutils -# Old name used for <= 10.3: -Provides: avahi-python = %{version} -Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi-gtk +Provides: %{oldpython}-avahi-gtk = %{version} +Obsoletes: %{oldpython}-avahi-gtk < %{version} # Provide split-provides for update from <= 11.0: -Provides: python-avahi:%{_bindir}/avahi-bookmarks -Obsoletes: python-avahi < %{version} +Provides: %{oldpython}-avahi:%{_bindir}/avahi-discover %description -n python3-avahi-gtk Avahi is an implementation of the DNS Service Discovery and Multicast @@ -502,7 +537,8 @@ sed -i "s:-DGTK_DISABLE_DEPRECATED=1::" avahi-ui/Makefile.am %build autoreconf -f -i intltoolize -f -export PYTHON=%{_bindir}/python3 +%{python_expand # configure for every python flavor +export PYTHON=%{_bindir}/$python %configure\ --libexecdir=%{_prefix}/lib\ --disable-static\ @@ -547,6 +583,10 @@ export PYTHON=%{_bindir}/python3 --with-avahi-priv-access-group=avahi\ --with-autoipd-user=avahi-autoipd\ --with-autoipd-group=avahi-autoipd + +cp -r avahi-python avahi-python-%{$python_bin_suffix} +} + %if %{build_glib2} && !%{build_core} for DIR in avahi-glib avahi-gobject avahi-ui avahi-discover-standalone avahi-python man ; do cd $DIR @@ -559,6 +599,13 @@ cd avahi-sharp %make_build cd ../avahi-ui-sharp %endif +%if %{build_core} +%{python_expand # build for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_build +cd .. +} +%endif %make_build %install @@ -586,6 +633,13 @@ cd .. %make_build install-pkgconfigDATA DESTDIR=%{buildroot} %endif %if %{build_core} +%{python_expand # install for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_install +cd .. +} +%python_clone -a %{buildroot}%{_bindir}/avahi-bookmarks +%python_clone -a %{buildroot}%{_mandir}/man1/avahi-bookmarks.1 # do not remove this unless you plan to fix _all_ the references to # it. all (multiple) previous attempts have failed already #rm "%{buildroot}/%{_libdir}/libavahi-common.la" @@ -736,6 +790,21 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %desktop_database_post %if %{build_core} +%if 0%{?python_subpackage_only} +# this is rewritten by python_subpackages into the appropriate flavor +%post -n python-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python-avahi +%python_uninstall_alternative avahi-bookmarks +%else +%post -n python3-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python3-avahi +%python_uninstall_alternative avahi-bookmarks +%endif + %files %license LICENSE %doc docs/* @@ -794,14 +863,10 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %files -n libhowl%{avahi_libhowl_sover} %{_libdir}/libhowl.so.* -%files -n python3-avahi -%{_bindir}/avahi-bookmarks -%{_mandir}/man1/avahi-bookmarks.1%{ext_man} -%dir %{python3_sitelib}/avahi -%{python3_sitelib}/avahi/__init__.py* -%dir %{python3_sitelib}/avahi/__pycache__ -%{python3_sitelib}/avahi/__pycache__/__init__* -%{python3_sitelib}/avahi/ServiceTypeDatabase.py +%files %{python_files avahi} +%python_alternative %{_bindir}/avahi-bookmarks +%python_alternative %{_mandir}/man1/avahi-bookmarks.1%{ext_man} +%{python_sitelib}/avahi %files autoipd %doc avahi-autoipd/README.SUSE diff --git a/avahi.changes b/avahi.changes index 6705160..5582482 100644 --- a/avahi.changes +++ b/avahi.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Sun Jan 31 23:54:15 UTC 2021 - Ben Greiner + +- Build python bindings subpackages for all flavors + * use the python-rpm-macros singlespec system: The macro + %python_subpackages together with %python_subpackage_only + creates the pythonXY-avahi bindings package for all python + flavors on Tumbleweed (currently python36, python38) + * Put the avahi-bookmarks command under updates-alternatives + control to avoid package conflicts between flavors + * outside of build_core, the build continues to use but not + install everything in the primary python3 flavor. + * For distros without multiple python3 flavors and/or older + python-rpm-macros, the status quo is unchanged. + ------------------------------------------------------------------- Wed Sep 2 10:11:46 UTC 2020 - Antonio Larrosa diff --git a/avahi.spec b/avahi.spec index 2c2cc0b..d06031c 100644 --- a/avahi.spec +++ b/avahi.spec @@ -1,7 +1,7 @@ # # spec file for package avahi # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -41,6 +41,9 @@ %if %{build_glib2} %define debug_package_requires libavahi-ui%{avahi_ui_sover} = %{version}-%{release} %endif +%{?!python_module:%define python_module() python3-%{**}} +%define skip_python2 1 +%define oldpython python Name: avahi Version: 0.8 Release: 0 @@ -85,10 +88,6 @@ BuildRequires: libexpat-devel # libtool is needed to build all variants: bootstrap is unconditional in the build section BuildRequires: libtool BuildRequires: pkgconfig -# Even if we are not building python bindings, we need python to build service types database: -BuildRequires: python3-dbm -BuildRequires: python3-dbus-python -BuildRequires: python3-devel BuildRequires: translation-update-upstream # FIXME: on upgrade, ensure to verify if -DGTK_DISABLE_DEPRECATED=1 can remain in avahi=ui/Makefile.am (GtkStock deprecated with GTK+ 3.9.10). %if !%{build_glib2} && !%{build_mono} && !%{build_qt5} @@ -103,12 +102,8 @@ BuildRequires: dbus-1-devel BuildRequires: doxygen BuildRequires: graphviz BuildRequires: libevent-devel >= 2.1.5 -BuildRequires: python3-dbm BuildRequires: zlib-devel BuildRequires: pkgconfig(systemd) -# For python bindings and utilities: -#BuildRequires: python3-dbus-python -#Requires: dbus-1 Requires: nss-mdns Requires(pre): shadow # @@ -143,6 +138,27 @@ BuildRequires: libavahi-devel = %{version} BuildRequires: pkgconfig(Qt5Core) Requires: libavahi-client%{avahi_client_sover} >= %{version} %endif +%if %{build_core} +BuildRequires: %{python_module dbm} +BuildRequires: %{python_module dbus-python} +BuildRequires: python-rpm-macros +%if 0%{?python38_version_nodots} +# if python multiflavor is in place yet, use it to generate subpackages +%define python_subpackage_only 1 +%python_subpackages +%else +# Same defaults for all build targets +%define python_sitelib %python3_sitelib +%define python_files() -n python3-%{**} +%endif +%else +# Even if we don't install the python bindings outside of build_core, we need the default python3 to build the service types database: +%define pythons python3 +BuildRequires: python3-dbm +BuildRequires: python3-dbus-python +# avoid error from unused python_subpackages +%define python_files() -n python3-%{**} +%endif %description Avahi is an implementation of the DNS Service Discovery and Multicast @@ -226,6 +242,26 @@ Howl compatibility layer for Avahi. Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%if 0%{?python_subpackage_only} +%package -n python-avahi +Summary: A set of Avahi utilities written in Python +Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python-Twisted +Requires: python-dbm +Requires: python-dbus-python +# Old name used for <= 10.3: +%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3" +Provides: avahi-python = %{version} +Obsoletes: %{oldpython}-avahi < %{version} +Obsoletes: avahi-python < %{version} +%endif + +%description -n python-avahi +Avahi is an implementation of the DNS Service Discovery and Multicast +DNS specifications for Zeroconf Computing. + +%else %package -n python3-avahi Summary: A set of Avahi utilities written in Python Group: Development/Languages/Python @@ -236,11 +272,12 @@ Requires: python3-dbus-python # Old name used for <= 10.3: Provides: avahi-python = %{version} Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi +Obsoletes: python-avahi < %{version} %description -n python3-avahi Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +%endif %package autoipd Summary: IPv4LL Service for Zeroconf and Bonjour @@ -367,6 +404,7 @@ Obsoletes: avahi-glib2-utils-gtk < %{version} Avahi is an implementation of the DNS Service Discovery and Multicast DNS specifications for Zeroconf Computing. +# This is the avahi-discover command, only provided for the primary python3 flavor %package -n python3-avahi-gtk Summary: A set of Avahi utilities written in Python Using python-gtk Group: Development/Languages/Python @@ -374,13 +412,10 @@ Requires: python3-avahi = %{version} Requires: python3-gobject Requires(post): coreutils Requires(postun): coreutils -# Old name used for <= 10.3: -Provides: avahi-python = %{version} -Obsoletes: avahi-python < %{version} -Obsoletes: python-avahi-gtk +Provides: %{oldpython}-avahi-gtk = %{version} +Obsoletes: %{oldpython}-avahi-gtk < %{version} # Provide split-provides for update from <= 11.0: -Provides: python-avahi:%{_bindir}/avahi-bookmarks -Obsoletes: python-avahi < %{version} +Provides: %{oldpython}-avahi:%{_bindir}/avahi-discover %description -n python3-avahi-gtk Avahi is an implementation of the DNS Service Discovery and Multicast @@ -497,7 +532,8 @@ sed -i "s:-DGTK_DISABLE_DEPRECATED=1::" avahi-ui/Makefile.am %build autoreconf -f -i intltoolize -f -export PYTHON=%{_bindir}/python3 +%{python_expand # configure for every python flavor +export PYTHON=%{_bindir}/$python %configure\ --libexecdir=%{_prefix}/lib\ --disable-static\ @@ -542,6 +578,10 @@ export PYTHON=%{_bindir}/python3 --with-avahi-priv-access-group=avahi\ --with-autoipd-user=avahi-autoipd\ --with-autoipd-group=avahi-autoipd + +cp -r avahi-python avahi-python-%{$python_bin_suffix} +} + %if %{build_glib2} && !%{build_core} for DIR in avahi-glib avahi-gobject avahi-ui avahi-discover-standalone avahi-python man ; do cd $DIR @@ -554,6 +594,13 @@ cd avahi-sharp %make_build cd ../avahi-ui-sharp %endif +%if %{build_core} +%{python_expand # build for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_build +cd .. +} +%endif %make_build %install @@ -581,6 +628,13 @@ cd .. %make_build install-pkgconfigDATA DESTDIR=%{buildroot} %endif %if %{build_core} +%{python_expand # install for every python flavor +cd avahi-python-%{$python_bin_suffix} +%make_install +cd .. +} +%python_clone -a %{buildroot}%{_bindir}/avahi-bookmarks +%python_clone -a %{buildroot}%{_mandir}/man1/avahi-bookmarks.1 # do not remove this unless you plan to fix _all_ the references to # it. all (multiple) previous attempts have failed already #rm "%{buildroot}/%{_libdir}/libavahi-common.la" @@ -731,6 +785,21 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %desktop_database_post %if %{build_core} +%if 0%{?python_subpackage_only} +# this is rewritten by python_subpackages into the appropriate flavor +%post -n python-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python-avahi +%python_uninstall_alternative avahi-bookmarks +%else +%post -n python3-avahi +%python_install_alternative avahi-bookmarks avahi-bookmarks.1 + +%postun -n python3-avahi +%python_uninstall_alternative avahi-bookmarks +%endif + %files %license LICENSE %doc docs/* @@ -789,14 +858,10 @@ find %{_localstatedir}/lib/avahi-autoipd -user avahi -exec chown avahi-autoipd:a %files -n libhowl%{avahi_libhowl_sover} %{_libdir}/libhowl.so.* -%files -n python3-avahi -%{_bindir}/avahi-bookmarks -%{_mandir}/man1/avahi-bookmarks.1%{ext_man} -%dir %{python3_sitelib}/avahi -%{python3_sitelib}/avahi/__init__.py* -%dir %{python3_sitelib}/avahi/__pycache__ -%{python3_sitelib}/avahi/__pycache__/__init__* -%{python3_sitelib}/avahi/ServiceTypeDatabase.py +%files %{python_files avahi} +%python_alternative %{_bindir}/avahi-bookmarks +%python_alternative %{_mandir}/man1/avahi-bookmarks.1%{ext_man} +%{python_sitelib}/avahi %files autoipd %doc avahi-autoipd/README.SUSE