mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
}
+# ============= Back up and delete remaining actual install conflicts =============
+reinstall_backup_and_delete_remaining_install_conflicts ()
+{
+ local stagedir
+ message_echo "(Checking installation conflict...)"
+ stagedir=`database_query_get_makevar_val "$REINSTALL_ORIGIN" STAGEDIR`
+ {
+ ( set -e
+ cd "$stagedir"
+ find . -not -type d
+ ) | sed 's|^\.||' | while read filepath
+ do
+ [ ! -e "$filepath" ] && continue
+ pkg=`pkg_which "$filepath"`
+ [ -z "$pkg" ] && continue
+ origin=`pkg_info_qo "$pkg"`
+ [ x"$pkg" = x"$REINSTALL_ORIGIN" ] || echo "$pkg"
+ done
+ pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN"
+ } | sort -u | reinstall_backup_and_delete_conflicts
+}
+
# ============= Restoration of backed up conflicts =============
reinstall_restore_conflicts ()
{
{
[ -n "$REINSTALL_CURRENTPKG" ] || return 0
reinstall_chk_stage_complete DEINSTALL && return
- echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | grep -v '^$' | while read pkg
- do
- pkg_delete_f "$pkg" || \
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_delete_f "$REINSTALL_CURRENTPKG" || \
{
- message_echo "WARNING: Failed to deinstall $pkg by $PKGSYS_CMD_PKG_DELETE." >&2
+ message_echo "WARNING: Failed to deinstall $REINSTALL_CURRENTPKG by $PKGSYS_CMD_PKG_DELETE." >&2
}
- done
+ else
+ echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | grep -v '^$' | while read pkg
+ do
+ pkg_delete_f "$pkg" || \
+ {
+ message_echo "WARNING: Failed to deinstall $pkg by $PKGSYS_CMD_PKG_DELETE." >&2
+ }
+ done
+ fi
message_echo "-- (Trying to deinstall by ports to make sure. This usually ends up with warnings.)"
reinstall_make deinstall || \
{
then
if ! reinstall_chk_stage FAILED_INSTALL_BY_PKG
then
- if [ "x$REINSTALL_ORIGIN" = 'xports-mgmt/pkg' -a "x$PKGSYS_USE_PKGNG" = xyes ]
+ if [ "x$PKGSYS_USE_PKGNG" = xyes ] \
+ && pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
then
if reinstall_deinstall && pkg_is_tool_available && pkg_info_e "$REINSTALL_NEWPKGNAME"
then
else
reinstall_register_stage FAILED_INSTALL_BY_PKG
fi
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ fi
else
reinstall_register_stage FAILED_INSTALL_BY_PKG
fi
then
[ $flag_restarted_build = yes ] && message_echo "INFO: This failure may be due to restarting from a terminated build."
is_build_env_modified=no
- if pkg_info_eO "$REINSTALL_ORIGIN"
- then
- message_echo "INFO: The currently installed package for this port is deinstalled for retrial because it may have effects on build."
- reinstall_pkg_backup || :
- reinstall_deinstall
- is_build_env_modified=yes
- fi
if pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN" \
> ${TMPDIR}/reinstall_exec::conflicts_install
then
reinstall_backup_and_delete_conflicts < ${TMPDIR}/reinstall_exec::conflicts_install
is_build_env_modified=yes
fi
+ if pkg_info_eO "$REINSTALL_ORIGIN"
+ then
+ message_echo "INFO: The currently installed package for this port is deinstalled for retrial because it may have effects on build."
+ reinstall_pkg_backup || :
+ reinstall_deinstall
+ is_build_env_modified=yes
+ fi
if [ $flag_restarted_build = no -a $is_build_env_modified = no ]
then
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ fi
reinstall_restore_conflicts "$REINSTALL_ORIGIN"
reinstall_restore_if_temporarily_deinstalled
reinstall_errproc 'build'
message_echo "INFO: Retrying the build process after cleaning for $REINSTALL_ORIGPKGTAG."
reinstall_make clean || \
{
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ fi
reinstall_restore_conflicts "$REINSTALL_ORIGIN"
reinstall_restore_if_temporarily_deinstalled
reinstall_errproc 'build and clean after build failure'
reinstall_register_stage_complete CLEAN_BEFORE_BUILD
reinstall_make build MAKE_JOBS_UNSAFE=yes || \
{
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ fi
reinstall_restore_conflicts "$REINSTALL_ORIGIN"
reinstall_restore_if_temporarily_deinstalled
reinstall_errproc 'retrial of build after failure'
return
}
fi
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ fi
reinstall_register_stage_complete BUILD
fi
reinstall_deregister_stage in_build
fi
reinstall_register_stage_complete BEFOREDEINSTALL
fi
- reinstall_deinstall
if ! reinstall_chk_stage_complete INSTALL
then
- message_echo "(Checking installation conflict...)"
- stagedir=`database_query_get_makevar_val "$REINSTALL_ORIGIN" STAGEDIR`
- {
- ( set -e
- cd "$stagedir"
- find . -not -type d
- ) | sed 's|^\.||' | while read filepath
- do
- [ -e "$filepath" ] || continue
- pkg_which "$filepath"
- done
- pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN"
- } | sort -u | reinstall_backup_and_delete_conflicts
+ if pkgsys_is_necessary_pkgtool
+ then
+ reinstall_backup_and_delete_remaining_install_conflicts
+ reinstall_deinstall
+ else
+ reinstall_deinstall
+ reinstall_backup_and_delete_remaining_install_conflicts
+ fi
if ! reinstall_chk_stage FAILED_INSTALL
then
if reinstall_make $insttarget || \
fi
if reinstall_chk_stage FAILED_INSTALL
then
- reinstall_failed_install_recover
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
+ then
+ pkg_is_tool_available || pkg_rescue_tools
+ else
+ reinstall_failed_install_recover
+ fi
if [ -e "$REINSTALL_DBNODE_DIR/AFTERINSTALL.conf" ] && \
! reinstall_chk_stage_complete FAILED_INSTALL.AFTERINSTALL
then