5. Языковые экосистемы
Раздел руководства по RPM-пакетированию для openSUSE.
Python
Для библиотек используется single-spec. В Tumbleweed/Leap 16 типично несколько Python 3 flavors; на июль 2026 в Factory/Leap 16 prjconf виден primary_python python313, но точный набор проверяй в project config.
%define skip_python2 1
Name: python-foo
Version: 1.0.0
Release: 0
Summary: Python foo module
License: MIT
Source: foo-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pyproject-metadata}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module pytest}
BuildArch: noarch
%prep
%autosetup -p1 -n foo-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%check
%pytest
%files %{python_files}
%{python_sitelib}/foo/
%{python_sitelib}/foo-%{version}.dist-info/
%python_module, %python_expand, %python_files, %pyproject_wheel, %pyproject_install актуальны. %pyproject_save_files часто встречается в Fedora-style рецептах; в проверенном python-rpm-macros Tumbleweed 20260601 он не определён. Для openSUSE помечай его как [ТРЕБУЕТ УТОЧНЕНИЯ] и проверяй rpm --eval '%pyproject_save_files foo'.
Sphinx-документация:
BuildRequires: %{python_module Sphinx}
%build
%pyproject_wheel
%python_expand PYTHONPATH=$PWD sphinx-build-%{$python_bin_suffix} -b html docs build/sphinx-%{$python_bin_suffix}
pip -> RPM: py2pack fetch NAME, py2pack generate NAME -f python-NAME.spec, затем ручная проверка BuildRequires/тестов. Не пакуй wheel как upstream source, если есть source archive. Не встраивай venv, vendored wheels, site-packages snapshots.
Rust/Cargo
Актуальный cargo-packaging содержит %cargo_build, %cargo_install, %cargo_test. %cargo_audit в проверенном пакете cargo-packaging-1.5.0 не найден; аудит делай через source service/RustSec или явный cargo audit, если зависимость разрешена политикой проекта.
BuildRequires: cargo
BuildRequires: cargo-packaging
ExclusiveArch: %{rust_tier1_arches}
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
%prep
%autosetup -p1 -a1
%build
export CARGO_HOME=$PWD/.cargo
%cargo_build
%install
export CARGO_HOME=$PWD/.cargo
%cargo_install
%check
export CARGO_HOME=$PWD/.cargo
%cargo_test
Rust имеет практическое исключение для vendoring crate-зависимостей, но vendor tarball должен быть воспроизводимым, проверяемым и созданным через OBS service (cargo_vendor) или эквивалентный процесс.
Go
Актуальный golang-packaging в Tumbleweed определяет %gobuild и %gotest, а не %go_build/%go_test. Если в проекте есть go-mod-packaging или локальные aliases, проверяй через rpm --eval; без проверки используй прямой go build -mod=vendor.
<services>
<service name="go_modules" mode="manual">
<param name="compression">zst</param>
</service>
</services>Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
BuildRequires: golang-packaging
BuildRequires: obs-service-go_modules
%prep
%autosetup -p1 -a1
%build
go build -mod=vendor -buildmode=pie -o %{name} ./cmd/%{name}
%check
go test -mod=vendor ./...
Сеть в build root недоступна; go get в %build - ошибка. Все modules должны быть в source/vendor tarball.
Java
Для Java используются xmvn, mvn_install, javapackages-tools, jpackage-utils macros. Нельзя скачивать jar-зависимости во время сборки; зависимости должны быть пакетами.
BuildRequires: maven-local
BuildRequires: mvn(org.slf4j:slf4j-api)
%build
%{mvn_build} -f
%install
%mvn_install
%files -f .mfilesC/C++
%{optflags} должен попадать в compiler flags. Убирай upstream -Werror, если он ломает сборку на новых GCC.
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: pkgconfig(libsystemd)
%build
%cmake -DENABLE_TESTS=ON
%cmake_build
%install
%cmake_install
%check
%ctest
Meson:
BuildRequires: meson
%build
%meson -Dtests=true
%meson_build
%install
%meson_install
%check
%meson_test
Autotools:
%build
%configure --disable-static
%make_build
%install
%make_install
find %{buildroot} -type f -name '*.la' -deleteNode.js / npm
nodejs-packaging в проверенном Tumbleweed содержит %nodejs_install, %nodejs_build, %nodejs_check, %nodejs_sitelib; %nodejs_archdep не найден и требует проверки. npm не должен ходить в сеть во время %build.
BuildRequires: nodejs
BuildRequires: nodejs-packaging
BuildArch: noarch
%{?nodejs_requires}
%prep
%autosetup -p1
%install
%nodejs_install
%files
%{nodejs_modulesdir}/fooRuby Gem
Ruby gems обычно создаются через gem2rpm, затем проверяются вручную.
BuildRequires: ruby-macros >= 5
BuildRequires: %{ruby}
%prep
%gem_unpack
%build
%gem_build
%install
%gem_install
%files
%{gem_base}/gems/%{mod_full_name}/
%{gem_base}/specifications/%{mod_full_name}.gemspecPerl
В актуальных macros есть %perl_vendorlib, %perl_archlib, %perl_make_install, %perl_gen_filelist; %perl_make_build в проверенном наборе macros не найден. Обычно build делается через perl Makefile.PL и make.
BuildRequires: perl
BuildRequires: perl-macros
%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.filesHPC / Science
Страница Science_HPC_Packaging в Wiki указывает, что multibuild для HPC официально deprecated. Поэтому старые %hpc_* рецепты нужно применять только после проверки текущего состояния devel:science:HPC и macro-пакетов. Для нового пакета сначала ищи живой пример в OBS.
# [ТРЕБУЕТ УТОЧНЕНИЯ] пример только как форма legacy HPC spec
BuildRequires: hpc-macros-devel
%{hpc_init}
%hpc_setup
%hpc_configure
%hpc_make
%hpc_make_install