summary refs log tree commit diff
diff options
context:
space:
mode:
authorphodina <phodina@protonmail.com>2021-11-09 17:04:49 +0000
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2021-11-15 11:39:17 +0100
commitce9b9e7cba87f648dff911d5c055e2a833c25c43 (patch)
tree148e7b7ce3cd4760c6180ae5394f4946db018558
parente5354455e58e5c33d41b28dedb9d1f36c13d5dc9 (diff)
downloadguix-ce9b9e7cba87f648dff911d5c055e2a833c25c43.tar.gz
gnu: Add rust-adblock-0.4.
* gnu/packages/crates-io.scm (rust-adblock-0.4): New variable.
* gnu/packages/patches/rust-adblock-ignore-live-tests.patch: New file.
* gnu/local.mk: Add patch.

Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/crates-io.scm54
-rw-r--r--gnu/packages/patches/rust-adblock-ignore-live-tests.patch69
3 files changed, 124 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 208875754b..5b21a6ee1b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1752,6 +1752,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \
   %D%/packages/patches/rust-1.45-linker-locale.patch		\
   %D%/packages/patches/rust-1.48-linker-locale.patch		\
+  %D%/packages/patches/rust-adblock-ignore-live-tests.patch		\
   %D%/packages/patches/rust-bootstrap-stage0-test.patch		\
   %D%/packages/patches/rust-coresimd-doctest.patch		\
   %D%/packages/patches/rust-ndarray-remove-blas-src-dep.patch	\
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 692cd2a28b..9327ed5e1c 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -984,6 +984,60 @@ threads.  This makes it robust in face of panics (it won't make your program
 deadlock, like the standard Barrier).")
     (license (list license:asl2.0 license:expat))))
 
+(define-public rust-adblock-0.4
+  (package
+    (name "rust-adblock")
+    (version "0.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/brave/adblock-rust")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (patches (search-patches "rust-adblock-ignore-live-tests.patch"))
+       (sha256
+        (base32
+         "0l2iacwkm66z6wc71wy62x2k5xllx94adrqncicxqsx203c3ljpl"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-addr" ,rust-addr-0.14)
+        ("rust-base64" ,rust-base64-0.13)
+        ("rust-bitflags" ,rust-bitflags-1)
+        ("rust-cssparser" ,rust-cssparser-0.25)
+        ("rust-flate2" ,rust-flate2-1)
+        ("rust-idna" ,rust-idna-0.2)
+        ("rust-itertools" ,rust-itertools-0.10)
+        ("rust-lifeguard" ,rust-lifeguard-0.6)
+        ("rust-once-cell" ,rust-once-cell-1)
+        ("rust-percent-encoding"
+         ,rust-percent-encoding-2)
+        ("rust-regex" ,rust-regex-1)
+        ("rust-rmp-serde" ,rust-rmp-serde-0.13)
+        ("rust-rmp-serde" ,rust-rmp-serde-0.15)
+        ("rust-seahash" ,rust-seahash-3)
+        ("rust-selectors" ,rust-selectors-0.21)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-twoway" ,rust-twoway-0.2)
+        ("rust-url" ,rust-url-2))
+       #:cargo-development-inputs
+       (("rust-criterion" ,rust-criterion-0.3)
+        ("rust-csv" ,rust-csv-1)
+        ("rust-futures" ,rust-futures-0.3)
+        ("rust-reqwest" ,rust-reqwest-0.11)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-sha2" ,rust-sha2-0.9)
+        ("rust-tokio" ,rust-tokio-1.8))))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("openssl" ,openssl)))
+    (home-page "https://github.com/brave/adblock-rust/")
+    (synopsis "Adblock Plus syntax filter parsing and matching")
+    (description "This package provides native Rust module for Adblock Plus
+syntax (e.g.  EasyList, EasyPrivacy) filter parsing and matching.")
+    (license license:mpl2.0)))
+
 (define-public rust-addr2line-0.14
   (package
     (name "rust-addr2line")
diff --git a/gnu/packages/patches/rust-adblock-ignore-live-tests.patch b/gnu/packages/patches/rust-adblock-ignore-live-tests.patch
new file mode 100644
index 0000000000..fc7f2858ff
--- /dev/null
+++ b/gnu/packages/patches/rust-adblock-ignore-live-tests.patch
@@ -0,0 +1,69 @@
+From b83b5b453d3f7883ef4c12f84a7045486957c709 Mon Sep 17 00:00:00 2001
+From: Petr Hodina <phodina@protonmail.com>
+Date: Tue, 9 Nov 2021 17:02:54 +0100
+Subject: [PATCH] Ignore live tests.
+
+
+diff --git a/tests/live.rs b/tests/live.rs
+index b1a19fc..6bd4685 100644
+--- a/tests/live.rs
++++ b/tests/live.rs
+@@ -140,6 +140,7 @@ fn get_blocker_engine_deserialized_ios() -> Engine {
+ }
+
+ #[test]
++#[ignore]
+ fn check_live_specific_urls() {
+     let mut engine = get_blocker_engine();
+     {
+@@ -176,6 +177,7 @@ fn check_live_specific_urls() {
+ }
+
+ #[test]
++#[ignore]
+ fn check_live_deserialized_specific_urls() {
+     let mut engine = get_blocker_engine_deserialized();
+     {
+@@ -201,6 +203,7 @@ fn check_live_deserialized_specific_urls() {
+ }
+
+ #[test]
++#[ignore]
+ fn check_live_from_filterlists() {
+     let engine = get_blocker_engine();
+     let requests = load_requests();
+@@ -214,6 +217,7 @@ fn check_live_from_filterlists() {
+ }
+
+ #[test]
++#[ignore]
+ fn check_live_deserialized_file() {
+     let engine = get_blocker_engine_deserialized();
+     let requests = load_requests();
+@@ -243,6 +247,7 @@ fn check_live_deserialized_ios() {
+
+ #[cfg(feature = "resource_assembler")]
+ #[test]
++#[ignore]
+ fn check_live_redirects() {
+     use adblock::resources::resource_assembler::assemble_web_accessible_resources;
+
+@@ -278,6 +283,7 @@ fn check_live_redirects() {
+ }
+
+ #[test]
++#[ignore]
+ /// Ensure that two different engines loaded from the same textual filter set serialize to
+ /// identical buffers.
+ fn stable_serialization() {
+@@ -291,6 +297,7 @@ fn stable_serialization() {
+ }
+
+ #[test]
++#[ignore]
+ /// Ensure that one engine's serialization result can be exactly reproduced by another engine after
+ /// deserializing from it.
+ fn stable_serialization_through_load() {
+--
+2.33.1
+