OSDN Git Service

[CHANGED] The keyword for identifying build failure is separated into "build" and...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 22 Aug 2018 14:39:03 +0000 (22:39 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 22 Aug 2018 14:39:03 +0000 (22:39 +0800)
 Changes to be committed:
modified:   bin/portsreinstall
modified:   lib/chroot-mount/liboptions.sh
modified:   lib/chroot-mount/libusage.sh
modified:   lib/chroot/libcommand.sh
modified:   lib/chroot/libcommand_do.sh
modified:   lib/chroot/liboptions.sh
modified:   lib/chroot/libusage.sh
modified:   lib/libcommand.sh
modified:   lib/libcommand_do.sh
modified:   lib/libmain.sh
modified:   lib/libreinstall.sh
modified:   lib/main/libcommand.sh
modified:   lib/main/liboptions.sh
modified:   lib/main/libusage.sh
modified:   lib/upgrade/liboptions.sh
modified:   lib/upgrade/libusage.sh
modified:   man/portsreinstall.8

17 files changed:
bin/portsreinstall
lib/chroot-mount/liboptions.sh
lib/chroot-mount/libusage.sh
lib/chroot/libcommand.sh
lib/chroot/libcommand_do.sh
lib/chroot/liboptions.sh
lib/chroot/libusage.sh
lib/libcommand.sh
lib/libcommand_do.sh
lib/libmain.sh
lib/libreinstall.sh
lib/main/libcommand.sh
lib/main/liboptions.sh
lib/main/libusage.sh
lib/upgrade/liboptions.sh
lib/upgrade/libusage.sh
man/portsreinstall.8

index 96bbab8..af657f4 100755 (executable)
@@ -114,9 +114,6 @@ main_reflect_conf_changes
 
 # ============= Database construction =============
 
-# Execute command operations which must be done before the database construction
-command_all_exec_before_build_database "$@"
-
 # Execute command operations of database construction
 command_all_exec_build_database "$@"
 
index 467fed1..fe58113 100644 (file)
@@ -18,6 +18,7 @@ h     help    opt_help_mode   0       1
 h      short-help      opt_help_mode   0       1
 V      show-version    opt_show_version        no      yes
 a      batch-mode      opt_batch_mode  no      yes
+J      just-save-options       opt_just_save_options   no      yes
 S      no-opening-message      opt_no_opening_message  no      yes
 eof
 }
index e60d80c..57b7123 100644 (file)
@@ -20,6 +20,7 @@ USAGE: ${APPNAME} [OPTIONS] [--] [command]
  -V : Show the current version.
  <Group 2: Effective anytime>
  -a : Suppress messages to be batch-friendly.
+ -J : Exit by doing nothing but just saving the options and command mode
  -S : Suppress the credit, opening and terminating messages.
 
 [ARGUMENTS]
index 96166b5..46316bb 100644 (file)
@@ -162,20 +162,13 @@ command_all_exec_before_tools_upgrade ()
 command_all_exec_main ()
 {
        case $COMMAND_MODE in
-       do)
+       do | auto )
                command_do_pre
                command_do_starter_portsnap
                command_do_starter_pkg
                command_do_starter_clean
                command_do_main_init_resinst
-               command_do_chroot_enter_if_incomplete
-               command_do_post
-               command_do_ending_process
-               ;;
-       auto)
-               shift || :
-               command_do_pre
-               command_do_auto_if_incomplete "$@"
+               command_do_chroot_enter_if_incomplete "$@"
                command_do_post
                command_do_ending_process
                ;;
index bc25789..4b030de 100644 (file)
@@ -47,26 +47,29 @@ eof
                ;;
        esac
        chroot "$opt_basedir"/builder "$shellcmd"
+       exitstatus=$?
+       echo "$exitstatus" > ${DBDIR}/recent_exit_status
+       return $exitstatus
+}
+
+# ============= Execute in the chroot environment automatically repeating by fixing the file systems =============
+_command_do_auto_repeat_by_fixing_fs ()
+{
+       until "$@" || ! command_do_chk_unionfs_error_at_chroot
+       do
+               message_echo "INFO: Retrying by re-mounting the file systems for the builder chroot environment." >&2
+               fs_unmount
+               fs_mount
+       done
 }
 
 # ============= Continue reinstallation in the guest =============
 command_do_chroot_enter_fullcourse ()
 {
-       local shellcmd exitstatus
-       message_section_title "Full course main: Continue the reinstallation process"
+       local exitstatus opt_quiet
+       message_section_title "Full course main: Reinstallation process"
        [ $opt_batch_mode = yes ] && opt_quiet='-a '
        chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -S $opt_quiet
-}
-
-# ============= Enter the guest =============
-command_do_chroot_enter ()
-{
-       if [ $opt_fullcourse = no ]
-       then
-               command_do_chroot_enter_shell
-       else
-               command_do_chroot_enter_fullcourse
-       fi
        exitstatus=$?
        echo "$exitstatus" > ${DBDIR}/recent_exit_status
        return $exitstatus
@@ -75,7 +78,7 @@ command_do_chroot_enter ()
 # ============= Enter the guest and execute portsreinstall(8) automatically =============
 command_do_chroot_auto ()
 {
-       local exitstatus
+       local exitstatus opt_quiet
        [ $opt_batch_mode = yes ] && opt_quiet='-a '
        message_cat <<eof
 =========================================================
@@ -90,6 +93,27 @@ eof
        return $exitstatus
 }
 
+# ============= Enter the guest =============
+command_do_chroot_enter ()
+{
+       if [ $COMMAND_MODE = auto ]
+       then
+               [ $opt_fullcourse = yes ] && message_section_title "Full course main"
+               _command_do_auto_repeat_by_fixing_fs command_do_chroot_auto "$@"
+       elif [ $opt_fullcourse = no ]
+       then
+               if ! command_do_chroot_enter_shell
+               then
+                       message_echo "INFO: The last exit status in the builder chroot environment was non-zero." >&2
+                       command_do_chk_unionfs_error_at_chroot && \
+                               message_echo "INFO: Executing ${APPNAME} again may be sufficient for the troubleshooting." >&2
+               fi
+       else
+               _command_do_auto_repeat_by_fixing_fs command_do_chroot_enter_fullcourse
+       fi
+       return `command_do_get_recent_chroot_exit_status`
+}
+
 # ============= Update of the files affecting package installation of the host environment  =============
 command_do_update_host_files ()
 {
@@ -181,7 +205,7 @@ command_do_starter_portsnap ()
                local mode stdout
                [ $opt_fullcourse = no ] && return
                message_section_title "Full course starter: Update the ports tree"
-               if [ -e "$opt_basedir/builder/var/db/portsnap/INDEX" ]
+               if [ -e "$opt_basedir/builder$PORTSNAP_WORKDIR/INDEX" ]
                then
                        mode=update
                else
@@ -253,26 +277,9 @@ command_do_main_init_resinst ()
                local exitstatus
                [ $opt_fullcourse = no ] && return
                message_section_title "Full course main: Initiate the reinstallation process"
-               if [ ! -e "$opt_basedir/builder/${DBDIR_PROG}/saved_options.sh" ]
-               then
-                       if [ $opt_batch_mode = no ]
-                       then
-                               opts='-CGjqx'
-                       else
-                               opts='-CGYajqx'
-                       fi
-                       if ! chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -S $opts
-                       then
-                               exitstatus=$?
-                               program_register_stage_complete UPGRADE_GUEST
-                               message_echo "INFO: The last exit status in the builder chroot environment was non-zero." >&2
-                               command_do_chk_unionfs_error_at_chroot && \
-                                       message_echo "INFO: Executing ${APPNAME} again may be sufficient for the troubleshooting." >&2
-                               exit $exitstatus
-                       fi
-                       command_do_chroot_postprocess
-               fi
-               program_register_stage_complete UPGRADE_GUEST
+               opts=
+               [ $opt_batch_mode = yes ] && opts='-Ya'
+               chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -SJCGjqx $opts
                message_echo
        }
        program_exec_and_record_completion STARTER_GUEST_INIT_REINST
@@ -287,35 +294,7 @@ command_do_chroot_enter_if_incomplete ()
        _program_exec_and_record_completion__operation ()
        {
                local exitstatus
-               if ! command_do_chroot_enter
-               then
-                       exitstatus=`command_do_get_recent_chroot_exit_status`
-                       message_echo "INFO: The last exit status in the builder chroot environment was non-zero." >&2
-                       command_do_chk_unionfs_error_at_chroot && \
-                               message_echo "INFO: Executing ${APPNAME} again may be sufficient for the troubleshooting." >&2
-                       exit $exitstatus
-               fi
-               command_do_chroot_postprocess
-               message_echo
-       }
-       program_exec_and_record_completion UPGRADE_GUEST
-}
-
-# ============= Enter the chroot environment and execute portsreinstall automatically =============
-command_do_auto_if_incomplete ()
-{
-       local PROGRAM_DEPENDS
-       command_do_chk_build_completion || program_deregister_stage_complete UPGRADE_GUEST
-       PROGRAM_DEPENDS='CLEANUP_GUEST'
-       _program_exec_and_record_completion__operation ()
-       {
-               local exitstatus
-               until command_do_chroot_auto "$@" || ! command_do_chk_unionfs_error_at_chroot
-               do
-                       message_echo "INFO: Retrying by re-mounting the file systems for the builder chroot environment." >&2
-                       fs_unmount
-                       fs_mount
-               done
+               command_do_chroot_enter
                exitstatus=`command_do_get_recent_chroot_exit_status`
                [ "$exitstatus" -gt 0 ] && exit $exitstatus
                command_do_chroot_postprocess
index ba63846..a167011 100644 (file)
@@ -20,6 +20,7 @@ H     long-help       opt_help_mode   0       2
 V      show-version    opt_show_version        no      yes
 a      batch-mode      opt_batch_mode  no      yes
 E      extra-dirs-delim        opt_extra_dirs_delim    ,       :
+J      just-save-options       opt_just_save_options   no      yes
 M      reset-minor-options     opt_reset_minor_options no      yes
 S      no-opening-message      opt_no_opening_message  no      yes
 eof
index f00bb5a..fd7629f 100644 (file)
@@ -21,6 +21,7 @@ USAGE: portsreinstall-chroot [OPTIONS] [--] [command]
  <Group 2: Effective anytime>
  -a : Suppress messages to be batch-friendly.
  -E delimiter(s) : Custom delimiter character(s) for -e option.
+ -J : Exit by doing nothing but just saving the options and command mode
  -S : Suppress the credit, opening and terminating messages.
  <Group 3: Saved and not renewable until cleaning>
  -b : Base directory of the chroot environment (default: /home/.portsreinstall-chroot).
index 1d73223..5d8ce58 100644 (file)
@@ -100,7 +100,7 @@ command_all_exec_before_tools_upgrade ()
 }
 
 # ============= Execute command operations which must be done before the database construction =============
-command_all_exec_before_build_database ()
+command_all_exec_command_specific_preconfiguration ()
 {
 }
 
index 8bb43fc..cd8b594 100644 (file)
@@ -7,14 +7,14 @@
 # ==============================================================================
 
 # ============= Operation of redo command before the database reconstruction =============
-command_do_do__command_all_exec_before_build_database ()
+command_do_do__command_all_exec_command_specific_preconfiguration ()
 {
        program_deregister_stage_complete FORGET::PREPARATION_INSPECT_MASTER
        program_deregister_stage_complete ALL_COMPLETE
 }
 
 # ============= Operation of redo command before the database reconstruction =============
-command_do_redo__command_all_exec_before_build_database ()
+command_do_redo__command_all_exec_command_specific_preconfiguration ()
 {
        program_deregister_stage_complete REDO_INIT
        if [ $opt_reset_targets = yes ]
@@ -23,7 +23,7 @@ command_do_redo__command_all_exec_before_build_database ()
                program_deregister_stage_complete PREPARE_FOR_INSPECT_ALL_DEPENDENCIES
                rm -rf "${DBDIR}/targets"
        fi
-       command_do_do__command_all_exec_before_build_database
+       command_do_do__command_all_exec_command_specific_preconfiguration
 }
 
 # ============= Meta process for redo =============
index b5ed502..e2adde7 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_20180822013227
+       MYVERSION=4.0.0+toward_4.1.0_20180822223450
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
@@ -282,6 +282,11 @@ main_setup_parameters ()
        
        # Execute command operations which should be carried out just after completing the option settings
        command_all_exec_just_after_option_settings "$@"
+
+       # ============= Command-specific pre-configuration =============
+       
+       # Execute command operations which must be done before the database construction
+       command_all_exec_command_specific_preconfiguration "$@"
        
        # ============= Configurations =============
        
@@ -296,6 +301,11 @@ main_setup_parameters ()
        
        # Load the saved configuration
        main_load_conf
+       if [ $opt_just_save_options = yes ]
+       then
+               message_echo "(Save-options-only mode)"
+               exit
+       fi
 }
 
 # ============= Operation without packages management tools =============
index 3b8643f..c654100 100644 (file)
@@ -1386,7 +1386,7 @@ reinstall_exec_reinstall_build ()
                                fi
                                reinstall_restore_conflicts "$REINSTALL_ORIGIN"
                                reinstall_restore_if_temporarily_deinstalled
-                               reinstall_errproc 'build and clean after build failure'
+                               reinstall_errproc 'clean after build failure'
                                return 1
                        fi
                        reinstall_register_stage_complete CLEAN_BEFORE_BUILD
@@ -1399,7 +1399,12 @@ reinstall_exec_reinstall_build ()
                                fi
                                reinstall_restore_conflicts "$REINSTALL_ORIGIN"
                                reinstall_restore_if_temporarily_deinstalled
-                               reinstall_errproc 'retrial of build after failure'
+                               if [ `cat "$REINSTALL_DBNODE_DIR/failed_requirements.build.full" 2> /dev/null | wc -l` - eq 0 ]
+                               then
+                                       reinstall_errproc 'build'
+                               else
+                                       reinstall_errproc 'requirements build'
+                               fi
                                return 1
                        fi
                        reinstall_deregister_stage in_retrial_build
index fb39acc..4bfcb64 100644 (file)
@@ -494,14 +494,14 @@ command_all_exec_before_tools_upgrade ()
 }
 
 # ============= Execute command operations which must be done before the database construction =============
-command_all_exec_before_build_database ()
+command_all_exec_command_specific_preconfiguration ()
 {
        case $COMMAND_MODE in
        do )
-               command_do_do__command_all_exec_before_build_database
+               command_do_do__command_all_exec_command_specific_preconfiguration
                ;;
        redo )
-               command_do_redo__command_all_exec_before_build_database
+               command_do_redo__command_all_exec_command_specific_preconfiguration
                ;;
        esac
 }
index 1665eec..28b29dc 100644 (file)
@@ -19,6 +19,7 @@ h     short-help      opt_help_mode   0       1
 H      long-help       opt_help_mode   0       2
 V      show-version    opt_show_version        no      yes
 a      batch-mode      opt_batch_mode  no      yes
+J      just-save-options       opt_just_save_options   no      yes
 N      reset-targets   opt_reset_targets       no      yes
 M      reset-minor-options     opt_reset_minor_options no      yes
 L      reload-conf     opt_reload_conf no      yes
index ddf660d..1dd3d64 100644 (file)
@@ -20,6 +20,7 @@ USAGE: portsreinstall [OPTIONS] [--] [command]
  <Group 2: Effective anytime>
  -a : Suppress messages to be batch-friendly.
  -i : Include new targets to the "needed" list.
+ -J : Exit by doing nothing but just saving the options and command mode
  -M : Reset group 4 option settings.
  -S : Suppress the credit, opening and terminating messages.
  <Group 3: Effective only with redo command>
index 93f699c..2f7b9c8 100644 (file)
@@ -19,6 +19,7 @@ h     short-help      opt_help_mode   0       1
 H      long-help       opt_help_mode   0       2
 V      show-version    opt_show_version        no      yes
 a      batch-mode      opt_batch_mode  no      yes
+J      just-save-options       opt_just_save_options   no      yes
 M      reset-minor-options     opt_reset_minor_options no      yes
 S      no-opening-message      opt_no_opening_message  no      yes
 eof
index 13bc6cb..9c4fd6a 100644 (file)
@@ -20,6 +20,7 @@ USAGE: ${APPNAME} [OPTIONS] [--] [command]
  -V : Show the current version.
  <Group 2: Effective anytime>
  -a : Suppress messages to be batch-friendly.
+ -J : Exit by doing nothing but just saving the options and command mode
  -M : Reset group 4 option settings.
  -S : Suppress the credit, opening and terminating messages.
  <Group 3: Saved and transferred to restarted runs, renewable by -M option>
index 214d460..24b2aae 100644 (file)
@@ -1137,6 +1137,8 @@ Configuration file of \fBportupgrade\fR(1).
 .RS
 [NEW] Options \fB\-j\fR and \fB\-x\fR are added.
 .PP
+[NEW] Option \fB\-J\fR is added to the all utilities.
+.PP
 [NEW] Options \fB\-f\fR and \fB\-s\fR are added to \fBportsreinstall\-chroot\fR(8).
 .PP
 [NEW] \fBauto\fR and \fBdestroy\fR commands are added to \fBportsreinstall\-chroot\fR(8).
@@ -1147,6 +1149,8 @@ Configuration file of \fBportupgrade\fR(1).
 .PP
 [NEW] BUILDCONFLICT and INSTCONFLICT sections are added to ${LOCALBASE}/etc/portsreinstall.conf.
 .PP
+[CHANGED] The keyword for identifying build failure is separated into "build" and "requirements build".
+.PP
 [IMPROVED] The (Re)installation scheme is changed to skip ports whose requirements are not installed at their turns, and always retry failed build.
 .PP
 [IMPROVED] It is changed to detect unflavored ports or ports with old flavor names of flavored ports as obsolete.