diff --git a/bcmkernel/scripts/bcm_git.sh b/bcmkernel/scripts/bcm_git.sh index 3003d0d894c603bb067af70f694f281c3d140f2e..f6656fa608332bc4dbe9d18e9b18401525e045ed 100644 --- a/bcmkernel/scripts/bcm_git.sh +++ b/bcmkernel/scripts/bcm_git.sh @@ -359,7 +359,7 @@ done prerelease=0 # include prerelease ?? that is run add_all or add_release # parse short opts -while getopts "hr:R:t:" opt; do +while getopts "hr:R:t:p" opt; do case ${opt} in h ) usage diff --git a/bcmkernel/scripts/bcm_git_ignore.sh b/bcmkernel/scripts/bcm_git_ignore.sh new file mode 100644 index 0000000000000000000000000000000000000000..c5615d3d5f89b65509f2599e679ebde8cba430d6 --- /dev/null +++ b/bcmkernel/scripts/bcm_git_ignore.sh @@ -0,0 +1,104 @@ +#! /bin/bash + +usage () +{ + cat <<EOF +ex: + bcm_git_ignore.sh -c bcm_5.04L.02test4 -p "963158BGWV 963138BGWV 947622GW" -r bcmcreator_pre -i gitignore + +EOF +} +# Convert long opts to short opts +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" + 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 + ;; + esac +done +shift $((OPTIND -1)) + +if [ -z "$commit" ] +then + echo "Need some commit to checkout -c xxxxx " + exit 1 +fi + +if [ ! -f "$ignorefile" ] +then + echo "Need some top level ignore file -i xxxxx/.gitignore" + exit 1 +fi + +if [ -z "$profiles" ] +then + echo "Need some broadcom SDK PROFILES to compile -p \"963158BGWV 963138BGWV\"" + exit 1 +fi + +if [ ! -d "$repo_name" ] +then + echo "Need some repo to work in" + exit 1 +fi + + +new_gitignore=$(mktemp) +echo "# this is an autognerated gitignore. from bcm_git_ignore.sh script" >>$new_gitignore +echo "# Manually add files to ../.gitignore instead." >>$new_gitignore +echo "# or to ../Makefile" >>$new_gitignore + +for profile in $profiles +do + echo "Compiling target $profile" + + # checkout and make sure everything is clean. + git -C ${repo_name} reset --hard + git -C ${repo_name} clean -ffxd + 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 + ) + + 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" + + + +