A Really Basic Koji-Shadow Script

This script will follow the general procedure:
* List the latest tagged (non-inherited) packages from the arch being followed
* Download and import any of the non-arch detected packages
* Sort all missing builds by their creation timestamp and order them to be qued
* Loop thru the missing package list and download and que each build

A simple server-side script to help reduce the size of the Koji sessions table:

#!/bin/bash
pd=$(echo $(date "+%s") - 1800 | bc) ; echo "$pd" ; psql koji -c "delete from sessions where extract(epoch from update_time) < $pd and master != 0;"
while true
do
	pd=$(echo $(date "+%s") - 1800 | bc) ; echo "$pd" ; psql koji -c "delete from sessions where expired = 't' and extract(epoch from update_time) < $pd;"
	sleep 2400
done

A simple script to re-que the latest failed build tasks in case of a build-root breakage:

#!/bin/bash
let x="0"
let l="50 * $1"
while [ $x -lt $l ]
do
	echo "[$x]"
	for t in `curl -sL "$1/koji/tasks?start=${x}&state=failed&view=flat&method=build&order=-completion_time" | grep -Eiv "pcre|libssh|glib2|glibc" | grep -i 'taskinfo.taskID=[0-9]*' | sed -e 's/^.*taskinfo.taskID=\([0-9]*\).*$/\1/g'`
	do
		echo "    [$t]"
		koji -s "$1/kojihub" resubmit --nowait "$t"
	done
	let x="$x + 50"
done

Source Code (Git Hub)
Source Code (Fedora People)

2 thoughts on “A Really Basic Koji-Shadow Script

Leave a comment