From 98dfa458f8478dc5702e2d7885884ad41949ffd9 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Sat, 29 Jul 2017 06:08:08 +0200 Subject: [PATCH 1/2] Fix incorrect TOP_DIR in build.sh `TOP_DIR` refers to the top level directory in the repository. Assuming that the `build.sh` script is in the top level directory, we can use its path as reference. Previously we used `pwd` which is incorrect as it refers to the current working directory of the caller. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 36b6ee829..08f5849a5 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -TOP_DIR="${PWD}" +TOP_DIR="$(readlink --canonicalize-existing $(dirname "$0"))" : ${BUILD_DIR:=${TOP_DIR}/build} : ${INSTALL_DIR:=${TOP_DIR}/install} LOG_FILE="${TOP_DIR}/build.log" From 89da5b531383449389ebfe996b72285b7ebdda58 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Sat, 29 Jul 2017 06:09:19 +0200 Subject: [PATCH 2/2] Refactor `tags` command into separate script The `tags` command is not a separate script. --- build.sh | 6 ++---- update_tags.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 update_tags.sh diff --git a/build.sh b/build.sh index 08f5849a5..2900179fc 100755 --- a/build.sh +++ b/build.sh @@ -172,10 +172,8 @@ check_indent() { } tags() { - local basedir=$(git rev-parse --show-toplevel) - local files=$(git ls-files ${basedir}/*.{c,h,F90}) - ctags --recurse --C-kinds=+lxzLp ${files} - etags ${files} + "${TOP_DIR}/update_tags.sh" 2>&1 | tee -a "${LOG_FILE}" + check_pipe_error } dist() { diff --git a/update_tags.sh b/update_tags.sh new file mode 100644 index 000000000..2532ae4ff --- /dev/null +++ b/update_tags.sh @@ -0,0 +1,8 @@ +#!/bin/bash + + +files=$(git ls-tree --full-tree -r HEAD \ + | grep '.\(c\|h\|F90\)$' \ + | awk '{print $4}') +ctags --recurse --C-kinds=+lxzLp --Fortran-kinds=+LP ${files} +etags ${files}