diff options
author | Kris Kennaway <kris@FreeBSD.org> | 2003-10-13 02:58:38 +0000 |
---|---|---|
committer | Kris Kennaway <kris@FreeBSD.org> | 2003-10-13 02:58:38 +0000 |
commit | 0c4ee12a728ba2aee2b868984364fe44dba94eda (patch) | |
tree | f217a92bc660cc2e3109bf360c809efb77e8c254 /Tools | |
parent | cc8e11aa6b021fd8456fcd34fd8cab5a03d05c91 (diff) | |
download | ports-0c4ee12a728ba2aee2b868984364fe44dba94eda.tar.gz ports-0c4ee12a728ba2aee2b868984364fe44dba94eda.zip |
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/portbuild/scripts/updatefailure | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/updatefailure b/Tools/portbuild/scripts/updatefailure new file mode 100755 index 000000000000..c5e4b9231bc3 --- /dev/null +++ b/Tools/portbuild/scripts/updatefailure @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Update the format of the failure file from the old-style (alphanumeric +# date, and only tracks latest failure date). +# +# This must be called via: +# +# lockf ${pb}/${arch}/${branch}/failure.lock ${pb}/scripts/updatefailure ${arch} ${branch} +# +# to avoid racing with any package builds in progress that might try to append to +# these files. + +# configurable variables +pb=/var/portbuild + +cleanup() { + echo "Problem writing new failure file!" + rm -f failure.new + exit 1 +} + +if [ $# -ne 2 ]; then + echo "updatefailure <arch> <branch>" + exit 1 +fi + +arch=$1 +branch=$2 +shift 2 + +. ${pb}/${arch}/portbuild.conf +. ${pb}/scripts/buildenv + +buildenv ${pb} ${arch} ${branch} + +home=${pb}/${arch}/${branch} +cd $home + +echo "===> Updating old failure file" + +rm -f failure.new +tr -s ' ' '_' < failure > failure2 +mv failure2 failure + +IFS='|' +while read dir name ver date count; do + + entry=$(grep "^$dir|" newfailure) + if [ -z "$entry" ]; then + echo $dir not in newfailures + olddate=0 + else + olddate=$(echo $entry | cut -f 4 -d \ ) + echo $dir has olddate $olddate + fi + + if (echo $olddate | grep '_'); then + date2=$(echo $olddate | tr -s '_' ' ') + echo $date2 + olddate=$(date -j -f %+ "$date2" +%s) + echo Updating to $olddate + fi + + if (echo $date | grep '_'); then + date2=$(echo $date | tr -s '_' ' ') + echo $date2 + date=$(date -j -f %+ "$date2" +%s) + echo Updating to $date + fi + + (echo "$dir|$name|$ver|$olddate|$date|$count" >> $home/failure.new) || cleanup +done < $home/failure + +mv failure.new failure |