Sugar Activity Packaging Guidelines

These guidelines are for packaging Sugar activities. Sugar is the core of the OLPC Human Interface.

Macros

Sugar looks for its activities in two fixed locations, which are defined in sugar-toolkit with rpm macros:

Architecture Independent (noarch):

%global sugaractivitydir /usr/share/sugar/activities/

Architecture Dependent:

%global sugarlibdir %{_libdir}/sugar/activities

Necessary BuildRequires

All Sugar Activities use setup.py, which is dependant upon sugar-toolkit. Accordingly, all activities need to:

BuildRequires: sugar-toolkit

Naming

All activities MUST be named sugar-.

Architecture-specific Activities

All activities containing compiled code (thus, architecture-specific) must be built in the %build section. Any architecture-specific bits must either go in %{_bindir} %{_libdir} or %{sugarlibdir} as appropriate.

Runtime Dependencies

All runtime dependency information MUST be manually added. There is no build time detection for Sugar activities.

Sample SPEC

Name:           sugar-journal
Version:        79
Release:        1%{?dist}
Summary:        Journal for Sugar

Group:          Sugar/Activities
License:        GPLv2+
URL:            http://wiki.laptop.org/go/Journal
Source0:        journal-activity-%{version}.tar.bz2
Source1:        sugar-journal-checkout.sh
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  python sugar-toolkit
Requires:       sugar
BuildArch:      noarch

%description
The Journal activity provides an intuitive interface for viewing projects and
files saved by the XO user. Activities that the user has stopped will show in
the journal view with a timer showing how long ago they were stopped.

%prep
%setup -q -n journal-activity-%{version}


%build


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{sugaractivitydir}
./setup.py install $RPM_BUILD_ROOT%{sugaractivitydir}


%clean
rm -rf $RPM_BUILD_ROOT


%files
%doc NEWS
%{sugaractivitydir}/Journal.activity/


%changelog
* Fri Apr 04 2008 Dennis Gilmore <dennis@ausil.us> - 79-1
- Initial packaging

Sample Checkout Script

#!/bin/bash

VERSION=79
NAME=journal-activity

rm -rf $NAME-$VERSION

git clone git://dev.laptop.org/$NAME $NAME-$VERSION

tar -cjvf $NAME-$VERSION.tar.bz2 $NAME-$VERSION

rm -rf $NAME-$VERSION