File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -675,6 +675,22 @@ cat <<\RECORD > record-success.sh
675675#!/bin/sh
676676test "$1 " || { echo "[ERROR] Please specify project to update."; exit 1; }
677677
678+ containsLine() {
679+ pattern=$1
680+ file=$2
681+ test -f "$file " || return
682+ # HACK: The obvious way to do this is:
683+ #
684+ # grep -qxF "$pattern " "$file "
685+ #
686+ # Unfortunately, BSD grep dies with "out of memory" when the pattern is 5111
687+ # characters or longer. So let's do something needlessly complex instead!
688+ cat "$file " | while read line
689+ do
690+ test "$pattern " = "$line " && echo 1 && break
691+ done
692+ }
693+
678694dir=$( cd " $( dirname " $0 " ) " && pwd)
679695buildLog="$dir /$1 /build.log"
680696test -f "$buildLog " || exit 1
@@ -685,11 +701,12 @@ mkdir -p "$(dirname "$successLog")"
685701deps=$( grep " ^\[INFO\] " " $buildLog " |
686702 sed -e " s/^.\{10\}//" -e " s/ -- .*//" |
687703 sort | tr ' \n' ' ,' )
688- test -f "$successLog " && grep -Fxq "$deps " "$successLog " || {
704+ if [ -z "$( containsLine " $deps " " $successLog " ) " ]
705+ then
689706 echo "$deps " > "$successLog ".new
690707 test -f "$successLog " && cat "$successLog " >> "$successLog ".new
691708 mv -f "$successLog ".new "$successLog "
692- }
709+ fi
693710RECORD
694711 chmod +x record-success.sh
695712}
You can’t perform that action at this time.
0 commit comments