On this page:
2.1 Ebuild Class
ebuild%
new
create-list
create
save
2.2 Metadata Class
metadata%
new
create
save
2.3 Package Class
package%
new
get-versions
get-PVs
CATEGORY/  PN
show
save
2.4 Repository Class
repository%
new
show
layout-string
save-layout
save-name
save-packages
save
8.2

2 Ebuild - Classes

 (require ebuild) package: ebuild

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.1 Ebuild Class

 (require ebuild/ebuild) package: ebuild

class

ebuild% : class?

  superclass: object%

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

constructor

(new ebuild% 
    [[year year] 
    [EAPI EAPI] 
    [custom custom] 
    [custom-unroller custom-unroller] 
    [inherits inherits] 
    [DESCRIPTION DESCRIPTION] 
    [HOMEPAGE HOMEPAGE] 
    [SRC_URI SRC_URI] 
    [S S] 
    [LICENSE LICENSE] 
    [SLOT SLOT] 
    [KEYWORDS KEYWORDS] 
    [IUSE IUSE] 
    [REQUIRED_USE REQUIRED_USE] 
    [RESTRICT RESTRICT] 
    [COMMON_DEPEND COMMON_DEPEND] 
    [RDEPEND RDEPEND] 
    [DEPEND DEPEND] 
    [BDEPEND BDEPEND] 
    [PDEPEND PDEPEND] 
    [body body] 
    [body-unroller body-unroller]]) 
  (is-a?/c ebuild%)
  year : integer? = (date-year (current-date))
  EAPI : integer? = 7
  custom : any/c = #f
  custom-unroller : (or/c #f procedure?) = #f
  inherits : (listof string?) = '()
  DESCRIPTION : string? = "package"
  HOMEPAGE : string?
   = "https://wiki.gentoo.org/wiki/No_homepage"
  SRC_URI : (or/c #f (listof src-uri?)) = '()
  S : (or/c #f string?) = #f
  LICENSE : string? = "all-rights-reserved"
  SLOT : string? = "0"
  KEYWORDS : (listof string?) = '("~amd64")
  IUSE : (listof string?) = '()
  REQUIRED_USE : (listof pair?) = '()
  RESTRICT : (listof string?) = '()
  COMMON_DEPEND : (listof string?) = '()
  RDEPEND : (listof string?) = '()
  DEPEND : (listof string?) = '()
  BDEPEND : (listof string?) = '()
  PDEPEND : (listof string?) = '()
  body : any/c = #f
  body-unroller : (or/c #f procedure?) = #f

method

(send an-ebuild create-list)  list?

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

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?
  pth : path-string? = (current-directory)
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.

Example:

(define my-ebuild
  (new ebuild%))

2.2 Metadata Class

 (require ebuild/metadata) package: ebuild

class

metadata% : class?

  superclass: object%

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

constructor

(new metadata% 
    [[maintainers maintainers] 
    [longdescriptions longdescriptions] 
    [slots slots] 
    [stabilize-allarches stabilize-allarches] 
    [uses uses] 
    [upstream upstream]]) 
  (is-a?/c metadata%)
  maintainers : (or/c #f (listof maintainer?)) = #f
  longdescriptions : (or/c #f (listof longdescription?)) = #f
  slots : (or/c #f (listof slots?)) = #f
  stabilize-allarches : boolean? = #f
  uses : (or/c #f (listof use?)) = #f
  upstream : (or/c #f upstream?) = #f

method

(send a-metadata create)  document?

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

method

(send a-metadata save [pth])  void

  pth : path-string? = (current-directory)
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.

Example: Simple metadata object defining maintainer and upstream.

(define my-metadata
  (new metadata%
       [maintainers  (list (maintainer 'person #f "me@me.com" "Me" #f))]
       [upstream  (upstream
                   '() #f #f #f
                   (list (remote-id 'gitlab "me/myproject")))]))

2.3 Package Class

 (require ebuild/package) package: ebuild

class

package% : class?

  superclass: object%

Package class.
For creating packages.

constructor

(new package%    
    [[CATEGORY CATEGORY]    
    [PN PN]    
    [ebuilds ebuilds]    
    [metadata metadata]])  (is-a?/c package%)
  CATEGORY : string? = "app-misc"
  PN : string? = "unknown"
  ebuilds : (hash/c package-version? (is-a?/c ebuild%))
   = (hash (live-version) (new ebuild%))
  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-versions extracted from ebuilds.

method

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

Return a list of package-versions as strings extracted from ebuilds.

method

(send a-package CATEGORY/PN)  string?

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

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

"app-misc/unknown"

method

(send a-package show)  void

Display ebuilds and metadata.

method

(send a-package save [pth])  void

  pth : path-string? = (current-directory)
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.4 Repository Class

 (require ebuild/repository) package: ebuild

class

repository% : class?

  superclass: object%

Repository class.
For creating ebuild repository structures.

constructor

(new repository%    
    [name name]    
    [[layout layout]]    
    [packages packages])  (is-a?/c repository%)
  name : string?
  layout : layout? = (default-layout)
  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

  pth : path-string? = (current-directory)
Creates directory "metadata" with a file "layout.conf" in the given location (or current directory).

method

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

  pth : path-string? = (current-directory)
Creates directory "profiles" with a file "repo_name" in the given location (or current directory).

method

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

  pth : path-string? = (current-directory)
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

  pth : path-string? = (current-directory)
Creates a full ebuild repository directory structure. (uses save-layout, save-name and save-packages).

Example:

(define r
  (new repository%
       [name "test"]
       [packages (list
                  (new package%
                       [CATEGORY "sys-devel"]
                       [PN "asd"]
                       [ebuilds
                        (hash
                         (live-version)  (new ebuild%)
                         (package-version "1.1.1" #f #f #f #f #f)  (new ebuild%))]
 
                       [metadata
                        (new metadata%
                             [upstream (upstream
                                        '() #f #f #f
                                        (list (remote-id 'gitlab "asd/asd")))])]))]))