From 90d0f9b2f0de0f94fdaba9015370476c27c24a2e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 28 Feb 2022 13:27:35 +0000 Subject: [PATCH] Add nbdkit-srpm-macros --- nbdkit-find-provides | 23 ++++++++++++ nbdkit.attr | 3 ++ nbdkit.spec | 88 ++++++++++++++++++-------------------------- 3 files changed, 62 insertions(+), 52 deletions(-) create mode 100755 nbdkit-find-provides create mode 100644 nbdkit.attr diff --git a/nbdkit-find-provides b/nbdkit-find-provides new file mode 100755 index 0000000..7013ccd --- /dev/null +++ b/nbdkit-find-provides @@ -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 diff --git a/nbdkit.attr b/nbdkit.attr new file mode 100644 index 0000000..2757679 --- /dev/null +++ b/nbdkit.attr @@ -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 diff --git a/nbdkit.spec b/nbdkit.spec index 6b1f947..fabfef6 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -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 - 1.30.0-2 +- Add nbdkit-srpm-macros + * Thu Feb 24 2022 Richard W.M. Jones - 1.30.0-1 - New stable version 1.30.0