diff --git a/.gitignore b/.gitignore index e69de29..824dba8 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,3 @@ +/rust-podman-sequoia-0.1.0-vendor.tar.xz +/podman-sequoia-0.1.0.crate +/capnproto-c++-1.0.1.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e7cb33 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# rust-podman-sequoia + +The rust-podman-sequoia package diff --git a/podman-sequoia-fix-metadata.diff b/podman-sequoia-fix-metadata.diff new file mode 100644 index 0000000..bc0893f --- /dev/null +++ b/podman-sequoia-fix-metadata.diff @@ -0,0 +1,15 @@ +--- podman-sequoia-0.1.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ podman-sequoia-0.1.0/Cargo.toml 2025-08-05T06:46:32.764459+00:00 +@@ -40,12 +40,7 @@ + repository = "https://github.com/ueno/podman-sequoia" + + [features] +-crypto-botan = ["sequoia-openpgp/crypto-botan"] +-crypto-botan2 = ["sequoia-openpgp/crypto-botan2"] +-crypto-cng = ["sequoia-openpgp/crypto-cng"] +-crypto-nettle = ["sequoia-openpgp/crypto-nettle"] + crypto-openssl = ["sequoia-openpgp/crypto-openssl"] +-crypto-rust = ["sequoia-openpgp/crypto-rust"] + default = ["crypto-openssl"] + + [lib] diff --git a/rust-podman-sequoia.spec b/rust-podman-sequoia.spec new file mode 100644 index 0000000..465bc09 --- /dev/null +++ b/rust-podman-sequoia.spec @@ -0,0 +1,153 @@ +# Generated by rust2rpm 27 +%bcond check 1 + +# prevent library files from being installed +%global cargo_install_lib 0 + +%global crate podman-sequoia + +%if 0%{?rhel} +# RHEL: Use bundled deps as it doesn't ship Rust libraries +%global bundled_rust_deps 1 +%global __brp_mangle_shebangs_exclude_from ^/usr/src/debug/.*$ +%bcond bundled_capnproto 1 +%else +# Fedora: Use only system Rust libraries +%global bundled_rust_deps 0 +%bcond bundled_capnproto 0 +%endif + +Name: rust-podman-sequoia +Version: 0.1.0 +Release: %autorelease +Summary: Polyfill to use Sequoia as a signing backend for containers + +License: Apache-2.0 +URL: https://crates.io/crates/podman-sequoia +Source0: %{crates_source} +# Generated using cargo-vendor-filterer: +# cargo download %%{crate}==%%{version} > %%{crate}-%%{version}.crate +# tar xf %%{crate}-%%{version}.crate +# pushd %%{crate}-%%{version} +# cargo vendor-filterer --platform x86_64-unknown-linux-gnu \ +# --platform powerpc64le-unknown-linux-gnu \ +# --platform aarch64-unknown-linux-gnu \ +# --platform i686-unknown-linux-gnu \ +# --platform s390x-unknown-linux-gnu \ +# --all-features=true +Source1: %{name}-%{version}-vendor.tar.xz +Source2: capnproto-c++-1.0.1.tar.gz +# Manually created patch for downstream crate metadata changes +# * default to the OpenSSL crypto backend of sequoia-openpgp +Patch: podman-sequoia-fix-metadata.diff + +%if 0%{?bundled_rust_deps} +BuildRequires: rust-toolset +# vendored openssl-sys +BuildRequires: openssl-devel +BuildRequires: sqlite-devel +%else +BuildRequires: cargo-rpm-macros >= 26 +%endif +BuildRequires: clang-devel >= 3.5 + +%if %{with bundled_capnproto} +BuildRequires: gcc-c++ +BuildRequires: cmake >= 3.1 +%endif + +%global _description %{expand: +A polyfill to use Sequoia as a signing backend for containers.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +# Upstream license specification: Apache-2.0 +# +# The build dependencies have the following licenses: +# +# (MIT OR Apache-2.0) AND Unicode-DFS-2016 +# 0BSD OR MIT OR Apache-2.0 +# Apache-2.0 +# Apache-2.0 OR MIT +# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +# BSD-2-Clause OR Apache-2.0 OR MIT +# BSD-3-Clause +# BSL-1.0 +# LGPL-2.0-or-later +# MIT +# MIT OR Apache-2.0 +# MIT OR Zlib OR Apache-2.0 +# MPL-2.0 +# Unicode-3.0 +# Unlicense OR MIT +# Zlib +License: ((MIT OR Apache-2.0) AND Unicode-DFS-2016) AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND BSL-1.0 AND LGPL-2.0-or-later AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Zlib OR Apache-2.0) AND MPL-2.0 AND Unicode-3.0 AND (Unlicense OR MIT) AND Zlib +# LICENSE.dependencies contains a full license breakdown + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%license LICENSE.dependencies +%doc README.md +%{_libdir}/libpodman_sequoia.so.* +%{_libdir}/libpodman_sequoia.so +%{_datadir}/containers/podman-sequoia/sequoia.h +%{_datadir}/containers/podman-sequoia/gosequoia.h +%{_datadir}/containers/podman-sequoia/gosequoia.c +%{_datadir}/containers/podman-sequoia/gosequoiafuncs.h + +%prep +%autosetup -n %{crate}-%{version} -N %{?bundled_rust_deps:-a1} +%autopatch -M 99 -p1 +%if 0%{?bundled_rust_deps} +%cargo_prep -v vendor +%else +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires +%endif + +%if %{with bundled_capnproto} +mkdir -p bundled_capnproto +pushd bundled_capnproto +tar --strip-components=1 -xf %{SOURCE2} +popd +%endif + +%build +%if %{with bundled_capnproto} +pushd bundled_capnproto +%cmake -DBUILD_TESTING=OFF +%cmake_build +export PATH="$PWD/%{__cmake_builddir}/src/capnp:$PATH" +popd +%endif + +# build script uses environment variables to populate the pkgconfig file +export PREFIX="%{_prefix}" +export LIBDIR="%{_libdir}" +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +# install shared library +mkdir -p %{buildroot}/%{_libdir} +cp -pav target/release/libpodman_sequoia.so %{buildroot}/%{_libdir}/libpodman_sequoia.so.0 +# create unversioned symlink +ln -s libpodman_sequoia.so.0 %{buildroot}/%{_libdir}/libpodman_sequoia.so +# install bindings +mkdir -p %{buildroot}/%{_datadir}/containers/podman-sequoia +cp -pav target/release/bindings/*.[ch] %{buildroot}/%{_datadir}/containers/podman-sequoia/ + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..fdeee76 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,47 @@ +[package] +cargo-toml-patch-comments = [ + "default to the OpenSSL crypto backend of sequoia-openpgp", +] +extra-files = [ + "%{_libdir}/libpodman_sequoia.so.*", + "%{_libdir}/libpodman_sequoia.so", + "%{_datadir}/containers/podman-sequoia/sequoia.h", + "%{_datadir}/containers/podman-sequoia/gosequoia.h", + "%{_datadir}/containers/podman-sequoia/gosequoia.c", + "%{_datadir}/containers/podman-sequoia/gosequoiafuncs.h", +] +suppress-cdylib-install-fixme = true +extra-sources = [ + { number = 2, file = "%{name}-%{version}-vendor.tar.xz", comments = [ + "Generated using cargo-vendor-filterer:", + " cargo download %%{crate}==%%{version} > %%{crate}-%%{version}.crate", + " tar xf %%{crate}-%%{version}.crate", + " pushd %%{crate}-%%{version}", + " cargo vendor-filterer --platform x86_64-unknown-linux-gnu \\", + " --platform powerpc64le-unknown-linux-gnu \\", + " --platform aarch64-unknown-linux-gnu \\", + " --platform i686-unknown-linux-gnu \\", + " --platform s390x-unknown-linux-gnu \\", + " --all-features=true", + ] } +] + +[requires] +build = ["clang-devel >= 3.5"] + +[scripts] +build.pre = [ + "# build script uses environment variables to populate the pkgconfig file", + "export PREFIX=\"%{_prefix}\"", + "export LIBDIR=\"%{_libdir}\"", +] +install.post = [ + "# install shared library", + "mkdir -p %{buildroot}/%{_libdir}", + "cp -pav target/release/libpodman_sequoia.so %{buildroot}/%{_libdir}/libpodman_sequoia.so.0", + "# create unversioned symlink", + "ln -s libpodman_sequoia.so.0 %{buildroot}/%{_libdir}/libpodman_sequoia.so", + "# install bindings", + "mkdir -p %{buildroot}/%{_datadir}/containers/podman-sequoia", + "cp -pav target/release/bindings/*.[ch] %{buildroot}/%{_datadir}/containers/podman-sequoia/", +] diff --git a/sources b/sources new file mode 100644 index 0000000..428ecfb --- /dev/null +++ b/sources @@ -0,0 +1,3 @@ +SHA512 (rust-podman-sequoia-0.1.0-vendor.tar.xz) = 7aeab91b6776feeddd6cea0a11fefd517efb62535c32aec78faee62a15c96d2651ecbcd3d95d8b5e55aa04c4d072bded22772edead9e87b92838806f411f0580 +SHA512 (podman-sequoia-0.1.0.crate) = ecfb75e9aa9186e2322687821749453cc0bfdb10931c4ae63edeb5452fc61b30c2b9d2fd5937b14b750aff5d89e64c6429154f2b3642fe1af1f96c608feb1729 +SHA512 (capnproto-c++-1.0.1.tar.gz) = c60291f433eea15a51e480e1679a4b9b3b5e67edebc445e371a7a32fce6ec5a7e4b440b17b2adc0565519ec369e3dae8ea727ae790a082a53ecd0d245b5275a9