+ origin_esc=`str_escape_regexp "$origin"`
+ touch "$tmppath.parents"
+ num_parents=`wc -l < $tmppath.parents`
+ if grep -Eq "^$origin_esc$" "$tmppath.parents"
+ then
+ loophead=`grep -En "^$origin_esc$" "$tmppath.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 for ${table}.${tag}${suffix}:" >&2
+ else
+ message_echo "WARNING: The following loop was found for ${table}.${tag}${suffix}:" >&2
+ fi
+ message_echo " $origin" >&2
+ sed -n $(($loophead+1)),\$p "$tmppath.parents" > $tmppath.ports_in_loop.tmp
+ sed 's/^/ -->/' "$tmppath.ports_in_loop.tmp" | message_cat >&2
+ message_echo " -->$origin" >&2
+ if [ "x$opt_disallow_force_continuation_for_looped_dependency" = xyes ]
+ then
+ message_echo 'Resolve the problem manually if possible, and then restart by executing' >&2
+ message_echo " ${APPNAME} reset keepopts" >&2
+ message_echo " ${APPNAME}" >&2
+ message_echo 'Otherwise, you may attempt a forcible continuation by executing' >&2
+ message_echo " ${APPNAME} -f" >&2
+ exit 1
+ else
+ message_echo 'Exploring a node port to terminate the loop by evaluating only build-and-run-time dependencies as essential.' >&2
+ echo "$origin" > $tmppath.ports_in_loop
+ cat "$tmppath.ports_in_loop.tmp" >> $tmppath.ports_in_loop
+ echo "$origin" >> $tmppath.ports_in_loop
+ index_loop=1
+ loop_len=`wc -l < $tmppath.ports_in_loop`
+ while [ $index_loop -lt $loop_len ]
+ do
+ origin_target=`sed -n ${index_loop}p "$tmppath.ports_in_loop"`
+ origin_ref=`sed -n $((${index_loop}+1))p "$tmppath.ports_in_loop"`
+ dbpath_target=${DBDIR}/requires/$origin_target
+ origin_ref_esc=`str_escape_regexp "$origin_ref"`
+ if ! grep -Eq "^$origin_ref_esc$" "$dbpath_target/${table}.run.direct${suffix}" 2> /dev/null || \
+ ! grep -Eq "^$origin_ref_esc$" "$dbpath_target/${table}.build.direct${suffix}" 2> /dev/null
+ then
+ fileedit_add_a_line_if_new "$origin_ref" "$dbpath_target/ignored_dependencies_to_break_loops"
+ message_echo 'INFO: The dependency of '$origin_target' on '$origin_ref' is ignored to terminate the loop.' >&2
+ break
+ fi
+ index_loop=$((${index_loop}+1))
+ done
+ if [ $index_loop -eq $loop_len ]
+ then
+ fileedit_add_a_line_if_new "$origin_ref" "$dbpath_target/ignored_dependencies_to_break_loops"
+ message_echo 'WARNING: The loop cannot be resolved. Continuing by forcible ignorance of the dependency of '$origin_target' on '$origin_ref'. This may cause confusion in the later processes.' >&2
+ fi
+ str_escape_regexp_filter < $dbpath_target/ignored_dependencies_to_break_loops | sed 's/^/^/;s/$/$/' > $dbpath_target/ignored_dependencies_to_break_loops.regexp
+ fi
+ fi
+ echo "$origin" >> $tmppath.parents
+ tmpdstpath=${TMPDIR}/requires/$origin
+ dstfile_tmp=$tmpdstpath/${table}.${tag}.full${suffix}
+ [ -d "$tmpdstpath" ] || mkdir -p "$tmpdstpath"
+ database_build_filter_ignored_requirements "$origin" < $srcfile | while read origin_requirement