From 6c50527200e964efae158c70615b4ebd840252e4 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Wed, 20 Dec 2023 18:00:04 +0700 Subject: [PATCH] add sccache (#855) * add sccache * reverse conf flag * Add cargo_license and cargo_license_summary macros * remove license macros because meh * Update rust-sccache.spec to disable shebang mangling This commit updates the rust-sccache.spec file to disable shebang mangling. This change ensures that shebangs are not modified during the build process. * Fix shebangs in rust-sccache.spec * Add conditional compilation for dist server * Fix package dependencies * Add sccache-dist binary if dist_server is enabled --- anda/apps/sccache/anda.hcl | 5 + anda/apps/sccache/rust-sccache.spec | 601 ++++++++++++++++++ .../sccache/sccache-fix-metadata-auto.diff | 14 + 3 files changed, 620 insertions(+) create mode 100644 anda/apps/sccache/anda.hcl create mode 100644 anda/apps/sccache/rust-sccache.spec create mode 100644 anda/apps/sccache/sccache-fix-metadata-auto.diff diff --git a/anda/apps/sccache/anda.hcl b/anda/apps/sccache/anda.hcl new file mode 100644 index 0000000000..665fb9cf1a --- /dev/null +++ b/anda/apps/sccache/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "rust-sccache.spec" + } +} diff --git a/anda/apps/sccache/rust-sccache.spec b/anda/apps/sccache/rust-sccache.spec new file mode 100644 index 0000000000..ae15a5a33a --- /dev/null +++ b/anda/apps/sccache/rust-sccache.spec @@ -0,0 +1,601 @@ +# Generated by rust2rpm 25 +%bcond_with check +# aarch64 dist is not available +%ifarch aarch64 +%bcond_with dist_server +%else +%bcond_without dist_server +%endif + +# Don't mangle shebangs +%global __brp_mangle_shebangs %{nil} + +%global crate sccache + +Name: rust-sccache +Version: 0.7.4 +Release: 1%{?dist} +Summary: Ccache-like tool + +License: Apache-2.0 +URL: https://crates.io/crates/sccache +Source: %{crates_source} +# Automatically generated patch to strip dependencies and normalize metadata +Patch: sccache-fix-metadata-auto.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: anda-srpm-macros +BuildRequires: openssl-devel +BuildRequires: gcc +BuildRequires: perl +BuildRequires: rust-packaging + +%global _description %{expand: +Sccache is a ccache-like tool. It is used as a compiler wrapper and +avoids compilation when possible, storing a cache in a remote storage +using various cloud storage.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +# FIXME: paste output of %%cargo_license_summary here +License: # FIXME +# LICENSE.dependencies contains a full license breakdown + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%doc CODE_OF_CONDUCT.md +%doc README.md +%{_bindir}/sccache +%if %{with dist_server} +%{_bindir}/sccache-dist +%endif + +%package devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache) = 0.7.4 +Requires: cargo +Requires: rust >= 1.67.1 + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/CODE_OF_CONDUCT.md +%doc %{crate_instdir}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/default) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/all) = 0.7.4 + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+all-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/all) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/azure) = 0.7.4 +Requires: crate(sccache/dist-client) = 0.7.4 +Requires: crate(sccache/gcs) = 0.7.4 +Requires: crate(sccache/gha) = 0.7.4 +Requires: crate(sccache/memcached) = 0.7.4 +Requires: crate(sccache/redis) = 0.7.4 +Requires: crate(sccache/s3) = 0.7.4 +Requires: crate(sccache/webdav) = 0.7.4 + +%description -n %{name}+all-devel %{_description} + +This package contains library source intended for building other packages which +use the "all" feature of the "%{crate}" crate. + +%files -n %{name}+all-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+azure-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/azure) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+azure-devel %{_description} + +This package contains library source intended for building other packages which +use the "azure" feature of the "%{crate}" crate. + +%files -n %{name}+azure-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dist-client-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/dist-client) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+dist-client-devel %{_description} + +This package contains library source intended for building other packages which +use the "dist-client" feature of the "%{crate}" crate. + +%files -n %{name}+dist-client-devel +%ghost %{crate_instdir}/Cargo.toml +%if %{with dist_server} +%package -n %{name}+dist-server-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/dist-server) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+dist-server-devel %{_description} + +This package contains library source intended for building other packages which +use the "dist-server" feature of the "%{crate}" crate. + +%files -n %{name}+dist-server-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dist-tests-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/dist-tests) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/dist-client) = 0.7.4 +Requires: crate(sccache/dist-server) = 0.7.4 + +%description -n %{name}+dist-tests-devel %{_description} + +This package contains library source intended for building other packages which +use the "dist-tests" feature of the "%{crate}" crate. + +%files -n %{name}+dist-tests-devel +%ghost %{crate_instdir}/Cargo.toml +%endif +%package -n %{name}+flate2-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/flate2) = 0.7.4 +Requires: (crate(flate2) >= 1.0.0 with crate(flate2) < 2.0.0~) +Requires: (crate(flate2/rust_backend) >= 1.0.0 with crate(flate2/rust_backend) < 2.0.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+flate2-devel %{_description} + +This package contains library source intended for building other packages which +use the "flate2" feature of the "%{crate}" crate. + +%files -n %{name}+flate2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+gcs-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/gcs) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+gcs-devel %{_description} + +This package contains library source intended for building other packages which +use the "gcs" feature of the "%{crate}" crate. + +%files -n %{name}+gcs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+gha-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/gha) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/opendal) = 0.7.4 + +%description -n %{name}+gha-devel %{_description} + +This package contains library source intended for building other packages which +use the "gha" feature of the "%{crate}" crate. + +%files -n %{name}+gha-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+hyper-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/hyper) = 0.7.4 +Requires: (crate(hyper/default) >= 0.14.27 with crate(hyper/default) < 0.15.0~) +Requires: (crate(hyper/server) >= 0.14.27 with crate(hyper/server) < 0.15.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+hyper-devel %{_description} + +This package contains library source intended for building other packages which +use the "hyper" feature of the "%{crate}" crate. + +%files -n %{name}+hyper-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+jwt-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/jwt) = 0.7.4 +Requires: (crate(jsonwebtoken/default) >= 8.0.0 with crate(jsonwebtoken/default) < 9.0.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+jwt-devel %{_description} + +This package contains library source intended for building other packages which +use the "jwt" feature of the "%{crate}" crate. + +%files -n %{name}+jwt-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libmount-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/libmount) = 0.7.4 +Requires: (crate(libmount/default) >= 0.1.10 with crate(libmount/default) < 0.2.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+libmount-devel %{_description} + +This package contains library source intended for building other packages which +use the "libmount" feature of the "%{crate}" crate. + +%files -n %{name}+libmount-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memcached-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/memcached) = 0.7.4 +Requires: (crate(opendal/default) >= 0.40.0 with crate(opendal/default) < 0.41.0~) +Requires: (crate(opendal/services-memcached) >= 0.40.0 with crate(opendal/services-memcached) < 0.41.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+memcached-devel %{_description} + +This package contains library source intended for building other packages which +use the "memcached" feature of the "%{crate}" crate. + +%files -n %{name}+memcached-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+native-zlib-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/native-zlib) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+native-zlib-devel %{_description} + +This package contains library source intended for building other packages which +use the "native-zlib" feature of the "%{crate}" crate. + +%files -n %{name}+native-zlib-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+nix-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/nix) = 0.7.4 +Requires: (crate(nix/default) >= 0.26.2 with crate(nix/default) < 0.27.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+nix-devel %{_description} + +This package contains library source intended for building other packages which +use the "nix" feature of the "%{crate}" crate. + +%files -n %{name}+nix-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+opendal-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/opendal) = 0.7.4 +Requires: (crate(opendal/default) >= 0.40.0 with crate(opendal/default) < 0.41.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+opendal-devel %{_description} + +This package contains library source intended for building other packages which +use the "opendal" feature of the "%{crate}" crate. + +%files -n %{name}+opendal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+openssl-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/openssl) = 0.7.4 +Requires: (crate(openssl/default) >= 0.10.55 with crate(openssl/default) < 0.11.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+openssl-devel %{_description} + +This package contains library source intended for building other packages which +use the "openssl" feature of the "%{crate}" crate. + +%files -n %{name}+openssl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+redis-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/redis) = 0.7.4 +Requires: (crate(opendal/default) >= 0.40.0 with crate(opendal/default) < 0.41.0~) +Requires: (crate(opendal/services-redis) >= 0.40.0 with crate(opendal/services-redis) < 0.41.0~) +Requires: (crate(opendal/services-redis-rustls) >= 0.40.0 with crate(opendal/services-redis-rustls) < 0.41.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/url) = 0.7.4 + +%description -n %{name}+redis-devel %{_description} + +This package contains library source intended for building other packages which +use the "redis" feature of the "%{crate}" crate. + +%files -n %{name}+redis-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reqsign-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/reqsign) = 0.7.4 +Requires: (crate(reqsign/default) >= 0.14.1 with crate(reqsign/default) < 0.15.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+reqsign-devel %{_description} + +This package contains library source intended for building other packages which +use the "reqsign" feature of the "%{crate}" crate. + +%files -n %{name}+reqsign-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reqwest-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/reqwest) = 0.7.4 +Requires: (crate(reqwest/blocking) >= 0.11.0 with crate(reqwest/blocking) < 0.12.0~) +Requires: (crate(reqwest/default) >= 0.11.0 with crate(reqwest/default) < 0.12.0~) +Requires: (crate(reqwest/json) >= 0.11.0 with crate(reqwest/json) < 0.12.0~) +Requires: (crate(reqwest/rustls-tls) >= 0.11.0 with crate(reqwest/rustls-tls) < 0.12.0~) +Requires: (crate(reqwest/stream) >= 0.11.0 with crate(reqwest/stream) < 0.12.0~) +Requires: (crate(reqwest/trust-dns) >= 0.11.0 with crate(reqwest/trust-dns) < 0.12.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+reqwest-devel %{_description} + +This package contains library source intended for building other packages which +use the "reqwest" feature of the "%{crate}" crate. + +%files -n %{name}+reqwest-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rouille-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/rouille) = 0.7.4 +Requires: (crate(rouille) >= 3.6.0 with crate(rouille) < 4.0.0~) +Requires: (crate(rouille/ssl) >= 3.6.0 with crate(rouille/ssl) < 4.0.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+rouille-devel %{_description} + +This package contains library source intended for building other packages which +use the "rouille" feature of the "%{crate}" crate. + +%files -n %{name}+rouille-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+s3-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/s3) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/opendal) = 0.7.4 +Requires: crate(sccache/reqsign) = 0.7.4 + +%description -n %{name}+s3-devel %{_description} + +This package contains library source intended for building other packages which +use the "s3" feature of the "%{crate}" crate. + +%files -n %{name}+s3-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sha2-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/sha2) = 0.7.4 +Requires: (crate(sha2/default) >= 0.10.6 with crate(sha2/default) < 0.11.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+sha2-devel %{_description} + +This package contains library source intended for building other packages which +use the "sha2" feature of the "%{crate}" crate. + +%files -n %{name}+sha2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+syslog-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/syslog) = 0.7.4 +Requires: (crate(syslog/default) >= 6.0.0 with crate(syslog/default) < 7.0.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+syslog-devel %{_description} + +This package contains library source intended for building other packages which +use the "syslog" feature of the "%{crate}" crate. + +%files -n %{name}+syslog-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+trust-dns-resolver-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/trust-dns-resolver) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+trust-dns-resolver-devel %{_description} + +This package contains library source intended for building other packages which +use the "trust-dns-resolver" feature of the "%{crate}" crate. + +%files -n %{name}+trust-dns-resolver-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+unstable-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/unstable) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+unstable-devel %{_description} + +This package contains library source intended for building other packages which +use the "unstable" feature of the "%{crate}" crate. + +%files -n %{name}+unstable-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+url-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/url) = 0.7.4 +Requires: (crate(url/default) >= 2.0.0 with crate(url/default) < 3.0.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+url-devel %{_description} + +This package contains library source intended for building other packages which +use the "url" feature of the "%{crate}" crate. + +%files -n %{name}+url-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+vendored-openssl-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/vendored-openssl) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+vendored-openssl-devel %{_description} + +This package contains library source intended for building other packages which +use the "vendored-openssl" feature of the "%{crate}" crate. + +%files -n %{name}+vendored-openssl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+version-compare-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/version-compare) = 0.7.4 +Requires: (crate(version-compare/default) >= 0.1.1 with crate(version-compare/default) < 0.2.0~) +Requires: cargo +Requires: crate(sccache) = 0.7.4 + +%description -n %{name}+version-compare-devel %{_description} + +This package contains library source intended for building other packages which +use the "version-compare" feature of the "%{crate}" crate. + +%files -n %{name}+version-compare-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+webdav-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(sccache/webdav) = 0.7.4 +Requires: cargo +Requires: crate(sccache) = 0.7.4 +Requires: crate(sccache/opendal) = 0.7.4 + +%description -n %{name}+webdav-devel %{_description} + +This package contains library source intended for building other packages which +use the "webdav" feature of the "%{crate}" crate. + +%files -n %{name}+webdav-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep_online + + +%build +%if %{with dist_server} +%cargo_build -f dist-server +%else +%cargo_build +%endif + +%install +%if %{with dist_server} +%cargo_install -f dist-server +%else +%cargo_install +%endif + +%if %{with check} +%check +%if %{with dist_server} +%cargo_test -f dist-server +%else +%cargo_test +%endif + +%endif + +%changelog +* Mon Dec 18 2023 Cappy Ishihara - 0.7.4-1 +- Initial package diff --git a/anda/apps/sccache/sccache-fix-metadata-auto.diff b/anda/apps/sccache/sccache-fix-metadata-auto.diff new file mode 100644 index 0000000000..9b96ebe2e2 --- /dev/null +++ b/anda/apps/sccache/sccache-fix-metadata-auto.diff @@ -0,0 +1,14 @@ +--- sccache-0.7.4/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ sccache-0.7.4/Cargo.toml 2023-12-18T06:08:52.420382+00:00 +@@ -384,11 +384,3 @@ + [target."cfg(unix)".dependencies.daemonize] + version = "0.5" + +-[target."cfg(windows)".dependencies.winapi] +-version = "0.3" +-features = [ +- "fileapi", +- "handleapi", +- "stringapiset", +- "winnls", +-]