439 lines
15 KiB
RPMSpec
439 lines
15 KiB
RPMSpec
%global _hardened_build 1
|
|
#%global complete_test_arches x86-64
|
|
%global patches_touch_autotools %{nil}
|
|
|
|
Name: nbdkit
|
|
Version: 1.6.2
|
|
Release: 7
|
|
Summary: NBD server
|
|
License: BSD
|
|
URL: https://github.com/libguestfs/nbdkit
|
|
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
|
|
Patch0000: Fix-the-test-error.patch
|
|
%if 0%{patches_touch_autotools}
|
|
BuildRequires: autoconf, automake, libtool
|
|
%endif
|
|
%ifnarch %{complete_test_arches}
|
|
BuildRequires: autoconf, automake, libtool
|
|
%endif
|
|
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
|
|
|
|
%description
|
|
NBD (Network Block Device) is a protocol for accessing Block Devices (hard disks and disk-like things)
|
|
over a Network. nbdkit is a toolkit for creating NBD servers.
|
|
The key features are:
|
|
* Multithreaded NBD server written in C with good performance.
|
|
* Minimal dependencies for the basic server.
|
|
* Liberal license (BSD) allows nbdkit to be linked to proprietary libraries or included in proprietary code.
|
|
* Well-documented, simple plugin API with a stable ABI guarantee. Lets you export “unconventional”
|
|
block devices easily.
|
|
* You can write plugins in C, Lua, Perl, Python, OCaml, Ruby, Rust, shell script or Tcl.
|
|
* Filters can be stacked in front of plugins to transform the output.
|
|
|
|
%package server
|
|
Summary: The nbdkit server
|
|
License: BSD
|
|
|
|
%description server
|
|
This package contains the nbdkit server with no plugins or filters.
|
|
|
|
%package basic-plugins
|
|
Summary: Basic plugins for nbdkit
|
|
License: BSD
|
|
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
|
|
|
|
%description basic-plugins
|
|
This package contains some basic plugins for nbdkit which have only
|
|
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.
|
|
|
|
%package plugins
|
|
Summary: Plugins set
|
|
License: BSD
|
|
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}
|
|
|
|
%description guestfs-plugin
|
|
This package is a libguestfs plugin for nbdkit.
|
|
|
|
%package libvirt-plugin
|
|
Summary: Libvirt plugin for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
Provides: nbdkit-plugin-libvirt = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-libvirt <= %{version}-%{release}
|
|
|
|
%description libvirt-plugin
|
|
This package is a libvirt plugin for nbdkit. It lets you access
|
|
libvirt guest disks readonly. It is implemented using the libvirt
|
|
virDomainBlockPeek API.
|
|
|
|
%package ocaml-plugin
|
|
Summary: OCaml plugin for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
Provides: nbdkit-plugin-ocaml = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-ocaml <= %{version}-%{release}
|
|
|
|
%description ocaml-plugin
|
|
This package lets you run OCaml plugins for nbdkit.
|
|
To compile OCaml plugins you will also need to install
|
|
nbdkit-ocaml-plugin-devel.
|
|
|
|
%package ocaml-plugin-devel
|
|
Summary: OCaml development environment for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release} nbdkit-ocaml-plugin = %{version}-%{release}
|
|
Provides: nbdkit-plugin-ocaml-devel = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-ocaml-devel <= %{version}-%{release}
|
|
|
|
%description ocaml-plugin-devel
|
|
This package lets you write OCaml plugins for nbdkit.
|
|
|
|
%package perl-plugin
|
|
Summary: Perl plugin for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
Provides: nbdkit-plugin-perl = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-perl <= %{version}-%{release}
|
|
|
|
%description perl-plugin
|
|
This package lets you write Perl plugins for nbdkit.
|
|
|
|
%package python-plugin-common
|
|
Summary: Python 2 and 3 plugin common files for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
Provides: nbdkit-plugin-python-common = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-python-common <= %{version}-%{release}
|
|
|
|
%description python-plugin-common
|
|
This package contains common files shared between Python 2
|
|
and Python 3 nbdkit plugins.
|
|
You should not install this package directly. Instead install
|
|
either nbdkit-python2-plugin or nbdkit-python3-plugin.
|
|
|
|
%package python2-plugin
|
|
Summary: Python 2 plugin for nbdkit
|
|
License: BSD
|
|
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}
|
|
|
|
%description python2-plugin
|
|
This package lets you write Python 2 plugins for nbdkit.
|
|
|
|
%package python3-plugin
|
|
Summary: Python 3 plugin for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release} nbdkit-python-plugin-common = %{version}-%{release}
|
|
Provides: nbdkit-plugin-python3 = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-python3 <= %{version}-%{release}
|
|
|
|
%description python3-plugin
|
|
This package lets you write Python 3 plugins for nbdkit.
|
|
|
|
%ifarch x86_64
|
|
%package vddk-plugin
|
|
Summary: VMware VDDK plugin for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
Provides: nbdkit-plugin-vddk = %{version}-%{release}
|
|
Obsoletes: nbdkit-plugin-vddk <= %{version}-%{release}
|
|
|
|
%description vddk-plugin
|
|
This package is a plugin for nbdkit which connects to
|
|
VMware VDDK for accessing VMware disks and servers.
|
|
%endif
|
|
|
|
%package basic-filters
|
|
Summary: Basic filters for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release}
|
|
|
|
%description basic-filters
|
|
This package contains some basic filters for nbdkit which have only
|
|
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.
|
|
|
|
%package devel
|
|
Summary: Development files and documentation for nbdkit
|
|
License: BSD
|
|
Requires: nbdkit-server = %{version}-%{release} pkgconfig
|
|
|
|
%description devel
|
|
This package contains development files and documentation
|
|
for nbdkit. Install this package if you want to develop
|
|
plugins for nbdkit.
|
|
|
|
%package bash-completion
|
|
Summary: Bash tab-completion for nbdkit
|
|
BuildArch: noarch
|
|
Requires: bash-completion >= 2.0 nbdkit-server = %{version}-%{release}
|
|
|
|
%description bash-completion
|
|
Install this package if you want intelligent bash tab-completion
|
|
for nbdkit.
|
|
|
|
%package help
|
|
Summary: Documents for nbdkit
|
|
Buildarch: noarch
|
|
Requires: man info
|
|
|
|
%description help
|
|
Man pages and other related documents for nbdkit
|
|
|
|
%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
|
|
%configure --disable-static --with-libguestfs --with-libvirt --with-tls-priority=@NBDKIT,SYSTEM
|
|
%make_build
|
|
|
|
pushd python3
|
|
export PYTHON=%{_bindir}/python3
|
|
%configure --disable-static --disable-lua --disable-perl --disable-ocaml --disable-ruby --disable-tcl \
|
|
--without-curl --without-ext2 --without-libvirt --without-liblzma --without-zlib
|
|
grep '^PYTHON_VERSION = 3' Makefile
|
|
%make_build
|
|
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
|
|
|
|
%ifnarch x86_64
|
|
rm $RPM_BUILD_ROOT%{_libdir}/nbdkit/plugins/nbdkit-vddk-plugin.so
|
|
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
|
|
|
|
%post ocaml-plugin -p /sbin/ldconfig
|
|
%postun ocaml-plugin -p /sbin/ldconfig
|
|
|
|
%files
|
|
|
|
%files server
|
|
%doc README LICENSE
|
|
%{_sbindir}/nbdkit
|
|
%dir %{_libdir}/nbdkit/{plugins,filters}
|
|
|
|
%files basic-plugins
|
|
%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}
|
|
|
|
%files plugins
|
|
%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}
|
|
|
|
%files guestfs-plugin
|
|
%doc README LICENSE
|
|
%{_libdir}/nbdkit/plugins/nbdkit-guestfs-plugin.so
|
|
|
|
%files libvirt-plugin
|
|
%doc README LICENSE
|
|
%{_libdir}/nbdkit/plugins/nbdkit-libvirt-plugin.so
|
|
|
|
%files ocaml-plugin
|
|
%doc README LICENSE
|
|
%{_libdir}/libnbdkitocaml.so.*
|
|
|
|
%files ocaml-plugin-devel
|
|
%{_libdir}/libnbdkitocaml.so
|
|
%{_libdir}/ocaml/NBDKit.*
|
|
|
|
%files perl-plugin
|
|
%doc README LICENSE
|
|
%{_libdir}/nbdkit/plugins/nbdkit-perl-plugin.so
|
|
|
|
%files python-plugin-common
|
|
%doc README LICENSE
|
|
|
|
%files python2-plugin
|
|
%{_libdir}/nbdkit/plugins/{nbdkit-python-plugin.so,nbdkit-python2-plugin.so}
|
|
|
|
%files python3-plugin
|
|
%{_libdir}/nbdkit/plugins/nbdkit-python3-plugin.so
|
|
|
|
%ifarch x86_64
|
|
%files vddk-plugin
|
|
%doc README LICENSE
|
|
%{_libdir}/nbdkit/plugins/nbdkit-vddk-plugin.so
|
|
%endif
|
|
|
|
%files basic-filters
|
|
%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}
|
|
|
|
%files devel
|
|
%doc OTHER_PLUGINS README TODO LICENSE
|
|
%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
|
|
%doc LICENSE
|
|
%dir %{_datadir}/bash-completion/completions
|
|
%{_datadir}/bash-completion/completions/nbdkit
|
|
|
|
%files help
|
|
%{_mandir}/man1/nbdkit*.1*
|
|
%{_mandir}/man3/nbdkit-*.3*
|
|
|
|
%changelog
|
|
* Wed Jun 24 2020 yaokai13 <yaokai13@huawei.com> - 1.6.2-6
|
|
- Fix the test error
|
|
|
|
* Mon Jun 1 2020 Jeffery.Gao <gaojianxing@huawei.com> - 1.6.2-5
|
|
- Remove the special check for x86-64 architecture, consist with aarch64.
|
|
|
|
* Fri Apr 3 2020 Ling Yang <lingyang2@huawei.com> - 1.6.2-4
|
|
- Rewrite description for nbdkit
|
|
|
|
* Fri Apr 3 2020 Ling Yang <lingyang2@huawei.com> - 1.6.2-3
|
|
- Fixed format for spec file
|
|
|
|
* Thu Dec 12 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.6.2-2
|
|
- Package init
|