Add nbdkit-srpm-macros

This commit is contained in:
Richard W.M. Jones 2022-02-28 13:27:35 +00:00
parent 9f65d71f46
commit 90d0f9b2f0
3 changed files with 62 additions and 52 deletions

23
nbdkit-find-provides Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash -
# Generate RPM provides automatically for nbdkit packages and filters.
# Copyright (C) 2009-2022 Red Hat Inc.
# To test:
# find /usr/lib64/nbdkit/plugins | ./nbdkit-find-provides VER REL
# find /usr/lib64/nbdkit/filters | ./nbdkit-find-provides VER REL
ver="$1"
rel="$2"
function process_file
{
if [[ $1 =~ /plugins/nbdkit-.*-plugin ]] ||
[[ $1 =~ /filters/nbdkit-.*-filter ]]; then
echo "Provides:" "$(basename $1 .so)" "=" "$ver-$rel"
fi
}
while read line; do
process_file "$line"
done

3
nbdkit.attr Normal file
View File

@ -0,0 +1,3 @@
%__nbdkit_provides %{_rpmconfigdir}/nbdkit-find-provides %{version} %{release}
%__nbdkit_path %{_libdir}/nbdkit/(plugins|filters)/nbdkit-.*-(plugin|filter)(\.so)?$
%__nbdkit_flags exeonly

View File

@ -53,7 +53,7 @@ ExclusiveArch: x86_64
Name: nbdkit
Version: 1.30.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: NBD server
License: BSD
@ -74,6 +74,11 @@ Source2: libguestfs.keyring
# Maintainer script which helps with handling patches.
Source3: copy-patches.sh
# For automatic RPM Provides generation.
# See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
Source4: nbdkit.attr
Source5: nbdkit-find-provides
BuildRequires: make
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
@ -144,6 +149,11 @@ BuildRequires: %{_sbindir}/ss
BuildRequires: %{_bindir}/stat
BuildRequires: %{_bindir}/ssh-keygen
# This package has RPM rules that create the automatic Provides: for
# nbdkit plugins and filters. This means nbdkit build depends on
# itself, but it's a simple noarch package so easy to install.
## XXX TEMP DISABLE XXX BuildRequires: nbdkit-srpm-macros >= 1.30.0
# nbdkit is a metapackage pulling the server and a useful subset
# of the plugins and filters.
Requires: nbdkit-server%{?_isa} = %{version}-%{release}
@ -185,7 +195,6 @@ reading the nbdkit(1) and nbdkit-plugin(3) manual pages.
%package server
Summary: The %{name} server
License: BSD
Provides: %{name}-null-plugin = %{version}-%{release}
%description server
This package contains the %{name} server with only the null plugin
@ -198,21 +207,6 @@ the metapackage "nbdkit".
Summary: Basic plugins for %{name}
License: BSD
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Provides: %{name}-data-plugin = %{version}-%{release}
Provides: %{name}-eval-plugin = %{version}-%{release}
Provides: %{name}-file-plugin = %{version}-%{release}
Provides: %{name}-floppy-plugin = %{version}-%{release}
Provides: %{name}-full-plugin = %{version}-%{release}
Provides: %{name}-info-plugin = %{version}-%{release}
Provides: %{name}-memory-plugin = %{version}-%{release}
Provides: %{name}-ondemand-plugin = %{version}-%{release}
Provides: %{name}-pattern-plugin = %{version}-%{release}
Provides: %{name}-partitioning-plugin = %{version}-%{release}
Provides: %{name}-random-plugin = %{version}-%{release}
Provides: %{name}-sh-plugin = %{version}-%{release}
Provides: %{name}-sparse-random-plugin = %{version}-%{release}
Provides: %{name}-split-plugin = %{version}-%{release}
Provides: %{name}-zero-plugin = %{version}-%{release}
%description basic-plugins
@ -508,41 +502,6 @@ VMware VDDK for accessing VMware disks and servers.
Summary: Basic filters for %{name}
License: BSD
Requires: %{name}-server%{?_isa} = %{version}-%{release}
Provides: %{name}-blocksize-filter = %{version}-%{release}
Provides: %{name}-blocksize-policy-filter = %{version}-%{release}
Provides: %{name}-cache-filter = %{version}-%{release}
Provides: %{name}-cacheextents-filter = %{version}-%{release}
Provides: %{name}-checkwrite-filter = %{version}-%{release}
Provides: %{name}-cow-filter = %{version}-%{release}
Provides: %{name}-ddrescue-filter = %{version}-%{release}
Provides: %{name}-delay-filter = %{version}-%{release}
Provides: %{name}-error-filter = %{version}-%{release}
Provides: %{name}-exitlast-filter = %{version}-%{release}
Provides: %{name}-exitwhen-filter = %{version}-%{release}
Provides: %{name}-exportname-filter = %{version}-%{release}
Provides: %{name}-extentlist-filter = %{version}-%{release}
Provides: %{name}-fua-filter = %{version}-%{release}
Provides: %{name}-ip-filter = %{version}-%{release}
Provides: %{name}-limit-filter = %{version}-%{release}
Provides: %{name}-log-filter = %{version}-%{release}
Provides: %{name}-multi-conn-filter = %{version}-%{release}
Provides: %{name}-nocache-filter = %{version}-%{release}
Provides: %{name}-noextents-filter = %{version}-%{release}
Provides: %{name}-nofilter-filter = %{version}-%{release}
Provides: %{name}-noparallel-filter = %{version}-%{release}
Provides: %{name}-nozero-filter = %{version}-%{release}
Provides: %{name}-offset-filter = %{version}-%{release}
Provides: %{name}-partition-filter = %{version}-%{release}
Provides: %{name}-pause-filter = %{version}-%{release}
Provides: %{name}-protect-filter = %{version}-%{release}
Provides: %{name}-rate-filter = %{version}-%{release}
Provides: %{name}-readahead-filter = %{version}-%{release}
Provides: %{name}-retry-filter = %{version}-%{release}
Provides: %{name}-retry-request-filter = %{version}-%{release}
Provides: %{name}-stats-filter = %{version}-%{release}
Provides: %{name}-swab-filter = %{version}-%{release}
Provides: %{name}-tls-fallback-filter = %{version}-%{release}
Provides: %{name}-truncate-filter = %{version}-%{release}
%description basic-filters
This package contains filters for %{name} which only depend on simple
@ -673,8 +632,19 @@ for %{name}. Install this package if you want to develop
plugins for %{name}.
%package srpm-macros
Summary: RPM Provides rules for %{name} plugins and filters
License: BSD
BuildArch: noarch
%description srpm-macros
This package contains RPM rules that create the automatic Provides:
for %{name} plugins and filters found in the plugins directory.
%package bash-completion
Summary: Bash tab-completion for %{name}
License: BSD
BuildArch: noarch
Requires: bash-completion >= 2.0
Requires: %{name}-server = %{version}-%{release}
@ -757,6 +727,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-S3-plugin
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-S3-plugin.1*
%endif
# Install RPM dependency generator.
mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/fileattrs/
install -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_rpmconfigdir}/fileattrs/
install -m 0755 %{SOURCE5} $RPM_BUILD_ROOT%{_rpmconfigdir}/
%check
%ifnarch %{broken_test_arches}
@ -1192,6 +1167,12 @@ export LIBGUESTFS_TRACE=1
%{_libdir}/pkgconfig/nbdkit.pc
%files srpm-macros
%license LICENSE
%{_rpmconfigdir}/fileattrs/nbdkit.attr
%{_rpmconfigdir}/nbdkit-find-provides
%files bash-completion
%license LICENSE
%dir %{_datadir}/bash-completion/completions
@ -1199,6 +1180,9 @@ export LIBGUESTFS_TRACE=1
%changelog
* Mon Feb 28 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.0-2
- Add nbdkit-srpm-macros
* Thu Feb 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.0-1
- New stable version 1.30.0