Skip to content
Snippets Groups Projects
Commit 9d8c042d authored by Arne Jonsson's avatar Arne Jonsson
Browse files

bcmkernel:bcm_git_ignore:For defined profiles, gather non-indexed filenames to be ignored

parent 047da119
No related branches found
No related tags found
1 merge request!34brcm63xx:bcm963xx:gitignore
...@@ -3,43 +3,55 @@ ...@@ -3,43 +3,55 @@
usage () usage ()
{ {
cat <<EOF cat <<EOF
ex: NAME
bcm_git_ignore.sh -c bcm_5.04L.02test4 -p "963158BGWV 963138BGWV 947622GW" -r bcmcreator_pre -i gitignore bcm_git_ignore - creates a .gitignore in the directory bcm963xx
SYNOPSIS
bcm_git_ignore [OPTION]...
DESCRIPTION
Run this script to create a single bcm963xx/.gitignore for all the listed profiles.
ex:
./bcm_git_ignore.sh -c iopsys_5.04L.04 -p "96846GOV96856GWO_WL21D2GA 96858GWO_WL21D2GA 96888GWO_WL21D2GA" -r /home/user/bcm963xx-bsp
-c, --commitref
branch-name, tag-name, commit-hash, ...
-h, --help
display help theme, exit
-p, ---profiles
profiles used to generate .gitignore for
-r, --repo
path to the git repository to use
EOF EOF
} }
# Convert long opts to short opts # Convert long opts to short opts
for arg in "$@"; do for arg in "$@"; do
shift shift
case "$arg" in case "$arg" in
"--help") set -- "$@" "-h" ;; "--commit") set -- "$@" "-c" ;;
"--repo") set -- "$@" "-r" ;; "--help") set -- "$@" "-h" ;;
"--commit") set -- "$@" "-c" ;; "--profiles") set -- "$@" "-p" ;;
"--profiles") set -- "$@" "-p" ;; "--repo") set -- "$@" "-r" ;;
"--ignorefile") set -- "$@" "-i" ;; *) set -- "$@" "$arg"
*) set -- "$@" "$arg"
esac esac
done done
# parse short opts # parse short opts
while getopts "hc:r:p:i:" opt; do while getopts "hc:p:r:" opt; do
case ${opt} in case ${opt} in
c )
commit=$OPTARG
;;
h ) h )
usage usage
exit 0 exit 0
;; ;;
c )
commit=$OPTARG
;;
p ) p )
profiles=$OPTARG profiles=$OPTARG
;; ;;
r ) r )
repo_name=$OPTARG repo_name=$OPTARG
;; ;;
i )
ignorefile=$OPTARG
;;
esac esac
done done
shift $((OPTIND -1)) shift $((OPTIND -1))
...@@ -50,51 +62,46 @@ then ...@@ -50,51 +62,46 @@ then
exit 1 exit 1
fi fi
if [ ! -f "$ignorefile" ]
then
echo "Need some top level ignore file -i xxxxx/.gitignore"
exit 1
fi
if [ -z "$profiles" ] if [ -z "$profiles" ]
then then
echo "Need some broadcom SDK PROFILES to compile -p \"963158BGWV 963138BGWV\"" echo "Need some broadcom SDK PROFILES to compile -p \"96858GWO_WL21D2GA 96888GWO_WL21D2GA\""
exit 1 exit 1
fi fi
if [ ! -d "$repo_name" ] if [ -z "$repo_name" ]
then then
echo "Need some repo to work in" echo "The directory for the git repository needs to be specified. ex -r /home/user/bcm963xx-bsp"
exit 1 exit 1
fi fi
new_gitignore=$(mktemp) new_gitignore=$(mktemp)
echo "# this is an autognerated gitignore. from bcm_git_ignore.sh script" >>$new_gitignore cat << EOF > $new_gitignore
echo "# Manually add files to ../.gitignore instead." >>$new_gitignore # Files below are autogenerated using bcm_git_ignore.sh script.
echo "# or to ../Makefile" >>$new_gitignore # Profile(s) used: $profiles
EOF
for profile in $profiles for profile in $profiles
do do
echo "Compiling target $profile" echo "Compiling target $profile"
# checkout and make sure everything is clean. # checkout and make sure everything is clean.
git -C ${repo_name} reset --hard git -C "$repo_name" reset --hard -q
git -C ${repo_name} clean -ffxd git -C "$repo_name" clean -ffxd
git -C ${repo_name} checkout $commit git -C "$repo_name" checkout -q $commit
git -C ${repo_name} reset --hard git -C "$repo_name" reset --hard -q
git -C ${repo_name} clean -ffxd git -C "$repo_name" clean -ffxd
( (
cd $repo_name/bcm963xx cd $repo_name/bcm963xx
make PROFILE=$profile make PROFILE=$profile
) )
cp $ignorefile ${repo_name}/.gitignore rm -f $repo_name/bcm963xx/.gitignore
git -C ${repo_name}/bcm963xx status -s | cut -c4- >>$new_gitignore git -C "$repo_name"/bcm963xx ls-files --others --exclude-standard --directory --no-empty-directory >>$new_gitignore
done done
sort $new_gitignore | uniq > ${repo_name}/bcm963xx/.gitignore sort $new_gitignore | uniq > $repo_name/bcm963xx/.gitignore
rm $new_gitignore rm $new_gitignore
echo "done! new git ignore in ${repo_name}/bcm963xx/.gitignore" echo "done! new .gitignore in $repo_name/bcm963xx/.gitignore"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment