From 25fc46e3973268a117d2d8cf2e7b20bd893aa1f1 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 2 Oct 2024 07:15:13 -0400 Subject: [PATCH] Update to 7.0.0 --- .gitignore | 1 + ...-by-allocating-less-memory-by-runnin.patch | 71 ---------------- 219.patch | 13 +++ brotli-6.0.0-license-accuracy.patch | 32 ------- brotli-fix-metadata.diff | 11 +-- rust-brotli.spec | 85 ++++++++++++++----- rust2rpm.toml | 37 +------- sources | 2 +- 8 files changed, 84 insertions(+), 168 deletions(-) delete mode 100644 0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch create mode 100644 219.patch delete mode 100644 brotli-6.0.0-license-accuracy.patch diff --git a/.gitignore b/.gitignore index 8be70e4..7c6d2c5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /brotli-3.4.0.crate /brotli-3.5.0.crate /brotli-6.0.0.crate +/brotli-7.0.0.crate diff --git a/0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch b/0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch deleted file mode 100644 index edba55f..0000000 --- a/0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 64a98f1bdc2a37c4dd1f29ee6886ed5f4688439e Mon Sep 17 00:00:00 2001 -From: Daniel Reiter Horn -Date: Wed, 2 Oct 2024 00:43:00 -0700 -Subject: [PATCH] Fix 32 bit tests by allocating less memory by running with - less parallelism in that case - ---- - src/enc/test.rs | 33 ++++++++++++++++++++++++++++++++- - 1 file changed, 32 insertions(+), 1 deletion(-) - -diff --git a/src/enc/test.rs b/src/enc/test.rs -index 744472b..854d9b8 100755 ---- a/src/enc/test.rs -+++ b/src/enc/test.rs -@@ -211,6 +211,34 @@ fn oneshot_compress( - - (true, next_out_offset) - } -+static lock32: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0); -+ -+/// 32bit systems do not have sufficient memory to compress multiple items -+/// at the same time with the current limits and defaults. So we instead spin -+/// until a process has completed compression. We cannot use proper locks -+/// in nostd, so we fall back to this simple spin lock. -+#[cfg(target_pointer_width = "32")] -+fn lock_if_32bit(){ -+ use core::sync::atomic::Ordering; -+ loop { -+ let cur = lock32.fetch_add(1, Ordering::SeqCst); -+ if cur == 0 { -+ return; -+ } -+ lock32.fetch_sub(1, Ordering::SeqCst); -+ } -+} -+#[cfg(target_pointer_width = "32")] -+fn unlock_if_32bit(){ -+ use core::sync::atomic::Ordering; -+ lock32.fetch_sub(1, Ordering::SeqCst); -+} -+#[cfg(not(target_pointer_width = "32"))] -+fn lock_if_32bit(){ -+} -+#[cfg(not(target_pointer_width = "32"))] -+fn unlock_if_32bit(){ -+} - - fn oneshot_decompress(compressed: &[u8], output: &mut [u8]) -> (BrotliResult, usize, usize) { - let mut available_in: usize = compressed.len(); -@@ -255,6 +283,7 @@ fn oneshot( - in_buffer_size: usize, - out_buffer_size: usize, - ) -> (BrotliResult, usize, usize) { -+ lock_if_32bit(); - let (success, mut available_in) = oneshot_compress( - input, - compressed, -@@ -268,7 +297,9 @@ fn oneshot( - //return (BrotliResult::ResultFailure, 0, 0); - available_in = compressed.len(); - } -- oneshot_decompress(&mut compressed[..available_in], output) -+ let ret = oneshot_decompress(&mut compressed[..available_in], output); -+ unlock_if_32bit(); -+ ret - } - - #[test] --- -2.46.1 - diff --git a/219.patch b/219.patch new file mode 100644 index 0000000..aed9f24 --- /dev/null +++ b/219.patch @@ -0,0 +1,13 @@ +From c14dfea3af98729663eb46577d00d283d90ef6d1 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Wed, 2 Oct 2024 07:10:40 -0400 +Subject: [PATCH] Remove unwanted executable permission from src/enc/test.rs + +--- + src/enc/test.rs | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + mode change 100755 => 100644 src/enc/test.rs + +diff --git a/src/enc/test.rs b/src/enc/test.rs +old mode 100755 +new mode 100644 diff --git a/brotli-6.0.0-license-accuracy.patch b/brotli-6.0.0-license-accuracy.patch deleted file mode 100644 index ba09783..0000000 --- a/brotli-6.0.0-license-accuracy.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/LICENSE b/LICENSE.BSD-3-Clause -similarity index 100% -rename from LICENSE -rename to LICENSE.BSD-3-Clause -diff --git a/LICENSE.MIT b/LICENSE.MIT -new file mode 100644 -index 0000000..33b7cdd ---- /dev/null -+++ b/LICENSE.MIT -@@ -0,0 +1,19 @@ -+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -+ -+Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to deal -+in the Software without restriction, including without limitation the rights -+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included in -+all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -+THE SOFTWARE. --- -2.46.1 - diff --git a/brotli-fix-metadata.diff b/brotli-fix-metadata.diff index cc49baa..aad224f 100644 --- a/brotli-fix-metadata.diff +++ b/brotli-fix-metadata.diff @@ -1,11 +1,8 @@ ---- brotli-6.0.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ brotli-6.0.0/Cargo.toml 2024-10-02T11:06:05.778047+00:00 -@@ -34,8 +34,17 @@ - "compression", - "no-std", +--- brotli-7.0.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ brotli-7.0.0/Cargo.toml 2024-10-02T11:16:18.293205+00:00 +@@ -36,6 +36,15 @@ ] --license = "BSD-3-Clause OR MIT" -+license = "BSD-3-Clause AND MIT" + license = "BSD-3-Clause AND MIT" repository = "https://github.com/dropbox/rust-brotli" +exclude = [ + "/ci/", diff --git a/rust-brotli.spec b/rust-brotli.spec index c1af70e..b074b07 100644 --- a/rust-brotli.spec +++ b/rust-brotli.spec @@ -8,7 +8,7 @@ %global crate brotli Name: rust-brotli -Version: 6.0.0 +Version: 7.0.0 Release: %autorelease Summary: Brotli compressor and decompressor with no_std support @@ -16,27 +16,11 @@ License: BSD-3-Clause AND MIT URL: https://crates.io/crates/brotli Source: %{crates_source} # Manually created patch for downstream crate metadata changes -# * Adjust license from BSD-3-Clause/MIT to BSD-3-Clause AND MIT; see -# https://github.com/dropbox/rust-brotli/issues/41, -# https://github.com/dropbox/rust-brotli/pull/218 (which was merged upstream), -# and Patch10. See also the similar PR -# https://github.com/dropbox/rust-brotli-decompressor/pull/32, which was -# merged, but note comments in -# https://github.com/dropbox/rust-brotli/pull/218: we should be attentive to -# future improvements or corrections to the license texts. # * Exclude files that are only useful for upstream development: # https://github.com/dropbox/rust-brotli/pull/43 Patch: brotli-fix-metadata.diff -# * Adjust license to reflect a MIT-only source, and add a MIT license file -# (https://github.com/dropbox/rust-brotli/pull/218), without the changes to -# Cargo.toml (which are applied manually to the normalized Cargo.toml in the -# crate). -Patch10: brotli-6.0.0-license-accuracy.patch -# * Fix 32 bit tests by allocating less memory by running with less parallelism -# in that case: -# https://github.com/dropbox/rust-brotli/commit/0462558646c0d0c346f7e152377b33e9d9d507af -# (cherry-picked to 6.0.0) -Patch11: 0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch +# * Remove unwanted executable permission from src/enc/test.rs +Patch10: https://github.com/dropbox/rust-brotli/pull/219.patch BuildRequires: cargo-rpm-macros >= 26 @@ -89,6 +73,18 @@ use the "alloc-stdlib" feature of the "%{crate}" crate. %files -n %{name}+alloc-stdlib-devel %ghost %{crate_instdir}/Cargo.toml +%package -n %{name}+billing-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+billing-devel %{_description} + +This package contains library source intended for building other packages which +use the "billing" feature of the "%{crate}" crate. + +%files -n %{name}+billing-devel +%ghost %{crate_instdir}/Cargo.toml + %package -n %{name}+disable-timer-devel Summary: %{summary} BuildArch: noarch @@ -101,6 +97,18 @@ use the "disable-timer" feature of the "%{crate}" crate. %files -n %{name}+disable-timer-devel %ghost %{crate_instdir}/Cargo.toml +%package -n %{name}+disallow_large_window_size-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+disallow_large_window_size-devel %{_description} + +This package contains library source intended for building other packages which +use the "disallow_large_window_size" feature of the "%{crate}" crate. + +%files -n %{name}+disallow_large_window_size-devel +%ghost %{crate_instdir}/Cargo.toml + %package -n %{name}+external-literal-probability-devel Summary: %{summary} BuildArch: noarch @@ -125,6 +133,42 @@ use the "ffi-api" feature of the "%{crate}" crate. %files -n %{name}+ffi-api-devel %ghost %{crate_instdir}/Cargo.toml +%package -n %{name}+float64-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+float64-devel %{_description} + +This package contains library source intended for building other packages which +use the "float64" feature of the "%{crate}" crate. + +%files -n %{name}+float64-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+floating_point_context_mixing-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+floating_point_context_mixing-devel %{_description} + +This package contains library source intended for building other packages which +use the "floating_point_context_mixing" feature of the "%{crate}" crate. + +%files -n %{name}+floating_point_context_mixing-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+no-stdlib-ffi-binding-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+no-stdlib-ffi-binding-devel %{_description} + +This package contains library source intended for building other packages which +use the "no-stdlib-ffi-binding" feature of the "%{crate}" crate. + +%files -n %{name}+no-stdlib-ffi-binding-devel +%ghost %{crate_instdir}/Cargo.toml + %package -n %{name}+pass-through-ffi-panics-devel Summary: %{summary} BuildArch: noarch @@ -211,9 +255,6 @@ use the "vector_scratch_space" feature of the "%{crate}" crate. %prep %autosetup -n %{crate}-%{version} -p1 -# Remove executable flag from .rs files -# https://github.com/dropbox/rust-brotli/pull/181 -find -type f -name '*.rs' -executable -exec chmod -x '{}' + %cargo_prep %generate_buildrequires diff --git a/rust2rpm.toml b/rust2rpm.toml index bee1e34..99b3bf5 100644 --- a/rust2rpm.toml +++ b/rust2rpm.toml @@ -1,16 +1,6 @@ [package] summary = "Brotli compressor and decompressor with no_std support" cargo-toml-patch-comments = [ - """\ - Adjust license from BSD-3-Clause/MIT to BSD-3-Clause AND MIT; see \ - https://github.com/dropbox/rust-brotli/issues/41, \ - https://github.com/dropbox/rust-brotli/pull/218 (which was merged \ - upstream), and Patch10. See also the similar PR - https://github.com/dropbox/rust-brotli-decompressor/pull/32, which was - merged, but note comments in https://github.com/dropbox/rust-brotli/pull/218: \ - we should be attentive to future improvements or corrections to the license \ - texts.\ - """, """\ Exclude files that are only useful for upstream development: \ https://github.com/dropbox/rust-brotli/pull/43\ @@ -29,32 +19,9 @@ hide = [ "benchmark", ] -[scripts.prep] -pre = [ - "# Remove executable flag from .rs files", - "# https://github.com/dropbox/rust-brotli/pull/181", - "find -type f -name '*.rs' -executable -exec chmod -x '{}' +", -] - [[package.extra-patches]] number = 10 -file = "brotli-6.0.0-license-accuracy.patch" +file = "https://github.com/dropbox/rust-brotli/pull/219.patch" comments = [ - """\ - Adjust license to reflect a MIT-only source, and add a MIT license file \ - (https://github.com/dropbox/rust-brotli/pull/218), without the \ - changes to Cargo.toml (which are applied manually to the normalized \ - Cargo.toml in the crate).\ - """ -] -[[package.extra-patches]] -number = 11 -file = "0001-Fix-32-bit-tests-by-allocating-less-memory-by-runnin.patch" -comments = [ - """\ - Fix 32 bit tests by allocating less memory by running with less parallelism - in that case: \ - https://github.com/dropbox/rust-brotli/commit/0462558646c0d0c346f7e152377b33e9d9d507af \ - (cherry-picked to 6.0.0)\ - """ + "Remove unwanted executable permission from src/enc/test.rs", ] diff --git a/sources b/sources index 020399d..fec6a4a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (brotli-6.0.0.crate) = 6d53d3ab653aa3545f0da397796efa1110d445ab8f46456c7501f84ce1c48c99235ae05857f6e91b138521158268691b3a97524f2d3622d69986837dcb64c19d +SHA512 (brotli-7.0.0.crate) = 577b2efc324bf461e06af94b8b509a095a917d4ecb2bfd2f3097ab4663ad699317c2fdb0b470344c762589c75dfac073b828603ce5609295ddf1748a39b75622