diff options
| author | CoprDistGit <infra@openeuler.org> | 2025-12-12 03:26:32 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2025-12-12 03:26:32 +0000 |
| commit | 47d4bf161a0b1030c4dc25e8585da932aab8b179 (patch) | |
| tree | 94724b064dbe94622f9a48cf65633938886ed983 | |
| parent | 219c0d626b56070f838b34b38e33d482e2cc8a11 (diff) | |
automatic import of loggptopeneuler24.03_LTS_SP2openeuler24.03_LTS_SP1openeuler24.03_LTS
| -rw-r--r-- | .gitignore | 7 | ||||
| -rw-r--r-- | loggpt.spec | 123 | ||||
| -rw-r--r-- | sources | 7 |
3 files changed, 137 insertions, 0 deletions
@@ -0,0 +1,7 @@ +/loggpt-1.0.0.tar.gz +/wheelhouse_aarch64_1.tar +/wheelhouse_aarch64_2.tar +/wheelhouse_aarch64_3.tar +/wheelhouse_x86_64_1.tar +/wheelhouse_x86_64_2.tar +/wheelhouse_x86_64_3.tar diff --git a/loggpt.spec b/loggpt.spec new file mode 100644 index 0000000..cbc78bc --- /dev/null +++ b/loggpt.spec @@ -0,0 +1,123 @@ +%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 + +# x86_64 dependencies +Source1: wheelhouse_x86_64_1.tar +Source2: wheelhouse_x86_64_2.tar +Source3: wheelhouse_x86_64_3.tar + +# aarch64 dependencies +Source4: wheelhouse_aarch64_1.tar +Source5: wheelhouse_aarch64_2.tar +Source6: wheelhouse_aarch64_3.tar + +%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 +%ifarch x86_64 +cp -f %{SOURCE1} %{_builddir}/wheelhouse_1.tar +cp -f %{SOURCE2} %{_builddir}/wheelhouse_2.tar +cp -f %{SOURCE3} %{_builddir}/wheelhouse_3.tar +%endif + +%ifarch aarch64 +cp -f %{SOURCE4} %{_builddir}/wheelhouse_1.tar +cp -f %{SOURCE5} %{_builddir}/wheelhouse_2.tar +cp -f %{SOURCE6} %{_builddir}/wheelhouse_3.tar +%endif + +%build +mkdir -p %{_builddir}/%{name}-%{version}/wheelhouse +# 下载项目依赖包(包括构建依赖) + +%install +rm -rf %{buildroot} + +# 创建应用目录 +mkdir -p %{buildroot}/opt/%{name} + +# 复制wheelhouse离线包 +tar -x -M -f %{_builddir}/wheelhouse_1.tar -f %{_builddir}/wheelhouse_2.tar -f %{_builddir}/wheelhouse_3.tar -C %{buildroot}/opt/%{name}/ +rm -rf %{_builddir}/wheelhouse_*.tar + +# 复制项目代码(排除不需要的文件) +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 -executable -exec \ + sed -i "1s|^#!.*|#!/opt/%{name}/venv/bin/python|" {} \; + +%postun +# 清理配置 +rm -rf /opt/%{name} + +%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,7 @@ +1cbaf5ea206e9d37071d9c04d7cc2996 loggpt-1.0.0.tar.gz +b21222c88b6167299a3853ce4d380a88 wheelhouse_aarch64_1.tar +db22dbad044500443609eeb4cf65c510 wheelhouse_aarch64_2.tar +513f44a5f83e263a961fdd5135a563a2 wheelhouse_aarch64_3.tar +0abcb42dd454736dc5b502263da3afad wheelhouse_x86_64_1.tar +98016997b64ca44612c7d42c08a6cd80 wheelhouse_x86_64_2.tar +c5b1e292e9f09121ccc6ebb8128e039c wheelhouse_x86_64_3.tar |
