#!/bin/sh -e
# ==================================================================================
# portsreinstall main script
-# Copyright (C) 2010-2013 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
# This software is distributed under the 2-Clause BSD License.
# ==================================================================================
# ============ Set up of environment =============
APPNAME=`basename "$0"`
-MYVERSION=3.0.5
-COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$'
+# MYVERSION=3.0.6
+# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$'
# Template for development versions
-# MYVERSION=3.0.4+toward_3.0.5_20131213231732
-# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.0\.[0-9]+)$'
+MYVERSION=3.0.5+toward_3.0.6_20140707110837
+COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.0\.[0-9]+)$'
MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
MYPREFIX=${MYPREFIX:-/usr/local}
LIBDIR=${MYPREFIX}/lib/${APPNAME}
misc_init_vardefs
temp_trap_init
-conf_setup_envs
DBDIR=/var/tmp/${APPNAME}.db
CONFFILE=${MYPREFIX}/etc/${APPNAME}.conf
PKGTOOLSCONF=${MYPREFIX}/etc/pkgtools.conf
exit
elif [ $opt_help_mode -eq 2 ]
then
- usage_long | less
+ usage_long | less -r
exit
fi
exit
fi
+# ============= Set up variables for environment of ports and packages =============
+conf_setup_ports_envs
+conf_setup_packages_envs
+
# ============= Execute command operations before getting the temporary database ready =============
command_exec_before_db_creation "$@"
temp_terminate_process ()
{
+ local tmp_msg
+ tmp_msg=${TMPDIR}/temp_terminate_process:msg
[ $errno -eq 0 -o $opt_batch_mode = yes ] && return
temp_terminate_process_common
- [ -n "$COMMAND_RESTART" ] || message_cat 3<< eof
+ [ -n "$COMMAND_RESTART" ] && return
+ cat > $tmp_msg << eof
Instead, if you only want to construct the temporary database so as to stop before the actual reinstallation, execute as:
${APPNAME} prepare
eof
+ message_cat "$tmp_msg"
}
# ============= Opening title =============
options_chk_invalid_optvals_renewal non_renewable || optcomb_err=$?
if [ \( $opt_reload_conf = yes -o $opt_reset_targets = yes \) -a "x$COMMAND_MODE" != xredo ]
then
- message_echo "ERROR: Option -N is available only in the initial run of redo command." >&2
+ message_echo "ERROR: Options -L and -N are available only in the initial run of redo command." >&2
message_echo >&2
optcomb_err=1
fi
PROGRAM_DEPENDS='CONVERT_REQUIREMENTS_LIST'
_program_exec_restartable_loop_operation__routine ()
{
- local tag dbpath origin
+ local tag dbpath origin suffix
tag=${_REQUIREMENT_LISTS_tag}
dbpath=$1
origin=`str_dirpath_to_origin "$dbpath"`
- database_build_get_complete_recursive_dependency requirements.${tag} "$origin" > /dev/null
+ for suffix in '' .orig
+ do
+ database_build_get_complete_recursive_dependency requirements.${tag} "$origin" "$suffix" > /dev/null
+ done
}
_program_exec_and_record_completion__operation ()
{
program_exec_restartable_loop_operation complete_${tag}time_reqlists
message_echo
}
- program_exec_and_record_completion REQUIREMENT_LISTS:${_REQUIREMENT_LISTS_tag}
+ program_exec_and_record_completion RECURSIVE_REQUIREMENT_LISTS:${_REQUIREMENT_LISTS_tag}
done
# Trim dependency lists by removing uninspected ports
PROGRAM_DEPENDS='INSPECT_ALL_DEPENDENCIES CONVERT_REQUIREMENTS_LIST TRIM_DEPENDENCY_LISTS_RM_UNINSPECTED_PORTS'
_program_exec_restartable_loop_operation__routine ()
{
- local dbpath origin tag level srcdb dstdb
+ local dbpath origin tag level suffix srcdb dstdb
dbpath=$1
origin=`str_dirpath_to_origin "$dbpath"`
for tag in all run build
do
for level in direct full
do
- srcdb=requirements.${tag}.${level}
- dstdb=dependents.${tag}.${level}
- [ -e "$dbpath/$srcdb" ] || continue
- while read origin_requirement
+ for suffix in '' .orig
do
- dstpath=${DBDIR}/requires/$origin_requirement
- echo "$dstpath/$dstdb" >> ${DBDIR}/dependents_files.tmp
- [ "$dstpath/$dstdb" -nt "$dbpath/$srcdb" ] && continue
- [ -d "$dstpath" ] || mkdir -p "$dstpath"
- echo "$origin" >> $dstpath/$dstdb.raw
- echo "$dstpath/$dstdb" >> ${DBDIR}/stage.loop_list/make_dependents_lists_unique.tmp
- done < $dbpath/$srcdb
+ srcdb=requirements.${tag}.${level}${suffix}
+ dstdb=dependents.${tag}.${level}${suffix}
+ [ -e "$dbpath/$srcdb" ] || continue
+ while read origin_requirement
+ do
+ dstpath=${DBDIR}/requires/$origin_requirement
+ echo "$dstpath/$dstdb" >> ${DBDIR}/dependents_files.tmp
+ [ "$dstpath/$dstdb" -nt "$dbpath/$srcdb" ] && continue
+ [ -d "$dstpath" ] || mkdir -p "$dstpath"
+ echo "$origin" >> $dstpath/$dstdb.raw
+ echo "$dstpath/$dstdb" >> ${DBDIR}/stage.loop_list/make_dependents_lists_unique.tmp
+ done < $dbpath/$srcdb
+ done
done
done
}
program_exec_and_record_completion PARSE_TARGET_ATTR_INFO
# Inspection of necessity
-PROGRAM_DEPENDS='TARGET_ATTR_INFO_POSTPROCESS REQUIREMENT_LISTS:run-time REQUIREMENT_LISTS:build-time INSPECT_ALL_DEPENDENCIES'
+PROGRAM_DEPENDS='TARGET_ATTR_INFO_POSTPROCESS RECURSIVE_REQUIREMENT_LISTS:run RECURSIVE_REQUIREMENT_LISTS:build INSPECT_ALL_DEPENDENCIES'
_program_exec_restartable_loop_operation__routine ()
{
local origin