代码拉取完成,页面将自动刷新
同步操作将从 openEuler/pkgship 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
REPO_CONFIG_FILE="/etc/yum.repos.d/openEuler_pkgship.repo"
pkgship_spec_path="pkgship/pkgship.spec"
function clear_env() {
rm -rf /home/jenkins/rpmbuild || echo "clear env"
}
function prepare_rpmbuild_dir() {
mkdir -p /home/jenkins/rpmbuild
cd /home/jenkins/rpmbuild
mkdir -p BUILD BUILDROOT RPM RPMS SOURCES SPECS SRPMS
cd -
}
function install_require() {
sudo dnf install dnf-plugins-core -y
sudo dnf config-manager --set-disable update
sudo dnf install rpm-build 'dnf-command(builddep)' -y
state_1=$?
sudo dnf builddep pkgship/pkgship.spec -y
state_2=$?
if [ ${state_1} -eq 1 -o ${state_2} -eq 1 ]; then
echo "install require rpm failed"
exit 1
fi
}
function add_tmp_requires() {
echo "[INFO] add python requires"
sudo dnf install python3-devel -y
pip install aiohttp==3.8.1 lxml==4.6.3 apscheduler --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
}
function build_install_rpm(){
if [ ! -f ${pkgship_spec_path} ]; then
echo "pkgship.spec file not exists."
exit 1
fi
version=""
while read line; do
if [[ $line =~ "Version" ]]; then
version=$(echo ${line:9} | sed 's/ //g')
break
fi
done <${pkgship_spec_path}
pkgship_name="pkgship-"$version
mv pkgship $pkgship_name
tar -zcvf /home/jenkins/rpmbuild/SOURCES/$pkgship_name.tar.gz $pkgship_name &>/dev/null
cp $pkgship_name/pkgship.spec /home/jenkins/rpmbuild/SPECS/
# build pkgship rpm
rpmbuild -bb /home/jenkins/rpmbuild/SPECS/pkgship.spec
# install pkgship rpm
sudo dnf install -y /home/jenkins/rpmbuild/RPMS/noarch/pkgship*
}
export TZ=Asia/Shanghai
clear_env
echo "clear env ... done"
install_require
echo "install required rpms ... done"
#add_tmp_requires
prepare_rpmbuild_dir
echo "prepare rpmbuild dir ... done"
build_install_rpm
echo "build install rpm ... done"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。