.SRCINFO: Difference between revisions

From ArchWiki
m (End sentences introducing code blocks with colons instead of periods. Use italic for executable names and monospace for file content.)
m (Reformat examples into Template:hc)
 
(3 intermediate revisions by 3 users not shown)
Line 2: Line 2:
[[ja:.SRCINFO]]
[[ja:.SRCINFO]]
[[pt:.SRCINFO]]
[[pt:.SRCINFO]]
[[ru:.SRCINFO]]
[[zh-hans:.SRCINFO]]
[[zh-hans:.SRCINFO]]
{{Related articles start}}
{{Related articles start}}
{{Related|Arch packaging standards}}
{{Related|Arch packaging standards}}
{{Related|Arch Build System}}
{{Related|Arch build system}}
{{Related|Creating packages}}
{{Related|Creating packages}}
{{Related|PKGBUILD}}
{{Related|PKGBUILD}}
Line 15: Line 16:
{{Related articles end}}
{{Related articles end}}


{{ic|.SRCINFO}} files contain package metadata in a simple, unambiguous format, so that tools such as the [[AUR]]'s Web back-end or [[AUR helpers]] may retrieve a package's metadata without parsing the [[PKGBUILD]] directly. See {{Bug|25210}}, {{Bug|15043}}, and {{Bug|16394}} for examples of the sorts of issues that may arise from attempting to parse shell scripts.
{{ic|.SRCINFO}} files contain package metadata in a simple, unambiguous format, so that tools such as {{Pkg|devtools}}, the [[AUR]]'s Web back-end or [[AUR helpers]] may retrieve a package's metadata without parsing the [[PKGBUILD]] directly. See {{Bug|25210}}, {{Bug|15043}}, and {{Bug|16394}} for examples of the sorts of issues that may arise from attempting to parse shell scripts.


{{Warning|Changes to {{ic|PKGBUILD}} metadata, such as [[PKGBUILD#pkgver|pkgver()]] updates, do not automatically propagate to {{ic|.SRCINFO}}. Pushing an edited {{ic|PKGBUILD}} to the AUR without also updating its {{ic|.SRCINFO}} will cause the AUR to serve stale metadata.}}
{{Warning|Changes to {{ic|PKGBUILD}} metadata, such as [[PKGBUILD#pkgver|pkgver()]] updates, do not automatically propagate to {{ic|.SRCINFO}}. Pushing an edited {{ic|PKGBUILD}} to the AUR without also updating its {{ic|.SRCINFO}} will cause the AUR to serve stale metadata.}}
Line 31: Line 32:
Keys take their names and meanings from PKGBUILD variables; see {{man|5|PKGBUILD|OPTIONS AND DIRECTIVES}}. Neither keys nor values are quoted. Data that, in a {{ic|PKGBUILD}}, would be represented by an array is instead specified multiple times. For instance, the following are equivalent:
Keys take their names and meanings from PKGBUILD variables; see {{man|5|PKGBUILD|OPTIONS AND DIRECTIVES}}. Neither keys nor values are quoted. Data that, in a {{ic|PKGBUILD}}, would be represented by an array is instead specified multiple times. For instance, the following are equivalent:


# PKGBUILD
{{hc|PKGBUILD|arch{{=}}(i686 x86_64)}}
arch=(i686 x86_64)


# .SRCINFO
{{hc|.SRCINFO|
arch = i686
arch {{=}} i686
arch = x86_64
arch {{=}} x86_64
}}


The main section of the file is headed by a [[PKGBUILD#pkgbase|pkgbase]] declaration, and contains data applicable to the package as a whole. In a standard {{ic|PKGBUILD}} describing a single package, this will be the only section, followed by a [[PKGBUILD#pkgname|pkgname]] declaration containing the same value as the preceding {{ic|pkgbase}}:
The main section of the file is headed by a [[PKGBUILD#pkgbase|pkgbase]] declaration, and contains data applicable to the package as a whole. In a standard {{ic|PKGBUILD}} describing a single package, this will be the only section, followed by a [[PKGBUILD#pkgname|pkgname]] declaration containing the same value as the preceding {{ic|pkgbase}}:

Latest revision as of 10:43, 8 January 2024

.SRCINFO files contain package metadata in a simple, unambiguous format, so that tools such as devtools, the AUR's Web back-end or AUR helpers may retrieve a package's metadata without parsing the PKGBUILD directly. See FS#25210, FS#15043, and FS#16394 for examples of the sorts of issues that may arise from attempting to parse shell scripts.

Warning: Changes to PKGBUILD metadata, such as pkgver() updates, do not automatically propagate to .SRCINFO. Pushing an edited PKGBUILD to the AUR without also updating its .SRCINFO will cause the AUR to serve stale metadata.

Generation

.SRCINFO files may be generated using makepkg:

$ makepkg --printsrcinfo > .SRCINFO

Syntax

.SRCINFO files are lists of key = value pairs, separated into sections.

Keys take their names and meanings from PKGBUILD variables; see PKGBUILD(5) § OPTIONS AND DIRECTIVES. Neither keys nor values are quoted. Data that, in a PKGBUILD, would be represented by an array is instead specified multiple times. For instance, the following are equivalent:

PKGBUILD
arch=(i686 x86_64)
.SRCINFO
arch = i686
arch = x86_64

The main section of the file is headed by a pkgbase declaration, and contains data applicable to the package as a whole. In a standard PKGBUILD describing a single package, this will be the only section, followed by a pkgname declaration containing the same value as the preceding pkgbase:

pkgbase = foo
	pkgdesc = An example package.
	...
	md5sums = SKIP

pkgname = foo

In a split PKGBUILD, each section is headed by a pkgname, followed by any data specific to that package.

This article or section needs expansion.

Reason: The above will suffice for some, below is a verbose list of parameters; split these up to improve readability. Also, find ways to reduce redundancy between this and PKGBUILD. (Discuss in Talk:.SRCINFO)

Specification

The following fields may appear only once in each .SRCINFO file, in the pkgbase section:

  • pkgver, pkgrel, epoch

The following fields may appear up to once in any section.

  • pkgdesc, url, install, changelog

The following fields may be repeated within a section to specify multiple values:

  • arch
  • groups
  • license
  • noextract
  • options
  • backup
  • validpgpkeys (can only be in pkgbase)

The following fields may, additionally, specify multiple architectures as shown below:

source_x86_64 = https://foo.bar/file.tar.gz
source_i686 = https://foo.bar/file_i686_patch.tar.gz
  • source
  • depends, checkdepends, makedepends, optdepends
  • provides, conflicts, replaces
  • md5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums

Fields with other names are ignored. Blank lines and comment lines beginning with a hash sign (#) are also ignored. Lines may be indented.