roll development

nadyawilliams edited this page Jun 11, 2014 · 2 revisions

Table of Contents

Overview

Note: nearly all of these tips have been added to the "rocks" command.

Check the latest Roll Developer's Guide for details.

Repack the roll with all built RPM

If you already build a *lots* of RPM, but some RPM is failed due to some reason. You don't need to rebuild the whole roll just to repack that RPM. Instead, you can

make reroll
To repack all RPMS under RPMS/ and SRPMS/ directory. Make sure you didn't "make clean" or delete RPMS directory.

Verify validity of graph & node XML

Here's a simple script that I use to verify syntax of my graph & node XML BEFORE making the roll

#!/opt/rocks/bin/python

import os
from xml.dom.minidom import parse

# graph
for file in os.listdir('graphs/default') :
        if not file.endswith('.xml') :
                continue
        print 'parsing ' + file
        path = os.path.join('graphs/default', file)
        parse(path)

# node
for file in os.listdir('nodes') :
        if not file.endswith('.xml') :
                continue
        print 'parsing ' + file
        path = os.path.join('nodes', file)
        parse(path)

You may chain this to default "make roll" rules in top-level Makefile

verify: 
        ./xml_verify

default: verify roll

Testing graph & node RPM

Roll will comes with a RPM called roll-kickstart-RollName which contains graph and node of the roll. Most of the time roll development will have to deal with graph and node file. Here's some tips to speed up the test for graph and nodes.

(at the root of your roll source)
make profile <--- this will create roll-kickstart-<roll name>.rpm in RPMS/<arch> directory
rpm -Uvh RPMS/<arch>/roll-kickstart-<roll name>.rpm
cd /home/install && rocks-dist dist
# now test the graph & nodes file
rocks list host profile compute-0-0
rocks list host profile <frontend name>

Checking for build error

One problem of building roll is, how to make sure there's no "critical" error during the make roll. If you copied the makefile from most existing rolls, usually the make will continue even if there's any error occurred. This is convenient in most cases, but may lead to undetected error during roll rebuild. Here's my tips to check the error

make roll >& log < /dev/null & (making roll)
(once finished)
cat log | grep -i error | egrep -v 'checking|ignored|gcc|ld|ar' | less
Most of the contents should be filtered out already. Now check the output of command. Note that, I assume that error from compilation and linking *will* appear in the next line.