# ============= 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 "$@"
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
}
-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]
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
;;
;;
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
# ============= 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
=========================================================
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 ()
{
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
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
_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
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
<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).
}
# ============= Execute command operations which must be done before the database construction =============
-command_all_exec_before_build_database ()
+command_all_exec_command_specific_preconfiguration ()
{
}
# ==============================================================================
# ============= 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 ]
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 =============
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]+))$'
}
# 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 =============
# 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 =============
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
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
}
# ============= 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
}
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
<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>
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
-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>
.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).
.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.