From ce346572fa780fd46a240d7fec33ed2a7e2f6904 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Mar 2018 22:45:27 -0700 Subject: [PATCH] Bump regex-syntax to 0.5 --- 0001-Update-to-regex-syntax-0.5.patch | 66 +++++++++++++++++++++++++++ fd-find-6.2.0-fix-metadata.diff | 32 ------------- fd-find-6.3.0-fix-metadata.diff | 17 +++++-- rust-fd-find.spec | 9 +++- 4 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 0001-Update-to-regex-syntax-0.5.patch delete mode 100644 fd-find-6.2.0-fix-metadata.diff diff --git a/0001-Update-to-regex-syntax-0.5.patch b/0001-Update-to-regex-syntax-0.5.patch new file mode 100644 index 0000000..fec482d --- /dev/null +++ b/0001-Update-to-regex-syntax-0.5.patch @@ -0,0 +1,66 @@ +From 5616ca398ffa54643ae3c139518060d4523be687 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Wed, 7 Mar 2018 21:48:02 -0800 +Subject: [PATCH] Update to regex-syntax 0.5 + +The new regex 0.2.7 has updated to regex-syntax 0.5, so it seems prudent +to update fd's dependency too, if only to avoid duplication. +--- + src/internal.rs | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/src/internal.rs b/src/internal.rs +index fe9a43db5640..a2bb96a89772 100644 +--- a/src/internal.rs ++++ b/src/internal.rs +@@ -15,7 +15,8 @@ use std::io::Write; + use exec::CommandTemplate; + use lscolors::LsColors; + use walk::FileType; +-use regex_syntax::{Expr, ExprBuilder}; ++use regex_syntax::Parser; ++use regex_syntax::hir::Hir; + use regex::RegexSet; + + /// Configuration options for *fd*. +@@ -83,22 +84,27 @@ pub fn error(message: &str) -> ! { + + /// Determine if a regex pattern contains a literal uppercase character. + pub fn pattern_has_uppercase_char(pattern: &str) -> bool { +- ExprBuilder::new() ++ Parser::new() + .parse(pattern) +- .map(|expr| expr_has_uppercase_char(&expr)) ++ .map(|hir| hir_has_uppercase_char(&hir)) + .unwrap_or(false) + } + + /// Determine if a regex expression contains a literal uppercase character. +-fn expr_has_uppercase_char(expr: &Expr) -> bool { +- match *expr { +- Expr::Literal { ref chars, .. } => chars.iter().any(|c| c.is_uppercase()), +- Expr::Class(ref ranges) => ranges ++fn hir_has_uppercase_char(hir: &Hir) -> bool { ++ use regex_syntax::hir::*; ++ ++ match *hir.kind() { ++ HirKind::Literal(Literal::Unicode(c)) => c.is_uppercase(), ++ HirKind::Class(Class::Unicode(ref ranges)) => ranges + .iter() +- .any(|r| r.start.is_uppercase() || r.end.is_uppercase()), +- Expr::Group { ref e, .. } | Expr::Repeat { ref e, .. } => expr_has_uppercase_char(e), +- Expr::Concat(ref es) => es.iter().any(expr_has_uppercase_char), +- Expr::Alternate(ref es) => es.iter().any(expr_has_uppercase_char), ++ .any(|r| r.start().is_uppercase() || r.end().is_uppercase()), ++ HirKind::Group(Group { ref hir, .. }) | HirKind::Repetition(Repetition { ref hir, .. }) => { ++ hir_has_uppercase_char(hir) ++ } ++ HirKind::Concat(ref hirs) | HirKind::Alternation(ref hirs) => { ++ hirs.iter().any(hir_has_uppercase_char) ++ } + _ => false, + } + } +-- +2.14.3 + diff --git a/fd-find-6.2.0-fix-metadata.diff b/fd-find-6.2.0-fix-metadata.diff deleted file mode 100644 index c36901a..0000000 --- a/fd-find-6.2.0-fix-metadata.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- fd-find-6.2.0/Cargo.toml 1970-01-01T01:00:00+01:00 -+++ fd-find-6.2.0/Cargo.toml 2018-01-04T13:38:49.234315+01:00 -@@ -28,7 +28,7 @@ - name = "fd" - path = "src/main.rs" - [dependencies.ansi_term] --version = "0.9" -+version = "0.10" - - [dependencies.atty] - version = "0.2" -@@ -41,7 +41,7 @@ - version = "3.0" - - [dependencies.ignore] --version = "0.2" -+version = "0.3" - - [dependencies.lazy_static] - version = "1" -@@ -66,11 +66,6 @@ - version = "0.1.3" - [target."cfg(all(unix, not(target_os = \"redox\")))".dependencies.libc] - version = "0.2" --[target."cfg(windows)".dependencies.kernel32-sys] --version = "0.2" -- --[target."cfg(windows)".dependencies.winapi] --version = "0.2" - [badges.appveyor] - repository = "sharkdp/fd" - diff --git a/fd-find-6.3.0-fix-metadata.diff b/fd-find-6.3.0-fix-metadata.diff index 8cdd110..61e7bae 100644 --- a/fd-find-6.3.0-fix-metadata.diff +++ b/fd-find-6.3.0-fix-metadata.diff @@ -1,5 +1,5 @@ ---- fd-find-6.3.0/Cargo.toml 1970-01-01T01:00:00+01:00 -+++ fd-find-6.3.0/Cargo.toml 2018-02-12T17:06:09.462395+01:00 +--- fd-find-6.3.0/Cargo.toml 1969-12-31T16:00:00-08:00 ++++ fd-find-6.3.0/Cargo.toml 2018-03-08T10:21:06.328193-08:00 @@ -28,7 +28,7 @@ name = "fd" path = "src/main.rs" @@ -18,13 +18,22 @@ [dependencies.lazy_static] version = "1" -@@ -66,11 +66,6 @@ +@@ -53,7 +53,7 @@ + version = "0.2" + + [dependencies.regex-syntax] +-version = "0.4" ++version = "0.5" + [dev-dependencies.diff] + version = "0.1" + +@@ -66,11 +66,7 @@ version = "0.1.3" [target."cfg(all(unix, not(target_os = \"redox\")))".dependencies.libc] version = "0.2" -[target."cfg(windows)".dependencies.kernel32-sys] -version = "0.2" -- + -[target."cfg(windows)".dependencies.winapi] -version = "0.2" [badges.appveyor] diff --git a/rust-fd-find.spec b/rust-fd-find.spec index 1f28071..03b002d 100644 --- a/rust-fd-find.spec +++ b/rust-fd-find.spec @@ -5,7 +5,7 @@ Name: rust-%{crate} Version: 6.3.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Simple, fast and user-friendly alternative to find License: MIT or ASL 2.0 @@ -13,8 +13,10 @@ URL: https://crates.io/crates/fd-find Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate # Initial patched metadata # * Bump ansi_term to 0.10, ignore to 0.4: https://github.com/sharkdp/fd/pull/173 +# * Bump regex-syntax to 0.5: https://github.com/sharkdp/fd/pull/254 # * No windows Patch0: fd-find-6.3.0-fix-metadata.diff +Patch1: 0001-Update-to-regex-syntax-0.5.patch ExclusiveArch: %{rust_arches} @@ -29,7 +31,7 @@ BuildRequires: (crate(lazy_static) >= 1.0.0 with crate(lazy_static) < 2.0.0) BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0) BuildRequires: (crate(num_cpus) >= 1.6.2 with crate(num_cpus) < 2.0.0) BuildRequires: (crate(regex) >= 0.2.0 with crate(regex) < 0.3.0) -BuildRequires: (crate(regex-syntax) >= 0.4.0 with crate(regex-syntax) < 0.5.0) +BuildRequires: (crate(regex-syntax) >= 0.5.0 with crate(regex-syntax) < 0.6.0) # [build-dependencies] BuildRequires: (crate(clap) >= 2.26.0 with crate(clap) < 3.0.0) BuildRequires: (crate(version_check) >= 0.1.3 with crate(version_check) < 0.2.0) @@ -86,6 +88,9 @@ Summary: %{summary} %{_datadir}/zsh/site-functions/_fd %changelog +* Wed Mar 14 2018 Josh Stone - 0.2.9-1 +- Bump regex-syntax to 0.5 + * Mon Feb 12 2018 Igor Gnatenko - 6.3.0-1 - Update to 6.3.0