dependencies.sh: improve the missing perl modules detection
PATCH v7 1/1 dependencies.sh: improve the missing perl modules detection
---
Changes v6 -> v7:
- Remove the "space-separated list" comment. Having two examples of how to add modules to the list makes this comment not necessary. (Suggested by Thomas Petazzoni)
- Don't use the += operator as is bash specific and not POSIX compliant. The script specifies #!/bin/sh so we are not guaranteed that it will be executed with bash. (Suggested by Thomas Petazzoni)
- Use just "echo" without the empty string argument to produce blank lines. (Suggested by Thomas Petazzoni)
Changes v5 -> v6:
- Remove the check for perl itself, as is already done at line #161.
Changes v4 -> v5:
- Use the string concatenation operator (+=) to assing the values to the required_perl_modules. That way the comments about why each module is needed can be in the same line where the module is added to the variable.
Use also += for the missing_perl_modules variable.
Changes v3 -> v4:
- Thread::Queue module is actually needed because host-automake uses it. Comment modified accordingly. (Highlighted by Thomas Petazzoni)
Changes v2 -> v3:
- Add comments about why each module is needed. (Suggested by Baruch Siach)
Changes v1 -> v2:
- Check first for perl itself, and then the modules. Also keep the comment which says that perl is needed to build host-autoconf. (Suggested by Baruch Siach)
support/dependencies/dependencies.sh | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-)
support/dependencies/dependencies.sh +21 -5
@@ -236,10 +236,26 @@ if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then fi fi -# Check that the Perl installation is complete enough to build -# host-autoconf. -if ! perl -e "require Data::Dumper" > /dev/null 2>&1 ; then - echo "Your Perl installation is not complete enough, at least Data::Dumper is missing." - echo "On Debian/Ubuntu distributions, install the 'perl' package." +# Check that the Perl installation is complete enough for Buildroot. +required_perl_modules="Data::Dumper" # Needed to build host-autoconf +required_perl_modules="$required_perl_modules Thread:Queue" # Used by host-automake + +# This variable will keep the modules that are missing in your system. +missing_perl_modules="" + +for pm in $required_perl_modules ; do + if ! perl -e "require $pm" > /dev/null 2>&1 ; then + missing_perl_modules="$missing_perl_modules $pm" + fi +done + +if [ -n "$missing_perl_modules" ] ; then + echo "Your Perl installation is not complete enough; at least the following" + echo "modules are missing:" + echo + for pm in $missing_perl_modules ; do + echo -e "\t $pm" + done + echo exit 1 fi
Signature · 1 line
1.7.1
Thomas Petazzoni
AppliedPATCH v7 1/1 dependencies.sh: improve the missing perl modules detection
Vicente,
support/dependencies/dependencies.sh if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then · line 241
Quoted 8 lines · Vicente Olivert Riera
support/dependencies/dependencies.sh +3
-5-# Check that the Perl installation is complete enough to build -# host-autoconf. -if ! perl -e "require Data::Dumper" > /dev/null 2>&1 ; then - echo "Your Perl installation is not complete enough, at least Data::Dumper is missing." - echo "On Debian/Ubuntu distributions, install the 'perl' package." +# Check that the Perl installation is complete enough for Buildroot. +required_perl_modules="Data::Dumper" # Needed to build host-autoconf +required_perl_modules="$required_perl_modules Thread:Queue" # Used by host-automake
Thread:Queue doesn't exist, it's named Thread::Queue.
support/dependencies/dependencies.sh if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then · line 257
Quoted 6 lines
support/dependencies/dependencies.sh +6
-0+if [ -n "$missing_perl_modules" ] ; then + echo "Your Perl installation is not complete enough; at least the following" + echo "modules are missing:" + echo + for pm in $missing_perl_modules ; do + echo -e "\t $pm"
echo -e is not POSIX, using printf is better.
I've applied your patch with those two issues fixed. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com