diff --git "a/compassCI\347\256\200\350\277\260.md" "b/compassCI\347\256\200\350\277\260.md" new file mode 100644 index 0000000..69f2f9d --- /dev/null +++ "b/compassCI\347\256\200\350\277\260.md" @@ -0,0 +1,186 @@ +# compassCI简述 +## 说明 +该文档记录使用compassCI的部分流程以及日志查看 +## 首先安装compassCI客户端 +这里把lkp-tests作为compassCI的客户端,通过本地安装lkp-tests 实现手动提交测试任务. +查看文档注意到lkp-tests提交任务依赖ruby,建议安装ruby2.5及以上版本 +```bash +#将lkp-tests克隆到本地 +git clone https://gitee.com/compass-ci/lkp-tests.git + +# 进入安装目录 +cd lkp-tests +make install +source $HOME/.${SHELL##*/}rc +``` +## 测试提交任务 +使用submit命令提交任务到compassCI。 +我的理解是compassCI类似于调度系统,lkp-tests作为客户端,将任务推送到compassCI,compassCI再根据资源情况,将任务分发至节点执行 +当然,提交任务时可指定资源情况即指定机器。 +```bash +#如下命令 +submit -m -c job-pypi.yaml repo_addr=newsworthycharts os_arch=aarch64 testbox=vm-2p8g + +xiongkaiqi@z9 ~$ submit -m -c job-pypi.yaml repo_addr=newsworthycharts os_arch=aarch64 testbox=vm-2p8g +Ignoring openssl-2.2.0 because its extensions are not built. Try: gem pristine openssl --version 2.2.0 +submit_id=241217100434171930 +2024-12-17 10:04:35 +0800 WARN -- skip non-executable /home/xiongkaiqi/lkp-tests/daemon/netserver-sequence +submit job-pypi.yaml, got job id=z9.31481844 +result_root /srv/result/rpmbuild-python/2024-12-17/vm-2p8g/openeuler-24.03-LTS-aarch64/aarch64-1/z9.31481844 +Ignoring openssl-2.2.0 because its extensions are not built. Try: gem pristine openssl --version 2.2.0 +query=>{"job_id":["z9.31481844"]} +connect to ws://api.compass-ci.openeuler.org:20001/filter +{"level_num":2,"level":"INFO","time":"2024-12-17T10:04:39.995+0800","job_id":"z9.31481844","message":"","job_state":"submit","result_root":"/srv/result/rpmbuild-python/2024-12-17/vm-2p8g/openeuler-24.03-LTS-aarch64/aarch64-1/z9.31481844","status_code":200,"method":"POST","resource":"/submit_job","api":"submit_job","elapsed_time":681.059793,"elapsed":"681.06ms"} +{"level_num":2,"level":"INFO","time":"2024-12-17T10:04:40.279+0800","job_id":"z9.31481844","result_root":"/srv/result/rpmbuild-python/2024-12-17/vm-2p8g/openeuler-24.03-LTS-aarch64/aarch64-1/z9.31481844","job_state":"set result root","status_code":101,"method":"GET","resource":"/ws/boot.ipxe/mac/0a-f9-1b-5f-70-49","testbox":"vm-2p8g.taishan200-2280-2s48p-256g--a35-2"} +{"level_num":2,"level":"INFO","time":"2024-12-17T10:04:40.638+0800","from":"172.17.0.1:50658","message":"access_record","status_code":101,"method":"GET","resource":"/ws/boot.ipxe/mac/0a-f9-1b-5f-70-49","testbox":"vm-2p8g.taishan200-2280-2s48p-256g--a35-2","job_id":"z9.31481844"} +{"level_num":2,"level":"INFO","time":"2024-12-17T10:04:40.668+0800","from":"172.17.0.1:33808","message":"access_record","status_code":200,"method":"GET","resource":"/job_initrd_tmpfs/z9.31481844/job.cgz","job_id":"z9.31481844","job_state":"download","api":"job_initrd_tmpfs","elapsed_time":0.535913,"elapsed":"535.91µs"} + +The vm-2p8g testbox is starting. Please wait about 3 minutes +``` +## 上述命令说明 +submit命令作用是提交任务 + +-m 参数可以启动任务监控功能,并将执行任务过程中的状态信息打印到控制台,方便监控 + +-c 参数需要搭配-m参数使用,可以使申请的设备实现自动登录功能 (查看文档发现需提前执行ssh-keygen -t rsa 生成密钥文件和私钥文件) +```bash +The vm-2p8g testbox is starting. Please wait about 3 minutes +{"level_num":2,"level":"INFO","time":"2024-12-17T10:06:54+0800","mac":"0a-f9-1b-5f-70-49","ip":"172.18.188.51","job_id":"z9.31481844","state":"running","testbox":"vm-2p8g.taishan200-2280-2s48p-256g--a35-2","status_code":200,"method":"GET","resource":"/~lkp/cgi-bin/lkp-wtmp?tbox_name=vm-2p8g.taishan200-2280-2s48p-256g--a35-2&tbox_state=running&mac=0a-f9-1b-5f-70-49&ip=172.18.188.51&job_id=z9.31481844","api":"lkp-wtmp","elapsed_time":124.575754,"elapsed":"124.58ms"} +{"level_num":2,"level":"INFO","time":"2024-12-17T10:08:18.525+0800","from":"172.17.0.1:51296","message":"access_record","status_code":200,"method":"GET","resource":"/~lkp/cgi-bin/lkp-jobfile-append-var?job_file=/lkp/scheduled/job.yaml&job_id=z9.31481844&job_state=running","job_id":"z9.31481844","api":"lkp-jobfile-append-var","elapsed_time":254.047003,"elapsed":"254.05ms","job_state":"running","job_stage":"running"} +{"level_num":2,"level":"INFO","time":"2024-12-17T10:08:18.789+0800","tbox_name":"vm-2p8g.taishan200-2280-2s48p-256g--a35-2","job_id":"z9.31481844","ssh_port":"22380","message":"","state":"set ssh port","status_code":200,"method":"POST","resource":"/~lkp/cgi-bin/report_ssh_info","api":"report_ssh_info","elapsed_time":0.566163,"elapsed":"566.16µs"} +ssh root@api.compass-ci.openeuler.org -p 22380 -o StrictHostKeyChecking=no -o LogLevel=error + +Authorized users only. All activities may be monitored and reported. + + +Welcome to 6.6.0-28.0.0.34.oe2403.aarch64 + +System information as of time: Tue Dec 17 10:08:21 AM UTC 2024 + +System load: 0.86 +Memory used: 10.0% +Swap used: 0.0% +Usage On: 32% +IP address: 172.18.188.51 +Users online: 1 +``` +testbox 参数是指定需要的测试机 上述vm-2p8g意思是会申请一台2核8G内存的虚拟机用于测试。 + +## 日志追踪以及查看 +在提交任务进入到分配的虚拟机后,在/home/lkp下会生成rpmbuild目录,该目录下的SOURCEES目录和SPECS目录会自动下载源码和spec文件 +构建RPM包的相关日志存放在/tmp/lkp/result/目录下 +```bash +[root@localhost result]# ls +boot-time executed_programs lkp-stderr lkp-stdout output rpmbuild sleep stderr stdout umesg +``` +其中完整日志存放于output中,下面是部分日志,其调试过程中的日志也可在此追踪 +```bash +[log] don't need repair spec by rpm mpaping +Last metadata expiration check: 0:01:27 ago on Tue 17 Dec 2024 10:14:15 AM UTC. +Package python3-devel-3.11.6-8.oe2403.aarch64 is already installed. +Package python3-pip-23.3.1-2.oe2403.noarch is already installed. +Package python3-setuptools-68.0.0-2.oe2403.noarch is already installed. +Package python3-wheel-1:0.40.0-1.oe2403.noarch is already installed. +Error: + Problem 1: conflicting requests + - nothing provides python3.11dist(opencv-python-headless) needed by python3-numpyimage-2.1.0-1.noarch from python + Problem 2: cannot install the best candidate for the job + - nothing provides python3.11dist(jaxlib) >= 0.4.25 needed by python3-numpyro-0.16.1-1.noarch from python + Problem 3: package python3-numpy-sugar-1.5.4-1.noarch from python requires python3.11dist(pytest) < 7, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.3-1.noarch from python + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.4-1.noarch from python + Problem 4: package python3-numpydantic-1.6.4-1.noarch from python requires python3.11dist(pydantic) >= 2.3, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python + Problem 5: package python3-numpy-pydantic-types-0.1.0a0-1.noarch from python requires python3.11dist(pydantic) >= 2, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python +(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) +failed to solve dependencies +do repair_build_module_not_found count:2 +Looking in indexes: http://172.168.131.2:5032/lowinli/devpi/+simple/ +Requirement already satisfied: specfile in /usr/local/lib/python3.11/site-packages (0.33.0) +Requirement already satisfied: packaging in /usr/local/lib/python3.11/site-packages (24.2) +Requirement already satisfied: rpm in /usr/lib64/python3.11/site-packages (from specfile) (4.18.2) + +==> /tmp/stderr <== +WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv + +==> /tmp/stdout <== +python3 /lkp/lkp/src/programs/rpmbuild/utils/repair_build_module_not_found.py newsworthycharts /home/lkp/rpmbuild/SPECS/python-newsworthycharts.spec /tmp//build.log +No suitable module found to add as a build dependency. +repair_build_module_not_found fail +[log] ai_repair_spec: [], rpmbuild_result: [1] +[log] no need to repair by ai [1] + +==> /tmp/stderr <== +basename: missing operand +Try 'basename --help' for more information. +basename: missing operand +Try 'basename --help' for more information. + +==> /tmp/stdout <== +doneexit........................... +sleep started +``` +其中rpmbuild文件中存放的是构建过程中的部分日志如下,可以看到构建失败的原因,便于进一步排查处理 +```bash +Last metadata expiration check: 0:01:24 ago on Tue 17 Dec 2024 10:14:15 AM UTC. +Package python3-devel-3.11.6-8.oe2403.aarch64 is already installed. +Package python3-pip-23.3.1-2.oe2403.noarch is already installed. +Package python3-setuptools-68.0.0-2.oe2403.noarch is already installed. +Package python3-wheel-1:0.40.0-1.oe2403.noarch is already installed. +Error: + Problem 1: conflicting requests + - nothing provides python3.11dist(opencv-python-headless) needed by python3-numpyimage-2.1.0-1.noarch from python + Problem 2: cannot install the best candidate for the job + - nothing provides python3.11dist(jaxlib) >= 0.4.25 needed by python3-numpyro-0.16.1-1.noarch from python + Problem 3: package python3-numpy-sugar-1.5.4-1.noarch from python requires python3.11dist(pytest) < 7, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.3-1.noarch from python + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.4-1.noarch from python + Problem 4: package python3-numpydantic-1.6.4-1.noarch from python requires python3.11dist(pydantic) >= 2.3, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python + Problem 5: package python3-numpy-pydantic-types-0.1.0a0-1.noarch from python requires python3.11dist(pydantic) >= 2, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python +(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) +[log] don't need repair spec by rpm mpaping +Last metadata expiration check: 0:01:27 ago on Tue 17 Dec 2024 10:14:15 AM UTC. +Package python3-devel-3.11.6-8.oe2403.aarch64 is already installed. +Package python3-pip-23.3.1-2.oe2403.noarch is already installed. +Package python3-setuptools-68.0.0-2.oe2403.noarch is already installed. +Package python3-wheel-1:0.40.0-1.oe2403.noarch is already installed. +Error: + Problem 1: conflicting requests + - nothing provides python3.11dist(opencv-python-headless) needed by python3-numpyimage-2.1.0-1.noarch from python + Problem 2: cannot install the best candidate for the job + - nothing provides python3.11dist(jaxlib) >= 0.4.25 needed by python3-numpyro-0.16.1-1.noarch from python + Problem 3: package python3-numpy-sugar-1.5.4-1.noarch from python requires python3.11dist(pytest) < 7, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.3-1.noarch from python + - nothing provides python3.11dist(pluggy) >= 1.5 needed by python3-pytest-8.3.4-1.noarch from python + Problem 4: package python3-numpydantic-1.6.4-1.noarch from python requires python3.11dist(pydantic) >= 2.3, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python + Problem 5: package python3-numpy-pydantic-types-0.1.0a0-1.noarch from python requires python3.11dist(pydantic) >= 2, but none of the providers can be installed + - conflicting requests + - nothing provides python3.11dist(pydantic-core) = 2.27 needed by python3-pydantic-2.10.0-1.noarch from python + - nothing provides python3.11dist(pydantic-core) = 2.23.4 needed by python3-pydantic-2.9.2-1.noarch from python +(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) +failed to solve dependencies +do repair_build_module_not_found count:2 +``` +## 退出虚拟机 +退出虚拟机命令 +```bash +# root用户下执行以下命令退出虚拟机 +cci return +``` diff --git "a/epkg\345\267\245\345\205\267\344\275\277\347\224\250\350\257\264\346\230\216.md" "b/epkg\345\267\245\345\205\267\344\275\277\347\224\250\350\257\264\346\230\216.md" new file mode 100644 index 0000000..1159bb9 --- /dev/null +++ "b/epkg\345\267\245\345\205\267\344\275\277\347\224\250\350\257\264\346\230\216.md" @@ -0,0 +1,161 @@ +# epkg工具使用说明 +## 说明 +该文档介绍epkg下载以及使用基本功能 +# 安装 + 下面说明如何安装使用epkg工具 +```bash +# 使用通用安装方式 +curl -sSL https://gitee.com/openeuler/epkg/raw/master/epkg-installer.sh -o epkg-install.sh +# 执行安装脚本 +bash epkg-install.sh + +# 完成之后进行初始化 +epkg init +# 接下来重新执行.bashrc/bash获取新的PATH +bash + +# 创建虚拟环境t1 +epkg env create t1 + +# 创建完成之后可以使用epkg env list查看当前有哪些环境, 对应后面的Y,说明正在使用当前环境 +epkg env list +[root@3d09ed686202 ~]# epkg env list +EPKG_ENV_NAME: t1 +Available environments(sort by time): +Environment Status +--------------------- +t2 +t1 Y +main + +# 使用epkg env activate t1 切换到t1环境 +epkg env activate t1 +[root@3d09ed686202 /]# epkg activate t1 +Add common to path +Add t1 to path +Environment 't1' activated. + +# 安装包示例 +epkg install xxx +[root@3d09ed686202 /]# epkg install tree +EPKG_ENV_NAME: t1 +Caching repodata for: "OS" +Cache for "OS" already exists. Skipping... +Caching repodata for: "everything" +Cache for "everything" already exists. Skipping... +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/FF/FFCRTKRFGFQ6S2YVLOSUF6PHSMRP7A2N__ncurses-libs__6.4__8.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/D5/D5BOEFTRBNV3E4EXBVXDSRNTIGLGWVB7__glibc-all-langpacks__2.38__34.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/VX/VX6SUOPGEVDWF6E5M2XBV53VS7IXSFM5__openEuler-repos__1.0__3.3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/LO/LO6RYZTBB2Q7ZLG6SWSICKGTEHUTBWUA__libselinux__3.5__3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/EP/EPIEEK2P5IUPO4PIOJ2BXM3QPEFTZUCT__basesystem__12__3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/2G/2GYDDYVWYYIDGOLGTVUACSBHYVRCRJH3__setup__2.14.5__2.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/HC/HCOKXTWQQUPCFPNI7DMDC6FGSDOWNACC__glibc__2.38__34.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/OJ/OJQAHJTY3Y7MZAXETYMTYRYSFRVVLPDC__glibc-common__2.38__34.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/FJ/FJXG3K2TSUYXNU4SES2K3YSTA3AHHUMB__tree__2.1.1__1.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/KD/KDYRBN74LHKSZISTLMYOMTTFVLV4GPYX__readline__8.2__2.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/MN/MNJPSSBS4OZJL5EB6YKVFLMV4TGVBUBA__tzdata__2024a__2.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/S4/S4FBO2SOMG3GKP5OMDWP4XN5V4FY7OY5__bash__5.2.21__1.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/EJ/EJGRNRY5I6XIDBWL7H5BNYJKJLKANVF6__libsepol__3.5__3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/TZ/TZRQZRU2PNXQXHRE32VCADWGLQG6UL36__bc__1.07.1__12.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/WY/WYMBYMCARHXD62ZNUMN3GQ34DIWMIQ4P__filesystem__3.16__6.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/KQ/KQ2UE3U5VFVAQORZS4ZTYCUM4QNHBYZ7__openEuler-release__24.09__55.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/HD/HDTOK5OTTFFKSTZBBH6AIAGV4BTLC7VT__openEuler-gpg-keys__1.0__3.3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/EB/EBLBURHOKKIUEEFHZHMS2WYF5OOKB4L3__pcre2__10.42__8.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/YW/YW5WTOMKY2E5DLYYMTIDIWY3XIGHNILT__info__7.0.3__3.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% +start download https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64//store/E4/E4KCO6VAAQV5AJGNPW4HIXDHFXMR4EJV__ncurses-base__6.4__8.oe2409.epkg +######################################################################################################################################################################################################################################################### 100.0% + +# 查看安装包版本 +tree --version +which tree + +# 查看repo +[root@3d09ed686202 ~]# epkg repo list +EPKG_ENV_NAME: t1 +------------------------------------------------------------------------------------------------------------------------------------------------------ +channel | repo | url +------------------------------------------------------------------------------------------------------------------------------------------------------ +openEuler-22.03-LTS-SP3 | OS | https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-22.03-LTS-SP3/OS/aarch64/ +openEuler-24.09 | OS | https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/OS/aarch64/ +openEuler-24.09 | everything | https://repo.oepkgs.net/openeuler/epkg/channel/openEuler-24.09/everything/aarch64/ +------------------------------------------------------------------------------------------------------------------------------------------------------ + +# 指定repo创建环境 +epkg env create t2 --repo openEuler-22.03-LTS-SP3 + +# 安装包过程和上述一致 +epkg install ${package_name} + +# 退出当前环境 +epkg env deactivate ${env_name} +[root@3d09ed686202 ~]# epkg deactivate t1 +Add common to path +Add main to path +Environment 't1' deactivated. + +# 指定环境,持久化刷新PATH,并将指定环境设为第一优先级 +epkg env enable ${env_name} +[root@3d09ed686202 ~]# epkg env enable t1 +EPKG_ENV_NAME: main +Add common to path +Add main to path +Add t1 to path +Environment 't1' added to PATH. + +# 取消持久化刷新 +epkg env disable t1 +[root@3d09ed686202 ~]# epkg env disable t1 +EPKG_ENV_NAME: main +Add common to path +Add main to path +Environment 't1' removed from PATH. + +# 编译epkg软件包 +# 根据autopkg提供的yaml编译软件包 +epkg build ${yaml_path} +``` +# 注意 + 在实际使用中发现,如果使用docker exec -it 容器名 bash 进入容器操作,进入容器之后不要再次执行bash。 +# 命令使用说明 + Usage: + epkg install PACKAGE + epkg install [--env ENV] PACKAGE (开发中...) + epkg remove [--env ENV] PACKAGE (开发中...) + epkg upgrade [PACKAGE] (开发中...) + + epkg search PACKAGE (开发中...) + epkg list (开发中...) + + epkg env list + epkg env create|remove ENV + epkg env activate ENV + epkg env deactivate ENV + epkg env enable|disable ENV + epkg env history ENV (开发中...) + epkg env rollback ENV (开发中...) + +软件包安装: + + epkg env create $env // 创建环境 + epkg install $package // 在环境中安装软件包 + epkg env create $env2 --repo $repo // 创建环境2,指定repo + epkg install $package // 在环境2中安装软件包 \ No newline at end of file diff --git a/scripts/count_compare_rpm.sh b/scripts/count_compare_rpm.sh new file mode 100644 index 0000000..542e8f6 --- /dev/null +++ b/scripts/count_compare_rpm.sh @@ -0,0 +1,115 @@ +#!/bin/bash +# desc +#根据不同场景,传入目录,统计出二进制rpm包,发布的二进制包,源码包,发布的源码包情况 +# create time: 20241216 +# args: RPM_PATH (待统计RPM包目录,如:/srv/rpm/testing/openeuler-24.03-LTS/centos9) + +RPM_PATH=$1 +PUB_RPM_PATH=$2 +SRC_RPM_PATH=$RPM_PATH +PUB_SRC_RPM_PATH=$PUB_RPM_PATH + + +check_params(){ + if [ -z "$RPM_PATH" ] || [ -z "$PUB_RPM_PATH" ];then + echo "[error] ONE OR MORE PARAM PATH ARE EMPTY!" + echo "USAGE: sh count_compare_rpm.sh <构建成功RPM包路径> <发布成功RPM包路径>" + exit 1 + fi +} + +get_src_num(){ + # 输出包的信息,不带包版本 + local rpm_tmp_file=$1 + while read -r rpm_file; do + rpm -qp --queryformat "%{NAME}\n" "${rpm_file}" + done < "$rpm_tmp_file" +} + +lookup_count_rpm(){ + # 查找统计rpm包情况 + system_type=$(basename "$RPM_PATH") + rpm_info_tmp_file=$system_type"_rpm_1103.txt" + rpm_pkg_tmp_file=$system_type"_rpm_package_name_1103.txt" + rpm_uniq_tmp_file=$system_type"_uniq_rpm_1103.txt" + + pub_rpm_info_tmp_file=$system_type"_pub_rpm_1103.txt" + pub_rpm_pkg_tmp_file=$system_type"_pub_rpm_package_name_1103.txt" + pub_rpm_uniq_tmp_file=$system_type"_uniq_pub_rpm_1103.txt" + + src_rpm_info_tmp_file=$system_type"_src_rpm_1103.txt" + src_rpm_pkg_tmp_file=$system_type"_src_rpm_package_name_1103.txt" + src_rpm_uniq_tmp_file=$system_type"_uniq_src_rpm_1103.txt" + + src_pub_rpm_info_tmp_file=$system_type"_src_pub_rpm_1103.txt" + src_pub_rpm_pkg_tmp_file=$system_type"_src_pub_rpm_package_name_1103.txt" + src_pub_rpm_uniq_tmp_file=$system_type"_uniq_src_pub_rpm_1103.txt" + # 二进制rpm包情况 + find_process_rpm "$rpm_info_tmp_file" "$rpm_pkg_tmp_file" "$rpm_uniq_tmp_file" "$RPM_PATH" "N" + # 发布二进制包情况 + find_process_rpm "$pub_rpm_info_tmp_file" "$pub_rpm_pkg_tmp_file" "$pub_rpm_uniq_tmp_file" "$PUB_RPM_PATH" "N" + # 源码包情况 + find_process_rpm "$src_rpm_info_tmp_file" "$src_rpm_pkg_tmp_file" "$src_rpm_uniq_tmp_file" "$SRC_RPM_PATH" "Y" + # 发布源码包情况 + find_process_rpm "$src_pub_rpm_info_tmp_file" "$src_pub_rpm_pkg_tmp_file" "$src_pub_rpm_uniq_tmp_file" "$PUB_SRC_RPM_PATH" "Y" + + # 统计结果 + count_result "$system_type" +} + +find_process_rpm(){ + local rpm_info_tmp_file=$1 + local rpm_pkg_tmp_file=$2 + local rpm_uniq_tmp_file=$3 + local rpm_path=$4 + local src_flag=$5 + if [[ $src_flag == "N" ]];then + find "$rpm_path" -name "*rpm" | grep -v "src" > "$rpm_info_tmp_file" + else + find "$rpm_path" -name "*rpm" | grep "src" > "$rpm_info_tmp_file" + fi + get_src_num "$rpm_info_tmp_file" > "$rpm_pkg_tmp_file" + sort "$rpm_pkg_tmp_file" | uniq -c | sort -nr > "$rpm_uniq_tmp_file" +} + +count_result(){ + # 统计结果 + system_type=$1 + + # 源码包构建成功个数 + src_rpm_build_total=$(wc -l "$src_rpm_info_tmp_file"|awk -F ' ' '{print $1}') + # 源码包构建成功包名称个数 + src_rpm_build_package_total=$(wc -l "$src_rpm_uniq_tmp_file"|awk -F ' ' '{print $1}') + # 二进制包构建成功个数 + rpm_build_total=$(wc -l "$rpm_info_tmp_file"|awk -F ' ' '{print $1}') + # 二进制包构建成功包名称个数 + rpm_build_package_total=$(wc -l "$rpm_uniq_tmp_file"|awk -F ' ' '{print $1}') + # 发布成功源码包个数 + pub_src_rpm_total=$(wc -l "$src_pub_rpm_info_tmp_file"|awk -F ' ' '{print $1}') + # 发布成功源码包名称个数 + pub_src_rpm_package_total=$(wc -l "$src_pub_rpm_uniq_tmp_file"|awk -F ' ' '{print $1}') + # 发布成功二进制包个数 + pub_rpm_build_total=$(wc -l "$pub_rpm_info_tmp_file"|awk -F ' ' '{print $1}') + # 发布成功二进制包名称个数 + pub_rpm_build_package_total=$(wc -l "$pub_rpm_uniq_tmp_file"|awk -F ' ' '{print $1}') + + + cat > "$system_type""_count_result_info.txt" < <发布包路径>, 程序按位置获取参数 +# 如: +# sh run_count_compare_rpm.sh /srv/rpm/testing/openeuler-24.03-LTS/ai /srv/rpm/pub/openeuler-24.03-LTS/ai/ /srv/rpm/testing/openeuler-24.03-LTS/github /srv/rpm/pub/openeuler-24.03-LTS/github/ ... + +# 转成数组便于后续处理 +PARAM=("$@") + +check_params(){ + # 检查参数输入是否合规 + param_count="${#PARAM[@]}" + if (( "$param_count" == 0 || "$param_count" % 2 != 0 ));then + echo "参数输入有误或个数不正确" + echo "Usage: sh run_count_compare_rpm.sh <未发布包路径> <已发布包路径> (多个场景依次按这个路径顺序填入)" + exit 1 + fi +} + +join_param(){ + # 遍历并拼接参数 + for (( i=0; i<${#PARAM[@]}; i+=2 )); do + if (( i+1 < ${#PARAM[@]} )); then + result="${PARAM[i]} ${PARAM[i+1]}" + echo "sh count_compare_rpm.sh $result" + sh count_compare_rpm.sh "${PARAM[i]}" "${PARAM[i+1]}" & + fi + done + wait + echo "all task completed!" +} + +check_params +join_param