diff --git a/CONTRIBUTING.en.md b/CONTRIBUTING.en.md new file mode 100644 index 0000000000..58477c637f --- /dev/null +++ b/CONTRIBUTING.en.md @@ -0,0 +1,204 @@ +
+ +English | [简体中文](./CONTRIBUTING.md) | [正體中文](./CONTRIBUTING.zh-TW.md) + +
+ +# Contributing + +gentoo-zh is a Gentoo overlay (a third-party ebuild repository) that depends on +`::gentoo` (`masters = gentoo` in `metadata/layout.conf`). + +> [!NOTE] +> Anyone who deliberately bypasses the rules in this file is removed from the +> organization, and all packages they maintain are treecleaned. This applies to +> all maintainers, including owners and members. + +## Packages + +- Ebuilds use `~arch` keywords only. +- Dependencies that `::gentoo` already provides are not duplicated here, and a + package with the same name as one in `::gentoo` is not added unless there is a + specific reason. +- Every package has a `metadata.xml` that names its maintainer. +- `LICENSE` matches the license declared by the packaged software; add licenses + missing from `::gentoo` to `licenses/` and `profiles/license_groups`. +- Unless there is a specific reason, keep the changes to one package in one + commit. +- Register packages in `.github/workflows/overlay.toml`, inserted in + alphabetical order by `category/package`; comment the reason for any that + nvchecker cannot track. +- For packages that can be bumped automatically, see + [scripts/autobump.md](./scripts/autobump.md). +- Test ebuilds before committing. +- For a package you no longer maintain, find a new maintainer in the issues. If + nobody takes it, remove it through + [last rites](https://devmanual.gentoo.org/ebuild-maintenance/removal/): add an + entry at the top of `profiles/package.mask` with your name, email, date (UTC), + reason and removal date, and remove the package after 30 days or more, for + example: + + ``` + # Zakk (2026-11-18) + # Upstream archived. + # Removal on 2026-12-18. + net-proxy/daed + ``` + +References: + +- [Devmanual](https://devmanual.gentoo.org/) +- [GLEP 66](https://www.gentoo.org/glep/glep-0066.html): git workflow and commit messages +- [GLEP 76](https://www.gentoo.org/glep/glep-0076.html): copyright policy and `Signed-off-by` +- [pkgdev](https://pkgcore.github.io/pkgdev/), [pkgcheck](https://pkgcore.github.io/pkgcheck/) + +## Commits + +All changes go through pull requests. Do not push to master or bypass CI. + +Commits follow the +[Gentoo git workflow](https://wiki.gentoo.org/wiki/Gentoo_git_workflow): + +- The first line is the summary line, `category/package: summary`, at most 69 + characters. +- The body is optional; if present, separate it from the summary line with a + blank line. +- Add `Signed-off-by:`; `pkgdev commit --signoff` adds it. +- Version bumps are written as `category/package: add 0.5, drop 0.4`. +- No merge commits in a pull request; sync with master using `git rebase`, not + `git merge`. + +Example: + +``` +app-misc/foo: fix build with GCC 16 + +Add a missing include. + +Signed-off-by: A Developer +``` + +Common commands: + +``` +pkgdev manifest # update the Manifest +pkgcheck scan --net # check the current changes +pkgdev commit --signoff # commit with a generated summary and Signed-off-by +pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." + # custom summary and body +pkgcheck scan --commits --net # check the branch's commits before the pull request +``` + +> [!NOTE] +> `pkgdev commit -b` and `-c` refer to bugs.gentoo.org; do not use them for this +> repository's issues. + +### Pull request descriptions + +Use the pull request template: + +- Write the description above + ``. +- To close an issue of this repository, add `Closes #N` to the description. +- If you changed a package, `eclass/`, `profiles/` or `licenses/`, you must + check the pkgcheck box; if you used AI, you must check the AI box. + +Example: + +``` +Because upstream 1.2.3 fixes a crash on Wayland, add it. + +Closes #12345 + + + +--- + +Please check all the boxes that apply: + +- [x] I have run `pkgcheck scan --commits --net` to check for issues with my commits. +- [x] If I used AI: I understand every change, tested it and take responsibility for it; commits with AI-written changes carry `Assisted-by:`. + +Please note that all boxes must be checked for the pull request to be merged. +``` + +> [!NOTE] +> After opening the pull request, fix the problems reported by pkgcheck and CI, +> including QA warnings. + +## AI policy + +AI may be used, provided that: + +- work done with AI follows [AGENTS.md](./AGENTS.md); +- the contributor understands what the AI writes; +- contributors add `Signed-off-by` themselves; a tool must never add it; +- before adding `Signed-off-by`, the contributor confirms that the AI-written + parts copy no code under an incompatible license; +- AI-written commit messages and pull request descriptions are accurate, + concise and free of repetition, with every claim verified. + +### Disclosure + +A commit containing AI-written changes must carry an `Assisted-by:` trailer in +the [Linux kernel format](https://docs.kernel.org/process/coding-assistants.html), +`Assisted-by: AGENT:MODEL`, above `Signed-off-by:`. Add it with +`pkgdev commit -T`: + +``` +pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." -T Assisted-by:Claude:claude-opus-5-5 +``` + +The resulting commit message: + +``` +app-misc/foo: fix build with GCC 16 + +Add a missing include. + +Assisted-by: Claude:claude-opus-5-5 +Signed-off-by: A Developer +``` + +> [!NOTE] +> Do not add `Co-authored-by:`; CI rejects it. + +Disclosure is not required for: + +- small or mechanical changes; +- using AI only to review the contributor's own change, when the contributor + fixes the issues it finds. + +### Forbidden usage + +- Pull requests, pushes or comments published by a tool before the contributor + has reviewed and approved each one. +- Opening pull requests in bulk from a tool's output without building and + testing each one. +- Hiding or understating the extent of AI involvement. + +This repository's own bots, such as autobump and nvchecker, are not covered by +these rules. + +### Testing + +AI-written changes are subject to the same testing requirements as any other +change, and ebuilds must be smoke-tested. Do not claim to have run a test that +was not run. + +### Enforcement + +If we suspect that AI was used without disclosure, we will ask for an +explanation, and the contributor must answer truthfully. If they refuse, we will +close the pull request or issue. This rule also applies to maintainers. + +Agents can use [gentoo-zh/skills](https://github.com/gentoo-zh/skills) for +packaging, version bumps and reviews. They apply AGENTS.md and add no rules of +their own. Install them with: + +``` +npx skills add gentoo-zh/skills -g +``` + +This section is adapted from +[OpenWrt packages' AI policy](https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md#ai-policy). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 04111a7f20..653788b9ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,16 @@
+[English](./CONTRIBUTING.en.md) | 简体中文 | [正體中文](./CONTRIBUTING.zh-TW.md) +
# 贡献指南 gentoo-zh 是 Gentoo 的 overlay(第三方 ebuild 仓库),依赖 `::gentoo`(`metadata/layout.conf` 中 `masters = gentoo`)。 +> [!NOTE] +> 故意绕过本文规定者将被移出组织,其维护的全部软件包将被 treeclean。此规则适用于全部维护者,包括 owner 和 member。 + ## 软件包 - ebuild 只使用 `~arch` 关键字; @@ -16,7 +21,7 @@ gentoo-zh 是 Gentoo 的 overlay(第三方 ebuild 仓库),依赖 `::gentoo - 软件包须登记到 `.github/workflows/overlay.toml`,依 `category/package` 的字母顺序插入,不适合 nvchecker 的须注释原因; - 可自动更新版本的软件包见 [scripts/autobump.zh.md](./scripts/autobump.zh.md); - ebuild 提交前须进行测试; -- 不再维护的软件包,须在 issue 中寻找接手者。无人接手的且无法通过编译的,依据 [last rites](https://devmanual.gentoo.org/ebuild-maintenance/removal/) 流程移除:在 `profiles/package.mask` 顶部加入条目,写明作者、邮箱、日期(UTC)、原因和移除日期,至少 30 天后移除。范例: +- 不再维护的软件包,须在 issue 中寻找接手者。无人接手的,依据 [last rites](https://devmanual.gentoo.org/ebuild-maintenance/removal/) 流程移除:在 `profiles/package.mask` 顶部加入条目,写明作者、邮箱、日期(UTC)、原因和移除日期,至少 30 天后移除。范例: ``` # Zakk (2026-11-18) @@ -108,8 +113,12 @@ Please note that all boxes must be checked for the pull request to be merged. - 添加 `Signed-off-by` 前,贡献者须确认 AI 生成的部分没有复制许可证不兼容的代码; - AI 生成的提交信息和 pull request 描述须准确、精简、不重复,所述内容须经验证。 +### 声明 + +含 AI 生成改动的提交,须在 `Signed-off-by:` 之上添加 `Assisted-by:` 行,格式同 [Linux 内核](https://docs.kernel.org/process/coding-assistants.html),为 `Assisted-by: 工具名:模型名`。用 `pkgdev commit -T` 添加: + ``` -pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." -T Assisted-by:Deepseek-v4.1-Flash +pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." -T Assisted-by:Claude:claude-opus-5-5 ``` 生成的提交信息: @@ -123,6 +132,9 @@ Assisted-by: Claude:claude-opus-5-5 Signed-off-by: A Developer ``` +> [!NOTE] +> 不得使用 `Co-authored-by:`,CI 将拒绝。 + 以下情况无需声明: - 小改动或机械性改动; @@ -140,4 +152,14 @@ autobump、nvchecker 等本仓库自有的 bot 不受上述规则限制。 AI 生成的改动与其他改动适用相同的测试要求,ebuild 须经过冒烟测试。不得声称执行了实际未执行的测试。 +### 执行 +如果怀疑贡献中使用了 AI 却未声明,我们会要求说明,贡献者须如实回答;拒绝说明的,我们会关闭该 pull request 或 issue。本规则同样适用于维护者。 + +agent 可以使用 [gentoo-zh/skills](https://github.com/gentoo-zh/skills) 打包、更新版本和审查。它只执行 AGENTS.md 的规则,不另立规则。安装命令: + +``` +npx skills add gentoo-zh/skills -g +``` + +本节参考 [OpenWrt packages 的 AI 政策](https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md#ai-policy)。 diff --git a/CONTRIBUTING.zh-TW.md b/CONTRIBUTING.zh-TW.md new file mode 100644 index 0000000000..9efa7ae54b --- /dev/null +++ b/CONTRIBUTING.zh-TW.md @@ -0,0 +1,165 @@ +
+ +[English](./CONTRIBUTING.en.md) | [简体中文](./CONTRIBUTING.md) | 正體中文 + +
+ +# 貢獻指南 + +gentoo-zh 是 Gentoo 的 overlay(第三方 ebuild 儲存庫),依賴 `::gentoo`(`metadata/layout.conf` 中 `masters = gentoo`)。 + +> [!NOTE] +> 故意繞過本文規定者將被移出組織,其維護的全部套件將被 treeclean。此規則適用於全部維護者,包括 owner 和 member。 + +## 套件 + +- ebuild 只使用 `~arch` 關鍵字; +- `::gentoo` 已有的相依套件不在本儲存庫重複新增;除特殊情況外,不新增與 `::gentoo` 同名的套件; +- 每個套件須有 `metadata.xml`,並寫明維護者; +- `LICENSE` 須與所打包軟體聲明的授權條款一致,`::gentoo` 沒有的授權條款須加入 `licenses/` 和 `profiles/license_groups`; +- 除特殊情況外,同一套件的改動須在同一個提交中; +- 套件須登記到 `.github/workflows/overlay.toml`,依 `category/package` 的字母順序插入,不適合 nvchecker 的須註解原因; +- 可自動更新版本的套件見 [scripts/autobump.zh.md](./scripts/autobump.zh.md); +- ebuild 提交前須進行測試; +- 不再維護的套件,須在 issue 中尋找接手者。無人接手的,依據 [last rites](https://devmanual.gentoo.org/ebuild-maintenance/removal/) 流程移除:在 `profiles/package.mask` 最上方加入條目,寫明作者、電子郵件、日期(UTC)、原因和移除日期,至少 30 天後移除。範例: + + ``` + # Zakk (2026-11-18) + # Upstream archived. + # Removal on 2026-12-18. + net-proxy/daed + ``` + +參考: + +- [Devmanual](https://devmanual.gentoo.org/) +- [GLEP 66](https://www.gentoo.org/glep/glep-0066.html):git 工作流程與提交訊息 +- [GLEP 76](https://www.gentoo.org/glep/glep-0076.html):著作權政策與 `Signed-off-by` +- [pkgdev](https://pkgcore.github.io/pkgdev/)、[pkgcheck](https://pkgcore.github.io/pkgcheck/) + +## 提交 + +所有改動經 pull request 合併,禁止直接推送 master 或繞過 CI。 + +提交遵循 [Gentoo git workflow](https://wiki.gentoo.org/wiki/Gentoo_git_workflow): + +- 第一行為摘要行,格式為 `category/package: 摘要`,不超過 69 個字元; +- 內文可選;如有內文,須與摘要行之間空一行; +- 須附 `Signed-off-by:`,可用 `pkgdev commit --signoff` 新增; +- 版本更新的格式為 `category/package: add 0.5, drop 0.4`; +- pull request 中不得有 merge commit,同步 master 時使用 `git rebase`,不使用 `git merge`。 + +範例: + +``` +app-misc/foo: fix build with GCC 16 + +Add a missing include. + +Signed-off-by: A Developer +``` + +常用指令: + +``` +pkgdev manifest # 更新 Manifest +pkgcheck scan --net # 檢查目前的改動 +pkgdev commit --signoff # 提交,產生摘要行並附 Signed-off-by +pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." + # 自訂摘要行和內文 +pkgcheck scan --commits --net # 發起 pull request 前檢查本分支的提交 +``` + +> [!NOTE] +> `pkgdev commit` 的 `-b` 和 `-c` 會引用到 bugs.gentoo.org,不要用於本儲存庫的 issue。 + +### pull request 描述 + +須使用 pull request 範本: + +- 描述寫在 `` 之上; +- 關閉本儲存庫的 issue 時,在描述中加入 `Closes #N`; +- 改動了套件、`eclass/`、`profiles/` 或 `licenses/` 時,須勾選 pkgcheck;如果使用了 AI,須勾選 AI。 + +範例: + +``` +Because upstream 1.2.3 fixes a crash on Wayland, add it. + +Closes #12345 + + + +--- + +Please check all the boxes that apply: + +- [x] I have run `pkgcheck scan --commits --net` to check for issues with my commits. +- [x] If I used AI: I understand every change, tested it and take responsibility for it; commits with AI-written changes carry `Assisted-by:`. + +Please note that all boxes must be checked for the pull request to be merged. +``` + +> [!NOTE] +> 發起 pull request 後,須修復 pkgcheck 報告和 CI 發現的問題,包括 QA 提示。 + +## AI 政策 + +允許使用 AI,但須滿足以下要求: + +- 使用 AI 輔助時須遵守 [AGENTS.md](./AGENTS.md); +- 貢獻者須理解 AI 生成的內容; +- `Signed-off-by` 須由貢獻者本人新增,不得由工具新增; +- 新增 `Signed-off-by` 前,貢獻者須確認 AI 生成的部分沒有複製授權條款不相容的程式碼; +- AI 生成的提交訊息和 pull request 描述須準確、精簡、不重複,所述內容須經驗證。 + +### 聲明 + +含 AI 生成改動的提交,須在 `Signed-off-by:` 之上新增 `Assisted-by:` 行,格式同 [Linux 核心](https://docs.kernel.org/process/coding-assistants.html),為 `Assisted-by: 工具名:模型名`。用 `pkgdev commit -T` 新增: + +``` +pkgdev commit --signoff -m "fix build with GCC 16" -m "Add a missing include." -T Assisted-by:Claude:claude-opus-5-5 +``` + +產生的提交訊息: + +``` +app-misc/foo: fix build with GCC 16 + +Add a missing include. + +Assisted-by: Claude:claude-opus-5-5 +Signed-off-by: A Developer +``` + +> [!NOTE] +> 不得使用 `Co-authored-by:`,CI 將拒絕。 + +以下情況無需聲明: + +- 小改動或機械性改動; +- 僅使用 AI 審查貢獻者自己的改動,並由貢獻者自行修復 AI 發現的問題。 + +### 禁止 + +- 由工具發出 pull request、推送或留言,而貢獻者未逐條閱讀並批准。 +- 根據工具輸出批次發起 pull request,而未逐一建置和測試。 +- 隱瞞或淡化 AI 的參與程度。 + +autobump、nvchecker 等本儲存庫自有的 bot 不受上述規則限制。 + +### 測試 + +AI 生成的改動與其他改動適用相同的測試要求,ebuild 須經過冒煙測試。不得聲稱執行了實際未執行的測試。 + +### 執行 + +如果懷疑貢獻中使用了 AI 卻未聲明,我們會要求說明,貢獻者須如實回答;拒絕說明的,我們會關閉該 pull request 或 issue。本規則同樣適用於維護者。 + +agent 可以使用 [gentoo-zh/skills](https://github.com/gentoo-zh/skills) 打包、更新版本和審查。它只執行 AGENTS.md 的規則,不另立規則。安裝指令: + +``` +npx skills add gentoo-zh/skills -g +``` + +本節參考 [OpenWrt packages 的 AI 政策](https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md#ai-policy)。