Name:           slf4j
Version:        1.7.25
Release:        9
Epoch:          0
Summary:        Simple Logging Facade for Java(SLF4J)
License:        MIT and ASL 2.0
URL:            http://www.slf4j.org/
Source0:        http://www.slf4j.org/dist/slf4j-%{version}.tar.gz
Source1:        http://www.apache.org/licenses/LICENSE-2.0.txt
BuildArch:      noarch
BuildRequires:  mvn(ch.qos.cal10n:cal10n-api) mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires:  mvn(org.apache.maven.plugins:maven-antrun-plugin) mvn(commons-lang:commons-lang)
BuildRequires:  mvn(commons-logging:commons-logging) mvn(javassist:javassist) maven-local
BuildRequires:  mvn(org.codehaus.mojo:build-helper-maven-plugin) mvn(log4j:log4j:1.2.17)
# Disallow EventData deserialization by default
Patch0000:      0001-Disallow-EventData-deserialization-by-default.patch

%description
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various
logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the
desired logging framework at deployment time.Before you start using SLF4J, we highly recommend
that you read the two-page SLF4J user manual. Note that SLF4J-enabling your library implies the
addition of only a single mandatory dependency, namely slf4j-api.jar. If no binding is found on
the class path, then SLF4J will default to a no-operation implementation. In case you wish to
migrate your Java source files to SLF4J, consider our migrator tool which can migrate your project
to use the SLF4J API in just a few minutes. In case an externally-maintained component you depend
on uses a logging API other than SLF4J, such as commons logging, log4j or java.util.logging, have
a look at SLF4J's binary-support for legacy APIs.

%package        help
Summary:        Help documentation for slf4j
Provides:       slf4j-javadoc = %{epoch}:%{version}-%{release} slf4j-manual = %{epoch}:%{version}-%{release}
Obsoletes:      slf4j-javedoc < %{epoch}:%{version}-%{release} slf4j-manual < %{epoch}:%{version}-%{release}

%description    help
Help documentation for slf4j.

%package        jdk14
Summary:        JDK14 Binding of SLF4J

%description    jdk14
JDK14 Binding of SLF4J.

%package        log4j12
Summary:        LOG4J-12 Binding of SLF4J

%description    log4j12
LOG4J-12 Binding of SLF4J.

%package        jcl
Summary:        JCL Binding of SLF4J

%description    jcl
JCL Binding of SLF4J.

%package        ext
Summary:        Extensions Module of SLF4J

%description    ext
Extensions Module of SLF4J.

%package -n     jcl-over-slf4j
Summary:        JCL 1.1.1 implemented over SLF4J

%description -n jcl-over-slf4j
JCL 1.1.1 implemented over SLF4J.

%package -n     log4j-over-slf4j
Summary:        Log4j implemented over SLF4J

%description -n log4j-over-slf4j
Log4j implemented over SLF4J.

%package -n     jul-to-slf4j
Summary:        JUL to SLF4J bridge

%description -n jul-to-slf4j
JUL to SLF4J bridge.

%package        sources
Summary:        Source JARs of SLF4J

%description    sources
Source JARs of SLF4J.

%prep
%autosetup -p1
find . -name "*.jar" | xargs rm
cp -p %{SOURCE1} APACHE-LICENSE

%pom_disable_module integration
%pom_disable_module osgi-over-slf4j
%pom_disable_module slf4j-android
%pom_disable_module slf4j-migrator

%pom_xpath_inject "pom:project/pom:properties" "
    <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>"

%pom_xpath_remove "pom:links"

%pom_xpath_inject "pom:plugin[pom:artifactId[text()='maven-javadoc-plugin']]/pom:configuration" "
    <detectJavaApiLink>false</detectJavaApiLink>
    <isOffline>false</isOffline>
    <links><link>/usr/share/javadoc/java</link></links>"

find -name "*.css" -o -name "*.js" -o -name "*.txt" | xargs -t sed -i 's/\r$//'

%pom_xpath_remove pom:extensions

%pom_xpath_inject "pom:plugin[pom:artifactId='maven-jar-plugin']/pom:executions" "
    <execution>
      <id>default-jar</id>
      <phase>skip</phase>
    </execution>" slf4j-api

sed -i "/Import-Package/s/.$/;resolution:=optional&/" slf4j-api/src/main/resources/META-INF/MANIFEST.MF

%mvn_package :::sources: sources
%mvn_package :slf4j-parent __noinstall
%mvn_package :slf4j-site __noinstall
%mvn_package :slf4j-api
%mvn_package :slf4j-simple
%mvn_package :slf4j-nop

%build
%mvn_build -f -s

%install
%mvn_file ':slf4j-{*}' slf4j/slf4j-@1 slf4j/@1
%mvn_install
install -d -m 0755 $RPM_BUILD_ROOT%{_defaultdocdir}/slf4j-manual
rm -rf target/site/{.htaccess,apidocs}
cp -pr target/site/* $RPM_BUILD_ROOT%{_defaultdocdir}/slf4j-manual

%files -f .mfiles
%doc LICENSE.txt APACHE-LICENSE

%files jdk14 -f .mfiles-slf4j-jdk14
%files log4j12 -f .mfiles-slf4j-log4j12
%files jcl -f .mfiles-slf4j-jcl
%files ext -f .mfiles-slf4j-ext
%files -n jcl-over-slf4j -f .mfiles-jcl-over-slf4j
%files -n log4j-over-slf4j -f .mfiles-log4j-over-slf4j
%files -n jul-to-slf4j -f .mfiles-jul-to-slf4j

%files sources -f .mfiles-sources
%doc LICENSE.txt APACHE-LICENSE

%files help -f .mfiles-javadoc
%{_defaultdocdir}/slf4j-manual

%changelog
* Mon Feb 21 2022 wangkai <wangkai385@huawei.com> - 0:1.7.25-9
- Rebuild for fix log4j1.x cves

* Sun Mar 15 2020 Ling Yang <lingyang2@huawei.com> - 0:1.7.25-8
- Fix format

* Wed Dec 04 2019 daiqianwen <daiqianwen@huawei.com> - 0:1.7.25-7
- Package init
