# ================================================
APPNAME=`basename "$0"`
-MYVERSION=2.2.2+toward_2.2.3_20130131041824
+MYVERSION=2.2.2+toward_3.0.0_20130203231825
LOCALBASE=${LOCALBASE:-/usr/local}
PREFIX=${PREFIX:-${LOCALBASE}}
show_version=no
avoid_vulner=no
skip_unchanged=no
+include_buildtime_dependencies=no
+include_runtime_dependencies=yes
keep_distfiles=no
renew_options=no
supress_self_upadte=no
then
skip_unchanged=yes
shift
+ elif [ "$1" = "-b" ]
+ then
+ include_buildtime_dependencies=yes
+ shift
+ elif [ "$1" = "-B" ]
+ then
+ include_runtime_dependencies=no
+ shift
elif [ "$1" = "-d" ]
then
keep_distfiles=yes
-P : Import settings from pkgtools.conf(5) as the secondary if exists.
-Q : Ignore pkgtools.conf(5) even if it exists.
-s : Build of vulnerable ports are avoided by triggering errors.
- -q : Ports whose all requirements and themselves are not new are skipped.
+ -q : Only new ports and their run-time requirements are reinstalled.
+ -b : Include build-time dependencies in evaluation of dependencies.
+ -B : Exclude run-time dependencies in evaluation of dependencies.
-d : Do not clean up obsolete or unused distfiles.
-N : Renew option settings (only for redo command).
-k : Keep ${APPNAME} itself untouched.
transferred to the restarted runs.
Dependency relations are inspected for all installed packages as well.
Combination with options "-T", "-r" and "-R" is available.
+ The behavior can be modified by -b option.
-r glob : Reinstall only the target port and their dependents.
This option can be given multiply.
The difference from "-t" is that only one port glob can be specified.
Thus a package name with commas is available.
Combination with options "-t", "-T" and "-R" is available.
+ The behavior can be modified by -b option.
-T glob1[,glob2,...] : Reinstall only target ports and their requirements.
Target ports which are not installed yet are newly installed.
Target ports which are obsolete are deinstalled.
transferred to the restarted runs.
Dependency relations are inspected for all installed packages as well.
Combination with options "-t", "-r" and "-R" is available.
+ The behavior can be modified by -b option.
-R glob : Reinstall only target ports and their requirements.
This option can be given multiply.
The difference from "-T" is that only one port glob can be specified.
Thus a package name with commas is available.
Combination with options "-t", "-r" and "-T" is available.
+ The behavior can be modified by -b option.
-x glob1[,glob2,...] : Set the port glob(s) to be taboo.
This option registers a port to be ignored as taboo.
This option can be given multiply.
following runs.
If you want to continue the reinstallation process by resetting
this option, execute by "redo" command with "-N" option.
- -q : Ports whose all requirements and themselves are not new are skipped.
- This option is safe and useful when the all of the major version of
+ -q : Only new ports and their dependents are reinstalled.
+ This option is convenient when the all of the major version of
the system, configuration options of each ports, pkgtools.conf(5),
${APPNAME}.conf are unchanged.
This option is fixed at the first "do" run, and transferred to the
following runs.
If you want to continue the reinstallation process by resetting
this option, execute by "redo" command with "-N" option.
+ The behavior can be modified by -b option.
+ -b : Include build-time dependencies in evaluation of dependencies.
+ This option affects behaviors of -t, -r -T, -R and -q options.
+ This option is fixed at the first "do" run, and transferred to the
+ following runs.
+ If you want to continue the reinstallation process by resetting
+ this option, execute by "redo" command with "-N" option.
+ -B : Exclude run-time dependencies in evaluation of dependencies.
+ This option is intended to be used with -b option and affects behaviors
+ of -t, -r -T, -R and -q options.
+ This option is fixed at the first "do" run, and transferred to the
+ following runs.
+ If you want to continue the reinstallation process by resetting
+ this option, execute by "redo" command with "-N" option.
-d : Do not clean up obsolete or unused distfiles.
This option is fixed at the first "do" run, and transferred to the
following runs.
this option, execute by "redo" command with "-N" option.
-N : Renew option settings.
This option is effective only with "redo" command.
- Option settings for "-s", "-q" and "-d" are reset according to
- the simultaneously given ones.
+ Option settings for "-s", "-q", "-b", "-B" and "-d" are reset according
+ to the simultaneously given ones.
-k : Keep ${APPNAME} itself untouched.
This option supresses update, deinstallation and reinstallation of
the currently installed ${APPNAME}.
save [dir] : save the current temporal database as a .tar.gz archive
load path : load a temporal database archive
show [args] : show the list of ports to be reinstalled
- todo : ports to be reinstalled in the current do/redo process (default)
+ todo : ports to be reinstalled in the current do/redo process
+ (default)
done : already reinstalled ports
resolved : manually reinstalled ports
failure : failed ports
- redo : ports succeeded once but to be reinstalled in the next redo process
- pending : ports to be reinstalled after success in their requirements
+ redo : ports succeeded once but to be reinstalled in the next redo
+ process
+ pending : ports to be reinstalled after success in their
+ requirements
taboo : taboo ports
deleted : obsolete ports to be or have been deleted
requirements glob1 [glob2 ...] : ports required by matching ports
ports_glob ()
{
local glob index
- [ -f "${DBDIR}/ports_glob:pkg.lst" ] || cut -d \| -f 1 "${PORTS_INDEX_DB}" > ${DBDIR}/ports_glob:pkg.lst
- [ -f "${DBDIR}/ports_glob:origin.lst" ] || cut -d \| -f 2 "${PORTS_INDEX_DB}" | sed -E "s/^`str_escape_regexp "${PORTSDIR}"`\///" > ${DBDIR}/ports_glob:origin.lst
+ [ -f "${DBDIR}/ports_glob:pkg.lst" ] \
+ || cut -d \| -f 1 "${PORTS_INDEX_DB}" > ${DBDIR}/ports_glob:pkg.lst
+ [ -f "${DBDIR}/ports_glob:origin.lst" ] \
+ || cut -d \| -f 2 "${PORTS_INDEX_DB}" \
+ | sed -E "s/^`str_escape_regexp "${PORTSDIR}"`\///" > ${DBDIR}/ports_glob:origin.lst
while [ $# -gt 0 ]
do
glob=`convert_portsglob_to_regexp_pattern "$1"`
- if expr "$glob" : '[^/][^/]*\/[^/][^/]*$' 2> /dev/null > /dev/null
+ if expr "$glob" : '[^/][^/]*\/[^/][^/]*$' > /dev/null 2>&1
then
grep -E "$glob" "${DBDIR}/ports_glob:origin.lst" || :
pkg_info_qoa | grep -E "$glob" || :
else
- grep -n -E "$glob" "${DBDIR}/ports_glob:pkg.lst" | cut -d : -f 1 | while read index
+ grep -n -E "$glob" "${DBDIR}/ports_glob:pkg.lst" | cut -d : -f 1 \
+ | while read index
do
sed -n ${index}p "${DBDIR}/ports_glob:origin.lst"
done || :
item=$1
dstpath=$2
pattern=`str_escape_regexp "$item"`
- grep -v -E "^$pattern$" "$dstpath" 2> /dev/null > ${TMPDIR}/rm_a_line || :
- mv "${TMPDIR}/rm_a_line" "$dstpath"
+ grep -v -E "^$pattern$" "$dstpath" 2> /dev/null > ${DBDIR}/tmpfile:rm_a_line || :
+ mv "${DBDIR}/tmpfile:rm_a_line" "$dstpath"
}
add_a_line_if_new ()
item=$1
dstpath=$2
pattern=`str_escape_regexp "$item"`
- grep -m 1 -E "^$pattern$" "$dstpath" > /dev/null 2>&1 || echo "$item" >> $dstpath
-}
-
-record_success ()
-{
- local origin clean recurse
- origin=$1
- str_escape_regexp_filter < ${DBDIR}/failed.list | sed "s|^|^|; s|$|$|" > ${TMPDIR}/record_success.grep_failed.list.tmp
- rm_a_line "$origin" "${DBDIR}/todo_after_requirements_succeed.list"
- dbdir_esc=`str_escape_replaceval "${DBDIR}/requires/"`
- if [ -e "${DBDIR}/requires/$origin/dependents" ]
- then
- sed "s/^/$dbdir_esc/;s|$|/failed_requirements|" "${DBDIR}/requires/$origin/dependents" | \
- rm_a_line_from_files "$origin"
- fi
- if [ `grep -m 1 -E -f "${TMPDIR}/record_success.grep_failed.list.tmp" "${DBDIR}/requires/$origin/requires" | wc -l` -eq 0 ]
- then
- add_a_line_if_new "$origin" "${DBDIR}/success.list"
- rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed.list"
- [ ! -e "${DBDIR}/requires/$origin/necessary_update" ] || mv "${DBDIR}/requires/$origin/necessary_update" "${DBDIR}/requires/$origin/necessary_update_completed"
- else
- rm_a_line "$origin" "${DBDIR}/success.list"
- add_a_line_if_new "$origin" "${DBDIR}/success_but_dependencies_failed.list"
- fi
- rm_a_line "$origin" "${DBDIR}/failed.list"
- touch "${DBDIR}/requires/$origin/succeeded_once"
- rm -f "${DBDIR}/requires/$origin/note_failtre"
-}
-
-record_failure ()
-{
- local origin clean portsdir_esc
- origin=$1
- clean=$2
- add_a_line_if_new "$origin" "${DBDIR}/failed.list"
- rm_a_line "$origin" "${DBDIR}/success.list"
- rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed.list"
- rm_a_line "$origin" "${DBDIR}/todo_after_requirements_succeed.list"
- dbdir_esc=`str_escape_replaceval "${DBDIR}/requires/"`
- if [ -e "${DBDIR}/requires/$origin/dependents" ]
- then
- sed "s/^/$dbdir_esc/;s|$|/failed_requirements|" "${DBDIR}/requires/$origin/dependents" | \
- add_a_line_to_files_if_new "$origin"
- fi
- rm -f "${DBDIR}/requires/$origin/succeeded_once"
- if [ -z "$clean" -o "@$clean" = @clean ]
- then
- echo "*** Trying to clean the failed build... (Ignore failures)"
- env ${MAKE_ENVS} make clean ${MAKE_ARGS} || :
- fi
- echo "*** Skipping this port and proceeding to the next one forcibly..."
- echo
+ cp "$dstpath" "${DBDIR}/tmpfile:add_a_line_if_new"
+ grep -m 1 -E "^$pattern$" "$dstpath" > /dev/null 2>&1 \
+ || echo "$item" >> ${DBDIR}/tmpfile:add_a_line_if_new
+ mv "${DBDIR}/tmpfile:add_a_line_if_new" "$dstpath"
}
rm_a_line_from_files ()
advance=$2
while read origin
do
- grep -m 1 -E "^`str_escape_regexp $origin`$" "$filepath" 2> /dev/null > /dev/null || echo $origin
- done > ${TMPDIR}/add_lines_if_new
+ grep -m 1 -E "^`str_escape_regexp \"$origin\"`$" "$filepath" > /dev/null 2>&1 \
+ || echo "$origin"
+ done > ${TMPDIR}/add_lines_if_new:add
if [ "@$advance" = @advance ]
then
- mv "$filepath" ${TMPDIR}/add_lines_if_new.bak
- cat "${TMPDIR}/add_lines_if_new" "${TMPDIR}/add_lines_if_new.bak" > $filepath
+ cat "${TMPDIR}/add_lines_if_new:add" "$filepath"
else
- cat "${TMPDIR}/add_lines_if_new" >> $filepath
+ cat "$filepath" "${TMPDIR}/add_lines_if_new:add"
+ fi > ${DBDIR}/tmpfile:add_lines_if_new:newfile
+ mv "${DBDIR}/tmpfile:add_lines_if_new:newfile" "$filepath"
+}
+
+record_success ()
+{
+ local origin nodedir dbdir_esc tag
+ origin=$1
+ nodedir=${DBDIR}/requires/$origin
+ str_escape_regexp_filter < ${DBDIR}/failed.list \
+ | sed "s|^|^|; s|$|$|" > ${TMPDIR}/record_success.grep_failed.list.tmp
+ dbdir_esc=`str_escape_replaceval "${DBDIR}/requires/"`
+ for tag in all run build
+ do
+ rm_a_line "$origin" "${DBDIR}/todo_after_requirements_succeed_$tag.list"
+ if [ -e "$nodedir/dependents_$tag" ]
+ then
+ sed "s/^/$dbdir_esc/;s|$|/failed_requirements_$tag|" "$nodedir/dependents_$tag" | \
+ rm_a_line_from_files "$origin"
+ fi
+ if grep -m 1 -E -f "${TMPDIR}/record_success.grep_failed.list.tmp" \
+ "$nodedir/requirements_$tag" > /dev/null 2>&1
+ then
+ rm_a_line "$origin" "${DBDIR}/success_$tag.list"
+ add_a_line_if_new "$origin" "${DBDIR}/success_but_dependencies_failed_$tag.list"
+ else
+ add_a_line_if_new "$origin" "${DBDIR}/success_$tag.list"
+ rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed_$tag.list"
+ [ ! -e "$nodedir/necessary_update_$tag" ] \
+ || mv "$nodedir/necessary_update_$tag" "$nodedir/necessary_update_completed_$tag"
+ fi
+ done
+ rm_a_line "$origin" "${DBDIR}/failed.list"
+ touch "$nodedir/succeeded_once"
+ rm -f "$nodedir/note_failtre"
+}
+
+record_failure ()
+{
+ local origin clean nodedir dbdir_esc
+ origin=$1
+ clean=$2
+ nodedir=${DBDIR}/requires/$origin
+ add_a_line_if_new "$origin" "${DBDIR}/failed.list"
+ dbdir_esc=`str_escape_replaceval "${DBDIR}/requires/"`
+ for tag in all run build
+ do
+ rm_a_line "$origin" "${DBDIR}/success_$tag.list"
+ rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed_$tag.list"
+ rm_a_line "$origin" "${DBDIR}/todo_after_requirements_succeed_$tag.list"
+ if [ -e "$nodedir/dependents_$tag" ]
+ then
+ sed "s/^/$dbdir_esc/;s|$|/failed_requirements_$tag|" "$nodedir/dependents_$tag" | \
+ add_a_line_to_files_if_new "$origin"
+ fi
+ done
+ rm -f "$nodedir/succeeded_once"
+ if [ -z "$clean" -o "@$clean" = @clean ]
+ then
+ echo "*** Trying to clean the failed build... (Ignore failures)"
+ env ${MAKE_ENVS} make clean ${MAKE_ARGS} || :
fi
+ echo "*** Skipping this port and proceeding to the next one forcibly..."
+ echo
}
register_globs ()
echo "`echo "$globlist1" | sed 's/,/ /g'`" "$globlist2" | sed -E 's/ +/\
/g' | grep -v '^$' | while read glob
do
- if expr "@$glob" : '^@[^/][^/]*\/[^/][^/]*$' > /dev/null 2> /dev/null
+ if expr "@$glob" : '^@[^/][^/]*\/[^/][^/]*$' > /dev/null 2>&1
then
[ ! -d "${PORTSDIR}/$glob" ] || { echo "$glob"; continue; }
fi
set | grep -e "^_CONF_${section}_${tag_target}_" | cut -d = -f 1 | while read var
do
eval glob_pattern=\${$var}
- eval val=\$\{`echo $var | sed "s/^_CONF_${section}_${tag_target}_/_CONF_${section}_${tag_val}_/"`\}
+ eval val=\$\{`echo "$var" | sed "s/^_CONF_${section}_${tag_target}_/_CONF_${section}_${tag_val}_/"`\}
expand_glob_pattern_to_origins "$glob_pattern" | while read origin
do
path=${DBDIR}/requires_conflist/$origin
echo "${DEPTH_INDEX} $origin"
origin_id=`echo "$origin" | tr / :`
pkg=`pkg_info_qO "$origin"`
+ target_dir=${DBDIR}/initial/$origin
if [ -n "$pkg" ]
then
- target_dir=${DBDIR}/initial/$origin
[ -d "$target_dir" ] || mkdir -p "$target_dir"
- echo $pkg > $target_dir/installed_version
+ echo "$pkg" > $target_dir/installed_version
pkg_info_qr "$pkg" | while read requirement
do
pkg_info_e "$requirement" || continue
- pkg_info_qo "$requirement" >> $target_dir/requires
- done
+ pkg_info_qo "$requirement"
+ done > ${DBDIR}/tmpfile:inspect_dependencies:init_requirements
+ mv "${DBDIR}/tmpfile:inspect_dependencies:init_requirements" "$target_dir/requirements_all.src"
+ ln "$target_dir/requirements_all.src" "$target_dir/requirements_run.src"
pkg_info_qR "$pkg" | while read dependent
do
pkg_info_e "$dependent" || continue
- pkg_info_qo "$dependent" >> $target_dir/dependents
- done
+ pkg_info_qo "$dependent"
+ done > ${DBDIR}/tmpfile:inspect_dependencies:init_dependents
+ mv "${DBDIR}/tmpfile:inspect_dependencies:init_dependents" "$target_dir/dependents_all.src"
+ ln "$target_dir/dependents_all.src" "$target_dir/dependents_run.src"
fi
if [ $supress_self_upadte = yes -a `expr "$pkg" : "^${APPNAME}-[0-9].*"` -gt 0 ]
then
is_supressed=no
fi
origin_src=
- if [ `echo "$origin" | grep -m 1 -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" | wc -l` -eq 1 ]
+ if echo "$origin" | grep -m 1 -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" > /dev/null
then
origin_src=$origin
origin=`echo "$origin_src" | sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist"`
[ $is_supressed = no ] || touch "$target_dir/SUPPRESSED"
if [ -d "${DBDIR}/requires_conflist/$origin" ]
then
- cp -R "${DBDIR}/requires_conflist/$origin/"* "$target_dir/" > /dev/null 2> /dev/null || :
+ cp -R "${DBDIR}/requires_conflist/$origin/"* "$target_dir/" > /dev/null 2>&1 || :
fi
- MAKE_ARGS="FORCE_PKG_REGISTER=yes DISABLE_VULNERABILITIES=yes `cat \"$target_dir/MARG.conflist\" 2> /dev/null || :`"
+ MAKE_ARGS=`cat "$target_dir/MARG.conflist" 2> /dev/null || :`
+ MAKE_ARGS="${MAKE_ARGS} FORCE_PKG_REGISTER=yes DISABLE_VULNERABILITIES=yes"
MAKE_ENVS=`cat "$target_dir/MENV.conflist" 2> /dev/null || :`
env ${MAKE_ENVS} make -C "${PORTSDIR}/$origin" config-conditional ${MAKE_ARGS}
pkg=`pkg_info_qO "$origin"`
- [ -z "$pkg" ] || echo $pkg > $target_dir/installed_version
+ [ -z "$pkg" ] || echo "$pkg" > $target_dir/installed_version
pkg_new=`env ${MAKE_ENVS} make -C "${PORTSDIR}/$origin" package-name ${MAKE_ARGS}`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
elif [ "z$pkg" != "z$pkg_new" ]
then
- echo $pkg_new > $target_dir/new_version
+ echo "$pkg_new" > $target_dir/new_version
if [ -n "$pkg" ]
then
pkgtag="$pkg => $pkg_new"
fi
fi
echo "$pkgtag" > $target_dir/pkgtag
- env ${MAKE_ENVS} make -C "${PORTSDIR}/$origin" all-depends-list ${MAKE_ARGS} | sed -E "s/^`str_escape_regexp "${PORTSDIR}"`\///" > $target_dir/requires || :
- grep -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" "$target_dir/requires" | grep -v -E "^`str_escape_regexp $origin`$" > ${TMPDIR}/replaced_target.tmp || :
- mv "$target_dir/requires" "$target_dir/requires.orig"
- sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist" "$target_dir/requires.orig" | grep -v '^$' > $target_dir/requires || :
- add_lines_if_new "${DBDIR}/replaced_target.list" < ${TMPDIR}/replaced_target.tmp
- grep -v -E -f "${DBDIR}/installed_ports.grep_pattern" "$target_dir/requires" > ${TMPDIR}/missing.$origin_id || :
+ for tag in all run build
+ do
+ env ${MAKE_ENVS} make -C "${PORTSDIR}/$origin" $tag-depends-list ${MAKE_ARGS} \
+ | sed -E "s/^`str_escape_regexp "${PORTSDIR}"`\///" > $target_dir/requirements_$tag.orig || :
+ sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist" "$target_dir/requirements_$tag.orig" \
+ | grep -v '^$' > $target_dir/requirements_$tag.src || :
+ done
+ grep -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" "$target_dir/requirements_all.orig" \
+ | grep -v -E "^`str_escape_regexp $origin`$" \
+ | add_lines_if_new "${DBDIR}/replaced_target.list" || :
+ grep -v -E -f "${DBDIR}/installed_ports.grep_pattern" "$target_dir/requirements_all.src" \
+ > ${TMPDIR}/missing.$origin_id || :
nlines=`cat "${TMPDIR}/missing.$origin_id" | wc -l`
iline=1
while [ $iline -le $nlines ]
do
origin_dependency=`sed -n ${iline}p "${TMPDIR}/missing.$origin_id"`
iline=$(($iline+1))
- if grep -m 1 -E "^`str_escape_regexp \"$origin_dependency\"`$" "${DBDIR}/target.inspected.list" > /dev/null 2> /dev/null
+ if grep -m 1 -E "^`str_escape_regexp \"$origin_dependency\"`$" "${DBDIR}/target.inspected.list" \
+ > /dev/null 2>&1
then
:
else
DEPTH_INDEX=${DEPTH_INDEX_orig}
}
+get_recursive_dependency_table ()
+{
+ local table origin dbpath origin_esc
+ table=$1
+ origin=$2
+ dbpath="${DBDIR}/requires/$origin"
+ origin_esc=`echo "$origin" | sed 's|/|:|'`
+ [ -e "$dbpath/$table.direct" ] || return 0
+ if [ ! -e "$dbpath/$table" ]
+ then
+ while read origin_requirement
+ do
+ get_recursive_dependency_table "$table" "$origin_requirement"
+ done < $dbpath/$table.direct | sort -u > ${DBDIR}/tmpfile:get_recursive_dependency_table:$origin_esc
+ mv "${DBDIR}/tmpfile:get_recursive_dependency_table:$origin_esc" "$dbpath/$table"
+ fi
+ cat "$dbpath/$table"
+}
+
+inspect_necessity ()
+{
+ local origin dbpath tag
+ origin=$1
+ dbpath=${DBDIR}/requires/$origin
+ [ -e "$dbpath/necessary_port" ] && return
+ tag=run
+ [ -e "$dbpath/new_version" ] && tag=build.direct
+ if [ -e "$dbpath/requirements_$tag" ]
+ then
+ while read origin_requirement
+ do
+ inspect_necessity "$origin_requirement"
+ done < $dbpath/requirements_$tag
+ fi
+ touch "$dbpath/necessary_port"
+}
+
cmt_fail_reinst ()
{
local origin
done < ${DBDIR}/failed.list
}
+get_dependency_tag ()
+{
+ case $include_buildtime_dependencies+$include_runtime_dependencies in
+ yes+yes)
+ echo all;;
+ no+yes)
+ echo run;;
+ yes+no)
+ echo build;;
+ *)
+ echo "ERROR: Invalid combination of option values for build-/run-time dependency evaluation" >&2
+ exit 1;;
+ esac
+}
+
chk_if_target ()
{
- local prefix _is_all _is_target _is_required _is_former_required _is_dependent _is_former_dependent _is_relevant
+ local prefix origin nodedir_req nodedir_ini nodedir_all origin_esc _is_all _is_target _is_required _is_former_required _is_dependent _is_former_dependent _is_relevant deptag
prefix=$1
origin=$2
- if [ -e "${DBDIR}/all/$origin/chk_if_target.param" ]
+ nodedir_req=${DBDIR}/requires/$origin
+ nodedir_ini=${DBDIR}/initial/$origin
+ nodedir_all=${DBDIR}/all/$origin
+ if [ -e "$nodedir_all/chk_if_target.param" ]
then
- . "${DBDIR}/all/$origin/chk_if_target.param"
+ . "$nodedir_all/chk_if_target.param"
else
_is_all=y
_is_target=
_is_dependent=
_is_former_dependent=
_is_relevant=y
+ deptag=`get_dependency_tag`
+ origin_esc=`str_escape_regexp "$origin"`
if [ `cat "${DBDIR}/target_required_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
then
_is_all=
- if grep -m 1 -E "^`str_escape_regexp \"$origin\"`$" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ if grep -m 1 -E "^$origin_esc$" \
+ "${DBDIR}/target_required_ports.specified" > /dev/null 2>&1
then
_is_target=y
- elif [ -e "${DBDIR}/requires/$origin/dependents.pattern" ] && \
- grep -m 1 -E -f "${DBDIR}/requires/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ elif [ -e "$nodedir_req/dependents_$deptag.pattern" ] && \
+ grep -m 1 -E -f "$nodedir_req/dependents_$deptag.pattern" \
+ "${DBDIR}/target_required_ports.specified" > /dev/null 2>&1
then
_is_required=y
- elif [ -e "${DBDIR}/initial/$origin/dependents.pattern" ] && \
- grep -m 1 -E -f "${DBDIR}/initial/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ elif [ -e "$nodedir_ini/dependents_$deptag.pattern" ] && \
+ grep -m 1 -E -f "$nodedir_ini/dependents_$deptag.pattern" \
+ "${DBDIR}/target_required_ports.specified" > /dev/null 2>&1
then
_is_former_required=y
fi
if [ `cat "${DBDIR}/target_dependent_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
then
_is_all=
- if [ -n "${_is_target}" ] || grep -m 1 -E "^`str_escape_regexp \"$origin\"`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ if [ -n "${_is_target}" ] \
+ || grep -m 1 -E "^$origin_esc$" "${DBDIR}/target_dependent_ports.specified" \
+ > /dev/null 2>&1
then
_is_target=y
- elif [ -e "${DBDIR}/requires/$origin/requires.pattern" ] && \
- grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ elif [ -e "$nodedir_req/requirements_$deptag.pattern" ] && \
+ grep -m 1 -E -f "$nodedir_req/requirements_$deptag.pattern" \
+ "${DBDIR}/target_dependent_ports.specified" > /dev/null 2>&1
then
_is_dependent=y
- elif [ -e "${DBDIR}/initial/$origin/requires.pattern" ] && \
- grep -m 1 -E -f "${DBDIR}/initial/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ elif [ -e "$nodedir_ini/requirements_$deptag.pattern" ] && \
+ grep -m 1 -E -f "$nodedir_ini/requirements_$deptag.pattern" \
+ "${DBDIR}/target_dependent_ports.specified" > /dev/null 2>&1
then
_is_former_dependent=y
fi
fi
- [ -n "${_is_all}${_is_target}${_is_required}${_is_former_required}${_is_dependent}${_is_former_dependent}" ] || _is_relevant=
- echo _is_all=${_is_all} > ${TMPDIR}/chk_if_target:results
- echo _is_target=${_is_target} >> ${TMPDIR}/chk_if_target:results
- echo _is_required=${_is_required} >> ${TMPDIR}/chk_if_target:results
- echo _is_former_required=${_is_former_required} >> ${TMPDIR}/chk_if_target:results
- echo _is_dependent=${_is_dependent} >> ${TMPDIR}/chk_if_target:results
- echo _is_former_dependent=${_is_former_dependent} >> ${TMPDIR}/chk_if_target:results
- echo _is_relevant=${_is_relevant} >> ${TMPDIR}/chk_if_target:results
- [ -d "${DBDIR}/all/$origin" ] || mkdir -p "${DBDIR}/all/$origin"
- mv "${TMPDIR}"/chk_if_target:results "${DBDIR}/all/$origin/chk_if_target.param"
+ [ -n "${_is_all}${_is_target}${_is_required}${_is_former_required}${_is_dependent}${_is_former_dependent}" ] \
+ || _is_relevant=
+ echo _is_all=${_is_all} > ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_target=${_is_target} >> ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_required=${_is_required} >> ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_former_required=${_is_former_required} >> ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_dependent=${_is_dependent} >> ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_former_dependent=${_is_former_dependent} >> ${DBDIR}/tmpfile:chk_if_target:results
+ echo _is_relevant=${_is_relevant} >> ${DBDIR}/tmpfile:chk_if_target:results
+ [ -d "$nodedir_all" ] || mkdir -p "$nodedir_all"
+ mv "${DBDIR}/tmpfile:chk_if_target:results" "$nodedir_all/chk_if_target.param"
fi
eval ${prefix}_is_all=\$\{_is_all\}
eval ${prefix}_is_target=\$\{_is_target\}
[ -e "${TMPDIR}/register_globs_only_installed:origins" ] || return 0
while read origin
do
- [ -z `pkg_info_qO "$origin"` ] || echo $origin
+ [ -z `pkg_info_qO "$origin"` ] || echo "$origin"
done < ${TMPDIR}/register_globs_only_installed:origins
}
+chk_and_warn_ignored_target_options ()
+{
+ local option val
+ option=$1
+ val=$2
+ [ -z "$flag" -o ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ] && return
+ echo "WARNING: -$option option is specified but ignored because we are restarting the previous run." >&2
+}
+
+chk_and_warn_ignored_logical_options ()
+{
+ local option var t_var_val var_val
+ option=$1
+ var=$2
+ eval t_var_val=\$\{t_$var\}
+ eval var_val=\$\{$var\}
+ [ $t_var_val = no -o $t_var_val = $var_val ] && return
+ echo "WARNING: -$option option is specified but ignored by transferring the settings from the previous run." >&2
+}
+
+msg_stage ()
+{
+ echo -n "========== $* at `timestamp` =========="
+}
+
+msg_reinststage_info ()
+{
+ echo -n "========== $counter [$*] ($position_msg at `timestamp`) =========="
+}
+
# ==================================================
# ==================== MAIN ========================
# Title
credit
-echo
-echo " Don't hesitate to terminate by CTRL+C anytime you feel the system is heavy to"
-echo "use because you can restart the operation from the terminated point quickly."
-echo
-echo "The current time is `timestamp`"
-echo
+fold -s << eof
-# Check of conflicting option
-[ -z "$target_dependent_ports" -o ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ] || echo "WARNING: -t option is specified but ignored because we are restarting the previous run." >&2
-[ -z "$target_required_ports" -o ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ] || echo "WARNING: -T option is specified but ignored because we are restarting the previous run." >&2
-[ -z "$target_dependent_ports_form2" -o ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ] || echo "WARNING: -r option is specified but ignored because we are restarting the previous run." >&2
-[ -z "$target_required_ports_form2" -o ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ] || echo "WARNING: -R option is specified but ignored because we are restarting the previous run." >&2
-[ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
+ Don't hesitate to terminate by CTRL+C anytime you feel the system is heavy to use because you can restart the operation from the terminated point quickly.
+
+ The current time is `timestamp`
+eof
+
+# Check of conflicting option values
+get_dependency_tag > /dev/null
+chk_and_warn_ignored_target_options t "$target_dependent_ports"
+chk_and_warn_ignored_target_options T "$target_required_ports"
+chk_and_warn_ignored_target_options r "$target_dependent_ports_form2"
+chk_and_warn_ignored_target_options R "$target_required_ports_form2"
+[ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] \
+ || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
# Check whether the temporal database is newer than the ports tree
if [ `id -u` -eq 0 -a "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
exit 1
elif [ $num_pkgng_versions -eq 1 ]
then
- [ -d "${PORTSDIR}/ports-mgmt/pkg" ] || { echo "ERROR: ${PORTSDIR}/ports-mgmt/pkg does not exist" >&2; exit 1; }
+ [ -d "${PORTSDIR}/ports-mgmt/pkg" ] \
+ || { echo "ERROR: ${PORTSDIR}/ports-mgmt/pkg does not exist" >&2; exit 1; }
pkgng_pkg_current=`cat "${TMPDIR}"/pkgng_version`
pkgng_pkg_new=`make -C "${PORTSDIR}/ports-mgmt/pkg" package-name`
if [ -n "$pkgng_pkg_new" ]
elif [ $num_self_versions -eq 1 ]
then
self_origin=`pkg_info_qo "\`cat \"${TMPDIR}\"/self_version\`"`
- [ -d "${PORTSDIR}/$self_origin" ] || { echo "ERROR: ${PORTSDIR}/$self_origin does not exist" >&2; exit 1; }
+ [ -d "${PORTSDIR}/$self_origin" ] \
+ || { echo "ERROR: ${PORTSDIR}/$self_origin does not exist" >&2; exit 1; }
self_pkg_current=`cat "${TMPDIR}"/self_version`
self_pkg_new=`make -C "${PORTSDIR}/$self_origin" package-name`
if [ -n "$self_pkg_new" ]
_filter_only_target=
_for_each_matching_port=
pkgnamedb=requires
+ deptag=`get_dependency_tag`
case ${1:-todo} in
todo)
echo "The following ports are to be reinstalled or newly installed in the current do/redo"
echo "process:"
list=reinst_todo.list
[ -e "${DBDIR}/reinst_todo.list" ] || list=reinst_order.list
- _filter_skip_unchanged=necessary_update
+ _filter_skip_unchanged=necessary_update_$deptag
_filter_only_target=y
;;
done)
echo "The following ports have been successfully reinstalled or newly installed:"
- list=success.list
- _filter_skip_unchanged=necessary_update_completed
+ list=success_$deptag.list
+ _filter_skip_unchanged=necessary_update_completed_$deptag
_filter_only_target=y
;;
redo)
echo "The following ports themselves have been successfully reinstalled or newly installed,"
echo "but are to be reinstalled again because their dependencies were failed:"
- list=success_but_dependencies_failed.list
- _filter_skip_unchanged=necessary_update
+ list=success_but_dependencies_failed_$deptag.list
+ _filter_skip_unchanged=necessary_update_$deptag
_filter_only_target=y
;;
pending)
echo "The following ports need reinstalltion but are to be skipped until their requirements"
echo "succeed:"
- list=todo_after_requirements_succeed.list
- _filter_skip_unchanged=necessary_update
+ list=todo_after_requirements_succeed_$deptag.list
+ _filter_skip_unchanged=necessary_update_$deptag
_filter_only_target=y
;;
resolved)
requirements)
grandtitle="Dependencies based on the latest ports tree"
title="The following ports are required by %s:"
- list=requires
+ list=requirements_$deptag
_for_each_matching_port=y
;;
dependents)
grandtitle="Dependencies based on the latest ports tree"
title="The following ports depend on %s:"
- list=dependents
+ list=dependents_$deptag
_for_each_matching_port=y
;;
*)
do
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
- echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
+ echo "$origin" '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
else
- echo $origin
+ echo "$origin"
fi
done < ${DBDIR}/requires/$origin_target/$list
done
fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
- echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
+ echo "$origin" '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
else
- echo $origin
+ echo "$origin"
fi
done < ${DBDIR}/$list
else
fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
- echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
+ echo "$origin" '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
else
- echo $origin
+ echo "$origin"
fi
done < ${DBDIR}/$list
fi
if [ ! -e "${DBDIR}/COMPLETE_SAVE_OPTIONS" ]
then
- [ ! -e "${DBDIR}"/saved_options.sh ] || echo "(Previous option settings for '-s', '-q' and '-d' are reset.)"
+ [ ! -e "${DBDIR}"/saved_options.sh ] \
+ || echo "(Previous option settings for '-s', '-q', '-b' and '-d' are reset.)"
set | grep -e '^target_dependent_ports=' \
-e '^target_required_ports=' \
-e '^target_dependent_ports_form2=' \
-e '^load_pkgtoolsconf=' \
-e '^avoid_vulner=' \
-e '^skip_unchanged=' \
+ -e '^include_buildtime_dependencies=' \
+ -e '^include_runtime_dependencies=' \
-e '^keep_distfiles=' \
-e '^renew_options=' \
-e '^supress_self_upadte=' \
else
t_avoid_vulner=$avoid_vulner
t_skip_unchanged=$skip_unchanged
+ t_include_buildtime_dependencies=$include_buildtime_dependencies
+ t_include_runtime_dependencies=$include_runtime_dependencies
t_keep_distfiles=$keep_distfiles
. "${DBDIR}"/saved_options.sh
- [ $t_avoid_vulner = no -o $t_avoid_vulner = $avoid_vulner ] || \
- echo "WARNING: -s option is specified but ignored by transferring the settings from the previous run." >&2
- [ $t_skip_unchanged = no -o $t_skip_unchanged = $skip_unchanged ] || \
- echo "WARNING: -q option is specified but ignored by transferring the settings from the previous run." >&2
- [ $t_keep_distfiles = no -o $t_keep_distfiles = $keep_distfiles ] || \
- echo "WARNING: -d option is specified but ignored by transferring the settings from the previous run." >&2
+ chk_and_warn_ignored_logical_options s avoid_vulner
+ chk_and_warn_ignored_logical_options q skip_unchanged
+ chk_and_warn_ignored_logical_options b include_buildtime_dependencies
+ chk_and_warn_ignored_logical_options B include_runtime_dependencies
+ chk_and_warn_ignored_logical_options d keep_distfiles
fi
echo "INFO: List of option values:"
echo "-- Starting to parse pkgtools.conf at `timestamp` (by using installed portupgrade)"
portupgrade_pkg=`pkg_info_qO ports-mgmt/portupgrade`
[ -n "$portupgrade_pkg" ] || portupgrade_pkg=`pkg_info_qO ports-mgmt/portupgrade-devel`
- [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -eq 0 ] || echo "WARNING: Combination with portupgrade-devel-* has not tested."
+ [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -eq 0 ] \
+ || echo "WARNING: Combination with portupgrade-devel-* has not tested."
istart=`grep -m 1 -n -e '^def init_global$' "${PORTUPGRADE}" | cut -d : -f 1` || :
[ -n "$istart" ] || { echo "ERROR: The current installed version of portupgrade is unsupported." >&2; }
sed 1,$(($istart-1))d "${PORTUPGRADE}" > ${TMPDIR}/portupgrade.0
if [ ! -e "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS" ]
then
rm -f "${DBDIR}/target_dependent_ports.specified" "${DBDIR}/target_required_ports.specified"
- register_globs_only_installed "$target_dependent_ports" "$target_dependent_ports_form2" > ${DBDIR}/target_dependent_ports.specified
- register_globs_only_installed "$target_required_ports" "$target_required_ports_form2" > ${DBDIR}/target_required_ports.specified
+ register_globs_only_installed "$target_dependent_ports" "$target_dependent_ports_form2" \
+ > ${DBDIR}/target_dependent_ports.specified
+ register_globs_only_installed "$target_required_ports" "$target_required_ports_form2" \
+ > ${DBDIR}/target_required_ports.specified
touch "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS"
fi
if [ -n "$target_dependent_ports$target_dependent_ports_form2$target_required_ports$target_required_ports_form2" ]
then
echo "INFO: Operations will be applied only to the targets:"
- if [ `cat "${DBDIR}"/target_dependent_ports.specified | wc -l` -gt 0 -a `cat "${DBDIR}"/target_required_ports.specified | wc -l` -gt 0 ]
- then
- echo "----------------------------------------"
- cat "${DBDIR}"/target_dependent_ports.specified
- echo "----------------------------------------"
- echo "and their dependents;"
- echo "----------------------------------------"
- cat "${DBDIR}"/target_required_ports.specified
- echo "----------------------------------------"
- echo "and their requirements."
- echo
- elif [ `cat "${DBDIR}"/target_dependent_ports.specified | wc -l` -gt 0 ]
+ case $include_buildtime_dependencies+$include_runtime_dependencies in
+ yes+yes)
+ dependency_type='run- and build-time';;
+ no+yes)
+ dependency_type='run-time';;
+ yes+no)
+ dependency_type='build-time';;
+ *)
+ echo "ERROR: Invalid combination of option values for build-/run-time dependency evaluation" >&2
+ exit 1;;
+ esac
+ num_specified_dependents=`cat "${DBDIR}"/target_dependent_ports.specified | wc -l`
+ num_specified_requirements=`cat "${DBDIR}"/target_required_ports.specified | wc -l`
+ suffix=.
+ [ $num_specified_dependents -gt 0 -a $num_specified_requirements -gt 0 ] && suffix=';'
+ if [ $num_specified_dependents -gt 0 ]
then
echo "----------------------------------------"
cat "${DBDIR}"/target_dependent_ports.specified
echo "----------------------------------------"
- echo "and their dependents."
- echo
- elif [ `cat "${DBDIR}"/target_required_ports.specified | wc -l` -gt 0 ]
+ echo "and their $dependency_type dependents$suffix"
+ fi
+ if [ $num_specified_requirements -gt 0 ]
then
echo "----------------------------------------"
cat "${DBDIR}"/target_required_ports.specified
echo "----------------------------------------"
- echo "and their requirements."
- echo
+ echo "and their $dependency_type requirements."
else
echo "ERROR: Target ports are specified but none of them is valid." >&2
exit 1
fi
+ echo
fi
# Parse configuration file
set | grep -e '^_CONF_REPLACE_FROM_' | cut -d = -f 1 | while read var
do
eval glob_pattern=\${$var}
- eval to=\${`echo $var | sed 's/^_CONF_REPLACE_FROM_/_CONF_REPLACE_TO_/'`}
+ eval to=\${`echo "$var" | sed 's/^_CONF_REPLACE_FROM_/_CONF_REPLACE_TO_/'`}
expand_glob_pattern_to_origins "$glob_pattern" yes > ${TMPDIR}/origins.2.tmp || :
if [ `cat "${TMPDIR}/origins.2.tmp" | wc -l` -eq 0 ]
then
echo " If still required, use a pattern for port origins instead." >&2
continue
fi
- str_escape_regexp_filter < ${TMPDIR}/origins.2.tmp | sed "s|^|^|; s|$|$|" >> ${DBDIR}/REPLACE.grep_from_pattern.conflist
-
+ str_escape_regexp_filter < ${TMPDIR}/origins.2.tmp \
+ | sed "s|^|^|; s|$|$|" >> ${DBDIR}/REPLACE.grep_from_pattern.conflist
if [ -z "$to" -o "$to" = delete ]
then
to=
else
[ -d "${PORTSDIR}/$to" ] || echo "WARNING: replacement port [$to] is obsolete" >&2
fi
- str_escape_regexp_filter < ${TMPDIR}/origins.2.tmp | sed -E "s|^|s:^|; s/$/$:`str_escape_replaceval \"$to\"`:/" >> ${DBDIR}/REPLACE.replace_pattern.conflist
+ str_escape_regexp_filter < ${TMPDIR}/origins.2.tmp \
+ | sed -E "s|^|s:^|; s/$/$:`str_escape_replaceval \"$to\"`:/" \
+ >> ${DBDIR}/REPLACE.replace_pattern.conflist
done
touch "${DBDIR}/COMPLETE_REFLECTCONF_REPLACE"
fi
then
echo "Starting to collect installed packages at `timestamp`"
pkg_info_qoa 2> /dev/null > ${DBDIR}/installed_ports
- str_escape_regexp_filter < "${DBDIR}/installed_ports" | sed 's/^/^/; s/$/$/' > ${DBDIR}/installed_ports.grep_pattern
+ str_escape_regexp_filter < "${DBDIR}/installed_ports" \
+ | sed 's/^/^/; s/$/$/' > ${DBDIR}/installed_ports.grep_pattern
touch "${DBDIR}/COMPLETE_INSTALLED_PORTS"
echo
fi
then
echo "Starting to check newly installing ports at `timestamp`"
cp "${DBDIR}/installed_ports" "${DBDIR}/target_ports"
- cat "${DBDIR}/target_dependent_ports.specified" "${DBDIR}/target_required_ports.specified" 2> /dev/null | sort -u | add_lines_if_new "${DBDIR}"/target_ports
+ cat "${DBDIR}/target_dependent_ports.specified" "${DBDIR}/target_required_ports.specified" 2> /dev/null \
+ | sort -u | add_lines_if_new "${DBDIR}"/target_ports
touch "${DBDIR}/COMPLETE_TARGETS"
echo
elif [ -e "${DBDIR}/REQUIRE_CHK_NEW_TARGET" ]
then
echo "Starting to check newly installing ports at `timestamp`"
cp "${DBDIR}/target_ports" "${DBDIR}/target_ports.new"
- sort -u "${DBDIR}/target_dependent_ports.specified" "${DBDIR}/target_required_ports.specified" | add_lines_if_new "${DBDIR}"/target_ports.new
+ sort -u "${DBDIR}/target_dependent_ports.specified" "${DBDIR}/target_required_ports.specified" \
+ | add_lines_if_new "${DBDIR}"/target_ports.new
if [ `cat "${DBDIR}/target_ports" | wc -l` -ne `cat "${DBDIR}/target_ports.new" | wc -l` ]
then
echo "WARNING: The temporal database will be refreshed so as to reinstall the all failed ports and their dependents."
rm -f "${DBDIR}/COMPLETE_COLLECED_ALL_DEPENDENCIES" \
"${DBDIR}/COMPLETE_DISTFILES_LIST" \
"${DBDIR}/COMPLETE_CONVERT_REQUIRES_LIST" \
+ "${DBDIR}/COMPLETE_RUNTIME_REQUIREMENT_LISTS" \
+ "${DBDIR}/COMPLETE_BUILDTIME_REQUIREMENT_LISTS" \
"${DBDIR}/COMPLETE_INSPECT_DEPENDENTS" \
+ "${DBDIR}/COMPLETE_PREPARATION_OF_MATCHING_PATTERNS_OF_DEPENDENCIES" \
+ "${DBDIR}/COMPLETE_INSPECT_NECESSITY" \
+ "${DBDIR}/COMPLETE_NECESSARY_UPDATES" \
"${DBDIR}/COMPLETE_COPY_DEPENDENCY_TMPFILES" \
+ "${DBDIR}/COMPLETE_CLEANUP_REINST_STATUS" \
"${DBDIR}/COMPLETE_ORDERED_ALL_DEPENDENCIES" \
"${DBDIR}/COMPLETE_CHECKED_UNSATISFIED_DEPENDENCIES" \
"${DBDIR}/COMPLETE_REFLECTCONF_2"
if [ ! -e "${DBDIR}/COMPLETE_DISTFILES_LIST" -a $keep_distfiles = no ]
then
echo "Starting to summarize distfiles list at `timestamp`"
- sort -u "${DBDIR}/distfiles.list" 2> /dev/null | str_escape_regexp_filter | sed 's|^|^\\.\\/|; s|$|$|' > ${DBDIR}/distfiles.grep.pattern || :
+ sort -u "${DBDIR}/distfiles.list" 2> /dev/null | str_escape_regexp_filter \
+ | sed 's|^|^\\.\\/|; s|$|$|' > ${DBDIR}/distfiles.grep.pattern || :
touch "${DBDIR}/COMPLETE_DISTFILES_LIST"
echo
fi
-# Convert requires-lists to actual ones
-if [ ! -e "${DBDIR}/COMPLETE_CONVERT_REQUIRES_LIST" ]
+# Convert requirements-lists to actual ones
+if [ ! -e "${DBDIR}/COMPLETE_CONVERT_REQUIREMENTS_LIST" ]
then
- echo "Starting conversion of requires-lists to actual ones at `timestamp`"
- if [ -f "${DBDIR}/convert_requires_lists.remain" ]
+ echo "Starting conversion of requirements-lists to actual ones at `timestamp`"
+ if [ -f "${DBDIR}/convert_requirements_lists.remain" ]
then
echo "INFO: Restarting from the previously terminated point"
else
- find "${DBDIR}/requires" -depth 2 -type d > ${DBDIR}/convert_requires_lists.remain
+ ( set -e
+ cd "${DBDIR}/initial" && find . -depth 2 -type d
+ cd "${DBDIR}/requires" && find . -depth 2 -type d
+ ) | sort -u >> ${DBDIR}/convert_requirements_lists.remain
fi
- cp "${DBDIR}/convert_requires_lists.remain" "${TMPDIR}/convert_requires_lists"
+ cp "${DBDIR}/convert_requirements_lists.remain" "${TMPDIR}/convert_requirements_lists"
while read dbpath
do
portname=`basename "$dbpath"`
catpath=`dirname "$dbpath"`
catname=`basename "$catpath"`
origin=$catname/$portname
- sed -E -f "${DBDIR}/REPLACE.complete_replace_pattern" "$dbpath/requires" | grep -v '^$' | sort -u > $dbpath/requires.new
- mv "$dbpath/requires.new" "$dbpath/requires"
- sed -i '' 1d "${DBDIR}/convert_requires_lists.remain"
- done < ${TMPDIR}/convert_requires_lists
- touch "${DBDIR}/COMPLETE_CONVERT_REQUIRES_LIST"
+ for table in dependents requirements
+ do
+ for tag in all run build
+ do
+ for dbtag in requires initial
+ do
+ target=${DBDIR}/$dbtag/$origin/${table}_${tag}
+ [ -e "$target" ] || continue
+ sed -E -f "${DBDIR}/REPLACE.complete_replace_pattern" "$target.src" \
+ | grep -v '^$' | sort -u > $target
+ done
+ done
+ done
+ for tag in run build
+ do
+ mv "${DBDIR}/requires/$origin/requirements_$tag" "${DBDIR}/requires/$origin/requirements_$tag.direct"
+ done
+ sed -i '' 1d "${DBDIR}/convert_requirements_lists.remain"
+ done < ${TMPDIR}/convert_requirements_lists
+ touch "${DBDIR}/COMPLETE_CONVERT_REQUIREMENTS_LIST"
+ echo
+fi
+
+# Completion of run-time requirement lists
+if [ ! -e "${DBDIR}/COMPLETE_RUNTIME_REQUIREMENT_LISTS" ]
+then
+ echo "Starting completion of run-time requirement lists at `timestamp`"
+ if [ -f "${DBDIR}/complete_runtime_reqlists.remain" ]
+ then
+ echo "INFO: Restarting from the previously terminated point"
+ else
+ find "${DBDIR}/requires" -depth 3 -type f -name requirements_run.direct \
+ > ${DBDIR}/complete_runtime_reqlists.remain
+ fi
+ cp "${DBDIR}/complete_runtime_reqlists.remain" "${TMPDIR}/complete_runtime_reqlists"
+ while read reqlist
+ do
+ dbpath=`dirname "$reqlist"`
+ portname=`basename "$dbpath"`
+ catpath=`dirname "$dbpath"`
+ catname=`basename "$catpath"`
+ origin=$catname/$portname
+ get_recursive_dependency_table requirements_run "$origin" > /dev/null
+ sed -i '' 1d "${DBDIR}/complete_runtime_reqlists.remain"
+ done < ${TMPDIR}/complete_runtime_reqlists
+ touch "${DBDIR}/COMPLETE_RUNTIME_REQUIREMENT_LISTS"
+ echo
+fi
+
+# Completion of build-time requirement lists
+if [ ! -e "${DBDIR}/COMPLETE_BUILDTIME_REQUIREMENT_LISTS" ]
+then
+ echo "Starting completion of build-time requirement lists at `timestamp`"
+ if [ -f "${DBDIR}/complete_buildtime_reqlists.remain" ]
+ then
+ echo "INFO: Restarting from the previously terminated point"
+ else
+ find "${DBDIR}/requires" -depth 3 -type f -name requirements_build.direct \
+ > ${DBDIR}/complete_buildtime_reqlists.remain
+ fi
+ cp "${DBDIR}/complete_buildtime_reqlists.remain" "${TMPDIR}/complete_buildtime_reqlists"
+ while read reqlist
+ do
+ dbpath=`dirname "$reqlist"`
+ portname=`basename "$dbpath"`
+ catpath=`dirname "$dbpath"`
+ catname=`basename "$catpath"`
+ origin=$catname/$portname
+ get_recursive_dependency_table requirements_build "$origin" > /dev/null
+ sed -i '' 1d "${DBDIR}/complete_buildtime_reqlists.remain"
+ done < ${TMPDIR}/complete_buildtime_reqlists
+ touch "${DBDIR}/COMPLETE_BUILDTIME_REQUIREMENT_LISTS"
echo
fi
else
find "${DBDIR}/requires" -depth 2 -type d > ${DBDIR}/inspect_dependent.remain
fi
+ dbrequires_valesc=`str_escape_replaceval "${DBDIR}/requires/"`
cp "${DBDIR}/inspect_dependent.remain" "${TMPDIR}/inspect_dependent"
while read dbpath
do
catpath=`dirname "$dbpath"`
catname=`basename "$catpath"`
origin=$catname/$portname
- sed -E "s/^/`str_escape_replaceval \"${DBDIR}/requires/\"`/; s|$|/dependents|" "$dbpath/requires" | add_a_line_to_files_if_new "$origin"
+ for tag in all run build
+ do
+ sed -E "s/^/$dbrequires_valesc/; s|$|/dependents_$tag|" "$dbpath/requirements_$tag" \
+ | add_a_line_to_files_if_new "$origin"
+ done
sed -i '' 1d "${DBDIR}/inspect_dependent.remain"
done < ${TMPDIR}/inspect_dependent
touch "${DBDIR}/COMPLETE_INSPECT_DEPENDENTS"
catpath=`dirname "$dbpath"`
catname=`basename "$catpath"`
origin=$catname/$portname
- [ ! -e "${DBDIR}/requires/$origin/dependents" ] || str_escape_regexp_filter < ${DBDIR}/requires/$origin/dependents | sed 's/^/^/;s/$/$/' > ${DBDIR}/requires/$origin/dependents.pattern
- [ ! -e "${DBDIR}/initial/$origin/dependents" ] || str_escape_regexp_filter < ${DBDIR}/initial/$origin/dependents | sed 's/^/^/;s/$/$/' > ${DBDIR}/initial/$origin/dependents.pattern
- [ ! -e "${DBDIR}/requires/$origin/requires" ] || str_escape_regexp_filter < ${DBDIR}/requires/$origin/requires | sed 's/^/^/;s/$/$/' > ${DBDIR}/requires/$origin/requires.pattern
- [ ! -e "${DBDIR}/initial/$origin/requires" ] || str_escape_regexp_filter < ${DBDIR}/initial/$origin/requires | sed 's/^/^/;s/$/$/' > ${DBDIR}/initial/$origin/requires.pattern
+ for table in dependents requirements
+ do
+ for tag in all run build
+ do
+ for dbtag in requires initial
+ do
+ target=${DBDIR}/$dbtag/$origin/${table}_${tag}
+ [ -e "$target" ] || continue
+ str_escape_regexp_filter < $target \
+ | sed 's/^/^/;s/$/$/' > $target.pattern
+ done
+ done
+ done
chk_if_target currentorigin "$origin"
+ [ -n "${currentorigin_is_relevant}" ] && touch "$dbpath/relevant_to_target"
sed -i '' 1d "${DBDIR}/prepare_matching_patterns_dependencies.remain"
done < ${DBDIR}/prepare_matching_patterns_dependencies
touch "${DBDIR}/COMPLETE_PREPARATION_OF_MATCHING_PATTERNS_OF_DEPENDENCIES"
echo
fi
+# Inspection of necessity
+if [ ! -e "${DBDIR}/COMPLETE_INSPECT_NECESSITY" ]
+then
+ echo "Starting inspection of necessity at `timestamp`"
+ if [ -f "${DBDIR}/inspect_necessity.remain" ]
+ then
+ echo "INFO: Restarting from the previously terminated point"
+ else
+ find "${DBDIR}/requires" -depth 3 -type f \
+ \( -name installed_version -or -name relevant_to_target \) \
+ | sed 's|/[^/]*$||' | sort -u > ${DBDIR}/inspect_necessity.remain
+ fi
+ cp "${DBDIR}/inspect_necessity.remain" "${TMPDIR}/inspect_necessity"
+ while read markerpath
+ do
+ dbpath=`dirname "$markerpath"`
+ portname=`basename "$dbpath"`
+ catpath=`dirname "$dbpath"`
+ catname=`basename "$catpath"`
+ origin=$catname/$portname
+ inspect_necessity "$origin"
+ sed -i '' 1d "${DBDIR}/inspect_necessity.remain"
+ done < ${TMPDIR}/inspect_necessity
+ touch "${DBDIR}/COMPLETE_INSPECT_NECESSITY"
+ echo
+fi
+
# Inspection of necessary updates
if [ ! -e "${DBDIR}/COMPLETE_NECESSARY_UPDATES" ]
then
then
echo "INFO: Restarting from the previously terminated point"
else
- find "${DBDIR}/requires" -depth 2 -type d > ${DBDIR}/necessary_updates.remain
+ find "${DBDIR}/requires" -depth 3 -type f -name necessary_port > ${DBDIR}/necessary_updates.remain
fi
cp "${DBDIR}/necessary_updates.remain" "${TMPDIR}/necessary_updates"
- while read dbpath
+ while read markerpath
do
- portname=`basename "$dbpath"`
- catpath=`dirname "$dbpath"`
- catname=`basename "$catpath"`
- origin=$catname/$portname
- if [ -e "${DBDIR}/requires/$origin/new_version" ]
+ dbpath=`dirname "$markerpath"`
+ if [ -e "$dbpath/new_version" ]
then
- touch "${DBDIR}/requires/$origin/necessary_update"
- if [ -e "${DBDIR}/requires/$origin/dependents" ]
- then
- while read origin_dependent
- do
- touch "${DBDIR}/requires/$origin_dependent/necessary_update"
- done < ${DBDIR}/requires/$origin/dependents
- fi
+ for tag in all run build
+ do
+ touch "$dbpath/necessary_update_$tag"
+ if [ -e "$dbpath/dependents_$tag" ]
+ then
+ while read origin_dependent
+ do
+ touch "${DBDIR}/requires/$origin_dependent/necessary_update_$tag"
+ done < $dbpath/dependents_$tag
+ fi
+ done
fi
sed -i '' 1d "${DBDIR}/necessary_updates.remain"
done < ${TMPDIR}/necessary_updates
if [ ! -e "${DBDIR}/COMPLETE_COPY_DEPENDENCY_TMPFILES" ]
then
echo "Starting preparation for order of dependencies at `timestamp`"
- find "${DBDIR}/requires" -depth 3 -name requires -exec cp -p {} {}.remained \;
+ find "${DBDIR}/requires" -depth 3 -name requirements_all -exec cp -p {} {}.remained \;
touch "${DBDIR}/COMPLETE_COPY_DEPENDENCY_TMPFILES"
echo
fi
if (i == 0)
{
target = \$0;
- sub (/\/requires\.remained$/, "", target);
+ sub (/\/requirements_all\.remained$/, "", target);
sub (/^\.\//, "", target);
srcikey[it] = target;
srckeyi[target] = it;
}
}
eof
- find . -depth 3 -name requires.remained -exec echo {} \; -exec cat {} \; -exec echo \; | \
+ find . -depth 3 -name requirements_all.remained -exec echo {} \; -exec cat {} \; -exec echo \; | \
env DBDIR=${DBDIR} awk -f "${TMPDIR}"/order_dependencies.awk || { \
echo "ERROR: Unsatisfied dependencies are remained" >&2
cat "${DBDIR}/unsatisfied.list"
echo
fi
-# Deinstallation of obsolete packages
+# Composition of a list for deinstallation of obsolete packages
if [ ! -e "${DBDIR}/COMPLETE_LIST_DEINST_OBS_PKGS" ]
then
- echo "Starting to compose a list of deinstallation of obsolete packages at `timestamp`"
+ echo "Starting to compose a list for deinstallation of obsolete packages at `timestamp`"
while read origin
do
- origin_ptn=`str_escape_regexp ${origin}`
- [ `grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null | wc -l` -gt 0 ] || echo $origin
+ origin_ptn=`str_escape_regexp "${origin}"`
+ grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" > /dev/null 2>&1 || \
+ echo "$origin"
done < ${DBDIR}/moved_or_lost.list > ${DBDIR}/moved_or_lost.actual.list.tmp
mv "${DBDIR}"/moved_or_lost.actual.list.tmp "${DBDIR}"/moved_or_lost.actual.list
touch "${DBDIR}/COMPLETE_LIST_DEINST_OBS_PKGS"
continue
fi
origin_ptn=`str_escape_regexp ${origin}`
- if [ `grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null | wc -l` -gt 0 ]
+ if grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" > /dev/null 2>&1
then
+ :
+ else
echo "-- (Skipping a hold package for obsolete port $origin as $currentpkg)"
continue
fi
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
- echo "========== Starting deinstallation process for obsolete port $origin as $currentpkg =========="
+ msg_stage "Starting deinstallation process for obsolete port $origin as $currentpkg"
if [ -z "${currentorigin_is_all}" -a -n "${currentorigin_is_relevant}" ]
then
- [ -z "${currentorigin_is_target}" ] || echo "(Target port)"
- [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))"
- [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))"
- [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))"
- [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))"
+ [ -z "${currentorigin_is_target}" ] \
+ || echo "(Target port)"
+ [ -z "${currentorigin_is_dependent}" ] \
+ || echo "(Dependent of the target port(s))"
+ [ -z "${currentorigin_is_required}" ] \
+ || echo "(Requirement of the target port(s))"
+ [ -z "${currentorigin_is_former_dependent}" ] \
+ || echo "(Former dependent of the target port(s))"
+ [ -z "${currentorigin_is_former_required}" ] \
+ || echo "(Former requirement of the target port(s))"
fi
echo "-- (Creating backup package for $origin as $currentpkg)"
- tag=`echo $origin | sed 's|/|.|'`
+ tag=`echo "$origin" | sed 's|/|.|'`
if [ ! -e "${DBDIR}/status_deinst/$tag.backup" ]
then
backup_pkg=`create_backup_pkg "$currentpkg" "${DBDIR}/backup_obsolete"` || :
touch "${DBDIR}/status_deinst/$tag.backup"
fi
echo "-- (Deleting package for $origin as $currentpkg)"
- pkg_delete_f "$currentpkg" || { echo "*** Continuating forcibly by hoping success..."; continue; }
+ pkg_delete_f "$currentpkg" \
+ || { echo "*** Continuating forcibly by hoping success..."; continue; }
rm_a_line "$origin" "${DBDIR}/moved_or_lost.list.remained"
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
echo
fi
# Reinstallation of remained ports
-[ ! -e "${DBDIR}/MODE_REDO" ] || rm -f "${DBDIR}/COMPLETE_REINSTALLATION" "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" "${DBDIR}/COMPLETE_REBUILD_PKGDB"
+[ ! -e "${DBDIR}/MODE_REDO" ] \
+ || rm -f "${DBDIR}/COMPLETE_REINSTALLATION" \
+ "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" \
+ "${DBDIR}/COMPLETE_REBUILD_PKGDB"
[ `cat "${DBDIR}/reinst_order.list" | wc -l` -gt 0 ] || touch "${DBDIR}/COMPLETE_REINSTALLATION"
if [ ! -e "${DBDIR}/COMPLETE_REINSTALLATION" ]
then
rm -f "${DBDIR}/MODE_REDO"
cp -p "${DBDIR}/reinst_todo.list" "${TMPDIR}/reinst_todo.tmp"
touch "${DBDIR}/failed.list"
- touch "${DBDIR}/success_but_dependencies_failed.list"
- touch "${DBDIR}/success.list"
+ for tag in all run build
+ do
+ touch "${DBDIR}/success_but_dependencies_failed_$tag.list"
+ touch "${DBDIR}/success_$tag.list"
+ done
nlines_tot=$((`cat "${DBDIR}/reinst_order.list" | wc -l`))
nlines=`cat "${TMPDIR}/reinst_todo.tmp" | wc -l`
icount=$(($nlines_tot-$nlines))
origin=`sed -n ${iline}p "${TMPDIR}/reinst_todo.tmp"`
iline=$(($iline+1))
icount=$(($icount+1))
- MAKE_ARGS="FORCE_PKG_REGISTER=yes `[ $avoid_vulner = yes ] || echo DISABLE_VULNERABILITIES=yes` `cat "${DBDIR}/requires/$origin/MARG.conflist" 2> /dev/null || :`"
- MAKE_ENVS=`cat "${DBDIR}/requires/$origin/MENV.conflist" 2> /dev/null || :`
+ nodedir=${DBDIR}/requires/$origin
+ origin_regexp_esc=`str_escape_regexp "${origin}"`
+ arg_vuln=`[ $avoid_vulner = yes ] || echo DISABLE_VULNERABILITIES=yes`
+ src_conflist=`cat "$nodedir/MARG.conflist" 2> /dev/null || :`
+ MAKE_ARGS="FORCE_PKG_REGISTER=yes $arg_vuln $src_conflist"
+ MAKE_ENVS=`cat "$nodedir/MENV.conflist" 2> /dev/null || :`
counter="[$icount/$nlines_tot $(($icount*100/$nlines_tot))%]"
- if [ -e "${DBDIR}"/requires/$origin/new_version ]
- then
- newpkg=`cat "${DBDIR}"/requires/$origin/new_version`
- else
- newpkg=
- fi
+ newpkg=`cat "$nodedir/new_version" 2> /dev/null || :`
currentpkg=`pkg_info_qO "$origin" 2> /dev/null || :`
if [ -n "$currentpkg" ]
then
origpkg=$currentpkg
else
- origpkg=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+ origpkg=`cat "$nodedir/backedup_version" 2> /dev/null || :`
fi
pkgtag=$origpkg
is_currentport_latest=no
else
is_currentport_latest=yes
fi
- echo $pkgtag > ${DBDIR}/requires/$origin/pkgtag
+ echo "$pkgtag" > $nodedir/pkgtag
position_msg="$origin ($pkgtag)"
- if grep -m 1 -E "^`str_escape_regexp ${origin}`$" "${DBDIR}/success.list" 2> /dev/null > /dev/null
+ deptag=`get_dependency_tag`
+ if grep -m 1 -E "^$origin_regexp_esc$" "${DBDIR}/success_$deptag.list" > /dev/null 2>&1
then
- echo "========== $counter (Skipping an already reinstalled package for port $position_msg at `timestamp`) =========="
+ msg_reinststage_info "Skipping an already reinstalled package"
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
if [ $skip_unchanged = yes -a $is_currentport_latest = yes ]
then
- if [ ! -e "${DBDIR}/requires/$origin/necessary_update" ]
+ if [ ! -e "$nodedir/necessary_update_$deptag" ]
then
- echo "========== $counter (Skipping a port, $position_msg, because itself and the all of its requirements are already latest at `timestamp`) =========="
+ if [ -e "$nodedir/installed_version" ]
+ then
+ msg_reinststage_info "Skipping because being already latest as well as the all requirements"
+ else
+ msg_reinststage_info "Skipping because being an only-build-time dependency of already latest packages"
+ fi
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
fi
- if [ \( $skip_unchanged = no -a -e "${DBDIR}/requires/$origin/succeeded_once" \) -o \( $skip_unchanged = yes -a $is_currentport_latest = yes \) ]
+ if [ \( $skip_unchanged = no -a -e "$nodedir/succeeded_once" \) \
+ -o \( $skip_unchanged = yes -a $is_currentport_latest = yes \) ]
then
- if [ ! -e "${DBDIR}/requires/$origin/need_reinstall_due_to_updated_requirements" ]
+ if [ ! -e "$nodedir/need_reinstall_due_to_updated_requirements_$deptag" ]
then
- if [ ! -e "${DBDIR}/requires/$origin/failed_requirements.previous" ]
+ if [ ! -e "$nodedir/failed_requirements_$deptag.previous" ]
then
need_update=no
else
- sort -u "${DBDIR}/requires/$origin/failed_requirements" > ${TMPDIR}/failed_requirements.new
- sort -u "${DBDIR}/requires/$origin/failed_requirements.previous" > ${TMPDIR}/failed_requirements.old
+ sort -u "$nodedir/failed_requirements_$deptag" > ${TMPDIR}/failed_requirements.new
+ sort -u "$nodedir/failed_requirements_$deptag.previous" > ${TMPDIR}/failed_requirements.old
if diff "${TMPDIR}/failed_requirements.old" "${TMPDIR}/failed_requirements.new" \
> ${TMPDIR}/failed_requirements.diff
then
fi
if [ $need_update = no ]
then
- echo "========== $counter (Skipping a port, $position_msg, because itself and the all of its requirements are already latest or left failed in update at `timestamp`) =========="
+ msg_reinststage_info "Skipping because being already latest or failed as well as the all requirements"
echo
- add_a_line_if_new "$origin" "${DBDIR}/todo_after_requirements_succeed.list"
+ add_a_line_if_new "$origin" "${DBDIR}/todo_after_requirements_succeed_$deptag.list"
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
then
if [ -n "${currentorigin_is_relevant}" ]
then
- [ -z "${currentorigin_is_target}" ] || echo "(Target port)" > ${TMPDIR}/msg_if_target
- [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_target}" ] \
+ || echo "(Target port)" > ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_dependent}" ] \
+ || echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_required}" ] \
+ || echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_dependent}" ] \
+ || echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_required}" ] \
+ || echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
else
- echo "========== $counter (Skipping an irrelevant package for port $position_msg at `timestamp`) =========="
+ msg_reinststage_info "Skipping because being irrelevant"
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
fi
- if grep -m 1 -E "^`str_escape_regexp ${origin}`$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null > /dev/null
+ if grep -m 1 -E "^$origin_regexp_esc$" "${DBDIR}/HOLD_PORTS.conflist" > /dev/null 2>&1
then
- echo "========== $counter (Skipping a hold package for port $position_msg at `timestamp`) =========="
+ msg_reinststage_info "Skipping because being a hold package"
cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/taboo.all.list" 2> /dev/null > /dev/null
+ if grep -m 1 -E "^$origin_regexp_esc$" "${DBDIR}/taboo.all.list" > /dev/null 2>&1
then
- echo "========== $counter (Ignored a taboo port $position_msg at `timestamp`) =========="
+ msg_reinststage_info "Ignored because being taboo"
cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/manually_done.list" 2> /dev/null > /dev/null
+ if grep -m 1 -E "^$origin_regexp_esc$" "${DBDIR}/manually_done.list" > /dev/null 2>&1
then
- echo "========== $counter (Marking a manually-done port $position_msg as success at `timestamp`) =========="
+ msg_reinststage_info "Marking to be manually-done"
cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- if [ -e "${DBDIR}/requires/$origin/SUPPRESSED" ]
+ if [ -e "$nodedir/SUPPRESSED" ]
then
- echo "========== $counter (Skipping a suppressed port $position_msg as success at `timestamp`) =========="
+ msg_reinststage_info "Skipping because being suppressed"
cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- if [ -e "${DBDIR}/requires/$origin/installed_version" ]
+ if [ -e "$nodedir/installed_version" ]
then
insttarget=reinstall
instdesc='a reinstallation'
instdesc='an installation'
fi
_MSG_CURRENT_STAGE="$instdesc process for $position_msg $counter"
- echo "========== $counter Starting $instdesc process for $position_msg at `timestamp` =========="
+ msg_stage "$counter Starting $instdesc process for $position_msg"
cat ${TMPDIR}/msg_if_target
cd "${PORTSDIR}/$origin"
- if [ -e "${DBDIR}/requires/$origin/status/in_build" ]
+ if [ -e "$nodedir/status/in_build" ]
then
echo "(Restarting the previously terminated build process...)"
flag_restarted_build=yes
else
- touch "${DBDIR}/requires/$origin/status/in_build"
+ touch "$nodedir/status/in_build"
flag_restarted_build=no
fi
- if [ -e "${DBDIR}/requires/$origin/BEFOREBUILD.conflist" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREBUILD" ]
+ if [ -e "$nodedir/BEFOREBUILD.conflist" -a ! -e "$nodedir/status/COMPLETE_BEFOREBUILD" ]
then
echo "-- BEFOREBUILD operations (start)"
- sh -e "${DBDIR}/requires/$origin/BEFOREBUILD.conflist" || \
+ sh -e "$nodedir/BEFOREBUILD.conflist" || \
{
echo "ERROR: while BEFOREBUILD operations for ${PORTSDIR}/$position_msg." >&2
- echo 'BEFOREBUILD operations' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'BEFOREBUILD operations' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
}
echo "-- BEFOREBUILD operations (end)"
- touch "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREBUILD"
+ touch "$nodedir/status/COMPLETE_BEFOREBUILD"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_BEFORE_BUILD" ]
+ if [ ! -e "$nodedir/status/COMPLETE_CLEAN_BEFORE_BUILD" ]
then
env ${MAKE_ENVS} make clean ${MAKE_ARGS} || \
{
echo "ERROR: Check the permission of directory ${PORTSDIR}/$position_msg." >&2
- echo 'clean before build' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'clean before build' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
}
echo
- touch "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_BEFORE_BUILD"
+ touch "$nodedir/status/COMPLETE_CLEAN_BEFORE_BUILD"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_FETCH" ]
+ if [ ! -e "$nodedir/status/COMPLETE_FETCH" ]
then
- if [ ! -e "${DBDIR}/requires/$origin/status/FAILED_FETCH" ]
+ if [ ! -e "$nodedir/status/FAILED_FETCH" ]
then
- if env ${MAKE_ENVS} make checksum ${MAKE_ARGS}
- then
- :
- else
- touch "${DBDIR}/requires/$origin/status/FAILED_FETCH"
- fi
+ env ${MAKE_ENVS} make checksum ${MAKE_ARGS} || \
+ touch "$nodedir/status/FAILED_FETCH"
fi
- if [ -e "${DBDIR}/requires/$origin/status/FAILED_FETCH" ]
+ if [ -e "$nodedir/status/FAILED_FETCH" ]
then
echo "WARNING: Refetching distfiles for ${PORTSDIR}/$position_msg." >&2
-# if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE.FAILED_FETCH.DISTCLEAN" ]
+# if [ ! -e "$nodedir/status/COMPLETE.FAILED_FETCH.DISTCLEAN" ]
# then
# env ${MAKE_ENVS} make distclean NOCLEANDEPENDS=yes ${MAKE_ARGS} || \
# {
# echo "ERROR: Failed in distclean for ${PORTSDIR}/$position_msg." >&2
-# echo 'distclean for refetch' > ${DBDIR}/requires/$origin/note_failtre
+# echo 'distclean for refetch' > $nodedir/note_failtre
# record_failure $origin
# rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
# cmt_fail_reinst "$origin"
# continue
# }
-# touch "${DBDIR}/requires/$origin/status/COMPLETE.FAILED_FETCH.DISTCLEAN"
+# touch "$nodedir/status/COMPLETE.FAILED_FETCH.DISTCLEAN"
# fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE.FAILED_FETCH.REFETCH" ]
+ if [ ! -e "$nodedir/status/COMPLETE.FAILED_FETCH.REFETCH" ]
then
env ${MAKE_ENVS} make fetch ${MAKE_ARGS} FETCH_ARGS=-Ap || \
{
echo "ERROR: Failed in fetch for ${PORTSDIR}/$position_msg." >&2
- echo 'fetch' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'fetch' > $nodedir/note_failtre
record_failure $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
env ${MAKE_ENVS} make checksum ${MAKE_ARGS} || \
{
echo "ERROR: Failed in checksum for ${PORTSDIR}/$position_msg." >&2
- echo 'checksum' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'checksum' > $nodedir/note_failtre
record_failure $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
}
- touch "${DBDIR}/requires/$origin/status/COMPLETE.FAILED_FETCH.REFETCH"
+ touch "$nodedir/status/COMPLETE.FAILED_FETCH.REFETCH"
fi
fi
- touch "${DBDIR}/requires/$origin/status/COMPLETE_FETCH"
+ touch "$nodedir/status/COMPLETE_FETCH"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BUILD" ]
+ if [ ! -e "$nodedir/status/COMPLETE_BUILD" ]
then
if env ${MAKE_ENVS} make ${MAKE_ARGS}
then
:
elif [ $flag_restarted_build = yes ]
then
- rm "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_BEFORE_BUILD"
+ rm "$nodedir/status/COMPLETE_CLEAN_BEFORE_BUILD"
echo "INFO: This failure may be due to restarting from a terminated build." >&2
echo "WARNING: Retrying build after cleaning for ${PORTSDIR}/$position_msg." >&2
env ${MAKE_ENVS} make clean ${MAKE_ARGS} || \
{
echo "ERROR: Check the permission of directory ${PORTSDIR}/$position_msg." >&2
- echo 'build and clean after build failure' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'build and clean after build failure' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
then
:
else
- echo 'build' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'build' > $nodedir/note_failtre
record_failure $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
fi
else
- echo 'build' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'build' > $nodedir/note_failtre
record_failure $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
fi
- touch "${DBDIR}/requires/$origin/status/COMPLETE_BUILD"
+ touch "$nodedir/status/COMPLETE_BUILD"
fi
- rm -f "${DBDIR}/requires/$origin/status/in_build"
- if [ -e "${DBDIR}/requires/$origin/status/in_install" ]
+ rm -f "$nodedir/status/in_build"
+ if [ -e "$nodedir/status/in_install" ]
then
echo "(Restarting the previously terminated installation process...)"
else
- touch "${DBDIR}/requires/$origin/status/in_install"
+ touch "$nodedir/status/in_install"
fi
- if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP" ]
+ if [ -n "$currentpkg" -a ! -e "$nodedir/status/COMPLETE_PKG_BACKUP" ]
then
echo "-- (Creating temporal backup package for $position_msg)"
backup_pkg=`create_backup_pkg "$currentpkg" "${DBDIR}/backup_failure"` || \
echo "WARNING: Failed to create the backup package, but ignored by hoping success." >&2
}
cd "${PORTSDIR}/$origin"
- echo $currentpkg > ${DBDIR}/requires/$origin/backedup_version
- echo $backup_pkg > ${DBDIR}/requires/$origin/backedup_pkgfile
- touch "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP"
+ echo "$currentpkg" > $nodedir/backedup_version
+ echo "$backup_pkg" > $nodedir/backedup_pkgfile
+ touch "$nodedir/status/COMPLETE_PKG_BACKUP"
fi
- if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL" ]
+ if [ -n "$currentpkg" -a ! -e "$nodedir/status/COMPLETE_BEFOREDEINSTALL" ]
then
- if [ -e "${DBDIR}/requires/$origin/BEFOREDEINSTALL.conflist" ]
+ if [ -e "$nodedir/BEFOREDEINSTALL.conflist" ]
then
echo "-- BEFOREDEINSTALL operations (start)"
- sh -e "${DBDIR}/requires/$origin/BEFOREDEINSTALL.conflist" || \
+ sh -e "$nodedir/BEFOREDEINSTALL.conflist" || \
{
echo "ERROR: while BEFOREDEINSTALL operations for ${PORTSDIR}/$position_msg." >&2
- echo 'BEFOREDEINSTALL operations' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'BEFOREDEINSTALL operations' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
}
echo "-- BEFOREDEINSTALL operations (end)"
fi
- touch "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL"
+ touch "$nodedir/status/COMPLETE_BEFOREDEINSTALL"
fi
- if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_DEINSTALL" ]
+ if [ -n "$currentpkg" -a ! -e "$nodedir/status/COMPLETE_DEINSTALL" ]
then
pkg_delete_f $currentpkg || \
{
{
echo "WARNING: Failed to deinstall $currentpkg by make deinstall." >&2
}
- touch "${DBDIR}/requires/$origin/status/COMPLETE_DEINSTALL"
+ touch "$nodedir/status/COMPLETE_DEINSTALL"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_INSTALL" ]
+ if [ ! -e "$nodedir/status/COMPLETE_INSTALL" ]
then
- if [ ! -e "${DBDIR}/requires/$origin/status/FAILED_INSTALL" ]
+ if [ ! -e "$nodedir/status/FAILED_INSTALL" ]
then
if env ${MAKE_ENVS} make $insttarget ${MAKE_ARGS}
then
- touch "${DBDIR}/requires/$origin/status/COMPLETE_INSTALL"
+ touch "$nodedir/status/COMPLETE_INSTALL"
else
- touch "${DBDIR}/requires/$origin/status/FAILED_INSTALL"
+ touch "$nodedir/status/FAILED_INSTALL"
fi
fi
- if [ -e "${DBDIR}/requires/$origin/status/FAILED_INSTALL" ]
+ if [ -e "$nodedir/status/FAILED_INSTALL" ]
then
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.RECOVER" ]
+ if [ ! -e "$nodedir/status/COMPETE.FAILED_INSTALL.RECOVER" ]
then
echo "*** Trying to deinstall the failed/terminated installation... (Ignore failures)"
if [ -n "$currentpkg" ]
fi
echo "*** Trying to deinstall by ports to make sure. (This usually ends up with warnings)"
env ${MAKE_ENVS} make deinstall ${MAKE_ARGS} || :
- backedup_version=`cat "${DBDIR}/requires/$origin/backedup_version" 2> /dev/null || :`
+ backedup_version=`cat "$nodedir/backedup_version" 2> /dev/null || :`
if [ -n "$backedup_version" ]
then
echo "*** Restoring the backup of $backedup_version..."
- backup_pkg=`cat "${DBDIR}/requires/$origin/backedup_pkgfile" || :`
+ backup_pkg=`cat "$nodedir/backedup_pkgfile" || :`
if [ -z "$backup_pkg" -o ! -e "$backup_pkg" ]
then
echo "WARNING: No backup exists, gave up." >&2
echo "WARNING: Failed to restore $backedup_version. Note that your system may experience troubles by this error." >&2
fi
fi
- touch "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.RECOVER"
+ touch "$nodedir/status/COMPETE.FAILED_INSTALL.RECOVER"
fi
- if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.AFTERINSTALL" -a -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" ]
+ if [ -n "$currentpkg" -a ! -e "$nodedir/status/COMPETE.FAILED_INSTALL.AFTERINSTALL" -a -e "$nodedir/AFTERINSTALL.conflist" ]
then
echo "-- AFTERINSTALL operations (start)"
- sh -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" || { echo "-- (This error is ignored)"; }
+ sh -e "$nodedir/AFTERINSTALL.conflist" || { echo "-- (This error is ignored)"; }
echo "-- AFTERINSTALL operations (end)"
- touch "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.AFTERINSTALL"
+ touch "$nodedir/status/COMPETE.FAILED_INSTALL.AFTERINSTALL"
fi
- echo 'install' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'install' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
fi
fi
- if [ -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" -a ! -e "${DBDIR}/requires/$origin/status/in_install.AFTERINSTALL" ]
+ if [ -e "$nodedir/AFTERINSTALL.conflist" -a ! -e "$nodedir/status/in_install.AFTERINSTALL" ]
then
echo "-- AFTERINSTALL operations (start)"
- sh -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" || \
+ sh -e "$nodedir/AFTERINSTALL.conflist" || \
{
echo "ERROR: while AFTERINSTALL operations for ${PORTSDIR}/$position_msg." >&2
- echo 'AFTERINSTALL operations' > ${DBDIR}/requires/$origin/note_failtre
+ echo 'AFTERINSTALL operations' > $nodedir/note_failtre
record_failure $origin noclean
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
cmt_fail_reinst "$origin"
continue
}
echo "-- AFTERINSTALL operations (end)"
- touch "${DBDIR}/requires/$origin/status/in_install.AFTERINSTALL"
+ touch "$nodedir/status/in_install.AFTERINSTALL"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_AFTER_INSTALL" ]
+ if [ ! -e "$nodedir/status/COMPLETE_CLEAN_AFTER_INSTALL" ]
then
env ${MAKE_ENVS} make clean ${MAKE_ARGS} || \
{
echo "WARNING: Failed to clean $position_msg." >&2
}
- touch "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_AFTER_INSTALL"
+ touch "$nodedir/status/COMPLETE_CLEAN_AFTER_INSTALL"
fi
- if [ ! -e "${DBDIR}/requires/$origin/status/COMPLETE_TELL_UPDATE_TO_DEPANDENTS" ]
+ if [ ! -e "$nodedir/status/COMPLETE_TELL_UPDATE_TO_DEPANDENTS" ]
then
- if [ -e "${DBDIR}/requires/$origin/dependents" ]
- then
+ for tag in all run build
+ do
+ [ -e "$nodedir/dependents_$tag" ] || continue
while read origin_dependent
do
- touch "${DBDIR}/requires/$origin_dependent/need_reinstall_due_to_updated_requirements"
- done < ${DBDIR}/requires/$origin/dependents
- fi
- touch "${DBDIR}/requires/$origin/status/COMPLETE_TELL_UPDATE_TO_DEPANDENTS"
+ touch "$nodedir_dependent/need_reinstall_due_to_updated_requirements_$tag"
+ done < $nodedir/dependents_$tag
+ done
+ touch "$nodedir/status/COMPLETE_TELL_UPDATE_TO_DEPANDENTS"
fi
- rm -f "${DBDIR}/requires/$origin/need_reinstall_due_to_updated_requirements"
+ for tag in all run build
+ do
+ rm -f "$nodedir/need_reinstall_due_to_updated_requirements_$tag"
+ [ -e "$nodedir/failed_requirements_$tag" ] || continue
+ cp "$nodedir/failed_requirements_$tag" "$nodedir/failed_requirements_$tag.previous"
+ done
record_success $origin
- [ -e "${DBDIR}/requires/$origin/failed_requirements" ] && cp "${DBDIR}/requires/$origin/failed_requirements" "${DBDIR}/requires/$origin/failed_requirements.previous"
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
- backup_pkg=`cat "${DBDIR}/requires/$origin/backedup_pkgfile" 2> /dev/null|| :`
+ backup_pkg=`cat "$nodedir/backedup_pkgfile" 2> /dev/null|| :`
[ -n "$backup_pkg" ] && rm -f "$backup_pkg"
- rm "${DBDIR}/requires/$origin/status/in_install"
+ rm "$nodedir/status/in_install"
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
echo
done
if [ ! -e "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" ]
then
echo "Starting to clean up obsolete or unused distfiles at `timestamp`"
- ( set -e; cd "${DISTDIR}" && find . -type f ) | grep -v -E -f "${DBDIR}/distfiles.grep.pattern" | while read distfile
+ ( set -e; cd "${DISTDIR}" && find . -type f ) \
+ | grep -v -E -f "${DBDIR}/distfiles.grep.pattern" | while read distfile
do
echo -n ' '
expr "$distfile" : '^\./\(.*\)'