wiki:Obsolete/MovedToTree/PackageManagement/BuildingPackages

Version 6 (modified by bonefish, 13 years ago) ( diff )

--

Building Packages

This page provides information regarding the package building process.

Haiku Package Files

The package file format is in specified in detail in a separate document. This section presents information from the perspective of how to build a package file.

A hpkg file is an archive file (just like tar or zip files) that additionally contains package meta information in a separate section of the file. When building a hpkg file via the package command the meta information must be provided via a .PackageInfo file. For convenience the file itself is added to the archive as well and can be extracted later, but it will be ignored by packagefs.

The .PackageInfo file must be located in the top directory that is archived. A package invocation usually looks like that:

package -C foo-4.5.26-1 foo-4.5.26-1-x86.hpkg

or (packaging a gcc2 build from within the folder):

cd foo-4.5.26-1
package ../foo-4.5.26-1-x86_gcc2.hpkg

The argument of the -C option specifies the directory whose contents to archive (by default the current directory), the remaining argument is the path of the package file to be built.

The .PackageInfo

The contents of the .PackageInfo adheres to a restricted driver settings syntax. It consists of name-value pairs, following this simple grammar:

package_info	::= attribute*
attribute	::= name value_list
value_list	::= value | ( "{" value* "}" )
value		::= value_item+ ( '\n' | ';' )

name can be one of the attribute names defined below. value_item is either an unquoted string not containing any whitespace characters or a string enclosed in quotation marks (" or ') which can contain whitespace and also escaped characters (using \).

The supported attributes are:

  • name: The name of the package, not including the package version. Must only contain <alphanum_underline> characters.
  • version: The version of the package. The string must have the version format (see the Version Strings section).
  • architecture: The system architecture the package has been built for. Can be either of:
    • any: Any architecture (e.g. a documentation package).
    • x86: Haiku x86, built with gcc 4.
    • x86_gcc2: Haiku x86, built with gcc 2.
  • summary: A short (one-line) description of the package.
  • description: A longer description of the package.
  • vendor: The name of the person/organization publishing this package.
  • packager: The name and e-mail address of person that created this package (e.g. "Peter Packman <peter.packman@example.com>").
  • copyrights: A list of copyrights applying to the software contained in this package.
  • licenses: A list of names of the licenses applying to the software contained in this package.
  • flags: A list of boolean flags applying to the package. Can contain any of the following:
    • approve_license: This package's license requires approval (i.e. must be shown to and acknowledged by user before installation).
    • system_package: This is a system package (i.e. lives under "/boot/system") .
  • provides: A list of entities provided by this package. The list elements must have the following format:
    entity		::= entity_name [ "=" version_ref ] [ ( "compat" | "compatible" ) version_ref ]
    entity_name	::= [ entity_type ":" ] alphanum_underline+
    entity_type	::= alphanum_underline+
    
    See the Version Strings section for the version_ref definition. The first version_ref specifies the version of the provided entity. It can be omitted e.g. for abstract resolvables like "web_browser". The version_ref after the "compat"/"compatible" string specifies the oldest version the resolvable is backwards compatible with.
  • requires: A list of entities required by this package. The list elements must have the following format:
    required_entity		::= entity_name [ version_operator version_ref ]
    version_operator	::= "<" | "<=" | "==" | "!=" | ">=" | ">"
    
    See the Version Strings section for the version_ref definition.
  • supplements: A list of entities that are supplemented by this package (i.e. this package will automatically be selected for installation if the supplemented entities are already installed). The list elements must have the required_entity format.
  • conflicts: A list of entities that this package conflicts with (i.e. only one of both can be installed at any time). The list elements must have the required_entity format.
  • freshens: A list of entities that are being freshened by this package (i.e. this package will patch one or more files of the package(s) that provide this entity). The list elements must have the required_entity format.
  • replaces: A list of entities that are being replaced by this package (used if the name of a package changes, or if a package has been split). The list elements must have the entity_name format.

Version Strings

Versions strings are used in three contexts: For the package version, for resolvable versions (provides), and in dependency version expressions (requires, supplements, conflicts, freshens). They are structurally identical, with the exception that the former requires a release component (version), while the latter two don't (version_ref):

version		::= major [ "." minor [ "." micro ] ] [ "-" pre_release ] "-" release
version_ref	::= major [ "." minor [ "." micro ] ] [ "-" pre_release ] [ "-" release ]
major		::= alphanum_underline+
minor		::= alphanum_underline+
micro		::= alphanum_underline+
pre_release	::= alpha_underline alphanum_underline*
release		::= integer_between_0_and_99

The meaning of the major, minor, and micro version parts is vendor specific. A typical, but not universal (!), convention is to increment the major version when breaking binary compatibility (i.e. version a.d.e is backwards compatible to version a.b.c for all b.c <= d.e), to increment the minor version when adding new features (in a binary compatible way), and to increment the micro version for bug fix releases. There are, however, projects that use different conventions which don't imply that e.g. version 1.4 is backwards compatible with version 1.2. Which convention is used is important for the packager to know, as it is required for a correct declaration of the compatibility versions for the provided resolvables. The compatibility version specifies the oldest version the provided resolvable is backwards compatible with, thus implying the version range requested by a dependent package the resolvable can satisfy. When following the aforementioned convention a resolvable of version 2.4.3 should have compatibility version 2 (or, semantically virtually identical, 2.0.0). Not following the convention 2.4 may be correct instead. If no compatibility version is specified, the resolvable can only satisfy dependency constraints with an exactly matching version.

The pre-release part of the version string has a special semantics for comparison. Unlike minor and micro its presence makes the version older. E.g. version R1.0-alpha1 is considered to be older than version R1.0. When both version strings have a pre-release part, that part is compared naturally after the micro part (R1.0.1-alpha1 > R1.0 > R1.0-beta1 > R1.0-alpha2).

The release part of the version string is assigned by the packager (not by the vendor). It allows to uniquely identify updated packages of the same vendor version of a software.

Package File Names

A package file name should have the following form:

file_name	::= name "-" version "-" architecture ".hpkg"
Note: See TracWiki for help on using the wiki.