Andaman: Difference between revisions

From Fyra Wiki
Jump to navigation Jump to search
(init)
 
(→‎Configuration: add section; →‎History: add more info related to rewrites)
Line 1: Line 1:
[[Category:Fyra Labs]]
[[Category:Fyra Labs]]
'''Andaman''', often abbreviated as '''anda''', is a modern packaged build toolchain designed to
[[Category:Projects]]
'''Andaman''', often abbreviated as '''anda''', is a modern package build toolchain designed to
simplify building different package formats for different projects in the same repository.
simplify building different package formats for different projects in the same repository.
It mainly supports monorepo setups, especially ones with CI support like GitHub. It currently supports building RPMs, OCI images and Flatpak packages.
It mainly supports monorepo setups, especially ones with CI support like GitHub. It currently supports building RPMs, OCI images and Flatpak packages.
It is written by [[Fyra Labs]] with the Rust programming language.
It is written by [[Fyra Labs]] with the Rust programming language.
Anda's simplicity makes the packaging process seamless and it is most notably used in [[Terra]].


== Mechanisms ==
== Mechanisms ==
Line 14: Line 17:


=== Automatic Updates ===
=== Automatic Updates ===
: See also: [https://developer.fyralabs.com/terra/autoupdate Fyra Developer: Terra autoupdate] for the supported functions in AndaX
Anda has refined support over automatically updating packages via the <code>anda update</code> command. The command finds all the projects with the file <code>update.rhai</code> in the same directory or if the configuration file has the <code>update</code> property set to a value:
Anda has refined support over automatically updating packages via the <code>anda update</code> command. The command finds all the projects with the file <code>update.rhai</code> in the same directory or if the configuration file has the <code>update</code> property set to a value:
<syntaxhighlight lang="hcl">
<syntaxhighlight lang="js">
project proj_name {
project project_name {
   update = "path/to/update_script.rhai"
   update = "path/to/update_script.rhai"
   labels {
   labels {
Line 24: Line 28:
</syntaxhighlight>
</syntaxhighlight>
Then, AndaX executes the script. Projects can also be filtered by adding <code>--filters key=value,key2=value2</code> to the command.
Then, AndaX executes the script. Projects can also be filtered by adding <code>--filters key=value,key2=value2</code> to the command.
For example, the above project will be ran for <code>--filters a=1</code> or even without filters regarding the key <code>a</code>, but
For example, the update script for the above project will be executed for <code>--filters a=1</code> or even without filters related to <code>a</code>, but
it will be filtered for <code>--filters a=2</code>.
it won't be executed for <code>--filters a=2</code>.
 
== Configuration ==
Consider the following. for <code>{ }</code> and <code>""</code>, they represent, respectively, an dictionary (empty by default) with keys and string values, and a string with no default value. Unless otherwise stated, all the attributes are optional.
<syntaxhighlight lang="js">
config {
  mock_config = "" // default mock config for `anda build -c custom_mock_config`
  strip_prefix = "" // strip prefix to form new project alias
  strip_suffix = "" // strip suffix to form new project alias
  project_regex = ""
}
project "project_name" { // the string quote is optional
  rpm {
    spec = "path/to/file.spec" // REQUIRED
    sources = "."
    package = ""
    pre_script = "rpm_pre.rhai"
    post_script = "rpm_post.rhai"
    mock_config = ""
    enable_scm = false
    scm_opts { }
    config { }
    plugin_opts { }
    macros { }
    opts { }
  }
  podman tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  docker tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  flatpak {
    manifest = "path/to/manifest.yml" // REQUIRED
    pre_script = ""
    post_script = ""
  }
  pre_script = "pre.rhai"
  post_script = "post.rhai"
  env { }
  alias = [] // array of strings
  scripts = [] // array of paths to AndaX scripts
  labels { }
  update = "update.rhai"
  arches = ["x86_64", "aarch64"]
}
</syntaxhighlight>


== History ==
== History ==
<!-- creation? copy [[ultramarine linux]] -->
=== umpkg ===
The name Andaman refers to the [[wikipedia:Andaman Sea|Andaman Sea]] next to Thailand, and follows the [[Ultramarine Linux|Ultramarine]] marine naming usage.
In the very beginning, the [[Ultramarine]] Project had been using Koji for building RPM packages. Koji is the packaging system used by the [[wikipedia:Fedora Project|Fedora Project]]. However, Koji's sophistication makes it difficult to create and maintain RPM packages — it was said that the only person in the Ultramarine team who actually knew how to use Koji was the lead developer, [[Cappy Ishihara]]. Cappy was annoyed by the sheer complexity of building and uploading packages to Koji and made [[umpkg]], a packaging toolchain that runs on Mock and Koji. The creation of umpkg made it easier to create and maintain packages. However, umpkg still tightly integrates with Koji and uses the Koji API to trigger builds. Thus, an entirely new CI server was proposed.
 
=== RPM Frontend ===
The Ultramarine Project started work on Andaman on 9 Jun, 2022.
The name Andaman refers to the [[wikipedia:Andaman Sea|Andaman Sea]] next to Thailand, and follows the naming patterns for other projects related to Ultramarine.
Initially, Anda was written as a custom RPM frontend as an alternative to DNF that is similar to that of an AUR helper. However, there were issues with rust and RPM support.
 
=== CI Server ===
Anda was then rewritten as a CI Server that handles builds via BuildKit, stores artifacts and build infos, and later included a frontend to the server.
However, it slowly turned into a massive feature creep of projects.
 
=== Final rewrite ===
Thus, Anda was rewritten again and it finally became a build system for various package formats.

Revision as of 09:16, 10 June 2023

Andaman, often abbreviated as anda, is a modern package build toolchain designed to simplify building different package formats for different projects in the same repository. It mainly supports monorepo setups, especially ones with CI support like GitHub. It currently supports building RPMs, OCI images and Flatpak packages. It is written by Fyra Labs with the Rust programming language.

Anda's simplicity makes the packaging process seamless and it is most notably used in Terra.

Mechanisms

Currently, Anda is simply a meta-build system that calls upon other build systems to build and distribute packages. It reads the project manifest in anda.hcl and calls the corresponding build system to build the package. Multiple projects can be included in a single repository (known as a monorepo) recursively in different directories. The root directory contains a main configuration file (also anda.hcl) and the configurations will be inherited. All the other anda.hcl files in its subdirectory can independently represent multiple projects, and multiple ways to build a package can be specified in each project. Once properly configured, a project can be built by anda build subdirectory_path/project_name.

AndaX

AndaX is an embedded scripting system powered by Rhai. It is mainly for supporting automatic updates, but it is also the scripting system used behind pre_script and post_script.

Automatic Updates

See also: Fyra Developer: Terra autoupdate for the supported functions in AndaX

Anda has refined support over automatically updating packages via the anda update command. The command finds all the projects with the file update.rhai in the same directory or if the configuration file has the update property set to a value:

project project_name {
  update = "path/to/update_script.rhai"
  labels {
    a = "1"
  }
}

Then, AndaX executes the script. Projects can also be filtered by adding --filters key=value,key2=value2 to the command. For example, the update script for the above project will be executed for --filters a=1 or even without filters related to a, but it won't be executed for --filters a=2.

Configuration

Consider the following. for { } and "", they represent, respectively, an dictionary (empty by default) with keys and string values, and a string with no default value. Unless otherwise stated, all the attributes are optional.

config {
  mock_config = "" // default mock config for `anda build -c custom_mock_config`
  strip_prefix = "" // strip prefix to form new project alias
  strip_suffix = "" // strip suffix to form new project alias
  project_regex = ""
}
project "project_name" { // the string quote is optional
  rpm {
    spec = "path/to/file.spec" // REQUIRED
    sources = "."
    package = ""
    pre_script = "rpm_pre.rhai"
    post_script = "rpm_post.rhai"
    mock_config = ""
    enable_scm = false
    scm_opts { }
    config { }
    plugin_opts { }
    macros { }
    opts { }
  }
  podman tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  docker tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  flatpak {
    manifest = "path/to/manifest.yml" // REQUIRED
    pre_script = ""
    post_script = ""
  }
  pre_script = "pre.rhai"
  post_script = "post.rhai"
  env { }
  alias = [] // array of strings
  scripts = [] // array of paths to AndaX scripts
  labels { }
  update = "update.rhai"
  arches = ["x86_64", "aarch64"]
}

History

umpkg

In the very beginning, the Ultramarine Project had been using Koji for building RPM packages. Koji is the packaging system used by the Fedora Project. However, Koji's sophistication makes it difficult to create and maintain RPM packages — it was said that the only person in the Ultramarine team who actually knew how to use Koji was the lead developer, Cappy Ishihara. Cappy was annoyed by the sheer complexity of building and uploading packages to Koji and made umpkg, a packaging toolchain that runs on Mock and Koji. The creation of umpkg made it easier to create and maintain packages. However, umpkg still tightly integrates with Koji and uses the Koji API to trigger builds. Thus, an entirely new CI server was proposed.

RPM Frontend

The Ultramarine Project started work on Andaman on 9 Jun, 2022. The name Andaman refers to the Andaman Sea next to Thailand, and follows the naming patterns for other projects related to Ultramarine. Initially, Anda was written as a custom RPM frontend as an alternative to DNF that is similar to that of an AUR helper. However, there were issues with rust and RPM support.

CI Server

Anda was then rewritten as a CI Server that handles builds via BuildKit, stores artifacts and build infos, and later included a frontend to the server. However, it slowly turned into a massive feature creep of projects.

Final rewrite

Thus, Anda was rewritten again and it finally became a build system for various package formats.