OSDN Git Service

Operation by make is made more quite for the batch mode.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 6 Aug 2018 02:03:01 +0000 (10:03 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 6 Aug 2018 02:03:01 +0000 (10:03 +0800)
 Changes to be committed:
modified:   lib/libdatabase_record.sh
modified:   lib/libmain.sh
modified:   lib/libreinstall.sh

lib/libdatabase_record.sh
lib/libmain.sh
lib/libreinstall.sh

index 2cac1ac..d38f09c 100644 (file)
@@ -83,7 +83,7 @@ database_record_failure ()
        if [ -z "$clean" -o "@$clean" = @clean ]
        then
                message_echo "*** Trying to clean the failed build... (Ignore failures)"
-               database_build_make "$origin" clean || :
+               database_build_make "$origin" clean | message_cat
        fi
        message_echo "*** Skipping this port and proceeding to next forcibly..."
        message_echo
index 1995b6d..ee9d394 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180806094000
+       MYVERSION=4.0.0+toward_4.1.0_20180806100240
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index 286c41a..ef863b4 100644 (file)
@@ -583,7 +583,14 @@ reinstall_pkg_backup ()
 # ============= Deinstallation of the currently installed package =============
 reinstall_deinstall ()
 {
-       local tmp_installedpkg installed_pkgs
+       local tmp_installedpkg installed_pkgs dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        tmp_installedpkg=${TMPDIR}/reinstall_deinstall:installedpkg
        pkgsys_get_installed_pkg_from_origin "$REINSTALL_ORIGIN" > $tmp_installedpkg
        [ `wc -l < $tmp_installedpkg` -gt 0 ] || return 0
@@ -606,7 +613,7 @@ reinstall_deinstall ()
                done < $tmp_installedpkg
        fi
        message_echo "-- (Trying to deinstall by ports to make sure. This may cause negligible warnings.)"
-       reinstall_make deinstall || \
+       reinstall_make deinstall > $dev_out 2> $dev_err|| \
        {
                message_echo "WARNING: Failed to deinstall $REINSTALL_CURRENTPKG by make deinstall." >&2
        }
@@ -625,7 +632,14 @@ reinstall_deinstall_old_ports ()
 # ============= Recovery after failure of installation of the new package =============
 reinstall_failed_install_recover ()
 {
-       local backedup_version backup_pkg
+       local backedup_version backup_pkg dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        reinstall_chk_stage_complete FAILED_INSTALL.RECOVER && return
        message_echo "INFO: Trying to deinstall the failed/terminated installation (Ignore failures)."
        if [ -n "$REINSTALL_CURRENTPKG" ]
@@ -633,7 +647,7 @@ reinstall_failed_install_recover ()
                pkg_delete_f "$REINSTALL_CURRENTPKG" || :
        fi
        message_echo "INFO: Trying to deinstall by ports to make sure (This may cause negligible warnings)."
-       reinstall_make deinstall || :
+       reinstall_make deinstall > $dev_out 2> $dev_err|| :
        backedup_version=`cat "$REINSTALL_FROMNODE_DIR/backedup_version" 2> /dev/null || :`
        if grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/taboo.all.list" 2> /dev/null
        then
@@ -773,9 +787,16 @@ reinstall_execcmd_tee_errlog ()
        func=$1
        tmp_err=${TMPDIR}/reinstall_execcmd_tee_errlog::error
        rm -f "$tmp_err"
-       { {
-               $func
-       } 2>&1 || touch "$tmp_err"; } | tee "$REINSTALL_DBNODE_DIR/error.log"
+       if [ $opt_batch_mode = yes ]
+       then
+               { {
+                       $func
+               } 2>&1 || touch "$tmp_err"; } > "$REINSTALL_DBNODE_DIR/error.log"
+       else
+               { {
+                       $func
+               } 2>&1 || touch "$tmp_err"; } | tee "$REINSTALL_DBNODE_DIR/error.log"
+       fi
        [ -e "$tmp_err" ] && return 1
        rm -f "$REINSTALL_DBNODE_DIR/error.log"
        return
@@ -786,7 +807,7 @@ reinstall_execcmd_getstdout_errlog ()
 {
        local func
        func=$1
-       if $func 2> $REINSTALL_DBNODE_DIR/error.log
+       if $func > $REINSTALL_DBNODE_DIR/error.log 2>&1
        then
                rm -f "$REINSTALL_DBNODE_DIR/error.log"
                return
@@ -1211,11 +1232,19 @@ reinstall_exec_reinstall_prebuild ()
 # Return status 1 for error end
 reinstall_exec_reinstall_fetch ()
 {
+       local dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        if ! reinstall_chk_stage_complete FETCH
        then
                if ! reinstall_chk_stage FAILED_FETCH
                then
-                       reinstall_make_anymode checksum || \
+                       reinstall_make_anymode checksum > $dev_out > $dev_err || \
                                reinstall_register_stage FAILED_FETCH
                fi
                if reinstall_chk_stage FAILED_FETCH
@@ -1224,8 +1253,8 @@ reinstall_exec_reinstall_fetch ()
                        then
                                message_echo "INFO: Refetching distfiles for $REINSTALL_ORIGPKGTAG."
                                {
-                                       reinstall_make_anymode fetch FETCH_ARGS=-Ap &&
-                                               reinstall_make_anymode checksum
+                                       reinstall_make_anymode fetch FETCH_ARGS=-Ap > $dev_out > $dev_err &&
+                                               reinstall_make_anymode checksum > $dev_out > $dev_err
                                } || reinstall_register_stage FAILED_REFETCH_1
                                reinstall_register_stage_complete FAILED_FETCH.RETRIAL_1
                        fi
@@ -1234,7 +1263,7 @@ reinstall_exec_reinstall_fetch ()
                                if ! reinstall_chk_stage_complete FAILED_FETCH.RETRIAL_2.DISTCLEAN
                                then
                                        message_echo "INFO: Cleaning distfiles for the second refetch for $REINSTALL_ORIGPKGTAG."
-                                       reinstall_make_anymode distclean || :
+                                       reinstall_make_anymode distclean > $dev_out > $dev_err || :
                                        reinstall_register_stage_complete FAILED_FETCH.RETRIAL_2.DISTCLEAN
                                fi
                                if ! reinstall_chk_stage_complete FAILED_FETCH.RETRIAL_2
@@ -1298,7 +1327,14 @@ reinstall_exec_reinstall_chk_interactive_mode ()
 # Return status 1 for error end
 reinstall_exec_reinstall_build ()
 {
-       local flag_restarted_build build_args is_build_env_modified conflicts_install
+       local flag_restarted_build build_args is_build_env_modified conflicts_install dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        if reinstall_chk_stage in_build
        then
                message_echo "(Restarting the previously terminated build process...)"
@@ -1319,7 +1355,7 @@ reinstall_exec_reinstall_build ()
                pkgsys_get_conflicting_installed_pkgs build "$REINSTALL_ORIGIN" \
                        | reinstall_backup_and_delete_conflicts
                reinstall_chk_missing_requirement || return
-               if ! reinstall_make build $build_args
+               if ! reinstall_make build $build_args > $dev_out 2> $dev_err
                then
                        reinstall_register_stage in_retrial_build
                        [ $flag_restarted_build = yes ] && message_echo "INFO: This failure may be due to restarting from a terminated build."
@@ -1409,7 +1445,14 @@ reinstall_exec_reinstall_stage ()
 # Return status 1 for error end
 reinstall_exec_reinstall_install ()
 {
-       local insttarget
+       local insttarget dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        if [ -e "$REINSTALL_FROMNODE_DIR/installed_version" ]
        then
                insttarget=reinstall
@@ -1452,10 +1495,10 @@ reinstall_exec_reinstall_install ()
                fi
                if ! reinstall_chk_stage FAILED_INSTALL
                then
-                       if reinstall_make $insttarget || \
+                       if reinstall_make $insttarget > $dev_out 2> $dev_err || \
                                {
                                        message_echo "INFO: Cleaning up for retrial."
-                                       reinstall_make deinstall \
+                                       reinstall_make deinstall > $dev_out 2> $dev_err \
                                                || message_echo "WARNING: Continuing by hoping a success." >&2
                                        message_echo "INFO: Retrying the installation."
                                        _reinstall_exec__tmpcmd () { reinstall_make $insttarget MAKE_JOBS_UNSAFE=yes; }
@@ -1540,10 +1583,18 @@ reinstall_exec_reinstall_install ()
 # ============= Reinstallation of the current origin: Closing process after successful install =============
 reinstall_exec_reinstall_close ()
 {
+       local dev_out dev_err
+       dev_out=/dev/stdout
+       dev_err=/dev/stderr
+       if [ $opt_batch_mode = yes ]
+       then
+               dev_out=/dev/null
+               dev_err=/dev/null
+       fi
        reinstall_restore_conflicts "$REINSTALL_ORIGIN"
        if ! reinstall_chk_stage_complete CLEAN_AFTER_INSTALL
        then
-               if ! reinstall_make clean
+               if ! reinstall_make clean > $dev_out 2> $dev_err
                then
                        message_echo "WARNING: Failed to clean $REINSTALL_ORIGPKGTAG." >&2
                fi