代码拉取完成,页面将自动刷新
%define name toneagent
%define version 1.1.1
%define app_path /usr/local/toneagent
%define python_bin python3.9
%define release 1
# Resolve python conflicts
%define _build_id_links none
Summary: toneagent
Name: %{name}
Version: %{version}
Release: %{release}
License: MulanPSLv2
Group: Development/Libraries
Prefix: %{_prefix}
#BuildArch: noarch
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Vendor: foo <mr_foo@163.com>
Url: https://gitee.com/anolis/python-tone-agent
%description
ToneAgent[python] service
%prep
%setup -q -n %{name}-%{version}
%build
%define debug_package %{nil}
%install
mkdir -p ${RPM_BUILD_ROOT}%{app_path}/{app,conf,logs,results,scripts,venv}
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/systemd/system/
cp -rf %{_builddir}/%{name}-%{version}/* ${RPM_BUILD_ROOT}%{app_path}/app/
cp -f %{_builddir}/%{name}-%{version}/%{name}.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/
yum install -y gcc python39-devel
yum install -y python39
pip3 install --upgrade pip setuptools virtualenv
virtualenv -p %{python_bin} --copies ${RPM_BUILD_ROOT}%{app_path}/venv
#virtualenv -p %{python_bin} ${RPM_BUILD_ROOT}%{app_path}/venv
${RPM_BUILD_ROOT}%{app_path}/venv/bin/pip3 install -r ${RPM_BUILD_ROOT}%{app_path}/app/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
cd ${RPM_BUILD_ROOT}%{app_path}/venv/bin && \
rm -f activate activate.fish activate.ps1 normalizer pip3 pip3.9 wheel3 wheel3.9 && \
rm -f activate.csh activate.nu activate_this.py pip pip-3.9 wheel wheel-3.9 sanic
%post
systemctl daemon-reload
systemctl enable %{name}.service
systemctl start %{name}.service
%postun
rm -rf /usr/lib/systemd/system/toneagent.service
rm -rf /usr/local/toneagent
systemctl daemon-reload
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{app_path}
#%attr(0755, root, root) {app_path}/venv/bin
%{_prefix}/lib/systemd/system/%{name}.service
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。