X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2Flibreinstall.sh;fp=lib%2Flibreinstall.sh;h=74731bc3b9f34f75f28d18b836fa8f7dea1eecf1;hb=12c96c00c54d1b56c2472457377339c11e0a00d9;hp=d24eca7c6f6995b511eafae19fd58f2e5a0a7c32;hpb=c97978d1de45f00d3348cd6e1844ec650f270159;p=portsreinstall%2Fcurrent.git diff --git a/lib/libreinstall.sh b/lib/libreinstall.sh index d24eca7..74731bc 100644 --- a/lib/libreinstall.sh +++ b/lib/libreinstall.sh @@ -25,23 +25,23 @@ reinstall_skip () message_target_relations "$REINSTALL_ORIGIN" } -# ============= Check whether a package is forbidden due to conflict ============= +# ============= Check whether a package is forbidden due to conflict (only by referring to the record) ============= reinstall_quick_chk_forbidden_conflicts () { local pkg pkg_regexp_esc pkg=$1 pkg_regexp_esc=`str_escape_regexp "$pkg"` - grep -qE "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" 2> /dev/null + env LANG=C grep -qE "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" 2> /dev/null } -# ============= Check whether a package is forbidden due to conflict ============= +# ============= Check whether a package is forbidden due to conflict (referring to both the record and the actual installation) ============= reinstall_chk_forbidden_conflicts () { local pkg tmp_forbidden pkg_regexp_esc pkg=$1 tmp_forbidden=${TMPDIR}/reinstall_chk_forbidden_conflicts:forbidden pkg_regexp_esc=`str_escape_regexp "$pkg"` - grep -E "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" > $tmp_forbidden 2> /dev/null || return + env LANG=C grep -E "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" > $tmp_forbidden 2> /dev/null || return pkg_info_e `cut -d : -f 3 "$tmp_forbidden"` } @@ -97,7 +97,12 @@ reinstall_skip_if_in_a_list () message=$1 list=$2 mode=$3 - grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/$list" 2> /dev/null || return + env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/$list" 2> /dev/null || return + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` + if [ -n "$REINSTALL_ORIGIN_equiv" ] + then + env LANG=C grep -q -Fx "$REINSTALL_ORIGIN_equiv" "${DBDIR}/$list" 2> /dev/null || return + fi [ "x$mode" = xrestore ] && reinstall_restore_if_temporarily_deinstalled reinstall_skip "$message" || : } @@ -240,13 +245,15 @@ reinstall_deregister_stage_complete () # Package names of conflict are given via stdin. reinstall_backup_and_delete_conflicts () { - local pkg origin origin_regexp_esc backup_pkgdir backup_pkg + local pkg origin origin_equiv origin_regexp_esc origin_equiv_regexp_esc backup_pkgdir backup_pkg message_echo "INFO: Deinstalling conflicting packages for $REINSTALL_ORIGPKGTAG." while read pkg do origin=`pkg_info_flavored_origin "$pkg"` + origin_equiv=`database_query_get_equivalent_orgin "$origin"` message_echo "INFO: Backing up and deleting a conflict, $origin ($pkg)." origin_regexp_esc=`str_escape_regexp "$origin"` + origin_equiv_regexp_esc=`str_escape_regexp "$origin_equiv"` if [ -d "${DBDIR}/requires/$origin" ] then backup_pkgdir=${DBDIR}/backup_packages @@ -254,7 +261,7 @@ reinstall_backup_and_delete_conflicts () backup_pkgdir=${PKGREPOSITORY} fi mkdir -p "$backup_pkgdir" - if backup_pkg=`pkgsys_get_backup_pkg "$origin"` + if backup_pkg=`pkgsys_get_backup_pkg "$origin"` || backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"` then message_echo "INFO: backup package already exists as $backup_pkg" elif ! backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"` @@ -262,9 +269,16 @@ reinstall_backup_and_delete_conflicts () message_echo "WARNING: Failed to create the backup package, the conflict is kept installed." >&2 continue fi - grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \ + env LANG=C grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \ > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : + if [ -n "$origin_equiv_regexp_esc" ] + then + env LANG=C grep -v -E "^${origin_equiv_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts.tmp" \ + > ${DBDIR}/deleted_conflicts.tmp2 2> /dev/null || : + mv "${DBDIR}/deleted_conflicts.tmp2" "${DBDIR}/deleted_conflicts.tmp" + fi printf '%s\t%s\n' "$origin" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp + [ -n "$origin_equiv" ] && printf '%s\t%s\n' "$origin_equiv" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" pkg_delete_f "$pkg" || \ { @@ -294,13 +308,14 @@ reinstall_backup_and_delete_remaining_install_conflicts__by_pkg () # ============= Back up and delete remaining actual install conflict (for installation by port) ============= reinstall_backup_and_delete_remaining_install_conflicts () { - local stagedir tmp_conflicts db_conflict + local stagedir tmp_conflicts db_conflict REINSTALL_ORIGIN_equiv tmp_conflicts=${TMPDIR}/reinstall_backup_and_delete_remaining_install_conflicts db_conflict=$REINSTALL_DBNODE_DIR/possible_additional_conflict.csv message_echo "(Checking installation conflict...)" rm -rf "$db_conflict.tmp" "$tmp_conflicts".* stagedir=`database_query_get_makevar_val "$REINSTALL_ORIGIN" STAGEDIR` pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN" > $tmp_conflicts.pkgs || : + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` ( set -e cd "$stagedir" find . -not -type d @@ -309,9 +324,12 @@ reinstall_backup_and_delete_remaining_install_conflicts () [ ! -e "$filepath" ] && continue pkg=`pkg_which "$filepath" || :` [ -z "$pkg" ] && continue - grep -qFx "$pkg" "$tmp_conflicts.pkgs" && continue + env LANG=C grep -qFx "$pkg" "$tmp_conflicts.pkgs" && continue origin=`pkg_info_flavored_origin "$pkg"` [ x"$origin" = x"$REINSTALL_ORIGIN" ] && continue + [ x"$origin" = x"$REINSTALL_ORIGIN_equiv" ] && continue + origin_equiv=`database_query_get_equivalent_orgin "$origin"` + [ x"$origin_equiv" = x"$REINSTALL_ORIGIN" ] && continue printf '%s\t%s\n' "$pkg" "$filepath" >> $db_conflict.tmp done if [ -e "$db_conflict.tmp" ] @@ -363,9 +381,9 @@ reinstall_remove_needless_possible_conflict () cut -f 1 "$db_conflict" | sort -u > $tmp_db.conflict_pkg.old cut -f 1 "$db_conflict.tmp" | sort -u > $tmp_db.conflict_pkg.new suffix=`echo ":$REINSTALL_ORIGIN:$REINSTALL_NEWPKGNAME" | str_escape_replaceval_filter` - grep -vFx -f "$tmp_db.conflict_pkg.new" "$tmp_db.conflict_pkg.old" | \ + env LANG=C grep -vFx -f "$tmp_db.conflict_pkg.new" "$tmp_db.conflict_pkg.old" | \ sed -E "s/$/$suffix/" > $tmp_db.conflict_pkg.needless.filter - grep -vFx -f "$tmp_db.conflict_pkg.needless.filter" "$db_forbidden" > $db_forbidden.tmp || : + env LANG=C grep -vFx -f "$tmp_db.conflict_pkg.needless.filter" "$db_forbidden" > $db_forbidden.tmp || : mv "$db_forbidden.tmp" "$db_forbidden" mv "$db_conflict.tmp" "$db_conflict" [ `wc -l < $db_conflict` -gt 0 ] || rm "$db_conflict" @@ -374,21 +392,24 @@ reinstall_remove_needless_possible_conflict () # ============= Restoration of backed up conflict ============= reinstall_restore_conflicts () { - local origin_current tmpsrc + local origin_current tmpsrc origin_current_equiv origin_current=$1 [ $opt_fetch_only = no -a $opt_dry_run = no ] || return 0 [ -e "${DBDIR}/deleted_conflicts" ] || return 0 tmpsrc=${TMPDIR}/reinstall_restore_conflicts::deleted_conflicts cp "${DBDIR}/deleted_conflicts" "$tmpsrc" + origin_current_equiv=`database_query_get_equivalent_orgin "$origin_current"` while read origin pkg do pkg_regexp_esc=`str_escape_regexp "$pkg"` - origins_init=`database_query_initial_orgins "$origin" | grep -vFx "$origin" || :` + origins_init=`database_query_initial_orgins "$origin" | env LANG=C grep -vFx "$origin" || :` origin_replace=`echo "$origin" \ | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` [ "x$origin_replace" = "x$origin" ] && origin_replace= is_to_dereg_from_list=no - if [ -n "$origin_current" -a "x$origin" = "x$origin_current" ] || \ + origin_equiv=`database_query_get_equivalent_orgin "$origin"` + if [ -n "$origin" -a \( "x$origin" = "x$origin_current" -o "x$origin" = "x$origin_current_equiv" \) ] || \ + [ -n "$origin_equiv" -a "x$origin_equiv" = "x$origin_current" ] || \ pkg_info_e "$pkg" || pkgsys_exists_from_orig "$origin" then is_to_dereg_from_list=yes @@ -420,7 +441,7 @@ reinstall_restore_conflicts () then pkg_current= origin_current= - for origin_trial in $origin $origins_init $origin_replace + for origin_trial in $origin $origin_equiv $origins_init $origin_replace do pkg_trial=`pkgsys_get_installed_pkg_from_origin "$origin_trial" || :` [ -z "$pkg_trial" ] && continue @@ -432,33 +453,33 @@ reinstall_restore_conflicts () pkgname_msg=$pkg origin_msg=$origin [ "x$pkg_current" = "x$pkg" ] || pkgname_msg="$pkg => $pkg_current" - [ "x$origin_current" = "x$origin" ] || origin_msg="$origin => $origin_current" + [ "x$origin_current" = "x$origin" -o "x$origin_current" = "x$origin_equiv" ] || origin_msg="$origin => $origin_current" if [ $is_skipped = yes ] then message_echo "WARNING: Conflicting package is installed: $origin_msg ($pkgname_msg)" else message_echo "INFO: $origin_msg ($pkgname_msg) is already restored." - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ > ${DBDIR}/deleted_conflicts.tmp || : mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" fi continue fi [ $is_skipped = yes ] && continue - if grep -q -Fx -e "$origin" -e "$origin_replace" "${DBDIR}/taboo.all.list" 2> /dev/null + if env LANG=C grep -q -Fx -e "$origin" -e "$origin_equiv" -e "$origin_replace" "${DBDIR}/taboo.all.list" 2> /dev/null then message_echo "INFO: Restoration of a conflict, $origin ($pkg), is avoided because it is taboo." continue fi message_echo "INFO: Restoring a former conflict, $origin ($pkg)." - if ! backup_pkg=`pkgsys_get_backup_pkg "$origin"` + if ! backup_pkg=`pkgsys_get_backup_pkg "$origin"` || ! backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"` then message_echo "WARNING: No backup exists, gave up." >&2 continue fi if pkg_add_fF "$backup_pkg" then - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ > ${DBDIR}/deleted_conflicts.tmp || : mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" else @@ -473,7 +494,14 @@ reinstall_are_requirements_ready () [ -e "$REINSTALL_DBNODE_DIR/requirements.all.direct" ] || return 0 while read origin do - pkgsys_exists_from_orig "$origin" || return 1 + if ! pkgsys_exists_from_orig "$origin" + then + origin_equiv=`database_query_get_equivalent_orgin "$origin"` + if [ -n "$origin_equiv" ] && ! pkgsys_exists_from_orig "$origin_equiv" + then + return 1 + fi + fi done < $REINSTALL_DBNODE_DIR/requirements.all.direct } @@ -489,18 +517,30 @@ reinstall_chk_and_restore_requirements () | while read origin do pkgsys_exists_from_orig "$origin" && continue - if grep -q -Fx "$origin" "${DBDIR}/taboo.all.list" 2> /dev/null + origin_equiv=`database_query_get_equivalent_orgin "$origin"` + pkgsys_exists_from_orig "$origin_equiv" && continue + if env LANG=C grep -q -Fx "$origin" "${DBDIR}/taboo.all.list" 2> /dev/null \ + || { [ -n "$origin_equiv" ] && env LANG=C grep -q -Fx "$origin_equiv" "${DBDIR}/taboo.all.list" 2> /dev/null; } then message_echo "INFO: Restoration of a requirement [$origin] is avoided because it is set taboo." touch "$tmp_isfailed" break fi - origins_init=`database_query_initial_orgins "$origin" | grep -vFx "$origin" || :` + if [ -n "$origin_equiv" ] + then + origins_init=`{ database_query_initial_orgins "$origin"; database_query_initial_orgins "$origin_equiv"; } | env LANG=C grep -vFx -e "$origin" -e "$origin_equiv" || :` + else + origins_init=`{ database_query_initial_orgins "$origin"; } | env LANG=C grep -vFx "$origin" || :` + fi origin_replace=`echo "$origin" \ | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` + origin_equiv_replace=`echo "$origin_equiv" \ + | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` [ "x$origin_replace" = "x$origin" ] && origin_replace= + [ "x$origin_equiv_replace" = "x$origin_equiv" ] && origin_equiv_replace= + [ -n "$origin_replace" ] || origin_replace=$origin_equiv_replace is_installed=no - for origin_orig in $origins_init $origin_replace + for origin_orig in $origins_init $origin_replace $origin_equiv_replace do [ "x$origin_orig" = "x$origin" ] && continue if pkgsys_exists_from_orig "$origin_orig" @@ -508,7 +548,7 @@ reinstall_chk_and_restore_requirements () is_installed=yes break fi - if grep -q -Fx "$origin_orig" "${DBDIR}/taboo.all.list" 2> /dev/null + if env LANG=C grep -q -Fx "$origin_orig" "${DBDIR}/taboo.all.list" 2> /dev/null then message_echo "INFO: Restoration of a requirement [$origin_orig] is avoided because it is set taboo." touch "$tmp_isfailed" @@ -518,13 +558,14 @@ reinstall_chk_and_restore_requirements () done [ $is_installed = yes ] && continue [ $is_installed = taboo ] && break - for origin_orig in $origin $origins_init $origin_replace + for origin_orig in $origin $origin_equiv $origins_init $origin_replace $origin_equiv_replace do pkgarc=`pkgsys_get_backup_pkg "$origin_orig"` && break done if [ -z "$pkgarc" ] then - if grep -q -Fx "$origin" "${DBDIR}/failed.list" 2> /dev/null + if env LANG=C grep -q -Fx "$origin" "${DBDIR}/failed.list" 2> /dev/null || \ + { [ -n "$origin_equiv" ] && env LANG=C grep -q -Fx "$origin_equiv" "${DBDIR}/failed.list" 2> /dev/null; } then touch "$tmp_isfailed" break @@ -546,7 +587,7 @@ reinstall_chk_and_restore_requirements () message_echo "INFO: Restoring a backed-up requirement [$origin ($pkg)]." if pkg_add_fF "$pkgarc" then - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" else @@ -562,7 +603,7 @@ reinstall_pkg_backup () { local backup_pkg pkg reinstall_chk_stage_complete PKG_BACKUP && return - pkg=`echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | grep -v '^$' | tail -n 1` + pkg=`echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | env LANG=C grep -v '^$' | tail -n 1` if [ -n "$pkg" ] then message_echo "-- (Creating temporary backup package for $REINSTALL_ORIGPKGTAG)" @@ -581,7 +622,7 @@ reinstall_pkg_backup () # ============= Deinstallation of the currently installed package ============= reinstall_deinstall () { - local tmp_installedpkg installed_pkgs dev_out dev_err + local tmp_installedpkg REINSTALL_ORIGIN_equiv installed_pkgs dev_out dev_err dev_out=/dev/stdout dev_err=/dev/stderr if [ $opt_batch_mode = yes ] @@ -593,7 +634,8 @@ reinstall_deinstall () pkgsys_get_installed_pkg_from_origin "$REINSTALL_ORIGIN" > $tmp_installedpkg [ `wc -l < $tmp_installedpkg` -gt 0 ] || return 0 installed_pkgs=`tr '\n' ' ' < $tmp_installedpkg | sed 's/ *$//'` - if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN" + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` + if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN" || pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN_equiv" then message_echo "INFO: Deinstalling $installed_pkgs by $PKGSYS_CMD_PKG_DELETE." pkg_delete_f $installed_pkgs || \ @@ -624,13 +666,15 @@ reinstall_deinstall_old_ports () while read origin_old do pkgsys_get_installed_pkg_from_origin "$origin_old" + origin_old_equiv=`database_query_get_equivalent_orgin "$origin_old"` + pkgsys_get_installed_pkg_from_origin "$origin_old_equiv" done < $REINSTALL_FROMNODE_DIR/old_origs | reinstall_backup_and_delete_conflicts } # ============= Recovery after failure of installation of the new package ============= reinstall_failed_install_recover () { - local backedup_version backup_pkg dev_out dev_err + local backedup_version backup_pkg dev_out dev_err REINSTALL_ORIGIN_equiv dev_out=/dev/stdout dev_err=/dev/stderr if [ $opt_batch_mode = yes ] @@ -647,7 +691,9 @@ reinstall_failed_install_recover () message_echo "INFO: Trying to deinstall by ports to make sure (This may cause negligible warnings)." reinstall_make deinstall > $dev_out 2> $dev_err|| : backedup_version=`cat "$REINSTALL_FROMNODE_DIR/backedup_version" 2> /dev/null || :` - if grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/taboo.all.list" 2> /dev/null + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` + if env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/taboo.all.list" 2> /dev/null || \ + { [ -n "$REINSTALL_ORIGIN_equiv" ] && env LANG=C grep -q -Fx "$REINSTALL_ORIGIN_equiv" "${DBDIR}/taboo.all.list" 2> /dev/null; } then message_echo "INFO: Restoration of the backup of $backedup_version is avoided because it is taboo." elif [ -n "$backedup_version" ] @@ -680,8 +726,10 @@ reinstall_failed_install_recover () # ============= Report an installation success to the all dependents ============= reinstall_tell_update_to_depandents () { - local tag level dbsuffix + local REINSTALL_ORIGIN_equiv tag level dbsuffix pkgsys_is_pkgtool "$REINSTALL_ORIGIN" && return + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` + pkgsys_is_pkgtool "$REINSTALL_ORIGIN_equiv" && return reinstall_chk_stage_complete TELL_UPDATE_TO_DEPANDENTSL && return for tag in all run build none do @@ -695,6 +743,11 @@ reinstall_tell_update_to_depandents () | sort -u \ | while read origin_dependent do + echo "$origin_dependent" + origin_dependent_equiv=`database_query_get_equivalent_orgin "$origin_dependent"` + [ -z "$origin_dependent_equiv" ] || echo "$origin_dependent_equiv" + done | while read origin_dependent + do [ -d "${DBDIR}/requires/$origin_dependent" ] || continue touch "${DBDIR}/requires/$origin_dependent/need_reinstall_due_to_upgraded_requirements.$dbsuffix" fileedit_rm_a_line "$origin_dependent" \ @@ -707,7 +760,7 @@ reinstall_tell_update_to_depandents () reinstall_register_stage_complete TELL_UPDATE_TO_DEPANDENTS } -# ============= Closing operations after an installation success ============= +# ============= Closing operations after a successful installation ============= reinstall_closing_operations_after_successful_install () { local tag level @@ -730,15 +783,17 @@ reinstall_closing_operations_after_successful_install () } | sort -u | while read initial_orig do initial_orig_regexp=`str_escape_regexp "$initial_orig"` - grep -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" 2> /dev/null \ + initial_orig_equiv=`database_query_get_equivalent_orgin "$initial_orig"` + initial_orig_equiv_regexp=`str_escape_regexp "$initial_orig_equiv"` + env LANG=C grep -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" 2> /dev/null \ | cut -f 2 | while read initial_pkg do pkg_regexp=`str_escape_regexp "$initial_pkg"` - grep -v -E "^${pkg_regexp}:" "${DBDIR}/forbidden_conflicts" \ + env LANG=C grep -v -E "^${pkg_regexp}:" "${DBDIR}/forbidden_conflicts" \ > ${DBDIR}/forbidden_conflicts.tmp 2> /dev/null || : mv "${DBDIR}/forbidden_conflicts.tmp" "${DBDIR}/forbidden_conflicts" done - grep -v -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" \ + env LANG=C grep -v -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" \ > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" pkgsys_delete_backup_pkg "$initial_orig" @@ -758,21 +813,21 @@ reinstall_fetch_missing_distfiles () tmp_missing_fetch=${TMPDIR}/reinstall_fetch_missing_distfiles:missing_fetch.sh rm -rf "$tmp_fetch.pre" reinstall_make_anymode fetch-list 2> /dev/null > $tmp_fetch.src || return - grep '^SHA256[[:space:]]' "$port_path/distinfo" | \ + env LANG=C grep '^SHA256[[:space:]]' "$port_path/distinfo" | \ sed -E 's/^SHA256[[:space:]]+\(([^)]*)\).*/\1/' | \ while read relative_distfile_path do if ! { testhash=`( cd "${DISTDIR}" && sha256 "$relative_distfile_path" ) 2> /dev/null` && \ - grep -qxF "$testhash" "$port_path/distinfo"; } + env LANG=C grep -qxF "$testhash" "$port_path/distinfo"; } then relative_distfile_path_ptn=`str_escape_regexp "|| echo \"$relative_distfile_path\" not fetched; }"` - if grep -E "$relative_distfile_path_ptn$" "$tmp_fetch.src" + if env LANG=C grep -E "$relative_distfile_path_ptn$" "$tmp_fetch.src" then subdir_distfile=`dirname "$relative_distfile_path"` [ "x$subdir_distfile" = x. ] || echo "mkdir -p \"${DISTDIR}/$subdir_distfile\"" >> $tmp_fetch.pre fi fi - done | grep -v '^[[:space:]]*$' > $tmp_fetch.main || : + done | env LANG=C grep -v '^[[:space:]]*$' > $tmp_fetch.main || : [ -e "$tmp_fetch.pre" ] && sort -u "$tmp_fetch.pre" cat "$tmp_fetch.main" } @@ -817,18 +872,23 @@ reinstall_execcmd_getstdout_errlog () # Return status 0 for no problem about missing ports reinstall_chk_missing_requirement () { - local tmp_filter tmp_miising + local tmp_filter tmp_missing tmp_filter=${TMPDIR}/reinstall_chk_missing_requirement::requirements.all_but_test.unflavored - tmp_miising=${TMPDIR}/reinstall_chk_missing_requirement::missing_requirements + tmp_missing=${TMPDIR}/reinstall_chk_missing_requirement::missing_requirements message_echo "Checking whether any required package is missing or too old..." sed 's/@.*//' "$REINSTALL_DBNODE_DIR/requirements.all.full" > $tmp_filter || : - if reinstall_make missing 2> /dev/null | grep -Fx -f "$tmp_filter" > $tmp_miising + reinstall_make missing 2> /dev/null | env LANG=C grep -Fx -f "$tmp_filter" | while read missing_orig + do + missing_equiv=`database_query_get_equivalent_orgin "$missing_orig"` + [ -n "$missing_equiv" ] && ! pkg_info_eO "$missing_equiv" && echo "$missing_orig" + done > $tmp_missing + if [ `wc -l < $tmp_missing` -gt 0 ] then message_echo "Found missing/too old requirements:" - message_cat < $tmp_miising + message_cat < $tmp_missing { echo "Found missing/too old requirements:" - cat "$tmp_miising" + cat "$tmp_missing" } > "$REINSTALL_DBNODE_DIR/error.log" reinstall_restore_conflicts "$REINSTALL_ORIGIN" reinstall_restore_if_temporarily_deinstalled @@ -867,7 +927,7 @@ reinstall_exec_chk_skip () if expr "$REINSTALL_CURRENTPKG" : '.* .*' > /dev/null then message_echo "WARNING: Multiple packages are registered for this port. Reinstallation is needed to fix it." >&2 - elif grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/damaged_package" 2> /dev/null + elif env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/damaged_package" 2> /dev/null then message_echo "WARNING: Installed files have invalid checksums for this port. Reinstallation is needed to fix it." >&2 else @@ -1201,7 +1261,7 @@ reinstall_exec_reinstall_freeze_if_necessary () # Return status 0 for no concern about freezing requirements reinstall_exec_reinstall_avoid_if_any_unfrozen_requirements_exists () { - if grep -qFx "$REINSTALL_DBNODE_DIR/requirements.all.full" "${DBDIR}/freeze.all.list" 2> /dev/null + if env LANG=C grep -qFx "$REINSTALL_DBNODE_DIR/requirements.all.full" "${DBDIR}/freeze.all.list" 2> /dev/null then reinstall_restore_conflicts { @@ -1354,9 +1414,10 @@ reinstall_exec_reinstall_chk_interactive_mode () # Return status 1 for error end reinstall_exec_reinstall_build () { - local flag_restarted_build build_args is_build_env_modified conflicts_install dev_out dev_err + local flag_restarted_build build_args is_build_env_modified conflicts_install dev_out dev_err REINSTALL_ORIGIN_equiv dev_out=/dev/stdout dev_err=/dev/stderr + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` if [ $opt_batch_mode = yes ] then dev_out=/dev/null @@ -1393,7 +1454,7 @@ reinstall_exec_reinstall_build () echo "$conflicts_install" | reinstall_backup_and_delete_conflicts is_build_env_modified=yes fi - if pkgsys_exists_from_orig "$REINSTALL_ORIGIN" + if pkgsys_exists_from_orig "$REINSTALL_ORIGIN" "$REINSTALL_ORIGIN_equiv" 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 || : @@ -1472,13 +1533,14 @@ reinstall_exec_reinstall_stage () reinstall_deregister_stage in_stage } -# ============= Reinstallation of the current origin: Install process============= +# ============= Reinstallation of the current origin: Install process ============= # Return status 1 for error end reinstall_exec_reinstall_install () { - local insttarget dev_out dev_err + local insttarget dev_out dev_err REINSTALL_ORIGIN_equiv dev_out=/dev/stdout dev_err=/dev/stderr + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` if [ $opt_batch_mode = yes ] then dev_out=/dev/null @@ -1579,9 +1641,10 @@ reinstall_exec_reinstall_install () | while read origin_bak pkgpath_bak do pkg_bak=`pkgsys_pkgarc_to_pkgname "$pkgpath_bak"` - if [ "$origin_bak" = "$REINSTALL_ORIGIN" ] + origin_bak_equiv=`database_query_get_equivalent_orgin "$origin_bak"` + if [ "x$origin_bak" = "x$REINSTALL_ORIGIN" -o "x$origin_bak_equiv" = "x$REINSTALL_ORIGIN" -o "x$origin_bak" = "x$REINSTALL_ORIGIN_equiv" ] then - [ "$pkg_bak" = "$REINSTALL_NEWPKGNAME" ] && continue + [ "x$pkg_bak" = "x$REINSTALL_NEWPKGNAME" ] && continue elif reinstall_quick_chk_forbidden_conflicts "$pkg_bak" then continue @@ -1703,7 +1766,7 @@ reinstall_exec () REINSTALL_DBSUFFIX=`options_get_dependency_type`.`options_get_dependency_level` REINSTALL_NEWPKGNAME=`database_build_get_new_pkgname "$REINSTALL_ORIGIN"` REINSTALL_IS_FROZEN=no - grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes + env LANG=C grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes message_stage_title "$PROGRAM_STEP_COUNTER $REINSTALL_ORIGPKGTAG" reinstall_exec_chk_skip && reinstall_exec_reinstall || : message_echo