!884 修复kpatch-build调用命令,给patch文件打上时间戳

Merge pull request !884 from ydjohn/yd_merge
This commit is contained in:
huangtuq 2023-02-16 10:03:45 +00:00 committed by Gitee
commit d6edceb3eb
4 changed files with 8 additions and 64 deletions

View File

@ -18,7 +18,7 @@ install_package() {
rpm -q --quiet make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves || yum install -y make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves || exit 1
rpm -q --quiet docker git || yum install -y docker git || exit 1
rpm -q --quiet docker git || yum install -y docker git || echo "Warngin : Docker is not installed in this machine!"
}
mount_nfs()

View File

@ -117,6 +117,7 @@ class HotfixAPIView(GenericViewSet,
hotfix_name = request.data["hotfix_name"]
hotfix_name.replace(" ","-")
kernel_version = request.data['kernel_version']
patch_file_name = request.data['patch_file_name']
# check if this kernel_version is customize
try:
@ -130,8 +131,8 @@ class HotfixAPIView(GenericViewSet,
if re.search('an', release):
# this is a anolis kernel
os_type = "anolis"
patch_path = os.path.join(settings.HOTFIX_FILE_STORAGE_REPO, request.data['upload'].split("\\")[-1])
patch_file = request.data['upload'].split("\\")[-1]
patch_path = os.path.join(settings.HOTFIX_FILE_STORAGE_REPO, patch_file_name)
patch_file = patch_file_name
hotfix_necessary = 0
hotfix_risk = 2
try:
@ -151,8 +152,8 @@ class HotfixAPIView(GenericViewSet,
git_branch = self.function.get_info_from_version(kernel_version, "branch")
devel_link = self.function.get_info_from_version(kernel_version, "devel_link")
debuginfo_link = self.function.get_info_from_version(kernel_version, "debuginfo_link")
patch_path = os.path.join(settings.HOTFIX_FILE_STORAGE_REPO, request.data['upload'].split("\\")[-1])
patch_file = request.data['upload'].split("\\")[-1]
patch_path = os.path.join(settings.HOTFIX_FILE_STORAGE_REPO, patch_file_name)
patch_file = patch_file_name
hotfix_necessary = 0
hotfix_risk = 2
try:
@ -204,6 +205,7 @@ class HotfixAPIView(GenericViewSet,
)
if status:
hotfix_object.building_status = self.build_wait
hotfix_object.created_at = human_datetime()
hotfix_object.save()
return success(result="success", message="rebuild success")
else:

View File

@ -329,7 +329,7 @@ function do_kpatch_build(){
desc="hello world"
cmd="${kpatch_build_path} --skip-compiler-check -a ${kernel_version} -n "${kpatch_id}" -s "${tmpdir}"/"${kernel_version}"/"${kernel_version}" -c "${CONFIGFILE}" -o "${tmpdir}" "${tmpdir}"/"${kpatch_id}".patch " 2>&1 >> ${LOGFILE}
cmd="${kpatch_build_path} --skip-compiler-check -a ${kernel_version} -n "${kpatch_id}" -s "${tmpdir}"/"${kernel_version}"/"${kernel_version}" -c "${CONFIGFILE}" -o "${tmpdir}" -v "${VMLINUX}" "${tmpdir}"/"${kpatch_id}".patch " 2>&1 >> ${LOGFILE}
echo $cmd
if [[ -z "$USERMODBUILDDIR" ]]; then
if [ -z ${target} ]; then

View File

@ -1,58 +0,0 @@
########################################
# install packages
########################################
yum install nfs-utils rpcbind -y || exit 1
systemctl start rpcbind && systemctl enable rpcbind || exit 1
systemctl start nfs-server && systemctl enable nfs-server || exit 1
yum install -y make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves || exit 1
yum install -y docker git || exit 1
if [ "$APP_NAME" == "" ]
then
export APP_NAME="sysom"
fi
if [ "$APP_HOME" == "" ]
then
export APP_HOME=/usr/local/sysom/
export SERVER_HOME=/usr/local/sysom/server
export NODE_HOME=/usr/local/sysom/node
fi
if [ "$BUILDER_LOCAL_IP" == "" ]
then
local_ip=`ip -4 route | grep "link src" | awk -F"link src " '{print $2}' | awk '{print $1}' | head -n 1`
export BUILDER_LOCAL_IP=$local_ip
fi
if [ "$BUILDER_PUBLIC_IP" == "" ]
then
export BUILDER_PUBLIC_IP=$BUILDER_LOCAL_IP
fi
if [ "$SERVER_PORT" == "" ]
then
export SERVER_PORT=80
fi
###################################################################
# Mount the NFS from local directory to server
# NFS_SERVER_IP : The IP of NFS Server
# HOTFIX_NFS_HOME: The NFS directory of server
# LOCAL_HOTFIX_HOME : The local nfs direcotry of builder you choose to mount
###################################################################
NFS_SERVER_IP=127.0.0.1
HOTFIX_NFS_HOME=${SERVER_HOME}/hotfix_builder/hotfix-nfs
LOCAL_NFS_HOME=${SERVER_HOME}/builder/hotfix
export LOCAL_NFS_HOME
if [[ ! -d ${LOCAL_NFS_HOME} ]]; then
mkdir -p ${LOCAL_NFS_HOME}
fi
sudo umount $LOCAL_NFS_HOME
sudo mount -t nfs ${NFS_SERVER_IP}:${HOTFIX_NFS_HOME} ${LOCAL_NFS_HOME} || exit 1