rpm: Specfile cleanup

Fix some deprecated and obsolete syntax from the rpm specfile that
modern distributions complain about:
Don't specify the BuildRoot
Don't have a %clean section
Don't remove the BuildRoot at the start of %install
Don't repeat Name in summary
Version the Obsoletes
Have a %build section
Escape macros in changelog
Remove comment about user setting _smp_mflags since rpm does that
automatically better now
Be consistent about spaces and tabs (tabs are used)
This commit is contained in:
John Thacker 2022-04-24 12:20:33 -04:00
parent 35cc7f43ab
commit 858a670d34
1 changed files with 18 additions and 21 deletions

View File

@ -35,7 +35,7 @@
%global package_version @VERSION@
Summary: Wireshark is the world's foremost protocol analyzer
Summary: The world's foremost protocol analyzer
Name: wireshark
Version: @RPM_VERSION@
Release: 1
@ -47,40 +47,38 @@ Source: https://www.wireshark.org/download/src/%{name}-%{package_version}.tar.x
URL: https://www.wireshark.org/
Packager: Gerald Combs <gerald[AT]wireshark.org>
BuildRoot: /tmp/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: cmake >= 3.10
BuildRequires: python3
BuildRequires: python3
BuildRequires: gcc
BuildRequires: perl
BuildRequires: flex
%if %{with ninja}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: ninja-build
BuildRequires: ninja-build
%else
BuildRequires: ninja
BuildRequires: ninja
%endif
%endif
# XXX We always require Asciidoctor for packaging builds as of 84ab55cf75,
# unfortunately it's not evenly distributed across distros.
# Fedora & CentOS 7: rubygem-asciidoctor
# CentOS 8: <no package?>
# CentOS 8: <no package? - https://bugzilla.redhat.com/show_bug.cgi?id=1820896>
# openSUSE 15.3: ruby2.5-rubygem-asciidoctor
# SLES 12 SP5: ruby2.1-rubygem-asciidoctor
# All of the packages provide this, so we can rely on it:
%if ! 0%{?el8}
BuildRequires: /usr/bin/asciidoctor
BuildRequires: /usr/bin/asciidoctor
%endif
# No CentOS 8 package, so we install it from rubygems directly, but that
# means the package manager doesn't know about it and we can't require it.
# For the HTML guides, we need xsltproc, and the docbook stylesheets
%if %{with guides}
BuildRequires: /usr/bin/xsltproc
BuildRequires: /usr/bin/xsltproc
%if 0%{?suse_version}
BuildRequires: docbook-xsl-stylesheets
BuildRequires: docbook-xsl-stylesheets
%else
BuildRequires: docbook-style-xsl
BuildRequires: docbook-style-xsl
%endif
%endif
@ -204,8 +202,7 @@ Wireshark. A Qt graphical user interface is packaged separately.
%package qt
Summary: Wireshark's Qt-based GUI
Group: Applications/Internet
# XXX Recent versions of rpm (Fedora 33 et al.) warn about unversioned "Obsoletes".
Obsoletes: wireshark-gnome wireshark-gtk
Obsoletes: wireshark-gnome < %{version} wireshark-gtk < %{version}
Requires: %{name} = %{version}-%{release}
BuildRequires: gcc-c++
%if 0%{?suse_version}
@ -248,6 +245,7 @@ development of Wireshark scripts and plugins.
%prep
%setup -q -n %{name}-%{package_version}
%build
# The SUSE macros for cmake and ninja depend upon _bindir, which depends
# on _prefix (and is thus wrong if _prefix is anything other than /usr).
# Set _bindir to the correct value regardless of _prefix.
@ -358,8 +356,6 @@ development of Wireshark scripts and plugins.
%if %{with ninja}
%ninja_build
%else
# Suggestion: put this in your ~/.rpmmacros (without the hash sign, of course):
# %_smp_mflags -j %(grep -c processor /proc/cpuinfo)
%if (0%{?suse_version} && 0%{?sle_version} <= 150100)
make %{?_smp_mflags}
%else
@ -371,7 +367,6 @@ make %{?_smp_mflags} -C %{__cmake_builddir}
%endif
%install
rm -rf $RPM_BUILD_ROOT
%if (0%{?suse_version} && 0%{?sle_version} <= 150100) && %{with ninja}
cd %{__cmake_builddir}
%endif
@ -418,9 +413,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.wireshark.Wiresha
%endif
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if %{use_wireshark_group}
%pre
getent group wireshark >/dev/null || groupadd -r wireshark
@ -509,8 +501,10 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%defattr(-,root,root)
%{_datadir}/applications/org.wireshark.Wireshark.desktop
%if 0%{?suse_version}
%if "%{_prefix}" != "/usr"
/usr/share/applications/org.wireshark.Wireshark.desktop
%endif
%endif
%{_datadir}/metainfo/org.wireshark.Wireshark.metainfo.xml
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/mimetypes/*
@ -525,6 +519,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libdir}/pkgconfig/wireshark.pc
%changelog
* Mon Apr 25 2022 John Thacker
- Cleanup specfile to remove obsolete and deprecated syntax
* Wed Jan 5 2022 John Thacker
- pcre2 is required now (most distros will get this as part of a dependency
chain glib2-devel->libselinux-devel->pcre2-devel anyway)
@ -624,7 +621,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
- Make the license tag more specific: Wireshark is GPLv2+.
* Mon Jan 12 2015 Jeff Morriss
- Modernize the (base package) %description.
- Modernize the (base package) %%description.
* Wed Dec 3 2014 Jeff Morriss
- Don't run gtk-update-icon-cache when uninstalling the Qt package. But do run
@ -646,7 +643,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
* Fri Aug 1 2014 Jeff Morriss
- Remove the old wireshark binary during RPM upgrades: this is needed because
we now declare wireshark to be %ghost so it doesn't get overwritten during an
we now declare wireshark to be %%ghost so it doesn't get overwritten during an
upgrade (but in older RPMs it was the real program).
* Tue Jul 1 2014 Jeff Morriss