[BUG FIX] Command pkgsanity was confused by the specification change of pkg-check(8).
modified: README
modified: bin/portsreinstall
modified: lib/libdatabase_build.sh
modified: lib/libfileedit.sh
modified: lib/libpkgsys.sh
modified: man/portsreinstall.8
================================================================================
portsreinstall - ports upgrading utility for massive forced reinstallation
- Version 3.1.0, August 9, 2014
+ Version 3.1.1, December 4, 2014
Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
================================================================================
# ============ Set up of environment =============
APPNAME=`basename "$0"`
-MYVERSION=3.1.0
-COMPATIBLE_VERSIONS='^(3\.1\.[0-9]+)$'
+# MYVERSION=3.1.0
+# COMPATIBLE_VERSIONS='^(3\.1\.[0-9]+)$'
# Template for development versions
-# MYVERSION=3.0.5+toward_3.1.0_20140809212414
-# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.1\.[0-9]+_[0-9]+|3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.1\.[0-9]+)$'
+MYVERSION=3.1.0+toward_3.1.1_20141203202946
+COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.1\.[0-9]+_[0-9]+|3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.1\.[0-9]+)$'
MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
MYPREFIX=${MYPREFIX:-/usr/local}
LIBDIR=${MYPREFIX}/lib/${APPNAME}
orig_init=`cat "${DBDIR}/requires/$orig/initial_orig"`
pkg=`pkg_info_qO "$orig_init" || :`
fi
- echo "$pkg"
+ [ -n "$pkg" ] && echo "$pkg"
+ :
done > $savefile
cat "$savefile"
}
# ============= Remove lines exactly matching a string from multiple files =============
fileedit_rm_a_line_from_files ()
{
- local item
+ local item filepath
item=$1
[ -n "$item" ] || return 0
while read filepath
# ============= Add a line to each of multiple files if no matching one exists in the file =============
fileedit_add_a_line_to_files_if_new ()
{
- local item
+ local item filepath
item=$1
[ -n "$item" ] || return 0
while read filepath
# ============= Manipulate old and new lines from an old and a new versions of a file =============
fileedit_manipulate_old_new_lines ()
{
- local oldsrc newsrc olddiff newdiff
+ local oldsrc newsrc olddiff newdiff tmpdiff
oldsrc=$1
newsrc=$2
olddiff=$3
# ============= Manipulate old lines from an old and a new versions of a file =============
fileedit_manipulate_old_lines ()
{
- local oldsrc newsrc
+ local oldsrc newsrc tmpdiff
oldsrc=$1
newsrc=$2
tmpdiff=${TMPDIR}/fileedit_manipulate_old_lines::diff
# ============= Manipulate new lines from an old and a new versions of a file =============
fileedit_manipulate_new_lines ()
{
- local oldsrc newsrc
+ local oldsrc newsrc tmpdiff
oldsrc=$1
newsrc=$2
tmpdiff=${TMPDIR}/fileedit_manipulate_new_lines::diff
# ============= Check whether removed lines exists in updating from an old and a new versions of a file =============
fileedit_exists_old_lines ()
{
- local oldsrc newsrc
+ local oldsrc newsrc tmpdiff
oldsrc=$1
newsrc=$2
tmpdiff=${TMPDIR}/fileedit_exists_old_lines::diff
}
pkg_check_sanity ()
{
- local pkg
+ local pkg tmp_stdout tmp_stderr
pkg=$1
- pkg check -s "$pkg" 2> /dev/null
+ tmp_stdout=${TMPDIR}/pkgng:pkg_check_sanity:stdout
+ tmp_stderr=${TMPDIR}/pkgng:pkg_check_sanity:stderr
+ pkg check -s "$pkg" > $tmp_stdout 2> $tmp_stderr || :
+ grep '^[^:]*: checksum mismatch for ' "$tmp_stderr" | sed 's/^[^:]*: checksum mismatch for //' || :
+ if grep -q '^pkg: .*: No such file or directory$' "$tmp_stderr"
+ then
+ pkg info -ql "$pkg" | while read filepath
+ do
+ [ -e "$filepath" ] || echo "$filepath"
+ done
+ fi
+ :
}
pkg_which ()
{
}
pkg_check_sanity ()
{
- local pkg
+ local pkg tmp_stdout tmp_stderr
pkg=$1
- pkg_info -qg "$pkg" 2> /dev/null
+ tmp_stdout=${TMPDIR}/pkgng:pkg_check_sanity:stdout
+ tmp_stderr=${TMPDIR}/pkgng:pkg_check_sanity:stderr
+ pkg_info -qg "$pkg" > $tmp_stdout 2> $tmp_stderr || :
+ grep ' fails the original MD5 checksum$' "$tmp_stdout" | sed 's/ fails the original MD5 checksum$//' || :
+ grep "^pkg_info: .* doesn't exist$" "$tmp_stderr" | sed -E "s/^pkg_info: (.*) doesn't exist$/\1/" || :
}
pkg_which ()
{
_is_reinstall_encouraged=no
while [ $iline -le $nlines ]
do
- src=`sed -n ${iline}p "$tmp_sanity"`
+ filename=`sed -n ${iline}p "$tmp_sanity"`
iline=$(($iline+1))
- filename=`echo "$src" | cut -d ' ' -f 1`
- icol=2
- until [ -e "$filename" -o "$filename" = "$src" ]
- do
- filename="$filename "`echo "$src" | cut -d ' ' -f $icol`
- done
- [ -e "$filename" ] || continue
+ if [ ! -e "$filename" ]
+ then
+ _is_reinstall_encouraged=yes
+ break
+ fi
if expr "$filename" : '.*/include/.*' > /dev/null
then
_is_reinstall_encouraged=yes
.\" ports reinstall installation guide
.\" Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
.\" ==================================================================================
-.TH PORTSREINSTALL 8 "9 August 2014" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "4 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.1.1 (4 December 2014)
+.RS
+[BUG FIX] MOVED or REPLACED ports were possibly incorrectly detected as duplicated ports.
+.PP
+[BUG FIX] Command \fBpkgsanity\fR was confused by the specification change of \fBpkg-check\fR(8).
+.RE
+.TP
3.1.0 (9 August 2014)
.RS
[IMPROVED] Command \fBreset\fR is now available to work with an updated ports tree by preserving information of the initially installed packages.