On this page:
4.1 Git  Host
githost
url->githost
string->githost
githost->string
githost->url
4.2 SRC_  URI Transformers
url->src-uri
4.3 CFlag Transformers
string->cflag
4.4 Metadata Transformers
4.4.1 longdescription transformation
xexpr->longdescriptions
4.4.2 maintainer transformation
xexpr->maintainers
4.4.3 slots transformation
xexpr->slots
4.4.4 stabilize-allarches transformation
xexpr->stabilize-allarches
4.4.5 upstream transformation
xexpr->upstream
4.4.6 use transformation
xexpr->uses
4.4.7 metadata transformation
xexpr->metadata
read-metadata
read-metadata-file
4.5 Un  Cache
uncache
uncache-file
8.12

4 Ebuild Transformers🔗ℹ

4.1 GitHost🔗ℹ

 (require ebuild/transformers/githost)
  package: ebuild-transformers

struct

(struct githost (domain repository)
    #:extra-constructor-name make-githost)
  domain : string?
  repository : string?

Example:
> (githost "gitlab.com" "asd/asd")

(githost "gitlab.com" "asd/asd")

procedure

(url->githost ur)  githost?

  ur : url?
Converts a ur url to githost.

Example:
> (url->githost (string->url "https://gitlab.com/asd/asd"))

(githost "gitlab.com" "asd/asd")

procedure

(string->githost str)  githost?

  str : string?
Converts a str string to githost.

Example:
> (string->githost "https://gitlab.com/asd/asd.git")

(githost "gitlab.com" "asd/asd")

procedure

(githost->string gh)  string?

  gh : githost?
Converts a gh githost to string.

Example:
> (githost->string (githost "gitlab.com" "asd/asd"))

"https://gitlab.com/asd/asd"

procedure

(githost->url gh)  url?

  gh : githost?
Converts a gh githost to url.

Example:
> (githost->url (githost "gitlab.com" "asd/asd"))

(url

 "https"

 #f

 "gitlab.com"

 #f

 #t

 (list (path/param "asd" '()) (path/param "asd" '()))

 '()

 #f)

4.2 SRC_URI Transformers🔗ℹ

 (require ebuild/transformers/src-uri)
  package: ebuild-transformers

procedure

(url->src-uri ur pn)  src-uri

  ur : path-string?
  pn : string?
Converts a URL ur path-string to a src-uri struct.

If pn is supplied also a PN (package name) detection is carried out.

Examples:
> (define racket-url "https://mirror.racket-lang.org/installers/8.1/racket-8.1-src-builtpkgs.tgz")
> (define racket-src-uri (url->src-uri racket-url "racket"))
> racket-src-uri

(src-uri

 #f

 "https://mirror.${PN}-lang.org/installers/8.1/${PN}-8.1-src-builtpkgs.tgz"

 #f)

> (src-uri->string racket-src-uri)

"https://mirror.${PN}-lang.org/installers/8.1/${PN}-8.1-src-builtpkgs.tgz"

4.3 CFlag Transformers🔗ℹ

 (require ebuild/transformers/cflag)
  package: ebuild-transformers

procedure

(string->cflag str)  (listof (or/c cflag? string?))

  str : string?
Converts a string back to cflags.

Example:
> (string->cflag "X? ( x11-libs/libX11 ) qt5? ( dev-qt/qtsvg dev-qt/qtwidgets )")

(list

 (cflag "X?" '("x11-libs/libX11"))

 (cflag "qt5?" '("dev-qt/qtsvg" "dev-qt/qtwidgets")))

4.4 Metadata Transformers🔗ℹ

 (require ebuild/transformers/metadata)
  package: ebuild-transformers

4.4.1 longdescription transformation🔗ℹ

procedure

(xexpr->longdescriptions xexpr)  (listof longdescription?)

  xexpr : xexpr?
Converts a xexpr to list of longdescriptions.

Example:
> (xexpr->longdescriptions
   '(pkgmetadata (longdescription ((lang "en")) "Description")
                 (longdescription ((lang "pl")) "Opis")))

(list (longdescription "en" "Description") (longdescription "pl" "Opis"))

4.4.2 maintainer transformation🔗ℹ

procedure

(xexpr->maintainers xexpr)  (listof maintainer?)

  xexpr : xexpr?
Converts a xexpr to list of maintainers.

Example:
> (xexpr->maintainers
   '(pkgmetadata (maintainer ((type "person"))
                             (email "asd@asd.asd") (name "A.S.D."))))

(list (maintainer 'person #f "asd@asd.asd" "A.S.D." #f))

4.4.3 slots transformation🔗ℹ

procedure

(xexpr->slots xexpr)  (listof slots?)

  xexpr : xexpr?
Converts a xexpr to list of slots.

Example:
> (xexpr->slots '(pkgmetadata (slots (slot ((name "1.9"))
                                           "Provides libmypkg19.so.0"))))

(list (slots #f (list (slot "1.9" "Provides libmypkg19.so.0")) #f))

4.4.4 stabilize-allarches transformation🔗ℹ

procedure

(xexpr->stabilize-allarches xexpr)  boolean?

  xexpr : xexpr?
Converts a xexpr to boolean.

Example:
> (xexpr->stabilize-allarches '(pkgmetadata (stabilize-allarches ())))

#t

4.4.5 upstream transformation🔗ℹ

procedure

(xexpr->upstream xexpr)  upstream?

  xexpr : xexpr?
Converts a xexpr to upstream.

Example:
> (xexpr->upstream '(pkgmetadata (upstream
                                  (remote-id ((type "gitlab")) "asd/asd")
                                  (remote-id ((type "github")) "asd-org/asd"))))

(upstream

 '()

 #f

 #f

 #f

 (list (remote-id 'gitlab "asd/asd") (remote-id 'github "asd-org/asd")))

4.4.6 use transformation🔗ℹ

procedure

(xexpr->uses xexpr)  (listof use?)

  xexpr : xexpr?
Converts a xexpr to list of uses.

Example:
> (xexpr->uses '(pkgmetadata (use (flag ((name "racket"))
                                        "Build using dev-scheme/racket"))))

(list (use #f (list (uflag "racket" "Build using dev-scheme/racket"))))

4.4.7 metadata transformation🔗ℹ

procedure

(xexpr->metadata xexpr)  metadata%

  xexpr : xexpr?
Converts a xexpr to metadata% object.

Example:
> (xexpr->metadata '(pkgmetadata))

(document

 (prolog

  '(#(struct:p-i

      #(struct:location 0 0 0)

      #(struct:location 0 0 0)

      xml

      "version=\"1.0\" encoding=\"UTF-8\""))

  (document-type

   'pkgmetadata

   (external-dtd/system "https://www.gentoo.org/dtd/metadata.dtd")

   #f)

  '())

 (element 'racket 'racket 'pkgmetadata '() '())

 '())

procedure

(read-metadata [port])  metadata%

  port : input-port? = current-input-port
Converts input from port to metadata% object.

Examples:
> {define str "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE pkgmetadata SYSTEM \"https://www.gentoo.org/dtd/metadata.dtd\">\n<pkgmetadata>\n</pkgmetadata>"}
> (display (read-metadata (open-input-string str)))

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

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

<pkgmetadata>

</pkgmetadata>

procedure

(read-metadata-file pth)  metadata%

  pth : path-string?
Converts contents of file from pth to metadata% object.

4.5 UnCache🔗ℹ

 (require ebuild/transformers/uncache)
  package: ebuild-transformers

procedure

(uncache port)  ebuild%

  port : input-port?
Consumes port and attempts to convert it to a ebuild% (racket object).

Certain to be missed are any additional shell script functions because cached ebuild files contain only special ebuild variables.

procedure

(uncache-file pth)  ebuild%

  pth : path-string?
Attempts to convert a cached ebuild file at pth to a ebuild% (racket object).