OSDN Git Service

[NEW] make command is added.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sat, 4 Aug 2018 18:06:47 +0000 (02:06 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sat, 4 Aug 2018 18:06:47 +0000 (02:06 +0800)
reinstall_exec() is broken into smaller functions.

 Changes to be committed:
modified:   lib/libcommand.sh
modified:   lib/libcommand_pkgs.sh
modified:   lib/libdatabase_build.sh
modified:   lib/libmain.sh
modified:   lib/libreinstall.sh
modified:   lib/main/libcommand.sh
modified:   lib/main/libusage.sh
modified:   man/portsreinstall.8

lib/libcommand.sh
lib/libcommand_pkgs.sh
lib/libdatabase_build.sh
lib/libmain.sh
lib/libreinstall.sh
lib/main/libcommand.sh
lib/main/libusage.sh
man/portsreinstall.8

index 6aa0bfa..8c5c692 100644 (file)
@@ -30,7 +30,7 @@ command_all_chk_need_opening_notice ()
 _command_parse_args__chk_glob_args ()
 {
        local nargs
-       nargs=1
+       nargs=$1
        [ $nargs -gt 0 ] && return
        message_echo "ERROR: No port glob is specified." >&2
        exit 1
index ea3f306..2407665 100644 (file)
@@ -435,3 +435,20 @@ command_pkgs_packupgrade_crop ()
        cp "$dstdir.tar.gz" "${COMMAND_PACKUPGRADE_SAVEPATH}"
        message_echo "INFO: The cropped archive is saved as [${COMMAND_PACKUPGRADE_SAVEPATH}]."
 }
+
+# ============= Operation of make command =============
+command_pkgs_make_ports ()
+{
+       glob=$1
+       shift || :
+       origins=`pkgsys_eval_ports_glob "$1"`
+       [ -n "$origins" ] || message_echo "WARNING: No matching port for the glob pattern $glob" >&2
+       echo "$origins" | while read origin
+       do
+               message_echo "========== [$origin] =========="
+               reinstall_make_individual "$origin" "$@"
+               errno=$?
+               message_echo
+               [ $errno -eq 0 ] || exit $errno
+       done
+}
index a61672d..fa25c46 100644 (file)
@@ -124,7 +124,7 @@ database_build_setup_make_envs ()
        origin=$1
        dbdir=${DBDIR}/requires/$origin
        [ -d "$dbdir" ] || dbdir=${DBDIR}/conf/each_port/$origin
-       cat "$dbdir/MENV.conf" 2> /dev/null || :
+       cat "$dbdir/MENV.conf" 2> /dev/null | tr '\n' ' '
 }
 
 # ============= Execute make command for building the temporary database =============
index ee7ac24..3ff8f0c 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_20180804182236
+       MYVERSION=4.0.0+toward_4.1.0_20180805020621
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index fc07d2a..286c41a 100644 (file)
@@ -23,7 +23,6 @@ reinstall_skip ()
        message=$1
        message_echo "($message)"
        message_target_relations "$REINSTALL_ORIGIN"
-       message_echo
        fileedit_rm_a_line "$REINSTALL_ORIGIN" "${DBDIR}/stage.loop_list/reinst_todo.remain"
 }
 
@@ -127,7 +126,9 @@ reinstall_setup_make_args ()
                then
                        pkgsys_is_dialog4ports_used && echo 'NO_DIALOG=yes'
                fi
-               cat "${DBDIR}/requires/$REINSTALL_ORIGIN/MARG.conf" 2> /dev/null || :
+               dbdir=$REINSTALL_DBNODE_DIR
+               [ -d "$dbdir" ] || dbdir=${DBDIR}/conf/each_port/$origin
+               cat "$dbdir/MARG.conf" 2> /dev/null || :
                flavor=`pkgsys_get_flavor_from_origin "$REINSTALL_ORIGIN"`
                [ -z "$flavor" ] || echo "FLAVOR=$flavor"
        } | tr '\n' ' '
@@ -136,7 +137,7 @@ reinstall_setup_make_args ()
 # ============= Get the make environment variables =============
 reinstall_setup_make_envs ()
 {
-       cat "${DBDIR}/requires/$REINSTALL_ORIGIN/MENV.conf" 2> /dev/null | tr '\n' ' '
+       database_build_setup_make_envs "$REINSTALL_ORIGIN"
 }
 
 # ============= Common comand to execute make command =============
@@ -731,7 +732,6 @@ reinstall_closing_operations_after_successful_install ()
                pkgsys_delete_backup_pkg "$initial_orig"
        done
        rm -f "$REINSTALL_FROMNODE_DIR/backedup_pkgfile"
-       reinstall_deregister_stage in_postinstall
        database_record_success "$REINSTALL_ORIGIN"
        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
        message_echo "===>  Done successfully"
@@ -796,6 +796,7 @@ reinstall_execcmd_getstdout_errlog ()
 }
 
 # ============= Check whether any required package is missing or too old for build by ports =============
+# Return status 0 for no problem about missing ports
 reinstall_chk_missing_requirement ()
 {
        local tmp_filter tmp_miising
@@ -819,31 +820,22 @@ reinstall_chk_missing_requirement ()
        fi
 }
 
-# ============= Reinstallation for a flavored origin =============
-reinstall_exec ()
+# ============= Check whether the current port is marked to skip =============
+# Return status 1 for port to skip
+reinstall_exec_chk_skip ()
 {
-       ( set -e
-       REINSTALL_ORIGIN=$1
-       REINSTALL_DBNODE_DIR=${DBDIR}/requires/$REINSTALL_ORIGIN
-       REINSTALL_FROMNODE_DIR=${DBDIR}/moved_from/$REINSTALL_ORIGIN
-       REINSTALL_CURRENTPKG=`database_build_update_pkgname "$REINSTALL_ORIGIN" | tr '\n' ' ' | sed 's/ *$//'`
-       REINSTALL_IS_CURRENTPKG_LATEST=no
-       database_build_is_currentpkg_latest "$REINSTALL_ORIGIN" && REINSTALL_IS_CURRENTPKG_LATEST=yes
-       database_build_update_pkgtag "$REINSTALL_ORIGIN"
-       REINSTALL_PKGTAG=`cat "$REINSTALL_FROMNODE_DIR/pkgtag"`
-       REINSTALL_ORIGPKGTAG="$REINSTALL_ORIGIN ($REINSTALL_PKGTAG)"
-       REINSTALL_DBSUFFIX=`options_get_dependency_type`.`options_get_dependency_level`
-       REINSTALL_NEWPKGNAME=`database_build_get_new_pkgname "$REINSTALL_ORIGIN"`
-       REINSTALL_IS_FROZEN=no
-       grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes
-       message_stage_title "$PROGRAM_STEP_COUNTER $REINSTALL_ORIGPKGTAG"
+       local tag level
+       local currentorigin_is_all currentorigin_is_target currentorigin_is_requires_requirements
+       local currentorigin_is_initial_requirements currentorigin_is_requires_dependents
+       local currentorigin_is_initial_dependents currentorigin_is_requires_requirements_complement
+       local currentorigin_is_relevant
        database_query_get_target_attributes currentorigin "$REINSTALL_ORIGIN"
        if [ -z "${currentorigin_is_all}" -a -z "${currentorigin_is_relevant}" ]
        then
                reinstall_skip 'Skipped because being irrelevant'
-               return
+               return 1
        fi
-       reinstall_skip_if_in_a_list 'Skipped because being a leaf port' leaf_ports_to_delete && return
+       reinstall_skip_if_in_a_list 'Skipped because being a leaf port' leaf_ports_to_delete && return 1
        rm -f "$REINSTALL_DBNODE_DIR/this_is_skipped_build_requirement"
        if expr "$REINSTALL_CURRENTPKG" : '.* .*' > /dev/null
        then
@@ -858,18 +850,18 @@ reinstall_exec ()
                        then
                                reinstall_restore_if_temporarily_deinstalled
                                reinstall_skip 'Skipped because being already latest' "$REINSTALL_ORIGIN"
-                               return
+                               return 1
                        fi
                elif [ ! -e "$REINSTALL_DBNODE_DIR/conf_updated" ]
                then
-                       if [ -e "$nodedir/installed_by_pkg" ] && database_query_is_default_conf "$REINSTALL_ORIGIN" quiet
+                       if [ -e "$REINSTALL_DBNODE_DIR/installed_by_pkg" ] && database_query_is_default_conf "$REINSTALL_ORIGIN" quiet
                        then
                                reinstall_restore_if_temporarily_deinstalled
                                reinstall_skip 'Skipped because already upgraded with a prebuilt package'
-                               return
+                               return 1
                        fi
                        reinstall_skip_if_in_a_list 'Skipped because the reinstallation has been already completed' \
-                               "success.${REINSTALL_DBSUFFIX}.list" restore && return
+                               "success.${REINSTALL_DBSUFFIX}.list" restore && return 1
                        if [ $opt_skip_unchanged = yes ]
                        then
                                if [ ! -e "$REINSTALL_DBNODE_DIR/necessary_upgrade.${REINSTALL_DBSUFFIX}" ]
@@ -882,7 +874,7 @@ reinstall_exec ()
                                                touch "$REINSTALL_DBNODE_DIR/this_is_skipped_build_requirement"
                                                reinstall_skip 'Skipped because being an only-build-time dependency of already latest packages'
                                        fi
-                                       return
+                                       return 1
                                fi
                        fi
                        if [ \( $opt_skip_unchanged = no -a -e "$REINSTALL_DBNODE_DIR/succeeded_once" \) \
@@ -896,21 +888,21 @@ reinstall_exec ()
                                                fileedit_add_a_line_if_new "$REINSTALL_ORIGIN" \
                                                        "${DBDIR}/todo_after_requirements_succeed.${REINSTALL_DBSUFFIX}.list"
                                                reinstall_skip 'Skipped because being already latest or failed as well as the all requirements'
-                                               return
+                                               return 1
                                        fi
                                fi
                        fi
                fi
-               reinstall_skip_if_in_a_list 'Marked to be manually-done' manually_done.list restore && return
+               reinstall_skip_if_in_a_list 'Marked to be manually-done' manually_done.list restore && return 1
        fi
-       reinstall_skip_if_in_a_list 'Skipped because being a hold package' conf/HOLD:PORTS.parsed restore && return
+       reinstall_skip_if_in_a_list 'Skipped because being a hold package' conf/HOLD:PORTS.parsed restore && return 1
        if database_query_is_a_port_suppressed "$REINSTALL_ORIGIN"
        then
                reinstall_restore_if_temporarily_deinstalled
                reinstall_skip 'Skipped because being suppressed'
-               return
+               return 1
        fi
-       reinstall_skip_if_in_a_list 'Ignored because being taboo' taboo.all.list && return
+       reinstall_skip_if_in_a_list 'Ignored because being taboo' taboo.all.list && return 1
        if [ $opt_fetch_only = no ] && \
                ! reinstall_are_requirements_ready && \
                ! reinstall_chk_and_restore_requirements
@@ -925,19 +917,15 @@ reinstall_exec ()
                        done
                done
                reinstall_skip 'Skipped because the requirements cannot be ready'
-               return
-       fi
-       if [ -e "$REINSTALL_FROMNODE_DIR/installed_version" ]
-       then
-               insttarget=reinstall
-               instdesc='a reinstallation'
-       else
-               insttarget=install
-               instdesc='an installation'
+               return 1
        fi
-       temp_set_msg_current_stage "$instdesc process for $REINSTALL_ORIGPKGTAG $PROGRAM_STEP_COUNTER"
-       message_target_relations "$REINSTALL_ORIGIN"
-       message_echo "------- Starting $instdesc process --------"
+}
+
+# ============= Reinstallation of the current origin: Check sanity =============
+# Return status 0 for no sanity problem
+reinstall_exec_reinstall_check_sanity ()
+{
+       local check_sanity_msg func_pkg_inst_remote_verify_fetch func_pkg_inst_verify_pkg tmp_fetch_dir tmp_fetch_missing
        if ! reinstall_chk_stage_complete CHECK_SANITY
        then
                message_echo "Sanity Check..."
@@ -995,17 +983,18 @@ reinstall_exec ()
                                fi
                                message_fetch_only
                        fi
-                       return
+                       return 1
                fi
                message_echo
                reinstall_register_stage_complete CHECK_SANITY
        fi
-       if [ $opt_dry_run = yes ]
-       then
-               message_dry_run
-               temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-               return
-       fi
+}
+
+# ============= Reinstallation of the current origin: Installation by package =============
+# Return status 0 for success
+reinstall_exec_reinstall_by_pkg ()
+{
+       local pkg func_pkg_inst_remote_verify_fetch func_pkg_inst_remote
        if [ $REINSTALL_IS_FROZEN = yes ] || [ $opt_inst_by_pkg_if_can = yes ] && database_query_is_default_conf "$REINSTALL_ORIGIN"
        then
                if [ $REINSTALL_IS_FROZEN = yes ]
@@ -1093,7 +1082,6 @@ reinstall_exec ()
                        reinstall_deregister_stage in_bypkg
                        reinstall_tell_update_to_depandents
                        reinstall_closing_operations_after_successful_install
-                       message_echo
                        return
                fi
                reinstall_deregister_stage in_bypkg
@@ -1104,52 +1092,61 @@ reinstall_exec ()
                        message_echo "WARNING: (Re)installation-by-package is unsuccessful, so retrying by using port." >&2
                fi
        fi
-       if [ $REINSTALL_IS_FROZEN = yes ]
+       return 1
+}
+
+# ============= Reinstallation of the current origin: Freeze the port =============
+# Return status 0 for no need of freezing
+reinstall_exec_reinstall_freeze_if_necessary ()
+{
+       local pkg pkg_current
+       message_echo "(Port to freeze)"
+       _reinstall_exec__tmpcmd () { pkg_get_remote_repository_version "$REINSTALL_ORIGIN"; }
+       if ! pkg=`reinstall_execcmd_getstdout_errlog _reinstall_exec__tmpcmd` || [ -z "$pkg" ]
        then
-               message_echo "(Port to freeze)"
-               _reinstall_exec__tmpcmd () { pkg_get_remote_repository_version "$REINSTALL_ORIGIN"; }
-               if ! pkg=`reinstall_execcmd_getstdout_errlog _reinstall_exec__tmpcmd` || [ -z "$pkg" ]
-               then
-                       reinstall_restore_conflicts "$REINSTALL_ORIGIN"
-                       reinstall_restore_if_temporarily_deinstalled
-                       reinstall_errproc 'freezing'
-                       temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       reinstall_skip "ERROR: Failed to get the repository version."
-                       return
-               fi
-               pkg_current=`pkgsys_get_installed_pkg_from_origin "$REINSTALL_ORIGIN"`
-               if [ "x$pkg" = "x$pkg_current" ]
-               then
-                       message_echo "INFO: The latest repository version $pkg installed, deemed success."
-                       message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
-                       reinstall_tell_update_to_depandents
-                       reinstall_closing_operations_after_successful_install
-                       message_echo
-                       return
-               fi
-               message_echo "INFO: The latest repository version $pkg will be installed."
-               reinstall_pkg_backup || :
-               reinstall_deinstall_old_ports
-               reinstall_deinstall
-               reinstall_backup_and_delete_remaining_install_conflicts__by_pkg "$pkg"
-               _reinstall_exec__tmpcmd () { pkg_inst_remote "$pkg"; }
-               if reinstall_execcmd_tee_errlog _reinstall_exec__tmpcmd
-               then
-                       message_echo "INFO: Deemed success."
-                       message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
-                       reinstall_tell_update_to_depandents
-                       reinstall_closing_operations_after_successful_install
-                       message_echo
-                       return
-               fi
-               message_echo "ERROR: Failed install the version in the repository for a port to freeze. Dependents are locked." >&2
                reinstall_restore_conflicts "$REINSTALL_ORIGIN"
                reinstall_restore_if_temporarily_deinstalled
                reinstall_errproc 'freezing'
                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-               reinstall_skip 'Skipped because being a port to freeze.'
+               reinstall_skip "ERROR: Failed to get the repository version."
+               return 1
+       fi
+       pkg_current=`pkgsys_get_installed_pkg_from_origin "$REINSTALL_ORIGIN"`
+       if [ "x$pkg" = "x$pkg_current" ]
+       then
+               message_echo "INFO: The latest repository version $pkg installed, deemed success."
+               message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
+               reinstall_tell_update_to_depandents
+               reinstall_closing_operations_after_successful_install
+               return 1
+       fi
+       message_echo "INFO: The latest repository version $pkg will be installed."
+       reinstall_pkg_backup || :
+       reinstall_deinstall_old_ports
+       reinstall_deinstall
+       reinstall_backup_and_delete_remaining_install_conflicts__by_pkg "$pkg"
+       _reinstall_exec__tmpcmd () { pkg_inst_remote "$pkg"; }
+       if reinstall_execcmd_tee_errlog _reinstall_exec__tmpcmd
+       then
+               message_echo "INFO: Deemed success."
+               message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
+               reinstall_tell_update_to_depandents
+               reinstall_closing_operations_after_successful_install
                return
        fi
+       message_echo "ERROR: Failed install the version in the repository for a port to freeze. Dependents are locked." >&2
+       reinstall_restore_conflicts "$REINSTALL_ORIGIN"
+       reinstall_restore_if_temporarily_deinstalled
+       reinstall_errproc 'freezing'
+       temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
+       reinstall_skip 'Skipped because being a port to freeze.'
+       return
+}
+
+# ============= Reinstallation of the current origin: Avoid build if any requirement port to freeze is unfrozen =============
+# Return status 0 for no concern about freezing requirements
+reinstall_exec_reinstall_avoid_if_any_unfrozen_requirements_exists ()
+{
        if grep -qFx "$REINSTALL_DBNODE_DIR/requirements.all.full" "${DBDIR}/freeze.all.list" 2> /dev/null
        then
                reinstall_restore_conflicts
@@ -1160,9 +1157,15 @@ reinstall_exec ()
                if ! database_query_are_requirements_not_locked "$REINSTALL_ORIGIN"
                then
                        reinstall_skip 'Skipped because of missing requirements to freeze.'
-                       return
+                       return 1
                fi
        fi
+}
+
+# ============= Reinstallation of the current origin: Prebuild process =============
+# Return status 1 for error end
+reinstall_exec_reinstall_prebuild ()
+{
        if [ $opt_fetch_only = no ]
        then
                if reinstall_chk_stage in_prebuild
@@ -1183,7 +1186,7 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        reinstall_errproc 'BEFOREBUILD operations'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
                message_echo "-- BEFOREBUILD operations (end)"
                reinstall_register_stage_complete BEFOREBUILD
@@ -1196,11 +1199,18 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        reinstall_errproc 'clean before build'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
                message_echo
                reinstall_register_stage_complete CLEAN_BEFORE_BUILD
        fi
+       reinstall_deregister_stage in_prebuild
+}
+
+# ============= Reinstallation of the current origin: Fetch process =============
+# Return status 1 for error end
+reinstall_exec_reinstall_fetch ()
+{
        if ! reinstall_chk_stage_complete FETCH
        then
                if ! reinstall_chk_stage FAILED_FETCH
@@ -1254,12 +1264,13 @@ reinstall_exec ()
                fi
                reinstall_register_stage_complete FETCH
        fi
-       if [ $opt_fetch_only = yes ]
-       then
-               message_fetch_only
-               return
-       fi
-       reinstall_deregister_stage in_prebuild
+}
+
+# ============= Reinstallation of the current origin: Check matching of interactive or non-interactive mode=============
+# Return status 1 for error end
+reinstall_exec_reinstall_chk_interactive_mode ()
+{
+       local to_skip msg_is_interactive
        if [ $opt_batch_ports_only = yes -o $opt_interactive_ports_only = yes ]
        then
                to_skip=no
@@ -1276,12 +1287,18 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        database_build_update_pkgname "$REINSTALL_ORIGIN" > /dev/null
                        message_echo "INFO: Further processes for this port are skipped because it is $msg_is_interactive."
-                       message_echo
                        fileedit_rm_a_line "$REINSTALL_ORIGIN" "${DBDIR}/stage.loop_list/reinst_todo.remain"
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
        fi
+}
+
+# ============= Reinstallation of the current origin: Build process=============
+# Return status 1 for error end
+reinstall_exec_reinstall_build ()
+{
+       local flag_restarted_build build_args is_build_env_modified conflicts_install
        if reinstall_chk_stage in_build
        then
                message_echo "(Restarting the previously terminated build process...)"
@@ -1301,17 +1318,16 @@ reinstall_exec ()
        then
                pkgsys_get_conflicting_installed_pkgs build "$REINSTALL_ORIGIN" \
                        | reinstall_backup_and_delete_conflicts
-               reinstall_chk_missing_requirement || return 0
+               reinstall_chk_missing_requirement || return
                if ! reinstall_make build $build_args
                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."
                        is_build_env_modified=no
-                       if pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN" \
-                               > ${TMPDIR}/reinstall_exec::conflicts_install
+                       if conflicts_install=`pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN"`
                        then
                                message_echo "INFO: Install-only conflicts are deinstalled for retrial because they may have effects on build."
-                               reinstall_backup_and_delete_conflicts < ${TMPDIR}/reinstall_exec::conflicts_install
+                               echo "$conflicts_install" | reinstall_backup_and_delete_conflicts
                                is_build_env_modified=yes
                        fi
                        if pkgsys_exists_from_orig "$REINSTALL_ORIGIN"
@@ -1335,7 +1351,7 @@ reinstall_exec ()
                                reinstall_restore_if_temporarily_deinstalled
                                reinstall_errproc 'build and clean after build failure'
                                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                               return
+                               return 1
                        fi
                        reinstall_register_stage_complete CLEAN_BEFORE_BUILD
                        _reinstall_exec__tmpcmd () { reinstall_make build MAKE_JOBS_UNSAFE=yes; }
@@ -1349,7 +1365,7 @@ reinstall_exec ()
                                reinstall_restore_if_temporarily_deinstalled
                                reinstall_errproc 'retrial of build after failure'
                                temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                               return
+                               return 1
                        fi
                        reinstall_deregister_stage in_retrial_build
                fi
@@ -1361,6 +1377,12 @@ reinstall_exec ()
        fi
        reinstall_deregister_stage in_retrial_build
        reinstall_deregister_stage in_build
+}
+
+# ============= Reinstallation of the current origin: Stage process=============
+# Return status 1 for error end
+reinstall_exec_reinstall_stage ()
+{
        if reinstall_chk_stage in_stage
        then
                message_echo "(Restarting the previously terminated staging process...)"
@@ -1376,11 +1398,24 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        reinstall_errproc 'STAGE operations'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
                reinstall_register_stage_complete STAGE
        fi
        reinstall_deregister_stage in_stage
+}
+
+# ============= Reinstallation of the current origin: Install process=============
+# Return status 1 for error end
+reinstall_exec_reinstall_install ()
+{
+       local insttarget
+       if [ -e "$REINSTALL_FROMNODE_DIR/installed_version" ]
+       then
+               insttarget=reinstall
+       else
+               insttarget=install
+       fi
        if reinstall_chk_stage in_install
        then
                message_echo "(Restarting the previously terminated installation process...)"
@@ -1398,7 +1433,7 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        reinstall_errproc 'BEFOREDEINSTALL operations'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
                message_echo "-- BEFOREDEINSTALL operations (end)"
                reinstall_register_stage_complete BEFOREDEINSTALL
@@ -1457,7 +1492,7 @@ reinstall_exec ()
                        reinstall_restore_if_temporarily_deinstalled
                        reinstall_errproc 'install'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
        fi
        reinstall_remove_needless_possible_conflict
@@ -1494,13 +1529,17 @@ reinstall_exec ()
                        reinstall_restore_conflicts "$REINSTALL_ORIGIN"
                        reinstall_errproc 'AFTERINSTALL operations'
                        temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
-                       return
+                       return 1
                fi
                message_echo "-- AFTERINSTALL operations (end)"
                reinstall_register_stage_complete AFTERINSTALL
        fi
        reinstall_deregister_stage in_install
-       reinstall_register_stage in_postinstall
+}
+
+# ============= Reinstallation of the current origin: Closing process after successful install =============
+reinstall_exec_reinstall_close ()
+{
        reinstall_restore_conflicts "$REINSTALL_ORIGIN"
        if ! reinstall_chk_stage_complete CLEAN_AFTER_INSTALL
        then
@@ -1512,6 +1551,83 @@ reinstall_exec ()
        fi
        reinstall_tell_update_to_depandents
        reinstall_closing_operations_after_successful_install
+}
+
+# ============= Reinstallation of the current origin =============
+# Return status 1 for error or incomplete end
+reinstall_exec_reinstall ()
+{
+       local insttarget instdesc
+       if [ -e "$REINSTALL_FROMNODE_DIR/installed_version" ]
+       then
+               insttarget=reinstall
+               instdesc='a reinstallation'
+       else
+               insttarget=install
+               instdesc='an installation'
+       fi
+       temp_set_msg_current_stage "$instdesc process for $REINSTALL_ORIGPKGTAG $PROGRAM_STEP_COUNTER"
+       message_target_relations "$REINSTALL_ORIGIN"
+       message_echo "------- Starting $instdesc process --------"
+       reinstall_exec_reinstall_check_sanity || return
+       if [ $opt_dry_run = yes ]
+       then
+               message_dry_run
+               temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
+               return
+       fi
+       reinstall_exec_reinstall_by_pkg && return
+       if [ $REINSTALL_IS_FROZEN = yes ]
+       then
+               reinstall_exec_reinstall_freeze_if_necessary || return
+       fi
+       reinstall_exec_reinstall_avoid_if_any_unfrozen_requirements_exists || return
+       reinstall_exec_reinstall_prebuild || return
+       reinstall_exec_reinstall_fetch || return
+       if [ $opt_fetch_only = yes ]
+       then
+               message_fetch_only
+               return
+       fi
+       reinstall_exec_reinstall_chk_interactive_mode || return
+       reinstall_exec_reinstall_build || return
+       reinstall_exec_reinstall_stage || return
+       reinstall_exec_reinstall_install || return
+       reinstall_exec_reinstall_close_successful_install
+}
+
+# ============= Reinstallation for a flavored origin =============
+reinstall_exec ()
+{
+       local REINSTALL_ORIGIN REINSTALL_DBNODE_DIR REINSTALL_FROMNODE_DIR
+       local REINSTALL_CURRENTPKG REINSTALL_IS_CURRENTPKG_LATEST
+       local REINSTALL_PKGTAG REINSTALL_ORIGPKGTAG REINSTALL_DBSUFFIX
+       local REINSTALL_NEWPKGNAME REINSTALL_IS_FROZEN
+       REINSTALL_ORIGIN=$1
+       REINSTALL_DBNODE_DIR=${DBDIR}/requires/$REINSTALL_ORIGIN
+       REINSTALL_FROMNODE_DIR=${DBDIR}/moved_from/$REINSTALL_ORIGIN
+       REINSTALL_CURRENTPKG=`database_build_update_pkgname "$REINSTALL_ORIGIN" | tr '\n' ' ' | sed 's/ *$//'`
+       REINSTALL_IS_CURRENTPKG_LATEST=no
+       database_build_is_currentpkg_latest "$REINSTALL_ORIGIN" && REINSTALL_IS_CURRENTPKG_LATEST=yes
+       database_build_update_pkgtag "$REINSTALL_ORIGIN"
+       REINSTALL_PKGTAG=`cat "$REINSTALL_FROMNODE_DIR/pkgtag"`
+       REINSTALL_ORIGPKGTAG="$REINSTALL_ORIGIN ($REINSTALL_PKGTAG)"
+       REINSTALL_DBSUFFIX=`options_get_dependency_type`.`options_get_dependency_level`
+       REINSTALL_NEWPKGNAME=`database_build_get_new_pkgname "$REINSTALL_ORIGIN"`
+       REINSTALL_IS_FROZEN=no
+       grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes
+       message_stage_title "$PROGRAM_STEP_COUNTER $REINSTALL_ORIGPKGTAG"
+       reinstall_exec_chk_skip && reinstall_exec_reinstall || :
        message_echo
-       )
 }
+
+# ============= Indivisual make of a port for user command operations =============
+reinstall_make_individual ()
+{
+       local REINSTALL_ORIGIN REINSTALL_DBNODE_DIR
+       REINSTALL_ORIGIN=$1
+       REINSTALL_DBNODE_DIR=${DBDIR}/requires/$REINSTALL_ORIGIN
+       shift || :
+       reinstall_make_anymode "$@"
+}
+
index 1503b86..408941b 100644 (file)
@@ -170,7 +170,7 @@ command_all_parse_args ()
        options )
                _command_parse_args__chk_no_arg $#
                ;;
-       reconf | rmconf | forget | escape | restore )
+       reconf | rmconf | forget | escape | restore | make )
                misc_chk_privilege
                temp_warn_obsolete_temp_db >&2
                _command_parse_args__chk_glob_args $#
@@ -439,6 +439,7 @@ command_all_exec_irrespective_of_saved_options ()
 # ============= Execute command operations which should be done without upgrade of tools =============
 command_all_exec_before_tools_upgrade ()
 {
+       local glob origins errno
        shift || :
        case $COMMAND_MODE in
        reset )
@@ -461,6 +462,9 @@ command_all_exec_before_tools_upgrade ()
                command_show "$@"
                exit
                ;;
+       make )
+               command_pkgs_make_ports "$@"
+               ;;
        esac
 }
 
index fcab815..34c1dd4 100644 (file)
@@ -73,6 +73,7 @@ USAGE: portsreinstall [OPTIONS] [--] [command]
           | rmconf globs... | reconf globs... | forget globs...
           | escape globs... | restore globs...
           | pkgsanity [globs...]
+          | make glob [target] [arguments...]
           | packupgrade create | packupgrade crop [path] | packupgrade clean
           | show todo | show done | show resolved | show failure | show redo
           | show taboo | show need | show noneed | show restored | show deleted
index 6129ba8..9316f11 100644 (file)
@@ -211,6 +211,14 @@ The escaped packages are registered as taboo as same as \fBtaboo add\fR \fIglob\
 Restore packages specified by \fIglobs\fR escaped by \fBescape\fR command.
 The escaped packages are deregistered from taboo as same as \fBtaboo del\fR \fIglob\fR [\fIglob2\fR ...].
 .TP
+\fBmake\fR \fIglob\fR [\fItarget\fR ...] [\fIarguments\fR ...]
+Execute \fBmake\fR(1) command for ports matching the glob pattern.
+The taget and arguments are passed as they are with the arguments and environment variables customized for each port.
+The main purpose of this command is diagnosis and experimental build of unsuccessful ports.
+The result of this command will not be recognized by the (re)installation processes of \fBdo\fR and \fBredo\fR commands.
+The execution is carried out for each matching port in the alphanumeric order.
+If any port failed to execute \fBmake\fR(1) command, its exit status is returned by terminating immediately (so the following ports in the queue are skipped). 
+.TP
 \fBpackupgrade\fR \fBcreate\fR
 Create packages of the all reinstalled or newly installed ports (at a "builder" environment) with a set of scripts for upgrading another system with the same initial configuration of installed packages ("target" environment).
 One of typical examples of application can be such that the builder is a "forked" jail/chroot system constructed onto a host system by using nullfs and unionfs and the target is the host system (Refer to "Package build in a chroot system" Section).
@@ -1095,7 +1103,7 @@ Configuration file of \fBportupgrade\fR(1).
 .PP
 [NEW] \fBauto\fR command is added to \fBportsreinstall\-chroot\fR(8).
 .PP
-[NEW] \fBshow errormessage\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
+[NEW] \fBmake\fR, \fBshow errormessage\fR, \fBshow leaves\fR and \fBshow obsolete\fR commands are added.
 .PP
 [NEW] BUILDCONFLICT and INSTCONFLICT sections are added to ${LOCALBASE}/etc/portsreinstall.conf.
 .PP