Skip to content

Commit 6a36f4b

Browse files
committed
feat(packaging): add specifications for Repository Metadata and Configuration Templates
1 parent 2f0a70e commit 6a36f4b

File tree

2 files changed

+227
-0
lines changed

2 files changed

+227
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
+++
2+
title = "Repository Metadata and Configuration Templates"
3+
+++
4+
5+
This specification defines the structure and content of repository (and mirror) metadata and configuration templates used by AOSC OS installations.
6+
7+
Structure and Functions
8+
===
9+
10+
- `/usr/share/repository-data/` - system configuration prefix, configuration files found in this directory should be shipped with packages
11+
- `mirror.toml` - repository metadata
12+
- `comps.toml` - component (package collection) metadata
13+
- `/etc/repository-data/ - user configuration prefix, configuration files found in this directory are user-defined
14+
- A copy of `mirror.toml` and `comps.toml` may be placed here and is used to supplement their counterparts in `/usr/share/repository-data/`
15+
- IDs found in these configurations must be unique to those in `/usr/share/repository-data/`
16+
17+
Main Configuration Files
18+
===
19+
20+
`/usr/share/repository-data/mirror.toml`:
21+
22+
```toml
23+
[origin]
24+
description.default = "AOSC main repository (auto-redirect)"
25+
description.zh_CN = "安同开源社区官方源(自动重定向)"
26+
url = "https://repo.aosc.io/anthon/"
27+
```
28+
29+
`/usr/share/repository-data/comps.toml`:
30+
31+
```toml
32+
[main]
33+
description.default = "The main collection of packages"
34+
description.zh_CN = "主软件集"
35+
36+
[bsp-loongarch64-nosimd]
37+
description.default = "Packages for LoongArch64 BSP for no-SIMD platforms"
38+
description.zh_CN = "用于无 SIMD 的龙架构(64 位)平台的软件包"
39+
```
40+
41+
Repository Configuration Template
42+
===
43+
44+
`/usr/share/repository-data/template.toml` instructs package management frontends (such as oma) on how to make use of the above information to generate repository configurations, sections defined in this template should be written in-order to the target configuration file:
45+
46+
```toml
47+
[[config]]
48+
# For options with multiple values.
49+
#
50+
# - sources.list: comma-separated (",")
51+
# - DEB-822: whitespace-separated
52+
#
53+
# List of components (package collections)
54+
#
55+
# Written as an array and converted to string, space in sources.list or
56+
# whitespace-separated in DEB-822 configurations
57+
components = ["main"]
58+
#
59+
# Signature configuration, APT generally requires repository to be GPG-signed
60+
#
61+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
62+
#
63+
# Whether to check for repository signature
64+
#
65+
# Corresponds to "[trusted=yes]" in sources.list or "Trusted: yes" in DEB-822
66+
#
67+
# Defaults to false if not specified
68+
always-trusted = <true|false>
69+
#
70+
# Architecture configuration - to define the range of architectures supported
71+
# by a specific repository
72+
#
73+
# Defaults to `dpkg --print-architecture` + all (noarch) if not specified
74+
#
75+
# For packages of multiple architectures
76+
architectures = ["amd64","arm64"]
77+
# For all architecture-agnostic packages
78+
architectures = ["all"]
79+
# For all architecture-specific packages
80+
architectures = ["any"]
81+
# Equivalent of default
82+
architectures = ["all","any"]
83+
#
84+
# Whether to enable the repository
85+
#
86+
# Corresponds to commented/not-commented in sources.list or "Enabled: yes/no" in DEB-822
87+
#
88+
# Defaults to true if not specified
89+
enabled = <true|false>
90+
```
91+
92+
Example: Mainline Distribution
93+
---
94+
95+
```toml
96+
[[config]]
97+
components = ["main"]
98+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
99+
```
100+
101+
Example: loongarch64-nosimd
102+
---
103+
104+
```toml
105+
[[config]]
106+
components = ["bsp-loongarch64-nosimd"]
107+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
108+
architectures = ["loongarch64"]
109+
110+
[[config]]
111+
components = ["main"]
112+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
113+
architectures = ["all"]
114+
```
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
+++
2+
title = "安同 OS 软件源元数据及源配置模板规范"
3+
+++
4+
5+
本规范定义安同 OS 所使用的软件源(镜像源)元数据及软件源配置模板的结构及内容规范。
6+
7+
功能结构
8+
===
9+
10+
- `/usr/share/repository-data/`:系统配置目录,本目录中的配置文件由软件包提供
11+
- `mirror.toml`:镜像源配置
12+
- `comps.toml`:组件(软件集)配置
13+
- `template.toml`:软件源配置文件模板
14+
- `/etc/repository-data/`:用户配置目录,本目录中的配置文件可供用户编写和修改
15+
- 同样地放置 `mirror.toml``comps.toml`,用于补充 `/usr/share/repository-data` 下的对应配置
16+
- 此处配置文件中定义的镜像源 ID 不得与 `/usr/share/repository-data` 中所定义的冲突
17+
18+
主配置格式
19+
===
20+
21+
`/usr/share/repository-data/mirror.toml`:
22+
23+
```toml
24+
[origin]
25+
description.default = "AOSC main repository (auto-redirect)"
26+
description.zh_CN = "安同开源社区官方源(自动重定向)"
27+
url = "https://repo.aosc.io/anthon/"
28+
```
29+
30+
`/usr/share/repository-data/comps.toml`:
31+
32+
```toml
33+
[main]
34+
description.default = "The main collection of packages"
35+
description.zh_CN = "主软件集"
36+
37+
[bsp-loongarch64-nosimd]
38+
description.default = "Packages for LoongArch64 BSP for no-SIMD platforms"
39+
description.zh_CN = "用于无 SIMD 的龙架构(64 位)平台的软件包"
40+
```
41+
42+
模板配置格式
43+
===
44+
45+
`/usr/share/repository-data/template.toml` 用于定义包管理前端(如 oma)填入上述信息的方式,配置中段落顺序按从上到下顺序写入对应的源配置中:
46+
47+
```toml
48+
[[config]]
49+
# 对于有多个值的选项:
50+
#
51+
# - sources.list 中使用 "," 分隔
52+
# - DEB-822 中使用空白分隔
53+
#
54+
# 对应的组件(软件集)列表
55+
#
56+
# 数组展开为字符串,sources.list 中使用空格分隔、DEB-822 中使用空白分隔
57+
components = ["main"]
58+
#
59+
# 签名配置,APT 一般要求软件源具有 GPG 签名
60+
#
61+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
62+
#
63+
# 不检查签名,布尔值
64+
#
65+
# 对应 sources.list 下的 "[trusted=yes]" 或 DEB-822 下的 "Trusted: yes"
66+
#
67+
# 如未指定,默认为 false
68+
always-trusted = <true|false>
69+
#
70+
# 架构配置:用于定义某个源对应的架构支持范围
71+
#
72+
# 如未指定,默认为 `dpkg --print-architecture` 输出 + all (noarch)
73+
#
74+
# 多个架构
75+
architectures = ["amd64","arm64"]
76+
# 所有架构无关包
77+
architectures = ["all"]
78+
# 所有架构相关包
79+
architectures = ["any"]
80+
# 不指定该项或根据下例编写则对应所有软件包
81+
architectures = ["all","any"]
82+
#
83+
# 是否启用,布尔值
84+
#
85+
# sources.list 对应注释与否,DEB-822 对应 "Enabled: yes/no"
86+
#
87+
# 如未指定,默认为 true
88+
enabled = <true|false>
89+
```
90+
91+
样例:主线发行
92+
---
93+
94+
```toml
95+
[[config]]
96+
components = ["main"]
97+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
98+
```
99+
100+
样例:loongarch64-nosimd 移植
101+
---
102+
103+
```toml
104+
[[config]]
105+
components = ["bsp-loongarch64-nosimd"]
106+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
107+
architectures = ["loongarch64"]
108+
109+
[[config]]
110+
components = ["main"]
111+
signed-by = ["/usr/share/keyrings/aosc-archive-keyring.gpg"]
112+
architectures = ["all"]
113+
```

0 commit comments

Comments
 (0)