diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b34e7a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libnbd-0.1.1.tar.gz diff --git a/libguestfs.keyring b/libguestfs.keyring new file mode 100644 index 0000000..bb3eb55 Binary files /dev/null and b/libguestfs.keyring differ diff --git a/libnbd-0.1.1.tar.gz.sig b/libnbd-0.1.1.tar.gz.sig new file mode 100644 index 0000000..61cf806 --- /dev/null +++ b/libnbd-0.1.1.tar.gz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- + +iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAlzs6IURHHJpY2hAYW5u +ZXhpYS5vcmcACgkQkXOPc+G3aKDFnA/+K/pH0lNT9p4JXZ1vqwyzuADpFr1BKgs/ +FTMoQCmO6Of24V0F53IHc9ymgzNuOpQfvh1x2zBIkprpMjV7nnTa42YVSdmXJ3+6 +sANqQaR+Wc8tApBNKuQLmU61XuVC0npdFcSfFyyy9Nv9QFWP2DDyi0E2RUinJCGe +/QutnyBojALMdUWJuNu2Bv3I0C0bgg+S8OtBPPYa0M0BkeyzzYbFx019yL60AuLk +CJbwhd+4PBs0gYNchoJT963euyCiRSHQhLkHr/qgi9RhYwatqZIiYnsKGXiyYehF +Uk+nd8Al/0gVVJ/2kWUb6cDe/6IEL4nfXqbRm+qaqVOX3LbtF032HMOG4RRd0kUm +2Jdd7cjSnTBokwJOyH0z73oBK2zZ29a4xJ8dhEUgGW/txmokPHAw35bn063P2yHd +ZFAZIic+Gl8/4+dtzW4wj0Mrhu0wSm3FutIPcWk194sh3/BaAKNSC5lDGxVKRLl9 +sPOpfFFFLUCMRNTkHKjETIYklt2A7vkH5+V1EWfXdVpz5UBSaPkvaxTgzfBlcAVE +JSXpbfWIqsH/iMj/3XC36SKvBSZ8+9UFq0Q2oaOUTMPZfKLI+tWw7KkyqZoRW6a0 ++zwHsYYjfmEr9NqRIK6TDQO58p2tHkFSz6AQHbKZhugtLCxBamClFkIASsqWjGct +stHWEYd2+nw= +=oVfz +-----END PGP SIGNATURE----- diff --git a/libnbd.spec b/libnbd.spec new file mode 100644 index 0000000..9f71b0f --- /dev/null +++ b/libnbd.spec @@ -0,0 +1,161 @@ +# If we should verify tarball signature with GPGv2. +%global verify_tarball_signature 1 + +# If there are patches which touch autotools files, set this to 1. +%global patches_touch_autotools %{nil} + +# The source directory. +%global source_directory 0.x-unstable-api + +Name: libnbd +Version: 0.1.1 +Release: 1%{?dist} +Summary: NBD client library in userspace + +License: LGPLv2+ +URL: https://github.com/libguestfs/libnbd + +Source0: http://libguestfs.org/download/libnbd/%{source_directory}/%{name}-%{version}.tar.gz +Source1: http://libguestfs.org/download/libnbd/%{source_directory}/%{name}-%{version}.tar.gz.sig +# Keyring used to verify tarball signature. This contains the single +# key from here: +# https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex +Source2: libguestfs.keyring + +# Patches. +# (none) + +%if 0%{patches_touch_autotools} +BuildRequires: autoconf, automake, libtool +%endif + +%if 0%{verify_tarball_signature} +BuildRequires: gnupg2 +%endif + +BuildRequires: gcc +BuildRequires: /usr/bin/pod2man +BuildRequires: gnutls-devel +BuildRequires: python3-devel + +# Only for running the test suite. +BuildRequires: gnutls-utils +BuildRequires: nbdkit +BuildRequires: nbd +BuildRequires: qemu-img + + +%description +NBD — Network Block Device — is a protocol for accessing Block Devices +(hard disks and disk-like things) over a Network. + +This is the NBD client library in userspace, a simple library for +writing NBD clients. + +The key features are: + + * Synchronous and asynchronous APIs, both for ease of use and for + writing non-blocking, multithreaded clients. + + * High performance. + + * Minimal dependencies for the basic library. + + * Well-documented, stable API. + + * Bindings in several programming languages. + + +%package devel +Summary: Development headers for %{name} +License: LGPLv2+ and BSD +Requires: %{name}%{?_isa} = %{version}-%{release} + + +%description devel +This package contains development headers for %{name}. + + +%package -n python3-%{name} +Summary: Python 3 bindings for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +%{?python_provide:%python_provide python3-%{name}} + +# The Python module happens to be called lib*.so. Don't scan it and +# have a bogus "Provides: libnbdmod.*". +%global __provides_exclude_from ^%{python3_sitearch}/lib.*\\.so + + +%description -n python3-%{name} +python3-%{name} contains Python 3 bindings for %{name}. + + +%prep +%if 0%{verify_tarball_signature} +tmphome="$(mktemp -d)" +gpgv2 --homedir "$tmphome" --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} +%endif +%autosetup -p1 +%if 0%{patches_touch_autotools} +autoreconf -i +%endif + + +%build +%configure \ + --disable-static \ + --with-tls-priority=@LIBNBD,SYSTEM \ + PYTHON=%{__python3} \ + --enable-python + +make %{?_smp_mflags} + + +%install +%make_install + +# Delete libtool crap. +find $RPM_BUILD_ROOT -name '*.la' -delete + + +%check +make %{?_smp_mflags} check || { + cat tests/test-suite.log + exit 1 + } + + +%files +%doc README +%license COPYING.LIB +%{_libdir}/libnbd.so.* + + +%files devel +%doc TODO examples/*.c +%license examples/LICENSE-FOR-EXAMPLES +%{_includedir}/libnbd.h +%{_libdir}/libnbd.so +%{_libdir}/pkgconfig/libnbd.pc +%{_mandir}/man3/libnbd.3* +%{_mandir}/man3/libnbd-api.3* + + +%files -n python3-%{name} +%{python3_sitearch}/libnbdmod*.so +%{python3_sitearch}/nbd.py +%{python3_sitearch}/__pycache__/nbd*.py* +%{_bindir}/nbdsh +%{_mandir}/man1/nbdsh.1* + + +%changelog +* Tue May 28 2019 Richard W.M. Jones - 0.1.1-1 +- Fix license in man pages and examples. +- Add nbdsh(1) man page. +- Include the signature and keyring even if validation is disabled. +- Update devel subpackage license. +- Fix old FSF address in Python tests. +- Filter Python provides. +- Remove executable permission on the tar.gz.sig file. +- Initial release. diff --git a/sources b/sources new file mode 100644 index 0000000..cf36daf --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libnbd-0.1.1.tar.gz) = b3bdaaa3277484806b434a99747c8c383716003c29019c8dd456ece156812b14894f99bc84e7c9dcb617faec1f0f2df0ff78410e2a276a08ce07a4ce11d13ea4