input/libnbd.spec
raw · 12.1 KiB
%bcond_with gpgverify
%bcond_with tests
%bcond_with ocaml
%bcond_with ublk
%{!?bash_completions_dir:%global bash_completions_dir %{_datadir}/bash-completion/completions}
Name: libnbd
Version: 1.24.2
Release: 1%{?dist}
Summary: NBD client library in userspace
Summary(ru): Пользовательская библиотека клиента NBD
License: LGPL-2.0-or-later AND BSD-3-Clause
URL: https://gitlab.com/nbdkit/libnbd
Source0: https://libguestfs.org/download/libnbd/1.24-stable/%{name}-%{version}.tar.gz
Packager: NICE SOFT GROUP LLC (ООО "НАЙС СОФТ ГРУПП") 5024245440 <niceos@ncsgp.ru>
Vendor: NiceSOFT
Distribution: NiceOS.Core
BugURL: https://bugs.niceos.ru/
VCS: https://specs.niceos.ru/rmps/%{name}
%if %{with gpgverify}
BuildRequires: gnupg2
%endif
# RU: Пересборка autotools.
# EN: Autotools regeneration.
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
# RU: Базовая сборка.
# EN: Base build.
BuildRequires: gcc
BuildRequires: gnutls-devel
BuildRequires: libxml2-devel
BuildRequires: make
BuildRequires: pkgconfig
BuildRequires: nettle-devel
BuildRequires: libtasn1-devel
BuildRequires: libidn2-devel
BuildRequires: p11-kit-devel
BuildRequires: gmp-devel
# RU: nbdfuse.
# EN: nbdfuse.
BuildRequires: fuse3
BuildRequires: fuse3-devel
# RU: Python 3 биндинги.
# EN: Python 3 bindings.
BuildRequires: python3-devel
# RU: Примеры (часть upstream включает их по умолчанию).
# EN: Examples (some upstream versions enable them by default).
BuildRequires: glib2-devel
# RU: bash-completion.
# EN: bash-completion.
BuildRequires: bash-completion-devel
BuildRequires: perl
%if %{with ublk}
# RU: nbdublk.
# EN: nbdublk.
BuildRequires: liburing-devel >= 2.2
BuildRequires: ubdsrv-devel >= 1.0-3.rc6
%endif
%if %{with ocaml}
# RU: OCaml биндинги.
# EN: OCaml bindings.
BuildRequires: ocaml
BuildRequires: ocaml-findlib-devel
BuildRequires: ocaml-ocamldoc
%endif
%if %{with tests}
# RU: Зависимости для тестов (по умолчанию тесты выключены).
# EN: Test dependencies (tests are disabled by default).
BuildRequires: coreutils
BuildRequires: gcc-c++
BuildRequires: glibc-utils
BuildRequires: gnutls-utils
BuildRequires: iproute
BuildRequires: jq
BuildRequires: nbd
BuildRequires: nbdkit
BuildRequires: nbdkit-data-plugin
BuildRequires: nbdkit-eval-plugin
BuildRequires: nbdkit-memory-plugin
BuildRequires: nbdkit-null-plugin
BuildRequires: nbdkit-pattern-plugin
BuildRequires: nbdkit-sh-plugin
BuildRequires: nbdkit-sparse-random-plugin
BuildRequires: qemu-img
BuildRequires: util-linux
%endif
%description
NBD (Network Block Device) is a protocol for accessing block devices over a
network.
This package provides libnbd, a userspace library for writing NBD clients,
including synchronous and asynchronous APIs, and a set of command-line tools.
%description -l ru
NBD (Network Block Device) — протокол доступа к блочным устройствам по сети.
Пакет содержит libnbd — библиотеку в пользовательском пространстве для
написания NBD-клиентов, включая синхронный и асинхронный API, а также набор
утилит командной строки.
%package devel
Summary: Development headers for libnbd
Summary(ru): Заголовки и файлы разработки для libnbd
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n %{name}-devel
Development headers and build metadata for libnbd.
%description -l ru -n %{name}-devel
Заголовочные файлы и метаданные для сборки приложений, использующих libnbd.
%if %{with ocaml}
%package -n ocaml-%{name}
Summary: OCaml bindings for libnbd
Summary(ru): OCaml биндинги для libnbd
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n ocaml-%{name}
OCaml language bindings for libnbd.
%description -l ru -n ocaml-%{name}
OCaml биндинги для библиотеки libnbd.
%package -n ocaml-%{name}-devel
Summary: OCaml development files for libnbd
Summary(ru): Файлы разработки OCaml для libnbd
Requires: ocaml-%{name}%{?_isa} = %{version}-%{release}
%description -n ocaml-%{name}-devel
Development files to build OCaml applications using libnbd.
%description -l ru -n ocaml-%{name}-devel
Файлы разработки для сборки OCaml-приложений, использующих libnbd.
%endif
%package -n python3-%{name}
Summary: Python 3 bindings for libnbd
Summary(ru): Python 3 биндинги для libnbd
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}}
# RU: Python-модуль называется lib*.so, исключаем ложные Provides вида libnbdmod.*.
# EN: Python module is named lib*.so; exclude false Provides like libnbdmod.*.
%global __provides_exclude_from ^%{python3_sitearch}/lib.*\\.so
%description -n python3-%{name}
Python 3 bindings for libnbd.
%description -l ru -n python3-%{name}
Python 3 биндинги для библиотеки libnbd.
%package -n nbdfuse
Summary: FUSE support for libnbd
Summary(ru): FUSE-утилита для libnbd
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n nbdfuse
FUSE-based tool to expose an NBD export as a local filesystem tree.
%description -l ru -n nbdfuse
Утилита на базе FUSE, позволяющая представить экспорт NBD как дерево файлов
в локальной файловой системе.
%if %{with ublk}
%package -n nbdublk
Summary: Userspace NBD block device
Summary(ru): Пользовательское блочное устройство NBD
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n nbdublk
Userspace NBD block device based on libnbd.
%description -l ru -n nbdublk
Пользовательское блочное устройство NBD на базе libnbd.
%endif
%package bash-completion
Summary: Bash completion for libnbd
Summary(ru): Bash-автодополнение для libnbd
BuildArch: noarch
Requires: bash-completion >= 2.0
# RU: Без _isa, так как пакет noarch; нужно лишь синхронизировать обновления.
# EN: No _isa since this is a noarch package; we only need synchronized updates.
Requires: %{name} = %{version}-%{release}
%description -n %{name}-bash-completion
Intelligent bash tab-completion for libnbd command-line tools.
%description -l ru -n %{name}-bash-completion
Интеллектуальное bash-автодополнение для утилит libnbd.
%prep
%if %{with gpgverify}
# RU: Проверяем подпись исходника без доступа в сеть.
# RU: ВНИМАНИЕ: Source1/Source2 не заданы в этом spec; включение --with gpgverify потребует добавить их без изменения логики.
# EN: Verify upstream signature without network access.
# EN: NOTE: Source1/Source2 are not defined in this spec; enabling --with gpgverify would require adding them without changing build logic.
gpgv --keyring '%{SOURCE2}' '%{SOURCE1}' '%{SOURCE0}'
%endif
%autosetup -p1
autoreconf -i
%build
export PKG_CONFIG_PATH="%{_libdir}/pkgconfig:%{_datadir}/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"
%configure \
--disable-static \
--with-extra='%{name}-%{version}-%{release}' \
--with-tls-priority=@LIBNBD,SYSTEM \
--with-bash-completions \
PYTHON=%{__python3} \
--enable-python \
%if %{with ocaml}
--enable-ocaml \
%else
--disable-ocaml \
%endif
--enable-fuse \
--disable-golang \
--disable-rust \
%if %{with ublk}
--enable-ublk \
%else
--disable-ublk \
%endif
%{nil}
%make_build
%install
%make_install
find %{buildroot} -type f -name '*.la' -delete
# RU: Удаляем man-страницы для отключённых биндингов (если вдруг поставились).
# EN: Remove man pages for disabled bindings (if they got installed).
rm -f %{buildroot}%{_mandir}/man3/libnbd-golang.3*
rm -f %{buildroot}%{_mandir}/man3/libnbd-ocaml.3*
# RU: Удаляем служебный мусор Perl (правило NiceOS; обычно тут его нет).
# EN: Remove Perl packaging litter (NiceOS rule; usually none here).
find %{buildroot} -type f -name .packlist -delete
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
%check
%if %{with tests}
skip_test() {
for f in "$@"; do
rm -f "$f"
echo 'exit 77' > "$f"
chmod +x "$f"
done
}
# RU: В сборочном окружении часто не работает fusermount/mtab, пропускаем FUSE тесты.
# EN: fusermount/mtab often do not work in build environments; skip FUSE tests.
skip_test fuse/test-*.sh
# RU: IPv6 loopback в сборочном окружении может быть недоступен.
# EN: IPv6 loopback may be unavailable in build environments.
%make_build -C tests connect-tcp6 || :
skip_test tests/connect-tcp6
%make_build check || {
for f in $(find -name test-suite.log); do
echo
echo "==== $f ===="
cat "$f"
done
exit 1
}
%endif
%ldconfig_scriptlets
%files
%license COPYING.LIB
%doc README.md
%{_bindir}/nbdcopy
%{_bindir}/nbddump
%{_bindir}/nbdinfo
%{_libdir}/libnbd.so.*
%{_mandir}/man1/nbdcopy.1*
%{_mandir}/man1/nbddump.1*
%{_mandir}/man1/nbdinfo.1*
%files devel
%license examples/LICENSE-FOR-EXAMPLES
%doc TODO examples/*.c
%{_includedir}/libnbd.h
%{_libdir}/libnbd.so
%{_libdir}/pkgconfig/libnbd.pc
%{_mandir}/man1/libnbd-release-notes-1.*.1*
%{_mandir}/man3/libnbd.3*
%{_mandir}/man3/libnbd-security.3*
%{_mandir}/man3/nbd_*.3*
%if %{with ocaml}
%files -n ocaml-%{name}
%dir %{_libdir}/ocaml/nbd
%{_libdir}/ocaml/nbd/META
%{_libdir}/ocaml/nbd/*.cma
%{_libdir}/ocaml/nbd/*.cmi
%{_libdir}/ocaml/stublibs/dllmlnbd.so
%{_libdir}/ocaml/stublibs/dllmlnbd.so.owner
%files -n ocaml-%{name}-devel
%license ocaml/examples/LICENSE-FOR-EXAMPLES
%doc ocaml/examples/*.ml
%if 0%{?ocaml_native_compiler:1}
%{_libdir}/ocaml/nbd/*.cmxa
%{_libdir}/ocaml/nbd/*.cmx
%endif
%{_libdir}/ocaml/nbd/*.a
%{_libdir}/ocaml/nbd/*.mli
%{_mandir}/man3/NBD.3*
%{_mandir}/man3/NBD.*.3*
%endif
%files -n python3-%{name}
%{python3_sitearch}/libnbdmod*.so
%{python3_sitearch}/nbd.py
%{python3_sitearch}/nbdsh.py
%{_bindir}/nbddiscard
%{_bindir}/nbdsh
%{_bindir}/nbdzero
%{_mandir}/man1/nbddiscard.1*
%{_mandir}/man1/nbdsh.1*
%{_mandir}/man1/nbdzero.1*
%{_mandir}/man3/libnbd-python.3*
%files -n nbdfuse
%{_bindir}/nbdfuse
%{_mandir}/man1/nbdfuse.1*
%if %{with ublk}
%files -n nbdublk
%{_bindir}/nbdublk
%{_mandir}/man1/nbdublk.1*
%endif
%files -n %{name}-bash-completion
%dir %{bash_completions_dir}
%{bash_completions_dir}/nbdcopy
%{bash_completions_dir}/nbddiscard
%{bash_completions_dir}/nbddump
%{bash_completions_dir}/nbdfuse
%{bash_completions_dir}/nbdinfo
%{bash_completions_dir}/nbdsh
%if %{with ublk}
%{bash_completions_dir}/nbdublk
%endif
%{bash_completions_dir}/nbdzero
%changelog
* Sat May 09 2026 NiceOS Team <support@niceos.ru> - 1.24.2-1
- EN: - Update libnbd from 1.24.0 to 1.24.2.
- Refresh the upstream source tarball reference for the 1.24-stable branch.
- Upstream point release with build/test and Go-binding hygiene changes; no SONAME/ABI change observed in the reviewed evidence.
- RU: - Обновить libnbd с 1.24.0 до 1.24.2.
- Обновить ссылку на исходный tarball для ветки 1.24-stable.
- Патч-релиз upstream с изменениями в сборке/тестах и обслуживанием Go-биндингов; по проверенным данным изменений SONAME/ABI не видно.
* Mon Jan 12 2026 NiceOS Team <niceos@ncsgp.ru> - 1.24.0-1
- Initial build for NiceOS (Первая сборка для НАЙС.ОС)