Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Script for show current tasks and task status for ALT Linux build system
- # (c) Andrey Cherepanov <cas@altlinux.org>
- # Usage: gtl [<task num>]
- # Note: you should have access to git.alt to show you own tasks
- task="$1"
- grept()
- {
- pattern=$1
- shift
- esc=$(printf "\033")
- sed 's"'"$pattern"'"'$esc'[33m&'$esc'[0m"g' "$@"
- }
- grepe()
- {
- pattern=$1
- shift
- esc=$(printf "\033")
- sed 's"'"$pattern"'"'$esc'[31m&'$esc'[0m"g' "$@"
- }
- if [ -n "$task" ]; then
- # Dump task log and exit
- log="$(curl -s "http://git.altlinux.org/tasks/$task/" | grep '^<h2>Status' | cut -f2 -d '"')"
- if [ -n "$log" ]; then
- curl -s "http://git.altlinux.org/tasks/$task/$log" | grept '^#.*$' | grepe '^\(E\|error\): .*$'
- else
- echo "Unable to show log for task #$task"
- fi
- exit
- fi
- # Show complete task list
- ssh git.alt task ls | while read l
- do
- status="$(echo $l | cut -f2 -d ' ')"
- case "$status" in
- BUILDING)
- echo -e "\033[33m$l\033[0m"
- ;;
- AWAITING)
- echo -e "\033[36m$l\033[0m"
- ;;
- TESTED)
- echo -e "\033[32m$l\033[0m"
- ;;
- FAILED)
- echo -e "\033[35m$l\033[0m"
- ;;
- *)
- echo "$l"
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement