nbdkit/nbdkit.spec

433 lines
15 KiB
RPMSpec
Raw Normal View History

2019-12-17 16:40:49 +08:00
%global _hardened_build 1
%global complete_test_arches x86_64
%global patches_touch_autotools %{nil}
Name: nbdkit
Version: 1.6.2
2020-04-03 11:58:14 +08:00
Release: 3
2019-12-17 16:40:49 +08:00
Summary: NBD server
License: BSD
URL: https://github.com/libguestfs/nbdkit
2020-04-03 11:58:14 +08:00
Source0: http://libguestfs.org/download/nbdkit/1.6-stable/nbdkit-%{version}.tar.gz
Source1: http://libguestfs.org/download/nbdkit/1.6-stable/nbdkit-%{version}.tar.gz.sig
Source2: libguestfs.keyring
2019-12-17 16:40:49 +08:00
%if 0%{patches_touch_autotools}
2020-04-03 11:58:14 +08:00
BuildRequires: autoconf, automake, libtool
2019-12-17 16:40:49 +08:00
%endif
%ifnarch %{complete_test_arches}
BuildRequires: autoconf, automake, libtool
%endif
2020-04-03 11:58:14 +08:00
BuildRequires: gnutls gnutls-devel libselinux-devel python3-devel gnupg2 lua-devel socat iproute
BuildRequires: libguestfs-devel libvirt-devel xz-devel zlib-devel libcurl-devel e2fsprogs-devel
BuildRequires: bash-completion perl-devel perl(ExtUtils::Embed) python2-devel ocaml >= 4.02.2
BuildRequires: ruby-devel tcl-devel perl-podlators qemu-img
Requires: nbdkit-server nbdkit-basic-plugins nbdkit-basic-filters
2019-12-17 16:40:49 +08:00
%description
NBD is a protocol for accessing block devices (hard disks and
disk-like things) over the network.
'nbdkit' is a toolkit for creating NBD servers.
The key features are:
* Multithreaded NBD server written in C with good performance.
* Well-documented, simple plugin API with a stable ABI guarantee.
Allows you to export "unconventional" block devices easily.
* Liberal license (BSD) allows nbdkit to be linked to proprietary
braries or included in proprietary code.
2020-04-03 11:58:14 +08:00
In Fedora, 'nbdkit' is a meta-package which pulls in the core server
2019-12-17 16:40:49 +08:00
and a useful subset of plugins and filters.
2020-04-03 11:58:14 +08:00
If you want just the server, install 'nbdkit-server'.
To develop plugins, install the 'nbdkit-devel' package and start by
2019-12-17 16:40:49 +08:00
reading the nbdkit(1) and nbdkit-plugin(3) manual pages.
2020-04-03 11:58:14 +08:00
%package server
Summary: The nbdkit server
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
%description server
This package contains the nbdkit server with no plugins or filters.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package basic-plugins
Summary: Basic plugins for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Obsoletes: nbdkit-plugin-file < 1.1.19-1 nbdkit-plugin-nbd < 1.1.19-1 nbdkit-plugin-streaming < 1.1.19-1
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description basic-plugins
This package contains some basic plugins for nbdkit which have only
2019-12-17 16:40:49 +08:00
trivial dependencies.
* nbdkit-data-plugin
Serve small files directly from the command line.
* nbdkit-file-plugin
A file serving plugin.
* nbdkit-memory-plugin
A virtual memory plugin.
* nbdkit-nbd-plugin
An NBD forwarding plugin.
It provides an NBD server that forwards all traffic as a client to
another existing NBD server. A primary usage of this setup is to
alter the set of features available to the ultimate end client,
without having to change the original server (for example, to
convert between oldstyle and newtyle, or to add TLS support where
the original server lacks it).
* nbdkit-null-plugin
A null (bitbucket) plugin.
* nbdkit-pattern-plugin
Fixed test pattern.
* nbdkit-random-plugin
Random content plugin for testing.
* nbdkit-split-plugin
Concatenate one or more files into a single virtual disk.
* nbdkit-streaming-plugin
A streaming file serving plugin.
* nbdkit-zero-plugin
Zero-length plugin for testing.
2020-04-03 11:58:14 +08:00
%package plugins
Summary: Plugins set
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Provides: nbdkit-example-plugins nbdkit-curl-plugin nbdkit-plugin-curl = %{version}-%{release}
Provides: nbdkit-ext2-plugin nbdkit-plugin-ext2 = %{version}-%{release}
Provides: nbdkit-gzip-plugin nbdkit-plugin-gzip = %{version}-%{release}
Provides: nbdkit-lua-plugin nbdkit-plugin-lua = %{version}-%{release}
Provides: nbdkit-ruby-plugin nbdkit-plugin-ruby = %{version}-%{release}
Provides: nbdkit-tar-plugin nbdkit-plugin-tar = %{version}-%{release}
Provides: nbdkit-tcl-plugin nbdkit-plugin-tcl = %{version}-%{release}
Provides: nbdkit-xz-plugin nbdkit-plugin-xz = %{version}-%{release}
Obsoletes: nbdkit-example-plugins nbdkit-plugin-examples < 1.1.19-1
Obsoletes: nbdkit-curl-plugin nbdkit-plugin-curl <= %{version}-%{release}
Obsoletes: nbdkit-ext2-plugin nbdkit-plugin-ext2 <= %{version}-%{release}
Obsoletes: nbdkit-gzip-plugin nbdkit-plugin-gzip <= %{version}-%{release}
Obsoletes: nbdkit-lua-plugin nbdkit-plugin-lua <= %{version}-%{release}
Obsoletes: nbdkit-ruby-plugin nbdkit-plugin-ruby <= %{version}-%{release}
Obsoletes: nbdkit-tar-plugin nbdkit-plugin-tar <= %{version}-%{release}
Obsoletes: nbdkit-tcl-plugin nbdkit-plugin-tcl <= %{version}-%{release}
Obsoletes: nbdkit-xz-plugin nbdkit-plugin-xz <= %{version}-%{release}
Requires: nbdkit-server = %{version}-%{release} nbdkit-perl-plugin
%description plugins
This package contains a set of plugins for nbdkit.
%package guestfs-plugin
Summary: libguestfs plugin for nbdkit
License: BSD
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-guestfs = %{version}-%{release}
Obsoletes: nbdkit-plugin-guestfs <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description guestfs-plugin
This package is a libguestfs plugin for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package libvirt-plugin
Summary: Libvirt plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-libvirt = %{version}-%{release}
Obsoletes: nbdkit-plugin-libvirt <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description libvirt-plugin
This package is a libvirt plugin for nbdkit. It lets you access
2019-12-17 16:40:49 +08:00
libvirt guest disks readonly. It is implemented using the libvirt
virDomainBlockPeek API.
2020-04-03 11:58:14 +08:00
%package ocaml-plugin
Summary: OCaml plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-ocaml = %{version}-%{release}
Obsoletes: nbdkit-plugin-ocaml <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description ocaml-plugin
This package lets you run OCaml plugins for nbdkit.
2019-12-17 16:40:49 +08:00
To compile OCaml plugins you will also need to install
2020-04-03 11:58:14 +08:00
nbdkit-ocaml-plugin-devel.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package ocaml-plugin-devel
Summary: OCaml development environment for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release} nbdkit-ocaml-plugin = %{version}-%{release}
Provides: nbdkit-plugin-ocaml-devel = %{version}-%{release}
Obsoletes: nbdkit-plugin-ocaml-devel <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description ocaml-plugin-devel
This package lets you write OCaml plugins for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package perl-plugin
Summary: Perl plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-perl = %{version}-%{release}
Obsoletes: nbdkit-plugin-perl <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description perl-plugin
This package lets you write Perl plugins for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package python-plugin-common
Summary: Python 2 and 3 plugin common files for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-python-common = %{version}-%{release}
Obsoletes: nbdkit-plugin-python-common <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description python-plugin-common
2019-12-17 16:40:49 +08:00
This package contains common files shared between Python 2
2020-04-03 11:58:14 +08:00
and Python 3 nbdkit plugins.
2019-12-17 16:40:49 +08:00
You should not install this package directly. Instead install
2020-04-03 11:58:14 +08:00
either nbdkit-python2-plugin or nbdkit-python3-plugin.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package python2-plugin
Summary: Python 2 plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release} nbdkit-python-plugin-common = %{version}-%{release}
Provides: nbdkit-plugin-python = %{version}-%{release} nbdkit-plugin-python2 = %{version}-%{release}
Obsoletes: nbdkit-plugin-python <= %{version}-%{release} nbdkit-plugin-python2 <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description python2-plugin
This package lets you write Python 2 plugins for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package python3-plugin
Summary: Python 3 plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release} nbdkit-python-plugin-common = %{version}-%{release}
Provides: nbdkit-plugin-python3 = %{version}-%{release}
Obsoletes: nbdkit-plugin-python3 <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description python3-plugin
This package lets you write Python 3 plugins for nbdkit.
2019-12-17 16:40:49 +08:00
%ifarch x86_64
2020-04-03 11:58:14 +08:00
%package vddk-plugin
Summary: VMware VDDK plugin for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
Provides: nbdkit-plugin-vddk = %{version}-%{release}
Obsoletes: nbdkit-plugin-vddk <= %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description vddk-plugin
This package is a plugin for nbdkit which connects to
2019-12-17 16:40:49 +08:00
VMware VDDK for accessing VMware disks and servers.
%endif
2020-04-03 11:58:14 +08:00
%package basic-filters
Summary: Basic filters for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description basic-filters
This package contains some basic filters for nbdkit which have only
2019-12-17 16:40:49 +08:00
trivial dependencies.
* nbdkit-blocksize-filter
Adjust block size of requests sent to plugins.
* nbdkit-cache-filter
Server-side cache.
* nbdkig-cow-filter
Copy-on-write overlay for read-only plugins.
* nbdkit-delay-filter
Inject read and write delays.
* nbdkit-error-filter
Inject errors.
* nbdkit-fua-filter
Modify flush behaviour in plugins.
* nbdkit-log-filter
Log all transactions to a file.
* nbdkit-nozero-filter
Adjust handling of zero requests by plugins.
* nbdkit-offset-filter
Serve an offset and range.
* nbdkit-partition-filter
Serve a single partition.
* nbdkit-truncate-filter
Truncate, expand, round up or round down a plugin size.
2020-04-03 11:58:14 +08:00
%package devel
Summary: Development files and documentation for nbdkit
2019-12-17 16:40:49 +08:00
License: BSD
2020-04-03 11:58:14 +08:00
Requires: nbdkit-server = %{version}-%{release} pkgconfig
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description devel
2019-12-17 16:40:49 +08:00
This package contains development files and documentation
2020-04-03 11:58:14 +08:00
for nbdkit. Install this package if you want to develop
plugins for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package bash-completion
Summary: Bash tab-completion for nbdkit
BuildArch: noarch
Requires: bash-completion >= 2.0 nbdkit-server = %{version}-%{release}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description bash-completion
2019-12-17 16:40:49 +08:00
Install this package if you want intelligent bash tab-completion
2020-04-03 11:58:14 +08:00
for nbdkit.
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%package help
Summary: Documents for nbdkit
Buildarch: noarch
Requires: man info
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%description help
Man pages and other related documents for nbdkit
2019-12-17 16:40:49 +08:00
%prep
tmphome="$(mktemp -d)"
gpgv2 --homedir "$tmphome" --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
%autosetup -p1
%if 0%{patches_touch_autotools}
autoreconf -i
%endif
%ifnarch %{complete_test_arches}
sed -i -e '/^if HAVE_LIBGUESTFS/,/^endif HAVE_LIBGUESTFS/d' tests/Makefile.am
sed -i -e '/^if HAVE_GUESTFISH/,/^endif HAVE_GUESTFISH/d' tests/Makefile.am
autoreconf -i
%endif
%build
export LDFLAGS="$LDFLAGS -Wl,-z,now"
copy="$(mktemp -d)"
cp -a . "$copy"
mv "$copy" python3
2020-04-03 11:58:14 +08:00
%configure --disable-static --with-libguestfs --with-libvirt --with-tls-priority=@NBDKIT,SYSTEM
%make_build
2019-12-17 16:40:49 +08:00
pushd python3
export PYTHON=%{_bindir}/python3
2020-04-03 11:58:14 +08:00
%configure --disable-static --disable-lua --disable-perl --disable-ocaml --disable-ruby --disable-tcl \
--without-curl --without-ext2 --without-libvirt --without-liblzma --without-zlib
2019-12-17 16:40:49 +08:00
grep '^PYTHON_VERSION = 3' Makefile
2020-04-03 11:58:14 +08:00
%make_build
2019-12-17 16:40:49 +08:00
unset PYTHON
popd
%install
pushd python3
%make_install
popd
pushd $RPM_BUILD_ROOT%{_libdir}/nbdkit/plugins/
mv nbdkit-python-plugin.so nbdkit-python3-plugin.so
popd
%make_install
pushd $RPM_BUILD_ROOT%{_libdir}/nbdkit/plugins/
mv nbdkit-python-plugin.so nbdkit-python2-plugin.so
ln -s nbdkit-python2-plugin.so nbdkit-python-plugin.so
popd
find $RPM_BUILD_ROOT -name '*.la' -delete
2020-04-03 11:58:14 +08:00
%ifnarch x86_64
rm $RPM_BUILD_ROOT%{_libdir}/nbdkit/plugins/nbdkit-vddk-plugin.so
2019-12-17 16:40:49 +08:00
rm $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-vddk-plugin.1*
%endif
%check
mkdir -p $HOME/.cache/libvirt
export LIBGUESTFS_DEBUG=1
export LIBGUESTFS_TRACE=1
make check -j1 || {
cat tests/test-suite.log
exit 1
}
%ifarch %{complete_test_arches}
pushd python3
make check -j1 -C tests TESTS=test-python || {
cat tests/test-suite.log
exit 1
}
popd
%endif
2020-04-03 11:58:14 +08:00
%post ocaml-plugin -p /sbin/ldconfig
%postun ocaml-plugin -p /sbin/ldconfig
2019-12-17 16:40:49 +08:00
%files
%files server
2020-04-03 11:58:14 +08:00
%doc README LICENSE
2019-12-17 16:40:49 +08:00
%{_sbindir}/nbdkit
2020-04-03 11:58:14 +08:00
%dir %{_libdir}/nbdkit/{plugins,filters}
2019-12-17 16:40:49 +08:00
%files basic-plugins
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/plugins/{nbdkit-data-plugin.so,nbdkit-file-plugin.so,nbdkit-memory-plugin.so}
%{_libdir}/nbdkit/plugins/{nbdkit-nbd-plugin.so,nbdkit-null-plugin.so,nbdkit-pattern-plugin.so}
%{_libdir}/nbdkit/plugins/{nbdkit-random-plugin.so,nbdkit-split-plugin.so}
%{_libdir}/nbdkit/plugins/{nbdkit-streaming-plugin.so,nbdkit-zero-plugin.so}
2019-12-17 16:40:49 +08:00
%files plugins
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/plugins/{nbdkit-example*-plugin.so,nbdkit-example4-plugin,nbdkit-curl-plugin.so}
%{_libdir}/nbdkit/plugins/{nbdkit-ext2-plugin.so,nbdkit-gzip-plugin.so,nbdkit-lua-plugin.so}
%{_libdir}/nbdkit/plugins/{nbdkit-ruby-plugin.so,nbdkit-tar-plugin,nbdkit-tcl-plugin.so,nbdkit-xz-plugin.so}
2019-12-17 16:40:49 +08:00
2020-04-03 11:58:14 +08:00
%files guestfs-plugin
%doc README LICENSE
%{_libdir}/nbdkit/plugins/nbdkit-guestfs-plugin.so
2019-12-17 16:40:49 +08:00
%files libvirt-plugin
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/plugins/nbdkit-libvirt-plugin.so
2019-12-17 16:40:49 +08:00
%files ocaml-plugin
2020-04-03 11:58:14 +08:00
%doc README LICENSE
2019-12-17 16:40:49 +08:00
%{_libdir}/libnbdkitocaml.so.*
%files ocaml-plugin-devel
%{_libdir}/libnbdkitocaml.so
%{_libdir}/ocaml/NBDKit.*
%files perl-plugin
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/plugins/nbdkit-perl-plugin.so
2019-12-17 16:40:49 +08:00
%files python-plugin-common
2020-04-03 11:58:14 +08:00
%doc README LICENSE
2019-12-17 16:40:49 +08:00
%files python2-plugin
2020-04-03 11:58:14 +08:00
%{_libdir}/nbdkit/plugins/{nbdkit-python-plugin.so,nbdkit-python2-plugin.so}
2019-12-17 16:40:49 +08:00
%files python3-plugin
2020-04-03 11:58:14 +08:00
%{_libdir}/nbdkit/plugins/nbdkit-python3-plugin.so
2019-12-17 16:40:49 +08:00
%ifarch x86_64
%files vddk-plugin
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/plugins/nbdkit-vddk-plugin.so
2019-12-17 16:40:49 +08:00
%endif
%files basic-filters
2020-04-03 11:58:14 +08:00
%doc README LICENSE
%{_libdir}/nbdkit/filters/{nbdkit-blocksize-filter.so,nbdkit-cache-filter.so,nbdkit-cow-filter.so}
%{_libdir}/nbdkit/filters/{nbdkit-delay-filter.so,nbdkit-error-filter.so,nbdkit-fua-filter.so}
%{_libdir}/nbdkit/filters/{nbdkit-log-filter.so,nbdkit-nozero-filter.so,nbdkit-offset-filter.so}
%{_libdir}/nbdkit/filters/{nbdkit-partition-filter.so,nbdkit-truncate-filter.so}
2019-12-17 16:40:49 +08:00
%files devel
2020-04-03 11:58:14 +08:00
%doc OTHER_PLUGINS README TODO LICENSE
2019-12-17 16:40:49 +08:00
%doc plugins/example*/*.c
%doc plugins/example4/nbdkit-example4-plugin
%doc plugins/lua/example.lua
%doc plugins/perl/example.pl
%doc plugins/python/example.py
%doc plugins/ruby/example.rb
%doc plugins/tcl/example.tcl
%{_includedir}/nbdkit-common.h
%{_includedir}/nbdkit-filter.h
%{_includedir}/nbdkit-plugin.h
%{_libdir}/pkgconfig/nbdkit.pc
%files bash-completion
2020-04-03 11:58:14 +08:00
%doc LICENSE
2019-12-17 16:40:49 +08:00
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/nbdkit
%files help
2020-04-03 11:58:14 +08:00
%{_mandir}/man1/nbdkit*.1*
%{_mandir}/man3/nbdkit-*.3*
2019-12-17 16:40:49 +08:00
%changelog
2020-04-03 11:58:14 +08:00
* Fri Apr 3 2020 Ling Yang <lingyang2@huawei.com> - 1.6.2-3
- Fixed format for spec file
2019-12-17 16:40:49 +08:00
* Thu Dec 12 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.6.2-2
- Package init