From Fedora Project Wiki

Revision as of 14:38, 5 October 2011 by Ctyler (talk | contribs) (Expanded page)

Warning.png
This page is a draft only
It is still under construction and content may change. Do not rely on the information on this page.

Description

Moji is a simple build system in which the client grabs a package from the server, builds it locally using mock, and then uploads the results back to the original server. Moji stands for "mini koji" and it was written to support the Fedora-ARM armv5tel F15 pre-koji build effort.

Using Moji for the Fedora ARM F15-armv5tel Effort

Setting Up

To use a system as a Moji client for the ARM F15 armv5tel bringup:

  1. Install the Moji repo file: rpm -Uvh http://...
  2. Install the Moji preconfigured client: yum install moji
  3. Start the Moji server: service moji-client start
  4. (Optional) Configure the Moji server to start at next boot: chkconfig moji-client on

Please see the arm@lists.fedoraproject.org mailing list for more information.

Stopping the Moji Client

  • To stop the Moji client gracefully, at the end of the current build: service moji-client disable
  • To stop the Moji client immediately: service moji-client stop

Moji source code

The source code for Moji is in the Fedora ARM git repository at http://fedorahosted.org/arm/

Application Information

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)

For the ARM F15 armv5tel startup, the Moji server is australia.proximity.on.ca.

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