From 843011aba931b4da58dcd2766260f2ce890b086b Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Thu, 29 Dec 2022 12:32:57 -0600 Subject: [PATCH] Initial Fedora package Signed-off-by: Michel Alexandre Salim --- .gitignore | 1 + pore-fix-metadata.diff | 27 ++++++++++++ pore-remove-copy_dir.diff | 11 +++++ pore-replace-isatty.diff | 19 +++++++++ rust-pore.spec | 90 +++++++++++++++++++++++++++++++++++++++ sources | 1 + 6 files changed, 149 insertions(+) create mode 100644 .gitignore create mode 100644 pore-fix-metadata.diff create mode 100644 pore-remove-copy_dir.diff create mode 100644 pore-replace-isatty.diff create mode 100644 rust-pore.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6952e17 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/pore-0.1.6.crate diff --git a/pore-fix-metadata.diff b/pore-fix-metadata.diff new file mode 100644 index 0000000..7f38987 --- /dev/null +++ b/pore-fix-metadata.diff @@ -0,0 +1,27 @@ +--- pore-0.1.6/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ pore-0.1.6/Cargo.toml 2022-12-28T21:24:29.408792+00:00 +@@ -31,9 +31,6 @@ + [dependencies.console] + version = "0.15.0" + +-[dependencies.copy_dir] +-version = "0.1.2" +- + [dependencies.dirs] + version = "4.0.0" + +@@ -50,11 +47,11 @@ + [dependencies.indoc] + version = "1.0" + +-[dependencies.isatty] +-version = "0.1.9" ++[dependencies.atty] ++version = "0.2" + + [dependencies.joinery] +-version = "2.1.0" ++version = "3.0" + + [dependencies.lazy_static] + version = "1.4.0" diff --git a/pore-remove-copy_dir.diff b/pore-remove-copy_dir.diff new file mode 100644 index 0000000..5478007 --- /dev/null +++ b/pore-remove-copy_dir.diff @@ -0,0 +1,11 @@ +--- a/src/depot.rs ++++ b/src/depot.rs +@@ -104,7 +104,7 @@ impl Depot { + ) + .context(format!("failed to create directory {:?}", dst))?; + +- copy_dir::copy_dir(&src, &dst).context(format!("failed to copy directory {:?} to {:?}", src, dst))?; ++ std::process::Command::new("cp").arg("-pr").arg(&src).arg(&dst).spawn().context(format!("failed to copy directory {:?} to {:?}", src, dst))?; + Ok(()) + } + diff --git a/pore-replace-isatty.diff b/pore-replace-isatty.diff new file mode 100644 index 0000000..541f4bb --- /dev/null +++ b/pore-replace-isatty.diff @@ -0,0 +1,19 @@ +--- a/src/main.rs ++++ b/src/main.rs +@@ -43,6 +43,7 @@ use std::path::{Path, PathBuf}; + use std::sync::Arc; + + use anyhow::{Context, Error}; ++use atty::Stream; + use joinery::Joinable; + use progpool::{Job, Pool}; + +@@ -792,7 +793,7 @@ fn main() { + }; + let mut pool = Pool::with_size(pool_size); + +- let update_checker = if config.update_check && isatty::stdout_isatty() { ++ let update_checker = if config.update_check && atty::is(Stream::Stdout) { + Some(UpdateChecker::fetch()) + } else { + None diff --git a/rust-pore.spec b/rust-pore.spec new file mode 100644 index 0000000..66a2b12 --- /dev/null +++ b/rust-pore.spec @@ -0,0 +1,90 @@ +# Generated by rust2rpm 23 +%bcond_without check + +%global crate pore + +Name: rust-pore +Version: 0.1.6 +Release: %autorelease +Summary: Performance oriented reimplementation of repo + +License: Apache-2.0 +URL: https://crates.io/crates/pore +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# - drop copy_dir +# - replace isatty with atty +# - bump joinery to 3.0 +Patch: pore-fix-metadata.diff +# Based on merged https://github.com/jmgao/pore/pull/98 +Patch: pore-replace-isatty.diff +# Not upstreamed yet as the current patch is POSIX only +Patch: pore-remove-copy_dir.diff + +BuildRequires: rust-packaging >= 21 + +%global _description %{expand: +Performance oriented reimplementation of repo.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +License: Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND 0BSD AND BSD-3-Clause AND MIT AND GPL-2.0-only WITH GCC-exception-2.0 AND Unicode-DFS-2016 +# LICENSE.dependencies contains a full license breakdown + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%license LICENSE.dependencies +%doc README.md +%{_bindir}/pore + +%package devel +Summary: %{summary} +BuildArch: noarch + +%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}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%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 + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..9f9197b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pore-0.1.6.crate) = aaa92a82f6d6340ee6ea911989f6bd3554ec7b4108144d1d3e699ed8c9fd81274d33d15b203dfa4a2e06123471bc23b25a35b95abd537003bc784c25a4dca343