OSDN Git Service

Fixed bugs about freezing.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Fri, 14 Sep 2018 03:17:01 +0000 (12:17 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Fri, 14 Sep 2018 03:17:01 +0000 (12:17 +0900)
 Changes to be committed:
modified:   HISTORY
modified:   lib/libcommand_flexconf.sh
modified:   lib/libmain.sh
modified:   lib/libpkgsys.sh
modified:   lib/libreinstall.sh

HISTORY
lib/libcommand_flexconf.sh
lib/libmain.sh
lib/libpkgsys.sh
lib/libreinstall.sh

diff --git a/HISTORY b/HISTORY
index 248eb05..f4daa8b 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -12,7 +12,7 @@
 [IMPROVED] It is changed to detect unflavored ports or ports with old flavor names of flavored ports as obsolete.
 [IMPROVED] The behavior with union file systems is stabilized.
 [IMPROVED] It is changed to show messages of reset ports at the stage of reloading ${LOCALBASE}/etc/portsreinstall.conf.
-[IMPROVED] It is changed so that ports to freeze are upgraded to the latest available package version.
+[IMPROVED] It is changed so that ports to freeze are upgraded to the latest available package version and deemed success.
 [IMPROVED] It is changed to unlock in all error termination.
 [IMPROVED] Inside- and outside-parent jail/chroot mounting/unmounting operations by portsreinstall-chroot(8) and portsreinstall-chroot-mount(8) are now safely protected from each other.
 [IMPROVED] The message at the exit from portsreinstall-chroot(8) builder chroot environment is modified to be less shocking.
index 2a1ca68..27d9697 100644 (file)
@@ -81,10 +81,11 @@ command_flexconf_update_taboo ()
 # ============= Register/deregister freeze ports in the command line form =============
 command_flexconf_update_freeze ()
 {
-       local COMMAND_OPERATION evalated_globs
+       local COMMAND_OPERATION evalated_globs tmp_list
        COMMAND_OPERATION=$1
        shift || :
        evalated_globs=`str_linearize_list_and "$@"`
+       tmp_list=${TMPDIR}/command_flexconf_update_freeze
        case $COMMAND_OPERATION in
        add )
                pkgsys_register_evaluated_globs add "${DBDIR}/freeze.list" "$@"
@@ -95,7 +96,22 @@ command_flexconf_update_freeze ()
                message_echo "$evalated_globs is/are deregistered from the list of ports to freeze."
                ;;
        esac
+       cat "${DBDIR}/freeze.all.list" 2> /dev/null > $tmp_list:old || :
        fileedit_combine_lists "${DBDIR}/conf/FREEZE:PORTS.parsed" "${DBDIR}/freeze.list" > ${DBDIR}/freeze.all.list
+       rm -f "$tmp_list:exists_update"
+       {
+               grep -vFx -f "$tmp_list:old" "${DBDIR}/freeze.all.list"
+               grep -vFx -f "${DBDIR}/freeze.all.list" "$tmp_list:old"
+       } | while read origin
+       do
+               touch "$tmp_list:exists_update"
+               database_build_patch_reconf "$origin"
+       done
+       if [ -e "$tmp_list:exists_update" ]
+       then
+               program_deregister_stage_complete PREPARE_FOR_INSPECT_ALL_DEPENDENCIES
+               program_deregister_stage_complete ALL_COMPLETE
+       fi
        if [ `cat "${DBDIR}/freeze.all.list" 2> /dev/null | wc -l` -gt 0 ]
        then
                message_echo "Now the following ports are registered to be freeze:"
index 6bbbcde..eca2bf7 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180914003252
+       MYVERSION=4.0.0+toward_4.1.0_20180914121445
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index 10d68f7..314c2e6 100644 (file)
@@ -12,7 +12,6 @@ PKGSYS_CMD_PKG_DELETE='pkg delete'    # Corresponding command for pkg_delete
 PKGSYS_AVR_REFETCH_TIMES_PER_SITE=1    # Average number (integer) of retrials for retrieving package or distfiles per mirror site
 PKGSYS_AVR_REFETCH_TIMES_FOR_CHKSUMERR=2       #  Number (integer) of retrials for check sum error in retrieving a package
 
-
 # ============= Get the time stamp of the ports tree =============
 pkgsys_get_timestamp_portstree ()
 {
@@ -689,8 +688,8 @@ pkgsys_def_pkgtools ()
                        origin=$1
                        origin_unflavored=`expr "$origin" : '\([^@]*\)'` || return
                        [ -n "$origin_unflavored" ] || return
-                       pkg fetch -qyU "$origin_unflavored" 2> /dev/null || return
-                       pkg=`pkg rquery -U %n-%v "$origin_unflavored" 2> /dev/null` || return
+                       pkg fetch -qyU "$origin_unflavored" || return
+                       pkg=`pkg rquery -U %n-%v "$origin_unflavored"` || return
                        echo "$pkg"
                }
                pkg_get_pkgs_timestamps ()
index bed58eb..55c6400 100644 (file)
@@ -804,7 +804,7 @@ reinstall_execcmd_getstdout_errlog ()
 {
        local func
        func=$1
-       if $func > $REINSTALL_DBNODE_DIR/error.log 2>&1
+       if $func 2> $REINSTALL_DBNODE_DIR/error.log
        then
                rm -f "$REINSTALL_DBNODE_DIR/error.log"
                return
@@ -886,6 +886,12 @@ reinstall_exec_chk_skip ()
                                reinstall_skip 'Skipped because already upgraded with a prebuilt package'
                                return 1
                        fi
+                       if [ -e "$REINSTALL_DBNODE_DIR/installed_by_freezing" ]
+                       then
+                               reinstall_restore_if_temporarily_deinstalled
+                               reinstall_skip 'Skipped because the reinstallation has been deemed already completed by freezing'
+                               return 1
+                       fi
                        reinstall_skip_if_in_a_list 'Skipped because the reinstallation has been already completed' \
                                "success.${REINSTALL_DBSUFFIX}.list" restore && return 1
                        if [ $opt_skip_unchanged = yes ]
@@ -1024,7 +1030,14 @@ reinstall_exec_reinstall_by_pkg ()
        then
                if [ $REINSTALL_IS_FROZEN = yes ]
                then
-                       pkg=`pkg_get_remote_repository_version "$REINSTALL_ORIGIN" || :`
+                       pkg=`pkg_get_remote_repository_version "$REINSTALL_ORIGIN" 2> /dev/null || :`
+                       if [ -z "$pkg" ]
+                       then
+                               message_echo "WARNING: No package for $REINSTALL_ORIGIN is found in the repository." >&2
+                       elif [ "$pkg" != "$REINSTALL_NEWPKGNAME" ]
+                       then
+                               message_echo "WARNING: (For freezing) A different package version ($pkg) is found for $REINSTALL_ORIGIN in the repository." >&2
+                       fi
                else
                        pkg=$REINSTALL_NEWPKGNAME
                fi
@@ -1035,7 +1048,7 @@ reinstall_exec_reinstall_by_pkg ()
                else
                        reinstall_register_stage in_bypkg
                fi
-               if ! reinstall_chk_stage_complete INSTALL_BY_PKG
+               if [ -n "$pkg" ] && [ "$pkg" = "$REINSTALL_NEWPKGNAME" ] && ! reinstall_chk_stage_complete INSTALL_BY_PKG
                then
                        if ! reinstall_chk_stage FAILED_INSTALL_BY_PKG
                        then
@@ -1122,6 +1135,9 @@ reinstall_exec_reinstall_by_pkg ()
                if [ $opt_fetch_only = yes ]
                then
                        message_echo "INFO: Continue to fetch distfiles in case of installation by port."
+               elif [ $REINSTALL_IS_FROZEN = yes ]
+               then
+                       message_echo "WARNING: Correct (re)installation-by-package is unsuccessful, so retrying to freeze." >&2
                else
                        message_echo "WARNING: (Re)installation-by-package is unsuccessful, so retrying by using port." >&2
                fi
@@ -1153,8 +1169,9 @@ reinstall_exec_reinstall_freeze_if_necessary ()
                message_echo "INFO: The latest repository version $pkg installed, deemed success."
                message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
                reinstall_tell_update_to_depandents
+               touch "$REINSTALL_DBNODE_DIR/installed_by_freezing"
                reinstall_closing_operations_after_successful_install
-               return 1
+               return
        fi
        message_echo "INFO: The latest repository version $pkg will be installed."
        reinstall_pkg_backup || :
@@ -1167,6 +1184,7 @@ reinstall_exec_reinstall_freeze_if_necessary ()
                message_echo "INFO: Deemed success."
                message_echo "WARNING: This action may cause problems due to the version/option mismatch." >&2
                reinstall_tell_update_to_depandents
+               touch "$REINSTALL_DBNODE_DIR/installed_by_freezing"
                reinstall_closing_operations_after_successful_install
                return
        fi
@@ -1175,7 +1193,7 @@ reinstall_exec_reinstall_freeze_if_necessary ()
        reinstall_restore_if_temporarily_deinstalled
        reinstall_errproc 'freezing'
        reinstall_skip 'Skipped because being a port to freeze.'
-       return
+       return 1
 }
 
 # ============= Reinstallation of the current origin: Avoid build if any requirement port to freeze is unfrozen =============
@@ -1648,6 +1666,7 @@ reinstall_exec_reinstall ()
        if [ $REINSTALL_IS_FROZEN = yes ]
        then
                reinstall_exec_reinstall_freeze_if_necessary || return
+               return
        fi
        reinstall_exec_reinstall_avoid_if_any_unfrozen_requirements_exists || return
        reinstall_exec_reinstall_prebuild || return
@@ -1684,7 +1703,6 @@ reinstall_exec ()
        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
-       set +x
        message_stage_title "$PROGRAM_STEP_COUNTER $REINSTALL_ORIGPKGTAG"
        reinstall_exec_chk_skip && reinstall_exec_reinstall || :
        message_echo