%global majorversion 2
Name:                metadata-extractor2
Version:             2.19.0
Release:             1
Summary:             Extracts EXIF, IPTC, XMP, ICC and other metadata from image files
License:             ASL 2.0
URL:                 http://drewnoakes.com/code/exif/
Source0:             https://github.com/drewnoakes/metadata-extractor/archive/%{version}/metadata-extractor-%{version}.tar.gz
Source1:             xmvn-reactor

BuildRequires:       maven-local mvn(com.adobe.xmp:xmpcore) mvn(junit:junit)
BuildRequires:       mvn(org.apache.felix:maven-bundle-plugin) mvn(org.sonatype.oss:oss-parent:pom:)
BuildRequires:       maven

Requires:            javapackages-tools
Provides:            mvn(com.drewnoakes:metadata-extractor) = %{version}-%{release}
BuildArch:           noarch
%description
Metadata Extractor is a straightforward Java library
for reading metadata from image files.

%package javadoc
Summary:             Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q -n metadata-extractor-%{version}
find -name '*.jar' -delete
find -name '*.class' -delete

%pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin
%pom_remove_plugin org.apache.maven.plugins:maven-gpg-plugin
%pom_remove_plugin org.apache.maven.plugins:maven-source-plugin

cp %{SOURCE1} ./.xmvn-reactor
echo `pwd` > absolute_prefix.log
sed -i 's/\//\\\//g' absolute_prefix.log
absolute_prefix=`head -n 1 absolute_prefix.log`
sed -i 's/absolute-prefix/'"$absolute_prefix"'/g' .xmvn-reactor

%build
mvn package  org.apache.maven.plugins:maven-javadoc-plugin:aggregate
mkdir -p target/site/apidocs
mv Output/maven/apidocs target/site/apidocs

%install
%mvn_install
%jpackage_script com.drew.imaging.ImageMetadataReader "" "" %{name}-%{majorversion}:xmpcore %{name} true

%files
%{_bindir}/*
%doc README.md
%license LICENSE
%attr(0644,root,root) /usr/share/maven-metadata/metadata-extractor2.xml
%attr(0644,root,root) /usr/share/java/metadata-extractor2/metadata-extractor.jar
%attr(0644,root,root) /usr/share/maven-poms/metadata-extractor2/metadata-extractor.pom

%files javadoc
%license LICENSE
/usr/share/javadoc/metadata-extractor2

%changelog
* Wed Mar 06 2024 yaoxin <yao_xin001@hoperun.com> - 2.19.0-1
- Upgrade to 2.19.0

* Thu Aug 10 2023 xu_ping <707078654@qq.com> - 2.18.0-1
- Update to 2.18.0

* Mon May 30 2022 xigaoxinyan <xigaoxinyan@h-partners.com> - 2.11.0-1
- Update to 2.11.0

* Sat Aug 15 2020 shaoqiang kang <kangshaoqiang1@huawei.com> - 2.10.1-1
- Package init
