OSDN Git Service

Version 3.2.0
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 29 Dec 2014 17:53:04 +0000 (02:53 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Mon, 29 Dec 2014 17:53:04 +0000 (02:53 +0900)
Bumped to a release version, with several bug fix related to the new features of this release version.

modified:   README
modified:   bin/portsreinstall
modified:   lib/libpkgsys.sh
modified:   lib/libreinstall.sh
modified:   man/portsreinstall.8

README
bin/portsreinstall
lib/libpkgsys.sh
lib/libreinstall.sh
man/portsreinstall.8

diff --git a/README b/README
index d6e286c..ea8bc92 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ================================================================================
  portsreinstall - ports upgrading utility for massive forced reinstallation
-  Version 3.2.0, December 28, 2014
+  Version 3.2.0, December 30, 2014
  Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 ================================================================================
 
index 19add3e..f03b5e5 100755 (executable)
 # ============ Set up of environment =============
 APPNAME=`basename "$0"`
 
-MYVERSION=3.2.0
-COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
+MYVERSION=3.2.0
+COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
 # Template for development versions
-MYVERSION=3.1.1+toward_3.2.0_20141228231007
-COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+\+toward_3\.[1-2]\.[0-9]+_[0-9]+|3\.[1-2]\.[0-9]+)$'
+MYVERSION=3.1.1+toward_3.2.0_20141228231007
+COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+\+toward_3\.[1-2]\.[0-9]+_[0-9]+|3\.[1-2]\.[0-9]+)$'
 MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
 MYPREFIX=${MYPREFIX:-/usr/local}
 LIBDIR=${MYPREFIX}/lib/${APPNAME}
index f2bf8ec..2d2029f 100644 (file)
@@ -79,7 +79,7 @@ pkgsys_portsmgmt_dialog4ports ()
 pkgsys_is_pkgtool ()
 {
        case $1 in
-       ports-mgmt/pkg|ports-mgmt/pkg-devel|ports-mgmt/dialog4ports|ports-mgmt/dialog4ports-static)
+       ports-mgmt/pkg|ports-mgmt/pkg-devel|ports-mgmt/dialog4ports)
                ;;
        *)      return 1;;
        esac
@@ -397,6 +397,7 @@ pkgsys_def_pkgtools ()
                pkg_delete_f ()
                {
                        pkg delete -fqy "$@"
+                       pkg -N 2> /dev/null || return 0 # If pkg(8) is deinstalled successfully
                        pkg info -e "$@" || return 0    # Countermeasure for a bug found for pkg-1.3.4 (at least not until 1.2.7_4)
                        pkg delete -fy "$@"
                }
@@ -885,8 +886,8 @@ pkgsys_create_backup_pkg ()
                message_echo "WARNING: Failed to create backup package for $pkgname." >&2
                return 1
        fi
-       dbpath=${DBDIR}/requires/$origin
-       [ -d "$dbpath" ] || dbpath=${DBDIR}/initial/$origin
+       dbpath=${DBDIR}/backup/$origin
+       [ -d "$dbpath" ] || mkdir -p "$dbpath"
        pkg_info_qL > $dbpath/previously_installed_files
        [ -d "$dstdir" ] || mkdir -p "$dstdir"
        mv "${TMPDIR}/package.tmp/$backup_pkg" "$dstdir"
@@ -946,11 +947,22 @@ pkgsys_get_backup_pkg ()
 # ============= Get a file list to be restored by the current backup package for a port origin =============
 pkgsys_get_restored_files_by_backup_pkg ()
 {
-       local origin dbpath
+       local origin
        origin=$1
-       dbpath=${DBDIR}/requires/$origin
-       [ -d "$dbpath" ] || dbpath=${DBDIR}/initial/$origin
-       cat "$dbpath/previously_installed_files" 2> /dev/null || :
+       cat "${DBDIR}/backup/$origin/previously_installed_files" 2> /dev/null || :
+}
+
+# ============= Check whether any file match restored files by the current backup package for a port origin =============
+pkgsys_chk_match_to_restored_files_by_backup_pkg ()
+{
+       local origin
+       origin=$1
+       pattern_file=$2
+       while read pattern
+       do 
+               grep -qE "$pattern" "${DBDIR}/backup/$origin/previously_installed_files" && return
+       done < $pattern_file
+       false
 }
 
 # ============= Get a package name from a package archive file name =============
@@ -1060,7 +1072,10 @@ pkgsys_get_conflicting_installed_pkgs ()
        mode=$1
        origin=$2
        tmp_conflicts=${TMPDIR}/pkgsys_get_conflicting_installed_pkgs::conflicts
-       pkg_info_Eg `pkgsys_get_conflicting_pkgs_patterns "$mode" "$origin"` > $tmp_conflicts || :
+       pkgsys_get_conflicting_pkgs_patterns "$mode" "$origin" | while read pkg_pattern
+       do
+               pkg_info_Eg "$pkg_pattern" || :
+       done > $tmp_conflicts
        cat "$tmp_conflicts"
        [ `wc -l < $tmp_conflicts` -gt 0 ]
 }      
index f054167..b9fde5b 100644 (file)
@@ -245,7 +245,7 @@ reinstall_backup_and_delete_remaining_install_conflicts ()
                        pkg=`pkg_which "$filepath"`
                        [ -z "$pkg" ] && continue
                        origin=`pkg_info_qo "$pkg"`
-                       [ x"$pkg" = x"$REINSTALL_ORIGIN" ] || echo "$pkg"
+                       [ x"$origin" = x"$REINSTALL_ORIGIN" ] || echo "$pkg"
                done
                pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN"
        } | sort -u | reinstall_backup_and_delete_conflicts
@@ -915,10 +915,8 @@ reinstall_exec ()
        if reinstall_chk_stage in_stage
        then
                message_echo "(Restarting the previously terminated staging process...)"
-               flag_restarted_stage=yes
        else
                reinstall_register_stage in_stage
-               flag_restarted_stage=no
        fi
        if ! reinstall_chk_stage_complete STAGE
        then
@@ -936,10 +934,8 @@ reinstall_exec ()
        if reinstall_chk_stage in_install
        then
                message_echo "(Restarting the previously terminated installation process...)"
-               flag_restarted_build=yes
        else
                reinstall_register_stage in_install
-               flag_restarted_build=no
        fi
        reinstall_pkg_backup || :
        if [ -e "$REINSTALL_DBNODE_DIR/BEFOREDEINSTALL.conf" ] && ! reinstall_chk_stage_complete BEFOREDEINSTALL
@@ -961,7 +957,7 @@ reinstall_exec ()
        fi
        if ! reinstall_chk_stage_complete INSTALL
        then
-               if pkgsys_is_necessary_pkgtool
+               if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
                then
                        reinstall_backup_and_delete_remaining_install_conflicts
                        reinstall_deinstall
@@ -1024,8 +1020,7 @@ reinstall_exec ()
                cat "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \
                        | while read origin_bak pkgpath_bak
                do
-                       if pkgsys_get_restored_files_by_backup_pkg "$origin_bak" \
-                               | grep -qE -f "${TMPDIR}/previously_installed_files.grep_pattern"
+                       if pkgsys_chk_match_to_restored_files_by_backup_pkg "$origin_bak" "${TMPDIR}/previously_installed_files.grep_pattern"
                        then
                                pkg_bak=`pkgsys_pkgarc_to_pkgname "$pkgpath_bak"`
                                fileedit_add_a_line_if_new "$pkg_bak:$REINSTALL_NEWPKGNAME" \
index d4c890f..0a5ead7 100644 (file)
@@ -2,7 +2,7 @@
 .\" ports reinstall installation guide
 .\" Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 .\" ==================================================================================
-.TH PORTSREINSTALL 8 "28 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "30 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
 .SH NAME
 portsreinstall \- ports upgrading utility for massive forced reinstallation
 .SH SYNOPSIS
@@ -392,7 +392,7 @@ This problem can be resolved by configuring NOPKG_* section in ${LOCALBASE}/etc/
 .TP
 \fB\-\-suppress\-pkgtools\-upadte\fR
 Keep indispensable packages for the standard function of the ports/packages system untouched.
-Concretely, this option suppresses upgrade, de/re-installation of the currently installed ports-mgmt/pkg(\-devel) and ports-mgmt/dialog4ports(\-static).
+Concretely, this option suppresses upgrade, de/re-installation of the currently installed ports-mgmt/pkg(\-devel) and ports-mgmt/dialog4ports.
 .PD
 .IP \fB\-I\fR
 .PD 0
@@ -931,11 +931,11 @@ Configuration file of \fBportupgrade\fR(1).
 .SH HISTORY
 \fBportsreinstall\fR has been developed as below.
 .TP
-3.2.0 (28 December 2014)
+3.2.0 (30 December 2014)
 .RS
 [IMPROVED] The automatic resolution of installation conflict is improved to avoid stripping due to restore\-and\-delete of backup packages that possibly occurs when the default version changes.
 .PP
-[IMPROVED] Support for cases that ports-mgmt/pkg-devel or ports-mgmt/dialog4ports-static is used are implemented.
+[IMPROVED] Support for cases that alternative version of ports\-mgmt/pkg (ports\-mgmt/pkg\-devel, switched by defining WITH_PKG=devel in /etc/make.conf) or ports-mgmt/dialog4ports (DIALOGPORT=\fIport_origin\fR in /etc/make.conf, reserved for the future) is used are implemented.
 .PP
 [BUG FIX] Reinstallation of pkg(8) could encounter error termination.
 .RE