# ================================================
APPNAME=`basename $0`
-MYVERSION=1.0.0+toward_1.1.0_20120425212835
+MYVERSION=1.0.0+toward_1.1.0_20120426115858
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
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/$origin
- [ -d "$path" ] || continue
+ path=${DBDIR}/requires_conflist/$origin
+ [ -d "$path" ] || mkdir -p "$path"
echo $val > $path/${section}.conflist
done
done
fi
if [ $port_exists = yes ]
then
+ rm_a_line "$origin" "${DBDIR}/moved_or_lost.list"
cd "${PORTSDIR}/$origin"
- make config-conditional
- [ -d "${DBDIR}/requires/$origin/status" ] || mkdir -p "${DBDIR}/requires/$origin/status"
+ target_dir=${DBDIR}/requires/$origin
+ [ -d "$target_dir/status" ] || mkdir -p "$target_dir/status"
+ if [ -d "${DBDIR}/requires_conflist/$origin" ]
+ then
+ cp -R "${DBDIR}/requires_conflist/$origin/"* "$target_dir/" > /dev/null 2> /dev/null || :
+ fi
+ MAKE_ARGS="FORCE_PKG_REGISTER=yes DISABLE_VULNERABILITIES=yes `cat "$target_dir/MARG.conflist" 2> /dev/null || :`"
+ MAKE_ENVS=`cat "$target_dir/MENV.conflist" 2> /dev/null || :`
+ env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
pkg=`pkg_info -qO "$origin"`
- [ -n "$pkg" ] && echo $pkg > ${DBDIR}/requires/$origin/installed_version
- pkg_new=`(cd "${PORTSDIR}/$origin" && make package-name)`
+ [ -n "$pkg" ] && echo $pkg > $target_dir/installed_version
+ pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
if [ -z "$pkgtag" ]
elif [ "z$pkg" != "z$pkg_new" ]
then
pkgtag="$pkg => $pkg_new"
- echo $pkg_new > ${DBDIR}/requires/$origin/new_version
+ echo $pkg_new > $target_dir/new_version
fi
- echo $pkgtag > ${DBDIR}/requires/$origin/pkgtag
- make all-depends-list | sed "s|^${PORTSDIR}/||" > "${DBDIR}/requires/$origin/requires" || :
- grep -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" "${DBDIR}/requires/$origin/requires" | grep -v -E "^`str_escape_regexp $origin`$" > ${TMPDIR}/replaced_target.tmp || :
- mv "${DBDIR}/requires/$origin/requires" "${DBDIR}/requires/$origin/requires.orig"
- sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist" "${DBDIR}/requires/$origin/requires.orig" | grep -v '^$' > ${DBDIR}/requires/$origin/requires || :
+ echo $pkgtag > $target_dir/pkgtag
+ env ${MAKE_ENVS} make all-depends-list ${MAKE_ARGS} | sed "s|^${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" "${DBDIR}/requires/$origin/requires" > ${TMPDIR}/missing.$origin_id || :
+ grep -v -E -f "${DBDIR}/installed_ports.grep_pattern" "$target_dir/requires" > ${TMPDIR}/missing.$origin_id || :
nlines=`cat "${TMPDIR}/missing.$origin_id" | wc -l`
iline=1
while [ $iline -le $nlines ]
inspect_dependencies "$origin_dependency"
done
rm "${TMPDIR}/missing.$origin_id"
- make fetch-urlall-list | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
+ env ${MAKE_ENVS} make fetch-urlall-list ${MAKE_ARGS} | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
fi
fi
[ "$origin_orig" = "$origin" ] || echo "s|^`str_escape_regexp $origin_orig`$|$origin|" >> ${DBDIR}/REPLACE.complete_replace_pattern.tmp
then
while read origin misc
do
- [ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" -o ] || continue
- echo $origin '('`cat ${DBDIR}/requires/$origin/pkgtag`')'
+ [ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" ] || continue
+ echo $origin '('`cat "${DBDIR}/requires/$origin/pkgtag"`')'
done < ${DBDIR}/$list
else
- cat "${DBDIR}/$list"
+ while read origin misc
+ do
+ echo $origin '('`cat "${DBDIR}/requires/$origin/pkgtag"`')'
+ done < ${DBDIR}/$list
fi
exit
;;
fi
. "${DBDIR}/setenv.sh"
+if [ ! -e "${DBDIR}/COMPLETE_REFLECTCONF_2" ]
+then
+ echo "Starting to reflect settings for each port defined in the configuration file at `timestamp`"
+ build_conflist_target_val_pair MARG TARGET DEF
+ build_conflist_target_val_pair MENV TARGET DEF
+ build_conflist_target_val_pair BEFOREBUILD TARGET COMMAND
+ build_conflist_target_val_pair BEFOREDEINSTALL TARGET COMMAND
+ build_conflist_target_val_pair AFTERINSTALL TARGET COMMAND
+ touch "${DBDIR}/COMPLETE_REFLECTCONF_2"
+ echo
+fi
+
# ------- Database construction -------
terminate_process_common ()
echo
fi
-if [ ! -e "${DBDIR}/COMPLETE_REFLECTCONF_2" ]
-then
- echo "Starting to reflect settings for each port defined in the configuration file at `timestamp`"
- build_conflist_target_val_pair MARG TARGET DEF
- build_conflist_target_val_pair MENV TARGET DEF
- build_conflist_target_val_pair BEFOREBUILD TARGET COMMAND
- build_conflist_target_val_pair BEFOREDEINSTALL TARGET COMMAND
- build_conflist_target_val_pair AFTERINSTALL TARGET COMMAND
- touch "${DBDIR}/COMPLETE_REFLECTCONF_2"
- echo
-fi
-
# ------- Main operations -------
if [ "$command" = prepare ]
then
pkgtag='?'
- elif [ "x$currentpkg" != "x$newpkg" ]
+ elif [ -n "$newpkg" -a "x$currentpkg" != "x$newpkg" ]
then
pkgtag="$currentpkg => $newpkg"
fi
fi
if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP" ]
then
- echo "-- (Creating temporal backup package for $position_msg as $currentpkg)"
+ echo "-- (Creating temporal backup package for $position_msg)"
cd "${DBDIR}/backup_failure"
pkg_create -b "$currentpkg" || \
{
}
touch "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_AFTER_INSTALL"
fi
- echo $newpkg > ${DBDIR}/requires/$origin/pkgtag
record_success $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
rm -f "${DBDIR}/backup_failure/$currentpkg.tbz"
# ================================================
APPNAME=`basename $0`
-MYVERSION=1.0.0+toward_1.1.0_20120425110328
+MYVERSION=1.0.0+toward_1.1.0_20120426115237
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
PORTSDIR=${PORTSDIR:-/usr/ports}
PORTS_MOVED_DB=${PORTSDIR}/MOVED
+PORTS_INDEX_DB=${PORTSDIR}/INDEX-`uname -r | cut -d . -f 1`
str_escape_regexp_filter ()
{
else
ports_glob ()
{
- local glob
+ local glob index
glob=`convert_portsglob_to_regexp_pattern "$1"`
+ [ -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
if expr "$glob" : '[^\/][^\/]*\/[^\/][^\/]*$' 2> /dev/null > /dev/null
then
- find -E /usr/ports -maxdepth 2 -type d -regex /usr/ports/"$glob" -and -not -regex '/usr/ports/(Templates|Mk|Tools|distfiles|packages)/.*' | cut -d / -f 4,5 > ${TMPDIR}/ports_glob:matched
+ grep -E "$glob" "${DBDIR}/ports_glob:origin.lst" > ${TMPDIR}/ports_glob:matched
pkg_info -aoq | grep -E "$glob" >> ${TMPDIR}/ports_glob:matched
else
- pkg_info -EqIx "^$glob$" > ${TMPDIR}/ports_glob:matched
+ 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 > ${TMPDIR}/ports_glob:matched
+ pkg_info -oqx "$glob" >> ${TMPDIR}/ports_glob:matched
fi
-
+ sort -u "${TMPDIR}"/ports_glob:matched
}
fi
[ -d "${PORTSDIR}/$glob" ] && { echo $glob; continue; }
fi
origin=`ports_glob "$glob"`
- [ "$origin" ] || \
+ [ -n "$origin" ] || \
{
echo "ERROR: Invalid ports/package glob [$glob]" >&2
exit 1;
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/$origin
- [ -d "$path" ] || continue
+ path=${DBDIR}/requires_conflist/$origin
+ [ -d "$path" ] || mkdir -p "$path"
echo $val > $path/${section}.conflist
done
done
grep -n -m 1 -E "^`str_escape_regexp $origin`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || :
if [ `cat "${TMPDIR}/moved.info" | wc -l` -eq 0 ]
then
- if [ "$recursedb_in" ]
+ if [ -n "$recursedb_in" ]
then
echo "${DEPTH_INDEX} ===> Disappeared port (MOVED broken?)"
else
echo "${DEPTH_INDEX} ===> Nonexistent port (your original?)"
fi
- [ "$origin_src" ] && add_a_line_if_new "$origin_src" "${DBDIR}/moved_or_lost.list"
+ [ -n "$origin_src" ] && add_a_line_if_new "$origin_src" "${DBDIR}/moved_or_lost.list"
return 1
else
iline_db=`cut -d : -f 1 "${TMPDIR}/moved.info"`
origin=`sed -E 's/^[0-9]+://' "${TMPDIR}/moved.info" | cut -d '|' -f 2 || :`
date_moved=`cut -d '|' -f 3 "${TMPDIR}/moved.info" || :`
why_moved=`cut -d '|' -f 4 "${TMPDIR}/moved.info" || :`
- if [ "$origin" ]
+ if [ -n "$origin" ]
then
echo "${DEPTH_INDEX} ===> Moved to $origin at $date_moved because \"$why_moved\""
convert_origin_if_moved "$origin_src" "${TMPDIR}/MOVED.DB" || return 1
else
echo "${DEPTH_INDEX} ===> Deleted at $date_moved because \"$why_moved\""
- [ "$origin_src" ] || return 1
+ [ -n "$origin_src" ] || return 1
origin=$origin_src
echo "${DEPTH_INDEX} ===> Going back to the original port $origin_src"
convert_origin_if_moved || return 1
origin_src=$origin
origin=`echo $origin_src | sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist"`
add_a_line_if_new "$origin_src" "${DBDIR}/moved_or_lost.list"
- if [ "$origin" ]
+ if [ -n "$origin" ]
then
add_a_line_if_new "$origin" "${DBDIR}/replaced_target.inspected.list"
echo "${DEPTH_INDEX} ===> Replaced with $origin by user configuration"
echo "${DEPTH_INDEX} ===> Deleted by user configuration"
fi
fi
- if [ "$origin" ]
+ if [ -n "$origin" ]
then
if convert_origin_if_moved "$origin_src" ''
then
fi
if [ $port_exists = yes ]
then
+ rm_a_line "$origin" "${DBDIR}/moved_or_lost.list"
cd "${PORTSDIR}/$origin"
- make config-conditional
- [ -d "${DBDIR}/requires/$origin/status" ] || mkdir -p "${DBDIR}/requires/$origin/status"
+ target_dir=${DBDIR}/requires/$origin
+ [ -d "$target_dir/status" ] || mkdir -p "$target_dir/status"
+ if [ -d "${DBDIR}/requires_conflist/$origin" ]
+ then
+ cp -R "${DBDIR}/requires_conflist/$origin/"* "$target_dir/" > /dev/null 2> /dev/null || :
+ fi
+ MAKE_ARGS="FORCE_PKG_REGISTER=yes DISABLE_VULNERABILITIES=yes `cat "$target_dir/MARG.conflist" 2> /dev/null || :`"
+ MAKE_ENVS=`cat "$target_dir/MENV.conflist" 2> /dev/null || :`
+ env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
pkg=`pkg_info -qO "$origin"`
- [ "$pkg" ] && echo $pkg > ${DBDIR}/requires/$origin/installed_version
- pkg_new=`(cd "${PORTSDIR}/$origin" && make package-name)`
+ [ -n "$pkg" ] && echo $pkg > $target_dir/installed_version
+ pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
if [ -z "$pkgtag" ]
elif [ "z$pkg" != "z$pkg_new" ]
then
pkgtag="$pkg => $pkg_new"
- echo $pkg_new > ${DBDIR}/requires/$origin/new_version
+ echo $pkg_new > $target_dir/new_version
fi
- echo $pkgtag > ${DBDIR}/requires/$origin/pkgtag
- make all-depends-list | sed "s|^${PORTSDIR}/||" > "${DBDIR}/requires/$origin/requires" || :
- grep -E -f "${DBDIR}/REPLACE.grep_from_pattern.conflist" "${DBDIR}/requires/$origin/requires" | grep -v -E "^`str_escape_regexp $origin`$" > ${TMPDIR}/replaced_target.tmp || :
- mv "${DBDIR}/requires/$origin/requires" "${DBDIR}/requires/$origin/requires.orig"
- sed -E -f "${DBDIR}/REPLACE.replace_pattern.conflist" "${DBDIR}/requires/$origin/requires.orig" | grep -v '^$' > ${DBDIR}/requires/$origin/requires || :
+ echo $pkgtag > $target_dir/pkgtag
+ env ${MAKE_ENVS} make all-depends-list ${MAKE_ARGS} | sed "s|^${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" "${DBDIR}/requires/$origin/requires" > ${TMPDIR}/missing.$origin_id || :
+ grep -v -E -f "${DBDIR}/installed_ports.grep_pattern" "$target_dir/requires" > ${TMPDIR}/missing.$origin_id || :
nlines=`cat "${TMPDIR}/missing.$origin_id" | wc -l`
iline=1
while [ $iline -le $nlines ]
inspect_dependencies "$origin_dependency"
done
rm "${TMPDIR}/missing.$origin_id"
- make fetch-urlall-list | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
+ env ${MAKE_ENVS} make fetch-urlall-list ${MAKE_ARGS} | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
fi
fi
[ "$origin_orig" = "$origin" ] || echo "s|^`str_escape_regexp $origin_orig`$|$origin|" >> ${DBDIR}/REPLACE.complete_replace_pattern.tmp
add_a_line_if_new "$origin" "${DBDIR}/target.inspected.list"
rm_a_line "$origin" "${DBDIR}/target_ports.remain"
- if [ "$origin_src" ]
+ if [ -n "$origin_src" ]
then
add_a_line_if_new "$origin_src" "${DBDIR}/target.inspected.list"
rm_a_line "$origin_src" "${DBDIR}/target_ports.remain"
[ "$load_pkgtoolsconf" != undef -a -d "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] && echo "WARN: -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
-_STATUS_DB_OBSOLETE=no
-ls "${PORTSDIR}"/*.db | while read ref
-do
- [ "$ref" -nt "${DBDIR}" ] && { _STATUS_DB_OBSOLETE=yes; break; }
- :
-done
+if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}" ]
+then
+ _STATUS_DB_OBSOLETE=yes
+else
+ _STATUS_DB_OBSOLETE=no
+fi
# Creation of temporal database directory
if [ -d "${DBDIR}" ]
# Taboo list given by options
register_globs "$taboo_ports" "${DBDIR}/taboo.list"
-
# ------- Commands -------
# Special modes
exit
;;
save)
+echo $*
chk_privilege
[ -d "${DBDIR}" ] || { echo "ERROR: Database has not built yet." >&2; exit 1; }
- savedir=$2
- [ "$savedir" ] || { echo "ERROR: Directory to save the temporal database archive is not specified." >&2; exit 1; }
+ savedir=$1
+ [ -n "$savedir" ] || { echo "ERROR: Directory to save the temporal database archive is not specified." >&2; exit 1; }
[ -d "$savedir" ] || { echo "ERROR: Directory [$savedir] is not found." >&2; exit 1; }
srcdir=`dirname "${DBDIR}"`
srcnode=`basename "${DBDIR}"`
;;
load)
chk_privilege
- loadfile=$2
- [ "$loadfile" ] || { echo "ERROR: Database archive is not specified." >&2; exit 1; }
+ loadfile=$1
+ [ -n "$loadfile" ] || { echo "ERROR: Database archive is not specified." >&2; exit 1; }
[ -f "$loadfile" ] || { echo "ERROR: Database archive is not found." >&2; exit 1; }
loadfile=`realpath "$loadfile"`
echo "Starting to load the temporal database..."
esac
[ -r "${DBDIR}/$list" ] || exit 0
[ -e "${DBDIR}"/saved_options.sh ] && . "${DBDIR}"/saved_options.sh
- if [ "${_filter_skip_unchanged}" -a $skip_unchanged = yes ]
+ if [ -n "${_filter_skip_unchanged}" -a $skip_unchanged = yes ]
then
while read origin misc
do
- [ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" -o ] || continue
- echo $origin '('`cat ${DBDIR}/requires/$origin/pkgtag`')'
+ [ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" ] || continue
+ echo $origin '('`cat "${DBDIR}/requires/$origin/pkgtag"`')'
done < ${DBDIR}/$list
else
- cat "${DBDIR}/$list"
+ while read origin misc
+ do
+ echo $origin '('`cat "${DBDIR}/requires/$origin/pkgtag"`')'
+ done < ${DBDIR}/$list
fi
exit
;;
touch "${DBDIR}/MODE_REDO"
rm -f "${DBDIR}/COMPLETE_CLEANUP_REINST_STATUS"
[ $renew_options = yes ] && rm -f "${DBDIR}/COMPLETE_SAVE_OPTIONS"
- if [ "$target_required_ports$target_dependent_ports" ]
+ if [ -n "$target_required_ports$target_dependent_ports" ]
then
rm -f "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS"
touch "${DBDIR}/REQUIRE_CHK_NEW_TARGET"
then
echo "-- Starting to parse pkgtools.conf at `timestamp` (by using installed portupgrade)"
portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade`
- [ "$portupgrade_pkg" ] || portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade-devel`
+ [ -n "$portupgrade_pkg" ] || portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade-devel`
[ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -ne 0 ] && echo "WARN: Combination with portupgrade-devel-* has not tested."
istart=`grep -m 1 -n -e '^def init_global$' "${PORTUPGRADE}" | cut -d : -f 1` || :
- [ "$istart" ] || { echo "ERROR: The current installed version of portupgrade is unsupported." >&2; }
+ [ -n "$istart" ] || { echo "ERROR: The current installed version of portupgrade is unsupported." >&2; }
sed 1,$(($istart-1))d "${PORTUPGRADE}" > ${TMPDIR}/portupgrade.0
iend=`grep -m 1 -n -e '^end$' "${TMPDIR}"/portupgrade.0 | cut -d : -f 1`
sed -n 1,${iend}p "${TMPDIR}"/portupgrade.0 > ${TMPDIR}/portupgrade.init_global
expand_glob_pattern_to_origins "$glob_pattern" yes > ${TMPDIR}/origins.2.tmp || :
if [ `cat "${TMPDIR}/origins.2.tmp" | wc -l` -eq 0 ]
then
- if expr "$glob_pattern" : '.*\/' > /dev/null 2>&1
- then
- regexp_pattern=`convert_portsglob_to_regexp_pattern "$glob_pattern"`
- echo $glob_pattern | str_escape_regexp_filter | sed 's/\\\*/.*/g' > ${TMPDIR}/origins.2.tmp
- else
- echo "WARN: Original package to be replaced [$glob_pattern] is obsolete." >&2
- echo " If still required, use a pattern for port origins instead." >&2
- continue
- fi
+ echo "WARN: Original package to be replaced [$glob_pattern] is obsolete." >&2
+ 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
fi
. "${DBDIR}/setenv.sh"
+if [ ! -e "${DBDIR}/COMPLETE_REFLECTCONF_2" ]
+then
+ echo "Starting to reflect settings for each port defined in the configuration file at `timestamp`"
+ build_conflist_target_val_pair MARG TARGET DEF
+ build_conflist_target_val_pair MENV TARGET DEF
+ build_conflist_target_val_pair BEFOREBUILD TARGET COMMAND
+ build_conflist_target_val_pair BEFOREDEINSTALL TARGET COMMAND
+ build_conflist_target_val_pair AFTERINSTALL TARGET COMMAND
+ touch "${DBDIR}/COMPLETE_REFLECTCONF_2"
+ echo
+fi
+
# ------- Database construction -------
terminate_process_common ()
echo
fi
-if [ ! -e "${DBDIR}/COMPLETE_REFLECTCONF_2" ]
-then
- echo "Starting to reflect settings for each port defined in the configuration file at `timestamp`"
- build_conflist_target_val_pair MARG TARGET DEF
- build_conflist_target_val_pair MENV TARGET DEF
- build_conflist_target_val_pair BEFOREBUILD TARGET COMMAND
- build_conflist_target_val_pair BEFOREDEINSTALL TARGET COMMAND
- build_conflist_target_val_pair AFTERINSTALL TARGET COMMAND
- touch "${DBDIR}/COMPLETE_REFLECTCONF_2"
- echo
-fi
-
# ------- Main operations -------
if [ "$command" = prepare ]
origin=`sed -n ${iline}p "${TMPDIR}/moved_or_lost.tmp"`
iline=$(($iline+1))
currentpkg=`pkg_info -qO "$origin" 2> /dev/null`
- [ "$currentpkg" ] || continue
+ [ -n "$currentpkg" ] || continue
origin_ptn=`str_escape_regexp ${origin}`
if [ `grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null | wc -l` -gt 0 ]
then
then
pkgtag='?'
- elif [ "x$currentpkg" != "x$newpkg" ]
+ elif [ -n "$newpkg" -a "x$currentpkg" != "x$newpkg" ]
then
pkgtag="$currentpkg => $newpkg"
fi
then
str_escape_regexp_filter < "${DBDIR}/requires/$origin/requires" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/requires.pattern" 2> /dev/null || :
fi
- if [ "${_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 "^`str_escape_regexp $origin`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
then
_is_target=y
elif grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
fi
if [ -z "${_is_all}" ]
then
- if [ "${_is_target}${_is_dependent}${_is_required}" ]
+ if [ -n "${_is_target}${_is_dependent}${_is_required}" ]
then
[ "${_is_target}" = y ] && echo "(Target port)"
[ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
else
touch "${DBDIR}/requires/$origin/status/in_install"
fi
- if [ "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP" ]
+ if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP" ]
then
- echo "-- (Creating temporal backup package for $position_msg as $currentpkg)"
+ echo "-- (Creating temporal backup package for $position_msg)"
cd "${DBDIR}/backup_failure"
pkg_create -b "$currentpkg" || \
{
cd "${PORTSDIR}/$origin"
touch "${DBDIR}/requires/$origin/status/COMPLETE_PKG_BACKUP"
fi
- if [ "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL" ]
+ if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL" ]
then
if [ -e "${DBDIR}/requires/$origin/BEFOREDEINSTALL.conflist" ]
then
fi
touch "${DBDIR}/requires/$origin/status/COMPLETE_BEFOREDEINSTALL"
fi
- if [ "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_DEINSTALL" ]
+ if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPLETE_DEINSTALL" ]
then
pkg_delete -f $currentpkg || \
{
pkg_delete -f $currentpkg || :
echo "*** Trying to deinstall by ports to make sure. (This usually ends up with warnings)"
env ${MAKE_ENVS} make deinstall ${MAKE_ARGS} || :
- if [ "$currentpkg" ]
+ if [ -n "$currentpkg" ]
then
echo "*** Restoring the backup..."
if [ -e "${DBDIR}/backup_failure/$currentpkg.tbz" ]
fi
touch "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.RECOVER"
fi
- if [ "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.AFTERINSTALL" -a -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" ]
+ if [ -n "$currentpkg" -a ! -e "${DBDIR}/requires/$origin/status/COMPETE.FAILED_INSTALL.AFTERINSTALL" -a -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" ]
then
echo "-- AFTERINSTALL operations (start)"
sh -e "${DBDIR}/requires/$origin/AFTERINSTALL.conflist" || { echo "-- (This error is ignored)"; }
}
touch "${DBDIR}/requires/$origin/status/COMPLETE_CLEAN_AFTER_INSTALL"
fi
- echo $newpkg > ${DBDIR}/requires/$origin/pkgtag
record_success $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
rm -f "${DBDIR}/backup_failure/$currentpkg.tbz"