From 82eb2bf926d9abf8fe107a242d0401562b26a747 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 27 Aug 2020 16:20:18 +0100 Subject: [PATCH] Bring the nbdkit spec file closer to what is in RHEL. This conditionalises the spec file similarly to RHEL, removing several subpackages then %{rhel} is defined. If I've done this correctly then for Fedora there should be no change in the output. --- nbdkit.spec | 160 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 138 insertions(+), 22 deletions(-) diff --git a/nbdkit.spec b/nbdkit.spec index 53b0053..648ef19 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -7,7 +7,7 @@ %endif %endif -# We can only compiler the OCaml plugin on platforms which have native +# We can only compile the OCaml plugin on platforms which have native # OCaml support (not bytecode). %ifarch %{ocaml_native_compiler} %global have_ocaml 1 @@ -52,15 +52,20 @@ Summary: NBD server License: BSD URL: https://github.com/libguestfs/nbdkit +%if 0%{?rhel} >= 8 +# On RHEL 8+, we cannot build the package on i686 (no virt stack). +ExcludeArch: i686 +%endif + Source0: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name}-%{version}.tar.gz %if 0%{verify_tarball_signature} Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name}-%{version}.tar.gz.sig # Keyring used to verify tarball signature. -Source2: libguestfs.keyring +Source2: libguestfs.keyring %endif %if 0%{patches_touch_autotools} -BuildRequires: autoconf, automake, libtool +BuildRequires: autoconf, automake, libtool %endif %ifnarch %{complete_test_arches} @@ -70,7 +75,7 @@ BuildRequires: gcc, gcc-c++ BuildRequires: /usr/bin/pod2man BuildRequires: gnutls-devel BuildRequires: libselinux-devel -%if 0%{?have_libguestfs} +%if !0%{?rhel} && 0%{?have_libguestfs} BuildRequires: libguestfs-devel %endif BuildRequires: libvirt-devel @@ -81,12 +86,15 @@ BuildRequires: libcurl-devel BuildRequires: libnbd-devel >= 1.3.11 BuildRequires: libssh-devel BuildRequires: e2fsprogs, e2fsprogs-devel +%if !0%{?rhel} BuildRequires: genisoimage BuildRequires: rb_libtorrent-devel +%endif BuildRequires: bash-completion BuildRequires: perl-devel BuildRequires: perl(ExtUtils::Embed) BuildRequires: python3-devel +%if !0%{?rhel} %if 0%{?have_ocaml} # Requires OCaml 4.02.2 which contains fix for # http://caml.inria.fr/mantis/view.php?id=6693 @@ -95,18 +103,28 @@ BuildRequires: ocaml >= 4.02.2 BuildRequires: ruby-devel BuildRequires: tcl-devel BuildRequires: lua-devel +%endif %if 0%{verify_tarball_signature} BuildRequires: gnupg2 %endif # Only for running the test suite: -BuildRequires: /usr/bin/certtool +BuildRequires: %{_bindir}/certtool +BuildRequires: expect +BuildRequires: %{_bindir}/hexdump +BuildRequires: %{_sbindir}/ip BuildRequires: jq -BuildRequires: /usr/bin/nbdsh -BuildRequires: /usr/bin/qemu-img -BuildRequires: /usr/bin/socat -BuildRequires: /usr/sbin/ss -BuildRequires: /usr/bin/ssh-keygen +BuildRequires: %{_bindir}/nbdcopy +BuildRequires: %{_bindir}/nbdinfo +BuildRequires: %{_bindir}/nbdsh +BuildRequires: %{_bindir}/qemu-img +BuildRequires: %{_bindir}/qemu-io +BuildRequires: %{_bindir}/qemu-nbd +BuildRequires: %{_sbindir}/sfdisk +BuildRequires: %{_bindir}/socat +BuildRequires: %{_sbindir}/ss +BuildRequires: %{_bindir}/stat +BuildRequires: %{_bindir}/ssh-keygen # nbdkit is a metapackage pulling the server and a useful subset # of the plugins and filters. @@ -137,8 +155,8 @@ The key features are: * Filters can be stacked in front of plugins to transform the output. -In Fedora, '%{name}' is a meta-package which pulls in the core server -and a useful subset of plugins and filters with minimal dependencies. +'%{name}' is a meta-package which pulls in the core server and a +useful subset of plugins and filters with minimal dependencies. If you want just the server, install '%{name}-server'. @@ -232,6 +250,7 @@ This package contains example plugins for %{name}. # The plugins below have non-trivial dependencies are so are # packaged separately. +%if !0%{?rhel} %package cc-plugin Summary: Write small inline C plugins and scripts for %{name} License: BSD @@ -245,8 +264,10 @@ Requires: %{_bindir}/cat This package contains support for writing inline C plugins and scripts for %{name}. NOTE this is NOT the right package for writing plugins in C, install %{name}-devel for that. +%endif +%if !0%{?rhel} %package cdi-plugin Summary: Containerized Data Import plugin for %{name} License: BSD @@ -258,6 +279,7 @@ Requires: podman %description cdi-plugin This package contains Containerized Data Import support for %{name}. +%endif %package curl-plugin @@ -271,7 +293,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} This package contains cURL (HTTP/FTP) support for %{name}. -%if 0%{?have_libguestfs} +%if !0%{?rhel} && 0%{?have_libguestfs} %package guestfs-plugin Summary: libguestfs plugin for %{name} License: BSD @@ -295,6 +317,20 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} This package is a gzip filter for %{name}. +%if 0%{?rhel} == 8 +%package gzip-plugin +Summary: GZip plugin for %{name} +License: BSD + +Requires: %{name}-server%{?_isa} = %{version}-%{release} + + +%description gzip-plugin +This package is a gzip plugin for %{name}. +%endif + + +%if !0%{?rhel} %package iso-plugin Summary: Virtual ISO 9660 plugin for %{name} License: BSD @@ -305,8 +341,10 @@ Requires: genisoimage %description iso-plugin This package is a virtual ISO 9660 (CD-ROM) plugin for %{name}. +%endif +%if !0%{?rhel} %package libvirt-plugin Summary: Libvirt plugin for %{name} License: BSD @@ -318,6 +356,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} This package is a libvirt plugin for %{name}. It lets you access libvirt guest disks readonly. It is implemented using the libvirt virDomainBlockPeek API. +%endif %package linuxdisk-plugin @@ -333,6 +372,7 @@ Requires: e2fsprogs This package is a virtual Linux disk plugin for %{name}. +%if !0%{?rhel} %package lua-plugin Summary: Lua plugin for %{name} License: BSD @@ -342,6 +382,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} %description lua-plugin This package lets you write Lua plugins for %{name}. +%endif %package nbd-plugin @@ -356,7 +397,7 @@ This package lets you forward NBD connections from %{name} to another NBD server. -%if 0%{?have_ocaml} +%if !0%{?rhel} && 0%{?have_ocaml} %package ocaml-plugin Summary: OCaml plugin for %{name} License: BSD @@ -384,6 +425,7 @@ This package lets you write OCaml plugins for %{name}. %endif +%if !0%{?rhel} %package perl-plugin Summary: Perl plugin for %{name} License: BSD @@ -393,6 +435,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} %description perl-plugin This package lets you write Perl plugins for %{name}. +%endif %package python-plugin @@ -406,6 +449,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} This package lets you write Python 3 plugins for %{name}. +%if !0%{?rhel} %package ruby-plugin Summary: Ruby plugin for %{name} License: BSD @@ -415,6 +459,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} %description ruby-plugin This package lets you write Ruby plugins for %{name}. +%endif %package ssh-plugin @@ -452,6 +497,7 @@ Requires: tar This package is a tar archive plugin for %{name}. +%if !0%{?rhel} %package tcl-plugin Summary: Tcl plugin for %{name} License: BSD @@ -461,6 +507,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} %description tcl-plugin This package lets you write Tcl plugins for %{name}. +%endif %package tmpdisk-plugin @@ -471,13 +518,17 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} # For mkfs and mke2fs (defaults). Requires: util-linux, e2fsprogs # For other filesystems. -Suggests: xfsprogs, ntfsprogs, dosfstools +Suggests: xfsprogs +%if !0%{?rhel} +Suggests: ntfsprogs, dosfstools +%endif %description tmpdisk-plugin This package is a remote temporary filesystem disk plugin for %{name}. +%if !0%{?rhel} %package torrent-plugin Summary: BitTorrent plugin for %{name} License: BSD @@ -487,6 +538,7 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release} %description torrent-plugin This package is a BitTorrent plugin for %{name}. +%endif %ifarch x86_64 @@ -600,6 +652,7 @@ nbdkit-tls-fallback-filter TLS protection filter. nbdkit-truncate-filter Truncate, expand, round up or round down size. +%if !0%{?rhel} %package ext2-filter Summary: ext2, ext3 and ext4 filesystem support for %{name} License: BSD @@ -614,6 +667,7 @@ Obsoletes: %{name}-ext2-plugin <= %{version}-%{release} %description ext2-filter This package contains ext2, ext3 and ext4 filesystem support for %{name}. +%endif %package xz-filter @@ -671,20 +725,29 @@ autoreconf -i %build -# Golang bindings are not enabled in the Fedora build since they don't +# Golang bindings are not enabled in the build since they don't # need to be. Most people would use them by copying the upstream # package into their vendor/ directory. +export PYTHON=%{__python3} %configure \ - PYTHON=%{_bindir}/python3 \ --disable-static \ --disable-golang \ --disable-rust \ -%if 0%{?have_ocaml} +%if !0%{?rhel} && 0%{?have_ocaml} --enable-ocaml \ %else --disable-ocaml \ %endif -%if 0%{?have_libguestfs} +%if 0%{?rhel} + --disable-lua \ + --disable-perl \ + --disable-ruby \ + --disable-tcl \ + --without-ext2 \ + --without-iso \ + --without-libvirt \ +%endif +%if !0%{?rhel} && 0%{?have_libguestfs} --with-libguestfs \ %else --without-libguestfs \ @@ -704,9 +767,23 @@ grep '^PYTHON_VERSION = 3' Makefile # Delete libtool crap. find $RPM_BUILD_ROOT -name '*.la' -delete +# If cargo happens to be installed on the machine then the +# rust plugin is built. Delete it if this happens. +rm -f $RPM_BUILD_ROOT%{_mandir}/man3/nbdkit-rust-plugin.3* + +%if 0%{?rhel} != 8 # Remove the deprecated gzip plugin (use gzip filter instead). rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-gzip-plugin.so rm $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-gzip-plugin.1* +%endif + +%if 0%{?rhel} +# In RHEL, remove some plugins we cannot --disable. +for f in cc cdi torrent; do + rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-$f-plugin.so + rm $RPM_BUILD_ROOT%{_mandir}/man?/nbdkit-$f-plugin.* +done +%endif %check @@ -811,22 +888,28 @@ export LIBGUESTFS_TRACE=1 %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-example*-plugin.so +%if !0%{?rhel} %{_libdir}/%{name}/plugins/nbdkit-example4-plugin +%endif %{_mandir}/man1/nbdkit-example*-plugin.1* +%if !0%{?rhel} %files cc-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-cc-plugin.so %{_mandir}/man3/nbdkit-cc-plugin.3* +%endif +%if !0%{?rhel} %files cdi-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-cdi-plugin.so %{_mandir}/man1/nbdkit-cdi-plugin.1* +%endif %files curl-plugin @@ -836,7 +919,7 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-curl-plugin.1* -%if 0%{?have_libguestfs} +%if !0%{?rhel} && 0%{?have_libguestfs} %files guestfs-plugin %doc README %license LICENSE @@ -852,18 +935,31 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-gzip-filter.1* +%if 0%{?rhel} == 8 +%files gzip-plugin +%doc README +%license LICENSE +%{_libdir}/%{name}/plugins/nbdkit-gzip-plugin.so +%{_mandir}/man1/nbdkit-gzip-plugin.1* +%endif + + +%if !0%{?rhel} %files iso-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-iso-plugin.so %{_mandir}/man1/nbdkit-iso-plugin.1* +%endif +%if !0%{?rhel} %files libvirt-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-libvirt-plugin.so %{_mandir}/man1/nbdkit-libvirt-plugin.1* +%endif %files linuxdisk-plugin @@ -873,11 +969,13 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-linuxdisk-plugin.1* +%if !0%{?rhel} %files lua-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-lua-plugin.so %{_mandir}/man3/nbdkit-lua-plugin.3* +%endif %files nbd-plugin @@ -887,7 +985,7 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-nbd-plugin.1* -%if 0%{?have_ocaml} +%if !0%{?rhel} && 0%{?have_ocaml} %files ocaml-plugin %doc README %license LICENSE @@ -900,11 +998,13 @@ export LIBGUESTFS_TRACE=1 %endif +%if !0%{?rhel} %files perl-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-perl-plugin.so %{_mandir}/man3/nbdkit-perl-plugin.3* +%endif %files python-plugin @@ -914,11 +1014,13 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man3/nbdkit-python-plugin.3* +%if !0%{?rhel} %files ruby-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-ruby-plugin.so %{_mandir}/man3/nbdkit-ruby-plugin.3* +%endif %files ssh-plugin @@ -942,11 +1044,13 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-tar-plugin.1* +%if !0%{?rhel} %files tcl-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-tcl-plugin.so %{_mandir}/man3/nbdkit-tcl-plugin.3* +%endif %files tmpdisk-plugin @@ -956,11 +1060,13 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-tmpdisk-plugin.1* +%if !0%{?rhel} %files torrent-plugin %doc README %license LICENSE %{_libdir}/%{name}/plugins/nbdkit-torrent-plugin.so %{_mandir}/man1/nbdkit-torrent-plugin.1* +%endif %ifarch x86_64 @@ -1033,11 +1139,13 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-truncate-filter.1* +%if !0%{?rhel} %files ext2-filter %doc README %license LICENSE %{_libdir}/%{name}/filters/nbdkit-ext2-filter.so %{_mandir}/man1/nbdkit-ext2-filter.1* +%endif %files xz-filter @@ -1052,16 +1160,24 @@ export LIBGUESTFS_TRACE=1 %license LICENSE # Include the source of the example plugins in the documentation. %doc plugins/example*/*.c +%if !0%{?rhel} %doc plugins/example4/nbdkit-example4-plugin %doc plugins/lua/example.lua -%if 0%{?have_ocaml} +%endif +%if !0%{?rhel} && 0%{?have_ocaml} %doc plugins/ocaml/example.ml %endif +%if !0%{?rhel} %doc plugins/perl/example.pl +%endif %doc plugins/python/examples/*.py +%if !0%{?rhel} %doc plugins/ruby/example.rb +%endif %doc plugins/sh/example.sh +%if !0%{?rhel} %doc plugins/tcl/example.tcl +%endif %{_includedir}/nbdkit-common.h %{_includedir}/nbdkit-filter.h %{_includedir}/nbdkit-plugin.h