Skip to content
Snippets Groups Projects
Commit fc8f2554 authored by janis's avatar janis
Browse files

* reg_search: Replace existing uses of DATE with MADE_DATE and

	use DATE for the date command.
	* reg_periodic: Ditto.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68429 138bc75d-0d04-0410-961f-82ee72b054a4
parent a40d3705
No related branches found
No related tags found
No related merge requests found
2003-03-27 Janis Johnson <janis187@us.ibm.com> 2003-06-24 Janis Johnson <janis187@us.ibm.com>
* reg_search: Replace existing uses of DATE with MADE_DATE and
use DATE for the date command.
* reg_periodic: Ditto.
2003-03-27 Janis Johnson <janis187@us.ibm.com>
* README: New file. * README: New file.
* reg_search: New file. * reg_search: New file.
* reg_periodic: New file. * reg_periodic: New file.
......
...@@ -55,7 +55,7 @@ msg() { ...@@ -55,7 +55,7 @@ msg() {
if [ "x${DATE_IN_MSG}" = "x" ]; then if [ "x${DATE_IN_MSG}" = "x" ]; then
echo "${2}" echo "${2}"
else else
echo "`date` ${2}" echo "`${DATE}` ${2}"
fi fi
} }
...@@ -70,7 +70,7 @@ error() { ...@@ -70,7 +70,7 @@ error() {
# control tools and report to the user. # control tools and report to the user.
make_date() { make_date() {
MADE_DATE="`date -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \ MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \
|| error "make_date: date command failed" || error "make_date: date command failed"
} }
...@@ -79,25 +79,32 @@ make_date() { ...@@ -79,25 +79,32 @@ make_date() {
# testing; the first one needs it, the others can ignore it if they want. # testing; the first one needs it, the others can ignore it if they want.
process_date() { process_date() {
DATE="${1}" TEST_DATE="${1}"
${REG_UPDATE} "${DATE}" ${REG_UPDATE} "${TEST_DATE}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg 0 "source update failed for ${DATE}" msg 0 "source update failed for ${TEST_DATE}"
return return
fi fi
${REG_BUILD} "${DATE}" ${REG_BUILD} "${TEST_DATE}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg 0 "build failed for ${DATE}" msg 0 "build failed for ${TEST_DATE}"
return return
fi fi
${REG_TEST} "${DATE}" ${REG_TEST} "${TEST_DATE}"
} }
######################################################################## ########################################################################
# Main program (so to speak) # Main program (so to speak)
######################################################################## ########################################################################
# If DATE isn't defined, use the default date command; the configuration
# file can override this.
if [ "x${DATE}" = "x" ]; then
DATE=date
fi
# Process the configuration file. # Process the configuration file.
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
...@@ -135,9 +142,9 @@ msg 2 "VERBOSITY = ${VERBOSITY}" ...@@ -135,9 +142,9 @@ msg 2 "VERBOSITY = ${VERBOSITY}"
# Change the dates into seconds since the epoch. This uses an extension # Change the dates into seconds since the epoch. This uses an extension
# in GNU date. # in GNU date.
LOW_DATE=`date +%s --date "${LOW_DATE}"` || \ LOW_DATE=`${DATE} +%s --date "${LOW_DATE}"` || \
error "date command failed for \"${LOW_DATE}\"" error "date command failed for \"${LOW_DATE}\""
HIGH_DATE=`date +%s --date "${HIGH_DATE}"` || \ HIGH_DATE=`${DATE} +%s --date "${HIGH_DATE}"` || \
error "date command failed for \"${LOW_DATE}\"" error "date command failed for \"${LOW_DATE}\""
# Process each date in the range. # Process each date in the range.
......
...@@ -75,7 +75,7 @@ msg() { ...@@ -75,7 +75,7 @@ msg() {
if [ "x${DATE_IN_MSG}" = "x" ]; then if [ "x${DATE_IN_MSG}" = "x" ]; then
echo "${2}" echo "${2}"
else else
echo "`date` ${2}" echo "`${DATE}` ${2}"
fi fi
} }
...@@ -96,7 +96,7 @@ error() { ...@@ -96,7 +96,7 @@ error() {
# control tools and report to the user. # control tools and report to the user.
make_date() { make_date() {
MADE_DATE="`date -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \ MADE_DATE="`${DATE} -u +\"%Y-%m-%d %H:%M %Z\" --date \"1970-01-01 00:00:${1}\"`" \
|| error "make_date: date command failed" || error "make_date: date command failed"
} }
...@@ -105,15 +105,15 @@ make_date() { ...@@ -105,15 +105,15 @@ make_date() {
# testing; the first one needs it, the others can ignore it if they want. # testing; the first one needs it, the others can ignore it if they want.
process_date() { process_date() {
DATE="${1}" TEST_DATE="${1}"
${REG_UPDATE} "${DATE}" || error "source update failed for ${DATE}" ${REG_UPDATE} "${TEST_DATE}" || error "source update failed for ${TEST_DATE}"
# If we're already in a valid range, skip this date if there are no # If we're already in a valid range, skip this date if there are no
# differences from either end of the range and adjust LATER. # differences from either end of the range and adjust LATER.
if [ ${VALID_RANGE} = 1 ]; then if [ ${VALID_RANGE} = 1 ]; then
${HAS_CHANGES} "${DATE}" "${LATER_THAN}" "${EARLIER_THAN}" ${HAS_CHANGES} "${TEST_DATE}" "${LATER_THAN}" "${EARLIER_THAN}"
RET=$? RET=$?
case ${RET} in case ${RET} in
0) ;; 0) ;;
...@@ -123,8 +123,8 @@ process_date() { ...@@ -123,8 +123,8 @@ process_date() {
esac esac
fi fi
${REG_BUILD} "${DATE}" || error "build failed for ${DATE}" ${REG_BUILD} "${TEST_DATE}" || error "build failed for ${TEST_DATE}"
${REG_TEST} "${DATE}" ${REG_TEST} "${TEST_DATE}"
LATER=$? LATER=$?
} }
...@@ -149,21 +149,21 @@ search_dates() { ...@@ -149,21 +149,21 @@ search_dates() {
while [ ${DIFF} -ge ${DELTA} ]; do while [ ${DIFF} -ge ${DELTA} ]; do
make_date ${MID} make_date ${MID}
DATE="${MADE_DATE}" TEST_DATE="${MADE_DATE}"
# Test it. # Test it.
process_date "${DATE}" process_date "${TEST_DATE}"
# Narrow the search based on the outcome of testing DATE. # Narrow the search based on the outcome of testing DATE.
if [ ${LATER} -eq 1 ]; then if [ ${LATER} -eq 1 ]; then
msg 1 "search dates later than \"${DATE}\"" msg 1 "search dates later than \"${TEST_DATE}\""
LATER_THAN="${DATE}" LATER_THAN="${TEST_DATE}"
let LOW=MID let LOW=MID
else else
msg 1 "search dates earlier than \"${DATE}\"" msg 1 "search dates earlier than \"${TEST_DATE}\""
EARLIER_THAN="${DATE}" EARLIER_THAN="${TEST_DATE}"
let HIGH=MID let HIGH=MID
fi fi
...@@ -176,6 +176,13 @@ search_dates() { ...@@ -176,6 +176,13 @@ search_dates() {
# Main program (so to speak) # Main program (so to speak)
######################################################################## ########################################################################
# If DATE isn't defined, use the default date command; the configuration
# file can override this.
if [ "x${DATE}" = "x" ]; then
DATE=date
fi
# The error function uses this. # The error function uses this.
VALID_RANGE=0 VALID_RANGE=0
...@@ -228,15 +235,15 @@ test ${DELTA} -lt 120 && \ ...@@ -228,15 +235,15 @@ test ${DELTA} -lt 120 && \
# Change the dates into seconds since the epoch. This uses an extension # Change the dates into seconds since the epoch. This uses an extension
# in GNU date. # in GNU date.
LOW_DATE=`date +%s --date "${LOW_DATE}"` || \ LOW_DATE=`${DATE} +%s --date "${LOW_DATE}"` || \
error "date command failed for \"${LOW_DATE}\"" error "date command failed for \"${LOW_DATE}\""
HIGH_DATE=`date +%s --date "${HIGH_DATE}"` || \ HIGH_DATE=`${DATE} +%s --date "${HIGH_DATE}"` || \
error "date command failed for \"${LOW_DATE}\"" error "date command failed for \"${LOW_DATE}\""
# If FIRST_MID was defined, convert it and make sure it's in the range. # If FIRST_MID was defined, convert it and make sure it's in the range.
if [ "x${FIRST_MID}" != "x" ]; then if [ "x${FIRST_MID}" != "x" ]; then
FIRST_MID=`date +%s --date "${FIRST_MID}"` || \ FIRST_MID=`${DATE} +%s --date "${FIRST_MID}"` || \
error "date command failed for \"${FIRST_MID}\"" error "date command failed for \"${FIRST_MID}\""
test ${FIRST_MID} -le ${LOW_DATE} && \ test ${FIRST_MID} -le ${LOW_DATE} && \
error "FIRST_MID date is earlier than LOW_DATE" error "FIRST_MID date is earlier than LOW_DATE"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment