OSDN Git Service

Version 3.0.1+toward_3.0.2_20130703190902
[portsreinstall/current.git] / bin / portsreinstall
index a7b0ba9..2623a54 100755 (executable)
 # ============ Set up of environment =============
 APPNAME=`basename "$0"`
 
-# MYVERSION=3.0.0
+# MYVERSION=3.0.1
 # COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$'
 # Template for development versions
-MYVERSION=3.0.0+toward_3.0.1_20130608031815
-COMPATIBLE_VERSIONS='^(3\.0\.0\+toward_3\.0\.1_[0-9]+|3\.0\.[0-9]+)$'
-
+MYVERSION=3.0.1+toward_3.0.2_20130703190902
+COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.1_[0-9]+|3\.0\.[0-9]+)$'
 MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
 MYPREFIX=${MYPREFIX:-/usr/local}
 LIBDIR=${MYPREFIX}/lib/${APPNAME}
@@ -503,6 +502,7 @@ program_exec_and_record_completion REDO_INIT
 PROGRAM_DEPENDS=''
 _program_exec_and_record_completion__operation ()
 {
+       local tag level dbsuffix
        message_section_title "Determining specified targets"
        cat "${DBDIR}/stage.loop_list/target_itself.specified" \
                "${DBDIR}/stage.loop_list/target_dependents.specified" \
@@ -533,12 +533,38 @@ _program_exec_and_record_completion__operation ()
                cat "${DBDIR}/stage.loop_list/target_itself.specified" \
                        "${DBDIR}/stage.loop_list/target_dependents.specified" \
                        "${DBDIR}/stage.loop_list/target_requirements.specified" \
-                       "${DBDIR}/need.list"  2> /dev/null \
+                       | sort -u > ${TMPDIR}/DETERMINE_SPECIFIED_TARGETS.reset
+               cat "${TMPDIR}/DETERMINE_SPECIFIED_TARGETS.reset" "${DBDIR}/need.list" 2> /dev/null \
                        | sort -u > ${DBDIR}/need.list.tmp
                mv "${DBDIR}/need.list.tmp" "${DBDIR}/need.list"
                sort -u "${DBDIR}/need.list" "${DBDIR}/targets_specified_so_far" \
                        > ${DBDIR}/targets_specified_so_far.tmp
                mv "${DBDIR}/targets_specified_so_far.tmp" "${DBDIR}/targets_specified_so_far"
+               for tag in all run build none
+               do
+                       for level in direct full
+                       do
+                               dbsuffix=$tag.$level
+                               {
+                                       cat "${TMPDIR}/DETERMINE_SPECIFIED_TARGETS.reset"
+                                       cat "${DBDIR}/stage.loop_list/target_dependents.specified" | while read origin
+                                       do
+                                               nodedir=${DBDIR}/requires/$origin
+                                               cat "$nodedir/dependents.$dbsuffix" 2> /dev/null
+                                       done
+                                       cat "${DBDIR}/stage.loop_list/target_requirements.specified" | while read origin
+                                       do
+                                               nodedir=${DBDIR}/requires/$origin
+                                               cat "$nodedir/requirements.$dbsuffix" 2> /dev/null
+                                       done
+                               } | sort -u | while read origin
+                               do
+                                       fileedit_rm_a_line "$origin" "${DBDIR}/success.$dbsuffix.list"
+                                       fileedit_rm_a_line "$origin" "${DBDIR}/todo_after_requirements_succeed.$dbsuffix.list"
+                                       rm -f "${DBDIR}/requires/$origin/succeeded_once"
+                               done
+                       done
+               done
        fi
        message_echo
 }
@@ -630,12 +656,17 @@ _program_exec_restartable_loop_operation__routine ()
                                for tag in all run build
                                do
                                        target=${DBDIR}/$dbtag/$origin/${table}.${tag}.${level}
-                                       [ -e "$target.src" ] || continue
-                                       sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern" "$target.src" \
-                                               | grep -v '^$' | sort -u > $target.tmp
-                                       [ -e "$target" ] && ! diff "$target.tmp" "$target" > /dev/null \
-                                               && echo "$origin" >> ${DBDIR}/update_dependencies
-                                       mv "$target.tmp" "$target"
+                                       if [ -e "$target.src" ]
+                                       then
+                                               sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern" "$target.src" \
+                                                       | grep -v '^$' | sort -u > $target.tmp
+                                               [ -e "$target" ] && ! diff "$target.tmp" "$target" > /dev/null \
+                                                       && echo "$origin" >> ${DBDIR}/update_dependencies
+                                               mv "$target.tmp" "$target"
+                                       else
+                                               [ -e "$target" ] && echo "$origin" >> ${DBDIR}/update_dependencies
+                                               rm -f "$target"
+                                       fi
                                done
                        done
                done