File xgboost.spec of Package xgboost
# Avoid empty debugsourcefiles.list complaint
%undefine _debugsource_packages
%define _enable_debug_packages %{nil}
Summary: Large-scale and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library
Name: xgboost
Version: 0.80
Release: %{rpm_release}
License: ASL 2.0
Group: System Environment/Base
Source: xgboost-0.80.tar.gz
URL: http://dmlc.ml
BuildRequires: python2
BuildRequires: python2-setuptools
%if 0%{?centos} >= 8
BuildRequires: python3-rpm-generators
%endif
%define python /usr/bin/python2
%define __python2 /usr/bin/python2
%description
An optimized general purpose gradient boosting library.The library is
parallelized, and also provides an optimized distributed version.
It implements machine learning algorithm under gradient boosting
framework, including generalized linear model and gradient boosted
regression tree (GBDT). XGBoost can also also distributed and scale
to Terascale data.
%prep
%setup -n %{name}-%{version}
# Patch the source code to use python2
find -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python2}=' {} \;
%build
make -j8
mkdir -p pybuild
(cd python-package ; %{python} setup.py install --root="%{_builddir}/%{name}-%{version}/pybuild" --prefix="%{_prefix}")
%install
install -m 755 -d %{buildroot}%{_bindir}
install -m 755 xgboost %{buildroot}%{_bindir}
install -m 755 -d %{buildroot}/usr/xgboost
install -m 755 -d %{buildroot}/usr/lib/python2.7/site-packages/xgboost
install -m 755 -d %{buildroot}/usr/lib/python2.7/site-packages/xgboost-%{version}-py2.7.egg-info
pwd ; cd pybuild/usr ; pwd
install xgboost/libxgboost.so %{buildroot}/usr/xgboost
# 'install' version 8.22 in CentOS 7 just silently ignores the directories while
# version 8.30 in CentOS 8 will return an error. This error is avoided by
# providing only files to 'install'.
find lib/python2.7/site-packages/xgboost -type f -exec install {} %{buildroot}/usr/lib/python2.7/site-packages/xgboost \;
install lib/python2.7/site-packages/xgboost-%{version}-py2.7.egg-info/* %{buildroot}/usr/lib/python2.7/site-packages/xgboost-%{version}-py2.7.egg-info
pwd
#install -m 755 usr/xgboost/libxgboost.so %{buildroot}/usr/xgboost
#install -m 755 usr/lib/python2.7/site-packages/xgboost/* %{buildroot}/usr/lib/python2.7/site-packages/xgboost
#install -m 755 usr/lib/python2.7/site-packages/xgboost-%{version}-py2.7.egg-info/* %{buildroot}/usr/lib/python2.7/site-packages/xgboost-%{version}-py2.7.egg-info
%files
%{_bindir}/xgboost
/usr/xgboost
/usr/lib/python2.7/site-packages/xgboost
/usr/lib/python2.7/site-packages/xgboost-0.80-py2.7.egg-info