OSDN Git Service

Improved the log output to show 100% at the end of countered loop always.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 10 Sep 2018 04:26:24 +0000 (12:26 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 10 Sep 2018 04:26:24 +0000 (12:26 +0800)
 Changes to be committed:
modified:   lib/libcommand_do.sh
modified:   lib/libmain.sh
modified:   lib/libprogram.sh

lib/libcommand_do.sh
lib/libmain.sh
lib/libprogram.sh

index 86ba96d..8d5f91b 100644 (file)
@@ -1126,6 +1126,7 @@ command_do_reinstallation_of_remained_ports ()
                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
                message_section_title "Reinstallation"
                program_exec_restartable_loop_operation reinst_todo
+               [ "x$PROGRAM_STEP_COUNTER_LAST_SKIPPED" = xyes ] && message_stage_title "$PROGRAM_STEP_COUNTER"
                reinstall_restore_conflicts
                temp_set_msg_current_stage
                message_echo
@@ -1149,6 +1150,7 @@ command_do_restore_needed_obsolete_and_leaf_packages ()
                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
                message_section_title "Restoration of unselected obsolete/leaf packages"
                program_exec_restartable_loop_operation ports_to_restore
+               [ "x$PROGRAM_STEP_COUNTER_LAST_SKIPPED" = xyes ] && message_stage_title "$PROGRAM_STEP_COUNTER"
                temp_set_msg_current_stage
                message_echo
        }
@@ -1171,6 +1173,7 @@ command_do_deinstallation_of_unused_obsolete_and_leaf_packages ()
                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
                message_section_title "Deinstallation of unused obsolete/leaf packages"
                program_exec_restartable_loop_operation ports_to_delete
+               [ "x$PROGRAM_STEP_COUNTER_LAST_SKIPPED" = xyes ] && message_stage_title "$PROGRAM_STEP_COUNTER"
                temp_set_msg_current_stage
                message_echo
        }
index 5be867f..75a9d5a 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180910103620
+       MYVERSION=4.0.0+toward_4.1.0_20180910122552
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index e3a79ba..d4e1d2f 100644 (file)
@@ -12,6 +12,7 @@ PROGRAM_NUM_STEPS=    # [Used in _program_exec_restartable_loop_operation__routine]
 PROGRAM_STEP_PROGRESS= # [Used in _program_exec_restartable_loop_operation__routine] Current progress as the finished number of routine steps
 PROGRAM_STEP_COUNTER=  # [Used in _program_exec_restartable_loop_operation__routine] Counter string indicating the current progress
 PROGRAM_STAGETAG=      # [Used in _program_exec_restartable_loop_operation__routine] Current stage tag
+PROGRAM_STEP_COUNTER_LAST_SKIPPED=no   # Whether the last iteration was skipped
 
 # ============= Check completion of a stage =============
 program_chk_stage_complete ()
@@ -30,6 +31,15 @@ program_chk_stage_loop_complete ()
        [ -e "${DBDIR}/stage.reinit_loop/$stagetag" ]
 }
 
+# ============= Check completion of a loop in a stage =============
+program_chk_stage_loop_complete ()
+{
+       local stagetag
+       stagetag=$1
+       program_chk_stage_complete "$stagetag" && return
+       [ -e "${DBDIR}/stage.reinit_loop/$stagetag" ]
+}
+
 # ============= Register completion of a stage =============
 program_register_stage_complete ()
 {
@@ -157,13 +167,18 @@ program_exec_restartable_loop_operation ()
        nlines=`wc -l < ${TMPDIR}/$inputdb.input`
        PROGRAM_STEP_PROGRESS=$(($PROGRAM_NUM_STEPS-$nlines))
        iline=1
+       PROGRAM_STEP_COUNTER_LAST_SKIPPED=no
        while [ $iline -le $nlines ]
        do
                item=`sed -n ${iline}p "${TMPDIR}/$inputdb.input"`
                iline=$(($iline+1))
                PROGRAM_STEP_PROGRESS=$(($PROGRAM_STEP_PROGRESS+1))
                PROGRAM_STEP_COUNTER="[$PROGRAM_STEP_PROGRESS/$PROGRAM_NUM_STEPS $(($PROGRAM_STEP_PROGRESS*100/$PROGRAM_NUM_STEPS))%]"
-               grep -q -Fx "$item" "$looplist.remain" 2> /dev/null || continue
+               if grep -vq -Fx "$item" "$looplist.remain" 2> /dev/null
+               then
+                       [ $iline -gt $nlines ] && PROGRAM_STEP_COUNTER_LAST_SKIPPED=yes
+                       continue
+               fi
                _program_exec_restartable_loop_operation__routine "$item"
                fileedit_rm_a_line "$item" "$looplist.remain"
        done