On this page:
new
new
new
new
9.0
top
up

2Ebuild - ClassesπŸ”— i

(require ebuild ) package: ebuild-lib

ebuild module reexports functions from the class module and modules included in this section, that is: ebuild/ebuild, ebuild/metadata, ebuild/package and ebuild/repository

2.1Ebuild ClassπŸ”— i

class

ebuild% :class?

superclass:object%

extends: printable<%>
Ebuild class.
For creating package ebuild files ("package.ebuild").

constructor

[ [yearyear]
[EAPIEAPI]
[customcustom]
[inheritsinherits]
[DESCRIPTIONDESCRIPTION]
[HOMEPAGEHOMEPAGE]
[SRC_URISRC_URI]
[SS]
[LICENSELICENSE]
[SLOTSLOT]
[KEYWORDSKEYWORDS]
[IUSEIUSE]
[REQUIRED_USEREQUIRED_USE]
[RESTRICTRESTRICT]
[COMMON_DEPENDCOMMON_DEPEND]
[RDEPENDRDEPEND]
[DEPENDDEPEND]
[BDEPENDBDEPEND]
[IDEPENDIDEPEND]
[PDEPENDPDEPEND]
[DOCSDOCS]
[PATCHESPATCHES]
[QA_PREBUILTQA_PREBUILT]
[QA_TEXTRELSQA_TEXTRELS]
[QA_EXECSTACKQA_EXECSTACK]
[QA_WX_LOADQA_WX_LOAD]
[QA_FLAGS_IGNOREDQA_FLAGS_IGNORED]
[QA_MULTILIB_PATHSQA_MULTILIB_PATHS]
[QA_PRESTRIPPEDQA_PRESTRIPPED]
[QA_SONAMEQA_SONAME]
[QA_SONAME_NO_SYMLINKQA_SONAME_NO_SYMLINK]
[QA_AM_MAINTAINER_MODEQA_AM_MAINTAINER_MODE]
[QA_CONFIGURE_OPTIONSQA_CONFIGURE_OPTIONS]
[QA_DT_NEEDEDQA_DT_NEEDED]
[QA_DESKTOP_FILEQA_DESKTOP_FILE]
[bodybody]])
custom:(listof (or/c (-> any )sh-function? string? ))='()
inherits:(listof string? )='()
DESCRIPTION:string? ="package"
HOMEPAGE : string?
= "https://wiki.gentoo.org/wiki/No_homepage"
SRC_URI:(listof src-uri? )='()
S:(or/c #fstring? )=#f
LICENSE:string? ="all-rights-reserved"
SLOT:string? ="0"
KEYWORDS:(listof string? )='("~amd64""~x86")
IUSE:(listof string? )='()
REQUIRED_USE:(listof cflag? )='()
RESTRICT:(listof (or/c cflag? string? ))='()
COMMON_DEPEND:(listof (or/c cflag? string? ))='()
RDEPEND:(listof (or/c cflag? string? ))='()
DEPEND:(listof (or/c cflag? string? ))='()
BDEPEND:(listof (or/c cflag? string? ))='()
IDEPEND:(listof (or/c cflag? string? ))='()
PDEPEND:(listof (or/c cflag? string? ))='()
DOCS:(listof string? )='()
PATCHES:(listof string? )='()
QA_PREBUILT:(listof string? )='()
QA_TEXTRELS:(listof string? )='()
QA_EXECSTACK:(listof string? )='()
QA_WX_LOAD:(listof string? )='()
QA_FLAGS_IGNORED:(listof string? )='()
QA_MULTILIB_PATHS:(listof string? )='()
QA_PRESTRIPPED:(listof string? )='()
QA_SONAME:(listof string? )='()
QA_SONAME_NO_SYMLINK:(listof string? )='()
QA_AM_MAINTAINER_MODE:(listof string? )='()
QA_CONFIGURE_OPTIONS:(listof string? )='()
QA_DT_NEEDED:(listof string? )='()
QA_DESKTOP_FILE:(listof string? )='()

method

(send an-ebuild create-list )list?

Creates a list that contains string s or false as elements. The elaments of the list are created using the "unroll" functions which are not exposed to the user.

Also, concatenates values that custom and body arguments return.

method

(send an-ebuild create )string?

Takes non-false elemets of the list created by create-list method and turns them into one string ready to be written into a file (by save for example).

method

(send an-ebuild save name[pth])void

name:string?
Creates a file named name in the given location pth (or current directory). Internally uses the interfece implemented by this object’s printable<%> to dispaly this to file.

method

(send an-ebuild append! symlst)void

sym:symbol?
lst:list?
Uses dynamic-get-field and dynamic-set-field! . Sets the field-name represented by sym symbol of this object to that field appended with lst list .

method

(send an-ebuild concat! symv)void

sym:symbol?
v:any/c
Like append! but a list is automatically generated from v.

Examples:
> (define my-ebuild
[IUSE(list "debug""test")]
[RESTRICT(list (cflag "test?"(list "debug")))]))
> (display my-ebuild)

# Copyright 1999-2025 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64 ~x86"

IUSE="debug test"

RESTRICT="test? ( debug ) mirror"

2.1.1Default Ebuild valuesπŸ”— i

package: ebuild-lib

Value containing the current year. It is the default value for year field in ebuild% class.

It is automatically set when require ing the ebuild/ebuild module (or the ebuild/private/ebuild/default-values module).

Not re-exported by ebuild/ebuild (nor ebuild) and not intened to by accessed by the user.

Currently it is equal to 2025.

Value containing the greatest available EAPI version. It is the default value for EAPI field in ebuild% class.

The value is hardcoded and periodically updated, if a user wishes to change it, then they should set it for each ebuild% object themselves, create a ebuild% subclass or mixin .

Re-exported by ebuild/ebuild and ebuild modules.

Currently it is equal to 8.

2.2Metadata ClassπŸ”— i

class

metadata% :class?

superclass:object%

extends: printable<%>
Metadata class.
For crating package metadata files ("metadata.xml").

constructor

[ [maintainersmaintainers]
[longdescriptionslongdescriptions]
[slotsslots]
[stabilize-allarchesstabilize-allarches]
[usesuses]
[upstreamupstream]])
maintainers:(listof maintainer? )='()
longdescriptions:(listof longdescription? )='()
slots:(listof slots? )='()
stabilize-allarches:boolean? =#f
uses:(listof use? )='()
upstream:(or/c #fupstream? )=#f

method

(send a-metadata create )document?

Creates a XML document ready to be written into a file.

method

(send a-metadata save [pth])void

Creates a file named "metadata.xml" in the given location (or current directory). Internally uses the interfece implemented by this object’s printable<%> to dispaly object to file.

Examples:
> (define my-metadata
[maintainers
(list (maintainer 'person#f"me@me.com""Me"#f))]
#f
#f
#f
(list (remote-id 'gitlab"me/myproject")))]))
> (display my-metadata)

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">

<pkgmetadata>

<maintainer type="person">

<email>me@me.com</email>

<name>Me</name>

</maintainer>

<upstream>

<remote-id type="gitlab">me/myproject</remote-id>

</upstream>

</pkgmetadata>

2.3Package ClassπŸ”— i

class

package% :class?

superclass:object%

Package class.
For creating packages.

constructor

[ [CATEGORYCATEGORY]
[PNPN]
[ebuildsebuilds]
[metadatametadata]])(is-a?/c package% )
CATEGORY:string? ="app-misc"
PN:string? ="unknown"
metadata:(is-a?/c metadata% )=(new metadata% )
By default if ebuilds are not given the default ebuild% object (with PN set to "unknown" is used) and if metadata is not given default "empty" metadata% object is used.

method

(send a-package get-versions )(listof package-version? )

Return a list of package-version s extracted from ebuilds.

Example:
> (send (new package% )get-versions)

(list (package-version "9999" #f #f #f #f #f))

method

(send a-package get-PVs )(listof string? )

Return a list of package-version s as string s extracted from ebuilds.

Example:
> (send (new package% )get-PVs)

'("9999")

method

(send a-package get-CATEGORY/PN )string?

Return a string composed of: CATEGORY, "/" and PN.

Example:
> (send (new package% )get-CATEGORY/PN)

"app-misc/unknown"

method

(send a-package get-Ps )(listof string? )

Return a list of package-version s joined with get-CATEGORY/PN.

Example:
> (send
[CATEGORY"dev-scheme"]
[PN"bytes"]
[ebuilds
get-Ps)

'("dev-scheme/bytes-1" "dev-scheme/bytes-2")

method

(send a-package show )void

Display ebuilds and metadata.

Example:
> (send (new package% )show)

CATEGORY/PN: app-misc/unknown

PV: 9999

# Copyright 1999-2025 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64 ~x86"

RESTRICT="mirror"

METADATA:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">

<pkgmetadata>

</pkgmetadata>

method

(send a-package save [pth])void

Creates (uses their save methods) ebuilds and metadata of this package. The names of ebuilds are equal to so-called P ebuild variable which is composed of PN (taken from this package% object) and PV (version, taken from the ebuilds hash). So ebuilds will be saved as "P.ebuild".

2.4Repository ClassπŸ”— i

superclass:object%

Repository class.
For creating ebuild repository structures.

constructor

[namename]
[ [layoutlayout]]
[packagespackages])(is-a?/c repository% )
name:string?
packages:(listof (is-a?/c package% ))
By default if layout is not given default-layout (parameter variable) is used.

method

(send a-repository show )void

Display repository name, layout and packages it contains.

method

(send a-repository layout-string )string?

Wrapper for layout->string .

method

(send a-repository save-layout [pth])void

Creates directory "metadata" with a file "layout.conf" in the given location (or current directory).

method

(send a-repository save-name [pth])void

Creates directory "profiles" with a file "repo_name" in the given location (or current directory).

method

(send a-repository save-packages [pth])void

Creates directory "CATEGORY/PN" with a "metadata.xml" file and "P.ebuild" ebuilds in the given location (or current directory).

method

(send a-repository save [pth])void

Creates a full ebuild repository directory structure. (uses save-layout , save-name and save-packages ).

Examples:
> (define r
[name"test"]
[packages
(list
[CATEGORY"sys-devel"]
[PN"asd"]
[ebuilds(hash (simple-version "1.1.1")(new ebuild% ))]
[metadata
(list )#f#f#f(list (remote-id 'gitlab"asd/asd")))])]))]))
> (display (send rlayout-string))

masters = gentoo

cache-formats = md5-dict

sign-commits = true

update-changelog = false

eapis-banned = 0 1 2 3 4 5 6

eapis-deprecated =

manifest-hashes = BLAKE2B SHA512

manifest-required-hashes = BLAKE2B

sign-manifests = false

thin-manifests = true

> (send rshow)

Repository name:

test

Repository layout:

masters = gentoo

cache-formats = md5-dict

sign-commits = true

update-changelog = false

eapis-banned = 0 1 2 3 4 5 6

eapis-deprecated =

manifest-hashes = BLAKE2B SHA512

manifest-required-hashes = BLAKE2B

sign-manifests = false

thin-manifests = true

Repository packages:

CATEGORY/PN: sys-devel/asd

PV: 1.1.1

# Copyright 1999-2025 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64 ~x86"

RESTRICT="mirror"

METADATA:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">

<pkgmetadata>

<upstream>

<remote-id type="gitlab">asd/asd</remote-id>

</upstream>

</pkgmetadata>

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /