Skip to content

Commit 8b7489e

Browse files
committedMay 21, 2019
update Travis to build on Trusty for code layout (#10048)
* update Travis to build on Trusty for code layout * fix shellcheck replace ! -z by -n * shellcheck: fix -n doesn't work with unquoted arguments * more shellcheck fixes * use bash instead of posix
1 parent 1f0fbd1 commit 8b7489e

File tree

12 files changed

+35
-30
lines changed

12 files changed

+35
-30
lines changed
 

‎.docker/qgis_resources/test_runner/qgis_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ printf "[qgis]\n" >> $CONF_MASTER_FILE
3838
SHOW_TIPS=$(qgis --help 2>&1 | head -2 | grep 'QGIS - ' | perl -npe 'chomp; s/QGIS - (\d+)\.(\d+).*/showTips\1\2=false/')
3939
printf "%s\n\n" "$SHOW_TIPS" >> $CONF_MASTER_FILE
4040

41-
if [ -n "$PLUGIN_NAME" ]; then
41+
if [[ -n "$PLUGIN_NAME" ]]; then
4242
# Enable plugin
4343
printf '[PythonPlugins]\n' >> $CONF_MASTER_FILE
4444
printf "%s=true\n\n" "$PLUGIN_NAME" >> $CONF_MASTER_FILE

‎.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ matrix:
4848
# CODE LAYOUT
4949
##########################################################
5050
- os: linux
51+
dist: xenial
52+
name: code layout 👗
5153
if: type != cron
5254
env:
5355
- TRAVIS_CONFIG=code_layout
5456
addons:
5557
apt:
5658
sources:
5759
- sourceline: 'ppa:jonathonf/backports' # silversearcher-ag backport
58-
- sourceline: 'ppa:sergey-dryabzhinsky/packages' # doxygen
5960
packages:
6061
- doxygen
6162
- graphviz

‎scripts/qgis_srs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
###########################################################################
33
# qgis_srs.sh
44
# ---------------------
@@ -199,7 +199,7 @@ for i in $(awk 'NR>1' ${gdal_share}/pcs.csv | cut -d, -f1); do
199199

200200
raw=$(epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: ")
201201

202-
if [ -n "$raw" ]; then
202+
if [[ -n "$raw" ]]; then
203203

204204
no=$((no + 1))
205205
name=$(echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g")
@@ -222,7 +222,7 @@ for i in $(awk 'NR>1' ${gdal_share}/gcs.csv | cut -d, -f1); do
222222

223223
raw=$(epsg_tr.py -proj4 $i 2>&1 | tr "\n" " " | sed 's/ <> $//' | grep -v "^ERROR 6: ")
224224

225-
if [ -n "$raw" ]; then
225+
if [[ -n "$raw" ]]; then
226226

227227
no=$((no + 1))
228228
name=$(echo $raw | sed 's/^# //' | grep -o "^.\{1,\} <[[:digit:]]\{1,\}>" | sed 's/ <[[:digit:]]\{1,\}>//' | sed "s/'/''/g")

‎scripts/sip_include.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ if [[ "$OSTYPE" =~ darwin* ]]; then
3131
GP=g
3232
fi
3333

34-
modules=(core gui analysis server)
34+
if [[ -n $1 ]]; then
35+
modules=("$1")
36+
else
37+
modules=(core gui analysis server)
38+
fi
3539
sources=(HDRS MOC_HDRS SRCS)
3640

3741
for module in "${modules[@]}"; do
@@ -62,7 +66,7 @@ for module in "${modules[@]}"; do
6266
sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header})
6367
if_cond=$(grep -x -E '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \
6468
${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/')
65-
if [[ ! -z $if_cond ]]; then
69+
if [[ -n $if_cond ]]; then
6670
echo "$if_cond" >> $file
6771
fi
6872
if [[ "$sip" == [0-9]* ]]; then
@@ -71,7 +75,7 @@ for module in "${modules[@]}"; do
7175
sip="./$sip"
7276
fi
7377
echo "%Include auto_generated/$sip" >> $file
74-
if [[ ! -z $if_cond ]]; then
78+
if [[ -n $if_cond ]]; then
7579
echo "%End" >> $file
7680
fi
7781
fi

‎scripts/spell_check/check_spelling.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ declare -A GLOBREP_IGNORE=()
8585
ERRORFOUND=NO
8686

8787
for I in $(seq -f '%02g' 0 $((SPLIT-1)) ) ; do
88-
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && printf "Progress: %d/%d\r" $(( I + 1 )) $SPLIT
88+
{ [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]]; } && printf "Progress: %d/%d\r" $(( I + 1 )) $SPLIT
8989
SPELLFILE=spelling$I~
9090
${GP}sed -i '/^#/d' $SPELLFILE
9191

@@ -136,10 +136,10 @@ for I in $(seq -f '%02g' 0 $((SPLIT-1)) ) ; do
136136
RUN_IGNORECASE=OFF
137137
RUN_CASEMATCH=OFF
138138

139-
if [[ ! -z "${IGNORECASE}" ]]; then
139+
if [[ -n "${IGNORECASE}" ]]; then
140140
RUN_IGNORECASE=ON
141141
fi
142-
if [[ ! -z "${CASEMATCH}" ]]; then
142+
if [[ -n "${CASEMATCH}" ]]; then
143143
RUN_CASEMATCH=ON
144144
fi
145145

@@ -336,7 +336,7 @@ for I in $(seq -f '%02g' 0 $((SPLIT-1)) ) ; do
336336

337337
done
338338

339-
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && echo
339+
{ [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]]; } && echo
340340

341341
if [[ "$ERRORFOUND" =~ YES ]]; then
342342
echo -e "\x1B[1msome errors have been found.\x1B[0m" >&2

‎scripts/spell_check/spell_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ set -e
55
echo "Spell check"
66
cd $(git rev-parse --show-toplevel)
77

8-
if [[ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]]; then
8+
if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then
99
# if on a PR, just analyze the changed files
1010
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
1111
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD ${TRAVIS_BRANCH}) | tr '\n' ' ' )
1212
export PATH=${HOME}/osgeo4travis/bin:${PATH}
13-
elif [[ ! -z $TRAVIS_COMMIT_RANGE ]]; then
13+
elif [[ -n $TRAVIS_COMMIT_RANGE ]]; then
1414
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
1515
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
1616
export PATH=${HOME}/osgeo4travis/bin:${PATH}
@@ -19,7 +19,7 @@ else
1919
FILES=""
2020
fi
2121

22-
if [[ ! -z $FILES ]]; then
22+
if [[ -n $FILES ]]; then
2323
DIR=$(git rev-parse --show-toplevel)/scripts/spell_check
2424
${DIR}/check_spelling.sh -r $FILES
2525
fi

‎scripts/spell_check/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ ${DIR}/check_spelling.sh -r -l spelling_error.log~ spelling_error.dat~
8585
${GP}sort -u -o spelling_error.log~ spelling_error.log~
8686
DIFF=$(diff spelling_error.log~ spelling_error.expected~)
8787

88-
if [[ ! -z $DIFF ]]; then
88+
if [[ -n $DIFF ]]; then
8989
echo "SPELLING TEST FAILED" >&2
9090
else
9191
echo "TEST OK"

‎scripts/verify-indentation.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ ASTYLEDIFF=/tmp/astyle.diff
1919
true > $ASTYLEDIFF
2020

2121

22-
if [[ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]]; then
22+
if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then
2323
# if on a PR, just analyze the changed files
2424
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
2525
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD ${TRAVIS_BRANCH}) | tr '\n' ' ' )
26-
elif [[ ! -z $TRAVIS_COMMIT_RANGE ]]; then
26+
elif [[ -n $TRAVIS_COMMIT_RANGE ]]; then
2727
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
2828
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
2929
fi

‎tests/code_layout/test_doxygen_layout.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
# check that returns are placed before note and since
55
output=$(unbuffer ag --noaffinity --file-search-regex '\.h$' --multiline '\\(note|since)[^\n]+(\n\s*\* [^\n]+)*\n\s*\* \\return' ${TRAVIS_BUILD_DIR} | tee /dev/stderr)
6-
if [[ ! -z $output ]]; then
6+
if [[ -n $output ]]; then
77
echo -e "\n\x1B[31m*** Docstring computation: \\\return(s) should be placed before \\\note and \\since\x1B[0m"
88
exit 1
99
fi
1010

1111
# check that \since and \deprecated are placed at the end of the command block
1212
output=$(unbuffer ag --noaffinity --file-search-regex '\.h$' --multiline '(\\(deprecated|since)[^\n]+\n)+\s*\*[^\/](?!\s*\\(deprecated|since))' ${TRAVIS_BUILD_DIR} | tee /dev/stderr)
13-
if [[ ! -z $output ]]; then
13+
if [[ -n $output ]]; then
1414
echo -e "\n\x1B[31m*** Docstring computation: \\\deprecated and \\\since should be placed at the end of command blocks\x1B[0m"
1515
echo -e "To fix it, you may want to run (multiple times) at the top level directory:"
1616
echo 'sed -i -r '"'"'$!N;s/^(\s*\*\s+\\(deprecated|since)[^\n]+)\n(\s*\*([^\/].*|$))/\3\n\1/;P;D'"'"' $(ag -c --noaffinity --file-search-regex '"'"'\.h$'"'"' --multiline '"'"'(\\(deprecated|since)[^\n]+\n)+\s*\*[^\/]'"'"' . | cut -d: -f1)'
@@ -21,7 +21,7 @@ fi
2121

2222
# code snippets command
2323
output=$(unbuffer ag --noaffinity --file-search-regex '\.h$' --multiline '~~~\{\.\w+\}' ${TRAVIS_BUILD_DIR} | tee /dev/stderr)
24-
if [[ ! -z $output ]]; then
24+
if [[ -n $output ]]; then
2525
echo -e "\n\x1B[31m*** Docstring computation: code snippets should use \\\code{.xx} rather than ~~~{.xx} \x1B[0m"
2626
exit 1
2727
fi

‎tests/testdata/qgis_local_server/fcgi/scripts/spawn_fcgi_mac.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ PROCESS="mapserv"
1919
LABEL="org.qgis.test-${PROCESS}"
2020
USAGE="${0} {stop|status} or {start|restart spawn_bin fcgi_socket fcgi_bin qgis_server_temp_dir}"
2121

22-
if [ ! -z $2 ]; then
22+
if [[ -n $2 ]]; then
2323
SPAWN_BIN=$2
24-
if [ ! -z $3 ]; then
24+
if [[ -n $3 ]]; then
2525
FCGI_SOCKET=$3
2626
fi
27-
if [ ! -z $4 ]; then
27+
if [[ -n $4 ]]; then
2828
FCGI_BIN=$4
2929
fi
30-
if [ ! -z $5 ]; then
30+
if [[ -n $5 ]]; then
3131
QGIS_SERVER_TEMP_DIR=$5
3232
fi
3333
fi

‎tests/testdata/qgis_local_server/lighttpd/scripts/lighttpd_debian.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
###########################################################################
33
# lighttpd_debian.sh
44
# ---------------------
@@ -26,7 +26,7 @@ SCRIPTNAME=$NAME
2626

2727
export QGIS_SERVER_TEMP_DIR=$3
2828

29-
if [ ! -z $4 ]; then
29+
if [[ -n $4 ]]; then
3030
DAEMON_OPTS="-f ${4}"
3131
fi
3232

‎tests/testdata/qgis_local_server/lighttpd/scripts/lighttpd_mac.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ PROCESS="lighttpd"
1919
LABEL="org.qgis.test-${PROCESS}"
2020
USAGE="${0} {stop|status} or {start|restart lighttpd-path lighttpd_conf qgis_server_temp_dir}"
2121

22-
if [ ! -z $2 ]; then
22+
if [[ -n $2 ]]; then
2323
LIGHTTPD_BIN=$2
24-
if [ ! -z $3 ]; then
24+
if [[ -n $3 ]]; then
2525
LIGHTTPD_CONF_PATH=$3
2626
fi
27-
if [ ! -z $4 ]; then
27+
if [[ -n $4 ]]; then
2828
QGIS_SERVER_TEMP_DIR=$4
2929
fi
3030
fi

0 commit comments

Comments
 (0)
Please sign in to comment.