mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
change arch specific section naming from section_arch to section:arch
Some archs can have _ in their name. Also in future we can use sections with similar names
This commit is contained in:
parent
17b5cd0751
commit
d449eb3c2e
@ -1,6 +1,6 @@
|
|||||||
# ahriman configuration
|
# ahriman configuration
|
||||||
|
|
||||||
Some groups can be specified for each architecture separately. E.g. if there are `build` and `build_x86_64` groups it will use the option from `build_x86_64` for the `x86_64` architecture and `build` for any other (architecture specific group has higher priority). In case if both groups are presented, architecture specific options will be merged into global ones overriding them.
|
Some groups can be specified for each architecture separately. E.g. if there are `build` and `build:x86_64` groups it will use the option from `build:x86_64` for the `x86_64` architecture and `build` for any other (architecture specific group has higher priority). In case if both groups are presented, architecture specific options will be merged into global ones overriding them.
|
||||||
|
|
||||||
## `settings` group
|
## `settings` group
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ libalpm and AUR related configuration.
|
|||||||
* `repositories` - list of pacman repositories, space separated list of strings, required.
|
* `repositories` - list of pacman repositories, space separated list of strings, required.
|
||||||
* `root` - root for alpm library, string, required.
|
* `root` - root for alpm library, string, required.
|
||||||
|
|
||||||
## `build_*` groups
|
## `build:*` groups
|
||||||
|
|
||||||
Build related configuration. Group name must refer to architecture, e.g. it should be `build_x86_64` for x86_64 architecture.
|
Build related configuration. Group name must refer to architecture, e.g. it should be `build:x86_64` for x86_64 architecture.
|
||||||
|
|
||||||
* `archbuild_flags` - additional flags passed to `archbuild` command, space separated list of strings, optional.
|
* `archbuild_flags` - additional flags passed to `archbuild` command, space separated list of strings, optional.
|
||||||
* `build_command` - default build command, string, required.
|
* `build_command` - default build command, string, required.
|
||||||
@ -35,9 +35,9 @@ Base repository settings.
|
|||||||
* `name` - repository name, string, required.
|
* `name` - repository name, string, required.
|
||||||
* `root` - root path for application, string, required.
|
* `root` - root path for application, string, required.
|
||||||
|
|
||||||
## `sign_*` groups
|
## `sign:*` groups
|
||||||
|
|
||||||
Settings for signing packages or repository. Group name must refer to architecture, e.g. it should be `sign_x86_64` for x86_64 architecture.
|
Settings for signing packages or repository. Group name must refer to architecture, e.g. it should be `sign:x86_64` for x86_64 architecture.
|
||||||
|
|
||||||
* `target` - configuration flag to enable signing, space separated list of strings, required. Allowed values are `package` (sign each package separately), `repository` (sign repository database file).
|
* `target` - configuration flag to enable signing, space separated list of strings, required. Allowed values are `package` (sign each package separately), `repository` (sign repository database file).
|
||||||
* `key` - default PGP key, string, required. This key will also be used for database signing if enabled.
|
* `key` - default PGP key, string, required. This key will also be used for database signing if enabled.
|
||||||
@ -49,9 +49,9 @@ Report generation settings.
|
|||||||
|
|
||||||
* `target` - list of reports to be generated, space separated list of strings, optional. Allowed values are `html`.
|
* `target` - list of reports to be generated, space separated list of strings, optional. Allowed values are `html`.
|
||||||
|
|
||||||
### `html_*` groups
|
### `html:*` groups
|
||||||
|
|
||||||
Group name must refer to architecture, e.g. it should be `html_x86_64` for x86_64 architecture.
|
Group name must refer to architecture, e.g. it should be `html:x86_64` for x86_64 architecture.
|
||||||
|
|
||||||
* `path` - path to html report file, string, required.
|
* `path` - path to html report file, string, required.
|
||||||
* `homepage` - link to homepage, string, optional.
|
* `homepage` - link to homepage, string, optional.
|
||||||
@ -64,23 +64,23 @@ Remote synchronization settings.
|
|||||||
|
|
||||||
* `target` - list of synchronizations to be used, space separated list of strings, optional. Allowed values are `rsync`, `s3`.
|
* `target` - list of synchronizations to be used, space separated list of strings, optional. Allowed values are `rsync`, `s3`.
|
||||||
|
|
||||||
### `rsync_*` groups
|
### `rsync:*` groups
|
||||||
|
|
||||||
Group name must refer to architecture, e.g. it should be `rsync_x86_64` for x86_64 architecture. Requires `rsync` package to be installed. Do not forget to configure ssh for user `ahriman`.
|
Group name must refer to architecture, e.g. it should be `rsync:x86_64` for x86_64 architecture. Requires `rsync` package to be installed. Do not forget to configure ssh for user `ahriman`.
|
||||||
|
|
||||||
* `command` - rsync command to run, space separated list of string, required.
|
* `command` - rsync command to run, space separated list of string, required.
|
||||||
* `remote` - remote server to rsync (e.g. `1.2.3.4:5678:path/to/sync`), string, required.
|
* `remote` - remote server to rsync (e.g. `1.2.3.4:5678:path/to/sync`), string, required.
|
||||||
|
|
||||||
### `s3_*` groups
|
### `s3:*` groups
|
||||||
|
|
||||||
Group name must refer to architecture, e.g. it should be `s3_x86_64` for x86_64 architecture. Requires `aws-cli` package to be installed. Do not forget to configure it for user `ahriman`.
|
Group name must refer to architecture, e.g. it should be `s3:x86_64` for x86_64 architecture. Requires `aws-cli` package to be installed. Do not forget to configure it for user `ahriman`.
|
||||||
|
|
||||||
* `command` - s3 command to run, space separated list of string, required.
|
* `command` - s3 command to run, space separated list of string, required.
|
||||||
* `bucket` - bucket name (e.g. `s3://bucket/path`), string, required.
|
* `bucket` - bucket name (e.g. `s3://bucket/path`), string, required.
|
||||||
|
|
||||||
## `web_*` groups
|
## `web:*` groups
|
||||||
|
|
||||||
Web server settings. If any of `host`/`port` is not set, web integration will be disabled. Group name must refer to architecture, e.g. it should be `web_x86_64` for x86_64 architecture.
|
Web server settings. If any of `host`/`port` is not set, web integration will be disabled. Group name must refer to architecture, e.g. it should be `web:x86_64` for x86_64 architecture.
|
||||||
|
|
||||||
* `host` - host to bind, string, optional.
|
* `host` - host to bind, string, optional.
|
||||||
* `port` - port to bind, int, optional.
|
* `port` - port to bind, int, optional.
|
||||||
|
@ -84,7 +84,7 @@ class Configuration(configparser.RawConfigParser):
|
|||||||
:param architecture: repository architecture
|
:param architecture: repository architecture
|
||||||
:return: correct section name for repository specific section
|
:return: correct section name for repository specific section
|
||||||
"""
|
"""
|
||||||
return f"{section}_{architecture}"
|
return f"{section}:{architecture}"
|
||||||
|
|
||||||
def dump(self) -> Dict[str, Dict[str, str]]:
|
def dump(self) -> Dict[str, Dict[str, str]]:
|
||||||
"""
|
"""
|
||||||
@ -183,6 +183,6 @@ class Configuration(configparser.RawConfigParser):
|
|||||||
# remove any arch specific section
|
# remove any arch specific section
|
||||||
for foreign in self.sections():
|
for foreign in self.sections():
|
||||||
# we would like to use lambda filter here, but pylint is too dumb
|
# we would like to use lambda filter here, but pylint is too dumb
|
||||||
if not foreign.startswith(f"{section}_"):
|
if not foreign.startswith(f"{section}:"):
|
||||||
continue
|
continue
|
||||||
self.remove_section(foreign)
|
self.remove_section(foreign)
|
||||||
|
@ -25,7 +25,7 @@ def test_section_name(configuration: Configuration) -> None:
|
|||||||
"""
|
"""
|
||||||
must return architecture specific group
|
must return architecture specific group
|
||||||
"""
|
"""
|
||||||
assert configuration.section_name("build", "x86_64") == "build_x86_64"
|
assert configuration.section_name("build", "x86_64") == "build:x86_64"
|
||||||
|
|
||||||
|
|
||||||
def test_absolute_path_for_absolute(configuration: Configuration) -> None:
|
def test_absolute_path_for_absolute(configuration: Configuration) -> None:
|
||||||
@ -60,14 +60,15 @@ def test_dump_architecture_specific(configuration: Configuration) -> None:
|
|||||||
"""
|
"""
|
||||||
dump must contain architecture specific settings
|
dump must contain architecture specific settings
|
||||||
"""
|
"""
|
||||||
configuration.add_section("build_x86_64")
|
section = configuration.section_name("build", "x86_64")
|
||||||
configuration.set("build_x86_64", "archbuild_flags", "hello flag")
|
configuration.add_section(section)
|
||||||
|
configuration.set(section, "archbuild_flags", "hello flag")
|
||||||
configuration.merge_sections("x86_64")
|
configuration.merge_sections("x86_64")
|
||||||
|
|
||||||
dump = configuration.dump()
|
dump = configuration.dump()
|
||||||
assert dump
|
assert dump
|
||||||
assert "build" in dump
|
assert "build" in dump
|
||||||
assert "build_x86_64" not in dump
|
assert section not in dump
|
||||||
assert dump["build"]["archbuild_flags"] == "hello flag"
|
assert dump["build"]["archbuild_flags"] == "hello flag"
|
||||||
|
|
||||||
|
|
||||||
@ -125,9 +126,10 @@ def test_merge_sections_missing(configuration: Configuration) -> None:
|
|||||||
"""
|
"""
|
||||||
must merge create section if not exists
|
must merge create section if not exists
|
||||||
"""
|
"""
|
||||||
|
section = configuration.section_name("build", "x86_64")
|
||||||
configuration.remove_section("build")
|
configuration.remove_section("build")
|
||||||
configuration.add_section("build_x86_64")
|
configuration.add_section(section)
|
||||||
configuration.set("build_x86_64", "key", "value")
|
configuration.set(section, "key", "value")
|
||||||
|
|
||||||
configuration.merge_sections("x86_64")
|
configuration.merge_sections("x86_64")
|
||||||
assert configuration.get("build", "key") == "value"
|
assert configuration.get("build", "key") == "value"
|
||||||
|
Loading…
Reference in New Issue
Block a user