Skip to content

doc: packaging: altlinux

Yury V. Zaytsev edited this page Apr 6, 2025 · 2 revisions

Building binary packages for ALT Linux

The package format of ALT Linux is RPM. Thus, building an RPM package can be done in the same way as in any RPM-based Linux distribution. But like most distributions, ALT Linux has its own peculiarities. The main ones include:

Conventions and notation

To avoid ambiguous interpretations, it is necessary to define the terms and notation used later in the text. We will use macros and environment variables defined in ALT RPM itself:

  • %_topdir - top-level directory containing the standard RPM directory hierarchy where the package is built. The default value of this macro is $HOME/RPM;
  • %_sourcedir - macro that points to the source directory of the program being built into the package. The default value is %_topdir/SOURCES;
  • %_specdir - The directory containing the spec file. The default value is %_topdir/SPECS;
  • %_srcrpmdir - The directory that will contain the built source package (src.rpm). The default value is %_topdir/SRPMS;
  • %_rpmdir/%_arch - A directory containing subdirectories named after the different architectures (%_arch) for which the package is being built. The binary package will be placed in one of these subdirectories. The default value of the %_rpmdir macro is %_topdir/RPMS.

The values of all of these macros can be overridden by the user in ~/.rpmmacros.

In addition, we designate the GIT_DIR variable as the directory where the clone of the MC's git repository will be located.

Preparing to build

To build the mc package, you need to obtain the source code in one of the following formats: either the git repository or a tarball (tar.bz2 or tar.xz). You can also make a tarball yourself from a clone of the repository. To create a tarball from thee git repository, follow these steps:

  1. Go to the $GIT_DIR directory.
  2. Install all packages needed for the build. In ALT Linux, the regular package installer is apt-get.
  3. Run the command

./autogen.sh && ./configure && make dist

This will result in a file named mc-<version>.tar.bz2 in $GIT_DIR. Next, the RPM package will be built from this tarball. In principle, you can pack the contents of the git repository (without the .git directory) into a tarball:

tar cjf mc-<version>.tar.bz2 --exclude '*/.git' mc

In this case, the commands

./autogen.sh
./configure

will need to be executed when building the rpm package.

Building using rpmbuild

To build rpm packages, you must install the rpm-build and rpm-utils packages.

sudo apt-get install rpm-build

Next, you need to create a directory hierarchy %_topdir:

In %_sourcedir you should copy the resulting tarball, and create the mc.spec file in %_specdir. You can use the spec file of the mc package located in the Sisyphus apt repository as a template.

In the spec file, you should edit the Version and Release numbers, and preferably make an entry in the %changelog section about this build. To add an entry to %changelog it is convenient to use the add_changelog utility from the rpm-utils package.

The binary package is built with the command

rpmbuild -bb mc.spec

running in the %_specdir directory, and the source package with the command

rpmbuild -bs mc.spec.

Both packages can be built simultaneously with the command

rpmbuild -ba mc.spec.

After the build, the binary package will reside in the %_rpmdir/%_arch directory and the source package will reside in the %_srcrpmdir directory.

Building with hasher

You can read about what hasher is, as well as how to install and configure it here.

The input for hasher is the APT package repository (local or remote) in which the build will be done, and the RPM package with the source code mc-<version>.src.rpm. Once hasher is configured with the desired repository, the build is performed with the command

hsh --no-sisyphus-check --no-repackage-source ~/hasher mc-<version>.src.rpm

The --no-sisyphus-check key disables all checks that a package must pass when built for the Sisyphus repository. The --no-repackage-source key prevents hasher from creating another src.rpm.

Upon a successful build, the resulting packages will reside in ~/hasher/repo/%_arch/RPMS.hasher, otherwise build errors will be displayed on stdout.

Building with gear

TODO

Clone this wiki locally