OSDN Git Service

[BUG FIX] Packages for which the flavor mechanism is newly introduced sometimes had...
[portsreinstall/current.git] / lib / libmain.sh
index dd35ad5..23dbc45 100644 (file)
@@ -2,18 +2,18 @@
 # ==============================================================================
 # portsreinstall library script
 # - Common functions of main programs -
-# Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2018-2022 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
 # ============= Define the software version =============
 main_set_version ()
 {
-       MYVERSION=4.1.0
+       MYVERSION=4.1.2
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180826163929
-       COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
+       MYVERSION=4.1.1+toward_4.1.2_20220508155922
+       COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0-1]\.[0-1]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
 # ============= Parse options, arguments and control parameters =============
@@ -79,7 +79,6 @@ main_parse_options_arguments ()
 
        # ============= Argument check for conventional runs =============
        command_all_parse_args "$@"
-       shift "${COMMAND_SHIFT}"
 }
 
 # ============= Define the common termination messages =============
@@ -345,12 +344,54 @@ main_collect_all_installed_packages ()
        program_exec_and_record_completion COLLECT_ALL_INSTALLED_PACKAGES
 }
 
+# ============= Determine all target ports of tools which have to be up-to-date =============
+main_determine_all_target_ports_of_tools ()
+{
+       local PROGRAM_DEPENDS
+       PROGRAM_DEPENDS=
+       _program_exec_and_record_completion__operation ()
+       {
+               message_section_title "Determining all target ports of tools which have to be up-to-date"
+               {
+                       [ "$PKGSYS_USE_PKGNG" = yes ] && pkgsys_portsmgmt_pkg
+                       pkgsys_is_dialog4ports_used && pkgsys_portsmgmt_dialog4ports
+                       [ -n "$MYPORTORIGIN" ] && echo "$MYPORTORIGIN"
+               } 2> /dev/null > ${DBDIR}/stage.loop_list/tools_to_inspect
+               cp "${DBDIR}/stage.loop_list/tools_to_inspect" "${DBDIR}/stage.loop_list/tools_to_inspect_initial"
+               message_echo
+       }
+       program_exec_and_record_completion DETERMINE_ALL_TARGET_PORTS_OF_TOOLS
+}
+
+# ============= Preliminary inspection of initially installed tools which have to be up-to-date =============
+# (No need depend on PARSE_CONF because INSPECT_ALL_DEPENDENCIES will take the task.)
+main_preliminary_inspection_of_initial_tools ()
+{
+       local PROGRAM_DEPENDS
+       PROGRAM_DEPENDS='DETERMINE_ALL_TARGET_PORTS_OF_TOOLS'
+       _program_exec_restartable_loop_operation__routine ()
+       {
+               local origin
+               origin=$1
+               database_build_setup_initial_node "$origin"
+       }
+       _program_exec_and_record_completion__operation ()
+       {
+               local DEPTH_INDEX
+               message_section_title "Preliminary inspection of initially installed tools which have to be up-to-date"
+               program_exec_restartable_loop_operation tools_to_inspect_initial
+               database_build_post_inspect_initial_dependencies
+               message_echo
+       }
+       program_exec_and_record_completion PRELIMINARY_INSPECTION_OF_INITIAL_TOOLS
+}
+
 # ============= Preliminary inspection of tools which have to be up-to-date =============
 # (No need depend on PARSE_CONF because INSPECT_ALL_DEPENDENCIES will take the task.)
 main_preliminary_inspection_of_tools ()
 {
        local PROGRAM_DEPENDS
-       PROGRAM_DEPENDS=
+       PROGRAM_DEPENDS='PRELIMINARY_INSPECTION_OF_INITIAL_TOOLS'
        _program_exec_restartable_loop_operation__routine ()
        {
                local origin
@@ -361,11 +402,6 @@ main_preliminary_inspection_of_tools ()
        {
                local DEPTH_INDEX
                message_section_title "Preliminary inspection of tools which have to be up-to-date"
-               {
-                       [ "$PKGSYS_USE_PKGNG" = yes ] && pkgsys_portsmgmt_pkg
-                       pkgsys_is_dialog4ports_used && pkgsys_portsmgmt_dialog4ports
-                       [ -n "$MYPORTORIGIN" ] && echo "$MYPORTORIGIN"
-               } 2> /dev/null > ${DBDIR}/stage.loop_list/tools_to_inspect
                cp /dev/null "${DBDIR}/done_required_ports_to_inspect"
                DEPTH_INDEX='--'
                program_exec_restartable_loop_operation tools_to_inspect
@@ -487,7 +523,7 @@ main_reflect_conf_changes ()
                if fileedit_manipulate_old_new_lines \
                        "${DBDIR}/conf.prev/setenv.sh" "${DBDIR}/conf/setenv.sh" "$tmpfile_old" "$tmpfile_new"
                then
-                       if grep -q -e ^LOCALBASE= -e ^LINUXBASE= -e ^PORTSDIR= "$tmpfile_old" "$tmpfile_new"
+                       if env LANG=C grep -q -e ^LOCALBASE= -e ^LINUXBASE= -e ^PORTSDIR= "$tmpfile_old" "$tmpfile_new"
                        then
                                message_echo "ERROR: Migration of the temporary database is unavailable because LOCALBASE, LINUXBASE or PORTSDIR was changed." >&2
                                message_echo "        ${APPNAME} clean" >&2