summaryrefslogtreecommitdiff
path: root/aops-mcp.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-10-16 01:28:50 +0000
committerCoprDistGit <infra@openeuler.org>2025-10-16 01:28:50 +0000
commit31e7ae3333942fb14db3c71c274fe64aa38a0e9e (patch)
tree46e2ffe031f6af0c8281e98a4b16590479d63045 /aops-mcp.spec
parent1871ad357774216551c042c772d6eaa2a59a35f2 (diff)
automatic import of aops-mcp
Diffstat (limited to 'aops-mcp.spec')
-rw-r--r--aops-mcp.spec76
1 files changed, 76 insertions, 0 deletions
diff --git a/aops-mcp.spec b/aops-mcp.spec
new file mode 100644
index 0000000..be18659
--- /dev/null
+++ b/aops-mcp.spec
@@ -0,0 +1,76 @@
+%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)
+
+Name: aops-mcp
+Version: 1.0.0
+Release: 1.%{?dist_tag}
+Summary: Aops MCP 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
+
+%description
+Aops MCP Service packaged as RPM.
+
+%prep
+%setup -q
+
+%build
+# 创建虚拟环境
+%{__python3} -m venv %{_builddir}/%{name}-%{version}/venv
+
+# 激活虚拟环境并安装依赖
+source %{_builddir}/%{name}-%{version}/venv/bin/activate
+pip install . -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
+deactivate
+rm -rf %{_builddir}/%{name}-%{version}/build
+
+%install
+rm -rf %{buildroot}
+
+# 创建应用目录
+mkdir -p %{buildroot}/opt/%{name}
+
+# 复制整个项目(包括虚拟环境)
+cp -r %{_builddir}/%{name}-%{version}/venv %{buildroot}/opt/%{name}/
+
+find %{buildroot}/opt/%{name}/venv/bin -type f -exec \
+ sed -i "1s|^#!.*|#!/opt/%{name}/venv/bin/python|" {} \;
+
+# 复制 systemd 服务文件
+mkdir -p %{buildroot}%{_unitdir}
+install -m 644 aops-mcp.service %{buildroot}%{_unitdir}/
+
+# 创建可执行文件符号链接
+mkdir -p %{buildroot}%{_bindir}
+ln -s /opt/%{name}/venv/bin/aops-mcp %{buildroot}%{_bindir}/aops-mcp
+
+%post
+# systemd 配置
+%systemd_post aops-mcp.service
+
+%preun
+# 卸载前停止服务
+%systemd_preun aops-mcp.service
+
+%postun
+# 清理配置
+%systemd_postun_with_restart aops-mcp.service
+
+%files
+%dir /opt/%{name}
+/opt/%{name}/*
+%license LICENSE
+%{_bindir}/aops-mcp
+%{_unitdir}/aops-mcp.service
+
+%changelog
+* Tue Sep 16 2025 ShiLei <845621916@qq.com> - 1.0-1
+- Initial package