diff options
author | CoprDistGit <infra@openeuler.org> | 2025-10-16 02:20:53 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-10-16 02:20:53 +0000 |
commit | 9377510420d974f862990078f70162bd0aae8888 (patch) | |
tree | d0d67eee51e554eb93bc3597aaed85506d3edbcf | |
parent | bacea38bd322a689fec77b27b4ed28d36188cd33 (diff) |
automatic import of loggpt
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | loggpt.spec | 120 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 122 insertions, 0 deletions
@@ -0,0 +1 @@ +/loggpt-1.0.0.tar.gz diff --git a/loggpt.spec b/loggpt.spec new file mode 100644 index 0000000..7c55e83 --- /dev/null +++ b/loggpt.spec @@ -0,0 +1,120 @@ +%define dist_tag %(sed -n 's/.*release \\([0-9]*\\)\.\\([0-9]*\\).*[Ss][Pp]\\([0-9]*\\).*/oe\\1\\2sp\\3/p; t; s/.*release \\([0-9]*\\)\.\\([0-9]*\\).*/oe\\1\\2/p' /etc/openEuler-release) +%global _unitdir /usr/lib/systemd/system + +Name: loggpt +Version: 1.0.0 +Release: 1.%{?dist_tag} +Summary: loggpt Service + +License: MulanPSL-2.0 +URL: https://gitee.com/Victeo/AOPS_MCP_Server +Source0: %{name}-%{version}.tar.gz + +%global debug_package %{nil} +%global _enable_debug_package 0 + +BuildRequires: python3-setuptools +BuildRequires: python3-pip +Requires: python3, systemd +# Requires: python3-pandas + +AutoReq: no +AutoProv: no + +%description +loggpt Service packaged as RPM. + +%prep +%setup -q + +%build +mkdir -p %{_builddir}/%{name}-%{version}/wheelhouse +# 下载项目依赖包(包括构建依赖) +%{__python3} -m pip download \ + --only-binary :all: \ + -d %{_builddir}/%{name}-%{version}/wheelhouse \ + -r requirements.txt \ + setuptools wheel pip \ + -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple +%{__python3} -m pip download \ + -d %{_builddir}/%{name}-%{version}/wheelhouse \ + torch --index-url https://download.pytorch.org/whl/cpu + + +%install +rm -rf %{buildroot} + +# 创建应用目录 +mkdir -p %{buildroot}/opt/%{name} +mkdir -p %{buildroot}/opt/%{name}/wheelhouse + +# 复制wheelhouse离线包 +cp -r %{_builddir}/%{name}-%{version}/wheelhouse/* %{buildroot}/opt/%{name}/wheelhouse/ + +# 复制项目代码(排除不需要的文件) +find %{_builddir}/%{name}-%{version} -maxdepth 1 \ + ! -name 'wheelhouse' \ + ! -name 'build' \ + ! -name 'venv' \ + -exec cp -r {} %{buildroot}/opt/%{name}/ \; + +# 复制 systemd 服务文件 +mkdir -p %{buildroot}%{_unitdir} +install -m 644 loggpt.service %{buildroot}%{_unitdir}/ + +# 创建可执行文件符号链接 +mkdir -p %{buildroot}%{_bindir} +ln -s /opt/%{name}/venv/bin/loggpt %{buildroot}%{_bindir}/loggpt + +%post +# 创建虚拟环境 +python3 -m venv /opt/%{name}/venv +source /opt/%{name}/venv/bin/activate + +# 首先安装基本构建工具 +/opt/%{name}/venv/bin/pip install --no-index --find-links=/opt/%{name}/wheelhouse \ + setuptools wheel pip + +# 安装离线依赖包 +/opt/%{name}/venv/bin/pip install --no-index --find-links=/opt/%{name}/wheelhouse \ + /opt/%{name}/wheelhouse/* + +# 安装当前项目 +/opt/%{name}/venv/bin/pip install \ + --no-index \ + --find-links=/opt/%{name}/wheelhouse \ + --no-build-isolation \ + /opt/%{name} + +deactivate + +# 清理wheelhouse节省空间 +# rm -rf /opt/%{name}/wheelhouse + +# 修复shebang路径 +find /opt/%{name}/venv/bin -type f -exec \ + sed -i "1s|^#!.*|#!/opt/%{name}/venv/bin/python|" {} \; + +# systemd 配置 +%systemd_post loggpt.service + +%preun +# 卸载前停止服务 +%systemd_preun loggpt.service + +%postun +# 清理配置 +rm -rf /opt/%{name} +%systemd_postun_with_restart loggpt.service + +%files +%dir /opt/%{name} +/opt/%{name}/* +%exclude /opt/%{name}/.git* +%license LICENSE +%{_bindir}/loggpt +%{_unitdir}/loggpt.service + +%changelog +* Tue Sep 16 2025 ShiLei <845621916@qq.com> - 1.0-1 +- Initial package @@ -0,0 +1 @@ +cbd26a6abbf2e40166790b8fa7bdd09e loggpt-1.0.0.tar.gz |