2 # ==============================================================================
3 # portsreinstall library script
4 # - Operations of commands as well as check of command line arguments -
5 # Copyright (C) 2013 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
6 # This software is distributed under the 2-Clause BSD License.
7 # ==============================================================================
9 # ============= Variables =============
22 # ============= Check the number of following command line arguments (in case glob arguments are needed) =============
23 _command_parse_args__chk_glob_args ()
27 [ $nargs -gt 0 ] && return
28 message_echo "ERROR: No port glob is specified." >&2
32 # ============= Check the number of following command line arguments (in case without arguments) =============
33 _command_parse_args__chk_no_arg ()
35 local nargs term_redundant_argument
37 [ $nargs -eq 0 ] && return
38 term_redundant_argument='A redundant argument is'
39 [ $nargs -gt 1 ] && term_redundant_argument='Redundant arguments are'
40 message_echo "ERROR: $term_redundant_argument specified." >&2
44 # ============= Execute command operations before getting the temporary database ready =============
45 command_exec_before_db_creation ()
47 local COMMAND_RESTART COMMAND_MODE COMMAND_OPERATION
53 COMMAND_OPERATION=${1:-normal}
55 case $COMMAND_OPERATION in
57 message_echo "INFO: The temporary database is tried to be cleaned up without checking the privilege."
63 _command_parse_args__chk_no_arg $#
68 # ============= Check and parse command line arguments =============
78 COMMAND_OPERATION=${1:-normal}
80 case $COMMAND_OPERATION in
85 _command_parse_args__chk_no_arg $#
89 COMMAND_OPERATION=${1:-all}
91 case $COMMAND_OPERATION in
95 message_echo "ERROR: Invalid operation [$COMMAND_OPERATION]; it must be empty, \"all\" or \"keepopts\"." >&2
99 _command_parse_args__chk_no_arg $#
101 ok|taboo|need|noneed)
103 [ $COMMAND_MODE = ok ] && database_query_chk_preparation_completion
104 temp_warn_obsolete_temp_db
107 case $COMMAND_OPERATION in
111 message_echo "ERROR: Missing operation which must be \"add\" or \"del\"." >&2
115 message_echo "ERROR: Invalid operation [$COMMAND_OPERATION]; it must be \"add\" or \"del\"." >&2
119 _command_parse_args__chk_glob_args $#
123 database_query_chk_preparation_completion
124 temp_warn_obsolete_temp_db
127 case $COMMAND_OPERATION in
129 if [ -e "${DBDIR}/inspected_ports_only_partially" ]
131 message_echo "ERROR: Leaf ports cannot be analyzed because the dependency inspection is partial." >&2
132 message_echo "Executing redo command with -N option by disabling -o option fixes this situation." >&2
139 message_echo "ERROR: Missing operation which must be \"add\" or \"del\"." >&2
143 message_echo "ERROR: Invalid operation [$COMMAND_OPERATION]; it must be \"add\" or \"del\"." >&2
147 _command_parse_args__chk_glob_args $#
151 if [ ! -d "${DBDIR}" ]
153 message_echo "ERROR: The temporary database has not been created yet." >&2
158 _command_parse_args__chk_no_arg $#
159 if [ -z "$COMMAND_SAVE_DIR" ]
161 message_echo "ERROR: Directory to save the temporary database archive is not specified." >&2
164 if [ ! -d "$COMMAND_SAVE_DIR" ]
166 message_echo "ERROR: Directory [$COMMAND_SAVE_DIR] is not found." >&2
172 if [ -e "${DBDIR}/in_use" ]
174 message_echo "ERROR: A temporary database exists." >&2
175 message_echo "You must execute" >&2
176 message_echo " ${APPNAME} clean" >&2
177 message_echo "before executing \"load\" command." >&2
182 _command_parse_args__chk_no_arg $#
183 if [ -z "$COMMAND_LOAD_FILE" ]
185 message_echo "ERROR: No temporary database archive is specified." >&2
188 if [ ! -f "$COMMAND_LOAD_FILE" ]
190 message_echo "ERROR: The temporary database archive is not found." >&2
193 COMMAND_LOAD_FILE=`realpath "$COMMAND_LOAD_FILE"`
196 _command_parse_args__chk_glob_args $#
199 _command_parse_args__chk_no_arg $#
201 reconf|forget|escape|restore)
203 temp_warn_obsolete_temp_db
204 _command_parse_args__chk_glob_args $#
207 database_query_chk_preparation_completion
208 temp_warn_obsolete_temp_db
209 if ! expr "$1" : '@.*' > /dev/null
211 COMMAND_SHOW_SUBJECT=${1:-todo}
214 COMMAND_SHOW_SUBJECT=todo
216 COMMAND_SHOW_OPTIONS=$1
217 if expr "$COMMAND_SHOW_OPTIONS" : '@.*' > /dev/null
219 COMMAND_SHOW_DEPTAG=`expr "$COMMAND_SHOW_OPTIONS," : '@\(.*\)' | cut -d , -f 1` || :
220 COMMAND_SHOW_LEVEL=`expr "$COMMAND_SHOW_OPTIONS," : '@\(.*\)' | cut -d , -f 2` || :
221 case $COMMAND_SHOW_DEPTAG in
224 message_echo "ERROR: Invalid show option [$COMMAND_SHOW_OPTIONS]." >&2
228 case $COMMAND_SHOW_LEVEL in
231 message_echo "ERROR: Invalid show option [$COMMAND_SHOW_OPTIONS]." >&2
237 case $COMMAND_SHOW_SUBJECT in
238 todo|done|redo|resolved|failure|taboo|need|noneed|restored|deleted|conflict)
239 _command_parse_args__chk_no_arg $#
241 initrequirements|requirements|initdependents|dependents)
242 _command_parse_args__chk_glob_args $#
245 message_echo "ERROR: Invalid subject [$COMMAND_SHOW_SUBJECT]." >&2
251 COMMAND_DO_MODE=$COMMAND_MODE
254 temp_warn_obsolete_temp_db
255 _command_parse_args__chk_no_arg $#
258 COMMAND_DO_MODE=${1:-all}
260 case $COMMAND_DO_MODE in
263 message_echo "ERROR: Invalid operation mode [$COMMAND_DO_MODE]." >&2
268 temp_warn_obsolete_temp_db
269 _command_parse_args__chk_no_arg $#
270 if [ "$COMMAND_DO_MODE" = prepare ]
272 COMMAND_RESTART=prepare
278 message_echo "ERROR: Invalid command [$COMMAND_MODE]." >&2
282 COMMAND_SHIFT=$(($num_args_init - $#))
285 # ============= Notify that option settings are reset =============
286 command_exec_without_pkgtools__notify_reset_options ()
288 message_echo "NOTE: Option settings are ignored (because of no effect) and reset."
291 # ============= Execute command operations which do not need package tools =============
292 command_exec_without_pkgtools ()
295 case $COMMAND_MODE in
297 message_echo "Starting to clean up the temporary database..."
298 command_exec_without_pkgtools__notify_reset_options
304 message_echo "Starting to load the temporary database from the archive..."
305 command_exec_without_pkgtools__notify_reset_options
306 dbdir_parent=`dirname "${DBDIR}"`
307 [ -d "$dbdir_parent" ] || mkdir -p "$dbdir_parent"
308 tar xzf "$COMMAND_LOAD_FILE" -C "$dbdir_parent" --exclude "*/.lock"
315 # ============= Notify that option settings are ignored because of no effect =============
316 _command_exec_irrespective_of_saved_options__notify_ignored_options ()
318 message_echo "NOTE: Option settings are ignored because they have no effect on this command."
321 # ============= Operations of forget command =============
324 message_echo "The temporary database is trying to forget about the specified ports as much as possible."
325 message_echo "Concretely, the data on each of the specified ports and their requirements/dependents is removed unless initially installed or required by other preserved ports."
328 # Preparation for inspection of the specified ports
330 _program_exec_and_record_completion__operation ()
332 message_section_title "Preparation for inspection of the specified ports"
333 rm -rf "${DBDIR}/forget"
334 mkdir "${DBDIR}/forget"
335 for list in masters remove_scope
337 rm -f "${DBDIR}/stage.loop_list/forget_$list"*
341 program_exec_and_record_completion FORGET::PREPARATION_INSPECT_MASTER
343 # (Re)initialization of the specified ports to inspect
344 pkgsys_eval_ports_glob "$@" > ${DBDIR}/stage.loop_list/forget_masters
346 # Inspection of the specified ports
347 PROGRAM_DEPENDS='FORGET::PREPARATION_INSPECT_MASTER'
348 _program_exec_restartable_loop_operation__routine ()
350 local origin origin_orig
352 if [ -e "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern" ]
354 origin_orig=`echo "$origin" \
355 | sed -E -f "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern"`
359 if [ ! -e "${DBDIR}/initial/$origin/installed_version" \
360 -a ! -e "${DBDIR}/initial/$origin_orig/installed_version" \
361 -a `cat "${DBDIR}/requires/$origin/dependents.all.full" 2> /dev/null | wc -l` -eq 0 ]
363 message_echo "$origin"
364 echo "$origin" >> ${DBDIR}/forget/remove.master
365 cat "${DBDIR}/requires/$origin/requirements.all.full" \
366 2> /dev/null >> ${DBDIR}/forget/remove.scope || :
367 database_build_forget "$origin"
370 _program_exec_and_record_completion__operation ()
372 message_section_title "Inspection of the specified ports"
373 message_echo "----------------"
374 program_exec_restartable_loop_operation forget_masters
375 message_echo "----------------"
376 cat "${DBDIR}/forget/remove.scope" 2> /dev/null \
377 | sort -u > ${DBDIR}/forget/remove.scope.tmp
378 mv "${DBDIR}/forget/remove.scope.tmp" "${DBDIR}/forget/remove.scope"
379 cat "${DBDIR}/forget/remove.master" "${DBDIR}/forget/remove.scope" 2> /dev/null \
380 | str_escape_regexp_filter \
381 | sed 's/^/^/;s/$/$/' > ${DBDIR}/forget/remove.scope.grep_pattern
382 ln -f "${DBDIR}/forget/remove.scope" "${DBDIR}/stage.loop_list/forget_remove_scope"
385 program_exec_and_record_completion FORGET::INSPECT_MASTER
387 # Inspection of the requirements of the specified ports to remove
388 PROGRAM_DEPENDS='FORGET::INSPECT_MASTER'
389 _program_exec_restartable_loop_operation__routine ()
391 local origin origin_orig
393 if [ -e "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern" ]
395 origin_orig=`echo "$origin" \
396 | sed -E -f "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern"`
400 if [ ! -e "${DBDIR}/initial/$origin/installed_version" \
401 -a ! -e "${DBDIR}/initial/$origin_orig/installed_version" ] \
402 && ! grep -v -E -f "${DBDIR}/forget/remove.scope.grep_pattern" \
403 "${DBDIR}/requires/$origin/dependents.all.full" \
406 message_echo "$origin"
407 database_build_forget "$origin"
408 echo "$origin" >> ${DBDIR}/forget/remove
411 _program_exec_and_record_completion__operation ()
413 message_section_title "Inspection of the requirements of the specified ports to remove"
414 message_echo "----------------"
415 program_exec_restartable_loop_operation forget_remove_scope
416 message_echo "----------------"
417 cat "${DBDIR}/forget/remove.master" "${DBDIR}/forget/remove" 2> /dev/null \
418 | str_escape_regexp_filter \
419 | sed 's/^/^/;s/$/$/' > ${DBDIR}/forget/remove.grep_pattern
420 cat "${DBDIR}/inspected_ports.update" 2> /dev/null | sort -u \
421 | grep -v -E -f "${DBDIR}/forget/remove.grep_pattern" \
422 > ${DBDIR}/inspected_ports.update.tmp || :
423 mv "${DBDIR}/inspected_ports.update.tmp" "${DBDIR}/inspected_ports.update"
426 program_exec_and_record_completion FORGET::INSPECT_REQUIREMENTS_OF_REMOVED_PORTS
428 # Set up so that ports are inspected again in the building process of the temporary database
429 program_deregister_stage_complete INSPECT_ALL_DEPENDENCIES
431 # Clean up the database for this command because it is no more effective
432 program_deregister_stage_complete FORGET::PREPARATION_INSPECT_MASTER
436 # ============= Execute command operations which are irrespective of option settings =============
437 command_exec_irrespective_of_saved_options ()
439 local dbfile tmp_manually_done_diff evalated_globs dbdir_parent dbdir_node arcfile grandtitle title isfirst origin origin_regexp backup_pkg origin_orig origin_replace pkg_orig tmp_done_orig origin_regexp
440 case $COMMAND_MODE in
442 dbfile=${DBDIR}/manually_done.list
443 [ -e "$dbfile" ] || touch "$dbfile"
444 cp "$dbfile" "$dbfile.tmp"
445 case $COMMAND_OPERATION in
447 pkgsys_register_evaluated_globs add "$dbfile.tmp" "$@"
448 message_echo "`str_linearize_list_and \"$*\"` is/are registered to the list of manually resolved ports"
451 pkgsys_register_evaluated_globs remove "$dbfile.tmp" "$@"
452 message_echo "`str_linearize_list_and \"$*\"` is/are deregistered from the list of manually resolved ports"
455 tmp_manually_done_diff_old=${TMPDIR}/command_exec_irrespective_of_saved_options:manually_done.list.diff_old
456 tmp_manually_done_diff_new=${TMPDIR}/command_exec_irrespective_of_saved_options:manually_done.list.diff_new
457 if fileedit_manipulate_old_new_lines "$dbfile" "$dbfile.tmp" \
458 "$tmp_manually_done_diff_old" "$tmp_manually_done_diff_new"
462 database_record_failure "$origin"
463 done < $tmp_manually_done_diff_old
466 database_record_success "$origin"
467 done < $tmp_manually_done_diff_new
469 mv "$dbfile.tmp" "$dbfile"
470 _command_exec_irrespective_of_saved_options__notify_ignored_options
471 message_echo "Now the following ports have been manually resolved:"
472 message_cat "$dbfile"
476 evalated_globs=`str_linearize_list_and "$@"`
477 case $COMMAND_OPERATION in
479 pkgsys_register_evaluated_globs add "${DBDIR}/taboo.list" "$@"
480 message_echo "$evalated_globs is/are registered to the list of ports to be ignored."
483 pkgsys_register_evaluated_globs remove "${DBDIR}/taboo.list" "$@"
484 message_echo "$evalated_globs is/are deregistered from the list of ports to be ignored."
487 fileedit_combine_lists "${DBDIR}/conf/TABOO:PORTS.parsed" "${DBDIR}/taboo.list" > ${DBDIR}/taboo.all.list
488 _command_exec_irrespective_of_saved_options__notify_ignored_options
489 message_echo "Now the following ports are registered to be ignored:"
490 message_cat "${DBDIR}/taboo.all.list"
494 evalated_globs=`str_linearize_list_and "$@"`
495 case $COMMAND_OPERATION in
497 pkgsys_register_evaluated_globs add "${DBDIR}/need.list" "$@"
498 message_echo "$evalated_globs is/are registered to the list of necessary ports."
501 pkgsys_register_evaluated_globs remove "${DBDIR}/need.list" "$@"
502 message_echo "$evalated_globs is/are deregistered from the list of necessary ports."
505 str_escape_regexp_filter < ${DBDIR}/need.list \
506 | sed 's/^/^/; s/$/$/' > ${DBDIR}/need.grep_pattern
508 sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern" "${DBDIR}/need.list" || :
509 cat "${DBDIR}/need.list" || :
510 } 2> /dev/null | sort -u > ${DBDIR}/need.with_replaced.list
511 program_deregister_stage_complete DETERMINE_SPECIFIED_TARGETS
512 _command_exec_irrespective_of_saved_options__notify_ignored_options
513 message_echo "Now the following ports are registered to be necessary:"
514 message_cat "${DBDIR}/need.list"
518 evalated_globs=`str_linearize_list_and "$@"`
519 case $COMMAND_OPERATION in
521 pkgsys_register_evaluated_globs add "${DBDIR}/noneed.list" "$@"
522 message_echo "$evalated_globs is/are registered to the list of unnecessary ports."
525 pkgsys_register_evaluated_globs remove "${DBDIR}/noneed.list" "$@"
526 message_echo "$evalated_globs is/are deregistered from the list of unnecessary ports."
529 program_deregister_stage_complete INSPECT_PRIMARY_LEAF_PORTS
530 _command_exec_irrespective_of_saved_options__notify_ignored_options
531 message_echo "Now the following ports are registered to be unnecessary:"
532 message_cat "${DBDIR}/noneed.list"
536 case $COMMAND_OPERATION in
538 if ! deinstall_select_leaf_ports_to_delete force
542 message_echo "INFO: No leaf port is found."
545 message_echo "INFO: Leaf ports are undefined because requirements of some ports are not fully inspected."
549 program_deregister_stage_complete COLLECT_LEAF_PORTS_TO_DELETE
553 if ! deinstall_select_obsolete_ports_to_delete force
557 message_echo "INFO: No obsolete package is found."
561 program_deregister_stage_complete COLLECT_OBSOLETE_PORTS_TO_DELETE
568 dbdir_parent=`dirname "${DBDIR}"`
569 dbdir_node=`basename "${DBDIR}"`
570 arcfile=`realpath "$COMMAND_SAVE_DIR"`/${APPNAME}_`date +%Y%m%d_%H%M%S`.tar.gz
571 _command_exec_irrespective_of_saved_options__notify_ignored_options
572 message_echo "Starting to save the temporary database as [$arcfile]..."
573 tar czf "$arcfile" -C "$dbdir_parent" "$dbdir_node"
578 _command_exec_irrespective_of_saved_options__notify_ignored_options
579 message_echo "Evaluated port origins are as follows:"
580 pkgsys_eval_ports_glob "$@"
584 _command_exec_irrespective_of_saved_options__notify_ignored_options
585 message_echo "Temporary database sections for the following ports are reset for later rebuild:"
586 for origin in `pkgsys_eval_ports_glob "$@"`
588 origin_regexp=`str_escape_regexp "$origin"`
589 if grep -q -E "^$origin_regexp$" "${DBDIR}/inspected_ports" 2> /dev/null
591 database_build_make "$origin" config
592 database_build_patch_reconf "$origin"
594 message_echo "$origin (not inspected)"
598 program_deregister_stage_complete INSPECT_ALL_DEPENDENCIES
603 _command_exec_irrespective_of_saved_options__notify_ignored_options
608 _command_exec_irrespective_of_saved_options__notify_ignored_options
609 message_echo "Backing up and deleting the following packages for a temporary escape:"
611 for origin in `pkgsys_eval_ports_glob "$@"`
613 pkgsys_register_evaluated_globs add "${DBDIR}/taboo.list" "$origin"
614 message_echo " Registered $origin as taboo."
615 pkg=`pkg_info_qO "$origin"` || continue
616 [ -n "$pkg" ] || continue
617 if backup_pkg=`pkgsys_get_backup_pkg "$origin"`
619 message_echo "INFO: A backup package for $pkg ($origin) already exists as $backup_pkg."
620 elif backup_pkg=`pkgsys_create_backup_pkg "$pkg" "${DBDIR}/backup_packages"`
622 message_echo " Backed up $pkg ($origin) into $backup_pkg"
624 message_echo "ERROR: Failed to back up $pkg ($origin)." >&2
628 pkg_delete_f "$pkg" || \
630 message_echo "ERROR: Failed to deinstall $pkg ($origin)." >&2
633 message_echo " Deinstalled $pkg ($origin)."
636 program_deregister_stage_complete INSPECT_ALL_DEPENDENCIES
641 _command_exec_irrespective_of_saved_options__notify_ignored_options
642 message_echo "Restoring the following temporary escaped packages:"
644 tmp_done_orig=${TMPDIR}/command_exec_irrespective_of_saved_options::restore::done_orig
645 cp /dev/null "$tmp_done_orig"
646 for origin in `pkgsys_eval_ports_glob "$@"`
648 pkgsys_register_evaluated_globs remove "${DBDIR}/taboo.list" "$origin"
649 message_echo " Deregistered $origin from taboo."
650 origin_regexp=`str_escape_regexp "$origin"`
651 grep -E -q "^$origin_regexp$" "$tmp_done_orig" || :
652 if pkg_info_eO "$origin"
654 pkg=`pkg_info_qO "$origin"` || :
655 message_echo "WARNING: $pkg ($origin) is already installed." >&2
659 origin_orig=`echo "$origin" \
660 | sed -E -f "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern"`
661 if [ "x$origin_orig" = "x$origin" ] && pkg_info_eO "$origin_orig"
663 pkg_orig=`pkg_info_qO "$origin_orig"` || :
664 message_echo "WARNING: An original version of $origin ($pkg_orig, $origin_orig) is already installed." >&2
668 origin_replace=`echo "$origin" \
669 | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"`
670 if [ "x$origin_replace" != "x$origin" ]
672 if pkg_info_eO "$origin_replace"
674 pkg_replace=`pkg_info_qO "$origin_replace"` || :
675 message_echo "WARNING: A replacement of $origin ($pkg_replace, $origin_replace) is already installed." >&2
679 if backup_pkg=`pkgsys_get_backup_pkg "$origin_replace" 2> /dev/null`
681 message_echo "INFO: $origin is replaced with $origin_replace ($pkg_replace)."
682 echo "$origin_replace" >> $tmp_done_orig
683 origin=$origin_replace
688 if [ -z "$backup_pkg" ] && ! backup_pkg=`pkgsys_get_backup_pkg "$origin" 2> /dev/null`
690 message_echo "ERROR: Backup for $origin is not found." >&2
694 pkg=`pkgsys_pkgarc_to_pkgname "$backup_pkg"`
695 if ! pkg_add_fF "$backup_pkg"
697 message_echo "ERROR: Failed to restore $pkg ($origin)." >&2
700 message_echo " Restored $pkg ($origin)."
703 program_deregister_stage_complete INSPECT_ALL_DEPENDENCIES
708 if [ $opt_reload_conf = yes ]
710 program_deregister_stage_complete SAVE_PREV_CONF
716 # ============= Output of "options" command =============
717 _command_exec_before_tools_upgrade__options ()
719 local opt_control group_reset group_remain reset_opts result_opts str_opt_control str_rstoption notice_reset notice_result
723 reset_opts=`options_inverse_parse $group_reset`
724 result_opts=`options_inverse_parse $group_remain`
725 if [ $is_batch_mode = yes ]
727 printf '%s\t%s\t%s\n' "$opt_control" "$reset_opts" "$result_opts"
729 str_opt_control=`echo "$opt_control" | sed -E 's/(.)/-\1 /g;s/ *$//'`
730 str_rstoption=Option`[ \`echo -n "$opt_control" | wc -c\` -ge 2 ] && echo s` || :
731 notice_reset=`[ -z "$reset_opts" ] && echo ' (nothing)'` || :
732 notice_result=`[ -z "$result_opts" ] && echo ' (default)'` || :
733 echo "$str_rstoption [$str_opt_control] will reset [$reset_opts]$notice_reset so that the settings become [$result_opts]$notice_result."
737 # ============= Execute command operations which should be done without upgrade of tools =============
738 command_exec_before_tools_upgrade ()
740 local flag_filter_skip_unchanged flag_filter_only_target pkgnamedb dbsuffix list origin_target
741 case $COMMAND_MODE in
743 message_echo "Starting to reset the temporary database by preserving the initial snapshot of installed packages..."
744 find "${DBDIR}" -depth 1 \
745 -not \( -name saved_options.sh \
746 -or -name initial -or -name MYVERSION \
747 -or -name backup_failure -or -name installed_ports\* \) \
748 -exec rm -rf {} \; 2> /dev/null || :
749 case $COMMAND_OPERATION in
751 command_exec_without_pkgtools__notify_reset_options
752 rm -f "${DBDIR}/saved_options.sh"
755 message_echo "INFO: option settings are preserved."
758 find "${DBDIR}/initial" -depth 2 -type d \
759 | sed -E 's|.*/([^/]+/[^/]+)$|\1|' > ${DBDIR}/inspected_ports.update
760 mkdir -p "${DBDIR}/stage.loop_list"
766 is_batch_mode=$opt_batch_mode
768 [ -e "${DBDIR}/saved_options.sh" ] && . "${DBDIR}/saved_options.sh"
769 savedopts=`options_inverse_parse`
770 if [ $is_batch_mode = yes ]
772 printf '\t%s\n' "$savedopts"
774 echo "The saved setting is [$savedopts]."
776 _command_exec_before_tools_upgrade__options M \
777 'renewable_anytime' 'non_renewable renewable_in_redo_on_target renewable_in_redo_on_conf'
778 _command_exec_before_tools_upgrade__options N \
779 'renewable_in_redo_on_target' 'non_renewable renewable_anytime renewable_in_redo_on_conf'
780 _command_exec_before_tools_upgrade__options L \
781 'renewable_in_redo_on_conf' 'non_renewable renewable_anytime renewable_in_redo_on_target'
782 _command_exec_before_tools_upgrade__options MN \
783 'renewable_anytime renewable_in_redo_on_target' 'non_renewable renewable_in_redo_on_conf'
784 _command_exec_before_tools_upgrade__options ML \
785 'renewable_anytime renewable_in_redo_on_conf' 'non_renewable renewable_in_redo_on_target'
786 _command_exec_before_tools_upgrade__options NL \
787 'renewable_in_redo_on_target renewable_in_redo_on_conf' 'non_renewable renewable_anytime'
788 _command_exec_before_tools_upgrade__options MNL \
789 'renewable_anytime renewable_in_redo_on_target renewable_in_redo_on_conf' 'non_renewable'
794 flag_filter_skip_unchanged=
795 flag_filter_only_target=
796 pkgnamedb='requires obsolete initial'
797 [ -n "$COMMAND_SHOW_DEPTAG" ] || COMMAND_SHOW_DEPTAG=`options_get_dependency_type`
798 [ -n "$COMMAND_SHOW_LEVEL" ] || COMMAND_SHOW_LEVEL=`options_get_dependency_level`
799 dbsuffix=$COMMAND_SHOW_DEPTAG.$COMMAND_SHOW_LEVEL
800 case $COMMAND_SHOW_SUBJECT in
801 todo|done|redo|resolved|failure|taboo|need|noneed|deleted|restored|conflict)
802 database_query_show_single_list_exec "$COMMAND_SHOW_SUBJECT" \
803 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" || :
806 grandtitle="Dependencies based on the initially installed packages"
807 title="The following port(s) was/were required by %s:"
808 list=requirements.$dbsuffix
810 [ $COMMAND_SHOW_DEPTAG = none ] && \
811 message_echo "WARNING: This command has no meaning with the current options setting." >&2
812 database_query_for_each_matching_port "$grandtitle" "$title" "$list" "$pkgnamedb" \
813 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" "$@"
816 grandtitle="Dependencies based on the latest ports tree"
817 title="The following port(s) is/are required by %s:"
818 list=requirements.$dbsuffix
819 pkgnamedb='requires obsolete'
820 [ $COMMAND_SHOW_DEPTAG = none ] && \
821 message_echo "WARNING: This command has no meaning with the current options setting." >&2
822 database_query_for_each_matching_port "$grandtitle" "$title" "$list" "$pkgnamedb" \
823 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" "$@"
826 grandtitle="Dependencies based on the initially installed packages"
827 title="The following port(s) depended on %s:"
828 list=dependents.$dbsuffix
830 [ $COMMAND_SHOW_DEPTAG = none ] && \
831 message_echo "WARNING: This command has no meaning with the current options setting." >&2
832 database_query_for_each_matching_port "$grandtitle" "$title" "$list" "$pkgnamedb" \
833 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" "$@"
836 grandtitle="Dependencies based on the latest ports tree"
837 title="The following port(s) depend(s) on %s:"
838 list=dependents.$dbsuffix
839 pkgnamedb='requires obsolete'
840 [ $COMMAND_SHOW_DEPTAG = none ] && \
841 message_echo "WARNING: This command has no meaning with the current options setting." >&2
842 database_query_for_each_matching_port "$grandtitle" "$title" "$list" "$pkgnamedb" \
843 "$COMMAND_SHOW_DEPTAG" "$COMMAND_SHOW_LEVEL" "$@"
851 # ============= Execute command operations which must be done before building the temporary database =============
852 command_exec_before_building_tempdb ()
854 case $COMMAND_MODE in
856 program_deregister_stage_complete REDO_INIT
857 if [ $opt_reset_targets = yes ]
859 program_deregister_stage_complete DETERMINE_SPECIFIED_TARGETS
860 program_deregister_stage_complete INSPECT_ALL_DEPENDENCIES
861 rm -rf "${DBDIR}/targets"
865 program_deregister_stage_complete FORGET::PREPARATION_INSPECT_MASTER
868 # ============= Execute command operations which must be done before actual (re/de)installation processes =============
869 command_exec_before_actual_re_de_installation ()
871 case $COMMAND_MODE in
873 case $COMMAND_DO_MODE in
876 Done (skipped reinstallation) at `message_timestamp`
878 You can restart this process from the aborted/terminated point by executing without options or arguments as:
881 temp_terminate_process ()