diff --git a/script/autopatch.sh b/script/autopatch.sh index 73a7d0fd06b11a7b2050c018f4e87a16b547091a..23c0ab69b89d3e4e830325111aa3628bd76846f3 100755 --- a/script/autopatch.sh +++ b/script/autopatch.sh @@ -98,37 +98,40 @@ do echo "$branches" | grep -q "^$tbranch$" || continue echo "$open_pulls" | grep " $tbranch$" && continue || true fetch_git "$repo" - - #From openeuler "openEuler-20.03-LTS-Next" branch to src-openeuler "openEuler-20.03-LTS-Next and openEuler-20.03-LTS-SP1" branch + + #From openeuler "openEuler-20.03-LTS-Next" branch to src-openeuler "openEuler-20.03-LTS-Next and openEuler-20.03-LTS-SP2" branch #openEuler repo -> src-openEuler #openEuler-20.03-LTS-SP1 -> openEuler-20.03-LTS-SP1 #openEuler-20.03-LTS-Next -> openEuler-20.03-LTS-Next/openEuler-20.03-LTS-SP2 - #qemu-4.1.0 -> master/openEuler-21.03 - - if [ "$tbranch" == "master" ];then - more_tbranchs="$tbranch openEuler-21.03" + #qemu-4.1.0 -> master + #openEuler-21.03 -> openEuler-21.03 + + if [ "$tbranch" == "openEuler-20.03-LTS-Next" ];then + more_tbranchs="$tbranch openEuler-20.03-LTS-SP2" else more_tbranchs=$tbranch fi - - + + for tbranch in $more_tbranchs #only for openEuler-20.03-LTS-SP1 branch do cd "../src-$repo" git checkout -f "$tbranch" || git checkout -b "$tbranch" - + echo "$tbranches " | grep " $tbranch " || git reset --hard "upstream/$tbranch" git log | grep -w "spec: Update patch and changelog with !$prid" && continue || true echo "$tbranches " | grep " $tbranch " || tbranches="$tbranches $tbranch" cd "../$repo" - if [ "$tbranch" == "master" ] || [ "$tbranch" == "openEuler-21.03" ];then + if [ "$tbranch" == "master" ];then tbranch="qemu-4.1.0" + elif [ "$tbranch" == "openEuler-20.03-LTS-SP2" ];then + tbranch="openEuler-20.03-LTS-Next" fi - + git checkout $tbranch pr_message=$(git log --author openeuler-ci-bot --format=%s | awk -F 'From' '{print $1}'| grep "\!$prid") - + git checkout -f "pull/$prid/head" git reset --hard "pull/$prid/head" @@ -143,7 +146,7 @@ do mv "../$repo/$patch_file" "${patch_file#0001-}" patch_file=${patch_file#0001-} git add "$patch_file" - + author_name="Chen Qun" author_email="kuhn.chenqun@huawei.com" author_date=$(cd "../$repo" && git show -s --format=%ad "$hash") @@ -153,7 +156,7 @@ do ((patch_id++)) sed -i "$patch_line a Patch$(printf "%04d" $patch_id): ${patch_file#0001-}" "$repo.spec" ((patch_line++)) - + [ $patch_line -le $changelog ] && ((changelog++)) || true sed -i "$changelog a - $subject" "$repo.spec" ((changelog++)) @@ -184,4 +187,4 @@ do git push --force origin "$tbranch" pull_body=$(git show -s --format=%s "upstream/$tbranch..HEAD" | sed "/spec: Update patch and changelog with ![0-9]\+/{x;p;x;}") create_pull src-openeuler "$repo" "$tbranch" "$tbranch" "Automatically generate code patches with openeuler $prids" "
$pull_body" -done \ No newline at end of file +done