- while read origin_requirement
- do
- echo "$origin_requirement"
- database_build_get_complete_recursive_dependency "$table" "$origin_requirement"
- done < $dbpath/$table.direct | sort -u > $dstfile.tmp
- mv "$dstfile.tmp" "$dstfile"
+ 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`
+ if [ "x$opt_force_continuation_for_looped_dependency" = xno ]
+ then
+ message_echo 'ERROR: The following loop was found:' >&2
+ else
+ message_echo 'WARNING: The following loop was found:' >&2
+ fi
+ message_echo " $origin" >&2
+ sed -n $(($loophead+1)),\$p "$tmpdb_parents" | sed 's/^/ -->/' | message_cat >&2
+ message_echo " -->$origin" >&2
+ if [ "x$opt_force_continuation_for_looped_dependency" = xno ]
+ then
+ message_echo 'Resolve the problem manually if possible, and then restart by' >&2
+ message_echo " ${APPNAME} reset keepopts" >&2
+ message_echo " ${APPNAME}" >&2
+ message_echo 'Otherwise, you may attempt to forcibly continue by' >&2
+ message_echo " ${APPNAME} -f" >&2
+ exit 1
+ else
+ message_echo '(Forcibly continue)' >&2
+ fi
+ 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