From Fedora Project Wiki

DRAFT

THIS DOCUMENT IS A WORK IN PROGRESS. DO NOT RELY UPON IT, FOR IT WILL EAT YOUR BABIES.

Introduction

This is a simple, step-by-step lesson plan for becoming an effective Sugar activities packager for Fedora. There are a lot of steps involved, which makes the process look intimidating -- but really, it's pretty simple, and this lesson plan will take you through it. Follow these steps and you'll be an ace packager in no time at all.

We assume basic familiarity with Linux, understand how to install and uninstall RPM packages, familiarity with command-line usage, and basic scripting, programming, and sysadmin skills.

Background Reading

Estimated time: 30 minutes

It's a really great idea to read through the Creating a Fedora Package HOWTO before you get started. It's a big document, and you may not understand it all, but that's okay; read through it once to get familiar with the ideas, and then we'll go through everything step by step here.

Packaging Your First Sugar Activity

LESSON 1: Setting Up Your System

Estimated time: 15 minutes

In order to create an RPM package, it's customary to set up a separate user on your Linux system called "makerpm", and then configuring an RPM build environment in that user's home directory. Instructions on how do that that can be found in the Creating a Package Howto.

Go follow those instructions now. When you're done, you should have a user named makerpm with a directory in your homedir named rpmbuild that looks something like this:

[makerpm@localhost rpmbuild]$ pwd
/home/makerpm/rpmbuild
[makerpm@localhost rpmbuild]$ ls
BUILD  RPMS  SOURCES  SPECS  SRPMS

LESSON 2: Rebuilding a Package

Estimated time: 1 hour

We'll start by rebuilding a Sugar activity that has already been packaged. Most of the work has already been done for us; we will examine the components of the typical Sugar activity package.

What is "making a package"?

When you're making a package for Fedora, what you're really doing is taking the released source code of a software project, and adding some rules about how to install it and uninstall it on a standard Fedora system.

First you will usually identify the source tarball. This is where the source code "lives" on the web, and there must be a permanent URL associated with it.

Next, you will write the spec file. The spec file is a set of simple rules that define how the tarball is installed, how it's removed, and other tools. (These rules are explained in great detail in the Creating a Fedora Package HOWTO, and can be quite complex -- but for now we will focus on the simple cases around typical Sugar activities.)

Once the spec file is written, you test the spec file with a tool called rpmlint to make sure that you haven't made any simple mistakes.

Then you run rpmbuild, which downloads the source tarball, examines the spec file, and spits out an RPM.

After that, you can run rpmlint on the RPM, install and uninstall it, and otherwise test to make sure that the software is installing, running, and uninstalling properly.

Later, you will want to make sure that your package is being built with all of the proper dependencies, but that can come later.

Calculator: Getting the source

A lot of activity sources are maintained at the [source repositories]. We will be working with the source to the Calculator activity.

Calculator: Getting the source package

http://cvs.fedoraproject.org/viewvc/rpms/sugar-calculator/F-10/

Making a source package from GIT

Packaging/SourceURL#Using_Revision_Control