456b8b8
# If we should verify tarball signature with GPGv2.
456b8b8
%global verify_tarball_signature 1
456b8b8
456b8b8
# If there are patches which touch autotools files, set this to 1.
fec21e3
%global patches_touch_autotools %{nil}
456b8b8
456b8b8
# The source directory.
2f41901
%global source_directory 1.1-development
456b8b8
456b8b8
Name:           libnbd
d92b1f1
Version:        1.1.5
46c80ed
Release:        1%{?dist}
456b8b8
Summary:        NBD client library in userspace
456b8b8
456b8b8
License:        LGPLv2+
456b8b8
URL:            https://github.com/libguestfs/libnbd
456b8b8
456b8b8
Source0:        http://libguestfs.org/download/libnbd/%{source_directory}/%{name}-%{version}.tar.gz
456b8b8
Source1:        http://libguestfs.org/download/libnbd/%{source_directory}/%{name}-%{version}.tar.gz.sig
456b8b8
# Keyring used to verify tarball signature.  This contains the single
456b8b8
# key from here:
456b8b8
# https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex
456b8b8
Source2:       libguestfs.keyring
456b8b8
456b8b8
%if 0%{patches_touch_autotools}
456b8b8
BuildRequires: autoconf, automake, libtool
456b8b8
%endif
456b8b8
456b8b8
%if 0%{verify_tarball_signature}
456b8b8
BuildRequires:  gnupg2
456b8b8
%endif
456b8b8
f001a4a
# For the core library.
456b8b8
BuildRequires:  gcc
456b8b8
BuildRequires:  /usr/bin/pod2man
456b8b8
BuildRequires:  gnutls-devel
ae0eabf
BuildRequires:  libxml2-devel
456b8b8
d92b1f1
# For nbdfuse.
d92b1f1
BuildRequires:  fuse, fuse-devel
d92b1f1
f001a4a
# For the Python 3 bindings.
f001a4a
BuildRequires:  python3-devel
f001a4a
f001a4a
# For the OCaml bindings.
f001a4a
BuildRequires:  ocaml
f001a4a
BuildRequires:  ocaml-findlib-devel
f001a4a
f0a39ef
# Only for building the examples.
f0a39ef
BuildRequires:  glib2-devel
f0a39ef
456b8b8
# Only for running the test suite.
456b8b8
BuildRequires:  gnutls-utils
57d26cf
%if 0%{?fedora} >= 31
456b8b8
BuildRequires:  nbdkit
86d1fe9
BuildRequires:  nbdkit-memory-plugin
86d1fe9
BuildRequires:  nbdkit-null-plugin
86d1fe9
BuildRequires:  nbdkit-pattern-plugin
f0a39ef
BuildRequires:  nbdkit-sh-plugin
57d26cf
%endif
456b8b8
BuildRequires:  nbd
456b8b8
BuildRequires:  qemu-img
f001a4a
BuildRequires:  gcc-c++
456b8b8
456b8b8
456b8b8
%description
456b8b8
NBD — Network Block Device — is a protocol for accessing Block Devices
456b8b8
(hard disks and disk-like things) over a Network.
456b8b8
456b8b8
This is the NBD client library in userspace, a simple library for
456b8b8
writing NBD clients.
456b8b8
456b8b8
The key features are:
456b8b8
456b8b8
 * Synchronous and asynchronous APIs, both for ease of use and for
456b8b8
   writing non-blocking, multithreaded clients.
456b8b8
456b8b8
 * High performance.
456b8b8
456b8b8
 * Minimal dependencies for the basic library.
456b8b8
456b8b8
 * Well-documented, stable API.
456b8b8
456b8b8
 * Bindings in several programming languages.
456b8b8
456b8b8
456b8b8
%package devel
456b8b8
Summary:        Development headers for %{name}
456b8b8
License:        LGPLv2+ and BSD
456b8b8
Requires:       %{name}%{?_isa} = %{version}-%{release}
456b8b8
456b8b8
456b8b8
%description devel
456b8b8
This package contains development headers for %{name}.
456b8b8
456b8b8
f001a4a
%package -n ocaml-%{name}
f001a4a
Summary:        OCaml language bindings for %{name}
f001a4a
Requires:       %{name}%{?_isa} = %{version}-%{release}
f001a4a
f001a4a
f001a4a
%description -n ocaml-%{name}
f001a4a
This package contains OCaml language bindings for %{name}.
f001a4a
f001a4a
f001a4a
%package -n ocaml-%{name}-devel
f001a4a
Summary:        OCaml language development package for %{name}
f001a4a
Requires:       ocaml-%{name}%{?_isa} = %{version}-%{release}
f001a4a
f001a4a
f001a4a
%description -n ocaml-%{name}-devel
f001a4a
This package contains OCaml language development package for
f001a4a
%{name}.  Install this if you want to compile OCaml software which
f001a4a
uses %{name}.
f001a4a
f001a4a
456b8b8
%package -n python3-%{name}
456b8b8
Summary:        Python 3 bindings for %{name}
456b8b8
Requires:       %{name}%{?_isa} = %{version}-%{release}
456b8b8
%{?python_provide:%python_provide python3-%{name}}
456b8b8
456b8b8
# The Python module happens to be called lib*.so.  Don't scan it and
456b8b8
# have a bogus "Provides: libnbdmod.*".
456b8b8
%global __provides_exclude_from ^%{python3_sitearch}/lib.*\\.so
456b8b8
456b8b8
456b8b8
%description -n python3-%{name}
456b8b8
python3-%{name} contains Python 3 bindings for %{name}.
456b8b8
456b8b8
d92b1f1
%package -n nbdfuse
d92b1f1
Summary:        FUSE support for %{name}
d92b1f1
License:        LGPLv2+ and BSD
d92b1f1
Requires:       %{name}%{?_isa} = %{version}-%{release}
d92b1f1
d92b1f1
d92b1f1
%description -n nbdfuse
d92b1f1
This package contains FUSE support for %{name}.
d92b1f1
d92b1f1
456b8b8
%prep
456b8b8
%if 0%{verify_tarball_signature}
456b8b8
tmphome="$(mktemp -d)"
456b8b8
gpgv2 --homedir "$tmphome" --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
456b8b8
%endif
456b8b8
%autosetup -p1
456b8b8
%if 0%{patches_touch_autotools}
456b8b8
autoreconf -i
456b8b8
%endif
456b8b8
456b8b8
456b8b8
%build
456b8b8
%configure \
456b8b8
    --disable-static \
456b8b8
    --with-tls-priority=@LIBNBD,SYSTEM \
456b8b8
    PYTHON=%{__python3} \
f001a4a
    --enable-python \
d92b1f1
    --enable-ocaml \
d92b1f1
    --enable-fuse
456b8b8
456b8b8
make %{?_smp_mflags}
456b8b8
456b8b8
456b8b8
%install
456b8b8
%make_install
456b8b8
456b8b8
# Delete libtool crap.
456b8b8
find $RPM_BUILD_ROOT -name '*.la' -delete
456b8b8
456b8b8
456b8b8
%check
eb44bcc
# interop/structured-read.sh fails with the old qemu-nbd in Fedora 29,
eb44bcc
# so disable it there.
eb44bcc
%if 0%{?fedora} <= 29
eb44bcc
rm interop/structured-read.sh
eb44bcc
touch interop/structured-read.sh
eb44bcc
chmod +x interop/structured-read.sh
eb44bcc
%endif
eb44bcc
76965c3
# All fuse tests fail in Koji with:
76965c3
# fusermount: entry for fuse/test-*.d not found in /etc/mtab
76965c3
# for unknown reasons but probably related to the Koji environment.
76965c3
for f in fuse/test-*.sh; do
76965c3
    rm $f
76965c3
    touch $f
76965c3
    chmod +x $f
76965c3
done
76965c3
456b8b8
make %{?_smp_mflags} check || {
1157082
    for f in $(find -name test-suite.log); do
1157082
        echo
1157082
        echo "==== $f ===="
1157082
        cat $f
1157082
    done
456b8b8
    exit 1
456b8b8
  }
456b8b8
456b8b8
456b8b8
%files
456b8b8
%doc README
456b8b8
%license COPYING.LIB
456b8b8
%{_libdir}/libnbd.so.*
456b8b8
456b8b8
456b8b8
%files devel
456b8b8
%doc TODO examples/*.c
456b8b8
%license examples/LICENSE-FOR-EXAMPLES
456b8b8
%{_includedir}/libnbd.h
456b8b8
%{_libdir}/libnbd.so
456b8b8
%{_libdir}/pkgconfig/libnbd.pc
456b8b8
%{_mandir}/man3/libnbd.3*
db2bc69
%{_mandir}/man3/libnbd-security.3*
192cc92
%{_mandir}/man3/nbd_*.3*
456b8b8
456b8b8
f001a4a
%files -n ocaml-%{name}
f001a4a
%{_libdir}/ocaml/nbd
f001a4a
%exclude %{_libdir}/ocaml/nbd/*.a
f001a4a
%exclude %{_libdir}/ocaml/nbd/*.cmxa
f001a4a
%exclude %{_libdir}/ocaml/nbd/*.cmx
f001a4a
%exclude %{_libdir}/ocaml/nbd/*.mli
f001a4a
%{_libdir}/ocaml/stublibs/dllmlnbd.so
f001a4a
%{_libdir}/ocaml/stublibs/dllmlnbd.so.owner
f001a4a
f001a4a
f001a4a
%files -n ocaml-%{name}-devel
f001a4a
%doc ocaml/examples/*.ml
f001a4a
%license ocaml/examples/LICENSE-FOR-EXAMPLES
f001a4a
%{_libdir}/ocaml/nbd/*.a
f001a4a
%{_libdir}/ocaml/nbd/*.cmxa
f001a4a
%{_libdir}/ocaml/nbd/*.cmx
f001a4a
%{_libdir}/ocaml/nbd/*.mli
0ac4d82
%{_mandir}/man3/libnbd-ocaml.3*
f001a4a
f001a4a
456b8b8
%files -n python3-%{name}
456b8b8
%{python3_sitearch}/libnbdmod*.so
456b8b8
%{python3_sitearch}/nbd.py
29a89e7
%{python3_sitearch}/nbdsh.py
456b8b8
%{python3_sitearch}/__pycache__/nbd*.py*
456b8b8
%{_bindir}/nbdsh
456b8b8
%{_mandir}/man1/nbdsh.1*
456b8b8
456b8b8
d92b1f1
%files -n nbdfuse
d92b1f1
%{_bindir}/nbdfuse
d92b1f1
%{_mandir}/man1/nbdfuse.1*
d92b1f1
d92b1f1
456b8b8
%changelog
d92b1f1
* Sat Oct 12 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.5-1
d92b1f1
- New upstream version 1.1.5.
d92b1f1
- New tool and subpackage nbdfuse.
d92b1f1
db2bc69
* Wed Oct  9 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.4-1
d92b1f1
- New upstream version 1.1.4.
db2bc69
- Contains fix for remote code execution vulnerability.
db2bc69
- Add new libnbd-security(3) man page.
db2bc69
0e8ebe7
* Tue Oct  1 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.3-1
0e8ebe7
- New upstream version 1.1.3.
0e8ebe7
46c80ed
* Tue Sep 17 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.2-1
46c80ed
- New upstream version 1.1.2.
46c80ed
- Remove patches which are upstream.
46c80ed
- Contains fix for NBD Protocol Downgrade Attack (CVE-2019-14842).
46c80ed
52e6bd7
* Thu Sep 12 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.1-2
52e6bd7
- Add upstream patch to fix nbdsh (for nbdkit tests).
52e6bd7
2f41901
* Sun Sep 08 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1.1-1
2f41901
- New development version 1.1.1.
2f41901
c89a045
* Wed Aug 28 2019 Richard W.M. Jones <rjones@redhat.com> - 1.0.0-1
c89a045
- New upstream version 1.0.0.
c89a045
3c055fc
* Wed Aug 21 2019 Miro Hrončok <mhroncok@redhat.com> - 0.9.9-2
3c055fc
- Rebuilt for Python 3.8
3c055fc
fec21e3
* Wed Aug 21 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.9-1
fec21e3
- New upstream version 0.9.9.
fec21e3
f0a39ef
* Wed Aug 21 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.8-4
f0a39ef
- Fix nbdkit dependencies so we're actually running the tests.
f0a39ef
- Add glib2-devel BR so we build the glib main loop example.
d14f6f7
- Add upstream patch to fix test error:
d14f6f7
  nbd_connect_unix: getlogin: No such device or address
86d1fe9
- Fix test failure on 32 bit.
f0a39ef
96b1c68
* Tue Aug 20 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.8-3
96b1c68
- Bump and rebuild to fix releng brokenness.
96b1c68
  https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/2LIDI33G3IEIPYSCCIP6WWKNHY7XZJGQ/
96b1c68
ec922cf
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.9.8-2
ec922cf
- Rebuilt for Python 3.8
ec922cf
192cc92
* Thu Aug 15 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.8-1
192cc92
- New upstream version 0.9.8.
192cc92
- Package the new nbd_*(3) man pages.
192cc92
0ac4d82
* Mon Aug  5 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.7-1
0ac4d82
- New upstream version 0.9.7.
0ac4d82
- Add libnbd-ocaml(3) man page.
0ac4d82
f001a4a
* Sat Aug  3 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.6-2
f001a4a
- Add all upstream patches since 0.9.6 was released.
f001a4a
- Package the ocaml bindings into a subpackage.
f001a4a
ec2e136
* Tue Jul 30 2019 Richard W.M. Jones <rjones@redhat.com> - 0.9.6-1
ec2e136
- New upstream verison 0.9.6.
ec2e136
a785f94
* Fri Jul 26 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.9-1
a785f94
- New upstream version 0.1.9.
a785f94
ecb4166
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.8-2
ecb4166
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
ecb4166
bb085d8
* Wed Jul 17 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.8-1
bb085d8
- New upstream version 0.1.8.
bb085d8
78a9f1b
* Tue Jul 16 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.7-1
78a9f1b
- New upstream version 0.1.7.
78a9f1b
dd0333e
* Wed Jul  3 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.6-1
dd0333e
- New upstream version 0.1.6.
dd0333e
29a89e7
* Thu Jun 27 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.5-1
29a89e7
- New upstream version 0.1.5.
29a89e7
f030064
* Sun Jun 09 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.4-1
f030064
- New upstream version 0.1.4.
f030064
ae0eabf
* Sun Jun  2 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.2-2
ae0eabf
- Enable libxml2 for NBD URI support.
ae0eabf
bd65024
* Thu May 30 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.2-1
bd65024
- New upstream version 0.1.2.
bd65024
456b8b8
* Tue May 28 2019 Richard W.M. Jones <rjones@redhat.com> - 0.1.1-1
456b8b8
- Fix license in man pages and examples.
456b8b8
- Add nbdsh(1) man page.
456b8b8
- Include the signature and keyring even if validation is disabled.
456b8b8
- Update devel subpackage license.
456b8b8
- Fix old FSF address in Python tests.
456b8b8
- Filter Python provides.
456b8b8
- Remove executable permission on the tar.gz.sig file.
456b8b8
- Initial release.