Skip to content

Commit b6b2873

Browse files
committed
script: do not use dos2unix to change shell file type
* the shell script can't exit with 0 if there is no error * or the Jenkins job will stop Signed-off-by: Jingru Wang <jingru@synopsys.com>
1 parent 28e6c0e commit b6b2873

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

apply_embARC_patch.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/usr/bin/env bash
2+
dir="${BASH_SOURCE[0]}"
3+
4+
if uname | grep -q "MINGW"; then
5+
win_build=1
6+
pwd_opt="-W"
7+
else
8+
win_build=0
9+
pwd_opt=""
10+
fi
11+
12+
# identify OS source tree root directory
13+
export embARC_OSP_BASE=$( builtin cd "$( dirname "$dir" )" > /dev/null && pwd ${pwd_opt})
14+
unset pwd_opt
215

316
patches_required_folders="library,middleware,os"
417

@@ -7,11 +20,6 @@ patches_required_folder_list=(${patches_required_folders//,/ })
720
PREV_DIR=$(pwd)
821
SCRIPT_DIR=$(dirname $0)
922

10-
if which dos2unix >/dev/null 2>&1; then :; else
11-
echo "You need dos2unix in your path" >&2
12-
exit 1
13-
fi
14-
1523
cd ${SCRIPT_DIR}
1624

1725
echo "Start to download required source code and apply patches for embARC"
@@ -20,17 +28,11 @@ echo ""
2028
exit_ok=0
2129
for patch_folder in ${patches_required_folder_list[@]}
2230
do
23-
patch_scripts=$(find $patch_folder -maxdepth 2 -name "apply_embARC_patch.sh")
31+
patch_scripts=$(find ${embARC_OSP_BASE}/${patch_folder} -maxdepth 2 -name "apply_embARC_patch.sh")
2432
for script in ${patch_scripts[@]}
2533
do
2634
patch_dir=$(dirname ${script})
2735
echo "+++++Try to patch ${patch_dir}+++++"
28-
echo "Run script: chmod +x ${script} && ${script}"
29-
filetype=$(file ${script} | grep -q CRLF && echo DOS || echo UNIX)
30-
if [[ ${filetype} == DOS ]] ; then
31-
echo "Convert ${script} from DOS to UNIX"
32-
dos2unix ${script}
33-
fi
3436
chmod +x ${script} && ${script}
3537
if [[ $? -eq 0 ]] ; then
3638
echo "-----Patch ${patch_dir} successfully-----"
@@ -46,7 +48,7 @@ if [[ ${exit_ok} -eq 0 ]] ; then
4648
echo "Apply patches for embARC successfully"
4749
else
4850
echo "Apply patches for embARC failed"
51+
exit ${exit_ok}
4952
fi
5053
echo "Patch job ended"
5154
cd ${PREV_DIR}
52-
exit ${exit_ok}

0 commit comments

Comments
 (0)