Skip to content

Make a package

A port with a package.conf file becomes a rat package, and its files are not in the image. make packages builds the ports and writes one package for each into build/packages/ (i686) or build/x86_64/packages/ (x86_64):

make packages
make packages ARCH=x86_64

To install a package, see Packages.

package.conf

ports/<name>/package.conf is a settings file with a [package] section:

[package]
description = The Lua programming language interpreter
licence = MIT
release = 1
Key Value
description one line, at most 512 bytes
licence the licence of the program, at most 512 bytes
release a number from 1. Make it larger when the package changes and the version does not, so that rat upgrade installs it
name the package name, if it is not the name of the port folder
arch any for a package with no machine code; else leave it out

The version comes from the <NAME>_VERSION="..." line in the port's build.sh. A name has 1 to 32 characters from a-z, 0-9, +, . and -, and starts with a letter or a digit. A version has 1 to 32 characters from A-Z, a-z, 0-9, ., +, ~ and _.

What goes in the package

The package has every file, folder and symbolic link in the port's root folder, build/ports/<name>/root/ (build/x86_64/ports/<name>/root/ for x86_64). tools/rat/mkpkg.py checks the same rules as rat, so a package that it makes is one that rat installs:

  • only files, folders and symbolic links, with no setuid, setgid or sticky bit,
  • paths of at most 255 bytes, with no ., .. or empty parts and no control characters,
  • link targets that are relative, at most 100 bytes, and inside the package,
  • no path in var/lib/rat, dev, proc or tmp.

mkpkg.py makes the same bytes from the same files: it sorts the members, sets every time to 0 and every owner to root.

A file that is also in the ginnOS image is a conflict. The image build leaves out the files of every port that has a package.conf.

Files under etc/ are settings files: rat keeps a person's changes to them at an upgrade and a remove (see Packages). Put the files that a person can change there, and the other files elsewhere.

rat upgrade orders versions as Debian does: 1.10 is after 1.9, and 1.0~rc1 is before 1.0. A new version must be later than the old one in this order, or rat does not see it as an upgrade.

Publish the repository

The repository of each architecture is the GitHub release packages-i686 or packages-x86_64 of the ginnOS repository. To publish the packages of an architecture:

make publish
make publish ARCH=x86_64

make publish runs these steps, which also work one at a time:

  1. make packages makes the packages.
  2. make repo writes index.conf into the package folder with tools/rat/mkindex.py, and signs it into index.conf.sig with tools/rat/sign.sh.
  3. tools/rat/publish.sh uploads the packages, then the signature and the index, with gh release upload --clobber. It makes the release if it is not there, as a pre-release so that GitHub does not show it as the latest ginnOS release, and deletes the .rat files of the release that are not in the folder.

The sequence of the index is the time in seconds when mkindex.py runs, so each new index has a larger one. rat refuses an index with a smaller sequence than the one it has. To give a sequence, run make repo RAT_SEQUENCE=<number>.

The signing key

sign.sh signs with the private key in ~/.config/ginnos/rat-signing-key.pem, or with the key in RAT_KEY. The image trusts the public keys in tools/ext2/rootfs/etc/rat/keys/.

  • Do not put the private key in git or on a server. Keep a copy in a safe place.
  • tools/rat/newkey.sh <id> makes a new key pair. It does not replace a private key that is there. Commit the public key it writes.
  • A new key needs a new image: the images that exist only trust the old key.

For a test repository, sign with the test key of the host tests and add its public key to the image:

make repo RAT_KEY=src/lib/rat/test/keys/test-private.pem

The folder build/packages/ is then a repository for a file:/// URL in /etc/rat/repos.conf (see Packages).