diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff5f1b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/jiff-0.1.8.crate diff --git a/0001-Downstream-only-Omit-doctests-that-require-hifitime.patch b/0001-Downstream-only-Omit-doctests-that-require-hifitime.patch new file mode 100644 index 0000000..248d1f2 --- /dev/null +++ b/0001-Downstream-only-Omit-doctests-that-require-hifitime.patch @@ -0,0 +1,35 @@ +From 4313121d95e9ad7ae0d4cc3c1eaf8c3b46c25ef4 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Thu, 22 Aug 2024 11:48:36 -0400 +Subject: [PATCH] Downstream-only: Omit doctests that require hifitime + +It is not worth packaging it solely for a couple of tiny examples. +--- + COMPARE.md | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/COMPARE.md b/COMPARE.md +index ccb0593..1a9257c 100644 +--- a/COMPARE.md ++++ b/COMPARE.md +@@ -1049,7 +1049,7 @@ In particular, when computing a duration from two `Epoch` values that spans + a positive leap second (a second gets repeated), `hifitime` will correctly + report the accurate duration: + +-```rust ++```ignore + use hifitime::{Duration, Epoch}; + + fn main() -> anyhow::Result<()> { +@@ -1103,7 +1103,7 @@ In contrast, `hifitime` appears to use saturating arithmetic everywhere (I've + not been able to find this behavior documented though, so I'm not clear on what + the intended semantics are): + +-```rust ++```ignore + use hifitime::{Duration, Epoch}; + + fn main() -> anyhow::Result<()> { +-- +2.46.0 + diff --git a/jiff-fix-metadata-auto.diff b/jiff-fix-metadata-auto.diff new file mode 100644 index 0000000..411878d --- /dev/null +++ b/jiff-fix-metadata-auto.diff @@ -0,0 +1,49 @@ +--- jiff-0.1.8/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ jiff-0.1.8/Cargo.toml 2024-08-22T16:15:10.136703+00:00 +@@ -123,46 +123,22 @@ + "tzdb-zoneinfo", + ] + js = [ +- "dep:wasm-bindgen", +- "dep:js-sys", + ] + logging = ["dep:log"] + serde = ["dep:serde"] + std = ["alloc"] + tz-system = [ + "std", +- "dep:windows-sys", + ] + tzdb-bundle-always = [ + "dep:jiff-tzdb", + "alloc", + ] + tzdb-bundle-platform = [ +- "dep:jiff-tzdb-platform", + "alloc", + ] + tzdb-zoneinfo = ["std"] + +-[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies.js-sys] +-version = "0.3.50" +-optional = true +- +-[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies.wasm-bindgen] +-version = "0.2.70" +-optional = true +- +-[target.'cfg(any(windows, target_family = "wasm"))'.dependencies.jiff-tzdb-platform] +-version = "0.1.0" +-optional = true +- + [target.'cfg(not(target_family = "wasm"))'.dev-dependencies.hifitime] + version = "3.9.0" + +-[target."cfg(windows)".dependencies.windows-sys] +-version = ">=0.52.0, <=0.59.*" +-features = [ +- "Win32_Foundation", +- "Win32_System_Time", +-] +-optional = true +-default-features = false diff --git a/jiff-fix-metadata.diff b/jiff-fix-metadata.diff new file mode 100644 index 0000000..28668c8 --- /dev/null +++ b/jiff-fix-metadata.diff @@ -0,0 +1,18 @@ +--- jiff-0.1.8/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ jiff-0.1.8/Cargo.toml 2024-08-22T16:15:18.035828+00:00 +@@ -81,7 +81,7 @@ + features = ["serde"] + + [dev-dependencies.chrono-tz] +-version = "0.9.0" ++version = ">=0.8.0, <0.10.0" + + [dev-dependencies.insta] + version = "1.39.0" +@@ -139,6 +139,3 @@ + ] + tzdb-zoneinfo = ["std"] + +-[target.'cfg(not(target_family = "wasm"))'.dev-dependencies.hifitime] +-version = "3.9.0" +- diff --git a/rust-jiff.rpmlintrc b/rust-jiff.rpmlintrc new file mode 100644 index 0000000..0244557 --- /dev/null +++ b/rust-jiff.rpmlintrc @@ -0,0 +1,2 @@ +# Feature metapackages are not supposed to have documentation! +addFilter(r"\+[-_\w]+-devel.noarch: W: no-documentation") diff --git a/rust-jiff.spec b/rust-jiff.spec new file mode 100644 index 0000000..d3cd004 --- /dev/null +++ b/rust-jiff.spec @@ -0,0 +1,172 @@ +# Generated by rust2rpm 26 +%bcond_without check +%global debug_package %{nil} + +%global crate jiff + +Name: rust-jiff +Version: 0.1.8 +Release: %autorelease +Summary: Date-time library that encourages you to jump into the pit of success + +License: Unlicense OR MIT +URL: https://crates.io/crates/jiff +Source: %{crates_source} +# Automatically generated patch to strip dependencies and normalize metadata +Patch: jiff-fix-metadata-auto.diff +# Manually created patch for downstream crate metadata changes +# * Allow chrono-tz 0.8.x; this is just for doctests anyway. +# https://bugzilla.redhat.com/show_bug.cgi?id=2273630 +# * Drop dev-dependency hifitime: not packaged, and only for doctests +Patch: jiff-fix-metadata.diff +# * Downstream-only: Omit doctests that require hifitime. It is not worth +# packaging it solely for a couple of tiny examples. +Patch10: 0001-Downstream-only-Omit-doctests-that-require-hifitime.patch + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: tomcli + +%global _description %{expand: +A date-time library that encourages you to jump into the pit of success. +This library is heavily inspired by the Temporal project.} + +%description %{_description} + +%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}/COPYING +%license %{crate_instdir}/LICENSE-MIT +%license %{crate_instdir}/UNLICENSE +%doc %{crate_instdir}/CHANGELOG.md +%doc %{crate_instdir}/COMPARE.md +%doc %{crate_instdir}/DESIGN.md +%doc %{crate_instdir}/PLATFORM.md +%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 + +%package -n %{name}+alloc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+alloc-devel %{_description} + +This package contains library source intended for building other packages which +use the "alloc" feature of the "%{crate}" crate. + +%files -n %{name}+alloc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+logging-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+logging-devel %{_description} + +This package contains library source intended for building other packages which +use the "logging" feature of the "%{crate}" crate. + +%files -n %{name}+logging-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+serde-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+serde-devel %{_description} + +This package contains library source intended for building other packages which +use the "serde" feature of the "%{crate}" crate. + +%files -n %{name}+serde-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+std-devel %{_description} + +This package contains library source intended for building other packages which +use the "std" feature of the "%{crate}" crate. + +%files -n %{name}+std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tz-system-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tz-system-devel %{_description} + +This package contains library source intended for building other packages which +use the "tz-system" feature of the "%{crate}" crate. + +%files -n %{name}+tz-system-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tzdb-bundle-platform-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tzdb-bundle-platform-devel %{_description} + +This package contains library source intended for building other packages which +use the "tzdb-bundle-platform" feature of the "%{crate}" crate. + +%files -n %{name}+tzdb-bundle-platform-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tzdb-zoneinfo-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tzdb-zoneinfo-devel %{_description} + +This package contains library source intended for building other packages which +use the "tzdb-zoneinfo" feature of the "%{crate}" crate. + +%files -n %{name}+tzdb-zoneinfo-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep +# Exclude test and debug scripts that would BuildRequire sh or bash +tomcli set Cargo.toml append package.exclude test test-wasm 'scripts/*' + +%generate_buildrequires +%cargo_generate_buildrequires -f serde + +%build +%cargo_build -f serde + +%install +%cargo_install -f serde + +%if %{with check} +%check +%cargo_test -f serde +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..c12eaa7 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (jiff-0.1.8.crate) = 7889ef134c32d41fe3f2308b31882d7046b8ae09359d77fbdbc58499c3a810aa3d17b299e1cfa4b0742e2bdbcec0662167a6fcdd9ce320c4e37077351d2f2ac7