Chapitre 2. Preparing software for RPM packaging

This section explains how to prepare software for RPM packaging. To do so, knowing how to code is not necessary. However, you need to understand the basic concepts, such as What is source code and How programs are made.

2.1. What is source code

This part explains what is source code and shows example source codes of a program written in three different programming languages.

Source code is human-readable instructions to the computer, which describe how to perform a computation. Source code is expressed using a programming language.

This document features three versions of the Hello World program written in three different programming languages:

Each version is packaged differently.

These versions of the Hello World program cover the three major use cases of an RPM packager.

Exemple 2.1. Hello World written in bash

The bello project implements Hello World in bash. The implementation only contains the bello shell script. The purpose of the program is to output Hello World on the command line.

The bello file has the following syntax:

#!/bin/bash

printf "Hello World\n"

Exemple 2.2. Hello World written in Python

The pello project implements Hello World in Python. The implementation only contains the pello.py program. The purpose of the program is to output Hello World on the command line.

The pello.py file has the following syntax:

#!/usr/bin/python3

print("Hello World")

Exemple 2.3. Hello World written in C

The cello project implements Hello World in C. The implementation only contains the cello.c and the Makefile files, so the resulting tar.gz archive will have two files apart from the LICENSE file.

The purpose of the program is to output Hello World on the command line.

The cello.c file has the following syntax:

#include <stdio.h>

int main(void) {
    printf("Hello World\n");
    return 0;
}