OSDN Git Service

Fixed a bug of error end when no obsolete package is installed.
[portsreinstall/current.git] / lib / libcommand_do.sh
index 86ba96d..6ff92ba 100644 (file)
@@ -169,6 +169,10 @@ command_do_determine_all_target_ports ()
                        cat "${DBDIR}/stage.loop_list/target_requirements.specified" || :
                        cat "${DBDIR}/targets_specified_so_far" || :
                }  2> /dev/null | sort -u > "${DBDIR}/stage.loop_list/ports_to_inspect"
+               while read origin
+               do
+                       [ -d "${PORTSDIR}/$origin" ] || echo "$origin"
+               done < ${DBDIR}/stage.loop_list/ports_to_inspect > ${DBDIR}/obsoletes_to_escape_for_inspection
                message_echo
        }
        program_exec_and_record_completion DETERMINE_ALL_TARGET_PORTS
@@ -182,6 +186,7 @@ command_do_prepare_for_inspect_all_dependencies ()
        _program_exec_and_record_completion__operation ()
        {
                message_section_title "Preparing for inspection of all dependencies"
+               database_build_escape "${DBDIR}/escaped_obsoletes" < ${DBDIR}/obsoletes_to_escape_for_inspection
                cp /dev/null "${DBDIR}/done_required_ports_to_inspect"
                message_echo
        }
@@ -472,6 +477,21 @@ command_do_inspection_of_dependents ()
        program_exec_and_record_completion INSPECT_DEPENDENTS
 }
 
+# ============= Restore escaped obsolete packages for inspection =============
+command_do_restore_escaped_obsoletes ()
+{
+       local PROGRAM_DEPENDS
+       PROGRAM_DEPENDS='INSPECT_DEPENDENTS'
+       _program_exec_and_record_completion__operation ()
+       {
+               message_section_title "Restoring escaped obsolete packages for inspection"
+               cat "${DBDIR}/escaped_obsoletes" 2> /dev/null | database_build_restore
+               rm -f "${DBDIR}/escaped_obsoletes"
+               message_echo
+       }
+       program_exec_and_record_completion RESTORE_ESCAPED_OBSOLETE_PACKAGES_FOR_INSPECTION
+}
+
 # ============= Remove duplicated lines in dependents lists =============
 command_do_remove_duplicated_lines_in_dependents_lists ()
 {
@@ -1085,7 +1105,7 @@ command_do_clean_up_of_reinstallation_status_for_preparation ()
 command_do_completion_of_building_the_temporary_database ()
 {
        local PROGRAM_DEPENDS
-       PROGRAM_DEPENDS='REDO_INIT SETUP_REINST_TODO CLEANUP_REINST_STATUS PARSE_CONF INSPECT_ALL_DEPENDENCIES NECESSARY_UPDATES:direct NECESSARY_UPDATES:full PARSE_TARGET_ATTR_INFO MAKE_DEPENDENTS_LISTS_UNIQUE MAKE_IGNORED_DEPENDENTS_LISTS_UNIQUE COLLECT_LEAF_PORTS_TO_DELETE'
+       PROGRAM_DEPENDS='REDO_INIT SETUP_REINST_TODO CLEANUP_REINST_STATUS PARSE_CONF INSPECT_ALL_DEPENDENCIES RESTORE_ESCAPED_OBSOLETE_PACKAGES_FOR_INSPECTION NECESSARY_UPDATES:direct NECESSARY_UPDATES:full PARSE_TARGET_ATTR_INFO MAKE_DEPENDENTS_LISTS_UNIQUE MAKE_IGNORED_DEPENDENTS_LISTS_UNIQUE COLLECT_LEAF_PORTS_TO_DELETE'
        _program_exec_and_record_completion__operation ()
        {
                message_section_title "The temporary database is completely built up"
@@ -1126,6 +1146,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 +1170,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 +1193,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
        }
@@ -1277,6 +1300,9 @@ command_do_prepare ()
                command_do_reset_changed_portdb && break
        done
        
+       # Restore escaped obsolete packages for inspection
+       command_do_restore_escaped_obsoletes
+       
        # Remove duplicated lines in dependents lists
        command_do_remove_duplicated_lines_in_dependents_lists
        
@@ -1447,17 +1473,17 @@ command_do_ending_process ()
                if [ $opt_no_opening_message = yes ]
                then
                        message_echo "Done as ${APPNAME}"
-                       return
+               else
+                       message_section_title "COMPLETELY DONE"
                fi
-               message_section_title "COMPLETELY DONE"
                if [ $opt_fetch_only = no -a $opt_dry_run = no ]
-                       then
+               then
                        PROGRAM_DEPENDS='REBUILD_PKGDB CLEANUP_OBSLETE_DISTFILES '
                        _program_exec_and_record_completion__operation ()
                        {
                        }
                        program_exec_and_record_completion ALL_COMPLETE
-                       message_echo "- E N D -"
+                       [ $opt_no_opening_message = yes ] || message_echo "- E N D -"
                else
                        message_echo "INFO: Redo for the real (re)installation."
                fi