# ============= Execute command operations which are irrespective of option settings =============
command_exec_irrespective_of_saved_options ()
{
- 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
+ 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
case $COMMAND_MODE in
ok)
dbfile=${DBDIR}/manually_done.list
_command_exec_irrespective_of_saved_options__notify_ignored_options
message_echo "Backing up and deleting the following packages for a temporary escape:"
message_echo
- for pkg in "$@"
+ for origin in `pkgsys_eval_ports_glob "$@"`
do
- origin=`pkg_info_qo "$pkg"` || :
pkgsys_register_evaluated_globs add "${DBDIR}/taboo.list" "$origin"
- message_echo " Registered $pkg ($origin) as taboo."
- if ! backup_pkg=`pkgsys_create_backup_pkg "$pkg" "${DBDIR}/backup_packages"`
+ message_echo " Registered $origin as taboo."
+ pkg=`pkg_info_qO "$origin"` || continue
+ [ -n "$pkg" ] || continue
+ if backup_pkg=`pkgsys_get_backup_pkg "$origin"`
+ then
+ message_echo "INFO: A backup package for $pkg ($origin) already exists as $backup_pkg."
+ elif backup_pkg=`pkgsys_create_backup_pkg "$pkg" "${DBDIR}/backup_packages"`
then
- message_echo "ERROR: Failed to backup $pkg ($origin)." >&2
+ message_echo " Backed up $pkg ($origin) into $backup_pkg"
+ else
+ message_echo "ERROR: Failed to back up $pkg ($origin)." >&2
message_echo >&2
continue
fi
- message_echo " Backed up $pkg ($origin) into $backup_pkg"
pkg_delete_f "$pkg" || \
{
message_echo "ERROR: Failed to deinstall $pkg ($origin)." >&2
_command_exec_irrespective_of_saved_options__notify_ignored_options
message_echo "Restoring the following temporary escaped packages:"
message_echo
- for pkg in "$@"
+ tmp_done_orig=${TMPDIR}/command_exec_irrespective_of_saved_options::restore::done_orig
+ cp /dev/null "$tmp_done_orig"
+ for origin in `pkgsys_eval_ports_glob "$@"`
do
- origin=`pkg_info_qo "$pkg"` || :
pkgsys_register_evaluated_globs remove "${DBDIR}/taboo.list" "$origin"
- message_echo " Deregistered $pkg ($origin) from taboo."
+ message_echo " Deregistered $origin from taboo."
+ origin_regexp=`str_escape_regexp "$origin"`
+ grep -E -q "^$origin_regexp$" "$tmp_done_orig" || :
+ if pkg_info_eO "$origin"
+ then
+ pkg=`pkg_info_qO "$origin"` || :
+ message_echo "WARNING: $pkg ($origin) is already installed." >&2
+ message_echo >&2
+ continue
+ fi
origin_orig=`echo "$origin" \
| sed -E -f "${DBDIR}/REVERSE_REPLACE.complete_sed_pattern"`
- [ "x$origin_orig" = "x$origin" ] && origin_orig=
- origin_replace=`echo "$origin" \
- | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"`
- [ "x$origin_replace" = "x$origin" ] && origin_replace=
- if pkg_info_e "$pkg" || pkg_info_eO "$origin" || \
- { [ -n "$origin_orig" ] && pkg_info_eO "$origin_orig"; } || \
- { [ -n "$origin_replace" ] && pkg_info_eO "$origin_replace"; }
+ if [ "x$origin_orig" = "x$origin" ] && pkg_info_eO "$origin_orig"
then
- message_echo "WARNING: $pkg ($origin) is already installed."
+ pkg_orig=`pkg_info_qO "$origin_orig"` || :
+ message_echo "WARNING: An original version of $origin ($pkg_orig, $origin_orig) is already installed." >&2
message_echo >&2
continue
fi
- message_echo "INFO: Restoring the backup of $pkg ($origin)."
- if ! backup_pkg=`pkgsys_get_backup_pkg "$origin" 2> /dev/null`
+ origin_replace=`echo "$origin" \
+ | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"`
+ if [ "x$origin_replace" != "x$origin" ]
+ then
+ if pkg_info_eO "$origin_replace"
+ then
+ pkg_replace=`pkg_info_qO "$origin_replace"` || :
+ message_echo "WARNING: A replacement of $origin ($pkg_replace, $origin_replace) is already installed." >&2
+ message_echo >&2
+ continue
+ fi
+ if backup_pkg=`pkgsys_get_backup_pkg "$origin_replace" 2> /dev/null`
+ then
+ message_echo "INFO: $origin is replaced with $origin_replace ($pkg_replace)."
+ echo "$origin_replace" >> $tmp_done_orig
+ origin=$origin_replace
+ fi
+ else
+ backup_pkg=
+ fi
+ if [ -z "$backup_pkg" ] && ! backup_pkg=`pkgsys_get_backup_pkg "$origin" 2> /dev/null`
then
- message_echo "ERROR: Backup for $pkg ($origin) is not found." >&2
+ message_echo "ERROR: Backup for $origin is not found." >&2
message_echo >&2
continue
fi
+ pkg=`pkgsys_pkgarc_to_pkgname "$backup_pkg"`
if ! pkg_add_fF "$backup_pkg"
then
message_echo "ERROR: Failed to restore $pkg ($origin)." >&2
It is noted that ports registered by \fBok\fR, \fBtaboo\fR and \fBnoneed\fR commands are NOT deleted.
Internal tables used for \fBshow\fR command keep their information regardless of this command.
.TP
-\fBescape\fR \fIpackage1\fR [\fIpackage2\fR ...]
-Back up and delete specified packages for a temporary escape mainly for resolving undeclared conflicts.
-The escaped packages are registered as taboo implying the effects of \fBtaboo add\fR \fIpackage1\fR [\fIpackage2\fR ...].
+\fBescape\fR \fIglob\fR [\fIglob2\fR ...]
+Back up and delete packages specified by \fIglobs\fR for a temporary escape mainly for resolving undeclared conflicts.
+The escaped packages are registered as taboo as same as \fBtaboo add\fR \fIglob\fR [\fIglob2\fR ...].
.TP
-\fBrestore\fR \fIpackage1\fR [\fIpackage2\fR ...]
-Restore specified packages escaped by \fBescape\fR command.
-The escaped packages are deregistered from taboo implying the effects of \fBtaboo del\fR \fIpackage1\fR [\fIpackage2\fR ...].
+\fBrestore\fR \fIglob\fR [\fIglob2\fR ...]
+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
\fBshow\fR [\fIsubject\fR] [@[\fBrun\fR|\fBbuild\fR|\fBall\fR][,[\fBdirect\fR|\fBfull\fR]]] [\fIarguments\fR]
Show the list of ports to be reinstalled.