From Fedora Project Wiki

Revision as of 14:22, 5 October 2011 by Fossjon (talk | contribs)

Application

Server

python /path/to/moji.py server /path/to/source /path/to/working /path/to/finished /path/to/repo [password]
  • "source" is the folder containing source RPM files
    • the "source" folder can contain a file called "priority.txt" which is a simple plaintext file where each line is the filename of a source pkg that should be built first (ex. arpwatch-2.1a15-15.fc15.src.rpm)
  • "working" is a folder that contains any source RPM files currently being worked on by a builder
  • "finished" is a folder containing source RPM files that have been built (failure or success)
  • "repo" is the directory which contains the mock build result output of any "finished" builds
    • the "repo" directory should also be publicly accessible (ex. via httpd)
    • createrepo needs to also be run via some other means (ex. shell script via incrontab)

Client

python /path/to/moji.py client <hostname or ip> <mock config name> [password]
  • the mock option should be a config file name (ex fedora-15-arm)
    • the actual mock file (ex. /etc/mock/fedora-15-arm.cfg) should point to at least 2 repos: one to the moji server repo dir and another to a pre-established "main-line" repo

Design/Protocol

  • defaults to TCP port 6789
  • non-threaded and does not fork per child
    • does fork before any request that could take a while (ex. sending files or building packages)
  • if a client disconnects, their build is considered failed and sent to another builder later on
  • clients send dummy keep-alive ping messages thru its socket object

Repo Management

$ incrontab -e

/tmp/builds/done IN_CREATE touch /tmp/builds.flag

$ cat builds.sh

#!/bin/bash

while true
do
	if [ -e /tmp/builds.flag ] # check the lock flag
	then
		echo "Starting on [ `date` ]" | tee -a /home/builder/builds.log
		
		rm /tmp/builds.flag
		mkdir /tmp/builds/repo 2> /dev/null # make sure the temp repo directory exists
		rm -frv /tmp/builds/repo/* 2> /dev/null # clear the repo directory
		
		ls /tmp/builds/done | while read line
		do
			if [ ! -e "/tmp/builds/repo/${line}" ]
			then
				ln -s "/tmp/builds/done/${line}" "/tmp/builds/repo/${line}"
			fi
		done
		
		rm -frv /tmp/builds/repo/repodata # remove any repo data links
		cp -frv /tmp/builds/done/repodata /tmp/builds/repo/ # copy over the old repo data
		createrepo --update -d /tmp/builds/repo # create/update the new repo data
		cp -frv /tmp/builds/repo/repodata /tmp/builds/done/ # copy back the new repo data
		
		echo "Ending on [ `date` ]" | tee -a /home/builder/builds.log
	fi
	
	sleep 5 # sleep loop or risk fire!
done

Priority Packages