Changeset 769 for rpmbuild-bot/rpmbuild-bot.sh
- Timestamp:
- May 30, 2016, 6:43:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rpmbuild-bot/rpmbuild-bot.sh
r768 r769 186 186 # 187 187 188 print_elapsed() 189 { 190 # $1 = start timestamp, in seconds (as returned by `date +%s`) 191 # $2 = string containg \$e (will be replaced with the elapsed time) 192 193 [ -z "$1" -o -z "$2" ] && return 194 195 local e=$(($(date +%s) - $1)) 196 local e_min=$(($e / 60)) 197 local e_sec=$(($e % 60)) 198 local e_hrs=$((e_min / 60)) 199 e_min=$((e_min % 60)) 200 e="${e_hrs}h ${e_min}m ${e_sec}s" 201 202 eval "echo \"$2\"" 203 } 204 205 quit() 206 { 207 if [ -n "$start_time" ] ; then 208 echo "Build ended on $(date -R)." 209 if [ $1 = 0 ] ; then 210 print_elapsed start_time "Build succeeded (took \$e)." 211 else 212 print_elapsed start_time "Build failed (took \$e)." 213 fi 214 fi 215 exit $1 216 } 217 188 218 run() 189 219 { … … 193 223 echo "ERROR: The following command failed with error code $rc:" 194 224 echo $@ 195 exit $rc225 quit $rc 196 226 fi 197 227 } … … 209 239 echo "You will find more information in file '$log'." 210 240 echo "Here are the last 10 lines of output:" 211 echo " "241 echo "------------------------------------------------------------------------------" 212 242 tail "$log" -n 10 213 exit $rc 243 echo "------------------------------------------------------------------------------" 244 quit $rc 214 245 fi 215 246 } … … 223 254 { 224 255 echo "ERROR: $1" 225 exit 1256 quit 1 226 257 } 227 258 … … 254 285 [ -n "$3" ] && eval $3 255 286 [ -f "$file" ] || die "File '$file' is not found." 256 echo "Checking t mestamp of $file..."287 echo "Checking timestamp of $file..." 257 288 local act_ts=`stat -c '%Y' "$file"` 258 289 if [ "$ts" != "$act_ts" ] ; then … … 269 300 echo "Usage:" 270 301 sed -n -e "s/rpmbuild-bot.sh/${0##*/}/g" -e 's/^# > / /p' < "$0" 271 exit 255302 quit 255 272 303 } 273 304 … … 328 359 fi 329 360 361 local start_time= 362 330 363 # Generate RPMs. 331 364 for arch in $RPMBUILD_BOT_ARCH_LIST ; do 332 365 echo "Creating RPMs for '$arch' target (logging to $log_base.$arch.log)..." 366 start_time=$(date +%s) 333 367 log_run "$log_base.$arch.log" rpmbuild.exe --target=$arch -bb "$spec_full" 368 print_elapsed start_time "Completed in \$e." 334 369 done 335 370 336 371 # Generate SRPM. 337 372 echo "Creating SRPM (logging to $log_base.srpm.log)..." 373 start_time=$(date +%s) 338 374 log_run "$log_base.srpm.log" rpmbuild -bs "$spec_full" 375 print_elapsed start_time "Completed in \$e." 339 376 340 377 # Find SRPM file name in the log. … … 360 397 # Generate ZIP. 361 398 echo "Creating ZIP (logging to $log_base.zip.log)..." 399 start_time=$(date +%s) 362 400 create_zip() 363 401 {( … … 374 412 )} 375 413 log_run "$log_base.zip.log" create_zip 414 print_elapsed start_time "Completed in \$e." 376 415 377 416 local ver_list="$log_base.$ver_full.list" … … 730 769 spec_list="$log_base.list" 731 770 771 start_time=$(date +%s) 772 773 echo "Build started on $(date -R)." 732 774 echo "Package: $spec_name" 733 775 echo "Command: $command $options" … … 741 783 run eval "${command_name}_cmd" 742 784 743 echo "All done." 744 745 exit 0 785 quit 0
Note:
See TracChangeset
for help on using the changeset viewer.