From 977b9574ebb32d6701cc70cdc9b3ba21b2bb144e Mon Sep 17 00:00:00 2001 From: Simon Rupf Date: Mon, 9 Dec 2024 08:48:18 +0100 Subject: [PATCH] testing/jaq: upgrade to 2.0.1 - bump from 1.6.0 to 2.0.1 - remove cargo patch - add patch for tests on 32bit architecture, see: https://github.com/01mf02/jaq/issues/243 - package MIT license --- testing/jaq/32bit-tests.patch | 91 ++++++++++++++++++++++++++++++++++ testing/jaq/APKBUILD | 10 ++-- testing/jaq/cargo-update.patch | 16 ------ 3 files changed, 97 insertions(+), 20 deletions(-) create mode 100644 testing/jaq/32bit-tests.patch delete mode 100644 testing/jaq/cargo-update.patch diff --git a/testing/jaq/32bit-tests.patch b/testing/jaq/32bit-tests.patch new file mode 100644 index 000000000000..41229f002985 --- /dev/null +++ b/testing/jaq/32bit-tests.patch @@ -0,0 +1,91 @@ +Patch-Source: https://github.com/01mf02/jaq/commit/18aa0a8ac81b8321a453680fecf03b78961fd7ce +From 18aa0a8ac81b8321a453680fecf03b78961fd7ce Mon Sep 17 00:00:00 2001 +From: Simon Rupf +Date: Mon, 9 Dec 2024 19:08:43 +0100 +Subject: [PATCH] Changing test to pass on 32 bit architecture. + +Reduces large isize to remain below maximum for signed 32 bit int, +resolves #243 +--- + jaq-json/tests/funs.rs | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/jaq-json/tests/funs.rs b/jaq-json/tests/funs.rs +index 7aecdbe..d68ce55 100644 +--- a/jaq-json/tests/funs.rs ++++ b/jaq-json/tests/funs.rs +@@ -81,7 +81,7 @@ fn tojson() { + #[test] + fn math_rem() { + // generated with this command with modification for errors and float rounding +- // cargo run -- -rn 'def f: -2, -1, 0, 2.1, 3, 4000000001; f as $a | f as $b | "give!(json!(null), \"\($a) / \($b)\", \(try ($a % $b) catch tojson));"' ++ // cargo run -- -rn 'def f: -2, -1, 0, 2.1, 3, 2000000001; f as $a | f as $b | "give!(json!(null), \"\($a) / \($b)\", \(try ($a % $b) catch tojson));"' + // TODO: use fail!()? + give(json!(null), "-2 % -2", json!(0)); + give(json!(null), "-2 % -1", json!(0)); +@@ -92,7 +92,7 @@ fn math_rem() { + ); + give(json!(null), "-2 % 2.1", json!(-2.0)); + give(json!(null), "-2 % 3", json!(-2)); +- give(json!(null), "-2 % 4000000001", json!(-2)); ++ give(json!(null), "-2 % 2000000001", json!(-2)); + give(json!(null), "-1 % -2", json!(-1)); + give(json!(null), "-1 % -1", json!(0)); + give( +@@ -102,7 +102,7 @@ fn math_rem() { + ); + give(json!(null), "-1 % 2.1", json!(-1.0)); + give(json!(null), "-1 % 3", json!(-1)); +- give(json!(null), "-1 % 4000000001", json!(-1)); ++ give(json!(null), "-1 % 2000000001", json!(-1)); + give(json!(null), "0 % -2", json!(0)); + give(json!(null), "0 % -1", json!(0)); + give( +@@ -112,13 +112,13 @@ fn math_rem() { + ); + give(json!(null), "0 % 2.1", json!(0.0)); + give(json!(null), "0 % 3", json!(0)); +- give(json!(null), "0 % 4000000001", json!(0)); ++ give(json!(null), "0 % 2000000001", json!(0)); + give(json!(null), "2.1 % -2 | . * 1000 | round", json!(100)); + give(json!(null), "2.1 % -1 | . * 1000 | round", json!(100)); + give(json!(null), "2.1 % 0 | isnan", json!(true)); + give(json!(null), "2.1 % 2.1", json!(0.0)); + give(json!(null), "2.1 % 3", json!(2.1)); +- give(json!(null), "2.1 % 4000000001", json!(2.1)); ++ give(json!(null), "2.1 % 2000000001", json!(2.1)); + give(json!(null), "3 % -2", json!(1)); + give(json!(null), "3 % -1", json!(0)); + give( +@@ -128,19 +128,19 @@ fn math_rem() { + ); + give(json!(null), "3 % 2.1 | . * 1000 | round", json!(900)); + give(json!(null), "3 % 3", json!(0)); +- give(json!(null), "3 % 4000000001", json!(3)); +- give(json!(null), "4000000001 % -2", json!(1)); +- give(json!(null), "4000000001 % -1", json!(0)); ++ give(json!(null), "3 % 2000000001", json!(3)); ++ give(json!(null), "2000000001 % -2", json!(1)); ++ give(json!(null), "2000000001 % -1", json!(0)); + give( + json!(null), +- "try (4000000001 % 0) catch .", +- json!("cannot calculate 4000000001 % 0"), ++ "try (2000000001 % 0) catch .", ++ json!("cannot calculate 2000000001 % 0"), + ); + give( + json!(null), +- "4000000001 % 2.1 | . * 1000 | round", +- json!(500), ++ "2000000001 % 2.1 | . * 1000 | round", ++ json!(1800), // 1000 in jq + ); +- give(json!(null), "4000000001 % 3", json!(2)); +- give(json!(null), "4000000001 % 4000000001", json!(0)); ++ give(json!(null), "2000000001 % 3", json!(0)); ++ give(json!(null), "2000000001 % 2000000001", json!(0)); + } +-- +2.47.1 + diff --git a/testing/jaq/APKBUILD b/testing/jaq/APKBUILD index 76d05f21495c..3f6b5141adb2 100644 --- a/testing/jaq/APKBUILD +++ b/testing/jaq/APKBUILD @@ -1,15 +1,16 @@ # Maintainer: Hoang Nguyen pkgname=jaq -pkgver=1.6.0 +pkgver=2.0.1 pkgrel=0 pkgdesc="jq clone focused on correctness, speed and simplicity" url="https://github.com/01mf02/jaq" arch="all" license="MIT" makedepends="cargo cargo-auditable" +subpackages="$pkgname-doc" source=" https://github.com/01mf02/jaq/archive/v$pkgver/jaq-$pkgver.tar.gz - cargo-update.patch + 32bit-tests.patch " prepare() { @@ -28,9 +29,10 @@ check() { package() { install -Dm755 target/release/jaq -t "$pkgdir"/usr/bin/ + install -Dm644 LICENSE-MIT "$pkgdir"/usr/share/licenses/$pkgname/LICENSE-MIT } sha512sums=" -1ad7f313f175b3dc373d3627f8afde224e557c01c5c0e4ad17fce35034c1e85feb169ec3282aa44585a61ca08129a116e9aa2c72eaa471bb7395b2ad6331b3a1 jaq-1.6.0.tar.gz -44b5fb2e3d00835de1ef9252aa354ea6689d515d3c42ca12721a59f853672c3b32a9a3d0795a3c1f9b14b8d819c4d1c25294d3e309bab47e10fc51ea549d9522 cargo-update.patch +1b062c613a10352c43b34c141986cb34fcf0e4ce74078327bef1028e3acb227c8c40de2231f20ecfae9f9e510fd736e9f73ec42ceba9a3bc19df52f1e9e77a81 jaq-2.0.1.tar.gz +218a3dbf547717ddf9d7d96756c0c90804e03782b8ae9094d3bbd917442520c4fe6f2423fca874f545c0fde9fb9e3caf87daedc776cfc583f13fa5f7401f1bb2 32bit-tests.patch " diff --git a/testing/jaq/cargo-update.patch b/testing/jaq/cargo-update.patch deleted file mode 100644 index 5bb6789b746a..000000000000 --- a/testing/jaq/cargo-update.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 1b7b362..dcfd8c6 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -321,9 +321,9 @@ dependencies = [ - - [[package]] - name = "libc" --version = "0.2.147" -+version = "0.2.155" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - - [[package]] - name = "libm"