From 8d3d2be4e27e25ba64ae76042b15371bc1846f57 Mon Sep 17 00:00:00 2001 From: xuyongliang_01 Date: Thu, 31 Aug 2023 06:25:16 +0000 Subject: [PATCH] =?UTF-8?q?update=20cve-agency-manager/cve=5Ftracking/core?= =?UTF-8?q?/verification/packing.sh.=20=E5=BE=88=E5=A4=9Aspec=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E4=BC=9A=E5=90=AB=E6=9C=89%autosetup?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E5=8F=AF=E8=87=AA=E5=8A=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?%patch=EF=BC=8C=E9=9C=80=E5=85=88=E8=BF=9B=E8=A1=8C=E4=B8=80?= =?UTF-8?q?=E6=AC=A1%autosetup=E7=9A=84=E6=9F=A5=E6=89=BE=EF=BC=8C?= =?UTF-8?q?=E5=90=A6=E5=88=99=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8D=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BC=9A=E5=AF=BC=E8=87=B4=E7=BC=96=E8=AF=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyongliang_01 --- .../cve_tracking/core/verification/packing.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cve-agency-manager/cve_tracking/core/verification/packing.sh b/cve-agency-manager/cve_tracking/core/verification/packing.sh index 9c0ad16..1b95912 100755 --- a/cve-agency-manager/cve_tracking/core/verification/packing.sh +++ b/cve-agency-manager/cve_tracking/core/verification/packing.sh @@ -113,13 +113,16 @@ function update_spec() { sed -i "${last_patch_row}a Patch${new_patch_num}: ${path_file_name}" ${spec_file} fi # add %patch - last_patch_apply=$(grep "%patch.* " ${spec_file} | sed -n '$p') - if [[ -n ${last_patch_apply} ]]; then - last_patch_apply_row=$(grep -n "${last_patch_apply}" ${spec_file} | awk -F ':' '{print $1}') - last_patch_apply_num=$(echo ${last_patch_apply} | awk -F ' ' '{print $1}' | awk -F 'patch' '{print $2}') - ignore_level_num=$(echo ${last_patch_apply} | awk -F ' ' '{print $2}') - new_patch_apply_num=$(expr ${last_patch_apply_num} + 1) - sed -i "${last_patch_apply_row}a %patch${new_patch_apply_num} ${ignore_level_num} " ${spec_file} + is_autosetup_exist=$(grep "%autosetup" ${spec_file} | sed -n '$p') + if [[ -z ${is_autosetup_exist} ]]; then + last_patch_apply=$(grep "%patch.* " ${spec_file} | sed -n '$p') + if [[ -n ${last_patch_apply} ]]; then + last_patch_apply_row=$(grep -n "${last_patch_apply}" ${spec_file} | awk -F ':' '{print $1}') + last_patch_apply_num=$(echo ${last_patch_apply} | awk -F ' ' '{print $1}' | awk -F 'patch' '{print $2}') + ignore_level_num=$(echo ${last_patch_apply} | awk -F ' ' '{print $2}') + new_patch_apply_num=$(expr ${last_patch_apply_num} + 1) + sed -i "${last_patch_apply_row}a %patch${new_patch_apply_num} ${ignore_level_num} " ${spec_file} + fi fi # add changelog change_log_row=$(grep -n '%changelog' ${spec_file} | sed -n '$p' | awk -F ':' '{print $1}') -- Gitee