cookutils rev 992

cook: try to fix the '[ Done|Failed ]' status in the activity log when the two `cook` simultaneously build two different packages using the same activity log.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Oct 30 00:44:20 2017 +0200 (2017-10-30)
parents 9a3a955f4eb1
children 3de0a0c5d4c8
files cook lighttpd/index.cgi
line diff
     1.1 --- a/cook	Sun Oct 29 18:12:02 2017 +0200
     1.2 +++ b/cook	Mon Oct 30 00:44:20 2017 +0200
     1.3 @@ -849,7 +849,7 @@
     1.4  	if grep -Ev "(conftest|configtest)" $LOGS/$pkg.log | \
     1.5  	   grep -Eq "(^ERROR|undefined reference to)" ; then
     1.6  		debug_info | tee -a $LOGS/$pkg.log
     1.7 -		sed -i '$ s|$| [ Failed ]|' $activity
     1.8 +		put_status $pkg Failed
     1.9  		rm -f $command
    1.10  		broken; exit 1
    1.11  	fi
    1.12 @@ -1585,6 +1585,14 @@
    1.13  }
    1.14  
    1.15  
    1.16 +# Put the status to the activity log
    1.17 +
    1.18 +put_status() {
    1.19 +	# $1: package, $2: status, one of 'Done', 'Failed'
    1.20 +	sed -i "s|>$1</a>$|& [ $2 ]|" $activity
    1.21 +}
    1.22 +
    1.23 +
    1.24  
    1.25  
    1.26  #
    1.27 @@ -2032,7 +2040,7 @@
    1.28  				clean_log "$pkg-pack"
    1.29  				time=$(($(date +%s) - $time))
    1.30  				summary | sed 's|^Cook |Pack |' | tee -a $LOGS/$pkg-pack.log
    1.31 -				sed -i '$ s|$| [ Done ]|' $activity
    1.32 +				put_status $pkg Done
    1.33  				rm -f $command
    1.34  				exit 0 ;;
    1.35  
    1.36 @@ -2076,7 +2084,7 @@
    1.37  			grep -Ev "(/root/.cvspass|conftest|df: /|rm: can't remove)" $LOGS/$pkg.log | \
    1.38  			grep -Eq "(^ERROR|: No such file or directory|not remade because of errors|ake: \*\*\* .* Error)"; then
    1.39  			debug_info | tee -a $LOGS/$pkg.log
    1.40 -			sed -i '$ s|$| [ Failed ]|' $activity
    1.41 +			put_status $pkg Failed
    1.42  			rm -f $command
    1.43  			broken; exit 1
    1.44  		fi
    1.45 @@ -2092,7 +2100,7 @@
    1.46  		# We may want to install/update (outside aufs jail!).
    1.47  		[ -s /aufs-umount.sh ] || install_package
    1.48  
    1.49 -		sed -i '$ s|$| [ Done ]|' $activity
    1.50 +		put_status $pkg Done
    1.51  
    1.52  		# Finally we DON'T WANT to build the *-dev or packages with WANTED="$pkg"
    1.53  		# If you want automation, use the Cooker Build Bot.
     2.1 --- a/lighttpd/index.cgi	Sun Oct 29 18:12:02 2017 +0200
     2.2 +++ b/lighttpd/index.cgi	Mon Oct 30 00:44:20 2017 +0200
     2.3 @@ -550,7 +550,7 @@
     2.4  					s|\[39m|</span>|;
     2.5  					s|\[1m|<strong>|g; s|\[0m|</strong>|g" \
     2.6  				-e "s|^+.*|<i>\0</i>|;
     2.7 -					s|^-.*|<b>\0</b>|; /----/s|</*b>||; /^<b>-- /s|</*b>||;"
     2.8 +					s|^-.*|<b>\0</b>|; /----/s|</*b>||; /^<b>--[^-]/s|</*b>||;"
     2.9  			;;
    2.10  
    2.11  		files)