[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
================================================================================
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.
================================================================================
# ============ 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}
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
# ============= 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
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
# ============= 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"`
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 ()
{
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)"
.\" 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
.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)
[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
.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
.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
.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