diff --git a/plugins/boostkit-offline/config.yaml b/plugins/boostkit-offline/config.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..71d23f5277be550aa0a8d9e090e29820b38f1389
--- /dev/null
+++ b/plugins/boostkit-offline/config.yaml
@@ -0,0 +1,22 @@
+all:
+ hosts:
+ host1:
+ ansible_host: HOST_IP # e.g. 192.168.1.101
+ ansible_port: 22
+ ansible_user: root
+ ansible_password: ""
+ # 可在此添加更多主机
+ children:
+ AccLib:
+ hosts:
+ host1:
+ # 可在此包含更多主机
+ vars:
+ install_list: 'ALL' # 支持使用列表,或者使用逗号分隔的字符串
+ vars:
+ # 跳过所有基本检查项
+ skip_check: false
+ # 临时文件存放目录
+ temp_path: /tmp
+ # 跳过 ssh 校验,如需禁用此功能,请删除以下配置项
+ ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
diff --git a/plugins/boostkit-offline/main.yaml b/plugins/boostkit-offline/main.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..5c77268cf6060963ddea0703aedc216e9bf9d16a
--- /dev/null
+++ b/plugins/boostkit-offline/main.yaml
@@ -0,0 +1,15 @@
+name: boostkit
+description: BoostKit
+action:
+ AccLib-show:
+ description: show available components in AccLib
+ tasks:
+ - name: show available components in AccLib
+ playbook: AccLib-show.yml
+ scope: AccLib
+ AccLib-install:
+ description: install components in AccLib
+ tasks:
+ - name: install components in AccLib
+ playbook: AccLib-install.yml
+ scope: AccLib
diff --git a/plugins/boostkit-offline/workspace/AccLib-install.yml b/plugins/boostkit-offline/workspace/AccLib-install.yml
new file mode 100644
index 0000000000000000000000000000000000000000..274e4278c3453c87e30c39b4831491b55efecbdb
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/AccLib-install.yml
@@ -0,0 +1,6 @@
+- hosts: all
+ environment: "{{ proxy_env | default({}) }}"
+ roles:
+ - check
+ - AccLib/prepare
+ - AccLib/install
diff --git a/plugins/boostkit-offline/workspace/AccLib-show.yml b/plugins/boostkit-offline/workspace/AccLib-show.yml
new file mode 100644
index 0000000000000000000000000000000000000000..ffa7bebf88108c0578fb9b2127caf4136088120c
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/AccLib-show.yml
@@ -0,0 +1,6 @@
+- hosts: all
+ environment: "{{ proxy_env | default({}) }}"
+ roles:
+ - check
+ - AccLib/prepare
+ - AccLib/show
diff --git a/plugins/boostkit-offline/workspace/build.sh b/plugins/boostkit-offline/workspace/build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..677ecc99f036b4400697f4efab31e10347fdf3db
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/build.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+export DIR=$(cd `dirname $0/`;pwd)
+
+sh $DIR/build/AccLib/build.sh
\ No newline at end of file
diff --git a/plugins/boostkit-offline/workspace/build/AccLib/build.sh b/plugins/boostkit-offline/workspace/build/AccLib/build.sh
new file mode 100644
index 0000000000000000000000000000000000000000..957d3fb9c6bac834a27819306b41cb580b71f69f
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/build/AccLib/build.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+get_source() {
+ source "$DIR/build/AccLib/source.cfg"
+
+ KSL_version=${KSL_version:-"2.5.0"}
+ Hyperscan_branch=${Hyperscan_branch:-"v5.4.2.aarch64"}
+ KAE_branch=${KAE_branch:-"kae2"}
+
+ KSL_url="https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/boostkit-ksl-${KSL_version}-1.aarch64.rpm"
+ ragel_url="https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/ragel-6.10.tar.gz"
+ boost_url="https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/boost_1_87_0.tar.gz"
+ pcre_url="https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/pcre-8.43.tar.gz"
+ libgpg_url="https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.51.tar.gz"
+
+ Hyperscan_git=${Hyperscan_git:-"https://gitee.com/kunpengcompute/hyperscan.git"}
+ KAE_git=${KAE_git:-"https://gitee.com/kunpengcompute/KAE.git"}
+}
+
+download() {
+ download_dir=$DIR/build/AccLib/download
+ mkdir $download_dir
+ pushd $download_dir
+
+ wget -N --no-check-certificate $KSL_url
+ wget -N --no-check-certificate $ragel_url
+ wget -N --no-check-certificate $boost_url
+ wget -N --no-check-certificate $pcre_url
+ wget -N --no-check-certificate $libgpg_url
+
+ rm -rf hyperscan
+ git clone $Hyperscan_git -b khsel
+ cp hyperscan/khsel.patch ./
+ pushd hyperscan
+ git checkout $Hyperscan_branch
+ popd
+
+ rm -rf KAE
+ git clone $KAE_git -b $KAE_branch --depth=1
+
+ pip download "argparse>=1.4.0"
+
+ popd
+}
+
+build_dir() {
+ download_dir=$DIR/build/AccLib/download
+ target_dir=$DIR/roles/AccLib/prepare/files/BoostKit-AccLib
+ wheel_dir=$DIR/roles/AccLib/prepare/files/BoostKit-AccLib-wheels
+
+ Hyperscan_dir=$target_dir/Hyperscan
+ mkdir -p $Hyperscan_dir
+ cp -af $download_dir/boost_*.tar.gz $Hyperscan_dir
+ cp -af $download_dir/pcre-*.tar.gz $Hyperscan_dir
+ cp -af $download_dir/ragel-*.tar.gz $Hyperscan_dir
+ cp -arf $download_dir/hyperscan $Hyperscan_dir
+
+ KAE_dir=$target_dir/KAE
+ mkdir -p $KAE_dir
+ cp -arf $download_dir/KAE $KAE_dir
+
+ KSL_dir=$target_dir/KSL
+ mkdir -p $KSL_dir/rpm
+ cp -af $download_dir/boostkit-ksl-*.rpm $KSL_dir/rpm
+
+ resources_dir=$target_dir/resources
+ mkdir -p $resources_dir/libgcrypt
+ cp -af $download_dir/libgpg-error-*.tar.gz $resources_dir/libgcrypt
+
+ patch_dir=$target_dir/patch
+ mkdir -p $patch_dir
+ cp -af $download_dir/*.patch $patch_dir
+
+ mkdir -p $wheel_dir
+ cp -af $download_dir/argparse-*.whl $wheel_dir
+}
+
+edit_xml() {
+ xml_file=$DIR/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml
+
+ sed -i "s|.*|${ragel_url}|g" $xml_file
+ sed -i "s|.*|${boost_url}|g" $xml_file
+ sed -i "s|.*|${pcre_url}|g" $xml_file
+ sed -i "s|.*|${Hyperscan_git}|g" $xml_file
+ sed -i "s|.*|${KAE_git}|g" $xml_file
+ sed -i "s|.*|${libgpg_url}|g" $xml_file
+}
+
+
+build_tar() {
+ pushd $DIR/roles/AccLib/prepare/files
+ tar -zcvf BoostKit-AccLib.tar.gz BoostKit-AccLib/
+ popd
+}
+
+pushd $DIR
+
+get_source
+download
+build_dir
+edit_xml
+build_tar
+
+popd
diff --git a/plugins/boostkit-offline/workspace/build/AccLib/source.cfg b/plugins/boostkit-offline/workspace/build/AccLib/source.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..de93de1a777ff6a27a5de8ebe15e8eea66a50a98
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/build/AccLib/source.cfg
@@ -0,0 +1,5 @@
+KSL_version="2.5.0"
+Hyperscan_git="https://gitee.com/kunpengcompute/hyperscan.git"
+Hyperscan_branch="v5.4.2.aarch64"
+KAE_git="https://gitee.com/kunpengcompute/KAE.git"
+KAE_branch="kae2"
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/execute_install.yml b/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/execute_install.yml
new file mode 100644
index 0000000000000000000000000000000000000000..48bff616b512d5388186938a77f57ba21be16bf5
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/execute_install.yml
@@ -0,0 +1,29 @@
+- name: Get timestamp
+ command: date +%Y%m%d%H%M%S
+ register: timestamp
+ changed_when: false
+
+- name: Show log file path
+ debug:
+ msg: "Start executing install script. Use 'tail -f {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log' to watch process."
+ tags: install
+
+- name: Execute install script for {{ item }}
+ shell: |
+ python3 install.py --component {{ item }} > {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log 2>&1
+ args:
+ chdir: "{{ temp_path }}/BoostKit-AccLib/scripts"
+ register: install_result
+ changed_when: false
+ ignore_errors: true
+ tags: install
+
+- name: Show execution result
+ debug:
+ msg: "Installation completed for {{ item }}. Log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log"
+ when: install_result is succeeded
+
+- name: Fail if installation failed
+ fail:
+ msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log"
+ when: install_result is failed
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..525a999aaaa33ec3c20db82dcb7ae394722f5a16
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/install/tasks/main.yml
@@ -0,0 +1,3 @@
+- name: "[Script] Execute install script"
+ include_tasks: execute_install.yml
+ loop: "{{ (install_list if install_list is defined and (install_list is iterable and not install_list is string) else [install_list]) if install_list is defined and install_list | length > 0 else ['ALL'] }}"
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py
new file mode 100644
index 0000000000000000000000000000000000000000..80db5b8fb7eda492909c4167ef54efb1a346d32c
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py
@@ -0,0 +1,346 @@
+import argparse
+import os.path
+import re
+import xml.etree.ElementTree as ET
+import subprocess
+from contextlib import contextmanager
+
+quiet = True
+
+
+def check_version(src, tar, op=">="):
+ src_list = src.split('.')
+ tar_list = tar.split('.')
+
+ for index, str in enumerate(tar_list):
+ if '*' in str or index >= len(src_list):
+ break
+
+ if op == ">=":
+ if int(src_list[index]) > int(str):
+ return True
+ elif int(src_list[index]) == int(str):
+ continue
+ else:
+ return False
+ elif op == "<":
+ if int(src_list[index]) < int(str):
+ return True
+ elif int(src_list[index]) == int(str):
+ continue
+ else:
+ return False
+ elif op == "=":
+ if int(src_list[index]) != int(str):
+ return False
+ else:
+ return False
+ return True
+
+
+class Runcmd(object):
+ @staticmethod
+ def sendcmd(cmd, workspace=None, check=True, extra_env: dict = None):
+ env = os.environ.copy()
+ if extra_env:
+ for key in extra_env:
+ env[key] = extra_env.get(key)
+
+ if not quiet:
+ print(f"cmd: {cmd}")
+ result = subprocess.run(cmd, cwd=workspace, shell=True, check=check, capture_output=True, encoding='utf-8',
+ env=env)
+ if not quiet:
+ print(f"done\nstdout:\n{result.stdout}\nstderr:\n{result.stderr}\nreturn code: {result.returncode}")
+ return '\n'.join(result.stdout.split('\n')).strip("\n")
+
+
+class Installer(object):
+ __root = None
+ __function_dict = dict()
+
+ def __init__(self, xml_path):
+ self.__root = ET.parse(xml_path).getroot()
+ self.__ROOT_PATH = os.path.abspath(os.path.dirname(os.getcwd()))
+ self.__SOURCE_PATH = os.path.join(self.__ROOT_PATH, "source/")
+ self.__init_func_dict()
+ self.__platform = self.__check_platform()
+
+ def __check_platform(self):
+ kunpeng_platform = {"0xd01": "Kunpeng 920", "0xd02": "Kunpeng 920 V200"}
+ implementer = Runcmd.sendcmd("cat /proc/cpuinfo | grep 'CPU implementer' | head -n 1 | awk '{print $NF}'")
+ part = Runcmd.sendcmd("cat /proc/cpuinfo | grep 'CPU part' | head -n 1 | awk '{print $NF}'")
+
+ if implementer == "0x48":
+ return kunpeng_platform.get(part)
+ else:
+ return Runcmd.sendcmd("lscpu | grep 'BIOS Model name:' | awk '{print $NF}'")
+
+ def __check_env(self):
+ with self.__process("检查yum源, 并安装必要工具"):
+ Runcmd.sendcmd("yum makecache")
+ Runcmd.sendcmd("yum install -y tar gcc gcc-c++ patch")
+
+ def __chech_env_in_profile(self, key, value):
+ libpath = os.getenv(key)
+ if libpath and value in libpath:
+ return True
+
+ env_list = Runcmd.sendcmd(f"cat /etc/profile | grep {key}", check=False).split("\n")
+ for env in env_list:
+ if value in env and not re.search("#.+export", env):
+ return True
+
+ return False
+
+ def __get_element_text(self, tag: str):
+ tags = [child.tag for child in self.__root.find(tag)]
+ texts = [child.text for child in self.__root.find(tag)]
+ info = dict()
+
+ for index, tag in enumerate(tags):
+ info[tag] = texts[index]
+
+ return info
+
+ @contextmanager
+ def __process(self, topic):
+ try:
+ print(topic)
+ yield
+ print(f"{topic}成功")
+ except subprocess.CalledProcessError as e:
+ print(f"{topic}存在执行命令失败, 报错信息如下:\n{e.stderr}")
+ raise e
+ except Exception as e:
+ print(f"{topic}失败")
+ raise e
+
+ def __install_ksl(self):
+ with self.__process("安装KSL"):
+ res = Runcmd.sendcmd("cat /etc/os-release")
+ name = re.search("NAME=\"(.+)\"", res).group(1)
+ assert name == "openEuler", "仅支持在openEuler上安装"
+
+ Runcmd.sendcmd("rpm -e boostkit-ksl", check=False)
+ Runcmd.sendcmd("rpm -ivh rpm/*.rpm", workspace=f"{self.__ROOT_PATH}/KSL")
+
+ def __install_hyperscan_dep(self):
+ self.__install_ksl()
+
+ info = self.__get_element_text("Hyperscan")
+
+ with self.__process("安装ragel"):
+ bag = info.get("ragel").split('/')[-1]
+
+ Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+
+ dir = Runcmd.sendcmd(f"ls | grep ragel | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+ Runcmd.sendcmd(f"./configure", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}")
+ Runcmd.sendcmd(f"make -j && make install", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}")
+ Runcmd.sendcmd(f"ragel -v")
+
+ with self.__process("安装boost"):
+ bag = info.get("boost").split('/')[-1]
+
+ Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+
+ with self.__process("安装pcre"):
+ bag = info.get("pcre").split('/')[-1]
+
+ Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+
+ with self.__process("安装yum依赖包"):
+ Runcmd.sendcmd("yum install -y sqlite sqlite-devel")
+ stdout = Runcmd.sendcmd("pkg-config --libs sqlite3")
+ assert "-lsqlite3" in stdout, "安装sqlite失败"
+ Runcmd.sendcmd("yum install -y cmake make gcc gcc-c++")
+
+ def __install_hyperscan(self):
+ self.__install_hyperscan_dep()
+
+ info = self.__get_element_text("Hyperscan")
+
+ with self.__process("安装Hyperscan"):
+ download = info.get("hyperscan_code")
+ dir = download.split('/')[-1].split('.')[0]
+
+ res = Runcmd.sendcmd("rpm -qa | grep boostkit-ksl")
+ ksl_version = re.search("boostkit-ksl-(\d+.\d+.\d+)", res).group(1)
+ if check_version(ksl_version, "2.4.0"):
+ Runcmd.sendcmd(f"patch -p1 -N < ../../patch/khsel.patch",
+ workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}", check=False)
+
+ boost_path = Runcmd.sendcmd("ls | grep boost | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+ boost_path = f"{self.__ROOT_PATH}/Hyperscan/{boost_path}"
+ Runcmd.sendcmd(f"ln -s {boost_path}/boost include/boost", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}")
+
+ pcre_path = Runcmd.sendcmd("ls | grep pcre | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+ Runcmd.sendcmd(f"cp -rf ../{pcre_path} ./pcre", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}")
+
+ stdout = Runcmd.sendcmd("cmake --version | grep version", workspace=f"{self.__ROOT_PATH}/Hyperscan")
+ version = stdout.split()[-1]
+ if check_version(version, "2.8.0", op='<'):
+ Runcmd.sendcmd(
+ "sed -i 's/CMAKE_POLICY(SET CMP0026 OLD)/#CMAKE_POLICY(SET CMP0026 OLD)/g' CMakeLists.txt",
+ workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}/pcre")
+
+ Runcmd.sendcmd("mkdir -p build", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}")
+ Runcmd.sendcmd("cmake .. && make -j", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}/build")
+
+ def __install_kae_dep(self):
+ with self.__process("安装KAE相关依赖"):
+ Runcmd.sendcmd(
+ "yum install -y make kernel-devel libtool numactl-devel openssl-devel chrpath lz4-devel zstd-devel zlib-devel")
+
+ def __install_kae(self):
+ version = Runcmd.sendcmd("openssl version | awk '{print $2}'")
+ if check_version(version, "1.*", "="):
+ engine_path = "/usr/local/lib/engines-1.1/"
+ component = "engine"
+ elif check_version(version, "3.*", "="):
+ engine_path = "/usr/local/lib/engines-3.0/"
+ component = "engine3"
+ else:
+ assert False, f"unsupport openssl version: {version}"
+
+ self.__install_kae_dep()
+
+ info = self.__get_element_text("KAE")
+
+ with self.__process("编译KAE源码"):
+ download = info.get("kae_code")
+ dir = download.split('/')[-1].split('.')[0]
+
+ Runcmd.sendcmd("bash build.sh cleanup", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+ Runcmd.sendcmd("bash build.sh driver", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+ Runcmd.sendcmd("bash build.sh uadk", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+ Runcmd.sendcmd(f"bash build.sh {component}", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+ Runcmd.sendcmd("bash build.sh zlib", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+
+ if "Kunpeng 920 V200" == self.__platform:
+ Runcmd.sendcmd("bash build.sh lz4", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+ Runcmd.sendcmd("bash build.sh zstd", workspace=f"{self.__ROOT_PATH}/KAE/{dir}")
+
+ with self.__process("确认KAE模块使能"):
+ res = Runcmd.sendcmd("ls /sys/class/uacce", check=False)
+ if not res:
+ Runcmd.sendcmd("rmmod hisi_zip && rmmod hisi_sec2 && rmmod hisi_hpre")
+ Runcmd.sendcmd("inmod hisi_hpre && inmod hisi_sec2 && inmod hisi_zip")
+ Runcmd.sendcmd("ls /sys/class/uacce")
+ Runcmd.sendcmd("ls /usr/local/lib/libwd*")
+
+ res = Runcmd.sendcmd("ls /usr/local/kaezip/lib", check=False)
+ assert "kaezip" in res, "没有找到kaezip相关动态库"
+ if "Kunpeng 920 V200" == self.__platform:
+ res = Runcmd.sendcmd("ls /usr/local/kaelz4/lib", check=False)
+ assert "kaelz4" in res, "没有找到kaelz4相关动态库"
+ res = Runcmd.sendcmd("ls /usr/local/kaezstd/lib", check=False)
+ assert "kaezstd" in res, "没有找到kaezstd相关动态库"
+
+ res = Runcmd.sendcmd(f"ls {engine_path}", check=False)
+ assert "kae.so" in res, "没有找到engine相关动态库"
+
+ if not self.__chech_env_in_profile("OPENSSL_ENGINES", engine_path):
+ Runcmd.sendcmd(f"echo 'export OPENSSL_ENGINES={engine_path}:$OPENSSL_ENGINES' >> /etc/profile")
+
+ print("成功安装KAE, 已经添加必要环境变量, 执行source /etc/profile使能")
+
+ def __install_libgcrypt_dep(self):
+ with self.__process("安装libgcrypt相关依赖"):
+ Runcmd.sendcmd("yum install -y texinfo transfig hwloc hwloc-devel autoconf automake")
+
+ def __install_libgcrypt(self):
+ self.__install_libgcrypt_dep()
+
+ gpg_info = Runcmd.sendcmd("find /usr/local/lib -name '*libgpg-error.so*'")
+ if "libgpg-error.so" in gpg_info:
+ print("已经安装了libgpg-error,不用再安装了")
+ return
+
+ info = self.__get_element_text("Libgcrypt")
+ download = info.get('libgpg')
+ name = download.split('/')[-1]
+
+ Runcmd.sendcmd("mkdir libgpg", workspace=f"{self.__ROOT_PATH}")
+ with self.__process("安装libgcrypt"):
+ Runcmd.sendcmd(f"tar -xvf {name} -C {self.__ROOT_PATH}/libgpg",
+ workspace=f"{self.__ROOT_PATH}/resources/libgcrypt")
+ Runcmd.sendcmd("chmod 777 autogen.sh; ./autogen.sh",
+ workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51")
+ Runcmd.sendcmd("chmod 777 configure; ./configure --enable-maintainer-mode",
+ workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51")
+ Runcmd.sendcmd("make -j; make install", workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51")
+
+ if not self.__chech_env_in_profile("LD_LIBRARY_PATH", "/usr/local/lib"):
+ Runcmd.sendcmd("echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> /etc/profile")
+
+ def __install_kqmalloc_dep(self):
+ with self.__process("安装kqmalloc编译依赖"):
+ Runcmd.sendcmd("yum install -y autoconf gcc gcc-c++")
+
+ def __install_kqmalloc(self):
+ self.__install_kqmalloc_dep()
+
+ with self.__process("安装kqmalloc"):
+ self.__install_ksl()
+ res = Runcmd.sendcmd("rpm -qa | grep boostkit-ksl")
+ ksl_version = re.search("boostkit-ksl-(\d+.\d+.\d+)", res).group(1)
+ assert check_version(ksl_version, "2.4.0"), "ksl版本过低,请指定2.4.0以上版本"
+
+ def __init_func_dict(self):
+ self.__function_dict["Hyperscan"] = self.__install_hyperscan
+ self.__function_dict["Libgcrypt"] = self.__install_libgcrypt
+ res = Runcmd.sendcmd("lscpu | grep 'BIOS Model name:'")
+ if "Kunpeng" in res:
+ self.__function_dict["KAE"] = self.__install_kae
+ self.__function_dict["KQMalloc"] = self.__install_kqmalloc
+
+ def get_support(self):
+ return ' '.join(self.__function_dict.keys())
+
+ def install(self, components):
+ self.__check_env()
+
+ if "ALL" == components:
+ for func in self.__function_dict.values():
+ try:
+ func()
+ except Exception as e:
+ print(e)
+ if not args.ignore:
+ raise e
+ else:
+ for component in components.split(','):
+ func = self.__function_dict.get(component)
+ if func:
+ try:
+ func()
+ except Exception as e:
+ print(e)
+ if not args.ignore:
+ raise e
+ else:
+ raise f"没有找到安装方法, {component}"
+
+
+if __name__ == '__main__':
+ installer = Installer('version.xml')
+ supports = installer.get_support()
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--component", type=str,
+ help=f"support component eg. ALL | component | 'component1 component2...', default ALL",
+ default='ALL')
+ parser.add_argument("-q", '--quiet', action='store_true', help="print quiet")
+ parser.add_argument('--ignore', action='store_true',
+ help="ignore error for each installing component while component is ALL")
+ parser.add_argument("-i", '--info', action='store_true', help="check supported components")
+ args = parser.parse_args()
+ quiet = args.quiet
+ info_t = args.info
+ if info_t:
+ print(supports)
+ exit(0)
+
+ installer.install(args.component)
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml
new file mode 100644
index 0000000000000000000000000000000000000000..46b3897b95cbcd952699bffbb7f60fa0470f5cb5
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml
@@ -0,0 +1,15 @@
+
+
+
+ https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/ragel-6.10.tar.gz
+ https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/boost_1_87_0.tar.gz
+ https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/pcre-8.43.tar.gz
+ https://gitee.com/kunpengcompute/hyperscan.git
+
+
+ https://gitee.com/kunpengcompute/KAE.git
+
+
+ https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.51.tar.gz
+
+
\ No newline at end of file
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/prepare/tasks/main.yml b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..70fafff5c29427cb9fa78ad591a11e6aefe845de
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/prepare/tasks/main.yml
@@ -0,0 +1,47 @@
+- name: "[Dependency] Install python3-libselinux"
+ yum:
+ name: python3-libselinux
+ state: present
+ tags: dependency
+
+- name: "[Cleanup] Remove temporary files and directories"
+ file:
+ path: "{{ temp_path }}/{{ item }}"
+ state: absent
+ loop:
+ - "BoostKit-AccLib"
+ - "BoostKit-AccLib.tar.gz"
+ - "BoostKit-AccLib-wheels"
+ tags: cleanup
+
+- name: "[File] Ensure destination directory exists"
+ file:
+ path: "{{ temp_path }}"
+ state: directory
+ tags: file_transfer
+
+- name: "[File] Transfer local file to remote host"
+ copy:
+ src: "BoostKit-AccLib.tar.gz"
+ dest: "{{ temp_path }}"
+ tags: file_transfer
+
+- name: "[File] Unpack BoostKit-AccLib.tar.gz"
+ unarchive:
+ src: "{{ temp_path }}/BoostKit-AccLib.tar.gz"
+ dest: "{{ temp_path }}"
+ tags: file_transfer
+
+- name: "[File] Transfer wheels to remote host"
+ copy:
+ src: "BoostKit-AccLib-wheels"
+ dest: "{{ temp_path }}"
+ tags: file_transfer
+
+- name: "[Dependency] Install all wheel files from BoostKit-AccLib-wheels"
+ pip:
+ name: "{{ item }}"
+ state: present
+ with_fileglob:
+ - "{{ temp_path }}/BoostKit-AccLib-wheels/*.whl"
+ tags: dependency
diff --git a/plugins/boostkit-offline/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit-offline/workspace/roles/AccLib/show/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5652f83f8b589e76c03138ae81fba9a28649b1fc
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/AccLib/show/tasks/main.yml
@@ -0,0 +1,13 @@
+- name: "[Script] Get info and display"
+ shell: |
+ python3 install.py -i
+ args:
+ chdir: "{{ temp_path }}/BoostKit-AccLib/scripts"
+ register: info_output
+ changed_when: false
+ tags: get_info
+
+- name: "[Script] Display execution output"
+ debug:
+ msg: "{{ info_output.stdout_lines }}"
+ tags: get_info
diff --git a/plugins/boostkit-offline/workspace/roles/check/tasks/main.yml b/plugins/boostkit-offline/workspace/roles/check/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..78ab7fe16de23373ad28787d6364b3de1a594e46
--- /dev/null
+++ b/plugins/boostkit-offline/workspace/roles/check/tasks/main.yml
@@ -0,0 +1,44 @@
+- name: "[Check] Skip all checks if skip_check is true"
+ debug:
+ msg: "Skipping all checks"
+ when: >
+ skip_check is defined and
+ (skip_check == true or skip_check | string == "true")
+ tags: never
+
+- block:
+ - name: "[Check] Initialize check results"
+ set_fact:
+ check_results: []
+ check_failed: "false"
+
+ - name: "[CPU] Verify Kunpeng-920 processor"
+ shell: |
+ grep -m1 "CPU implementer" /proc/cpuinfo | awk '{print $4}'
+ register: cpu_implementer
+ changed_when: false
+ tags: hardware_check
+
+ - name: "[CPU] Record CPU check result"
+ set_fact:
+ check_results: "{{ check_results + ['CPU implementer: ' + cpu_implementer.stdout] }}"
+ check_failed: "{{ check_failed or (cpu_implementer.stdout != '0x48') }}"
+ tags: hardware_check
+
+ - name: "[Check] Display all check results"
+ debug:
+ msg: "{{ item }}"
+ loop: "{{ check_results }}"
+
+ - name: "[Check] Abort if any check failed"
+ fail:
+ msg: >-
+ Pre-deployment checks failed:
+ {% for result in check_results %}
+ - {{ result }}
+ {% endfor %}
+ Please fix the issues and try again.
+ when: check_failed
+ when: >
+ skip_check is not defined or
+ (skip_check != true and skip_check | string != "true")