Name: re2j
Version: 1.6
Release: 1%{?dist}
Summary: Linear time regular expression matching in Java
License: BSD
URL: https://github.com/google/%{name}
BuildArch: noarch
Source0: %{url}/archive/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/com/google/%{name}/%{name}/%{version}/%{name}-%{version}.pom
BuildRequires: maven-local
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
%description
RE2 is a regular expression engine that runs in time linear in the size of the
input. RE2/J is a port of RE2 to pure Java.
Java's standard regular expression package, java.util.regex, and many other
widely used regular expression packages such as PCRE, Perl and Python use a
backtracking implementation strategy: when a pattern presents two alternatives
such as a|b, the engine will try to match subpattern a first, and if that
yields no match, it will reset the input stream and try to match b instead.
If such choices are deeply nested, this strategy requires an exponential number
of passes over the input data before it can detect whether the input matches.
If the input is large, it is easy to construct a pattern whose running time
would exceed the lifetime of the universe. This creates a security risk when
accepting regular expression patterns from untrusted sources, such as users of
a web application.
In contrast, the RE2 algorithm explores all matches simultaneously in a single
pass over the input data by using a nondeterministic finite automaton.
There are certain features of PCRE or Perl regular expressions that cannot be
implemented in linear time, for example, backreferences, but the vast majority
of regular expressions patterns in practice avoid such features.
%javadoc_package
%prep
%autosetup -n %{name}-%{name}-%{version}
find -type f '(' -name '*.jar' -o -name '*.class' ')' -delete
cp -p %{SOURCE1} pom.xml
# this file is excluded from main jar
rm -rf java/com/google/re2j/super
%pom_xpath_inject 'pom:project' '
java
'
%build
# truth and gwt is unavailable
%mvn_build -f -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%install
%mvn_install
%files -f .mfiles
%license LICENSE
%doc README.md CONTRIBUTING.md
%changelog
* Wed Sep 22 2021 Didik Supriadi - 1.6-1
- Initial package