diff --git a/bcmkernel/scripts/bcm_git.sh b/bcmkernel/scripts/bcm_git.sh index f6656fa608332bc4dbe9d18e9b18401525e045ed..b5cbe27e694e4a3df11f2298c51cbcad27c0ac84 100644 --- a/bcmkernel/scripts/bcm_git.sh +++ b/bcmkernel/scripts/bcm_git.sh @@ -24,34 +24,34 @@ cd_repo() local repo=$1 if ! cd ${repo} 2>/dev/null then - echo "repo [${repo}] does not exist. aborting!" - exit 1 + echo "repo [${repo}] does not exist. aborting!" + exit 1 fi } -# +# create_new_repo () { local repo=$1 - + echo "-------------------------------------------------------------------------------" echo "creating new repo [$repo]!" if [ -e $repo ] then - echo "repo already exising. aborting!!" - exit 1 + echo "repo already exising. aborting!!" + exit 1 fi - mkdir -p $repo + mkdir -p $repo ( - cd_repo $repo - git init - echo "Master branch not used" > readme.md - git add readme.md - git commit -m "created repo" - git branch broadcom + cd_repo $repo + git init + echo "Master branch not used" > readme.md + git add readme.md + git commit -m "created repo" + git branch broadcom ) echo "-------------------------------------------------------------------------------" } @@ -85,229 +85,227 @@ add_release () # to add a release the full src needs to exist if [ ! -f bcm963xx_${version}_data_full_release.tar.gz ] then - echo "Release bcm963xx_${version}_data_full_release.tar.gz does not exist skipping ${version}" - return + echo "Release bcm963xx_${version}_data_full_release.tar.gz does not exist skipping ${version}" + return fi - + for module in $bcm_modules do - tar="bcm963xx_${version}_${module}.tar.gz" - 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 . - - # unpack new release - mkdir ${repo}/git_tmp - echo "unpack $tar" - tar_md5=$(cat ${tar_dir}/${tar} | md5sum) - tar_name=$(basename $tar) - pv ${tar_dir}/${tar} | tar -xz -C ${repo}/git_tmp - - tar_src=$( basename $tar | sed -e "s/${module}/data_src/") - echo "unpack $tar_src" - mkdir ${repo}/bcm963xx - # exclude any included git repo - pv ${repo}/git_tmp/${tar_src} | tar -xz --exclude=\.git -C ${repo}/bcm963xx - rm -rf ${repo}/git_tmp - - # add files to git - echo "Now adding files to git. this takes some time" - git -C ${repo} add -A -f - git -C ${repo} commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -q -m "New release from broadcom added. $version" \ - -m "file used is ${tar_md5} ${tar_name}" - git -C ${repo} tag bcm_${version}_t - do_merge=1 - ;; - "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 - tar_md5=$(cat ${tar_dir}/${tar} | md5sum) - tar_name=$(basename $tar) - pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp - cd git_tmp - # if you think that you can do "yes | ./bcmvoiceinstall ../" you are wrong. does not work. - echo "yy" | ./bcmvoiceinstall ../bcm963xx - cd .. - rm -rf git_tmp - git add -A -f - git commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -q -m "Add ${module} to release ${version}" \ - -m "file used is ${tar_md5} ${tar_name}" - ) - ;; - "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 - tar_md5=$(cat ${tar_dir}/${tar} | md5sum) - tar_name=$(basename $tar) - pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp - tar -xf git_tmp/*tar.gz -C bcm963xx - rm -rf git_tmp - git add -A -f - git commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -q -m "Add ${module} to release ${version}" \ - -m "file used is ${tar_md5} ${tar_name}" - ) - ;; - "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 - tar_md5=$(cat ${tar_dir}/${tar} | md5sum) - tar_name=$(basename $tar) - pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp - - rm -rf bcm963xx/userspace/private/apps/omcid/* - rm -rf bcm963xx/bcmdrivers/broadcom/char/gpon/* - rm -rf bcm963xx/userspace/private/libs/eponsdk - - tar -xf git_tmp/*tar.gz -C bcm963xx - rm -rf git_tmp - git add -A -f - git commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -q -m "Add ${module} to release ${version}" \ - -m "file used is ${tar_md5} ${tar_name}" - - ) - ;; - "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 - tar_md5=$(cat ${tar_dir}/${tar} | md5sum) - tar_name=$(basename $tar) - pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp - - for tar in git_tmp/*tar.gz - do - tar --overwrite -xf $tar -C bcm963xx - done - rm -rf git_tmp - git add -A -f - git commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -q -m "Add ${module} to release ${version}" \ - -m "file used is ${tar_md5} ${tar_name}" - ) - ;; - - *) - echo -e "\t${tar}" - ;; - esac - else - echo -e "\ttar not found. skipping $tar" - fi + tar="bcm963xx_${version}_${module}.tar.gz" + 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 . + + # unpack new release + mkdir ${repo}/git_tmp + echo "unpack $tar" + tar_md5=$(cat ${tar_dir}/${tar} | md5sum) + tar_name=$(basename $tar) + pv ${tar_dir}/${tar} | tar -xz -C ${repo}/git_tmp + + tar_src=$( basename $tar | sed -e "s/${module}/data_src/") + echo "unpack $tar_src" + mkdir ${repo}/bcm963xx + # exclude any included git repo + pv ${repo}/git_tmp/${tar_src} | tar -xz --exclude=\.git -C ${repo}/bcm963xx + rm -rf ${repo}/git_tmp + + # add files to git + echo "Now adding files to git. this takes some time" + git -C ${repo} add -A -f + git -C ${repo} commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -q -m "New release from broadcom added. $version" \ + -m "file used is ${tar_md5} ${tar_name}" + git -C ${repo} tag bcm_${version}_t + do_merge=1 + ;; + "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 + tar_md5=$(cat ${tar_dir}/${tar} | md5sum) + tar_name=$(basename $tar) + pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp + cd git_tmp + # if you think that you can do "yes | ./bcmvoiceinstall ../" you are wrong. does not work. + echo "yy" | ./bcmvoiceinstall ../bcm963xx + cd .. + rm -rf git_tmp + git add -A -f + git commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -q -m "Add ${module} to release ${version}" \ + -m "file used is ${tar_md5} ${tar_name}" + ) + ;; + "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 + tar_md5=$(cat ${tar_dir}/${tar} | md5sum) + tar_name=$(basename $tar) + pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp + tar -xf git_tmp/*tar.gz -C bcm963xx + rm -rf git_tmp + git add -A -f + git commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -q -m "Add ${module} to release ${version}" \ + -m "file used is ${tar_md5} ${tar_name}" + ) + ;; + "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 + tar_md5=$(cat ${tar_dir}/${tar} | md5sum) + tar_name=$(basename $tar) + pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp + + rm -rf bcm963xx/userspace/private/apps/omcid/* + rm -rf bcm963xx/bcmdrivers/broadcom/char/gpon/* + rm -rf bcm963xx/userspace/private/libs/eponsdk + + tar -xf git_tmp/*tar.gz -C bcm963xx + rm -rf git_tmp + git add -A -f + git commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -q -m "Add ${module} to release ${version}" \ + -m "file used is ${tar_md5} ${tar_name}" + ) + ;; + "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 + tar_md5=$(cat ${tar_dir}/${tar} | md5sum) + tar_name=$(basename $tar) + pv ${tar_dir}/${tar} | tar -xz --exclude=\.git -C git_tmp + + for tar in git_tmp/*tar.gz + do + tar --overwrite -xf $tar -C bcm963xx + done + rm -rf git_tmp + git add -A -f + git commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -q -m "Add ${module} to release ${version}" \ + -m "file used is ${tar_md5} ${tar_name}" + ) + ;; + + *) + echo -e "\t${tar}" + ;; + esac + else + echo -e "\ttar not found. skipping $tar" + fi done # all modules added make the main branch and do the octopus merge. # but only if the tag exist. - # BUG: so octopus do not work since broadcom adds the same binary file in mutiple addon modules. :( + # BUG: so octopus do not work since broadcom adds the same binary file in mutiple addon modules. :( if [ "$do_merge" == "1" ] then - if git -C ${repo} tag | grep "bcm_${version}_t$" - then - git -C ${repo} reset --hard - git -C ${repo} clean -ffxd - git -C ${repo} checkout bcm_${version}_t - git -C ${repo} branch bcm_${version} - git -C ${repo} checkout bcm_${version} - git -C ${repo} reset --hard - git -C ${repo} clean -ffxd - branch_list="" - for module in $bcm_modules - do - case ${module} in - "data_full_release") - true - ;; - *) - echo "trying to merge ${module} from branch ${version}_${module}" - if git -C ${repo} branch | grep "bcm_${version}_${module}$" - then - if ! git -C ${repo} merge --no-commit --no-ff -Xtheirs bcm_${version}_${module} - then - # so this merge did not work. clean up and skip it. - git -C ${repo} merge --abort - git -C ${repo} reset --hard - git -C ${repo} clean -ffxd - return - fi - git -C ${repo} commit --author="broadcom release<broadcom_release@broadcom.com>" \ - -m "Merge in bcm_${version}_${module}" - fi - ;; - esac - done - fi + if git -C ${repo} tag | grep "bcm_${version}_t$" + then + git -C ${repo} reset --hard + git -C ${repo} clean -ffxd + git -C ${repo} checkout bcm_${version}_t + git -C ${repo} branch bcm_${version} + git -C ${repo} checkout bcm_${version} + git -C ${repo} reset --hard + git -C ${repo} clean -ffxd + branch_list="" + for module in $bcm_modules + do + case ${module} in + "data_full_release") + true + ;; + *) + echo "trying to merge ${module} from branch ${version}_${module}" + if git -C ${repo} branch | grep "bcm_${version}_${module}$" + then + if ! git -C ${repo} merge --no-commit --no-ff -Xtheirs bcm_${version}_${module} + then + # so this merge did not work. clean up and skip it. + git -C ${repo} merge --abort + git -C ${repo} reset --hard + git -C ${repo} clean -ffxd + return + fi + git -C ${repo} commit --author="broadcom release<broadcom_release@broadcom.com>" \ + -m "Merge in bcm_${version}_${module}" + fi + ;; + esac + done + fi fi } add_all() { local bcm_base_versions=$@ - + for base_version in $bcm_base_versions do - # pre release - for pre_version in $bcm_pre_versions - do - echo "Adding release ${base_version}${pre_version}" - add_release ${base_version}${pre_version} $repo_name - done - # real release - echo "Adding release ${base_version}" - add_release $base_version $repo_name - + # pre release + for pre_version in $bcm_pre_versions + do + echo "Adding release ${base_version}${pre_version}" + add_release ${base_version}${pre_version} $repo_name + done + # real release + echo "Adding release ${base_version}" + add_release $base_version $repo_name done } @@ -322,7 +320,7 @@ SYNOIPSIS DESCRIPTION Will add a Broadcom release to a git repository. If the repository is empty is - + -r, --repo path to the git repository to use. If it do not exist it will be created. @@ -333,11 +331,11 @@ DESCRIPTION -t,--tars directory where the Broadcom SDK tar files is located. - - -v, --verbose + + -v, --verbose bla bla - -h, ---help + -h, ---help display help thene exit. EOF @@ -347,12 +345,12 @@ EOF for arg in "$@"; do shift case "$arg" in - "--help") set -- "$@" "-h" ;; - "--revision") set -- "$@" "-R" ;; - "--repo") set -- "$@" "-r" ;; - "--tars") set -- "$@" "-t" ;; - "--prerelease") set -- "$@" "-p" ;; - *) set -- "$@" "$arg" + "--help") set -- "$@" "-h" ;; + "--revision") set -- "$@" "-R" ;; + "--repo") set -- "$@" "-r" ;; + "--tars") set -- "$@" "-t" ;; + "--prerelease") set -- "$@" "-p" ;; + *) set -- "$@" "$arg" esac done @@ -361,36 +359,36 @@ prerelease=0 # include prerelease ?? that is run add_all or add_release # parse short opts while getopts "hr:R:t:p" opt; do case ${opt} in - h ) - usage - exit 0 - ;; - R ) - bcm_version=$OPTARG - ;; - t ) - # path to tar files needs to be absolute from / since the script is doing - # cd into the git repo and the tar files needs to be accessed after that cd is done. - if [ -d $(pwd)/$OPTARG ] - then - tar_dir=$(pwd)/$OPTARG - else - if [ -d$OPTARG ] - then - tar_dir=$OPTARG - else - echo "directory for tar files do not exist [$OPTARG]" - exit 1 - fi - fi - ;; - r ) - repo_name=$OPTARG - ;; - p ) - prerelease=1 - ;; - + h ) + usage + exit 0 + ;; + R ) + bcm_version=$OPTARG + ;; + t ) + # path to tar files needs to be absolute from / since the script is doing + # cd into the git repo and the tar files needs to be accessed after that cd is done. + if [ -d $(pwd)/$OPTARG ] + then + tar_dir=$(pwd)/$OPTARG + else + if [ -d$OPTARG ] + then + tar_dir=$OPTARG + else + echo "directory for tar files do not exist [$OPTARG]" + exit 1 + fi + fi + ;; + r ) + repo_name=$OPTARG + ;; + p ) + prerelease=1 + ;; + esac done shift $((OPTIND -1)) @@ -433,5 +431,3 @@ fi #add_all "5.04L.01 5.04L.02" #add_release 5.04L.01 $repo_name #add_release 5.04L.02 $repo_name - - diff --git a/bcmkernel/scripts/bcm_git_ignore.sh b/bcmkernel/scripts/bcm_git_ignore.sh index c5615d3d5f89b65509f2599e679ebde8cba430d6..964c21927f79d9eade82792dfe1f6085903cf4fa 100644 --- a/bcmkernel/scripts/bcm_git_ignore.sh +++ b/bcmkernel/scripts/bcm_git_ignore.sh @@ -12,34 +12,34 @@ EOF for arg in "$@"; do shift case "$arg" in - "--help") set -- "$@" "-h" ;; - "--repo") set -- "$@" "-r" ;; - "--commit") set -- "$@" "-c" ;; - "--profiles") set -- "$@" "-p" ;; - "--ignorefile") set -- "$@" "-i" ;; - *) set -- "$@" "$arg" + "--help") set -- "$@" "-h" ;; + "--repo") set -- "$@" "-r" ;; + "--commit") set -- "$@" "-c" ;; + "--profiles") set -- "$@" "-p" ;; + "--ignorefile") set -- "$@" "-i" ;; + *) set -- "$@" "$arg" esac done # parse short opts while getopts "hc:r:p:i:" opt; do case ${opt} in - h ) - usage - exit 0 - ;; - c ) - commit=$OPTARG - ;; - p ) - profiles=$OPTARG - ;; - r ) - repo_name=$OPTARG - ;; - i ) - ignorefile=$OPTARG - ;; + h ) + usage + exit 0 + ;; + c ) + commit=$OPTARG + ;; + p ) + profiles=$OPTARG + ;; + r ) + repo_name=$OPTARG + ;; + i ) + ignorefile=$OPTARG + ;; esac done shift $((OPTIND -1)) @@ -84,21 +84,17 @@ do git -C ${repo_name} checkout $commit git -C ${repo_name} reset --hard git -C ${repo_name} clean -ffxd - + ( - cd $repo_name/bcm963xx - make PROFILE=$profile + cd $repo_name/bcm963xx + make PROFILE=$profile ) cp $ignorefile ${repo_name}/.gitignore git -C ${repo_name}/bcm963xx status -s | cut -c4- >>$new_gitignore - + done sort $new_gitignore | uniq > ${repo_name}/bcm963xx/.gitignore rm $new_gitignore echo "done! new git ignore in ${repo_name}/bcm963xx/.gitignore" - - - -