Add progress info printouts to list_eol_stale_branches.sh
As the script runs it takes time to process every branches. This patch changes the script to show the current repository being processed. Also fixes variable name. Change-Id: Ifde9aa5bec30e18a12a9c5107888943a4af3e271
This commit is contained in:
parent
785ba8f9c6
commit
1502a9d517
@ -64,52 +64,54 @@ setup_temp_space 'list-eol-stale-branches'
|
||||
branch=$(series_to_branch "$series")
|
||||
|
||||
function no_open_patches {
|
||||
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${em_serie}"
|
||||
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${em_branch}"
|
||||
patches=$(curl -s ${req} | sed 1d | jq --raw-output '.[] | .change_id')
|
||||
[ -z "${patches}" ]
|
||||
no_opens=$?
|
||||
if [[ "$no_opens" -eq 1 ]]; then
|
||||
echo "Patches remained open on stale branch (make sure to abandon them):"
|
||||
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${em_serie}"
|
||||
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${em_branch}"
|
||||
fi
|
||||
return $no_opens
|
||||
}
|
||||
|
||||
function eol_tag_matches_head {
|
||||
head=$(git log --oneline --decorate -1)
|
||||
[[ "$head" =~ "${em_serie}-eol" ]] && [[ "$head" =~ "origin/stable/${em_serie}" ]]
|
||||
[[ "$head" =~ "${em_branch}-eol" ]] && [[ "$head" =~ "origin/stable/${em_branch}" ]]
|
||||
matches=$?
|
||||
if [[ "$matches" -eq 1 ]] ; then
|
||||
echo "stable/${em_serie} has patches on top of the ${em_serie}-eol tag"
|
||||
echo "stable/${em_branch} has patches on top of the ${em_branch}-eol tag"
|
||||
fi
|
||||
return $matches
|
||||
}
|
||||
|
||||
function is_eol {
|
||||
clone_repo ${repo} stable/${em_serie}
|
||||
cd ${repo} && git checkout -f -q stable/${em_serie} 2>/dev/null
|
||||
clone_repo ${repo} stable/${em_branch}
|
||||
cd ${repo} && git checkout -f -q stable/${em_branch} 2>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "${repo} contains eol stale branch (${em_serie})"
|
||||
echo
|
||||
echo "${repo} contains eol stale branch (${em_branch})"
|
||||
if no_open_patches && eol_tag_matches_head; then
|
||||
read -p "> Do you want to delete the branch stable/${em_serie} from ${repo} repository? [y/N]: " YN
|
||||
read -p "> Do you want to delete the branch stable/${em_branch} from ${repo} repository? [y/N]: " YN
|
||||
if [ "${YN,,}" == "y" ]; then
|
||||
if [ -z "$gerrit_username" ]; then
|
||||
read -p "Gerrit username: " gerrit_username
|
||||
fi
|
||||
${TOOLSDIR}/delete_stable_branch.py ${gerrit_username} ${repo} ${em_serie}
|
||||
${TOOLSDIR}/delete_stable_branch.py ${gerrit_username} ${repo} ${em_branch}
|
||||
fi
|
||||
fi
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
for em_serie in "${em_series[@]}"; do
|
||||
repos=$(list-deliverables -r --series "${em_serie}" --is-eol)
|
||||
for em_branch in "${em_series[@]}"; do
|
||||
repos=$(list-deliverables -r --series "${em_branch}" --is-eol)
|
||||
|
||||
# Show the eol stale branches for each repository.
|
||||
for repo in ${repos}; do
|
||||
cd ${MYTMPDIR}
|
||||
echo
|
||||
is_eol "${repo}" "${em_serie}"
|
||||
echo " --- $repo ($em_branch) --- "
|
||||
is_eol "${repo}" "${em_branch}"
|
||||
done
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user