OSDN Git Service

[NEW] Option -f is added.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 28 Jun 2016 15:33:58 +0000 (00:33 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 28 Jun 2016 15:33:58 +0000 (00:33 +0900)
[IMPROVED] Diagnosis of looped dependencies is implemented at the phase of "Completion of *-time requirement lists" in the preparation stage.

The manual page was modified in the part of options and history.
The target version is increased.
The copyright years are updated.

Changes to be committed:
modified:   README
modified:   bin/portsreinstall
modified:   lib/libcommand.sh
modified:   lib/libconf.sh
modified:   lib/libdatabase_build.sh
modified:   lib/libdatabase_query.sh
modified:   lib/libdatabase_record.sh
modified:   lib/libdeinstall.sh
modified:   lib/libfileedit.sh
modified:   lib/libmessage.sh
modified:   lib/libmisc.sh
modified:   lib/liboptions.sh
modified:   lib/libpkgsys.sh
modified:   lib/libprogram.sh
modified:   lib/libreinstall.sh
modified:   lib/libstr.sh
modified:   lib/libtemp.sh
modified:   lib/libusage.sh
modified:   man/portsreinstall.8

19 files changed:
README
bin/portsreinstall
lib/libcommand.sh
lib/libconf.sh
lib/libdatabase_build.sh
lib/libdatabase_query.sh
lib/libdatabase_record.sh
lib/libdeinstall.sh
lib/libfileedit.sh
lib/libmessage.sh
lib/libmisc.sh
lib/liboptions.sh
lib/libpkgsys.sh
lib/libprogram.sh
lib/libreinstall.sh
lib/libstr.sh
lib/libtemp.sh
lib/libusage.sh
man/portsreinstall.8

diff --git a/README b/README
index 0dd9a51..97a1404 100644 (file)
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ================================================================================
  portsreinstall - ports upgrading utility for massive forced reinstallation
-  Version 3.2.2, June 28, 2015
+  Version 3.3.0, June 28, 2015
  Copyright (C) 2010-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 ================================================================================
 
index fba2f83..6997d31 100755 (executable)
 # ============ Set up of environment =============
 APPNAME=`basename "$0"`
 
-MYVERSION=3.2.2
-COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
+MYVERSION=3.3.0
+COMPATIBLE_VERSIONS='^(3\.[1-3]\.[0-9]+)$'
 # Template for development versions
-MYVERSION=3.2.1+toward_3.2.2_20160628223135
-COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+\+toward_3\.[1-2]\.[0-9]+_[0-9]+|3\.[1-2]\.[0-9]+)$'
+MYVERSION=3.2.1+toward_3.3.0_20160629003312
+COMPATIBLE_VERSIONS='^(3\.[1-3]\.[0-9]+\+toward_3\.[1-3]\.[0-9]+_[0-9]+|3\.[1-3]\.[0-9]+)$'
 MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
 MYPREFIX=${MYPREFIX:-/usr/local}
 LIBDIR=${MYPREFIX}/lib/${APPNAME}
index 42f7f72..f530618 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Operations of commands as well as check of command line arguments -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 7561fb1..9247f7c 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Parsing of configuration files -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index ac50016..5eba1e5 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Operations for building the temporary database -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
@@ -626,25 +626,43 @@ database_build_inspect_dependencies ()
 # ============= Build and get a list of the complete recursive dependencies of a port =============
 database_build_get_complete_recursive_dependency ()
 {
-       local table origin dbpath tmppath suffix dstfile dstfile_tmp
+       local table origin suffix tmpdb_parents dbpath srcfile dstfile loophead origin_esc tmppath dstfile_tmp
        table=$1
        origin=$2
        suffix=$3
+       tmpdb_parents=${TMPDIR}/database_build_get_complete_recursive_dependency.parents
        dbpath=${DBDIR}/requires/$origin
-       [ -e "$dbpath/$table.direct$suffix" ] || return 0
+       srcfile=$dbpath/$table.direct$suffix
+       [ -e "$srcfile" ] || return 0
        dstfile=$dbpath/$table.full$suffix
        if [ ! -e "$dstfile" ]
        then
-               tmppath=${TMPDIR}/requires/$origin
-               dstfile_tmp=$tmppath/$table.full$suffix
-               [ -d "$tmppath" ] || mkdir -p "$tmppath"
-               while read origin_requirement
-               do
-                       echo "$origin_requirement"
-                       database_build_get_complete_recursive_dependency "$table" "$origin_requirement" "$suffix"
-               done < $dbpath/$table.direct$suffix > $dstfile_tmp
-               sort -u "$dstfile_tmp" > $dstfile
-               rm "$dstfile_tmp"
+               origin_esc=`str_escape_regexp "$origin"`
+               touch "$tmpdb_parents"
+               num_parents=`wc -l < $tmpdb_parents`
+               if grep -Eq "^$origin_esc$" "$tmpdb_parents"
+               then
+                       loophead=`grep -En "^$origin_esc$" "$tmpdb_parents" | tail -n 1 | cut -d : -f 1`
+                       message_echo 'WARNING: The following loop was found, ignored forcibly:' >&2
+                       message_echo "  $origin" >&2
+                       sed -n $(($loophead+1)),\$p "$tmpdb_parents" | sed 's/^/  -->/' | message_cat >&2
+                       message_echo "  -->$origin" >&2
+exit 255
+               else
+                       echo "$origin" >> $tmpdb_parents
+                       tmppath=${TMPDIR}/requires/$origin
+                       dstfile_tmp=$tmppath/$table.full$suffix
+                       [ -d "$tmppath" ] || mkdir -p "$tmppath"
+                       while read origin_requirement
+                       do
+                               echo "$origin_requirement"
+                               database_build_get_complete_recursive_dependency "$table" "$origin_requirement" "$suffix"
+                       done < $srcfile > $dstfile_tmp
+                       sort -u "$dstfile_tmp" > $dstfile
+                       rm "$dstfile_tmp"
+                       head -n ${num_parents}p "$tmpdb_parents" > $tmpdb_parents.tmp
+                       mv "$tmpdb_parents.tmp" "$tmpdb_parents"
+               fi
        fi
        cat "$dstfile"
 }
index 2a059b8..12655dc 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Operations for queries to the temporary database -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index d8d49ae..e32bc72 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Operations for recording operation results to the temporary database -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index b13eda4..72e4775 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Deinstallation processes -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 57020ad..b9658ab 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Editing operations on files -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 7e5a0ec..5102e8c 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Messages -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 9db2d55..0f7f977 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Miscellaneous functions -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 7d95490..8747603 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Command line options -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
@@ -26,6 +26,7 @@ N     reset-targets   opt_reset_targets       no      yes
 M      reset-minor-options     opt_reset_minor_options no      yes
 L      reload-conf     opt_reload_conf no      yes
 i      allow-new-targets       opt_allow_new_targets   no      yes
+f      force-continuation-for-looped-dependency        opt_force_continuation_for_looped_dependency    no      yes
 eof
 }
 
index e59f6ac..b389e3f 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Wrappers for hiding version differences in the Ports/Packages system -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 39d495d..5517a48 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Program control -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 51c8959..74239c2 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Reinstallation processes -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 28aecf9..795761d 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - String processing -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index ad0a29f..86f4f28 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Temporary directory and signal trapping -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
index 34a901d..afcb635 100644 (file)
@@ -2,7 +2,7 @@
 # ==============================================================================
 # portsreinstall library script
 # - Help messages -
-# Copyright (C) 2013-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2016 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==============================================================================
 
@@ -19,6 +19,7 @@ USAGE: ${APPNAME} [OPTIONS] [--] [command]
  -V : Show the current version.
  <Group 2: Effective anytime>
  -a : Suppress messages to be batch-friendly.
+ -f : Force continuation for looped dependency
  -i : Include new targets to the "needed" list.
  -M : Reset group 4 option settings.
  <Group 3: Effective only with redo command>
index bcc4c04..c7a14bd 100644 (file)
@@ -2,7 +2,7 @@
 .\" ports reinstall installation guide
 .\" Copyright (C) 2010-2015 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 .\" ==================================================================================
-.TH PORTSREINSTALL 8 "28 June 2016" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "29 June 2016" "FreeBSD" "FreeBSD System Manager's Manual"
 .SH NAME
 portsreinstall \- ports upgrading utility for massive forced reinstallation
 .SH SYNOPSIS
@@ -287,6 +287,13 @@ Suppress messages so as to be friendly for batch operations.
 The output formats for \fBoptions\fR and \fBshow\fR commands and \fB\-V\fR option are arranged to be more batch\-friendly.
 It is noted that log output in build/installation processes are not suppressed.
 .PD
+.IP \fB\-f\fR
+.PD 0
+.TP
+\fB\-\-force\-continuation\-for\-looped\-dependency\fR
+Continue forcibly even if looped dependencies are found.
+The diagnosis of dependencies is carried out at the phase of "Completion of *-time requirement lists" of the preparation stage.
+.PD
 .IP \fB\-i\fR
 .PD 0
 .TP
@@ -931,9 +938,13 @@ Configuration file of \fBportupgrade\fR(1).
 .SH HISTORY
 \fBportsreinstall\fR has been developed as below.
 .TP
-3.2.2 (21 June 2016)
+3.3.0 (29 June 2016)
 .RS
-[CHANGED] The "Completion of recursive requirement lists" phase was very heavy without -q option when pkg(8) was updated; this problem is resolved by ignoring the build-time dependence on pkg(8).
+[NEW] Option \-f is added.
+.PP
+[IMPROVED] Diagnosis of looped dependencies is implemented at the phase of "Completion of *-time requirement lists" in the preparation stage.
+.PP
+[CHANGED] Dependencies on pkg(8) is changed to be ignored.
 .PP
 [BUG FIX] The rescue process for cases missing pkg(8) was not working well.
 .RE