# JAVA # https://docs.fedoraproject.org/en-US/packaging-guidelines/Java/ # https://fedora-java.github.io/howto/latest/index # https://rpm-packaging-guide.github.io/ # https://rpm-software-management.github.io/rpm/manual/macros.html # https://docs.fedoraproject.org/en-US/quick-docs/publish-rpm-on-copr %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%define __spec_install_pre /bin/true # %%define __arch_install_post %%{nil} # %%define __os_install_post %%{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 # %%global __brp_mangle_shebangs %%{nil} # %%global __brp_strip %%{nil} # %%define __requires_exclude ^.*/xxx/bin/python.*$ # %%define __requires_exclude_from ^.*/xxx/bin/python.*$ # %%define _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # APACHE TIKA # https://tika.apache.org # https://github.com/apache/tika %global _tika_pkgnm tika-server %global _tika_unitnm tika-server %global _tika_comment Content detection and analysis framework %global _tika_descrip %{expand: %{_tika_comment}.} # https://spdx.org/licenses/Apache-2.0.html %global _tika_license Apache-2.0 # https://github.com/apache/tika %global _tika_scm_repo apache/tika %global _tika_scm_url https://github.com/%{_tika_scm_repo}.git # CVE-2023-39913 # https://nvd.nist.gov/vuln/detail/CVE-2023-39913 # [ERROR] Failed to execute goal org.sonatype.ossindex.maven:ossindex-maven-plugin:3.2.0:audit # https://lists.apache.org/thread/qrylw3lc01nzwk81ojm9mbhgtgcp45x3 # %%global _tika_scm_branch 2.9.1 # %%global _tika_scm_branch branch_2x %global _tika_scm_branch main # id tika # uid=979(tika) gid=970(tika) groups=970(tika),5000(vmail) %global _tika_usr tika %global _tika_grp tika %global _tika_cache_dir /var/cache/tika %global _tika_conf_dir /usr/local/etc/tika %global _tika_conf_file tika-server-config-custom.xml %global _tika_install_dir /usr/local/tika-pgnd %global _tika_jar_file tika-server.jar %global _tika_unit_dir /etc/systemd/system %global _tika_webapp_dir /srv/webapps/tika # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ %global forgeurl0 %{_tika_scm_url} %global branch0 %{_tika_scm_branch} %global commit0 %( git ls-remote %{_tika_scm_url} | grep /%{_tika_scm_branch}$ | cut -f1 ) %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global archiveext0 tar.gz %global archivename0 %( echo %{_tika_scm_repo} | sed 's|/|-|g')-%{shortcommit0} %global archiveurl0 https://api.github.com/repos/%{_tika_scm_repo}/tarball/%{_tika_scm_branch} %global forgesource0 %{archiveurl0} %global forgesetupargs0 -n %{archivename0} %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_tika_pkgnm} Epoch: 0 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_tika_scm_branch} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_tika_comment} License: %{_tika_license} URL: %{forgeurl0} Source0: %{forgesource0} Source100: %{_tika_unitnm}.service Source101: %{_tika_unitnm}.target Source102: %{_tika_conf_file} Source103: log4j2.xml # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets # https://docs.pagure.org/packaging-guidelines/Packaging:Scriptlets.html BuildRequires: maven-local BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: systemd BuildRequires: systemd-rpm-macros %{?systemd_requires} Requires(pre): user(tika) Requires(pre): group(tika) Requires: boost-numpy3 Requires: ImageMagick Requires: ImageMagick-c++ Requires: ImageMagick-djvu Requires: ImageMagick-libs Requires: ImageMagick-perl Requires: java-latest-openjdk-headless Requires: pdfbox-tools Requires: python3-numpy Requires: python3-scikit-image Requires: python3-scikit-learn Requires: tesseract Requires: tesseract-equ Requires: tesseract-langpack-deu Requires: tesseract-langpack-eng Requires: tesseract-langpack-fra Requires: tesseract-langpack-ita Requires: tesseract-langpack-pol Requires: tesseract-langpack-por Requires: tesseract-langpack-spa Requires: tesseract-osd Requires: tesseract-tessdata-doc Requires: tesseract-tools Provides: tika-server = %{_same_evr} Obsoletes: tika-server < %{_same_evr} %description %{_tika_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a %build echo '##### STARTING BUILD #####' cd %{_builddir}/%{extractdir0} # OutOfMemoryError # https://cwiki.apache.org/confluence/display/maven/outofmemoryerror # https://confluence.atlassian.com/confkb/how-to-fix-out-of-memory-errors-by-increasing-available-memory-154071.html # Use MaxMetaspaceSize in place of MaxPermSize and MetaspaceSize in place of PermSize in jdk17. # https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html # https://maven.apache.org/docs/3.3.1/release-notes.html#JVM_and_Command_Line_Options export MAVEN_OPTS='-Xmx2048m -Xms1024m -XX:MaxMetaspaceSize=512m -Djava.awt.headless=true' mvn \ clean \ install \ --quiet \ --also-make \ --threads ${RPM_BUILD_NCPUS} \ --projects :tika-server-standard %install echo '##### STARTING INSTALL #####' cd %{_builddir}/%{extractdir0} mkdir -p ${RPM_BUILD_ROOT}/%{_tika_conf_dir} mkdir -p ${RPM_BUILD_ROOT}/%{_tika_install_dir} mkdir -p ${RPM_BUILD_ROOT}/%{_tika_unit_dir} mkdir -p ${RPM_BUILD_ROOT}/%{_tika_webapp_dir} _tika_buildjar_path=$( find %{_builddir}/%{extractdir0}/tika-server/tika-server-standard/target -type f -iname "tika-server-standard*.jar" -and -not -iname "*tests*") _tika_buildjar_file=$( basename ${_tika_buildjar_path} ) # GENERATE .service FILES, scripts sed -i \ -e 's|__TIKA_CACHEDIR__|%{_tika_cache_dir}|g' \ -e 's|__TIKA_CONFDIR__|%{_tika_conf_dir}|g' \ -e 's|__TIKA_CONFFILE__|%{_tika_conf_file}|g' \ -e 's|__TIKA_GRP__|%{_tika_grp}|g' \ -e 's|__TIKA_INSTALLDIR__|%{_tika_install_dir}|g' \ -e 's|__TIKA_JARFILE_BUILD__|'${_tika_buildjar_file}'|g' \ -e 's|__TIKA_JARFILE__|%{_tika_jar_file}|g' \ -e 's|__TIKA_USR__|%{_tika_usr}|g' \ -e 's|__TIKA_WEBAPPDIR__|%{_tika_webapp_dir}|g' \ %{SOURCE100} %{SOURCE102} install -D -p -m 0644 \ ${_tika_buildjar_path} \ ${RPM_BUILD_ROOT}/%{_tika_install_dir}/ install -D -p -m 0644 \ %{SOURCE100} \ ${RPM_BUILD_ROOT}/%{_tika_unit_dir}/%{_tika_unitnm}.service install -D -p -m 0644 \ %{SOURCE101} \ ${RPM_BUILD_ROOT}/%{_tika_unit_dir}/%{_tika_unitnm}.target install -D -p -m 0644 \ %{SOURCE102} \ ${RPM_BUILD_ROOT}/%{_tika_conf_dir}/%{_tika_conf_file} install -D -p -m 0644 \ %{SOURCE103} \ ${RPM_BUILD_ROOT}/%{_tika_conf_dir}/log4j2.xml %check %pre %post systemctl daemon-reload systemctl --no-reload enable my-servers.timer systemctl restart --quiet %{_tika_unitnm}.service %preun systemctl --no-reload stop --no-warn %{_tika_unitnm}.service %postun rm -f %{_tika_webapp_dir}/tika-server.jar systemctl daemon-reload %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %doc %license %dir %{_tika_install_dir} %{_tika_install_dir}/* %attr(0644,root,root) %{_tika_unit_dir}/%{_tika_unitnm}.service %attr(0644,root,root) %{_tika_unit_dir}/%{_tika_unitnm}.target %attr(0644,%{_tika_usr},%{_tika_grp}) %{_tika_conf_dir}/%{_tika_conf_file} %attr(0644,%{_tika_usr},%{_tika_grp}) %{_tika_conf_dir}/log4j2.xml %dir %{_tika_webapp_dir} # track; delete on uninstall if exists; no error if !exists %ghost %{_tika_webapp_dir}/%{_tika_jar_file} %changelog * Mon Nov 18 2024 pgnd _ - bump 1731914423