commit:     2e27acb704c15f3c83ae6590a5a8cb3d0d6a8cb5
Author:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 17 11:28:16 2018 +0000
Commit:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
CommitDate: Sat Nov 17 11:28:16 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e27acb7

fortran-2.eclass: cleanup and improvements

Fix problems in the eclass found during EAPI 7 support review, but
unrelated to the EAPI 7 update. Thanks all reviewes for their work.

Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>

 eclass/fortran-2.eclass | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/eclass/fortran-2.eclass b/eclass/fortran-2.eclass
index 4b405ee5c18..b871d16e3e0 100644
--- a/eclass/fortran-2.eclass
+++ b/eclass/fortran-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fortran-2.eclass
@@ -95,7 +95,7 @@ unset _f_use
 fortran_int64_abi_fflags() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       _FC=$(tc-getFC)
+       local _FC=$(tc-getFC)
        if [[ ${_FC} == *gfortran* ]]; then
                echo "-fdefault-integer-8"
        elif [[ ${_FC} == ifort ]]; then
@@ -115,17 +115,17 @@ _fortran_write_testsuite() {
        local filebase=${T}/test-fortran
 
        # f77 code
-       cat <<- EOF > "${filebase}.f"
+       cat <<- EOF > "${filebase}.f" || die
               end
        EOF
 
        # f90/95 code
-       cat <<- EOF > "${filebase}.f90"
+       cat <<- EOF > "${filebase}.f90" || die
        end
        EOF
 
        # f2003 code
-       cat <<- EOF > "${filebase}.f03"
+       cat <<- EOF > "${filebase}.f03" || die
               procedure(), pointer :: p
               end
        EOF
@@ -173,7 +173,7 @@ _fortran-has-openmp() {
        local ret
        local _fc=$(tc-getFC)
 
-       cat <<- EOF > "${fcode}"
+       cat <<- EOF > "${fcode}" || die
               call omp_get_num_threads
               end
        EOF
@@ -182,7 +182,7 @@ _fortran-has-openmp() {
                ${_fc} ${flag} "${fcode}" -o "${fcode}.x" \
                        &>> "${T}"/_fortran_compile_test.log
                ret=$?
-               (( ${ret} )) || break
+               [[ ${ret} == 0 ]] && break
        done
 
        rm -f "${fcode}.x"
@@ -196,12 +196,12 @@ _fortran-has-openmp() {
 _fortran_die_msg() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       echo
+       eerror
        eerror "Please install currently selected gcc version with USE=fortran."
        eerror "If you intend to use a different compiler then gfortran, please"
        eerror "set FC variable accordingly and take care that the necessary"
        eerror "fortran dialects are supported."
-       echo
+       eerror
        die "Currently no working fortran compiler is available (see 
${T}/_fortran_compile_test.log for information)"
 }
 
@@ -253,7 +253,7 @@ _fortran-2_pkg_setup() {
        for _f_use in ${FORTRAN_NEEDED}; do
        case ${_f_use} in
                always)
-                       _fortran_test_function && break
+                       _fortran_test_function && break 2
                        ;;
                no)
                        einfo "Forcing fortran support off"
@@ -261,7 +261,7 @@ _fortran-2_pkg_setup() {
                        ;;
                *)
                        if use ${_f_use}; then
-                               _fortran_test_function && break
+                               _fortran_test_function && break 2
                        else
                                unset FC
                                unset F77

Reply via email to