mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-17 17:17:00 +08:00
parent
5de4f64133
commit
c6bbf99883
113
pkg/DEB/BUILD.md
Normal file
113
pkg/DEB/BUILD.md
Normal file
@ -0,0 +1,113 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : BUILD.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-15>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 构建 DEB package
|
||||
|
||||
## 从源代码构建
|
||||
|
||||
### 准备
|
||||
|
||||
安装构建所需的依赖:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential debhelper devscripts fakeroot
|
||||
```
|
||||
|
||||
### 构建
|
||||
|
||||
```bash
|
||||
git clone https://github.com/RubyMetric/chsrc.git
|
||||
cd chsrc
|
||||
|
||||
# 执行构建命令
|
||||
./deb.makefile deb-build
|
||||
|
||||
# 安装生成的 .deb 文件
|
||||
sudo dpkg -i ../chsrc_*.deb
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### 交叉编译
|
||||
|
||||
为不同架构进行构建:
|
||||
|
||||
```bash
|
||||
# For ARM64
|
||||
CC=aarch64-linux-gnu-gcc dpkg-buildpackage -us -uc -b -aarm64
|
||||
|
||||
# For ARMv7 (armhf)
|
||||
CC=arm-linux-gnueabihf-gcc dpkg-buildpackage -us -uc -b -aarmhf
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### 安装与测试
|
||||
|
||||
```bash
|
||||
# 安装生成的包
|
||||
sudo dpkg -i ../chsrc_*.deb
|
||||
sudo apt-get install -f # 修复依赖问题
|
||||
|
||||
# 运行测试
|
||||
./deb-test.sh
|
||||
|
||||
# 卸载
|
||||
sudo apt-get remove chsrc
|
||||
```
|
||||
|
||||
### 清理构建产物
|
||||
|
||||
```bash
|
||||
./deb.makefile deb-clean
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## 卸载
|
||||
|
||||
```bash
|
||||
sudo apt-get remove chsrc
|
||||
```
|
||||
|
||||
包括删除配置在内的完全删除:
|
||||
|
||||
```bash
|
||||
sudo apt-get purge chsrc
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 故障排查
|
||||
|
||||
### 常见问题
|
||||
|
||||
1. **构建失败**: 检查 debian/control 中的依赖是否正确
|
||||
2. **交叉编译失败**: 确认目标架构的工具链已正确安装
|
||||
3. **安装测试失败**: 检查 postinst 脚本是否有错误
|
||||
|
||||
### 调试构建
|
||||
|
||||
```bash
|
||||
# 启用详细输出
|
||||
DEB_BUILD_OPTIONS="nocheck" debuild -us -uc -b
|
||||
|
||||
# 检查构建日志
|
||||
less ../chsrc_*.build
|
||||
|
||||
# 检查包内容
|
||||
dpkg --contents ../chsrc_*.deb
|
||||
# 或
|
||||
dpkg-deb --contents ../chsrc_*.deb
|
||||
```
|
58
pkg/DEB/CI.md
Normal file
58
pkg/DEB/CI.md
Normal file
@ -0,0 +1,58 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : CI.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-15>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# DEB package CI/CD
|
||||
|
||||
本文档说明了 chsrc 项目的 DEB 包自动构建和发布流程。
|
||||
|
||||
## CI 文件
|
||||
|
||||
- [.github/workflows/pkg-deb.yml](.github/workflows/pkg-deb.yml)
|
||||
|
||||
<br>
|
||||
|
||||
## 支持的架构
|
||||
|
||||
当前支持以下架构的 DEB 包构建:
|
||||
|
||||
- `amd64` (x86_64)
|
||||
|
||||
<br>
|
||||
|
||||
## CI 构建产物
|
||||
|
||||
每次 CI 构建会生成:
|
||||
|
||||
1. **DEB 包文件**: `chsrc_<version>-1_<arch>.deb`
|
||||
2. **仓库元数据**: `Packages` 和 `Packages.gz` 文件用于创建 APT 仓库
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 自动触发
|
||||
|
||||
DEB 包构建 CI 会在以下情况下自动触发:
|
||||
|
||||
1. **Release 事件**: 当创建新的 release 时自动构建并上传 DEB 包到 release assets
|
||||
2. **手动触发**: 可以在 GitHub Actions 页面手动触发构建
|
||||
|
||||
<br>
|
||||
|
||||
## 手动发布流程
|
||||
|
||||
1. 确保所有代码已合并到主分支
|
||||
2. 更新版本号和 changelog
|
||||
3. 创建并推送 git tag: `git tag v1.2.3 && git push origin v1.2.3`
|
||||
4. 在 GitHub 上创建 release
|
||||
5. CI 将自动构建并上传 DEB 包
|
||||
|
||||
<br>
|
@ -1,77 +0,0 @@
|
||||
# DEB Package Installation
|
||||
|
||||
## Installing from Release
|
||||
|
||||
1. Download the appropriate DEB package from the [releases page](https://github.com/RubyMetric/chsrc/releases)
|
||||
2. Install using dpkg:
|
||||
```bash
|
||||
sudo dpkg -i chsrc_*.deb
|
||||
sudo apt-get install -f # Fix any dependency issues
|
||||
```
|
||||
|
||||
## Building from Source
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Install the required build dependencies:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential debhelper devscripts fakeroot
|
||||
```
|
||||
|
||||
### Building the Package
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/RubyMetric/chsrc.git
|
||||
cd chsrc
|
||||
```
|
||||
|
||||
2. Build the DEB package:
|
||||
```bash
|
||||
make deb-build
|
||||
```
|
||||
|
||||
3. Install the generated package:
|
||||
```bash
|
||||
sudo dpkg -i ../chsrc_*.deb
|
||||
```
|
||||
|
||||
### Cross-compilation
|
||||
|
||||
To build for different architectures:
|
||||
|
||||
```bash
|
||||
# For ARM64
|
||||
CC=aarch64-linux-gnu-gcc dpkg-buildpackage -us -uc -b -aarm64
|
||||
|
||||
# For ARMv7 (armhf)
|
||||
CC=arm-linux-gnueabihf-gcc dpkg-buildpackage -us -uc -b -aarmhf
|
||||
```
|
||||
|
||||
### Cleaning Build Artifacts
|
||||
|
||||
```bash
|
||||
make deb-clean
|
||||
```
|
||||
|
||||
## Package Information
|
||||
|
||||
- **Package Name**: chsrc
|
||||
- **Architecture**: amd64, arm64, armhf
|
||||
- **Dependencies**: Standard C library
|
||||
- **Installation Path**: `/usr/bin/chsrc`
|
||||
- **Manual Page**: `/usr/share/man/man1/chsrc.1`
|
||||
|
||||
## Uninstalling
|
||||
|
||||
```bash
|
||||
sudo apt-get remove chsrc
|
||||
```
|
||||
|
||||
Or completely remove including configuration:
|
||||
|
||||
```bash
|
||||
sudo apt-get purge chsrc
|
||||
```
|
@ -1,57 +1,52 @@
|
||||
# DEB Package CI/CD 构建
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! | Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-15>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
本文档说明了 chsrc 项目的 DEB 包自动构建和发布流程。
|
||||
# DEB package
|
||||
|
||||
## 自动触发
|
||||
本文档说明了 `chsrc` 项目的 DEB 包的相关情况
|
||||
|
||||
DEB 包构建 CI 会在以下情况下自动触发:
|
||||
<br>
|
||||
|
||||
1. **Release 事件**: 当创建新的 release 时自动构建并上传 DEB 包到 release assets
|
||||
2. **手动触发**: 可以在 GitHub Actions 页面手动触发构建
|
||||
## 相关文件
|
||||
|
||||
## 支持的架构
|
||||
- `.github/workflows/pkg-deb.yml` - CI 配置文件
|
||||
- `CI.md` - CI 情况说明
|
||||
|
||||
当前支持以下架构的 DEB 包构建:
|
||||
<wbr>
|
||||
|
||||
- `amd64` (x86_64)
|
||||
- `debian/` - DEB 包构建配置目录
|
||||
- `BUILD.md` - 如何手动构建
|
||||
- `deb.makefile` - DEB 包构建 Makefile
|
||||
- `deb-test.sh` - DEB 包 **已正确安装** 测试脚本
|
||||
|
||||
## 构建产物
|
||||
<br>
|
||||
|
||||
每次构建会生成:
|
||||
|
||||
1. **DEB 包文件**: `chsrc_<version>-1_<arch>.deb`
|
||||
2. **仓库元数据**: `Packages` 和 `Packages.gz` 文件用于创建 APT 仓库
|
||||
## 安装
|
||||
|
||||
## 本地测试
|
||||
|
||||
### 构建 DEB 包
|
||||
如果你是普通用户,你应该从 [GitHub Releases](https://github.com/RubyMetric/chsrc/releases) 下载合适的 DEB package,然后运行以下命令安装:
|
||||
|
||||
```bash
|
||||
# 准备构建环境
|
||||
sudo apt-get install build-essential debhelper devscripts fakeroot
|
||||
|
||||
# 构建包
|
||||
make deb-build
|
||||
|
||||
# 清理构建产物
|
||||
make deb-clean
|
||||
sudo dpkg -i chsrc_*.deb
|
||||
sudo apt-get install -f # Fix any dependency issues
|
||||
```
|
||||
|
||||
### 测试安装
|
||||
如果你是高级用户,你可以自己阅读本目录下的 [./BUILD.md](./BUILD.md) 来自己构建 DEB 包并按照上述同样的方式安装。
|
||||
|
||||
```bash
|
||||
# 安装生成的包
|
||||
sudo dpkg -i ../chsrc_*.deb
|
||||
sudo apt-get install -f # 修复依赖问题
|
||||
<br>
|
||||
|
||||
# 运行测试
|
||||
bash ./pkg/DEB/deb-test.sh
|
||||
|
||||
# 卸载
|
||||
sudo apt-get remove chsrc
|
||||
```
|
||||
|
||||
## 文件结构
|
||||
## `debian/` 目录结构
|
||||
|
||||
```
|
||||
debian/
|
||||
@ -64,38 +59,6 @@ debian/
|
||||
└── rules # 构建规则
|
||||
```
|
||||
|
||||
## 手动发布流程
|
||||
其中,最后三个是 `+x` 的可执行文件。
|
||||
|
||||
1. 确保所有代码已合并到主分支
|
||||
2. 更新版本号和 changelog
|
||||
3. 创建并推送 git tag: `git tag v1.2.3 && git push origin v1.2.3`
|
||||
4. 在 GitHub 上创建 release
|
||||
5. CI 将自动构建并上传 DEB 包
|
||||
|
||||
## 故障排查
|
||||
|
||||
### 常见问题
|
||||
|
||||
1. **构建失败**: 检查 debian/control 中的依赖是否正确
|
||||
2. **交叉编译失败**: 确认目标架构的工具链已正确安装
|
||||
3. **安装测试失败**: 检查 postinst 脚本是否有错误
|
||||
|
||||
### 调试构建
|
||||
|
||||
```bash
|
||||
# 启用详细输出
|
||||
DEB_BUILD_OPTIONS="nocheck" debuild -us -uc -b
|
||||
|
||||
# 检查构建日志
|
||||
less ../chsrc_*.build
|
||||
|
||||
# 检查包内容
|
||||
dpkg-deb --contents chsrc_*.deb
|
||||
```
|
||||
|
||||
## 相关文件
|
||||
|
||||
- `.github/workflows/pkg-deb.yml` - CI 工作流配置
|
||||
- `debian/` - Debian 包配置目录
|
||||
- `pkg/DEB/deb-test.sh` - DEB 包功能测试脚本
|
||||
- `pkg/DEB/INSTALL.md` - 用户安装指南
|
||||
<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user