[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master d413546d 3/4: make check: using awk instead of
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master d413546d 3/4: make check: using awk instead of find to look for script filenames |
Date: |
Thu, 2 Jun 2022 12:50:33 -0400 (EDT) |
branch: master
commit d413546d0410bc7de172bdbc93123e02490adc61
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
make check: using awk instead of find to look for script filenames
Until now, the 'find' program was used to obtain the name of the
(executable) installed scripts (through the bit-flags of a file). After
that, a symbolic link was created to have them in the desired directory for
testing. However, this way of obtaining the scripts does not work on macOS
systems (tested on Monterey version 12.3).
With this commit, the way of obtaining these filenames has changed. Now
they are obtained using 'awk' and by parsing their names directly from the
'bin_SCRIPTS' variable of 'Makefile.am' file. Later, a symbolic link to
each of them is generated based on their directory.
This bug was fixed with the help of Mohammad Akhlaghi.
This fixes bug #62563.
---
tests/prepconf.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/tests/prepconf.sh b/tests/prepconf.sh
index 4d66ec97..155a5097 100755
--- a/tests/prepconf.sh
+++ b/tests/prepconf.sh
@@ -101,9 +101,18 @@ done
-# Extract all the executable files in the build directory for 'astscripts'
-# and put a link to them in the temporary directory for all Gnuastro
-# executables. This is because some 'astscript-*'s depend on others.
-for f in $(find $topbuild/bin/script/ -type f -perm /111); do
- ln -sf $f $progbdir/
+# Extract all the intalled script filenames from the
+# 'bin/script/Makefile.am' and put a link to them in the temporary
+# directory for all Gnuastro executables. This is because some
+# 'astscript-*'s depend on others.
+#
+# Initially we were using 'find' to obtain the script names, but it has
+# portability problems between GNU/Linux and macOS. So we just parse the
+# Makefile.am to obtain them.
+scriptnames=$($AWK '/^bin_SCRIPTS/{parse=1; printf "%s ", $3} \
+ parse==1 && $1~/^astscript/{printf "%s ", $1; \
+ if($2=="") parse=0}' \
+ $topsrc/bin/script/Makefile.am)
+for f in $scriptnames; do
+ ln -sf $topbuild/bin/script/$f $progbdir/
done