OSDN Git Service

Version 3.1.1+toward_3.2.0_20141221233254
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 21 Dec 2014 14:36:48 +0000 (23:36 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sun, 21 Dec 2014 14:36:48 +0000 (23:36 +0900)
[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.

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 02b2723..c85b6b2 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ================================================================================
  portsreinstall - ports upgrading utility for massive forced reinstallation
-  Version 3.1.1, December 17, 2014
+  Version 3.2.0, December 17, 2014
  Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 ================================================================================
 
index 8e985a7..cd109b6 100755 (executable)
 # ============ Set up of environment =============
 APPNAME=`basename "$0"`
 
-MYVERSION=3.1.1
-COMPATIBLE_VERSIONS='^(3\.1\.[0-9]+)$'
+# MYVERSION=3.2.0
+# COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
 # Template for development versions
-# MYVERSION=3.1.0+toward_3.1.1_20141206201516
-# COMPATIBLE_VERSIONS='^(3\.1\.[0-9]+\+toward_3\.1\.[0-9]+_[0-9]+|3\.1\.[0-9]+)$'
+MYVERSION=3.1.1+toward_3.2.0_20141221233254
+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 4b8330f..11415c2 100644 (file)
@@ -489,7 +489,8 @@ pkgsys_def_pkgtools ()
                        PKGNG_AUTODEPS=NO
                        PKGNG_PORTAUDIT_SITE='http=//portaudit.FreeBSD.org/auditfile.tbz'
                        # Load configuration for pkg(1)
-                       pkg_conf=`pkg query %Fp pkg | grep '/etc/pkg\.conf\.sample$' | sed 's/\.sample$//'`
+                       pkg_conf=`pkg query %Fp pkg 2> /dev/null | grep '/etc/pkg\.conf\.sample$' | sed 's/\.sample$//'` || :
+                       [ -n "$pkg_conf" ] || pkg_conf=/usr/local/etc/pkg.conf
                        grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' "$pkg_conf" 2> /dev/null \
                                | grep -e '^[[:space:]]*[A-Z0-9_]*[[:space:]]*:[[:space:]]*.*' \
                                | while read srcline
@@ -828,7 +829,7 @@ pkgsys_eval_ports_glob ()
 # ============= Create a back-up package archive =============
 pkgsys_create_backup_pkg ()
 {
-       local pkgname dstdir origin backup_pkg_old origin_regexp pkgname_ptn backup_pkg pkgpath
+       local pkgname dstdir origin backup_pkg_old pkgname_ptn backup_pkg dbpath pkgpath origin_regexp
        pkgname=$1
        dstdir=$2
        rm -rf "${TMPDIR}"/package.tmp
@@ -851,6 +852,9 @@ 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
+       pkg_info_qL > $dbpath/previously_installed_files
        [ -d "$dstdir" ] || mkdir -p "$dstdir"
        mv "${TMPDIR}/package.tmp/$backup_pkg" "$dstdir"
        pkgpath=$dstdir/$backup_pkg
@@ -890,7 +894,7 @@ pkgsys_delete_backup_pkg ()
 # ============= Get an existing package archive path for a port origin =============
 pkgsys_get_backup_pkg ()
 {
-       local origin origin_regexp
+       local origin tmpnewest origin_regexp
        origin=$1
        tmpnewest=${TMPDIR}/pkgsys_get_backup_pkg::newest
        origin_regexp=`str_escape_regexp "$origin"`
@@ -906,6 +910,16 @@ pkgsys_get_backup_pkg ()
        cat "$tmpnewest" 2> /dev/null
 }
 
+# ============= 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
+       origin=$1
+       dbpath=${DBDIR}/requires/$origin
+       [ -d "$dbpath" ] || dbpath=${DBDIR}/initial/$origin
+       cat "$dbpath/previously_installed_files" 2> /dev/null || :
+}
+
 # ============= Get a package name from a package archive file name =============
 pkgsys_pkgarc_to_pkgname ()
 {
index 46f0b26..f3bc1d9 100644 (file)
@@ -967,6 +967,23 @@ reinstall_exec ()
                fi
        fi
        reinstall_restore_if_temporarily_deinstalled
+       if ! reinstall_chk_stage_complete UPDATE_CONFLICTS
+       then
+               pkg_info_qL | str_escape_regexp_filter | sed 's/^/^/; s/$/$/' \
+                       > ${TMPDIR}/previously_installed_files.grep_pattern
+               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"
+                       then
+                               pkg_bak=`pkgsys_pkgarc_to_pkgname "$pkgpath_bak"`
+                               fileedit_add_a_line_if_new "$pkg_bak:$REINSTALL_NEWPKGNAME" \
+                                       "${DBDIR}/forbidden_conflicts"
+                       fi
+               done
+               reinstall_register_stage_complete UPDATE_CONFLICTS
+       fi
        if [ -e "$REINSTALL_DBNODE_DIR/AFTERINSTALL.conf" ] && ! reinstall_chk_stage_complete AFTERINSTALL
        then
                message_echo "-- AFTERINSTALL operations (start)"
index 3e34826..84cf15e 100644 (file)
@@ -2,7 +2,7 @@
 .\" ports reinstall installation guide
 .\" Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 .\" ==================================================================================
-.TH PORTSREINSTALL 8 "17 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "21 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
 .SH NAME
 portsreinstall \- ports upgrading utility for massive forced reinstallation
 .SH SYNOPSIS
@@ -931,15 +931,20 @@ Configuration file of \fBportupgrade\fR(1).
 .SH HISTORY
 \fBportsreinstall\fR has been developed as below.
 .TP
+3.2.0 (21 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.
+.RE
+.TP
 3.1.1 (17 December 2014)
 .RS
 [IMPROVED] The automatic resolution of installation conflict is improved to detect actual conflict not described in CONFLICTS or CONFLICTS_INSTALL (for the sake of the staging mechanism).
 .PP
 [BUG FIX] MOVED or REPLACED ports were sometimes incorrectly detected as duplicated ports.
 .PP
-[BUG FIX] Command \fBpkgsanity\fR was confused by the specification change of \fBpkg-check\fR(8).
+[BUG FIX] Command \fBpkgsanity\fR was confused by the specification change of \fBpkg\-check\fR(8).
 .PP
-[BUG FIX] Option \fB-q\fR did not work correctly in version 3.1.0.
+[BUG FIX] Option \fB\-q\fR did not work correctly in version 3.1.0.
 .RE
 .TP
 3.1.0 (9 August 2014)
@@ -947,7 +952,7 @@ Configuration file of \fBportupgrade\fR(1).
 [IMPROVED] Command \fBreset\fR is now available to work with an updated ports tree by preserving information of the initially installed packages.
 The manual page is updated by adding "Workaround for failed ports: update of ports tree" subsection to explain an example to utilize this improved specification.
 .PP
-[IMPROVED] A countermeasure operation is implemented for a bug of pkg-1.3.4 that \fBpkg delete -q\fR does not work.
+[IMPROVED] A countermeasure operation is implemented for a bug of pkg-1.3.4 that \fBpkg delete \-q\fR does not work.
 .PP
 [IMPROVED] Revisions are made so that packages whose ports are replaced or moved are deinstalled before installation of the alternative ports.
 .PP
@@ -963,7 +968,7 @@ The manual page is updated by adding "Workaround for failed ports: update of por
 .PP
 [BUG FIX] The error message for specifying option \fB\-L\fR or \fB\-N\fR for other than \fBredo\fR command was wrong (\fB\-L\fR was missing).
 .PP
-[BUG FIX] Control sequences in output of the long help by \fB\-H\fR option was not correctly handled in some environment (detected in 10.0-RELEASE).
+[BUG FIX] Control sequences in output of the long help by \fB\-H\fR option was not correctly handled in some environment (detected in 10.0\-RELEASE).
 .PP
 [BUG FIX] Reload of configuration where replacement rule is changed possibly caused errors in the phase of "Inspection of necessity".
 .PP
@@ -971,11 +976,11 @@ The manual page is updated by adding "Workaround for failed ports: update of por
 .PP
 [BUG FIX] Evaluation of glob was incorrect when the pattern is regular expression containing multiple slashes.
 .PP
-[BUG FIX] Warning messages might have arise by attempting to restore nonexistent backed-up requirements.
+[BUG FIX] Warning messages might have arise by attempting to restore nonexistent backed\-up requirements.
 .PP
 [BUG FIX] The error message for invalid operation on \fBreselect\fR command was wrong.
 .PP
-[BUG FIX] Selection of leaf packages remained after all of them changed to non-leaves.
+[BUG FIX] Selection of leaf packages remained after all of them changed to non\-leaves.
 .PP
 [BUG FIX] Ports with periods or underscores in their package name, port name or origin were not be treated correctly.
 .PP
@@ -983,7 +988,7 @@ The manual page is updated by adding "Workaround for failed ports: update of por
 .PP
 [BUG FIX] Execution of \fBreset\fR command unintentionally removed temporally deinstalled leaf ports out of scope of reinstallation.
 .PP
-[BUG FIX] A wrong option was given to \fBpkg-info(8)\fR in a compatible command for \fBpkg_info -qoX\fR.
+[BUG FIX] A wrong option was given to \fBpkg-info(8)\fR in a compatible command for \fBpkg_info \-qoX\fR.
 .PP
 [BUG FIX] Variables "NOPKG_*" in ${LOCALBASE}/etc/portsreinstall.conf were not parsed.
 .RE