OSDN Git Service

[BUG FIX] MOVED or REPLACED ports were possibly incorrectly detected as duplicated...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 3 Dec 2014 11:33:36 +0000 (20:33 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Wed, 3 Dec 2014 11:33:36 +0000 (20:33 +0900)
[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

README
bin/portsreinstall
lib/libdatabase_build.sh
lib/libfileedit.sh
lib/libpkgsys.sh
man/portsreinstall.8

diff --git a/README b/README
index 38d68c9..982127c 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ================================================================================
  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.
 ================================================================================
 
index 1706d15..561088e 100755 (executable)
 # ============ 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}
index da86e40..7446ed0 100644 (file)
@@ -353,7 +353,8 @@ database_build_update_pkgname ()
                        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"
 }
index 910dfae..de19c87 100644 (file)
@@ -46,7 +46,7 @@ fileedit_add_a_line_if_new ()
 # ============= 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
@@ -58,7 +58,7 @@ fileedit_rm_a_line_from_files ()
 # ============= 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
@@ -105,7 +105,7 @@ fileedit_combine_lists ()
 # ============= 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
@@ -121,7 +121,7 @@ fileedit_manipulate_old_new_lines ()
 # ============= 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
@@ -134,7 +134,7 @@ fileedit_manipulate_old_lines ()
 # ============= 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
@@ -147,7 +147,7 @@ fileedit_manipulate_new_lines ()
 # ============= 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
index b3f28ab..4b8330f 100644 (file)
@@ -332,9 +332,20 @@ pkgsys_def_pkgtools ()
                }
                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 ()
                {
@@ -593,9 +604,13 @@ pkgsys_def_pkgtools ()
                }
                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 ()
                {
@@ -1031,15 +1046,13 @@ pkgsys_sanitychk_pkgcontents ()
        _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
index b895883..483aacf 100644 (file)
@@ -2,7 +2,7 @@
 .\" 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
@@ -931,6 +931,13 @@ Configuration file of \fBportupgrade\fR(1).
 .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.