diff --git a/0001-fix-riscv64-devstation-livecd-config-not-found.patch b/0001-fix-riscv64-devstation-livecd-config-not-found.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ff3b5ea20959faf7037d450ae9a9ef1733317cf --- /dev/null +++ b/0001-fix-riscv64-devstation-livecd-config-not-found.patch @@ -0,0 +1,407 @@ +From 5c682db5139bfccc8a55d9626c5831b7792c4267 Mon Sep 17 00:00:00 2001 +From: ouuleilei +Date: Fri, 7 Mar 2025 15:09:55 +0800 +Subject: [PATCH] fix riscv64 devstation livecd config not found + +--- + .../config_files/riscv64/boot.msg | 4 + + .../config_files/riscv64/grub.conf | 9 ++ + .../config_files/riscv64/grub2-efi.cfg | 38 ++++++ + .../livecd/devstation_live/riscv64.tmpl | 75 ++++++++++++ + .../livecd/devstation_livecd_riscv64.ks | 105 ++++++++++++++++ + .../config/riscv64/livecd/devstation_rpmlist | 115 ++++++++++++++++++ + 6 files changed, 346 insertions(+) + create mode 100644 isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/boot.msg + create mode 100644 isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub.conf + create mode 100644 isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub2-efi.cfg + create mode 100644 isomaker/config/riscv64/livecd/devstation_live/riscv64.tmpl + create mode 100644 isomaker/config/riscv64/livecd/devstation_livecd_riscv64.ks + create mode 100644 isomaker/config/riscv64/livecd/devstation_rpmlist + +diff --git a/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/boot.msg b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/boot.msg +new file mode 100644 +index 0000000..5605477 +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/boot.msg +@@ -0,0 +1,4 @@ ++^L ++^Xsplash.lss ++ ++ - Press the ^O01^O07 key to begin the installation process. +diff --git a/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub.conf b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub.conf +new file mode 100644 +index 0000000..ee47854 +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub.conf +@@ -0,0 +1,9 @@ ++#debug --graphics ++default=0 ++splashimage=@SPLASHPATH@ ++timeout 60 ++hiddenmenu ++title Start @PRODUCT@ @VERSION@ ++ findiso ++ kernel @KERNELPATH@ @ROOT@ quiet inst.text rd.live.ram net.ifnames=0 biosdevname=0 rd.shell=0 ++ initrd @INITRDPATH@ +\ No newline at end of file +diff --git a/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub2-efi.cfg b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub2-efi.cfg +new file mode 100644 +index 0000000..aa36684 +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_live/config_files/riscv64/grub2-efi.cfg +@@ -0,0 +1,38 @@ ++set default="0" ++ ++function load_video { ++ if [ x$feature_all_video_module = xy ]; then ++ insmod all_video ++ else ++ insmod efi_gop ++ insmod efi_uga ++ insmod ieee1275_fb ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++ fi ++} ++ ++load_video ++set gfxpayload=keep ++insmod gzio ++insmod part_gpt ++insmod ext2 ++ ++set timeout=60 ++### END /etc/grub.d/00_header ### ++ ++search --no-floppy --set=root -l '@ISOLABEL@' ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'Start @PRODUCT@ @VERSION@ with text mode' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ ro inst.text console=ttyS0 console=tty0 rd.live.ram net.ifnames=0 biosdevname=0 rd.shell=0 ++ initrd @INITRDPATH@ ++} ++submenu 'Troubleshooting -->' { ++ menuentry 'Rescue a @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os { ++ linux @KERNELPATH@ @ROOT@ rescue console=ttyS0 console=tty0 rd.live.ram net.ifnames=0 biosdevname=0 rd.shell=0 ++ initrd @INITRDPATH@ ++ } ++} +diff --git a/isomaker/config/riscv64/livecd/devstation_live/riscv64.tmpl b/isomaker/config/riscv64/livecd/devstation_live/riscv64.tmpl +new file mode 100644 +index 0000000..9c14d3f +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_live/riscv64.tmpl +@@ -0,0 +1,75 @@ ++<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/> ++<% ++configdir="tmp/config_files/riscv64" ++PXEBOOTDIR="images/pxeboot" ++KERNELDIR=PXEBOOTDIR ++LORAXDIR="usr/share/lorax/" ++LIVEDIR="LiveOS" ++ ++ ++from os.path import basename ++%> ++ ++## Test ${runtime_img} to see if udf is needed ++<% ++ import os ++ from pylorax.sysutils import joinpaths ++ if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: ++ udfargs = "-allow-limited-size" ++ else: ++ udfargs = "" ++%> ++mkdir ${LIVEDIR} ++install ${runtime_img} ${LIVEDIR}/squashfs.img ++treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img ++ ++ ++## install kernels ++mkdir ${KERNELDIR} ++%for kernel in kernels: ++ ## normal riscv64 ++ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz ++ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ++%endfor ++ ++ ++## WHeeeeeeee, EFI. ++## We could remove the basearch restriction someday.. ++<% efiargs=""; efigraft="" %> ++%if exists("boot/efi/EFI/*/gcdriscv64.efi"): ++ <% ++ efiarch32 = None ++ efiarch64 = 'RISCV64' ++ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) ++ images = ["images/efiboot.img"] ++ %> ++ %for img in images: ++ <% ++ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) ++ efigraft += " {0}={1}/{0}".format(img,outroot) ++ %> ++ treeinfo images-${basearch} ${img|basename} ${img} ++ %endfor ++ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> ++%endif ++ ++# Create optional product.img and updates.img ++<% filegraft=""; images=["product", "updates"] %> ++%for img in images: ++ %if exists("%s/%s/" % (LORAXDIR, img)): ++ installimg ${LORAXDIR}/${img}/ images/${img}.img ++ treeinfo images-${basearch} ${img}.img images/${img}.img ++ <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> ++ %endif ++%endfor ++ ++%if exists("boot/efi/EFI/*/gcdriscv64.efi"): ++## make boot.iso ++runcmd mkisofs -o ${outroot}/images/boot.iso \ ++ ${efiargs} -R -J -V '${isolabel}' -T ${udfargs} \ ++ -graft-points \ ++ ${KERNELDIR}=${outroot}/${KERNELDIR} \ ++ ${LIVEDIR}=${outroot}/${LIVEDIR} \ ++ ${efigraft} ${filegraft} ++treeinfo images-${basearch} boot.iso images/boot.iso ++%endif +\ No newline at end of file +diff --git a/isomaker/config/riscv64/livecd/devstation_livecd_riscv64.ks b/isomaker/config/riscv64/livecd/devstation_livecd_riscv64.ks +new file mode 100644 +index 0000000..be247e6 +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_livecd_riscv64.ks +@@ -0,0 +1,105 @@ ++# Minimal Disk Image ++# ++# Firewall configuration ++firewall --enabled ++# Use network installation ++url --url="INSTALL_REPO" ++# Root password ++rootpw --iscrypted ROOT_PWD ++ ++# Network information ++network --bootproto=dhcp --onboot=on --activate ++# System keyboard ++keyboard --xlayouts=us --vckeymap=us ++# System language ++lang en_US.UTF-8 ++# SELinux configuration ++selinux --enforcing ++# Installation logging level ++logging --level=info ++# Shutdown after installation ++shutdown ++# System timezone ++timezone Asia/Beijing ++# System bootloader configuration ++bootloader --location=mbr ++# Clear the Master Boot Record ++zerombr ++# Partition clearing information ++clearpart --all ++# Disk partitioning information ++part / --fstype="ext4" --size=15000 ++part swap --size=1000 ++%pre ++#!/bin/bash ++mkdir -p /mnt/sysimage/usr/lib64/ ++chmod 0755 /mnt/sysimage/usr/lib64/ ++cp /usr/lib64/libbep_env.so /mnt/sysimage/usr/lib64 ++%end ++%post ++echo "LANG=zh_CN.UTF-8" > /etc/locale.conf ++useradd -m devstation ++usermod -aG wheel devstation ++echo "devstation ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers ++echo "devstation" | passwd --stdin devstation ++passwd -d devstation ++passwd -d root ++ ++if ! grep -q "\[daemon\]" /etc/gdm/custom.conf; then ++ echo "[daemon]" >> /etc/gdm/custom.conf ++fi ++ ++sed -i "/\[daemon\]/a AutomaticLoginEnable=true" /etc/gdm/custom.conf ++sed -i "/\[daemon\]/a AutomaticLogin=devstation" /etc/gdm/custom.conf ++ ++echo "devstation ALL=(ALL) NOPASSWD: /usr/bin/nautilus" >> /etc/sudoers ++touch /etc/polkit-1/rules.d/50-nautilus.rules ++cat << EOR > /etc/polkit-1/rules.d/50-nautilus.rules ++polkit.addRule(function(action, subject) { ++ if (action.id == "org.freedesktop.policykit.exec" && ++ action.lookup("action_id") == "org.gnome.nautilus.file-manager" && ++ subject.isInGroup("sudo")) { ++ return polkit.Result.YES; ++ } ++}); ++EOR ++ ++cp /usr/share/applications/calamares.desktop /etc/xdg/autostart/ ++ ++systemctl enable gdm ++systemctl set-default graphical.target ++ ++systemctl enable calamares ++ ++su - devstation -c gsettings set org.gnome.desktop.input-sources sources "[(xkb, us), (ibus, libpinyin)]" ++ ++touch /etc/sysconfig/network ++ ++cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth0 ++TYPE=Ethernet ++BOOTPROTO=dhcp ++NAME=eth0 ++DEVICE=eth0 ++ONBOOT=yes ++EOF ++ ++rm -rf /etc/systemd/system/multi-user.target.wants/kbox.service ++rm -rf /etc/systemd/system/multi-user.target.wants/kdump.service ++rm -rf /usr/lib/systemd/system/kbox.service ++rm -rf /usr/lib/systemd/system/kdump.service ++rm -rf /boot/initramfs* ++ ++#fix shadows and shadows- time field ++awk 'BEGIN{FS=OFS=":"} {$3=18099; print $0 > "/etc/shadow"}' /etc/shadow; ++awk 'BEGIN{FS=OFS=":"} {$3=18099; print $0 > "/etc/shadow-"}' /etc/shadow-; ++ ++#fix /etc/pki/ca-trust/extracted/java/cacerts time field ++rm /etc/pki/ca-trust/extracted/java/cacerts ++/usr/bin/ca-legacy install ++/usr/bin/update-ca-trust ++ ++ ++%end ++ ++%packages --excludedocs ++%end +diff --git a/isomaker/config/riscv64/livecd/devstation_rpmlist b/isomaker/config/riscv64/livecd/devstation_rpmlist +new file mode 100644 +index 0000000..ba0b94e +--- /dev/null ++++ b/isomaker/config/riscv64/livecd/devstation_rpmlist +@@ -0,0 +1,115 @@ ++abattis-cantarell-fonts ++audit ++authselect ++basesystem ++bash ++bind ++bind-dnssec-utils ++boost-iostreams ++checkpolicy ++coreutils ++cronie ++cryptsetup ++CUnit ++CUnit-devel ++curl ++dejavu-fonts ++devstation-config ++dhcp ++dnf ++dnf-plugins-core ++dosfstools ++dracut-config-generic ++dracut-config-rescue ++dracut-live ++dracut-network ++e2fsprogs ++efibootmgr ++filesystem ++fipscheck ++firefox ++firewalld ++gdb ++gdm ++glibc ++gnome-menus ++gnome-session ++gnome-shell ++gnome-software ++gnome-terminal ++google-*-fonts ++grub2 ++grub2-efi ++grub2-efi-riscv64-cdboot ++grubby ++gtest ++gtest-devel ++hostname ++ibus-libpinyin ++initscripts ++ipmitool ++iproute ++iprutils ++iputils ++irqbalance ++java-21-openjdk-devel ++kbd ++kernel ++kernel-tools ++kexec-tools ++less ++libdaemon ++liberation-fonts ++libnet ++libteam ++libX11 ++linux-firmware ++lshw ++lsscsi ++lvm2 ++man-db ++nautilus ++ncurses ++net-snmp ++NetworkManager ++NetworkManager-config-server ++openssh ++openssh-clients ++openssh-server ++open-vm-tools ++open-vm-tools-desktop ++parted ++passwd ++policycoreutils ++procps-ng ++python3-decorator ++python3-ply ++python3-pytest ++python3-slip ++rdma-core ++rng-tools ++rootfiles ++rpm ++rsync ++rsyslog ++samba-client ++samba-libs ++security-tool ++selinux-policy-mls ++selinux-policy-targeted ++setup ++sg3_utils ++shadow ++sssd ++sudo ++sysfsutils ++systemd ++tuned ++unzip ++util-linux ++vim-minimal ++wget ++wqy-zenhei-fonts ++xdg-utils ++xfsprogs ++yum +-- +2.48.1 + diff --git a/0001-opt-oeDeploy-MCP.patch b/0001-opt-oeDeploy-MCP.patch new file mode 100644 index 0000000000000000000000000000000000000000..2adfda50428a583996f75addceaa95b3d9746c63 --- /dev/null +++ b/0001-opt-oeDeploy-MCP.patch @@ -0,0 +1,310 @@ +From 24b93433ebd4ec04e8fd13e8acece9207796b0e0 Mon Sep 17 00:00:00 2001 +From: dingjiahuichina +Date: Thu, 10 Apr 2025 20:46:43 +0800 +Subject: [PATCH] =?UTF-8?q?opt:=20=E4=BC=98=E5=8C=96oeDeploy=20MCP?= + =?UTF-8?q?=EF=BC=8C=E6=96=87=E5=AD=97=E8=A1=A8=E8=BF=B0=E6=9B=B4=E5=87=86?= + =?UTF-8?q?=E7=A1=AE?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + oedp-mcp/README.md | 14 ++-- + oedp-mcp/mcp-make-oedp-plugin.py | 15 ++--- + oedp-mcp/mcp-oedp.py | 110 ++++++++++++++++++++++++++----- + 3 files changed, 107 insertions(+), 32 deletions(-) + +diff --git a/oedp-mcp/README.md b/oedp-mcp/README.md +index bd42923..2d54138 100644 +--- a/oedp-mcp/README.md ++++ b/oedp-mcp/README.md +@@ -7,7 +7,7 @@ oeDeploy 目前提供了两个 MCP Server + + ## 1. 环境准备 + +-安装 python 依赖。为了更加直观,当前示例使用 `pip`安装到系统的 python 目录,实际上更加推荐 `uv`安装到虚拟环境。 ++安装 python 依赖。为了更加直观,当前示例使用`pip`安装到系统的 python 目录,实际上更加推荐`uv`安装到虚拟环境。 + + ````bash + pip install pydantic mcp requests --trusted-host mirrors.huaweicloud.com -i https://mirrors.huaweicloud.com/repository/pypi/simple +@@ -25,11 +25,11 @@ wget https://gitee.com/openeuler/oeDeploy/blob/master/oedp-mcp/mcp-make-oedp-plu + + ## 2. MCP 配置 + +-当前示例使用 VScode 开发平台,用 Remote ssh 连接到一个 openEuler24.03sp1 的 linux 环境。 ++当前示例使用 VScode 开发平台,用 Remote ssh 连接到一个 openEuler24.03sp1 的 linux 环境,并以家目录`~`为项目路径。 + +-在插件 Roo Code中配置了 DeepSeek-V3 的API。 ++在插件 Roo Code 中配置了 DeepSeek-V3 的API。 + +-打开 MCP 配置页面,编辑 MCP 配置文件 `mcp_settings.json`,在 `mcpServers`中新增如下内容: ++打开 MCP 配置页面,编辑 MCP 的项目配置文件`.roo/mcp.json`,修改如下: + + ````json + { +@@ -40,7 +40,7 @@ wget https://gitee.com/openeuler/oeDeploy/blob/master/oedp-mcp/mcp-make-oedp-plu + "mcp-oedp": { + "command": "python3", + "args": [ +- "/root/.oedp/mcp/mcp-oedp.py" ++ ".oedp/mcp/mcp-oedp.py" // 请根据实际情况调整路径 + ], + "disabled": false, + "alwaysAllow": [] +@@ -48,7 +48,7 @@ wget https://gitee.com/openeuler/oeDeploy/blob/master/oedp-mcp/mcp-make-oedp-plu + "mcp-make-oedp-plugin": { + "command": "python3", + "args": [ +- "/root/.oedp/mcp/mcp-make-oedp-plugin.py" ++ ".oedp/mcp/mcp-make-oedp-plugin.py" // 请根据实际情况调整路径 + ], + "disabled": false, + "alwaysAllow": [] +@@ -57,7 +57,7 @@ wget https://gitee.com/openeuler/oeDeploy/blob/master/oedp-mcp/mcp-make-oedp-plu + } + ```` + +-配置完成后,可以在 MCP 列表上看看到 `mcp-oedp`和 `mcp-make-oedp-plugin`,且状态正常。 ++配置完成后,可以在 MCP 列表上看看到`mcp-oedp`和`mcp-make-oedp-plugin`,且状态正常。 + + > 如果出现报错,请根据提示信息检查 python 组件依赖是否满足。 + +diff --git a/oedp-mcp/mcp-make-oedp-plugin.py b/oedp-mcp/mcp-make-oedp-plugin.py +index b504e7d..6a92595 100644 +--- a/oedp-mcp/mcp-make-oedp-plugin.py ++++ b/oedp-mcp/mcp-make-oedp-plugin.py +@@ -1,6 +1,4 @@ + from mcp.server.fastmcp import FastMCP +-import requests +-import subprocess + import os + + DEFAULT_DIR = "~/.oedp/" +@@ -28,13 +26,12 @@ async def make_plugin_auto(plugin: str, parent_dir: str) -> str: + + develop_guide_path = os.path.abspath(os.path.expanduser(DEVELOP_GUIDE_PATH)) + +- return f"""编写一个oeDeploy插件分为多个步骤: +-1. (重要!)仔细阅读oeDeploy插件的开发文档{develop_guide_path} +-2. 根据用户对eDeploy插件功能的详细描述,完成对oeDeploy插件的开发 +-3. 开发完成后,用指定方式打包成tar.gz到{parent_dir}目录下(如果有同名文件则强制覆盖) +-4. 再调用`oedp info -p {parent_dir}/{plugin}`进行测试 +-5. 测试通过后,不用执行oedp部署操作 +-""" ++ return "请帮我执行: {" + f""" ++1. (重要!)仔细阅读oeDeploy插件的开发文档{develop_guide_path},根据用户对eDeploy插件功能的详细描述,完成对oeDeploy插件的开发 ++2. 开发完成后,用指定方式打包成tar.gz到{parent_dir}目录下(如果有同名文件则强制覆盖) ++3. 再调用`oedp info -p {parent_dir}/{plugin}`进行测试 ++4. 测试通过后,不用执行oedp部署操作 ++""" + "}" + + if __name__ == "__main__": + # Initialize and run the server +diff --git a/oedp-mcp/mcp-oedp.py b/oedp-mcp/mcp-oedp.py +index 3010e23..fe6b856 100644 +--- a/oedp-mcp/mcp-oedp.py ++++ b/oedp-mcp/mcp-oedp.py +@@ -8,7 +8,7 @@ DEFAULT_DIR = "~/.oedp/" + # Initialize FastMCP server + mcp = FastMCP("安装部署命令行工具oedp调用方法", log_level="ERROR") + +-def validate_project_structure(project: str) -> str: ++def _validate_project_structure(project: str) -> str: + """校验项目目录结构 + + Args: +@@ -24,7 +24,7 @@ def validate_project_structure(project: str) -> str: + return f"Missing required file/directory: {f}" + return "" + +-def check_oedp_installed() -> str: ++def _check_oedp_installed() -> str: + """检查oedp是否安装 + + Returns: +@@ -144,7 +144,7 @@ async def remove_oedp() -> str: + + @mcp.tool() + async def oedp_init_plugin(plugin: str, parent_dir: str) -> str: +- """获取已经存在的oeDeploy插件(又称oedp插件),并初始化到{parent_dir}目录 ++ """获取已经存在的oeDeploy插件(又称oedp插件),并初始化 + + Args: + plugin: oeDeploy插件名称或.tar.gz文件路径/名称 +@@ -217,7 +217,7 @@ async def oedp_init_plugin(plugin: str, parent_dir: str) -> str: + except requests.exceptions.RequestException: + # 所有获取方式都失败,检查现有目录 + if os.path.exists(plugin_dir): +- validation_result = validate_project_structure(plugin_dir) ++ validation_result = _validate_project_structure(plugin_dir) + if not validation_result: + return "[Success] (Using existing valid plugin directory)" + return f"[Fail]Existing directory is invalid: {validation_result}" +@@ -226,22 +226,100 @@ async def oedp_init_plugin(plugin: str, parent_dir: str) -> str: + except Exception as e: + return f"[Fail]Unexpected error: {str(e)}" + ++@mcp.tool() ++async def oedp_info_plugin(project: str) -> str: ++ """查询oeDeploy插件(又称oedp插件)信息,仅在明确指定project路径时触发 ++ ++ Args: ++ project: oeDeploy插件的项目目录, 其中必定有config.yaml,main.yaml,workspace/ ++ """ ++ ++ # 校验项目目录结构 ++ abs_project = os.path.abspath(os.path.expanduser(project)) ++ validation_result = _validate_project_structure(abs_project) ++ if validation_result: ++ return f"[Fail]{validation_result}" ++ ++ # 检查oedp是否安装 ++ oedp_check_result = _check_oedp_installed() ++ if oedp_check_result: ++ return f"[Fail]{oedp_check_result}" ++ ++ # 执行安装命令 ++ try: ++ result = subprocess.run( ++ ["oedp", "info", "-p", abs_project], ++ capture_output=True, ++ text=True ++ ) ++ ++ log_text = result.stdout + "\n" + result.stderr ++ ++ if result.returncode == 0: ++ return "[Success]" + "\n" + log_text ++ else: ++ return f"[Fail]Installation failed" + "\n" + log_text ++ ++ except subprocess.CalledProcessError as e: ++ return f"[Fail]Command execution failed: {str(e)}" ++ except Exception as e: ++ return f"[Fail]Unexpected error: {str(e)}" ++ + @mcp.tool() + async def oedp_setup_plugin(operation: str, project: str) -> str: +- """配置oeDeploy插件(又称oedp插件): 根据operation, 修改oeDeploy插件的配置文件{project}/config.yaml ++ """配置oeDeploy插件(又称oedp插件): 根据operation,修改oeDeploy插件的配置文件{project}/config.yaml + + Args: + operation: 用户对oeDeploy插件config.yaml的修改说明(人类描述语言) +- project: oeDeploy插件的项目目录, 其中必定有config.yaml,main.yaml,workspace/ ++ project: oeDeploy插件的项目目录,其中必定有config.yaml,main.yaml,workspace/ + """ + + # 校验项目目录结构 + abs_project = os.path.abspath(os.path.expanduser(project)) +- validation_result = validate_project_structure(abs_project) ++ validation_result = _validate_project_structure(abs_project) + if validation_result: + return f"[Fail]{validation_result}" + +- return f"请根据用户的指令'{operation}', 修改{abs_project}/config.yaml" ++ return "请帮我执行: { " + f"修改{abs_project}/config.yaml.依据来自用户描述[{operation}]" + " }" ++ ++@mcp.tool() ++async def oedp_run_action_plugin(action: str, project: str) -> str: ++ """运行oeDeploy插件(又称oedp插件)的特定操作action,仅在明确指定project路径时触发 ++ ++ Args: ++ action: oeDeploy插件的一个操作名称 ++ project: oeDeploy插件的项目目录, 其中必定有config.yaml,main.yaml,workspace/ ++ """ ++ try: ++ # 校验项目目录结构 ++ abs_project = os.path.abspath(os.path.expanduser(project)) ++ validation_result = _validate_project_structure(abs_project) ++ if validation_result: ++ return f"[Fail]{validation_result}" ++ ++ # 检查oedp是否安装 ++ oedp_check_result = _check_oedp_installed() ++ if oedp_check_result: ++ return f"[Fail]{oedp_check_result}" ++ ++ # 执行命令 ++ result = subprocess.run( ++ ["oedp", "run", action, "-p", abs_project], ++ capture_output=True, ++ text=True ++ ) ++ ++ log_text = result.stdout + "\n" + result.stderr ++ ++ if result.returncode == 0: ++ return "[Success]" + "\n" + log_text ++ else: ++ return f"[Fail]Execution failed" + "\n" + log_text ++ ++ except subprocess.CalledProcessError as e: ++ return f"[Fail]Command execution failed: {str(e)}" ++ except Exception as e: ++ return f"[Fail]Unexpected error: {str(e)}" + + @mcp.tool() + async def oedp_run_install_plugin(project: str) -> str: +@@ -253,12 +331,12 @@ async def oedp_run_install_plugin(project: str) -> str: + try: + # 校验项目目录结构 + abs_project = os.path.abspath(os.path.expanduser(project)) +- validation_result = validate_project_structure(abs_project) ++ validation_result = _validate_project_structure(abs_project) + if validation_result: + return f"[Fail]{validation_result}" + + # 检查oedp是否安装 +- oedp_check_result = check_oedp_installed() ++ oedp_check_result = _check_oedp_installed() + if oedp_check_result: + return f"[Fail]{oedp_check_result}" + +@@ -283,7 +361,7 @@ async def oedp_run_install_plugin(project: str) -> str: + + @mcp.tool() + async def oedp_run_uninstall_plugin(project: str) -> str: +- """运行oeDeploy插件(又称oedp插件)的卸载流程 ++ """运行oeDeploy插件(又称oedp插件)的卸载流程,仅在明确指定project路径时触发 + + Args: + project: oeDeploy插件的项目目录, 其中必定有config.yaml,main.yaml,workspace/ +@@ -291,12 +369,12 @@ async def oedp_run_uninstall_plugin(project: str) -> str: + try: + # 校验项目目录结构 + abs_project = os.path.abspath(os.path.expanduser(project)) +- validation_result = validate_project_structure(abs_project) ++ validation_result = _validate_project_structure(abs_project) + if validation_result: + return f"[Fail]{validation_result}" + + # 检查oedp是否安装 +- oedp_check_result = check_oedp_installed() ++ oedp_check_result = _check_oedp_installed() + if oedp_check_result: + return f"[Fail]{oedp_check_result}" + +@@ -331,17 +409,17 @@ async def oedp_install_software_one_click(software: str, operation: str) -> str: + """ + + # 检查oedp是否安装 +- oedp_check_result = check_oedp_installed() ++ oedp_check_result = _check_oedp_installed() + if oedp_check_result: + return f"[Fail]{oedp_check_result}" + + parent_dir = os.path.abspath(os.path.expanduser(DEFAULT_DIR)) + +- return f"""用oeDeploy一键执行特定软件的部署流程(install)分为多个步骤: ++ return "请帮我执行: {" + f""" + 1. 调用oedp_init_plugin方法,将指定的oeDeploy插件[{software}]初始化到{parent_dir}目录 + 2. 调用oedp_setup_plugin方法,根据用户的指令[{operation}],修改oeDeploy插件的配置文件{parent_dir}/{software}/config.yaml + 3. 调用oedp_run_install_plugin方法,运行oeDeploy插件的安装部署流程 项目路径{parent_dir}/{software} +-""" ++""" + "}" + + if __name__ == "__main__": + # Initialize and run the server +-- +2.48.1 + diff --git a/oemaker.spec b/oemaker.spec index 01286a2ac8a4648608efe8f8351b326961eabce2..03ac6878f0e695a707a473dc8be3d122c6f51716 100644 --- a/oemaker.spec +++ b/oemaker.spec @@ -15,7 +15,7 @@ Summary: a building tool for DVD ISO making and ISO cutting License: Mulan PSL v2 Group: System/Management Version: 3.3.0 -Release: 6 +Release: 8 BuildRoot: %{_tmppath}/%{name} Source: https://gitee.com/openeuler/oemaker/repository/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz @@ -44,6 +44,8 @@ Requires: xorriso Patch0001: 0001-bugfix-IABY7K.patch Patch0002: 0001-fix-livecd-grub2-efi.cfg-not-found.patch Patch0003: 0001-Fixes-boot-failure-caused-by-invalid-volume-IDs.patch +Patch0004: 0001-opt-oeDeploy-MCP.patch +Patch0005: 0001-fix-riscv64-devstation-livecd-config-not-found.patch %description a building tool for DVD ISO making and ISO cutting @@ -224,6 +226,16 @@ rm -rf %{buildroot} rm -rf $RPM_BUILD_DIR/%{name} %changelog +* Fri Apr 18 2025 lulingyu-601 - 3.3.0-8 +- ID:NA +- SUG:NA +- DESC: fix-riscv64-devstation-livecd-config-not-found + +* Thu Apr 17 2025 lulingyu-601 - 3.3.0-7 +- ID:NA +- SUG:NA +- DESC: opt: 优化oeDeploy MCP,文字表述更准确 + * Tue Apr 15 2025 Liu Wang <1823363429@qq.com> - 3.3.0-6 - ID:NA - SUG:NA