diff --git a/bcmkernel/scripts/bcm_git.sh b/bcmkernel/scripts/bcm_git.sh index 3d6d507a0ebffbf6020d1f9a569313e8a424566f..66a84d1f8482bb8dd003756701b6a8f465186723 100755 --- a/bcmkernel/scripts/bcm_git.sh +++ b/bcmkernel/scripts/bcm_git.sh @@ -76,6 +76,21 @@ git_new_branch() } +is_module_already_added_to_repo() +{ + local repo="$1" + local module="$2" + local version="$3" + + case "$module" in + "data_full_release") + git -C "$repo" tag | grep "bcm_${version}_t$" > /dev/null || return $? + ;; + *) + git -C "$repo" branch -a | grep "bcm_${version}_${module}$" > /dev/null || return $? + esac +} + add_release () { local version=$1 @@ -92,19 +107,18 @@ add_release () for module in $bcm_modules do tar="bcm963xx_${version}_${module}.tar.gz" + if is_module_already_added_to_repo "$repo" "$module" "$version" + then + echo "Already added ${version} "$module" (corresponding branch/tag exists already). Skipping!" + continue + fi + if [ -f ${tar_dir}/${tar} ] then case ${module} in "data_full_release") echo -e "\t${tar} this is the base module" - # sanity check if tag exist skip - if git -C ${repo} tag | grep "bcm_${version}_t$" - then - echo "Already added bcm_${version}_t. skipping!" - return - fi - # prep repo. clean out all old files git -C ${repo} checkout broadcom git -C ${repo} rm -rq . @@ -134,13 +148,6 @@ add_release () ;; "voice_addon"|"voice_eptapp_addon") ( cd_repo $repo - - # sanity check if branch exist skip - if git branch -a | grep "bcm_${version}_${module}$" - then - echo "Already added branch bcm_${version}_${module}. skipping!" - return - fi git_new_branch ${version} ${module} mkdir git_tmp @@ -160,14 +167,6 @@ add_release () ;; "data_gfast_src") ( cd_repo $repo - - # sanity check if branch exist skip - if git branch -a | grep "bcm_${version}_${module}$" - then - echo "Already added branch bcm_${version}_${module}. skipping!" - return - fi - git_new_branch ${version} ${module} mkdir git_tmp @@ -184,14 +183,6 @@ add_release () ;; "xpon_src") ( cd_repo $repo - - # sanity check if branch exist skip - if git branch -a | grep "bcm_${version}_${module}$" - then - echo "Already added branch bcm_${version}_${module}. skipping!" - return - fi - git_new_branch ${version} ${module} mkdir git_tmp @@ -213,14 +204,6 @@ add_release () ;; "bdkuserspace_src"|"openwrtsupport_src") ( cd_repo $repo - - # sanity check if branch exist skip - if git branch -a | grep "bcm_${version}_${module}$" - then - echo "Already added branch bcm_${version}_${module}. skipping!" - return - fi - git_new_branch ${version} ${module} mkdir git_tmp