💾 Archived View for lofi.haiku-os.org › docs › develop › packages › PackagingPolicy.gmi captured on 2023-12-28 at 15:23:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-28)

-=-=-=-=-=-=-

Packaging Policy

This document defines the policy for creating packages.

Multiple Packages per Software

Installation files of a software shall be put into separated packages according to their purpose. For a software “foo”:

If multiple packages are defined, they must not contain any common files.

If a software contains client and server software that can be used independently from each other, two separate sets of packages shall be created.

Provides Declaration

A package “foo” must declare the following provided resolvables:

Any instance of ‘-’ in <name> shall be replaced by ‘_’. If the backward compatibility of a resolvable is known, a “compat >= <compatibleVersion>” shall be added accordingly.

Documentation

If a package “foo” provides documentation (which it should, of course), in many cases that can be provided in different formats:

Data Files

Data files for a package foo shall generally be placed in a directory “data/foo”. If it is likely that multiple versions of a package may be installed, then a version string shall be appended. Data (but not settings/configuration) files generated at run-time shall be placed in “cache/foo” or “var/foo”, depending on the kind of data the files contain. For data files, both read-only or generated, that are shared between different packages/software a differently named subdirectory may be used as appropriate (e.g. font files are placed in “data/fonts”).

Writable and Settings Files and Directories

All global writable files and directories as well as user settings files and directories that the package includes or the packaged software creates or requires the user to create shall be declared by the package (via GLOBAL_WRITABLE_FILES respectively USER_SETTINGS_FILES in the build recipe) in the following way:

USER_SETTINGS_FILES="settings/foo template data/foo/user-settings-template"

If no template file is included, the settings file shall still be declared:

USER_SETTINGS_FILES="settings/foo"
GLOBAL_WRITABLE_FILES="settings/foo keep-old"

“keep-old” indicates that the software can read old files and the user-modified file should be kept. “manual” indicates that the software may not be able to read an older file and the user may have to manually adjust it. “auto-merge” indicates that the file format is simple text and a three-way merge shall be attempted. If a default settings file is not included in the package, the settings file shall still be declared, just without the additional keyword.

In both cases, user settings files and global writable files, the “directory” keyword can be used to indicate that the given path actually refers to a directory.

Post-Installation Scripts

A package may include one or more post-installation scripts. The scripts are executed whenever the package is activated (for the first time, but also after package updates and first boot of a newly installed OS). They shall be placed in “boot/post-install” and declared explicitly by the package (via POST_INSTALL_SCRIPTS in the build recipe). A post-install script should be considered the last resort. It should only be used, if there’s no reasonable alternative. A typical use would be to create a desktop icon that the user can move around or delete.

Pre-Uninstallation Scripts

These undo the effects of a post-installation script and usually are put into “boot/pre-uninstall”. A typical use is to remove desktop icons.