# ==============================================================================
# portsreinstall library script
# - Operations for building the temporary database -
-# Copyright (C) 2013-2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2013-2022 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
# This software is distributed under the 2-Clause BSD License.
# ==============================================================================
echo "$origin" > ${TMPDIR}/database_build_convert_and_register_origin_if_obsolete:origin
pkgsys_exists_port "$origin" && return
database_build_register_obsolete_port "$origin"
- grep -n -m 1 -E "^`str_escape_regexp \"$origin\"`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || :
+ env LANG=C grep -n -m 1 -E "^`str_escape_regexp \"$origin\"`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || :
if [ `wc -l < ${TMPDIR}/moved.info` -eq 0 ]
then
fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
if [ -n "$recursedb_in" ]
then
message_echo "${DEPTH_INDEX} ===> Disappeared port (MOVED broken?)"
then
message_echo "${DEPTH_INDEX} ===> Moved to $origin_new at $date_moved because \"$why_moved\""
fileedit_add_a_line_if_new "$origin" "${TMPDIR}/database_build_convert_and_register_origin_if_obsolete:origins_old"
+ fileedit_add_a_line_if_new "$origin" "${DBDIR}/moved_ports"
+ fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
database_build_convert_and_register_origin_if_obsolete "$origin_new" "${TMPDIR}/MOVED.DB" || return 1
else
message_echo "${DEPTH_INDEX} ===> Deleted at $date_moved because \"$why_moved\""
fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
return 1
fi
fi
origin=$1
dbdir=${DBDIR}/requires/$origin
[ -d "$dbdir" ] || dbdir=${DBDIR}/conf/each_port/$origin
- cat "$dbdir/MENV.conf" 2> /dev/null || :
+ cat "$dbdir/MENV.conf" 2> /dev/null | tr '\n' ' '
}
# ============= Execute make command for building the temporary database =============
MAKE_ARGS=`database_build_setup_make_args "$origin"`
MAKE_ENVS=`database_build_setup_make_envs "$origin"`
port_path=`pkgsys_get_portpath_from_origin "$origin"`
+ fs_fix_unionfs_image_if_hidden "$port_path"
env $MAKE_ENVS make -C "$port_path" "$@" $MAKE_ARGS
}
# ============= Set up a temporary database node for the replaced/moved information of a port =============
database_build_setup_replace_node ()
{
- local origin_orig origin_trial origin dbpath
+ local origin_orig portoption_before portoption_after origin_trial origin dbpath tmp_msg flavor_orig flavors flavor origin_trial_unflavored origin_unflavored
origin_orig=$1
+ portoption_before=$2
+ portoption_after=$3
dbpath=${DBDIR}/replace/$origin_orig
+ tmp_msg=${TMPDIR}/database_build_setup_replace_node:meg
if [ ! -e "$dbpath/complete_as_node" ]
then
rm -rf "$dbpath"
mkdir -p "$dbpath"
origin_trial=$origin_orig
- if echo "$origin_orig" | grep -q -Fx -f "${DBDIR}/conf/REPLACE.filter" 2> /dev/null
+ if echo "$origin_orig" | env LANG=C grep -q -Fx -f "${DBDIR}/conf/REPLACE.filter" 2> /dev/null
then
origin_trial=`echo "$origin_orig" | sed -E -f "${DBDIR}/conf/REPLACE.sed_pattern"`
if [ "x$origin_orig" != "x$origin_trial" ]
fi >> $dbpath/message
fi
fi
- # Configure the port option to determine the true flavor
- database_build_determine_port_option "$origin_trial"
- # Get the true flavor to determine the flavored port origin
- origin=`database_build_determine_flavored_origin "$origin_trial"`
- if [ "x$origin_trial" != "x$origin" ]
+ cat "$dbpath/message" 2> /dev/null || :
+ if [ -n "$origin_trial" ]
then
- if [ -n "$origin" ]
+ database_build_make "$origin_trial" showconfig > $portoption_before 2> /dev/null || :
+ database_build_determine_port_option "$origin_trial"
+ database_build_make "$origin_trial" showconfig > $portoption_after 2> /dev/null || :
+ origin=`database_build_determine_flavored_origin "$origin_trial"`
+ if [ "x$origin_trial" != "x$origin" ]
then
- message_echo "${DEPTH_INDEX} ===> Transferred to $origin"
- else
- fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
- message_echo "${DEPTH_INDEX} ===> Lost (Something is wrong!)"
- fi
+ if [ -n "$origin" ]
+ then
+ message_echo "${DEPTH_INDEX} ===> Transferred to $origin"
+ else
+ fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports"
+ message_echo "${DEPTH_INDEX} ===> Lost (Something is wrong!)"
+ fi
+ fi > $tmp_msg
+ cat "$tmp_msg" >> $dbpath/message
+ else
+ origin=
+ fi
+ cat "$tmp_msg" 2> /dev/null || :
+ # If the flavor mechanism is introduced to an initial origin without flavor, apply the default one.
+ if [ -n "$origin" -a -n "$origin_trial" ]
+ then
+ origin_trial_unflavored=`pkgsys_get_unflavored_origin "$origin_trial"`
+ origin_unflavored=`pkgsys_get_unflavored_origin "$origin"`
+ flavor_orig=`pkgsys_get_flavor_from_origin "$origin_trial"`
+ if [ -z "$flavor_orig" -a "$origin_trial_unflavored" = "$origin_unflavored" ]
+ then
+ flavors=`database_build_make "$origin" -V FLAVORS`
+ if [ -n "$flavors" ]
+ then
+ flavor=`expr "$flavors" : '\([^ ]*\).*'` || :
+ if [ -n "$flavor" ]
+ then
+ database_build_register_obsolete_port "$origin_trial"
+ fileedit_add_a_line_if_new "$origin_trial" "${DBDIR}/moved_ports"
+ fileedit_rm_a_line "$origin_trial" "${DBDIR}/obsolete_ports"
+ origin=`pkgsys_compose_flavored_origin "$origin_trial" "$flavor"`
+ message_echo "${DEPTH_INDEX} ===> Moved to $origin by renaming with the default flavor"
+ fi
+ fi
+ fi > $tmp_msg
+ cat "$tmp_msg" >> $dbpath/message
fi
[ "x$origin_orig" = "x$origin" ] || echo "$origin" > $dbpath/origin
+ cat "$tmp_msg" 2> /dev/null || :
touch "$dbpath/complete_as_node"
+ else
+ cat "$dbpath/message" 2> /dev/null || :
fi
- cat "$dbpath/message" 2> /dev/null || :
}
# ============= Get the inspected level for a port with the current option settings =============
then
echo full
elif ! pkgsys_exists_or_existed_from_orig "$origin" \
- || grep -qFx "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null \
+ || env LANG=C grep -qFx "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null \
|| [ ! -e "${DBDIR}/moved_from/$origin_dependent/installed_version" ] \
- || grep -qFx "$origin_dependent" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null
+ || env LANG=C grep -qFx "$origin_dependent" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null
then
echo direct
else
inspected_level=`database_build_get_inspected_level "$origin_actual" "$origin_dependent"`
{
cat "${DBDIR}/ports.inspected.${inspected_level}.list" || :
+ cat "${DBDIR}/moved_ports" || :
cat "${DBDIR}/obsolete_ports" || :
- } 2> /dev/null | grep -q -Fx "$origin_actual" || return
+ } 2> /dev/null | env LANG=C grep -q -Fx "$origin_actual" || return
fileedit_rm_a_line "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect.remain"
[ "x$origin" = "$origin_actual" ] || \
fileedit_rm_a_line "$origin_actual" "${DBDIR}/stage.loop_list/ports_to_inspect.remain"
while read origin
do
database_build_get_new_pkgname "$origin"
- done < $srcfile | grep -v '^[[:space:]]*$' | sort -u > $savefile
+ done < $srcfile | env LANG=C grep -v '^[[:space:]]*$' | sort -u > $savefile
fi
cat "$savefile" 2> /dev/null || :
}
# ============= Get the true flavor to determine the flavored port origin =============
database_build_determine_flavored_origin ()
{
- local origin origin_unflavored flavor_trial flavor
+ local origin origin_unflavored flavor_trial origin_trial flavors_ptn flavor
origin=$1
origin_unflavored=`pkgsys_get_unflavored_origin "$origin"`
flavor_trial=`pkgsys_get_flavor_from_origin "$origin"`
if [ -n "$flavor_trial" ]
then
flavors_ptn="^("`database_build_make "$origin" -V FLAVORS 2> /dev/null | sed -E 's/[[:space:]]+/|/g'`")$"
- echo "$flavor_trial" | grep -qE "$flavors_ptn" || origin_trial=$origin_unflavored
+ echo "$flavor_trial" | env LANG=C grep -qE "$flavors_ptn" || flavor_trial=
fi
- flavor=`database_build_make "$origin" -V FLAVOR 2> /dev/null || :`
+ origin_trial=`pkgsys_compose_flavored_origin "$origin_unflavored" "$flavor_trial"`
+ flavor=`database_build_make "$origin_trial" -V FLAVOR 2> /dev/null || :`
pkgsys_compose_flavored_origin "$origin_unflavored" "$flavor"
}
database_build_escape_inspect_conflict ()
{
local origin dbpath
+ origin=$1
dbpath=${DBDIR}/requires/$origin
if [ -e "$dbpath/CONFLICT.conf" ]
then
message_echo "${DEPTH_INDEX} ===> Escaping inspection conflict..."
- pkgsys_eval_ports_glob `cat "$dbpath/CONFLICT.conf"` | while read origin_conflict
- do
- pkg_conflict=`pkgsys_get_installed_pkg_from_origin "$origin_conflict"`
- [ -n "$pkg_conflict" ] || continue
- message_echo "${DEPTH_INDEX} ===> Escaping $pkg_conflict..."
- pkgarc=`pkgsys_create_backup_pkg "$pkg_conflict" "${DBDIR}/backup_packages" 2> /dev/null` || \
- message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to back up)"
- pkg_delete_f "$pkg_conflict" > /dev/null 2>&1 || \
- message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to delete)"
- [ -n "$pkgarc" ] && printf '%s\t%s\n' "$pkg_conflict" "$pkgarc" >> $dbpath/CONFLICT_pkgarc.lst
- done
+ pkgsys_eval_ports_glob `cat "$dbpath/CONFLICT.conf"` | database_build_escape "$dbpath/CONFLICT_pkgarc.lst"
fi
}
+# ============= Escape of conflicts =============
+# A list of conflict package origins are given by stdin.
+database_build_escape ()
+{
+ local backup_list origin_conflict pkg_conflict pkgarc
+ backup_list=$1
+ while read origin_conflict
+ do
+ pkg_conflict=`pkgsys_get_installed_pkg_from_origin "$origin_conflict"`
+ [ -n "$pkg_conflict" ] || continue
+ message_echo "${DEPTH_INDEX} ===> Escaping $pkg_conflict..."
+ pkgarc=`pkgsys_create_backup_pkg "$pkg_conflict" "${DBDIR}/backup_packages" 2> /dev/null` || \
+ message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to back up)"
+ pkg_delete_f "$pkg_conflict" > /dev/null 2>&1 || \
+ message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to delete)"
+ [ -n "$pkgarc" ] && printf '%s\t%s\n' "$pkg_conflict" "$pkgarc" >> $backup_list
+ done
+}
+
# ============= Restoration of escaped inspection conflict =============
database_build_restore_inspect_conflict ()
{
local origin dbpath
+ origin=$1
dbpath=${DBDIR}/requires/$origin
if [ -e "$dbpath/CONFLICT.conf" ]
then
message_echo "${DEPTH_INDEX} ===> Restoring inspection conflict..."
- cat "$dbpath/CONFLICT_pkgarc.lst" 2> /dev/null | while read pkg_conflict pkgarc
- do
- pkg_info_e "$pkg_conflict" && continue
- message_echo "${DEPTH_INDEX} ===> Restoring $pkg_conflict..."
- pkg_add_f "$pkgarc" > /dev/null 2>&1 || \
- message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to restore $pkg_conflict)"
- done
+ cat "$dbpath/CONFLICT_pkgarc.lst" 2> /dev/null | database_build_restore
rm -f "$dbpath/CONFLICT_pkgarc.lst"
fi
}
+# ============= Restoration of escaped conflicts =============
+# The backup list is given by stdin.
+database_build_restore ()
+{
+ local pkg_conflict pkgarc
+ while read pkg_conflict pkgarc
+ do
+ pkg_info_e "$pkg_conflict" && continue
+ message_echo "${DEPTH_INDEX} ===> Restoring $pkg_conflict..."
+ pkg_add_f "$pkgarc" > /dev/null 2>&1 || \
+ message_echo "${DEPTH_INDEX} ===> (WARNING: Failed to restore $pkg_conflict)"
+ done
+}
+
# ============= Recursively inspect dependencies of a port and build a node database of the information =============
database_build_inspect_dependencies ()
{
- local origin_orig origin_dependent origin_orig_regexp origin_replace origin_trial origin tag stage level dbpath dbpath_prev origin_id tmp_config origin_dependency DEPTH_INDEX_orig nlines iline dist_subdir_rpl inspected_level inspected_levels_compatible origin_tmp inspected_level_tmp conf_updated tmp_portsdb_work tmp_portopt same_as_prevset dbfile installed_version frompath variable pkg_new
+ local origin_orig origin_dependent origin_orig_regexp origin_replace origin tag stage level dbpath dbpath_prev origin_id tmp_config origin_dependency DEPTH_INDEX_orig nlines iline dist_subdir_rpl inspected_level inspected_levels_compatible origin_tmp inspected_level_tmp conf_updated tmp_portsdb_work tmp_portopt same_as_prevset dbfile installed_version frompath variable pkg_new
origin_orig=$1
origin_dependent=$2
[ -z "$origin_orig" ] && return
message_echo "${DEPTH_INDEX} $origin_orig"
database_build_convert_and_register_origin_if_obsolete__reset_origins_old
origin_id=`echo "$origin_orig" | tr / :`
- database_build_setup_initial_node "$origin_orig"
# Replacement specified by the configuration file, knobs and port options
- tmp_config=${TMPDIR}/database_build_inspect_dependencies:confi
- database_build_make "$origin_trial" showconfig > $tmp_config.before 2> /dev/null || :
- database_build_setup_replace_node "$origin_orig"
- database_build_make "$origin_trial" showconfig > $tmp_config.after 2> /dev/null || :
+ tmp_config=${TMPDIR}/database_build_inspect_dependencies:config
+ database_build_setup_replace_node "$origin_orig" "$tmp_config.before" "$tmp_config.after"
if [ -e "${DBDIR}/replace/$origin_orig/origin" ]
then
origin=`cat "${DBDIR}/replace/$origin_orig/origin"`
[ "x$origin_orig" = "x$origin" ] || fileedit_add_a_line_if_new "$origin_orig" "$frompath/initial_orig"
[ -e "${DBDIR}/initial/$origin_orig/SUPPRESSED_SELF" ] && touch "$frompath/SUPPRESSED_SELF"
[ -e "${DBDIR}/initial/$origin_orig/SUPPRESSED_PKGNG" ] && touch "$frompath/SUPPRESSED_PKGNG"
- if ! grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null
+ if ! env LANG=C grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null
then
fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
dbpath=${DBDIR}/requires/$origin
dbpath_prev=${DBDIR}/prevset/requires/$origin
if [ ! -e "$dbpath/complete_as_node" ] || \
# Notify reconfiguration of the port option
conf_updated=
if [ -e "$dbpath/complete_as_node" ] || \
- grep -q -Fx -e "$origin_orig" -e "$origin" "${DBDIR}/to_be_reconf" 2> /dev/null
+ env LANG=C grep -q -Fx -e "$origin_orig" -e "$origin" "${DBDIR}/to_be_reconf" 2> /dev/null
then
message_echo "${DEPTH_INDEX} ===> Reconfigured"
conf_updated=y
else
cp /dev/null "$dbpath/ports_options.current"
fi
- pkgsys_save_port_oprion_timestamp "$origin"
+ pkgsys_save_port_option_timestamp "$origin"
# Get the lists of requirements in the flavored form
database_build_create_pkgtag "$origin"
for variable in PKG_DEPENDS EXTRACT_DEPENDS PATCH_DEPENDS FETCH_DEPENDS BUILD_DEPENDS LIB_DEPENDS
do
tr ' ' '\n' < ${TMPDIR}/database_build_inspect_dependencies:${tag}_depends_list | \
sed -E 's#.*:([^:/]+/[^:/]+|[^:/]+/[^:/]+:[^:/]*)$#\1#' | cut -d : -f 1 | sort -u | \
- grep -Ev "`pkgsys_pkgtools_ports_filter_regexp`" \
+ env LANG=C grep -Ev "`pkgsys_pkgtools_ports_filter_regexp`" \
| while read origin_flavor_incomplete
do
( set -e
database_build_determine_port_option "$origin_flavor_incomplete"
)
database_build_determine_flavored_origin "$origin_flavor_incomplete"
- done | grep -v '^$' | sort -u > $dbpath/requirements.$tag.orig || :
+ done | env LANG=C grep -v '^$' | sort -u > $dbpath/requirements.$tag.orig || :
sed -E -f "${DBDIR}/conf/REPLACE.sed_pattern" "$dbpath/requirements.$tag.orig" \
- | grep -v '^$' | sort -u > $dbpath/requirements.$tag.src || :
+ | env LANG=C grep -v '^$' | sort -u > $dbpath/requirements.$tag.src || :
done
for stage in orig src
do
inspected_level=`database_build_get_inspected_level "$origin" "$origin_dependent"`
case $inspected_level in
full )
- grep -v -Fx -f "${DBDIR}/installed_ports" \
+ env LANG=C grep -v -Fx -f "${DBDIR}/installed_ports" \
"$dbpath/requirements.all.direct.src" > ${TMPDIR}/missing.$origin_id || :
inspected_levels_compatible='full direct node'
;;
direct )
- grep -v -Fx -f "${DBDIR}/installed_ports" \
+ env LANG=C grep -v -Fx -f "${DBDIR}/installed_ports" \
"$dbpath/requirements.all.direct.src" > ${TMPDIR}/missing.$origin_id || :
inspected_levels_compatible='direct node'
;;
do
origin_dependency=`sed -n ${iline}p "${TMPDIR}/missing.$origin_id"`
iline=$(($iline+1))
- grep -q -Fx "$origin_dependency" "${DBDIR}/ports.inspected.list" 2> /dev/null && \
+ env LANG=C grep -q -Fx "$origin_dependency" "${DBDIR}/ports.inspected.list" 2> /dev/null && \
continue
database_build_inspect_dependencies "$origin_dependency" "$origin"
done
# Transfer data from the previous database if existent, successful and no change
pkg_new=`cat "$dbpath/new_version"`
if [ ! -e "$dbpath/conf_updated" -a -d "$dbpath_prev" ] && pkg_info_e "$pkg_new" 2> /dev/null && \
- ! grep -qFx "$origin" "$dbpath_prev/to_be_reconf" 2> /dev/null
+ ! env LANG=C grep -qFx "$origin" "$dbpath_prev/to_be_reconf" 2> /dev/null
then
same_as_prevset=yes
- for dbfile in new_version CONFLICT.conf MARG.conf MENV.conf \
+ for dbfile in new_version CONFLICT.conf BUILDCONFLICT.conf MARG.conf MENV.conf \
ports_options.default ports_options.current \
rename_requirements.sed.pattern \
requirements.run.direct.orig requirements.run.direct.src \
then
for dbfile in failed.list damaged_package manually_done.list
do
- if grep -qFx "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null
+ if env LANG=C grep -qFx "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null
then
same_as_prevset=no
break
done
} | while read dbfile
do
- if grep -Fxq "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null
+ if env LANG=C grep -Fxq "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null
then
fileedit_add_a_line_if_new "$origin" "${DBDIR}/$dbfile"
fi
pattern=${DBDIR}/requires/$origin/ignored_requirements.filter
if [ -e "$pattern" ]
then
- grep -Fxvq -f "$pattern"
+ env LANG=C grep -Fxvq -f "$pattern"
else
cat
fi 2> /dev/null || :
then
touch "$tmppath.parents"
num_parents=`wc -l < $tmppath.parents`
- if grep -Fxq "$origin" "$tmppath.parents"
+ if env LANG=C grep -Fxq "$origin" "$tmppath.parents"
then
- loophead=`grep -Fxn "$origin" "$tmppath.parents" | tail -n 1 | cut -d : -f 1`
+ loophead=`env LANG=C grep -Fxn "$origin" "$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 requirements.${tag}${suffix}:" >&2
message_echo "WARNING: The following loop was found for requirements.${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
+ ports_in_loop=`sed -n $(($loophead+1)),\$p "$tmppath.parents"`
+ echo "$ports_in_loop" | sed 's/^/ -->/' | message_cat >&2
message_echo " -->$origin" >&2
if [ "x$opt_disallow_force_continuation_for_looped_dependency" = xyes ]
then
else
message_echo 'Exploring a node port to terminate the loop by evaluating only build-and-run-time dependencies as essential ones.' >&2
echo "$origin" > $tmppath.ports_in_loop
- cat "$tmppath.ports_in_loop.tmp" >> $tmppath.ports_in_loop
+ echo "$ports_in_loop" >> $tmppath.ports_in_loop
echo "$origin" >> $tmppath.ports_in_loop
index_loop=1
loop_len=`wc -l < $tmppath.ports_in_loop`
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
- if ! grep -Fxq "$origin_ref" "$dbpath_target/requirements.run.direct${suffix}" 2> /dev/null || \
- ! grep -Fxq "$origin_ref" "$dbpath_target/requirements.build.direct${suffix}" 2> /dev/null
+ if ! env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.run.direct${suffix}" 2> /dev/null || \
+ ! env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.build.direct${suffix}" 2> /dev/null
then
message_echo 'INFO: The dependency of '$origin_target' on '$origin_ref' is ignored to terminate the loop.' >&2
break
do
for tag_tmp in run build
do
- grep -Fxq "$origin_ref" "$dbpath_target/requirements.${tag_tmp}.direct${suffix_tmp}" 2> /dev/null && \
+ env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.${tag_tmp}.direct${suffix_tmp}" 2> /dev/null && \
fileedit_add_a_line_if_new "$origin_ref" "$dbpath_target/ignored_requirements.${tag_tmp}${suffix_tmp}"
done
cat "$dbpath_target/ignored_requirements.run${suffix_tmp}" "$dbpath_target/ignored_requirements.build${suffix_tmp}" 2> /dev/null | sort -u > $dbpath_target/ignored_requirements.all${suffix_tmp}
mkdir -p "$tmpdstpath"
database_build_filter_ignored_requirements "$origin" < $srcfile | while read origin_requirement
do
- database_build_get_complete_recursive_dependency "$tag" "$origin_requirement" "$suffix" \
- > $tmppath.recursive_dependency
+ # The least requirements of build are the direct build-time requirements and the full run-time requirements of the direct build-time requirements.
+ tag_dep=$tag
+ [ "x$tag" = xbuild ] && tag_dep=run
+ recursive_dependency=`database_build_get_complete_recursive_dependency "$tag_dep" "$origin_requirement" "$suffix"`
[ -e "$dbpath/ignored_requirements.filter" ] && \
- echo "$origin_requirement" | grep -Fxq -f "$dbpath/ignored_requirements.filter" 2> /dev/null && \
+ echo "$origin_requirement" | env LANG=C grep -Fxq -f "$dbpath/ignored_requirements.filter" 2> /dev/null && \
continue
echo "$origin_requirement"
- cat "$tmppath.recursive_dependency"
+ echo "$recursive_dependency"
done > $dstfile_tmp
sed -n ${num_parents}p "$tmppath.parents" > $tmppath.parents.tmp
mv "$tmppath.parents.tmp" "$tmppath.parents"
if [ ! -e "$dstfile" ]
then
- sort -u "$dstfile_tmp" > $dstfile
+ sort -u "$dstfile_tmp" | env LANG=C grep -v '^$' > $dstfile || :
rm "$dstfile_tmp"
fi
fi
fi
}
+# ============= Recursively complete necessary upgrades for build =============
+database_build_complete_necessary_upgrades_for_build ()
+{
+ local origin level dbpath origin_requirement dbpath_requirement
+ origin=$1
+ level=$2
+ dbpath=${DBDIR}/requires/$origin
+ [ -e "$dbpath/requirements.build.${level}" ] || return 0
+ while read origin_requirement
+ do
+ dbpath_requirement=${DBDIR}/requires/$origin_requirement
+ [ -e "$dbpath_requirement/necessary_upgrade.build.${level}" ] || continue
+ [ `cat "${DBDIR}/moved_from/$origin_requirement/current_version" 2> /dev/null | wc -l` -eq 0 ] || continue
+ touch "$dbpath_requirement/necessary_upgrade.run.${level}"
+ database_build_complete_necessary_upgrades_for_build "$origin_requirement" "$level"
+ done < $dbpath/requirements.build.${level}
+ :
+}
+
# ============= Build target attribute files recursively =============
database_build_target_attributes ()
{
(cd "${DBDIR}/requires" && \
find . -depth 3 -name requirements.all.full -exec echo {} \; -exec cat {} \; -exec echo \;) | \
env "DBDIR=${DBDIR}" awk -f "${LIBEXECDIR}"/order_dependencies.awk || return
- grep -v '^$' "${DBDIR}/reinst_order.list.tmp" > "${DBDIR}/reinst_order.list" || :
+ env LANG=C grep -v '^$' "${DBDIR}/reinst_order.list.tmp" > "${DBDIR}/reinst_order.list" || :
}
# ============= [Sub-function] Common operations for resetting configurations for a port =============
fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.${level}.list"
done
fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports"
+ fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports"
fileedit_rm_a_line "$origin" "${DBDIR}/ports.inspected.list"
cat "${DBDIR}/replace/$origin/origin" 2> /dev/null || :
}
database_build_clear_db_dirs "$origin"
}
+# ============= Post-processes after finishing to inspect initial dependencies =============
+database_build_post_inspect_initial_dependencies ()
+{
+ find "${DBDIR}/initial" -depth 2 -type d \
+ | sed -E 's|.*/([^/]+/[^/]+)$|\1|' > ${DBDIR}/inspected_ports.initial
+}
+
# ============= Post-processes after finishing to inspect dependencies =============
database_build_post_inspect_dependencies ()
{
touch "${DBDIR}/obsolete_ports" "${DBDIR}/inspected_ports.update"
find "${DBDIR}/requires" -depth 2 -type d \
| sed -E 's|.*/([^/]+/[^/]+)$|\1|' > ${DBDIR}/inspected_ports
- find "${DBDIR}/initial" -depth 2 -type d \
- | sed -E 's|.*/([^/]+/[^/]+)$|\1|' > ${DBDIR}/inspected_ports.initial
sort -u "${DBDIR}/inspected_ports" "${DBDIR}/inspected_ports.initial" > ${DBDIR}/inspected_ports.all
{
cat "${DBDIR}/conf/HOLD:PORTS.parsed" || :
cat "${DBDIR}/need.list" || :
} 2> /dev/null | sort -u > $tmpfile.obsolete_ports.exclude
- grep -v -Fx -f "$tmpfile.obsolete_ports.exclude" "${DBDIR}/obsolete_ports" > ${DBDIR}/obsolete_ports.can_be_deleted || :
+ env LANG=C grep -v -Fx -f "$tmpfile.obsolete_ports.exclude" "${DBDIR}/obsolete_ports" > ${DBDIR}/obsolete_ports.can_be_deleted || :
cp /dev/null "${DBDIR}/REPLACE.complete_sed_pattern.tmp"
find "${DBDIR}/replace" -depth 3 -type f -name origin | while read nodepath
do
mv "${DBDIR}/REPLACE.complete_sed_pattern.tmp" "${DBDIR}/REPLACE.complete_sed_pattern"
if [ `cat "${DBDIR}/inspected_ports.update" 2> /dev/null | wc -l` -gt 0 ]
then
- grep -Fx -f "${DBDIR}/inspected_ports.all" "${DBDIR}/inspected_ports.update" \
+ env LANG=C grep -Fx -f "${DBDIR}/inspected_ports.all" "${DBDIR}/inspected_ports.update" \
> ${DBDIR}/inspected_ports.update.tmp 2> /dev/null || :
mv "${DBDIR}/inspected_ports.update.tmp" "${DBDIR}/inspected_ports.update"
if [ $opt_only_target_scope = yes ]