Compare commits
145 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
805234a474 | ||
|
2e58b7325d | ||
|
9256daa5bc | ||
|
cf9516b2c2 | ||
|
f9c81e695a | ||
|
0119eb0db9 | ||
|
4119466247 | ||
|
54e13aa77f | ||
|
21527184b6 | ||
|
789240dd2f | ||
|
168cce314f | ||
|
429fe656b2 | ||
|
2ad8c63b59 | ||
|
90cf624f53 | ||
|
2e0059978c | ||
|
dc34c4494a | ||
|
efa31ca0fc | ||
|
765da083da | ||
|
7e629fe96d | ||
|
72c752bfdd | ||
|
5bd1b61755 | ||
|
6b1a364fe6 | ||
|
2da1dffca4 | ||
|
c60e740549 | ||
|
5b70f7fd8c | ||
|
ba6fa809d4 | ||
|
7841e9bf1e | ||
|
537ed4fd8c | ||
|
9cbad804c5 | ||
|
28a3aae6e1 | ||
|
75c1401776 | ||
|
b9e7937526 | ||
|
31852b4f57 | ||
|
a2851d5246 | ||
|
54a93f9e19 | ||
|
72030ccec6 | ||
|
5372ace76f | ||
|
e60ff265d0 | ||
|
944a803ba4 | ||
|
82efdf97d4 | ||
|
acc8f8bf72 | ||
|
cd13b48c21 | ||
|
899297de22 | ||
|
74be327274 | ||
|
c3d6b1c5f3 | ||
|
d49377f166 | ||
|
dd2333f0c8 | ||
|
5cde6622b5 | ||
|
ca00e0233b | ||
|
7d0923e9de | ||
|
a978659696 | ||
|
27696d707e | ||
|
99748a51da | ||
|
670acaf247 | ||
|
2c64d724ef | ||
|
f307795e57 | ||
|
211e98cce1 | ||
|
f312dd3b8d | ||
|
eb24afc650 | ||
|
e8a22c13f2 | ||
|
17bd90f09b | ||
|
b3915738d8 | ||
|
a41d76b84f | ||
|
5106de1185 | ||
|
14b4c77125 | ||
|
73c63d117f | ||
|
c1a16582ff | ||
|
08dd6228f3 | ||
|
32b7477d21 | ||
|
7f0888c9da | ||
|
cacc70029a | ||
|
86a1fa3b16 | ||
|
a7b55064b1 | ||
|
50d6324b40 | ||
|
31addff431 | ||
|
a86ed49615 | ||
|
7c7c1ddc00 | ||
|
d292c0c3fb | ||
|
0821663073 | ||
|
2124770aeb | ||
|
975b2391cb | ||
|
02c3a815de | ||
|
d798da80f7 | ||
|
9e66fe4e93 | ||
|
1c630d3c5b | ||
|
7543e67920 | ||
|
e2b6bb9233 | ||
|
40ef2ae201 | ||
|
91e0696bc5 | ||
|
d6a3de0558 | ||
|
4339e856d3 | ||
|
ac676e07c6 | ||
|
5d992335f1 | ||
|
aea231bbc0 | ||
|
5a1c1f5470 | ||
|
8a288b90bc | ||
|
187f90dca5 | ||
|
aa1ab323d9 | ||
|
ecb083208f | ||
|
42135de152 | ||
|
ebbe2521bc | ||
|
d4e1e7dd37 | ||
|
075f91cbde | ||
|
258b54ba32 | ||
|
683aadee17 | ||
|
c6bbf99883 | ||
|
5de4f64133 | ||
|
62fefdb09d | ||
|
9b3ca55818 | ||
|
3c84ad550d | ||
|
eb808c49a5 | ||
|
7c7408e4b8 | ||
|
a2321fdc06 | ||
|
aab3042c88 | ||
|
c41bcf7e38 | ||
|
cac040efdf | ||
|
74915f629d | ||
|
d425fff037 | ||
|
d25c0addcb | ||
|
dc9cb70217 | ||
|
a67fc7c859 | ||
|
8f99e12efb | ||
|
6ecf028c84 | ||
|
19b9e54261 | ||
|
662cd7c311 | ||
|
573c981de5 | ||
|
1cf40ae473 | ||
|
7d190fcbc1 | ||
|
0c7e65db05 | ||
|
8e0fbb2f6b | ||
|
7ee02b8fea | ||
|
089fc77486 | ||
|
463f9092a6 | ||
|
7bfe7c7d26 | ||
|
7e3eb3d5ed | ||
|
ef5933a412 | ||
|
e8c0085c47 | ||
|
61a049b776 | ||
|
283acfa4ba | ||
|
b8034c44e7 | ||
|
1b4d088b42 | ||
|
8f1498e73c | ||
|
56dfa4f1fd | ||
|
b2a5b0add3 | ||
|
5e0b02cf3f |
@ -17,3 +17,10 @@ indent_style = tab
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# 使用 VS Code 生成文件的默认格式
|
||||
[*.json]
|
||||
indent_size = 4
|
||||
|
||||
[*.{yaml,yml}]
|
||||
indent_size = 2
|
||||
|
6
.github/ISSUE_TEMPLATE/01-Report_Bug.yml
vendored
@ -1,9 +1,9 @@
|
||||
name: 🐞 Bug 报告
|
||||
description: 有 Bug 了吗?
|
||||
title: "详细报告BUG是chsrc用户的一大美德"
|
||||
labels: ['Bug']
|
||||
# labels: [ ]
|
||||
type: Bug
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
@ -83,5 +83,5 @@ body:
|
||||
label: 防止重复问题
|
||||
description: 您确认在打开这个新的 issue 之前已经搜索过类似的issue。您可以评论或订阅已经存在的相关 issue
|
||||
options:
|
||||
- label: 我已在项目的 GitHub 和 Gitee 两个仓库分别搜索过类似的 issue
|
||||
- label: 我已在项目中搜索过类似的 issue
|
||||
required: true
|
||||
|
3
.github/ISSUE_TEMPLATE/02-Request_Recipe.yml
vendored
@ -1,7 +1,8 @@
|
||||
name: 🫡 我想要对 target 换源!
|
||||
description: 想要对尚未支持的 target 进行换源?
|
||||
title: "提前找好方案怎么换源是chsrc用户的一大美德"
|
||||
labels: []
|
||||
# labels: [ ]
|
||||
type: Request
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
3
.github/ISSUE_TEMPLATE/03-Share.yml
vendored
@ -1,7 +1,8 @@
|
||||
name: 🎉 我找到了新的镜像站或源!
|
||||
description: 为大家分享新的镜像站或可用源!
|
||||
title: "分享是chsrc用户的一大美德"
|
||||
labels: ['']
|
||||
# labels: [ ]
|
||||
type: Contribute
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
3
.github/ISSUE_TEMPLATE/04-Deprecate.yml
vendored
@ -1,7 +1,8 @@
|
||||
name: ⛓️💥 镜像源已失效
|
||||
description: 该镜像站已关停/该源已不再被支持
|
||||
title: "报告镜像源情况是chsrc用户的一大美德"
|
||||
labels: ['Deprecate']
|
||||
# labels: [ ]
|
||||
type: Deprecate
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
48
.github/PULL_REQUEST_TEMPLATE/Implement.md
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
## 问题描述
|
||||
|
||||
(此内容必填)
|
||||
|
||||
1. 简要说明此 PR 修复的具体问题或改进的功能背景
|
||||
2. 列出与此 PR 相关的 issue 或任务,若没有填 `N/A`
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 方案
|
||||
|
||||
(此内容必填)
|
||||
|
||||
详细描述针对该问题或功能改进的解决方案
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 实现
|
||||
|
||||
(此内容可选填)
|
||||
|
||||
在按照上述方案实现时,若遇到需记录和提醒他人的细节时,务必在此描述
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 测试
|
||||
|
||||
(此内容可选填)
|
||||
|
||||
描述如何验证本 PR,列出具体的测试步骤
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 备注
|
||||
|
||||
(此内容可选填)
|
||||
|
||||
列出需要特别注意或额外注意的事项
|
||||
|
||||
<br>
|
15
.github/READIT.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (Overview .github) READIT.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2025-06-20>
|
||||
! Last Modified : <2025-06-20>
|
||||
!
|
||||
! 此文件不能叫做 README.md,否则 GitHub 主页会显示此文件
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
[`pull_request_template.md`](./pull_request_template.md) 是 [`PULL_REQUEST_TEMPLATE/Implement.md`](./PULL_REQUEST_TEMPLATE/Implement.md) 的最简化版
|
6
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
80
.github/pull_request_template.md
vendored
@ -1,80 +1,14 @@
|
||||
## 描述
|
||||
## 问题描述
|
||||
|
||||
### 问题的背景
|
||||
1. 简要说明此 PR 修复的具体问题或改进的功能背景
|
||||
2. 列出与此 PR 相关的 issue 或任务,若没有填 `N/A`
|
||||
|
||||
简要说明此 PR 修复的具体问题或改进的功能背景
|
||||
<br>
|
||||
|
||||
例如:
|
||||
|
||||
- 当前 `chsrc list` 命令无法正确排序镜像源列表
|
||||
- `chsrc measure` 命令不支持IPv6测速
|
||||
- `chsrc set` 命令的源选择逻辑不够智能,无法自动选择最快源
|
||||
|
||||
### 相关 issue
|
||||
## 方案与实现
|
||||
|
||||
列出与此 PR 相关的 issue 或任务,若没有填 `N/A`
|
||||
详细描述针对该问题或功能改进的解决方案
|
||||
|
||||
例如:
|
||||
|
||||
- Closes `#123` (修复了`list`命令的问题)
|
||||
- Depends on `#789` (等待依赖PR的合并)
|
||||
|
||||
### 这个PR做了什么
|
||||
|
||||
简要描述本PR的改动内容
|
||||
|
||||
例如:
|
||||
|
||||
- 修复了 `list` 命令的排序问题
|
||||
- 增加了对 IPv6 的测速支持
|
||||
- 优化了 `set` 命令的源选择逻辑
|
||||
|
||||
---
|
||||
|
||||
## 方案
|
||||
|
||||
简要描述针对该问题或功能改进的解决方案
|
||||
|
||||
例如:
|
||||
|
||||
- 对 `list` 命令进行了排序优化,确保镜像源按照正确的顺序展示
|
||||
- 在 `measure` 命令中加入了 `-ipv6` 选项,支持 IPv6 测速
|
||||
- 对 `set` 命令进行了改进,加入了自动选择最快镜像源的逻辑
|
||||
|
||||
---
|
||||
|
||||
## 实现
|
||||
|
||||
详细描述本 PR 的具体实现,包括代码改动的关键点和实现方式
|
||||
|
||||
例如:
|
||||
|
||||
- 在 `list` 命令中使用新的排序算法
|
||||
- 在 `measure` 命令中添加了IPv6支持,具体通过解析 `-ipv6` 选项来启用
|
||||
- 修改了 `set` 命令的源选择逻辑,通过测速算法选择最快源
|
||||
|
||||
---
|
||||
|
||||
## 注意
|
||||
|
||||
列出需要特别注意的事项
|
||||
|
||||
例如:
|
||||
|
||||
- `-ipv6` 选项需要网络环境支持 IPv6地址,测试时请确保 IPv6 可用
|
||||
- 在使用 `-dry` 选项进行模拟时,命令只会打印过程,而不会实际执行更换源操作
|
||||
- 此 PR 向后兼容,原有命令和选项不受影响
|
||||
|
||||
---
|
||||
|
||||
## 测试
|
||||
|
||||
描述如何验证本 PR,列出具体的测试步骤
|
||||
|
||||
例如:
|
||||
|
||||
- 运行 `chsrc list` 命令,验证镜像源是否按正确的顺序列出
|
||||
- 使用 `chsrc measure <target> -ipv6` 进行 IPv6 测速,确保能够正常测速
|
||||
- 运行 `chsrc set <target>` 命令,验证是否能够自动选择最快的源并成功更换
|
||||
|
||||
---
|
||||
<br>
|
||||
|
50
.github/workflows/PR-notify.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : PR-notify.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2025-06-19>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Notify PR
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 告知PR者
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened,
|
||||
ready_for_review, # draft PR 转为正式 PR
|
||||
review_requested,
|
||||
reopened]
|
||||
|
||||
jobs:
|
||||
enforce-dev-branch:
|
||||
name: 强制使用dev分支
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request_target.base.ref != 'dev'
|
||||
steps:
|
||||
- name: 评论
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
with:
|
||||
message: |
|
||||
❤️ 感谢你的贡献!你的 PR 当前基于 ${{github.base_ref}} 分支,请修改使用 `dev` 分支!
|
||||
comment-tag: "❤️ 感谢你的贡献!"
|
||||
- run: |
|
||||
echo "::error::❌ PR 必须以 dev 分支为目标!当前是 ${GITHUB_BASE_REF}"
|
||||
exit 1
|
||||
|
||||
welcome:
|
||||
name: 欢迎PR者
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request_target.base.ref == 'dev'
|
||||
steps:
|
||||
- name: 评论
|
||||
if: github.event.pull_request.type == 'opened'
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
❤️ 感谢你的贡献!我们将在5天内阅读此 PR 并回复你
|
||||
edit-mode: replace
|
||||
reactions: heart
|
62
.github/workflows/PR-test.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : PR-test.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2025-06-19>
|
||||
# Last Modified : <2025-06-19>
|
||||
#
|
||||
# Test PR
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 测试PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened,
|
||||
synchronize, # 后续提交
|
||||
ready_for_review, # draft PR 转为正式 PR
|
||||
review_requested,
|
||||
reopened]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "lib/**"
|
||||
|
||||
jobs:
|
||||
test-on-ubuntu:
|
||||
name: 在Ubuntu上测试
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.base.ref == 'dev'
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 测试构建情况
|
||||
run: |
|
||||
make
|
||||
|
||||
- name: 测试test情况
|
||||
run: |
|
||||
make test
|
||||
|
||||
test-on-windows:
|
||||
name: 在Windows上测试
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.base.ref == 'dev'
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 安装依赖
|
||||
run: |
|
||||
choco install just
|
||||
|
||||
- name: 测试构建情况
|
||||
run: |
|
||||
just
|
||||
|
||||
- name: 测试test情况
|
||||
run: |
|
||||
just test
|
48
.github/workflows/build-on-Linux-AArch64.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-AArch64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on Linux (AArch64) and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 Linux AArch64
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 构建
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
with:
|
||||
arch: aarch64
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-aarch64-linux
|
||||
|
||||
cp ./chsrc-aarch64-linux /artifacts
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-aarch64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
49
.github/workflows/build-on-Linux-ARMv7.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-ARMv7.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on Linux (ARMv7) and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 Linux ARMv7
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 构建
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
with:
|
||||
arch: armv7
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-armv7-linux
|
||||
|
||||
cp ./chsrc-armv7-linux /artifacts
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-armv7-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
48
.github/workflows/build-on-Linux-riscv64.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-riscv64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on Linux (riscv64) and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 Linux riscv64
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 构建
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
with:
|
||||
arch: riscv64
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-riscv64-linux
|
||||
|
||||
cp ./chsrc-riscv64-linux /artifacts
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-riscv64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
40
.github/workflows/build-on-Linux-x64.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-x64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on Linux (x64) and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 Linux x64
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 构建
|
||||
run: |
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-x64-linux
|
||||
|
||||
- name: List files
|
||||
run: ls *-linux
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
63
.github/workflows/build-on-Windows.yml
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Windows.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on Windows and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 Windows
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 安装 GCC
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: UCRT64
|
||||
update: true
|
||||
install: |
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-make
|
||||
mingw-w64-i686-gcc
|
||||
mingw-w64-i686-make
|
||||
|
||||
- name: 为 x64 构建
|
||||
run: |
|
||||
mingw32-make.exe build-in-ci-release-mode
|
||||
mv chsrc-ci-release.exe chsrc-x64-windows.exe
|
||||
|
||||
- name: 为 x32 构建
|
||||
env:
|
||||
MSYSTEM: MINGW32
|
||||
run: |
|
||||
mingw32-make.exe build-in-ci-release-mode
|
||||
mv chsrc-ci-release.exe chsrc-x86-windows.exe
|
||||
|
||||
- name: List files
|
||||
run: ls *.exe
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-windows.exe
|
||||
chsrc-x86-windows.exe
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
65
.github/workflows/build-on-macOS.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-macOS.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2023-09-15>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# Build chsrc on macOS and upload it to GitHub: the 'pre' release
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建于 macOS
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
on-arm64:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 为 arm64 (AArch64) 构建
|
||||
run: |
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-aarch64-macos
|
||||
|
||||
- name: List files
|
||||
run: ls *-macos
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-aarch64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
||||
on-x64:
|
||||
runs-on: macos-13 # macos-14 is AArch64(ARMv8-A)
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 为 x64 构建
|
||||
run: |
|
||||
make build-in-ci-release-mode
|
||||
mv chsrc-ci-release chsrc-x64-macos
|
||||
|
||||
- name: List files
|
||||
run: ls *-macos
|
||||
|
||||
- name: 上传至 'pre' release
|
||||
uses: softprops/action-gh-release@v2
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
36
.github/workflows/linux-aarch64.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: Linux AArch64 Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
aarch64-linux-build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build aarch64
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
with:
|
||||
arch: aarch64
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
make CI CI_ARTIFACT_NAME=chsrc-aarch64-linux
|
||||
cp ./chsrc-aarch64-linux /artifacts
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-aarch64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
37
.github/workflows/linux-armv7.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: Linux ARMv7 Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
armv7-linu-build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build ARMv7
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
with:
|
||||
arch: armv7
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
make CI CI_ARTIFACT_NAME=chsrc-armv7-linux
|
||||
cp ./chsrc-armv7-linux /artifacts
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-armv7-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
36
.github/workflows/linux-riscv64.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: Linux riscv64 Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
riscv64-linux-build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build riscv64
|
||||
uses: uraimo/run-on-arch-action@v2
|
||||
with:
|
||||
arch: riscv64
|
||||
distro: ubuntu_latest
|
||||
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}/artifacts:/artifacts"
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install build-essential -y -q
|
||||
apt-get install git -y -q
|
||||
pwd ; ls -al
|
||||
git clone https://github.com/RubyMetric/chsrc -b gh-build -q
|
||||
cd chsrc
|
||||
make CI CI_ARTIFACT_NAME=chsrc-riscv64-linux
|
||||
cp ./chsrc-riscv64-linux /artifacts
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-riscv64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
30
.github/workflows/linux-x64.yml
vendored
@ -1,30 +0,0 @@
|
||||
name: Linux x64 Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
x64-linux-build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compile chsrc x64
|
||||
run: |
|
||||
make CI CI_ARTIFACT_NAME=chsrc-x64-linux
|
||||
|
||||
- name: List files
|
||||
run: ls *-linux
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
54
.github/workflows/macos.yml
vendored
@ -1,54 +0,0 @@
|
||||
name: macOS Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload-on-M1:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compile chsrc for AArch64
|
||||
run: |
|
||||
make CI CI_ARTIFACT_NAME=chsrc-aarch64-macos
|
||||
|
||||
- name: List files
|
||||
run: ls *-macos
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-aarch64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
||||
build-and-upload-on-x64:
|
||||
runs-on: macos-13 # macos-14 is AArch64(ARMv8-A)
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compile chsrc for x64
|
||||
run: |
|
||||
make CI CI_ARTIFACT_NAME=chsrc-x64-macos
|
||||
|
||||
- name: List files
|
||||
run: ls *-macos
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
181
.github/workflows/pkg-deb.yml
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : pkg-deb.yml
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-10>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# Build and publish deb packages
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: 构建发布deb包
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ released ]
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to build'
|
||||
required: true
|
||||
default: '0.3.0' # 短暂时间内不可达到的最新版本号
|
||||
|
||||
jobs:
|
||||
Build-deb:
|
||||
name: 构建deb包
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-build
|
||||
|
||||
- name: 获取版本号
|
||||
id: get_version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
version="${{ github.event.release.tag_name }}"
|
||||
# 删除前缀 'v' if present
|
||||
version=${version#v}
|
||||
|
||||
elif [ "${{ github.event_name }}" = "push" ];then
|
||||
# 从源代码中提取版本号
|
||||
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/chsrc-main.c)
|
||||
|
||||
else
|
||||
version="${{ github.event.inputs.version }}"
|
||||
fi
|
||||
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
echo "Version: $version"
|
||||
|
||||
- name: 验证版本号
|
||||
run: |
|
||||
version="${{ steps.get_version.outputs.version }}"
|
||||
|
||||
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Invalid version format: $version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 更新 debian/changelog
|
||||
run: |
|
||||
version="${{ steps.get_version.outputs.version }}"
|
||||
|
||||
cd ./pkg/deb
|
||||
|
||||
(cat << EOF; cat ./debian/changelog) > new_changelog
|
||||
chsrc ($version-1) unstable; urgency=medium
|
||||
|
||||
* Release version $version
|
||||
|
||||
-- Aoran Zeng <ccmywish@qq.com> $(date -R)
|
||||
|
||||
EOF
|
||||
|
||||
mv -f new_changelog ./debian/changelog
|
||||
|
||||
- name: 安装构建依赖
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y debhelper devscripts build-essential fakeroot
|
||||
|
||||
- name: 构建
|
||||
run: |
|
||||
make build-deb
|
||||
|
||||
- name: 移动构建产物到./dist和./dist-for-pre
|
||||
run: |
|
||||
version="${{ steps.get_version.outputs.version }}"
|
||||
|
||||
# 创建两个目录来存放构建产物(产物内容一样,只是文件名不一样)
|
||||
mkdir dist dist-for-pre
|
||||
find ./pkg -name "chsrc_${version}*.deb" -exec mv {} dist/ \;
|
||||
cp -r dist/* dist-for-pre/
|
||||
|
||||
# 上传至 'pre' release 的文件名需要设置为 'latest', 从而稳定下载URL
|
||||
cd ./dist-for-pre
|
||||
for old_name in ./chsrc_${version}*.deb; do
|
||||
new_name="${old_name/${version}-1/latest-1}"
|
||||
mv "$old_name" "$new_name"
|
||||
done
|
||||
|
||||
- name: 验证生成的deb包
|
||||
run: |
|
||||
version="${{ steps.get_version.outputs.version }}"
|
||||
ls -la dist/
|
||||
dpkg-deb --info dist/chsrc_${version}-1_amd64.deb
|
||||
dpkg-deb --contents dist/chsrc_${version}-1_amd64.deb
|
||||
|
||||
- name: 测试deb包能否正常安装
|
||||
run: |
|
||||
version="${{ steps.get_version.outputs.version }}"
|
||||
|
||||
sudo dpkg -i dist/chsrc_${version}-1_amd64.deb || true
|
||||
sudo apt-get install -f -y || true
|
||||
|
||||
bash pkg/deb/deb-installation-test.sh
|
||||
|
||||
- name: 上传deb包到artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: chsrc-deb-files
|
||||
path: dist/chsrc_*.deb
|
||||
retention-days: 30
|
||||
|
||||
- name: 上传附件到GitHub Releases(the newly created release)
|
||||
if: github.event_name == 'release'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# 用 * 省略版本号,以及指代各种架构
|
||||
files: dist/chsrc_*.deb
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
- name: 上传附件到GitHub Releases(the 'pre' release)
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: pre
|
||||
# 用 * 指代各种架构
|
||||
files: dist-for-pre/chsrc_latest-1_*.deb
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Create-APT-repository:
|
||||
name: 创建APT仓库
|
||||
needs: Build-deb
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'release'
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: chsrc-deb-files
|
||||
merge-multiple: true
|
||||
path: ./debs
|
||||
|
||||
- name: Install repository tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dpkg-dev
|
||||
|
||||
- name: Create Packages file
|
||||
run: |
|
||||
cd debs
|
||||
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
|
||||
dpkg-scanpackages . /dev/null > Packages
|
||||
|
||||
- name: Upload repository metadata
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: debian-repository-metadata
|
||||
path: debs/Packages*
|
||||
retention-days: 30
|
@ -1,7 +1,19 @@
|
||||
# This workflow will publish the `chsrc` and the `chsrc-bin` packages to the AUR
|
||||
# when there is a new `released` event.
|
||||
# Note: only normal version tags like `v1.2.3` will be published.
|
||||
name: Publish AUR Package (chsrc, chsrc-bin)
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : pub-AUR-chsrc-and-chsrc-bin.yml
|
||||
# File Authors : Terrasse <terrasse@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2024-08-29>
|
||||
# Last Modified : <2025-03-18>
|
||||
#
|
||||
# Publish the 2 packages to AUR when a new release is created:
|
||||
# 1. chsrc
|
||||
# 2. chsrc-bin
|
||||
#
|
||||
# Note: only normal version tags like 'v1.2.3' will be published
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: Publish 'chsrc' and 'chsrc-bin' to AUR
|
||||
on:
|
||||
release:
|
||||
types: [ released ]
|
||||
@ -60,4 +72,4 @@ jobs:
|
||||
commit_username: ${{ secrets.AUR_USERNAME }}
|
||||
commit_email: ${{ secrets.AUR_EMAIL }}
|
||||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||
commit_message: "github-action-auto-publish v${{ env.version }}"
|
||||
commit_message: "github-action-auto-publish v${{ env.version }}"
|
@ -1,10 +1,22 @@
|
||||
# This workflow will publish the `chsrc-git` package to the AUR
|
||||
# when the main branch is updated.
|
||||
name: Publish AUR Package (chsrc-git)
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : pub-AUR-chsrc-git.yml
|
||||
# File Authors : Terrasse <terrasse@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2024-08-29>
|
||||
# Last Modified : <2025-06-19>
|
||||
#
|
||||
# Publish package 'chsrc-git' to AUR when branch 'main' is updated.
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: Publish 'chsrc-git' to AUR
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ "main" ] # chsrc-git syncs with main
|
||||
paths:
|
||||
- "src/**"
|
||||
- "lib/**"
|
||||
|
||||
jobs:
|
||||
publish:
|
24
.github/workflows/pub-WinGet.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Workflow File : pub-WinGet.yml
|
||||
# File Authors : YU-7 <2747046473@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2024-12-25>
|
||||
# Last Modified : <2024-12-25>
|
||||
#
|
||||
# This workflow publish to winget
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
name: Publish to WinGet
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifier: RubyMetric.chsrc
|
||||
installers-regex: '\.exe$' # Only .exe files
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
53
.github/workflows/windows.yml
vendored
@ -1,53 +0,0 @@
|
||||
name: Windows Build
|
||||
on:
|
||||
push:
|
||||
branches: [ "gh-build" ]
|
||||
pull_request:
|
||||
branches: [ "gh-build" ]
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install x64 gcc
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: UCRT64
|
||||
update: true
|
||||
install: |
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-make
|
||||
mingw-w64-i686-gcc
|
||||
mingw-w64-i686-make
|
||||
|
||||
- name: Compile chsrc x64
|
||||
run: |
|
||||
mingw32-make.exe CI CI_ARTIFACT_NAME=chsrc-x64-windows
|
||||
|
||||
- name: Compile chsrc x86
|
||||
env:
|
||||
MSYSTEM: MINGW32
|
||||
run: |
|
||||
mingw32-make.exe CI CI_ARTIFACT_NAME=chsrc-x86-windows
|
||||
|
||||
- name: List files
|
||||
run: ls *.exe
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-windows.exe
|
||||
chsrc-x86-windows.exe
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
13
.github/workflows/winget.yml
vendored
@ -1,13 +0,0 @@
|
||||
name: Publish to WinGet
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifier: RubyMetric.chsrc
|
||||
installers-regex: '\.exe$' # Only .exe files
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
67
.gitignore
vendored
@ -1,5 +1,19 @@
|
||||
.vscode
|
||||
##############################
|
||||
# VS Code
|
||||
##############################
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
!.vscode/settings.json
|
||||
!.vscode/c_cpp_properties.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/README.md
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# Binaries
|
||||
##############################
|
||||
*.o
|
||||
*.obj
|
||||
*.a
|
||||
@ -9,27 +23,62 @@
|
||||
*.out
|
||||
*.exe
|
||||
|
||||
# target exe name
|
||||
chsrc
|
||||
|
||||
# test files
|
||||
|
||||
##############################
|
||||
# Built executables
|
||||
##############################
|
||||
chsrc
|
||||
chsrc-debug
|
||||
chsrc-release
|
||||
chsrc-ci-release
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# Test files
|
||||
##############################
|
||||
xy
|
||||
fw
|
||||
README.md.bak*
|
||||
|
||||
# Generated when testing (when there's a bug)
|
||||
nul
|
||||
|
||||
# 'chsrc set -local' generated
|
||||
.bundle
|
||||
.npmrc
|
||||
|
||||
# Generated when testing
|
||||
nul
|
||||
|
||||
# Cygwin problem
|
||||
.chsrc_measure_tmp.sh
|
||||
|
||||
# Texinfo
|
||||
##############################
|
||||
# Texinfo
|
||||
##############################
|
||||
chsrc.aux
|
||||
chsrc.log
|
||||
chsrc.toc
|
||||
*.info
|
||||
*.pdf
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# deb package
|
||||
##############################
|
||||
# deb package 未归档的目录
|
||||
pkg/deb/debian/chsrc/
|
||||
|
||||
# 下面这个目录包含创建出 $HOME 的虚拟环境
|
||||
pkg/deb/debian/.debhelper/
|
||||
|
||||
pkg/deb/debian/debhelper-build-stamp
|
||||
pkg/deb/debian/files
|
||||
pkg/deb/debian/chsrc.debhelper.log
|
||||
pkg/deb/debian/chsrc.substvars
|
||||
|
||||
# 以下为 deb package 构建的直接产物
|
||||
chsrc_*.deb
|
||||
chsrc-dbgsym_*.ddeb
|
||||
chsrc_*.build
|
||||
chsrc_*.buildinfo
|
||||
chsrc_*.changes
|
||||
|
18
.vscode/README.md
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (for VS Code users) README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2025-06-18>
|
||||
! Last Modified : <2025-06-20>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# Dev in VS Code
|
||||
|
||||
首先需要安装好 [just](https://github.com/casey/just),而不再硬性需要 `make`
|
||||
|
||||
1. `Ctrl-Shift-B` 直接构建
|
||||
2. `F5` 直接开始 Debug
|
28
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"cStandard": "c17",
|
||||
"intelliSenseMode": "windows-gcc-x64"
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"cStandard": "c17"
|
||||
},
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"cStandard": "c17"
|
||||
}
|
||||
],
|
||||
"enableConfigurationSquiggles": true,
|
||||
"version": 4
|
||||
}
|
11
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode.cpptools",
|
||||
"editorconfig.editorconfig",
|
||||
"redhat.vscode-yaml",
|
||||
"nefrob.vscode-just-syntax"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
34
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "开始Debug",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/chsrc-debug",
|
||||
"args": [
|
||||
"get",
|
||||
"python"
|
||||
],
|
||||
"preLaunchTask": "构建 debug 版 chsrc",
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
// "miDebuggerPath": "/path/to/gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Set Disassembly Flavor to Intel",
|
||||
"text": "-gdb-set disassembly-flavor intel",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
12
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"C_Cpp.intelliSenseEngine": "Tag Parser",
|
||||
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false,
|
||||
"editor.formatOnSave": false,
|
||||
"vscode-just.formatOnSave": false,
|
||||
"[yaml]": {
|
||||
"editor.defaultFormatter": "redhat.vscode-yaml"
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "vscode.json-language-features"
|
||||
}
|
||||
}
|
62
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "构建 chsrc",
|
||||
"command": "just",
|
||||
"args": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "使用 just build 编译"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "构建 debug 版 chsrc",
|
||||
"command": "just",
|
||||
"args": [
|
||||
"build-in-debug-mode"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"detail": "使用 just build-in-debug-mode 编译 debug 版"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "测试 chsrc",
|
||||
"command": "just",
|
||||
"args": [
|
||||
"test"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "使用 just test 测试"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
174
Makefile
Normal file → Executable file
@ -1,14 +1,19 @@
|
||||
#!/usr/bin/make -f
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : Makefile
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
# Build File : Makefile
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
# | sanchuanhehe <wyihe5520@gmail.com>
|
||||
# |
|
||||
# Created On : <2023-08-28>
|
||||
# Last Modified : <2025-03-06>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# 请阅读 ./doc/01-Develop.md 来使用
|
||||
# --------------------------------------------------------------
|
||||
|
||||
#=========== OS Check ================
|
||||
On-Linux = 0
|
||||
On-Windows = 0
|
||||
On-macOS = 0
|
||||
@ -17,12 +22,38 @@ ifeq ($(shell uname), Linux)
|
||||
On-Linux = 1
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname), Darwin)
|
||||
On-macOS = 1
|
||||
endif
|
||||
|
||||
# 只有Windows会定义$(OS)变量
|
||||
ifeq ($(OS), Windows_NT)
|
||||
On-Windows = 1
|
||||
endif
|
||||
#=======================
|
||||
#=====================================
|
||||
|
||||
|
||||
|
||||
#======== Default Tooling ============
|
||||
ifeq ($(On-Windows), 1)
|
||||
# MSYS2 环境
|
||||
CC = cc
|
||||
else ifeq ($(On-macOS), 1)
|
||||
CC = clang
|
||||
else
|
||||
CC = cc
|
||||
endif
|
||||
|
||||
ifeq ($(On-macOS), 1)
|
||||
DEBUGGER = lldb
|
||||
else
|
||||
DEBUGGER = gdb
|
||||
endif
|
||||
#=====================================
|
||||
|
||||
|
||||
|
||||
#======== Compilation Config ==========
|
||||
CFLAGS += -Iinclude -Ilib
|
||||
|
||||
ifeq ($(On-Windows), 1)
|
||||
@ -37,46 +68,101 @@ override WARN += -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-mi
|
||||
-Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare
|
||||
_C_Warning_Flags := $(WARN)
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += -g
|
||||
endif
|
||||
DevMode-Target-Name = chsrc
|
||||
DebugMode-Target-Name = chsrc-debug
|
||||
ReleaseMode-Target-Name = chsrc-release
|
||||
CIReleaseMode-Target-Name = chsrc-ci-release
|
||||
|
||||
DEBUGGER = gdb
|
||||
CFLAGS_debug = -g -DXY_DEBUG
|
||||
CFLAGS_static = -static
|
||||
CFLAGS_optimization = -O2
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += $(CFLAGS_debug)
|
||||
endif
|
||||
|
||||
STATIC = 0
|
||||
#=======================
|
||||
|
||||
Target-Name = chsrc
|
||||
ifeq ($(STATIC), 1)
|
||||
CFLAGS += $(CFLAGS_static)
|
||||
endif
|
||||
#=====================================
|
||||
|
||||
# 由 GitHub Actions 在调用时修改
|
||||
CI_ARTIFACT_NAME = chsrc
|
||||
|
||||
ifeq ($(MAKECMDGOALS), CI)
|
||||
|
||||
#====== CI release mode 的配置 =======
|
||||
ifeq ($(MAKECMDGOALS), build-in-ci-release-mode)
|
||||
CFLAGS += $(CFLAGS_optimization)
|
||||
# 仅在 Linux 上使用静态链接
|
||||
ifeq ($(On-Linux), 1)
|
||||
STATIC = 1
|
||||
CFLAGS += $(CFLAGS_static)
|
||||
endif
|
||||
endif
|
||||
#=======================
|
||||
#=====================================
|
||||
|
||||
|
||||
all:
|
||||
ifeq ($(STATIC), 1)
|
||||
CFLAGS += -static
|
||||
endif
|
||||
|
||||
all:
|
||||
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(Target-Name)
|
||||
@echo; echo Compile done using \'$(CC)\' $(CFLAGS)
|
||||
#============ Aliases ================
|
||||
all: build
|
||||
|
||||
CI: all
|
||||
@mv $(Target-Name) $(CI_ARTIFACT_NAME)
|
||||
b: build-in-dev-mode
|
||||
build: build-in-dev-mode
|
||||
bd: build-in-debug-mode
|
||||
br: build-in-release-mode
|
||||
bcir: build-in-ci-release-mode
|
||||
d: debug
|
||||
t: test
|
||||
check: test
|
||||
c: clean
|
||||
#=====================================
|
||||
|
||||
|
||||
debug: CFLAGS += -g
|
||||
debug: all
|
||||
@$(DEBUGGER) ./chsrc
|
||||
|
||||
test: test-xy test-fw
|
||||
build-in-dev-mode:
|
||||
@echo Starting: Build in DEV mode: \'$(CC)\' $(CFLAGS) -o $(DevMode-Target-Name)
|
||||
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(DevMode-Target-Name)
|
||||
@echo Finished: Build in DEV mode
|
||||
|
||||
build-in-debug-mode: CFLAGS += $(CFLAGS_debug)
|
||||
build-in-debug-mode:
|
||||
@echo Starting: Build in DEBUG mode: \'$(CC)\' $(CFLAGS) -o $(DebugMode-Target-Name)
|
||||
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(DebugMode-Target-Name)
|
||||
@echo Finished: Build in DEBUG mode
|
||||
|
||||
build-in-release-mode: CFLAGS += $(CFLAGS_optimization)
|
||||
build-in-release-mode:
|
||||
@echo Starting: Build in RELEASE mode: \'$(CC)\' $(CFLAGS) -o $(ReleaseMode-Target-Name)
|
||||
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(ReleaseMode-Target-Name)
|
||||
@echo Finished: Build in RELEASE mode
|
||||
|
||||
# CI release mode 的配置在该文件上方
|
||||
build-in-ci-release-mode:
|
||||
@echo Starting: Build in CI-RELEASE mode: \'$(CC)\' $(CFLAGS) -o $(CIReleaseMode-Target-Name)
|
||||
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(CIReleaseMode-Target-Name)
|
||||
@echo Finished: Build in CI-RELEASE mode
|
||||
|
||||
# 永远重新编译
|
||||
debug: build-in-debug-mode
|
||||
@$(DEBUGGER) $(DebugMode-Target-Name)
|
||||
|
||||
test: test-make-env test-xy test-fw
|
||||
|
||||
test-make-env:
|
||||
@echo "On-Linux: $(On-Linux)"
|
||||
@echo "On-Windows: $(On-Windows)"
|
||||
@echo "On-macOS: $(On-macOS)"
|
||||
@echo "CC: $(CC)"
|
||||
@echo "CFLAGS: $(CFLAGS)"
|
||||
@echo "USER: $$(whoami)"
|
||||
@echo "PWD: $(shell pwd)"
|
||||
@echo "UID: $$(id -u)"
|
||||
@echo "GID: $$(id -g)"
|
||||
# 检查HOME环境变量
|
||||
@if [ -z "$(HOME)" ]; then \
|
||||
echo "HOME environment variable is not set!"; \
|
||||
else \
|
||||
echo "HOME: $(HOME)"; \
|
||||
fi
|
||||
|
||||
test-xy:
|
||||
@$(CC) test/xy.c $(CFLAGS) -o xy
|
||||
@ -86,16 +172,38 @@ test-fw:
|
||||
@$(CC) test/fw.c $(CFLAGS) -o fw
|
||||
@./fw
|
||||
|
||||
check: test
|
||||
|
||||
# AUR package 安装时将执行此 target
|
||||
fastcheck: $(Target-Name)
|
||||
fastcheck: $(DevMode-Target-Name)
|
||||
@perl ./test/cli.pl fastcheck
|
||||
|
||||
test-cli: $(Target-Name)
|
||||
test-cli: $(DevMode-Target-Name)
|
||||
@perl ./test/cli.pl
|
||||
|
||||
clean:
|
||||
-@rm *.exe 2>/dev/null
|
||||
-@rm xy 2>/dev/null
|
||||
-@rm fw 2>/dev/null
|
||||
-@rm chsrc 2>/dev/null
|
||||
-@rm README.md.bak* 2>/dev/null
|
||||
-@rm README.md.bak* 2>/dev/null
|
||||
|
||||
-@rm chsrc 2>/dev/null
|
||||
-@rm chsrc-debug 2>/dev/null
|
||||
-@rm chsrc-release 2>/dev/null
|
||||
-@rm chsrc-ci-release 2>/dev/null
|
||||
|
||||
# -include pkg/deb/Makefile # 不这么做,因为 pkg/deb/Makefile 需要在 pkg/deb 目录下执行
|
||||
# 保持动词在前的任务名风格
|
||||
build-deb:
|
||||
@$(MAKE) -C pkg/deb deb-build
|
||||
|
||||
clean-deb:
|
||||
@$(MAKE) -C pkg/deb deb-clean
|
||||
|
||||
install: $(ReleaseMode-Target-Name)
|
||||
install -D -m 755 $(ReleaseMode-Target-Name) $(DESTDIR)/usr/bin/chsrc
|
||||
install -D -m 644 doc/chsrc.1 $(DESTDIR)/usr/share/man/man1/chsrc.1
|
||||
|
||||
.PHONY: all b build bd br bcir d t check c \
|
||||
build-in-dev-mode build-in-debug-mode build-in-release-mode build-in-ci-release-mode \
|
||||
debug test test-make-env test-xy test-fw fastcheck test-cli clean install build-deb clean-deb
|
||||
|
79
README.md
@ -1,10 +1,22 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
! |
|
||||
! Created On : <2023-12-28>
|
||||
! Last Modified : <2025-06-20>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
<div align="center">
|
||||
<img alt="chsrc logo" src="image/chsrc.png"/>
|
||||
<img alt="chsrc logo" src="doc/image/chsrc.png"/>
|
||||
</div>
|
||||
|
||||
全平台通用换源工具与框架 `chsrc`,**目标支持 Linux, Windows (MSYS2, Cygwin), macOS, BSD 等尽可能多的操作系统环境,龙芯、飞腾、RISC-V 等尽可能多的 CPU**。
|
||||
|
||||
我们使用 **C99** 来完成上述目标。我们并不使用 Python 或 JS 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。
|
||||
我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JS 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。
|
||||
|
||||
本软件为**自由软件**,SDPX 软件许可证为 `GPL-3.0-or-later and MIT`
|
||||
|
||||
@ -28,20 +40,27 @@
|
||||
> [!TIP]
|
||||
> **`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架,它甚至使你能够在不了解C语言的情况下编写出新的换源方法(recipe)。** [Write A Recipe Even If You Don't Know C](./doc/02-Write-A-Recipe-Even-If-You-Dont-Know-C.md)
|
||||
|
||||
---
|
||||
|
||||
> [!NOTE]
|
||||
> **`chsrc` 可换源 60+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助**。欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者参与贡献。[从开发到提交贡献,我们覆盖全流程文档](./doc/)
|
||||
,另外作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50)
|
||||
> 这是你可以参与的第一个现实世界中有用的C语言项目,[用 VS Code 一分钟内上手编译、运行、测试 chsrc ](./doc/01-Develop.md)
|
||||
>
|
||||
> 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR,我们覆盖全流程文档](./doc/)
|
||||
,作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50)
|
||||
---
|
||||
|
||||
> [!IMPORTANT]
|
||||
> [招募 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130)
|
||||
> **`chsrc` 可换源 60+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130)
|
||||
|
||||
<br>
|
||||
|
||||
可参与的任务与挑战:
|
||||
|
||||
1. [提供默认源地址,如Maven等的默认源URL,帮助我们进行 `chsrc reset`](https://github.com/RubyMetric/chsrc/issues/111)
|
||||
1. [Shell auto-completion 终端命令自动补全](https://github.com/RubyMetric/chsrc/issues/204)
|
||||
|
||||
2. [CentOS (Stream) Recipe](https://github.com/RubyMetric/chsrc/issues/48)
|
||||
2. [搜集默认源地址,帮助使用 `reset` 功能](https://github.com/RubyMetric/chsrc/issues/111)
|
||||
|
||||
3. [搜集测速地址,帮助使用 `measure` 功能](https://github.com/RubyMetric/chsrc/issues/205)
|
||||
|
||||
<br>
|
||||
|
||||
@ -54,20 +73,18 @@
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details>
|
||||
<summary>镜像站可用性</summary>
|
||||
|
||||
1. https://github.com/RubyMetric/chsrc/wiki
|
||||
2. https://github.com/RubyMetric/chsrc/discussions
|
||||
1. <https://github.com/RubyMetric/chsrc/wiki>
|
||||
2. <https://github.com/RubyMetric/chsrc/discussions>
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details>
|
||||
<summary>打包</summary>
|
||||
|
||||
想通过 `flatpak`,`snap`,`pacman`,`apt`,`dnf` 等系统包管理工具来安装和更新`chsrc`?若您可提供维护,请访问 [issue#16 on GitHub](https://github.com/RubyMetric/chsrc/issues/16)
|
||||
想通过 `dnf`, `flatpak`, `snap` 等系统包管理工具来安装和更新`chsrc`?若您可提供维护,请访问 [issue#16 on GitHub](https://github.com/RubyMetric/chsrc/issues/16)
|
||||
|
||||
- [x] `Homebrew`
|
||||
- [x] `Scoop`
|
||||
@ -84,7 +101,7 @@
|
||||
## 📌 示例
|
||||
|
||||
<div align="center">
|
||||
<img alt="chsrc set node" src="image/example-set-nodejs.png"/>
|
||||
<img alt="chsrc set node" src="doc/image/example-set-nodejs.png"/>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@ -104,7 +121,7 @@
|
||||
- 可通过 `scoop` 安装,感谢 [@Gn3po4g] 与 [@niheaven]
|
||||
|
||||
```bash
|
||||
$ scoop install chsrc
|
||||
scoop install chsrc
|
||||
```
|
||||
|
||||
<br>
|
||||
@ -112,7 +129,7 @@ $ scoop install chsrc
|
||||
- 可通过 `WinGet` 安装,感谢 [@YU-7]
|
||||
|
||||
```bash
|
||||
$ winget install RubyMetric.chsrc
|
||||
winget install RubyMetric.chsrc
|
||||
```
|
||||
|
||||
<br>
|
||||
@ -136,11 +153,25 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-windo
|
||||
# x86
|
||||
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x86-windows.exe -o chsrc.exe
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Linux</summary>
|
||||
|
||||
- 可通过 `apt`/`dpkg` 安装,感谢 [@sanchuanhehe]
|
||||
|
||||
```bash
|
||||
# x64
|
||||
$ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc_latest-1_amd64.deb -o chsrc_latest-1_amd64.deb
|
||||
|
||||
$ sudo apt install ./chsrc_latest-1_amd64.deb
|
||||
# 或
|
||||
$ sudo sudo dpkg -i chsrc_latest-1_amd64.deb
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
- 支持 `AUR`,可通过 `yay` 安装,感谢 [@Jerry-Terrasse]
|
||||
|
||||
```bash
|
||||
@ -196,7 +227,7 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-armv7-lin
|
||||
- 可通过 `homebrew` 安装,感谢 [@Aaron-212] 与 [@chenrui333]
|
||||
|
||||
```bash
|
||||
$ brew install chsrc
|
||||
brew install chsrc
|
||||
```
|
||||
|
||||
<br>
|
||||
@ -230,23 +261,26 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-aarch64-m
|
||||
# x64
|
||||
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-macos -o chsrc; chmod +x ./chsrc
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>BSD</summary>
|
||||
|
||||
```bash
|
||||
$ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc
|
||||
$ clang -Iinclude -Ilib src/chsrc-main.c -o chsrc
|
||||
git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc
|
||||
clang -Iinclude -Ilib src/chsrc-main.c -o chsrc
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>其他平台</summary>
|
||||
|
||||
```bash
|
||||
$ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make
|
||||
git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>
|
||||
@ -424,6 +458,7 @@ chsrc set conda | anaconda
|
||||
## ❤️ 致谢
|
||||
|
||||
感谢各个镜像站提供的优质免费镜像服务
|
||||
|
||||
1. [mirror.c](./src/framework/mirror.c) 包含了通用的镜像站信息
|
||||
2. 各个recipe内部定义的专用镜像站
|
||||
|
||||
@ -445,16 +480,12 @@ chsrc set conda | anaconda
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
[@Aaron-212]: https://github.com/Aaron-212
|
||||
[@chenrui333]: https://github.com/chenrui333
|
||||
[@niheaven]: https://github.com/niheaven
|
||||
[@Gn3po4g]: https://github.com/Gn3po4g
|
||||
[@Jerry-Terrasse]: https://github.com/Jerry-Terrasse
|
||||
[@ccmywish]: https://github.com/ccmywish
|
||||
[@Efterklang]: https://github.com/Efterklang
|
||||
[@wickdynex]: https://github.com/wickdynex
|
||||
[@YU-7]: https://github.com/YU-7
|
||||
|
||||
[issue#98 on GitHub]: https://github.com/RubyMetric/chsrc/issues/98
|
||||
[@sanchuanhehe]: https://github.com/sanchuanhehe
|
||||
|
@ -7,59 +7,133 @@
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2024-12-27>
|
||||
! Last Modified : <2025-03-06>
|
||||
! Last Modified : <2025-06-20>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 开发
|
||||
# 开发 chsrc
|
||||
|
||||
## 环境
|
||||
## 依赖与开发环境
|
||||
|
||||
请安装好 `GCC` 或 `Clang` 和 `make` 以及 `curl`
|
||||
请安装好:
|
||||
|
||||
1. `GCC` 或 `Clang`
|
||||
2. [just] 或 `make`
|
||||
3. `curl`
|
||||
|
||||
**我推荐你使用 VS Code 开发,你可以在一分钟内成功编译、运行和 Debug `chsrc`**
|
||||
|
||||
1. `Ctrl-Shift-B` 直接构建
|
||||
2. `F5` 直接开始 Debug
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 获取代码
|
||||
|
||||
**请务必使用 dev 分支开发**
|
||||
|
||||
```bash
|
||||
# 请务必使用 dev 分支开发
|
||||
$ git clone https://gitee.com/RubyMetric/chsrc.git -b dev
|
||||
git clone https://gitee.com/RubyMetric/chsrc.git -b dev
|
||||
```
|
||||
|
||||
关于分支的说明,可参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 编译运行
|
||||
|
||||
```bash
|
||||
$ make # 默认使用 cc 编译
|
||||
$ make CC=clang # 使用 clang 编译
|
||||
$ make CC=gcc # 使用 gcc 编译
|
||||
```
|
||||
共有四种构建模式:
|
||||
|
||||
1. **`DEV mode`**
|
||||
2. **`DEBUG mode`**
|
||||
3. **`RELEASE mode`**
|
||||
4. **`CI-RELEASE mode`**
|
||||
|
||||
第四种只在 GitHub Actions 使用,一般只需要前三者;而在开发时你仅需要前两者;如果不需要 Debug,仅仅第一个 **DEV mode** 就够了。
|
||||
|
||||
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建**
|
||||
|
||||
```bash
|
||||
# 重新编译并启动 GDB 调试
|
||||
$ make debug
|
||||
just (b) # 在Windows上默认使用 gcc 编译,在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
|
||||
just CC=clang # 使用 clang 编译
|
||||
just CC=gcc # 使用 gcc 编译
|
||||
|
||||
# 重新编译并启动 LLDB 调试
|
||||
$ make debug DEBUGGER=lldb
|
||||
|
||||
# 如果需要单独生成含有编译信息的二进制文件(这个不会自己启动debugger)
|
||||
$ make DEBUG=1
|
||||
# 编译出 debug 版本: chsrc-debug
|
||||
just bd
|
||||
# 编译出 release 版本: chsrc-release
|
||||
just br
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
`make` 用户:
|
||||
|
||||
```bash
|
||||
make (b) # 在Windows上默认使用 cc 编译,在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
|
||||
make CC=clang # 使用 clang 编译
|
||||
make CC=gcc # 使用 gcc 编译
|
||||
|
||||
# 编译出 debug 版本: chsrc-debug
|
||||
make bd
|
||||
# 编译出 release 版本: chsrc-release
|
||||
make br
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## Debug
|
||||
|
||||
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 F5 即可立即开始 Debug**
|
||||
|
||||
```bash
|
||||
# 重新编译出 ./chsrc-debug,并启动 GDB 调试 (在macOS上启动 LLDB 调试)
|
||||
$ just debug
|
||||
|
||||
# 重新编译出 ./chsrc-debug,并启动 LLDB 调试
|
||||
$ just DEBUGGER=lldb debug
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
`make` 用户:
|
||||
|
||||
```bash
|
||||
# 重新编译出 ./chsrc-debug,并启动 GDB 调试 (在macOS上启动 LLDB 调试)
|
||||
$ make debug
|
||||
|
||||
# 重新编译出 ./chsrc-debug,并启动 LLDB 调试
|
||||
$ make debug DEBUGGER=lldb
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 测试
|
||||
|
||||
`just` 用户只需要替换下述 `make` 为 `just`
|
||||
|
||||
```bash
|
||||
$ make test-xy # 测试 xy.h
|
||||
$ make test-fw # 测试 framework
|
||||
$ make test # 测试上述两个
|
||||
$ make test-cli # 测试命令
|
||||
$ make clean
|
||||
make test-xy # 测试 xy.h
|
||||
make test-fw # 测试 framework
|
||||
make test # 测试上述两个
|
||||
make test-cli # 测试命令
|
||||
make clean
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
## 提交 PR
|
||||
|
||||
关于分支的说明以及如何提交代码,请参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
|
||||
|
||||
<br>
|
||||
|
||||
[just]: https://github.com/casey/just
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
# Write A Recipe Even If You Don't Know C
|
||||
|
||||
# 介绍
|
||||
## 介绍
|
||||
|
||||
**`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架,它甚至使你能够在不了解C语言的情况下编写出新的换源方法(recipe)。**
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
6. 已有大量 `recipe` 可提供参考,并提供了 [recipe template] 供直接使用
|
||||
7. 提供持续关注镜像站可用性的协作平台:
|
||||
|
||||
1. https://github.com/RubyMetric/chsrc/wiki
|
||||
2. https://github.com/RubyMetric/chsrc/discussions
|
||||
1. <https://github.com/RubyMetric/chsrc/wiki>
|
||||
2. <https://github.com/RubyMetric/chsrc/discussions>
|
||||
|
||||
<br>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
<br>
|
||||
|
||||
# 基本概念
|
||||
## 基本概念
|
||||
|
||||
1. `target`: 所要换源的目标
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
<br>
|
||||
|
||||
# 编写 `recipe` 步骤
|
||||
## 编写 `recipe` 步骤
|
||||
|
||||
1. 确定你要编写的 `target` 的标准名称,创建 `Target-Name.c` 文件
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
<br>
|
||||
|
||||
# 开发准则
|
||||
## 开发准则
|
||||
|
||||
1. 代码高度可移植
|
||||
|
||||
|
@ -10,12 +10,10 @@
|
||||
|
||||
**目前项目的发展阶段还处于 *外行实现内行* 的情况,比如 Homebrew recipe,实现者根本不是 Homebrew 的真实用户,只是根据各种文档来实现,然后等待用户反馈。所以这里当前的实现者最多只能是 Maintainer,无法承担 Director 的责任**
|
||||
|
||||
|
||||
2. **Maintainers**
|
||||
|
||||
维护者:实现和持续维护 recipe,需要和 Director 一起 review 代码。可参考 [03-CONTRIBUTING.md](./03-CONTRIBUTING.md) 了解项目是如何进行提交和审阅代码的
|
||||
|
||||
|
||||
3. **Observers**
|
||||
|
||||
观察者:对该 target 和 recipe 持续反馈和关注的用户。如果你觉得你无法承担作为维护者的责任,可以退而求其次作为观察者积极参与其中
|
||||
@ -28,7 +26,6 @@
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## Framework
|
||||
|
||||
1. **Director**: `@ccmywish` `@gitee:G_I_Y`
|
||||
@ -37,80 +34,94 @@
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 编程语言
|
||||
|
||||
### Ruby
|
||||
|
||||
1. **Director**: `@ccmywish`
|
||||
2. **Maintainers**:
|
||||
3. **Observers**:
|
||||
|
||||
### Python
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@happy-game`
|
||||
3. **Observers**:
|
||||
|
||||
### NodeJS
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@happy-game`
|
||||
3. **Observers**:
|
||||
|
||||
### Perl
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### PHP
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Go
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Rust
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Java
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Clojure
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**:
|
||||
3. **Observers**:
|
||||
|
||||
### NuGet
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**:
|
||||
3. **Observers**:
|
||||
|
||||
### Dart
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Haskell
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### OCaml
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### R
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**: `@gitee:tfcolin`
|
||||
|
||||
### Julia
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
@ -120,166 +131,197 @@
|
||||
## 操作系统
|
||||
|
||||
### Ubuntu
|
||||
|
||||
1. **Director**: `@ccmywish`
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**: `@wickdynex`
|
||||
|
||||
### Debian
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@gitee:G_I_Y`
|
||||
3. **Observers**: `@happy-game`
|
||||
|
||||
### Fedora
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@gitee:G_I_Y` `@happy-game`
|
||||
3. **Observers**:
|
||||
|
||||
### Kali
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### Linux Mint
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### Armbian
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Raspberry Pi OS
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### ROS
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Trisquel
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Arch
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@gitee:G_I_Y` `@happy-game`
|
||||
3. **Observers**:
|
||||
|
||||
### Manjaro
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### msys2
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Alpine
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### OpenWrt
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**: `@happy-game`
|
||||
|
||||
### Gentoo
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### Void Linux
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### deepin
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### OpenKylin
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### OpenEuler
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y`
|
||||
3. **Observers**:
|
||||
|
||||
### FreeBSD
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**: `@ykla`
|
||||
|
||||
### NetBSD
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### OpenBSD
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@gitee:G_I_Y` `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
## 软件
|
||||
|
||||
### Homebrew
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**: `@wickdynex`
|
||||
|
||||
### WinGet
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Flathub
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Nix
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Guix
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### CocoaPods
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Docker Hub
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish` `@happy-game`
|
||||
3. **Observers**:
|
||||
|
||||
### Anaconda
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**: `@happy-game`
|
||||
|
||||
### Emacs
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
||||
### Tex Live
|
||||
|
||||
1. **Director**:
|
||||
2. **Maintainers**: `@ccmywish`
|
||||
3. **Observers**:
|
||||
|
@ -6,10 +6,10 @@
|
||||
.\" Contributors : Nul None <nul@none.org>
|
||||
.\" |
|
||||
.\" Created On : <2024-08-21>
|
||||
.\" Last Modified : <2024-10-09>
|
||||
.\" Last Modified : <2025-06-16>
|
||||
.\" --------------------------------------------------------------
|
||||
|
||||
.TH chsrc 1 "2024-10-09" "v0.1.9" "RubyMetric chsrc"
|
||||
.TH chsrc 1 "2025-06-16" "v0.2.1.2" "RubyMetric chsrc"
|
||||
|
||||
.SH NAME
|
||||
chsrc - Change Source for every software on every platform from the command line
|
||||
@ -62,7 +62,7 @@ chsrc - Change Source for every software on every platform from the command line
|
||||
.B set \fI<target>\fR \fI<mirror>\fR
|
||||
换源,指定使用某镜像站 (通过list <target>查看)
|
||||
.TP
|
||||
.B set \fI<target>\fR \fU<https://url>\fR
|
||||
.B set \fI<target>\fR \fI<https://url>\fR
|
||||
换源,用户自定义源URL
|
||||
.TP
|
||||
.B reset \fI<target>\fR
|
||||
|
@ -6,15 +6,15 @@
|
||||
@c Contributors : Nul None <nul@none.org>
|
||||
@c |
|
||||
@c Created On : <2024-08-22>
|
||||
@c Last Modified : <2024-10-09>
|
||||
@c Last Modified : <2025-06-19>
|
||||
@c --------------------------------------------------------------
|
||||
|
||||
\input texinfo
|
||||
@setfilename chsrc.info
|
||||
@settitle chsrc
|
||||
|
||||
@set Chsrc_Version v0.1.9
|
||||
@set Doc_Publish_Date 2024-10-09
|
||||
@set Chsrc_Version v0.2.1.2
|
||||
@set Doc_Publish_Date 2025-06-19
|
||||
|
||||
@copying
|
||||
@comment 这是软件copyright,不是文档copyright,因此不放在titlepage
|
||||
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
147
justfile
Normal file
@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env just --justfile
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : justfile
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2025-06-18>
|
||||
# Last Modified : <2025-06-20>
|
||||
#
|
||||
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
|
||||
# GNU make 以及相应的 MSYS2、Cygwin 环境
|
||||
# --------------------------------------------------------------
|
||||
# just (build) -> chsrc.exe
|
||||
# just bd (build-in-debug-mode) -> chsrc-debug.exe
|
||||
# just br (build-in-release-mode) -> chsrc-release.exe
|
||||
# just debug
|
||||
# just test
|
||||
# just clean
|
||||
#
|
||||
# just STATIC=1 br 静态链接 (注意只能在 br 任务中使用)
|
||||
#
|
||||
# 不支持 just DEBUG=1,请直接使用 just bd (等价于 just build-in-debug-mode)
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
# 注意,由于我们要在 GitHub Actions 上编译 x32 版的 chsrc,所以需要使用 make,
|
||||
# 而不清楚 just 在 MINGW32 中的情况,所以我们在此 justfile 中并不实现关于 CI 的功能
|
||||
# --------------------------------------------------------------
|
||||
|
||||
set windows-shell := ['cmd', '/c']
|
||||
|
||||
CC := if os() == 'windows' {
|
||||
"gcc"
|
||||
} else if os() == 'macos' {
|
||||
"clang"
|
||||
} else {
|
||||
"cc"
|
||||
}
|
||||
|
||||
DEBUGGER := if os() == 'windows' {
|
||||
"gdb"
|
||||
} else if os() == 'macos' {
|
||||
"lldb"
|
||||
} else {
|
||||
"gdb"
|
||||
}
|
||||
|
||||
CFLAGS_chk_Clang := if os() == 'windows' {
|
||||
if CC == 'clang' {
|
||||
'-target x86_64-pc-windows-gnu'
|
||||
} else {''}
|
||||
} else {''}
|
||||
|
||||
|
||||
CFLAGS_base := '-Iinclude -Ilib ' + CFLAGS_chk_Clang
|
||||
|
||||
WARN := '-Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-missing-braces -Wno-misleading-indentation' + ' ' + \
|
||||
'-Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare'
|
||||
CFLAGS_warn := WARN
|
||||
|
||||
|
||||
CFLAGS_debug := '-g -DXY_DEBUG'
|
||||
|
||||
DevMode-Target-Name := 'chsrc'
|
||||
DebugMode-Target-Name := 'chsrc-debug'
|
||||
ReleaseMode-Target-Name := 'chsrc-release'
|
||||
|
||||
STATIC := '0'
|
||||
|
||||
CFLAGS_static := "-static"
|
||||
|
||||
CFLAGS_chk_static := if STATIC == '1' {
|
||||
CFLAGS_static
|
||||
} else { "" }
|
||||
|
||||
|
||||
CFLAGS_optimization := "-O2"
|
||||
|
||||
|
||||
CFLAGS_dev_mode_prompt := CFLAGS_base
|
||||
CFLAGS_debug_mode_prompt := CFLAGS_base + ' ' + CFLAGS_debug
|
||||
CFLAGS_release_mode_prompt := CFLAGS_base + ' ' + CFLAGS_optimization + ' ' + CFLAGS_chk_static
|
||||
|
||||
CFLAGS_dev_mode := CFLAGS_dev_mode_prompt + ' ' + CFLAGS_warn
|
||||
CFLAGS_debug_mode := CFLAGS_debug_mode_prompt + ' ' + CFLAGS_warn
|
||||
CFLAGS_release_mode := CFLAGS_release_mode_prompt + ' ' + CFLAGS_warn
|
||||
|
||||
#=======================
|
||||
|
||||
BIN_xy := if os() == 'windows' {'xy.exe'} else {'./xy'}
|
||||
BIN_fw := if os() == 'windows' {'fw.exe'} else {'./fw'}
|
||||
BIN_rm := if os() == 'windows' {'del'} else {'rm'}
|
||||
#=======================
|
||||
alias b := build-in-dev-mode
|
||||
alias bd:= build-in-debug-mode
|
||||
alias br:= build-in-release-mode
|
||||
alias build:=build-in-dev-mode
|
||||
alias d := debug
|
||||
alias t := test
|
||||
alias check := test
|
||||
alias c := clean
|
||||
|
||||
default: build-in-dev-mode
|
||||
|
||||
build-in-dev-mode:
|
||||
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
|
||||
@echo Finished: Build in DEV mode
|
||||
|
||||
build-in-debug-mode:
|
||||
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_debug_mode}} -o {{DebugMode-Target-Name}}
|
||||
@echo Finished: Build in DEBUG mode
|
||||
|
||||
build-in-release-mode:
|
||||
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}}
|
||||
@echo Finished: Build in RELEASE mode
|
||||
|
||||
debug: build-in-debug-mode
|
||||
@{{DEBUGGER}} {{DebugMode-Target-Name}}
|
||||
|
||||
test: test-xy test-fw
|
||||
|
||||
test-xy:
|
||||
@{{CC}} test/xy.c {{CFLAGS_dev_mode}} -o xy
|
||||
@{{BIN_xy}}
|
||||
|
||||
test-fw:
|
||||
@{{CC}} test/fw.c {{CFLAGS_dev_mode}} -o fw
|
||||
@{{BIN_fw}}
|
||||
|
||||
fastcheck:
|
||||
@perl ./test/cli.pl fastcheck
|
||||
|
||||
test-cli:
|
||||
@perl ./test/cli.pl
|
||||
|
||||
clean:
|
||||
-@{{BIN_rm}} *.exe
|
||||
-@{{BIN_rm}} xy
|
||||
-@{{BIN_rm}} fw
|
||||
-@{{BIN_rm}} chsrc
|
||||
-@{{BIN_rm}} chsrc-debug
|
||||
-@{{BIN_rm}} chsrc-release
|
||||
-@{{BIN_rm}} README.md.bak*
|
121
lib/xy.h
@ -2,23 +2,33 @@
|
||||
* Copyright © 2023-2025 Aoran Zeng, Heng Guo
|
||||
* SPDX-License-Identifier: MIT
|
||||
* -------------------------------------------------------------
|
||||
* Lib Name : xy.h
|
||||
* Lib Name : xy.h
|
||||
* Lib Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* Contributors : juzeon <skyjuzheng@gmail.com>
|
||||
* |
|
||||
* Created On : <2023-08-28>
|
||||
* Last Modified : <2024-12-14>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* xy: 襄阳、咸阳
|
||||
* Corss-Platform C utilities for CLI applications in Ruby flavor
|
||||
* Corss-Platform C11 utilities for CLI applications in mixed flavor:
|
||||
* Ruby、Perl、Raku、HTML、Python、just、etc
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#ifndef XY_H
|
||||
#define XY_H
|
||||
|
||||
#define _XY_Version "v0.1.4.4-2024/12/14"
|
||||
#define _XY_Maintain_URL "https://gitee.com/RubyMetric/chsrc/blob/main/include/xy.h"
|
||||
#define _XY_Version "v0.1.5.0-2025/06/20"
|
||||
#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/main/lib/xy.h"
|
||||
#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/main/lib/xy.h"
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ < 201112L
|
||||
# error "xy.h requires C11 or later, please use a new compiler which at least supports C11"
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ < 201710L
|
||||
# warning "xy.h recommends a C17 or later compiler"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
@ -29,6 +39,17 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ >= 202311
|
||||
#define XY_Dreprecate_This(msg) [[deprecated(msg)]]
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define XY_Deprecate_This(msg) __attribute__((deprecated(msg)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define XY_Deprecate_This(msg) __declspec(deprecated(msg))
|
||||
#else
|
||||
#define XY_Deprecate_This(msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* Global */
|
||||
bool xy_enable_color = true;
|
||||
|
||||
@ -72,21 +93,58 @@ bool xy_enable_color = true;
|
||||
#define xy_useutf8()
|
||||
#endif
|
||||
|
||||
void putf (double n) { printf ("%f\n", n); }
|
||||
void puti (long long n) { printf ("%lld\n", n); }
|
||||
void putb (bool n) { if (n) puts ("true"); else puts ("false"); }
|
||||
void print (const char *s) { printf ("%s", s); }
|
||||
void println (const char *s) { printf ("%s\n", s); }
|
||||
void say (const char *s) { printf ("%s\n", s); }
|
||||
void br () { puts (""); }
|
||||
void p (const char *s) { printf ("%s\n", s); }
|
||||
|
||||
#define assert_str(a, b) assert (xy_streql ((a), (b)))
|
||||
|
||||
#define xy_unsupported() assert(!"Unsuppoted")
|
||||
#define xy_unimplemented() assert(!"Unimplemented temporarily")
|
||||
#define xy_unreached() assert(!"This code shouldn't be reached")
|
||||
|
||||
static void _xy_print_int (int n) {printf ("%d", n);}
|
||||
static void _xy_print_long (long n) {printf ("%ld", n);}
|
||||
static void _xy_print_long_long (long long n) {printf ("%lld", n);}
|
||||
static void _xy_print_float (float n) {printf ("%f", n);}
|
||||
static void _xy_print_double (double n) {printf ("%f", n);}
|
||||
static void _xy_print_bool (bool b) {printf("%s", (b) ? "true" : "false");}
|
||||
static void _xy_print_str (char *str) {printf ("%s", str);}
|
||||
static void _xy_print_const_str (const char *str) {printf ("%s", str);}
|
||||
|
||||
static void _xy_println_int (int n) {printf ("%d\n", n);}
|
||||
static void _xy_println_long (long n) {printf ("%ld\n", n);}
|
||||
static void _xy_println_long_long (long long n) {printf ("%lld\n", n);}
|
||||
static void _xy_println_float (float n) {printf ("%f\n", n);}
|
||||
static void _xy_println_double (double n) {printf ("%f\n", n);}
|
||||
static void _xy_println_bool (bool b) {printf("%s\n", (b) ? "true" : "false");}
|
||||
static void _xy_println_str (char *str) {printf ("%s\n", str);}
|
||||
static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
|
||||
|
||||
#define print(x) _Generic((x), \
|
||||
int: _xy_print_int, \
|
||||
long: _xy_print_long, \
|
||||
long long: _xy_print_long_long, \
|
||||
float: _xy_print_float, \
|
||||
double: _xy_print_double, \
|
||||
bool: _xy_print_bool, \
|
||||
char *: _xy_print_str, \
|
||||
const char *: _xy_print_const_str, \
|
||||
default: assert(!"Unsupported type for print()!") \
|
||||
)(x)
|
||||
|
||||
#define println(x) _Generic((x), \
|
||||
int: _xy_println_int, \
|
||||
long: _xy_println_long, \
|
||||
long long: _xy_println_long_long, \
|
||||
float: _xy_println_float, \
|
||||
double: _xy_println_double, \
|
||||
bool: _xy_println_bool, \
|
||||
char *: _xy_println_str, \
|
||||
const char *: _xy_println_const_str, \
|
||||
default: assert(!"Unsupported type for println()/say()!") \
|
||||
)(x)
|
||||
#define say println
|
||||
|
||||
void br () { puts (""); }
|
||||
void p (const char *s) { printf ("%s\n", s); }
|
||||
|
||||
#define xy_arylen(x) (sizeof (x) / sizeof (x[0]))
|
||||
|
||||
static inline void *
|
||||
@ -646,6 +704,41 @@ xy_run (const char *cmd, unsigned long n)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* cross OS
|
||||
******************************************************/
|
||||
|
||||
/**
|
||||
* 该函数同 just 中的 os_family(),只区分 windows, unix
|
||||
*
|
||||
* @return 返回 "windows" 或 "unix"
|
||||
*/
|
||||
#define xy_os_family _xy_os_family ()
|
||||
static char *
|
||||
_xy_os_family ()
|
||||
{
|
||||
if (xy_on_windows)
|
||||
return "windows";
|
||||
else
|
||||
return "unix";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 该函数返回所在 os family 的对应字符串
|
||||
*/
|
||||
static const char *
|
||||
xy_os_depend_str (const char *str_for_win, const char *str_for_unix)
|
||||
{
|
||||
if (xy_on_windows)
|
||||
return str_for_win;
|
||||
else
|
||||
return str_for_unix;
|
||||
}
|
||||
|
||||
|
||||
#define xy_os_home _xy_os_home ()
|
||||
static char *
|
||||
_xy_os_home ()
|
||||
|
36
pkg/AUR/README.md
Normal file
@ -0,0 +1,36 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! |
|
||||
! Created On : <2025-06-15>
|
||||
! Last Modified : <2025-06-16>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# AUR package
|
||||
|
||||
本文档说明了 `chsrc` 项目的 AUR 包的相关情况
|
||||
|
||||
<br>
|
||||
|
||||
## 相关文件
|
||||
|
||||
CI 维护者 [@Jerry-Terrasse](https://github.com/Jerry-Terrasse)
|
||||
|
||||
- [.github/workflows/pub-AUR-chsrc-git.yml](../../.github/workflows/pub-AUR-chsrc-git.yml)
|
||||
- [.github/workflows/pub-AUR-chsrc-and-chsrc-bin.yml`](../../.github/workflows/pub-AUR-chsrc-git.yml)
|
||||
|
||||
<br>
|
||||
|
||||
## 分发
|
||||
|
||||
位于 https://aur.archlinux.org/packages
|
||||
|
||||
- [chsrc-bin](https://aur.archlinux.org/packages/chsrc-bin): 从 GitHub Releases 直接下载的二进制文件
|
||||
|
||||
- [chsrc](https://aur.archlinux.org/packages/chsrc):从 GitHub Releases 的代码构建
|
||||
|
||||
- [chsrc-git](https://aur.archlinux.org/packages/chsrc-git):从最新源码构建的版本,偶尔可能不稳定
|
@ -1,6 +1,6 @@
|
||||
# Packages
|
||||
|
||||
https://github.com/RubyMetric/chsrc/issues/16
|
||||
## 分发情况
|
||||
|
||||
- [x] `Homebrew`
|
||||
- [x] `Scoop`
|
||||
@ -10,6 +10,8 @@ https://github.com/RubyMetric/chsrc/issues/16
|
||||
- [ ] `snap`
|
||||
- [ ] ...
|
||||
|
||||
<br>
|
||||
|
||||
```bash
|
||||
$ brew install chsrc
|
||||
|
||||
@ -24,22 +26,31 @@ yay -S chsrc-git # Build from the latest main branch (stable)
|
||||
|
||||
<br>
|
||||
|
||||
# Homebrew
|
||||
- Homebrew
|
||||
|
||||
https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/chsrc.rb
|
||||
https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/chsrc.rb
|
||||
|
||||
# Scoop
|
||||
- Scoop
|
||||
|
||||
https://github.com/ScoopInstaller/Main/blob/master/bucket/chsrc.json
|
||||
https://github.com/ScoopInstaller/Main/blob/master/bucket/chsrc.json
|
||||
|
||||
# WinGet
|
||||
- WinGet
|
||||
|
||||
https://github.com/microsoft/winget-pkgs/tree/master/manifests/r/RubyMetric/chsrc
|
||||
https://github.com/microsoft/winget-pkgs/tree/master/manifests/r/RubyMetric/chsrc
|
||||
|
||||
# AUR
|
||||
- AUR:
|
||||
|
||||
[chsrc-bin](https://aur.archlinux.org/packages/chsrc-bin): 从GitHub Release直接下载的二进制文件
|
||||
- https://aur.archlinux.org/packages/chsrc-bin
|
||||
|
||||
[chsrc](https://aur.archlinux.org/packages/chsrc):从GitHub Release的代码构建
|
||||
- https://aur.archlinux.org/packages/chsrc
|
||||
|
||||
[chsrc-git](https://aur.archlinux.org/packages/chsrc-git):从最新源码构建的版本,偶尔可能不稳定
|
||||
- https://aur.archlinux.org/packages/chsrc-git
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 打包情况
|
||||
|
||||
- [x] `deb`
|
||||
|
||||
<br>
|
||||
|
126
pkg/deb/BUILD.md
Normal file
@ -0,0 +1,126 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! 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-16>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 构建 deb package
|
||||
|
||||
## 准备
|
||||
|
||||
安装构建所需的依赖:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential debhelper devscripts fakeroot
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## 构建
|
||||
|
||||
```bash
|
||||
git clone https://github.com/RubyMetric/chsrc.git
|
||||
cd chsrc
|
||||
|
||||
# 进入 deb 目录
|
||||
cd pkg/deb
|
||||
|
||||
# 执行构建命令
|
||||
./Makefile deb-make
|
||||
```
|
||||
|
||||
### 调试构建
|
||||
|
||||
```bash
|
||||
# 启用详细输出
|
||||
DEB_BUILD_OPTIONS="nocheck" debuild -us -uc -b
|
||||
|
||||
# 检查构建日志
|
||||
less ../chsrc_*.build
|
||||
|
||||
# 检查包内容
|
||||
dpkg --contents ../chsrc_*.deb
|
||||
# 或
|
||||
dpkg-deb --contents ../chsrc_*.deb
|
||||
```
|
||||
|
||||
### 交叉编译
|
||||
|
||||
为不同架构进行构建:
|
||||
|
||||
```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 # 修复依赖问题
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### 测试安装情况
|
||||
|
||||
```bash
|
||||
# 运行测试
|
||||
bash ./deb-installation-test.sh
|
||||
|
||||
# 查看文档安装情况
|
||||
man chsrc
|
||||
|
||||
# 查看 deb 包的 copyright
|
||||
cat /usr/share/doc/chsrc/copyright
|
||||
|
||||
# 查看 deb 包 changelog
|
||||
zless /usr/share/doc/chsrc/changelog.Debian.gz
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### 清理构建产物
|
||||
|
||||
```bash
|
||||
./Makefile deb-clean
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## 卸载
|
||||
|
||||
```bash
|
||||
sudo apt-get remove chsrc
|
||||
```
|
||||
|
||||
包括删除配置在内的完全删除:
|
||||
|
||||
```bash
|
||||
sudo apt-get purge chsrc
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 故障排查
|
||||
|
||||
常见问题:
|
||||
|
||||
1. **构建失败**: 检查 debian/control 中的依赖是否正确
|
||||
2. **交叉编译失败**: 确认目标架构的工具链已正确安装
|
||||
3. **安装测试失败**: 检查 postinst 脚本是否有错误
|
||||
|
||||
<br>
|
61
pkg/deb/CI.md
Normal file
@ -0,0 +1,61 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! 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-16>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# deb package CI/CD
|
||||
|
||||
本文档说明了 chsrc 项目的 deb 包自动构建和发布流程。
|
||||
|
||||
## CI 文件
|
||||
|
||||
CI 维护者 [@sanchuanhehe](https://github.com/sanchuanhehe)
|
||||
|
||||
- [.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. **Push 事件**:当 push 到 `gh-build` 分支时自动构建,并上传 deb 包 到 `pre` 这个特定的 release 中
|
||||
2. **Release 事件**: 当创建新的 release 时自动构建,并上传 deb 包到最新的这个 release 中
|
||||
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>
|
37
pkg/deb/Makefile
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/make -f
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : Makefile
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# deb package targets
|
||||
#
|
||||
# @issue https://github.com/RubyMetric/chsrc/pull/206
|
||||
# 这些本是 debhelper 兼容性版本 (debian/compat) 为 9 时所需要定义的 targets
|
||||
# 然而现在已经为版本 13 (debian/compat已移除),不再需要这些 targets,仅出于
|
||||
# 实用目的保留。由于以上原因,也不要修改这些 targets 的名称。
|
||||
# --------------------------------------------------------------
|
||||
|
||||
all: deb-build
|
||||
|
||||
deb-prepare:
|
||||
@echo "Starting: Prepare for building deb package"
|
||||
@echo "Finished: Prepare for building deb package"
|
||||
|
||||
deb-build: deb-prepare
|
||||
@echo "Starting: Build deb package"
|
||||
@debuild -us -uc -b
|
||||
@echo "Finished: Build deb package"
|
||||
|
||||
deb-clean:
|
||||
@echo "Starting: Clean deb build artifacts"
|
||||
-@rm -rf debian/chsrc/
|
||||
-@rm -f ../chsrc_*.deb ../chsrc-dbgsym_*.ddeb ../chsrc_*.changes ../chsrc_*.buildinfo ../chsrc_*.build
|
||||
@echo "Finished: Clean deb build artifacts"
|
||||
|
||||
.PHONY: deb-prepare deb-build deb-clean
|
64
pkg/deb/README.md
Normal file
@ -0,0 +1,64 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! 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-16>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# deb package
|
||||
|
||||
本文档说明了 `chsrc` 项目的 deb 包的相关情况
|
||||
|
||||
<br>
|
||||
|
||||
## 相关文件
|
||||
|
||||
- `.github/workflows/pkg-deb.yml` - CI 配置文件
|
||||
- `./CI.md` - CI 情况说明
|
||||
|
||||
<wbr>
|
||||
|
||||
- `./debian/` - deb 包构建配置目录
|
||||
- `./BUILD.md` - 如何手动构建
|
||||
- `./Makefile` - deb 包构建 Makefile
|
||||
- `./deb-installation-test.sh` - deb 包 **已正确安装** 测试脚本
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
如果你是普通用户,你应该从 [GitHub Releases](https://github.com/RubyMetric/chsrc/releases) 下载合适的 deb 包,然后运行以下命令安装:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i chsrc_*.deb
|
||||
sudo apt-get install -f # Fix any dependency issues
|
||||
```
|
||||
|
||||
如果你是高级用户,你可以自己阅读本目录下的 [./BUILD.md](./BUILD.md) 来自己构建 deb 包并按照上述同样的方式安装。
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
## `debian/` 目录结构
|
||||
|
||||
```
|
||||
debian/
|
||||
├── changelog # 版本更新日志
|
||||
├── compat # debhelper 兼容性版本
|
||||
├── control # 包控制信息和依赖
|
||||
├── copyright # 版权信息
|
||||
├── postinst # 安装后脚本
|
||||
├── prerm # 卸载前脚本
|
||||
└── rules # 构建规则
|
||||
```
|
||||
|
||||
其中,最后三个是 `+x` 的可执行文件。
|
||||
|
||||
<br>
|
55
pkg/deb/deb-installation-test.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Test File : deb-installation-test.sh
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# Test script for deb package installation
|
||||
# --------------------------------------------------------------
|
||||
|
||||
set -e
|
||||
|
||||
echo "Testing installation of deb package 'chsrc' ..."
|
||||
|
||||
# Test 1: Check if chsrc binary exists and is executable
|
||||
if [ ! -f "/usr/bin/chsrc" ]; then
|
||||
echo "ERROR: /usr/bin/chsrc not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "/usr/bin/chsrc" ]; then
|
||||
echo "ERROR: /usr/bin/chsrc is not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ /usr/bin/chsrc binary exists and is executable"
|
||||
|
||||
# Test 2: Check if man page exists
|
||||
if [ ! -f "/usr/share/man/man1/chsrc.1" ]; then
|
||||
echo "WARNING: chsrc man page not found at /usr/share/man/man1/chsrc.1"
|
||||
else
|
||||
echo "✓ chsrc man page exists"
|
||||
fi
|
||||
|
||||
# Test 3: Test basic functionality
|
||||
echo "Testing basic chsrc functionality..."
|
||||
if /usr/bin/chsrc help >/dev/null 2>&1; then
|
||||
echo "✓ command 'chsrc help' works"
|
||||
else
|
||||
echo "ERROR: command 'chsrc help' failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if /usr/bin/chsrc list >/dev/null 2>&1; then
|
||||
echo "✓ command 'chsrc list' works"
|
||||
else
|
||||
echo "ERROR: command 'chsrc list' failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All installation tests of deb package 'chsrc' passed!"
|
12
pkg/deb/debian/changelog
Normal file
@ -0,0 +1,12 @@
|
||||
chsrc (0.1.9-1) unstable; urgency=medium
|
||||
|
||||
* v0.1.9 已发布
|
||||
|
||||
-- Aoran Zeng <ccmywish@qq.com> Sun, 15 Jun 2025 13:32:50 +0800
|
||||
|
||||
|
||||
chsrc (0.0.1-1) unstable; urgency=medium
|
||||
|
||||
* 首个 deb 包已完成!
|
||||
|
||||
-- sanchuanhehe <wyihe5520@gmail.com> Mon, 10 Jun 2025 00:00:00 +0000
|
18
pkg/deb/debian/control
Normal file
@ -0,0 +1,18 @@
|
||||
Source: chsrc
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: sanchuanhehe <wyihe5520@gmail.com>
|
||||
Build-Depends: debhelper-compat (= 13), build-essential, libc6-dev
|
||||
Standards-Version: 4.6.0
|
||||
Homepage: https://chsrc.run/
|
||||
Vcs-Git: https://github.com/RubyMetric/chsrc.git
|
||||
Vcs-Browser: https://github.com/RubyMetric/chsrc
|
||||
|
||||
Package: chsrc
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Change Source - A tool for changing software sources
|
||||
chsrc is a command-line tool for changing software sources (mirrors)
|
||||
for various package managers and programming language ecosystems.
|
||||
It supports automatic detection and switching of sources for better
|
||||
download speeds in different regions.
|
50
pkg/deb/debian/copyright
Normal file
@ -0,0 +1,50 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: chsrc
|
||||
Upstream-Contact: Aoran Zeng <ccmywish@qq.com>
|
||||
Source: https://github.com/RubyMetric/chsrc
|
||||
|
||||
Files: *
|
||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
||||
2023-2025 Heng Guo <2085471348@qq.com>
|
||||
License: GPL-3+
|
||||
Comment: The authors' names are indicated in each source code file's header.
|
||||
|
||||
Files: lib/xy.h
|
||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
||||
2023-2025 Heng Guo <2085471348@qq.com>
|
||||
License: MIT
|
||||
|
||||
Files: pkg/deb/debian/*
|
||||
Copyright: 2025 sanchuanhehe <wyihe5520@gmail.com>
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
Comment:
|
||||
On Debian systems, the full text of the GNU General Public License
|
||||
version 3 can be found in the file '/usr/share/common-licenses/GPL-3'.
|
||||
|
||||
License: MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023-2025 曾奥然 (Aoran Zeng), 郭恒 (Heng Guo)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
42
pkg/deb/debian/postinst
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# deb File : postinst
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# postinst script for chsrc
|
||||
# --------------------------------------------------------------
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# Update man database
|
||||
if command -v mandb >/dev/null 2>&1; then
|
||||
mandb -q /usr/share/man/man1/chsrc.1 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Make sure chsrc is executable
|
||||
chmod +x /usr/bin/chsrc
|
||||
|
||||
echo "chsrc has been successfully installed!"
|
||||
echo "Run 'chsrc help' to get started."
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
33
pkg/deb/debian/prerm
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# deb File : prerm
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# prerm script for chsrc
|
||||
# --------------------------------------------------------------
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
# Nothing special to do during removal
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
49
pkg/deb/debian/rules
Executable file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/make -f
|
||||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : rules
|
||||
# File 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-20>
|
||||
#
|
||||
# 该文件是 Makefile 格式
|
||||
# --------------------------------------------------------------
|
||||
#
|
||||
# debuild 调用 dpkg-buildpackage
|
||||
#
|
||||
# dpkg-buildpackage 通过调用 fakeroot debian/rules <target> 执行本文件
|
||||
#
|
||||
# 由于下面的 %,所有任务都将被传递给 dh
|
||||
#
|
||||
# 比如:
|
||||
#
|
||||
# debian/rules <target>
|
||||
#
|
||||
# 会转换为:
|
||||
#
|
||||
# dh <target>
|
||||
#
|
||||
# 来执行
|
||||
#
|
||||
# 简单理解,将顺序调用:
|
||||
# 1. dh clean
|
||||
# 2. dh build (debian/rules override_dh_auto_build)
|
||||
# 3. dh binary (debian/rules override_dh_auto_install)
|
||||
# --------------------------------------------------------------
|
||||
|
||||
# 由于 debuild 要寻找 debian/ 目录,因此当前工作目录一定在 pkg/deb 下
|
||||
Chsrc-Root-Dir = $(CURDIR)/../../
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
# 切换到 chsrc 根目录
|
||||
@$(MAKE) -C $(Chsrc-Root-Dir) build-in-release-mode
|
||||
|
||||
override_dh_auto_install:
|
||||
@$(MAKE) -C $(Chsrc-Root-Dir) install DESTDIR=$(CURDIR)/debian/chsrc
|
@ -24,15 +24,18 @@
|
||||
* | Jialin Lyu <jialinlvcn@aliyun.com>
|
||||
* | GitHub Copilot <https://github.com/copilot>
|
||||
* | ccy <icuichengyi@gmail.com>
|
||||
* | MadDogOwner <xiaoran@xrgzs.top>
|
||||
* | sanchuanhehe <wyihe5520@gmail.com>
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2023-08-28>
|
||||
* Last Modified : <2025-04-13>
|
||||
* Last Modified : <2025-06-18>
|
||||
*
|
||||
* chsrc: Change Source —— 全平台通用命令行换源工具
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#define Chsrc_Version "0.2.1"
|
||||
#define Chsrc_Release_Date "2025/04/13"
|
||||
#define Chsrc_Version "0.2.1.2-dev2"
|
||||
#define Chsrc_Release_Date "2025/06/18"
|
||||
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
|
||||
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
|
||||
|
||||
@ -66,6 +69,7 @@
|
||||
#include "recipe/lang/Rust/rustup.c"
|
||||
#include "recipe/lang/Rust/Cargo.c"
|
||||
|
||||
#include "recipe/lang/Dart/common.h"
|
||||
#include "recipe/lang/Dart/Pub.c"
|
||||
#include "recipe/lang/Dart/Flutter.c"
|
||||
|
||||
|
@ -9,11 +9,19 @@
|
||||
* | Yangmoooo <yangmoooo@outlook.com>
|
||||
* |
|
||||
* Created On : <2023-08-29>
|
||||
* Last Modified : <2025-03-06>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* chsrc framework
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ < 201112L
|
||||
# error "chsrc requires C11 or later, please use a new compiler which at least supports C11"
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) && __STDC_VERSION__ < 201710L
|
||||
# warning "chsrc recommends a C17 or later compiler"
|
||||
#endif
|
||||
|
||||
#include "xy.h"
|
||||
#include "struct.h"
|
||||
#include "mirror.c"
|
||||
@ -623,7 +631,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
skip_reason = CliOpt_InEnglish ? "SKIP for no reason" : "无理由跳过";
|
||||
}
|
||||
measure_msgs[i] = xy_strjoin (4, " x ", msg, " ", yellow(skip_reason));
|
||||
printf ("%s\n", measure_msgs[i]);
|
||||
println (measure_msgs[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -638,8 +646,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
||||
}
|
||||
|
||||
|
||||
printf ("%s", measure_msgs[i]);
|
||||
print (measure_msgs[i]);
|
||||
fflush (stdout);
|
||||
|
||||
char *url_ = xy_strdup (url);
|
||||
@ -1116,6 +1123,62 @@ chsrc_run_as_a_service (const char *cmd)
|
||||
ProgMode_Run_as_a_Service = false;
|
||||
}
|
||||
|
||||
static void
|
||||
chsrc_view_env (const char *var1, ...)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
const char *var = var1;
|
||||
|
||||
va_list vars;
|
||||
va_start (vars, var1);
|
||||
|
||||
bool first = true;
|
||||
while (var)
|
||||
{
|
||||
#ifdef XY_On_Windows
|
||||
if (first)
|
||||
{
|
||||
cmd = xy_strjoin (3, "set ", var, " ");
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = xy_strjoin (4, cmd, "& set ", var, " ");
|
||||
}
|
||||
#else
|
||||
if (first)
|
||||
{
|
||||
cmd = xy_strjoin (5, "echo ", var, "=$", var, " ");
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = xy_strjoin (6, cmd, "; echo ", var, "=$", var, " ");
|
||||
}
|
||||
#endif
|
||||
var = va_arg (vars, const char *);
|
||||
}
|
||||
|
||||
va_end (vars);
|
||||
|
||||
if (var1)
|
||||
{
|
||||
/**
|
||||
* 不用 chsrc_run(),因为在Windows上,set在遇到环境变量未定义时会返回非0,导致 chsrc_run() 报告运行失败
|
||||
* 这个错误过于醒目。我们应该像在 sh 一样,默默地没有输出即可,而不是报错
|
||||
*/
|
||||
// chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line|RunOpt_Dont_Abort_On_Failure);
|
||||
int status = system (cmd);
|
||||
if (status!=0) {/* NOOP */}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 必须给一个参数 */
|
||||
xy_unreached();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
chsrc_view_file (const char *path)
|
||||
{
|
||||
|
@ -6,9 +6,10 @@
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Shengwei Chen <414685209@qq.com>
|
||||
* | Jialin Lyu <jialinlvcn@aliyun.com>
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2023-08-29>
|
||||
* Last Modified : <2025-03-09>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* 通用镜像站
|
||||
* ------------------------------------------------------------*/
|
||||
@ -44,13 +45,13 @@ Tuna =
|
||||
|
||||
Sjtug_Zhiyuan =
|
||||
{
|
||||
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||
"sjtu-zy", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan}
|
||||
},
|
||||
|
||||
Sjtug_Siyuan =
|
||||
{
|
||||
"sjtu", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
|
||||
"sjtu-sy", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan}
|
||||
},
|
||||
|
||||
@ -150,20 +151,16 @@ Nju =
|
||||
{
|
||||
"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* @note 2023-09-05 只使用了不到5次,重庆大学镜像站就把我的ip封杀了,对用户来说封杀策略过严,暂时不可靠,暂时不用
|
||||
*
|
||||
* Cqu =
|
||||
* {
|
||||
* "cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
||||
* {NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"}
|
||||
* };
|
||||
*
|
||||
* @note 2023-09-05 封杀策略过严,谨慎使用
|
||||
*/
|
||||
|
||||
|
||||
Cqu =
|
||||
{
|
||||
"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
};
|
||||
|
||||
/**
|
||||
* 商业公司提供的源
|
||||
@ -171,7 +168,7 @@ Nju =
|
||||
MirrorSite_t Ali =
|
||||
{
|
||||
"ali", "Ali OPSX Public", "阿里巴巴开源镜像站(公网)", "https://developer.aliyun.com/mirror/",
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyun.com/deepin-cd" Big_File_deepin}
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyun.com/ubuntu/ls-lR.gz"} // 31MB左右
|
||||
},
|
||||
/*
|
||||
// https://mirrors.cloud.aliyuncs.com/
|
||||
@ -192,7 +189,7 @@ Ali_ECS_classic =
|
||||
Tencent =
|
||||
{
|
||||
"tencent", "Tencent Public", "腾讯软件源(公网)", "https://mirrors.tencent.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencent.com/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencent.com/mariadb/mariadb-12.1.0/winx64-packages/mariadb-12.1.0-winx64-debugsymbols.zip"} // 110MB左右
|
||||
},
|
||||
/*
|
||||
Tencent_Intra =
|
||||
@ -221,12 +218,19 @@ Volceengine_Intra =
|
||||
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu },
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @note 2026-06-20 网易开源镜像站的速度始终过低,不建议再使用
|
||||
*/
|
||||
Netease =
|
||||
{
|
||||
"netease", "Netease", "网易开源镜像站", "https://mirrors.163.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.163.com/deepin-cd" Big_File_deepin}
|
||||
},
|
||||
|
||||
/**
|
||||
* @note 2026-06-20 搜狐开源镜像站的速度始终过低,不建议再使用
|
||||
*/
|
||||
Sohu =
|
||||
{
|
||||
"sohu", "SOHU", "搜狐开源镜像站", "https://mirrors.sohu.com/",
|
||||
|
@ -1,26 +1,34 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : czyt <czyt.go@gmail.com>
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : czyt <czyt.go@gmail.com>
|
||||
* | MadDogOwner <xiaoran@xrgzs.top>
|
||||
* |
|
||||
* Created On : <2023-09-10>
|
||||
* Major Revision : 2
|
||||
* Last Modified : <2024-11-22>
|
||||
* Last Modified : <2025-06-19>
|
||||
*
|
||||
* 2024-09-14: 不得不将Dart和Flutter拆分为两个Target,
|
||||
* 因为3家教育网镜像站给出的 Dart 和 Flutter 换源URL模式都不一样
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-10-31
|
||||
* @update 2025-04-15
|
||||
*/
|
||||
static SourceProvider_t pl_dart_flutter_upstream =
|
||||
{
|
||||
def_upstream, "https://storage.googleapis.com",
|
||||
{NotSkip, NA, NA, "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"} // 231 MB
|
||||
};
|
||||
|
||||
static Source_t pl_dart_flutter_sources[] =
|
||||
{
|
||||
{&UpstreamProvider, "https://storage.googleapis.com"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn"}, // 没有后缀,怀疑是否存在问题
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/flutter"}, // URL 带 git
|
||||
{&Nju, "https://mirror.nju.edu.cn/flutter"}
|
||||
{&pl_dart_flutter_upstream, "https://storage.googleapis.com"},
|
||||
{&FlutterCN, "https://storage.flutter-io.cn"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn"}, // 没有后缀,怀疑是否存在问题
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter"},
|
||||
{&Nju, "https://mirror.nju.edu.cn/flutter"}
|
||||
};
|
||||
def_sources_n(pl_dart_flutter);
|
||||
|
||||
@ -31,18 +39,7 @@ def_sources_n(pl_dart_flutter);
|
||||
void
|
||||
pl_dart_flutter_getsrc (char *option)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
if (xy_on_windows)
|
||||
{
|
||||
// cmd = "set PUB_HOSTED_URL & set FLUTTER_STORAGE_BASE_URL";
|
||||
cmd = "set FLUTTER_STORAGE_BASE_URL";
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "echo $FLUTTER_STORAGE_BASE_URL";
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
chsrc_view_env ("FLUTTER_STORAGE_BASE_URL", NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -57,16 +54,11 @@ pl_dart_flutter_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (pl_dart_flutter);
|
||||
|
||||
char *w = NULL;
|
||||
|
||||
char *cmd = NULL;
|
||||
if (xy_on_windows)
|
||||
{
|
||||
w = xy_strjoin (3, "$env:FLUTTER_STORAGE_BASE_URL = \"", source.url, "\"\n");
|
||||
|
||||
if (xy_file_exist (xy_win_powershell_profile))
|
||||
chsrc_append_to_file (w, xy_win_powershell_profile);
|
||||
|
||||
if (xy_file_exist (xy_win_powershellv5_profile))
|
||||
chsrc_append_to_file (w, xy_win_powershellv5_profile);
|
||||
cmd = xy_strjoin (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\"");
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,22 +1,30 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : czyt <czyt.go@gmail.com>
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : czyt <czyt.go@gmail.com>
|
||||
* | MadDogOwner <xiaoran@xrgzs.top>
|
||||
* |
|
||||
* Created On : <2023-09-10>
|
||||
* Major Revision : 3
|
||||
* Last Modified : <2024-10-31>
|
||||
* Last Modified : <2025-06-19>
|
||||
*
|
||||
* Dart Pub 软件仓库
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-10-31
|
||||
* @update 2025-04-15
|
||||
*/
|
||||
static SourceProvider_t pl_dart_upstream =
|
||||
{
|
||||
def_upstream, "https://pub.dev",
|
||||
{NotSkip, NA, NA, "https://pub.dev/packages/flutter_vision/versions/1.1.4.tar.gz"} // 37.05 MB
|
||||
};
|
||||
|
||||
static Source_t pl_dart_sources[] =
|
||||
{
|
||||
{&UpstreamProvider, "https://pub.dev"},
|
||||
{&pl_dart_upstream, "https://pub.dev"},
|
||||
{&FlutterCN, "https://pub.flutter-io.cn"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub"},
|
||||
{&Nju, "https://mirror.nju.edu.cn/dart-pub"}
|
||||
@ -27,18 +35,7 @@ def_sources_n(pl_dart);
|
||||
void
|
||||
pl_dart_getsrc (char *option)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
if (xy_on_windows)
|
||||
{
|
||||
// cmd = "set PUB_HOSTED_URL & set FLUTTER_STORAGE_BASE_URL";
|
||||
cmd = "set PUB_HOSTED_URL";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "echo $PUB_HOSTED_URL";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
chsrc_view_env ("PUB_HOSTED_URL", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,16 +49,11 @@ pl_dart_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (pl_dart);
|
||||
|
||||
char *w = NULL;
|
||||
|
||||
char *cmd = NULL;
|
||||
if (xy_on_windows)
|
||||
{
|
||||
w = xy_strjoin (3, "$env:PUB_HOSTED_URL = \"", source.url, "\"\n");
|
||||
|
||||
if (xy_file_exist (xy_win_powershell_profile))
|
||||
chsrc_append_to_file (w, xy_win_powershell_profile);
|
||||
|
||||
if (xy_file_exist (xy_win_powershellv5_profile))
|
||||
chsrc_append_to_file (w, xy_win_powershellv5_profile);
|
||||
cmd = xy_strjoin (3, "setx PUB_HOSTED_URL \"", source.url, "\"");
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
16
src/recipe/lang/Dart/common.h
Normal file
@ -0,0 +1,16 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : MadDogOwner <xiaoran@xrgzs.top>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* |
|
||||
* Created On : <2025-04-15>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2025-04-15>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static MirrorSite_t FlutterCN =
|
||||
{
|
||||
"cfug", "CFUG", "Flutter 社区", "https://flutter.cn/",
|
||||
{NotSkip, NA, NA, "https://storage.flutter-io.cn/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"} // 231 MB
|
||||
};
|
@ -41,7 +41,7 @@ pl_haskell_setsrc (char *option)
|
||||
}
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file); br();
|
||||
println (file); br();
|
||||
|
||||
config = xy_normalize_path ("~/.stack/config.yaml");
|
||||
file = xy_strjoin (3, "package-indices:\n"
|
||||
|
@ -83,7 +83,7 @@ pl_java_setsrc (char *option)
|
||||
|
||||
char *maven_config = pl_java_find_maven_config ();
|
||||
chsrc_note2 (xy_strjoin (3, "请在您的 maven 配置文件 ", maven_config, " 中添加:"));
|
||||
puts (file);
|
||||
println (file);
|
||||
}
|
||||
|
||||
if (gradle_exist)
|
||||
|
@ -46,7 +46,7 @@ pl_lua_setsrc (char *option)
|
||||
"}");
|
||||
|
||||
chsrc_note2 ("请手动修改 ~/.luarocks/config.lua 文件 (用于下载):");
|
||||
puts (config);
|
||||
println (config);
|
||||
|
||||
char *upload_config = xy_strjoin (3, "key = \"<Your API Key>\"\n"
|
||||
"server = \"", source.url, "\"");
|
||||
|
@ -3,8 +3,9 @@
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nul None <nul@none.org>
|
||||
* |
|
||||
* Created On : <2024-09-23>
|
||||
* Last Modified : <2024-09-23>
|
||||
* Last Modified : <2025-06-19>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@ -13,8 +14,7 @@
|
||||
void
|
||||
pl_nodejs_nvm_getsrc (char *option)
|
||||
{
|
||||
char *cmd = "echo NVM_NODEJS_ORG_MIRROR";
|
||||
system (cmd);
|
||||
chsrc_view_env ("NVM_NODEJS_ORG_MIRROR", NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ pl_python_rye_setsrc (char *option)
|
||||
|
||||
char *rye_config = pl_python_find_rye_config ();
|
||||
chsrc_note2 (xy_strjoin (3, "请在您的 Rye 配置文件 ", rye_config, " 中添加:"));
|
||||
puts (file);
|
||||
println (file);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
chsrc_conclude (&source);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* |
|
||||
* Created On : <2023-09-03>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2024-12-11>
|
||||
* Last Modified : <2025-06-12>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static SourceProvider_t pl_python_pypi_upstream =
|
||||
@ -17,12 +17,13 @@ static SourceProvider_t pl_python_pypi_upstream =
|
||||
};
|
||||
|
||||
/**
|
||||
* @update 2024-12-08
|
||||
* @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna
|
||||
* @update 2025-06-12
|
||||
* @note 不要添加Zju,浙大的PyPI服务在校外访问会自动转向Tuna
|
||||
*/
|
||||
static Source_t pl_python_sources[] =
|
||||
{
|
||||
{&pl_python_pypi_upstream , "https://pypi.org/simple"},
|
||||
{&pl_python_pypi_upstream, "https://pypi.org/simple"},
|
||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/pypi/web/simple"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"},
|
||||
{&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"},
|
||||
{&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"},
|
||||
@ -35,7 +36,7 @@ static Source_t pl_python_sources[] =
|
||||
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"}
|
||||
// {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次
|
||||
// {&Netease, "https://mirrors.163.com/.help/pypi.html"} /* 不启用原因:24小时更新一次 */
|
||||
};
|
||||
def_sources_n(pl_python);
|
||||
|
||||
@ -58,15 +59,18 @@ pl_python_get_py_program_name (char **prog_name)
|
||||
|
||||
bool py_exist = false;
|
||||
|
||||
// 由于Python2和Python3的历史,目前(2024-06)许多python命令实际上仍然是python2
|
||||
// https://gitee.com/RubyMetric/chsrc/issues/I9VZL2
|
||||
// 因此我们首先测试 python3
|
||||
/**
|
||||
* @issue https://gitee.com/RubyMetric/chsrc/issues/I9VZL2
|
||||
*
|
||||
* 由于Python2和Python3的历史,目前(2024-06)许多python命令实际上仍然是python2
|
||||
* 因此我们首先测试 python3
|
||||
*/
|
||||
py_exist = chsrc_check_program ("python3");
|
||||
|
||||
if (py_exist) *prog_name = "python3";
|
||||
else
|
||||
{
|
||||
// 不要调用 python 自己,而是使用 python --version,避免Windows弹出Microsoft Store
|
||||
/* 不要调用 python 自己,而是使用 python --version,避免Windows弹出Microsoft Store */
|
||||
py_exist = chsrc_check_program ("python");
|
||||
|
||||
if (py_exist) *prog_name = "python";
|
||||
|
@ -2,14 +2,16 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : happy game <happygame1024@gmail.com>
|
||||
* Contributors : ccy <icuichengyi@gmail.com>
|
||||
* Contributors : ccy <icuichengyi@gmail.com>
|
||||
* | Aoran Zeng <ccmywish@qq.com>
|
||||
* |
|
||||
* Created On : <2024-12-11>
|
||||
* Last Modified : <2025-04-02>
|
||||
* Last Modified : <2025-06-02>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get uv
|
||||
*
|
||||
* uv的配置优先级顺序如下(高到低):
|
||||
* 1. $workspaces/uv.toml
|
||||
* 2. $workspaces/pyproject.toml
|
||||
@ -27,15 +29,37 @@ pl_python_find_uv_config (bool mkdir)
|
||||
{
|
||||
if (CliOpt_Locally)
|
||||
{
|
||||
return xy_strjoin (2, UV_LOCAL_CONFIG_PATH, UV_CONFIG);
|
||||
return xy_2strjoin (UV_LOCAL_CONFIG_PATH, UV_CONFIG);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mkdir)
|
||||
{
|
||||
chsrc_ensure_dir (UV_USER_CONFIG_PATH);
|
||||
}
|
||||
return xy_strjoin (2, UV_USER_CONFIG_PATH, UV_CONFIG);
|
||||
if (xy_on_windows)
|
||||
{
|
||||
/* config path on Windows */
|
||||
char *appdata = getenv ("APPDATA");
|
||||
|
||||
if (!appdata)
|
||||
{
|
||||
chsrc_error2 ("未能获取 APPDATA 环境变量");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *config_dir = xy_2strjoin(appdata, "\\uv\\");
|
||||
if (mkdir)
|
||||
{
|
||||
chsrc_ensure_dir (config_dir);
|
||||
}
|
||||
return xy_2strjoin (config_dir, UV_CONFIG);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* config path on Linux or macOS */
|
||||
if (mkdir)
|
||||
{
|
||||
chsrc_ensure_dir (UV_USER_CONFIG_PATH);
|
||||
}
|
||||
return xy_2strjoin (UV_USER_CONFIG_PATH, UV_CONFIG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,13 +67,17 @@ void
|
||||
pl_python_uv_getsrc (char *option)
|
||||
{
|
||||
char *uv_config = pl_python_find_uv_config (false);
|
||||
|
||||
if (!chsrc_check_file (uv_config))
|
||||
{
|
||||
chsrc_error2 ("未找到 uv 配置文件");
|
||||
return;
|
||||
}
|
||||
// grep -A 2 'index' config_file | sed -n 's/^url = "\(.*\)"/\1/p'
|
||||
// 获取 [[index]] 配置项的 url
|
||||
|
||||
/**
|
||||
* grep -A 2 'index' config_file | sed -n 's/^url = "\(.*\)"/\1/p'
|
||||
* 获取 [[index]] 配置项的 url
|
||||
*/
|
||||
char *cmd = xy_strjoin (3, "grep -A 2 'index' ",
|
||||
uv_config,
|
||||
" | sed -n 's/^url = \"\\(.*\\)\"/\\1/p'");
|
||||
@ -72,16 +100,23 @@ pl_python_uv_setsrc (char *option)
|
||||
chsrc_yield_for_the_source (pl_python);
|
||||
|
||||
char *uv_config = pl_python_find_uv_config (true);
|
||||
if (NULL==uv_config)
|
||||
{
|
||||
chsrc_error2 ("无法获取 uv 配置文件路径");
|
||||
return;
|
||||
}
|
||||
chsrc_backup (uv_config);
|
||||
|
||||
const char *source_content = xy_strjoin (5,
|
||||
"[[index]]\n",
|
||||
"url = \"", source.url, "\"\n",
|
||||
"default = true\n");
|
||||
"[[index]]\\n",
|
||||
"url = \"", source.url, "\"\\n",
|
||||
"default = true\\n");
|
||||
|
||||
// sed -i '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = " source.url "|}' uv_config
|
||||
// 将 [[index]] 到 default = true 之间的 url = ".*" 替换为 url = "source.url"
|
||||
#if xy_on_macos
|
||||
/**
|
||||
* sed -i '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = " source.url "|}' uv_config
|
||||
* 将 [[index]] 到 default = true 之间的 url = ".*" 替换为 url = "source.url"
|
||||
*/
|
||||
#if XY_On_macOS
|
||||
char *sed_cmd = "sed -i '' ";
|
||||
#else
|
||||
char *sed_cmd = "sed -i ";
|
||||
@ -97,23 +132,41 @@ pl_python_uv_setsrc (char *option)
|
||||
char *cmd = NULL;
|
||||
if (!xy_file_exist (uv_config))
|
||||
{
|
||||
// uv_config 不存在,追加到新文件末尾
|
||||
// run: append_source_cmd
|
||||
/**
|
||||
* uv_config 不存在,追加到新文件末尾
|
||||
* run: append_source_cmd
|
||||
*/
|
||||
cmd = append_source_cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾
|
||||
// run: grep -q '^[[index]]$' uv_config && update_source_cmd || append_source_cmd
|
||||
cmd = xy_strjoin (6, "grep -q '^\\[\\[index\\]\\]$' ",
|
||||
uv_config,
|
||||
" && ",
|
||||
update_source_cmd,
|
||||
" || ",
|
||||
append_source_cmd);
|
||||
if (xy_on_windows)
|
||||
{
|
||||
/* TODO: Windows 下替换源暂不支持 */
|
||||
chsrc_note2 ("Windows 下暂不支持修改 uv.toml,请手动修改配置文件");
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾
|
||||
* run: grep -q '^[[index]]$' uv_config && update_source_cmd || append_source_cmd
|
||||
*/
|
||||
cmd = xy_strjoin (6, "grep -q '^\\[\\[index\\]\\]$' ",
|
||||
uv_config,
|
||||
" && ",
|
||||
update_source_cmd,
|
||||
" || ",
|
||||
append_source_cmd);
|
||||
}
|
||||
}
|
||||
if (NULL==cmd)
|
||||
{
|
||||
chsrc_note2 (xy_strjoin (4, "请手动为 ", uv_config, "添加或修改 [[index]] 配置项的 url = ", source.url));
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
@ -152,4 +205,4 @@ pl_python_uv_feat (char *option)
|
||||
}
|
||||
|
||||
// def_target_gsrf(pl_python_uv);
|
||||
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python)};
|
||||
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python)};
|
||||
|
@ -1,34 +1,45 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2023-08-30>
|
||||
* Last Modified : <2024-12-18>
|
||||
* Last Modified : <2025-06-18>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static SourceProvider_t pl_rust_cargo_upstream =
|
||||
{
|
||||
def_upstream, "https://crates.io/",
|
||||
def_need_measure_info
|
||||
{NotSkip, NA, NA, "https://crates.io/api/v1/crates/windows/0.58.0/download"}
|
||||
/* 跳转为: https://static.crates.io/crates/windows/windows-0.58.0.crate */
|
||||
};
|
||||
|
||||
// Ali: https://mirrors.aliyun.com/crates/api/v1/crates/windows/0.58.0/download
|
||||
// Ustc: https://crates-io.proxy.ustclug.org/api/v1/crates/windows/0.58.0/download
|
||||
|
||||
/**
|
||||
* @update 2024-12-18
|
||||
* @update 2025-06-18
|
||||
*
|
||||
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
|
||||
* @note 链接末尾的 `/` 不能缺少
|
||||
*
|
||||
* @note 2025-06-17: 经验证,南京大学、华中科大的镜像同步失败,实际情况下多数包都不可用
|
||||
*/
|
||||
static Source_t pl_rust_cargo_sources[] =
|
||||
{
|
||||
{&pl_rust_cargo_upstream, "https://index.crates.io/"}, // @help 是这个吗?
|
||||
{&pl_rust_cargo_upstream, "https://github.com/rust-lang/crates.io-index/"},
|
||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/"},
|
||||
{&RsProxyCN, "https://rsproxy.cn/index/"},
|
||||
{&Ali, "https://mirrors.aliyun.com/crates.io-index/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/crates.io-index/"},
|
||||
// {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/"},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/"},
|
||||
{&RsProxyCN, "https://rsproxy.cn/index/"},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/crates.io-index/"}
|
||||
// {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/"},
|
||||
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/"}
|
||||
};
|
||||
def_sources_n(pl_rust_cargo);
|
||||
|
||||
|
@ -10,5 +10,5 @@
|
||||
static MirrorSite_t RsProxyCN =
|
||||
{
|
||||
"rsproxycn", "RsProxy.cn", "字节跳动基础架构Dev Infra", "https://rsproxy.cn/",
|
||||
{SKIP, ToFill, ToFill, NULL}
|
||||
{NotSkip, NA, NA, "https://rsproxy.cn/api/v1/crates/windows/0.58.0/download"}
|
||||
};
|
||||
|
@ -1,11 +1,12 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2024-10-02>
|
||||
* Last Modified : <2024-12-18>
|
||||
* Last Modified : <2025-06-19>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static SourceProvider_t pl_rust_binary_upstream =
|
||||
@ -15,18 +16,19 @@ static SourceProvider_t pl_rust_binary_upstream =
|
||||
};
|
||||
|
||||
/**
|
||||
* @update 2024-12-18
|
||||
* @update 2025-06-17
|
||||
*/
|
||||
static Source_t pl_rust_rustup_sources[] =
|
||||
{
|
||||
static Source_t pl_rust_rustup_sources[] = {
|
||||
{&pl_rust_binary_upstream, "https://static.rust-lang.org"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/rust-static"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/rustup"},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/rustup"},
|
||||
{&RsProxyCN, "https://rsproxy.cn"}
|
||||
};
|
||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/rustup"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/rust-static"},
|
||||
{&Nju, "https://mirror.nju.edu.cn/rustup"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/rustup"},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/rustup"},
|
||||
{&Ali, "https://mirrors.aliyun.com/rustup"},
|
||||
{&RsProxyCN, "https://rsproxy.cn"}};
|
||||
def_sources_n(pl_rust_rustup);
|
||||
|
||||
|
||||
@ -36,10 +38,7 @@ def_sources_n(pl_rust_rustup);
|
||||
void
|
||||
pl_rust_rustup_getsrc (char *option)
|
||||
{
|
||||
char *cmd = "echo RUSTUP_UPDATE_ROOT;"
|
||||
"echo RUSTUP_DIST_SERVER;";
|
||||
|
||||
system (cmd);
|
||||
chsrc_view_env ("RUSTUP_UPDATE_ROOT", "RUSTUP_DIST_SERVER", NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +52,16 @@ pl_rust_rustup_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_rust_rustup);
|
||||
|
||||
#ifdef XY_On_Windows
|
||||
|
||||
char *cmd1 = xy_strjoin (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\"");
|
||||
char *cmd2 = xy_strjoin (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\"");
|
||||
|
||||
char *cmd = xy_strjoin (3, cmd1, " & ", cmd2);
|
||||
chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line);
|
||||
|
||||
#else
|
||||
|
||||
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
|
||||
char *w2 = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n");
|
||||
|
||||
@ -83,6 +92,7 @@ pl_rust_rustup_setsrc (char *option)
|
||||
chsrc_backup (fishrc);
|
||||
chsrc_append_to_file (w, fishrc);
|
||||
}
|
||||
#endif
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@ -1,11 +1,12 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2023-09-01>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2025-03-04>
|
||||
* Last Modified : <2025-06-17>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/* Begin Target Matrix */
|
||||
@ -144,18 +145,18 @@ static const char
|
||||
static MirrorSite_t*
|
||||
available_mirrors[] = {
|
||||
|
||||
/* 教育网 */
|
||||
&MirrorZ, &Tuna, &Sjtug_Zhiyuan, &Zju, &Lzuoss, &Jlu, &Bfsu, &Pku, &Bjtu, &Sustech, &Ustc,
|
||||
/* ------------------------ 教育网(通用镜像站) ------------------------ */
|
||||
&MirrorZ, &Tuna, &Sjtug_Zhiyuan, &Sjtug_Siyuan, &Zju, &Lzuoss, &Jlu, &Bfsu, &Pku, &Bjtu, &Sustech, &Ustc,
|
||||
|
||||
&Hust, &Iscas, &Scau,
|
||||
&Nyist, &Sdu, &Cqupt,
|
||||
|
||||
&Nju,
|
||||
&Nju, &Cqu,
|
||||
|
||||
// 已支持但未启用
|
||||
// &Cqu,
|
||||
|
||||
/* 大型公司 */
|
||||
|
||||
|
||||
/* ------------------------ 商业公司(通用镜像站) ------------------------ */
|
||||
&Ali, // &Ali_ECS_VPC, &Ali_ECS_classic,
|
||||
&Tencent, // &Tencent_Intra,
|
||||
&Huawei,
|
||||
@ -163,14 +164,21 @@ available_mirrors[] = {
|
||||
&Netease,
|
||||
&Sohu,
|
||||
|
||||
/* 公司 */
|
||||
&Api7, &Fit2Cloud, &DaoCloud,
|
||||
|
||||
/* 专用镜像站 */
|
||||
&RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN,
|
||||
|
||||
// 暂不支持 &NugetOrg
|
||||
// 不要列出 &UpstreamProvider 和 &UserDefinedProvider
|
||||
|
||||
|
||||
/* ------------------------ 专用镜像站 ------------------------ */
|
||||
&RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN,
|
||||
/* 暂不支持 &NugetOrg */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------ chsrc 内部实现 ------------------------ */
|
||||
/* 不要列出 &UpstreamProvider 和 &UserDefinedProvider */
|
||||
|
||||
};
|
||||
|
||||
/* End Target Matrix */
|
||||
|
@ -8,7 +8,7 @@
|
||||
* |
|
||||
* Created On : <2023-09-02>
|
||||
* Major Revision : 3
|
||||
* Last Modified : <2025-03-25>
|
||||
* Last Modified : <2025-06-16>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static SourceProvider_t os_debian_upstream =
|
||||
@ -32,8 +32,8 @@ static Source_t os_debian_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian"},
|
||||
{&Tencent, "https://mirrors.tencent.com/debian"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian"},
|
||||
{&Netease, "https://mirrors.163.com/debian"},
|
||||
{&Sohu, "https://mirrors.sohu.com/debian"}
|
||||
// {&Netease, "https://mirrors.163.com/debian"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/debian"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_debian);
|
||||
|
||||
@ -127,7 +127,9 @@ os_debian_setsrc (char *option)
|
||||
if (use_cdrom)
|
||||
{
|
||||
chsrc_backup (OS_Debian_old_SourceList);
|
||||
system ("rm " OS_Debian_old_SourceList);
|
||||
int rm_status = system ("rm " OS_Debian_old_SourceList);
|
||||
if (rm_status != 0) { /* Placate -Wunused-result */ }
|
||||
|
||||
chsrc_warn2 ("旧版源配置文件中使用了 CDROM 源,已删除(但备份)该配置文件,重新配置");
|
||||
/* 现在的情况是:系统中已经没有配置文件了 */
|
||||
sourcelist_exist = ensure_debian_or_ubuntu_old_sourcelist (OS_Is_Debian_Literally);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* | Happy Game <happygame1024@gmail.com>
|
||||
* |
|
||||
* Created On : <2023-09-29>
|
||||
* Last Modified : <2025-01-03>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* Kali Linux 基于 Debian Testing branch
|
||||
* ------------------------------------------------------------*/
|
||||
@ -19,7 +19,7 @@ static SourceProvider_t os_kali_upstream =
|
||||
};
|
||||
|
||||
/**
|
||||
* @update 2025-01-03
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_kali_sources[] =
|
||||
{
|
||||
@ -30,11 +30,7 @@ static Source_t os_kali_sources[] =
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/kali"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/kali"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/kali"},
|
||||
// {&Tencent, "https://mirrors.tencent.com/kali"}, // 无kali源
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/kali"},
|
||||
// {&Huawei, "https://mirrors.huaweicloud.com/kali"}, // 未与上游同步
|
||||
// {&Netease, "https://mirrors.163.com/kali"}, // 无kali源
|
||||
// {&Sohu, "https://mirrors.sohu.com/kali"} //无kali源
|
||||
};
|
||||
def_sources_n(os_kali);
|
||||
|
||||
|
@ -27,7 +27,7 @@ static Source_t os_linuxmint_sources[] =
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/linuxmint/"},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/linuxmint/"},
|
||||
{&Scau, "https://mirrors.scau.edu.cn/linuxmint/"},
|
||||
{&Netease, "https://mirrors.163.com/linuxmint/packages/"},
|
||||
// {&Netease, "https://mirrors.163.com/linuxmint/packages/"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_linuxmint);
|
||||
|
||||
|
@ -22,8 +22,8 @@ static Source_t os_ros_sources[] =
|
||||
{&Tencent, "https://mirrors.tencent.com"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com"},
|
||||
{&Netease, "https://mirrors.163.com"},
|
||||
{&Sohu, "https://mirrors.sohu.com"}
|
||||
// {&Netease, "https://mirrors.163.com"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_ros);
|
||||
|
||||
|
@ -31,8 +31,8 @@ static Source_t os_ubuntu_sources[] =
|
||||
{&Tencent, "https://mirrors.tencent.com/ubuntu"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/ubuntu"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/ubuntu"},
|
||||
{&Netease, "https://mirrors.163.com/ubuntu"},
|
||||
{&Sohu, "https://mirrors.sohu.com/ubuntu"}
|
||||
// {&Netease, "https://mirrors.163.com/ubuntu"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/ubuntu"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_ubuntu);
|
||||
|
||||
|
@ -21,8 +21,8 @@ static Source_t os_deepin_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/deepin"},
|
||||
{&Tencent, "https://mirrors.tencent.com/deepin"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/deepin"},
|
||||
{&Netease, "https://mirrors.163.com/deepin"},
|
||||
{&Sohu, "https://mirrors.sohu.com/deepin"}
|
||||
// {&Netease, "https://mirrors.163.com/deepin"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/deepin"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_deepin);
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created On : <2023-09-05>
|
||||
* Last Modified : <2024-11-22>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-09-14
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_gentoo_sources[] =
|
||||
{
|
||||
@ -19,8 +19,8 @@ static Source_t os_gentoo_sources[] =
|
||||
{&Tuna, "mirrors.tuna.tsinghua.edu.cn"},
|
||||
{&Tencent, "mirrors.tencent.com"},
|
||||
// {&Tencent_Intra, "mirrors.tencentyun.com"},
|
||||
{&Netease, "mirrors.163.com"},
|
||||
{&Sohu, "mirrors.sohu.com"}
|
||||
// {&Netease, "mirrors.163.com"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "mirrors.sohu.com"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_gentoo);
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* |
|
||||
* Created On : <2023-09-26>
|
||||
* Last Modified : <2024-11-04>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* 名称为 Fedora Linux
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-11-04
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_fedora_sources[] =
|
||||
{
|
||||
@ -23,8 +23,8 @@ static Source_t os_fedora_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/fedora"},
|
||||
{&Tencent, "https://mirrors.tencent.com/fedora"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/fedora"},
|
||||
{&Netease, "https://mirrors.163.com/fedora"},
|
||||
{&Sohu, "https://mirrors.sohu.com/fedora"}
|
||||
// {&Netease, "https://mirrors.163.com/fedora"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/fedora"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_fedora);
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
* Contributors : happy game <happygame1024@gmail.com>
|
||||
* |
|
||||
* Created On : <2023-09-24>
|
||||
* Last Modified : <2024-12-12>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-06-12
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_rockylinux_sources[] =
|
||||
{
|
||||
@ -21,8 +21,8 @@ static Source_t os_rockylinux_sources[] =
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/rocky-linux"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/rocky"},
|
||||
{&Lzuoss, "https://mirror.lzu.edu.cn/rocky"},
|
||||
{&Sohu, "https://mirrors.sohu.com/Rocky"},
|
||||
{&Netease, "https://mirrors.163.com/rocky"}
|
||||
// {&Netease, "https://mirrors.163.com/rocky"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/Rocky"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_rockylinux);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | happy game <happygame1024@gmail.com>
|
||||
* |
|
||||
* Created On : <2023-09-06>
|
||||
* Last Modified : <2024-12-18>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static SourceProvider_t os_openEuler_upstream =
|
||||
@ -18,7 +18,7 @@ static SourceProvider_t os_openEuler_upstream =
|
||||
|
||||
|
||||
/**
|
||||
* @update 2024-12-18
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_openeuler_sources[] =
|
||||
{
|
||||
@ -29,8 +29,8 @@ static Source_t os_openeuler_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/openeuler/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/openeuler/"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/openeuler/"},
|
||||
{&Netease, "https://mirrors.163.com/openeuler/"}
|
||||
// {&Sohu, "https://mirrors.sohu.com/openeuler/"}
|
||||
// {&Netease, "https://mirrors.163.com/openeuler/"} /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/openeuler/"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_openeuler);
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created On : <2023-09-17>
|
||||
* Last Modified : <2024-08-16>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-08-16
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_opensuse_sources[] =
|
||||
{
|
||||
@ -20,8 +20,8 @@ static Source_t os_opensuse_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/opensuse"},
|
||||
{&Tencent, "https://mirrors.tencent.com/opensuse"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/opensuse"},
|
||||
{&Netease, "https://mirrors.163.com/opensuse"},
|
||||
{&Sohu, "https://mirrors.sohu.com/opensuse"}
|
||||
// {&Netease, "https://mirrors.163.com/opensuse"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/opensuse"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_opensuse);
|
||||
|
||||
|
@ -3,13 +3,14 @@
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Contributors : happy game <happygame1024@gmail.com>
|
||||
* |
|
||||
* Created On : <2023-09-05>
|
||||
* Last Modified : <2024-08-22>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-07-03
|
||||
* @update 2025-06-20
|
||||
* @note 不要给后面加 / ,因为ARM情况下,还要额外加一个 arm 后缀
|
||||
*/
|
||||
static Source_t os_arch_sources[] =
|
||||
@ -21,9 +22,9 @@ static Source_t os_arch_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/archlinux"},
|
||||
{&Tencent, "https://mirrors.tencent.com/archlinux"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/archlinux"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/archlinux"}, // 不支持 archlinuxcn
|
||||
{&Netease, "https://mirrors.163.com/archlinux"}, // archlinuxcn 的URL和其他镜像站不同
|
||||
// {&Sohu, "https://mirrors.sohu.com/archlinux"} // 不支持 archlinuxcn
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/archlinux"},
|
||||
// {&Netease, "https://mirrors.163.com/archlinux"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/archlinux"} /* 不启用原因:过慢 */
|
||||
},
|
||||
|
||||
/**
|
||||
@ -39,13 +40,14 @@ os_archlinuxcn_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/"},
|
||||
{&Tencent, "https://mirrors.cloud.tencent.com/archlinuxcn/"},
|
||||
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/archlinuxcn/"},
|
||||
{&Netease, "https://mirrors.163.com/archlinux-cn/"}
|
||||
// {&Netease, "https://mirrors.163.com/archlinux-cn/"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_arch);
|
||||
def_sources_n(os_archlinuxcn);
|
||||
|
||||
|
||||
#define OS_Pacman_MirrorList "/etc/pacman.d/mirrorlist"
|
||||
#define OS_Pacman_ArchLinuxCN_MirrorList "/etc/pacman.conf"
|
||||
void
|
||||
os_arch_getsrc (char *option)
|
||||
{
|
||||
@ -81,7 +83,7 @@ os_arch_setsrc (char *option)
|
||||
to_write = xy_strjoin (3, "Server = ", source.url, "arm/$arch/$repo");
|
||||
}
|
||||
|
||||
// 越前面的优先级越高
|
||||
/* 配置文件中,越前面的优先级越高 */
|
||||
chsrc_prepend_to_file (to_write, OS_Pacman_MirrorList);
|
||||
|
||||
if (is_x86)
|
||||
@ -106,6 +108,7 @@ os_archlinuxcn_getsrc (char *option)
|
||||
|
||||
/**
|
||||
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/archlinuxcn/
|
||||
* @update 2025-05-24
|
||||
*/
|
||||
void
|
||||
os_archlinuxcn_setsrc (char *option)
|
||||
@ -114,24 +117,36 @@ os_archlinuxcn_setsrc (char *option)
|
||||
|
||||
chsrc_yield_source_and_confirm (os_archlinuxcn);
|
||||
|
||||
chsrc_backup (OS_Pacman_MirrorList);
|
||||
chsrc_backup (OS_Pacman_ArchLinuxCN_MirrorList);
|
||||
|
||||
bool arch_flag = false;
|
||||
char *arch = chsrc_get_cpuarch ();
|
||||
|
||||
char *towrite = xy_strjoin (3, "[archlinuxcn]\nServer = ", source.url, "$arch");
|
||||
// 越前面的优先级越高
|
||||
chsrc_prepend_to_file (towrite, OS_Pacman_MirrorList);
|
||||
/* 检查是否已存在 archlinuxcn 配置段 */
|
||||
char *check_cmd = "grep -q '\\[archlinuxcn\\]' " OS_Pacman_ArchLinuxCN_MirrorList;
|
||||
int ret = system(check_cmd);
|
||||
|
||||
chsrc_run ("pacman-key --lsign-key \"farseerfc@archlinux.org\"", RunOpt_Dont_Abort_On_Failure);
|
||||
if (ret == 0)
|
||||
{
|
||||
char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ",
|
||||
source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList);
|
||||
chsrc_run (sed_cmd, RunOpt_Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n");
|
||||
chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList);
|
||||
}
|
||||
|
||||
chsrc_run ("pacman-key --lsign-key \"farseerfc@archlinux.org\"", RunOpt_Dont_Abort_On_Failure); // 此命令可能会失败, 但对换源没有影响
|
||||
chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default);
|
||||
|
||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||
|
||||
ProgMode_ChgType = ChgType_Untested;
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
#undef OS_Pacman_MirrorList
|
||||
#undef OS_Pacman_ArchLinuxCN_MirrorList
|
||||
|
||||
|
||||
Feature_t
|
||||
|
@ -1,14 +1,14 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created On : <2023-09-06>
|
||||
* Last Modified : <2024-08-16>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-04-18
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_msys2_sources[] =
|
||||
{
|
||||
@ -19,8 +19,8 @@ static Source_t os_msys2_sources[] =
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/msys2"},
|
||||
{&Tencent, "https://mirrors.tencent.com/msys2"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/msys2"},
|
||||
{&Netease, "https://mirrors.163.com/msys2"},
|
||||
{&Sohu, "https://mirrors.sohu.com/msys2"}
|
||||
// {&Netease, "https://mirrors.163.com/msys2"}, /* 不启用原因:过慢 */
|
||||
// {&Sohu, "https://mirrors.sohu.com/msys2"} /* 不启用原因:过慢 */
|
||||
};
|
||||
def_sources_n(os_msys2);
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* File Name : recipe-template.c
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* |
|
||||
* Created On : <2024-08-09>
|
||||
* Last Modified : <2024-11-22>
|
||||
* -------------------------------------------------------------
|
||||
@ -13,21 +14,28 @@
|
||||
*
|
||||
* 模版中:
|
||||
* <target> 为该换源目标的名称
|
||||
* <category> 为该换源目标的类别,仅有3类: pl, os, wr
|
||||
* <category> 为该换源目标的类别,仅有3类: pl, os, wr
|
||||
* 分别对应3个子目录: lang, os, ware
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
/* 模版文件从下行正式开始 */
|
||||
|
||||
/* 模版文件内容从下方第30行正式开始 */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Name : <target>.c
|
||||
* File Authors : Nil Null <nil@null.org> 尼尔闹先生
|
||||
* Contributors : Nul None <nul@none.org> 怒了馕女士
|
||||
* Created On : <2024-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none
|
||||
* Last Modified : <2024-01-01> 请更新文件标头
|
||||
* |
|
||||
* Created On : <2025-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none
|
||||
* Last Modified : <2025-01-01> 请更新文件标头
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@ -42,7 +50,7 @@ RubyMetric = {"rbmt", // chsrc set <target> rbmt
|
||||
"https://rubymetirc.com/target/aws/aws-sdk-go/@v/v1.45.2.zip"};
|
||||
|
||||
/**
|
||||
* @update 2024-08-09
|
||||
* @update 2025-12-31
|
||||
* @note 该target的各个源地址,该例数据为虚拟填充
|
||||
*/
|
||||
static Source_t
|
||||
|
@ -70,7 +70,7 @@ wr_anaconda_setsrc (char *option)
|
||||
}
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file);
|
||||
println (file);
|
||||
|
||||
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
||||
|
||||
|
@ -135,7 +135,7 @@ wr_dockerhub_setsrc (char *option)
|
||||
chsrc_append_to_file (to_add, WARE_DockerHub_SourceConfig);
|
||||
}
|
||||
// chsrc_note2 ("请向 /etc/docker/daemon.json 中添加下述内容:");
|
||||
// puts (to_add);
|
||||
// println (to_add);
|
||||
if (xy_on_linux)
|
||||
{
|
||||
// 由于 systemctl restart docker 会导致所有容器停止,所以不自动重启
|
||||
@ -151,7 +151,7 @@ wr_dockerhub_setsrc (char *option)
|
||||
{
|
||||
chsrc_note2 ("请打开Docker Desktop设置");
|
||||
chsrc_note2 ("选择“Docker Engine”选项卡,在该选项卡中找到“registry-mirrors”一栏,添加镜像地址:");
|
||||
puts (source.url);
|
||||
println (source.url);
|
||||
}
|
||||
|
||||
chsrc_determine_chgtype (ChgType_SemiAuto);
|
||||
|
@ -3,43 +3,59 @@
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Jialin Lyu <jialinlvcn@aliyun.com>
|
||||
* |
|
||||
* Created On : <2023-09-11>
|
||||
* Last Modified : <2025-03-17>
|
||||
* Last Modified : <2025-05-27>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2025-03-17
|
||||
* @note 加入官方仓库
|
||||
* @note SJTUG分为两个镜像站 思源站和致远站 以解决思源站可能无法访问的问题
|
||||
* @update 2025-05-27
|
||||
*/
|
||||
static SourceProvider_t wr_flathub_upstream =
|
||||
{
|
||||
"Flathub", "Flathub", "Flathub官方仓库", "https://flathub.org/repo",
|
||||
// 没有找到 DaoCloud 合适的下载链接,先随便给一个,以规避 chsrc 自动测速时所有 dockerhub 镜像站都没有测速链接带来的 bug
|
||||
def_upstream, "https://flathub.org/repo",
|
||||
{NotSkip, NA, NA, "https://flathub.org/repo/flathub.gpg"}
|
||||
},
|
||||
|
||||
/**
|
||||
* @note 下述上海交大两个镜像站都可使用,但实际使用时出现过无法访问的情况 (GitHub-#178),
|
||||
* 所以额外定义两个镜像站以更改测速链接为一个很小的文件: flathub.gpg
|
||||
* 若无速度,则证明无法访问。
|
||||
* 注意,这会使得测速的效果严重失真。
|
||||
*/
|
||||
|
||||
wr_flathub_siyuan =
|
||||
{
|
||||
"sjtu", "SJTUG-siyuan", "上海交通大学思源镜像站Flathub", "https://mirror.sjtu.edu.cn/",
|
||||
"sjtu-sy", "SJTUG-siyuan", "上海交通大学思源镜像站Flathub", "https://mirror.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/flathub/flathub.gpg"}
|
||||
},
|
||||
|
||||
wr_flathub_zhiyuan =
|
||||
{
|
||||
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站Flathub", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||
"sjtu-zy", "SJTUG-zhiyuan", "上海交通大学致远镜像站Flathub", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/flathub/flathub.gpg"}
|
||||
};
|
||||
|
||||
static Source_t wr_flathub_sources[] =
|
||||
{
|
||||
{&wr_flathub_upstream, "https://flathub.org/repo"},
|
||||
{&wr_flathub_upstream, "https://flathub.org/repo"},
|
||||
{&wr_flathub_siyuan, "https://mirror.sjtu.edu.cn/flathub"},
|
||||
{&wr_flathub_zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/flathub"},
|
||||
{&wr_flathub_zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/flathub"},
|
||||
};
|
||||
def_sources_n(wr_flathub);
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get flathub
|
||||
*/
|
||||
void
|
||||
wr_flathub_getsrc (char *option)
|
||||
{
|
||||
chsrc_run ("flatpak remotes", RunOpt_Default);
|
||||
chsrc_run ("flatpak remote-info flathub", RunOpt_Default);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @consult https://mirrors.sjtug.sjtu.edu.cn/docs/flathub
|
||||
*/
|
||||
@ -53,12 +69,12 @@ wr_flathub_setsrc (char *option)
|
||||
"wget ", source.url, "/flathub.gpg\n"
|
||||
"flatpak remote-modify --gpg-import=flathub.gpg flathub"
|
||||
);
|
||||
puts (note);
|
||||
say (note);
|
||||
|
||||
char *repo_note = "Flathub 中部分软件由于重分发授权问题,需要从官方服务器下载,无法使用镜像站加速\n"
|
||||
"比如 NVIDIA 驱动、JetBrains 系列软件等\n"
|
||||
"尝试运行 flatpak remote-modify flathub --url=https://flathub.org/repo";
|
||||
puts (repo_note);
|
||||
say (repo_note);
|
||||
|
||||
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
@ -67,4 +83,36 @@ wr_flathub_setsrc (char *option)
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
||||
def_target_s (wr_flathub);
|
||||
|
||||
/**
|
||||
* chsrc reset flathub
|
||||
*/
|
||||
void
|
||||
wr_flathub_resetsrc (char *option)
|
||||
{
|
||||
wr_flathub_setsrc (option);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc ls flathub
|
||||
*/
|
||||
Feature_t
|
||||
wr_flathub_feat (char *option)
|
||||
{
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
||||
f.cap_locally = CanNot;
|
||||
f.cap_locally_explain = NULL;
|
||||
f.can_english = false;
|
||||
f.can_user_define = true;
|
||||
|
||||
f.note = "对Flathub目标进行测速的文件非常小,测速效果严重失真,若您知道可供测速的URL,欢迎参与贡献: chsrc issue";
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
def_target_gsrf (wr_flathub);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Created On : <2023-09-10>
|
||||
* Major Revision : 3
|
||||
* Last Modified : <2024-08-28>
|
||||
* Last Modified : <2025-06-16>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@ -33,7 +33,8 @@ wr_homebrew_getsrc (char *option)
|
||||
"echo HOMEBREW_BOTTLE_DOMAIN=$HOMEBREW_BOTTLE_DOMAIN;"
|
||||
"echo HOMEBREW_BREW_GIT_REMOTE=$HOMEBREW_BREW_GIT_REMOTE;"
|
||||
"echo HOMEBREW_CORE_GIT_REMOTE=$HOMEBREW_CORE_GIT_REMOTE;";
|
||||
system (cmd);
|
||||
int status = system (cmd);
|
||||
if (status != 0) { /* NOOP */ }
|
||||
}
|
||||
|
||||
/**
|
||||
|
15
test/fw.c
@ -5,7 +5,7 @@
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* |
|
||||
* Created On : <2024-12-14>
|
||||
* Last Modified : <2024-12-14>
|
||||
* Last Modified : <2025-06-20>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#define Chsrc_Version "Frameworker"
|
||||
@ -66,10 +66,17 @@ main (int argc, char const *argv[])
|
||||
chsrc_view_file (bkup);
|
||||
|
||||
chsrc_log (xy_2strjoin ("CPU arch = ", chsrc_get_cpuarch ()));
|
||||
printf ("chsrc: CPU cores = ");
|
||||
puti (chsrc_get_cpucore ());
|
||||
print ("chsrc: CPU cores = ");
|
||||
println (chsrc_get_cpucore ());
|
||||
|
||||
chsrc_run ("rm " bkup, RunOpt_No_Last_New_Line);
|
||||
if (xy_on_windows)
|
||||
{
|
||||
chsrc_run ("del " bkup, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
chsrc_run ("rm " bkup, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
chsrc_run ("echo " Chsrc_Version " test pass!", RunOpt_Dont_Notify_On_Success);
|
||||
return 0;
|
||||
}
|
||||
|
23
test/xy.c
@ -6,7 +6,7 @@
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* |
|
||||
* Created On : <2023-08-30>
|
||||
* Last Modified : <2024-12-14>
|
||||
* Last Modified : <2025-06-20>
|
||||
*
|
||||
* Test xy.h
|
||||
* ------------------------------------------------------------*/
|
||||
@ -17,9 +17,12 @@ int
|
||||
main (int argc, char const *argv[])
|
||||
{
|
||||
xy_useutf8 ();
|
||||
puti (3);
|
||||
|
||||
println (xy_os_depend_str ("Hello, Windows!", "Hello, Unix!"));
|
||||
|
||||
println (3);
|
||||
double dbl = 3.1415;
|
||||
putf (dbl);
|
||||
println (dbl);
|
||||
say (xy_2strjoin ("Xi", "'an"));
|
||||
say (xy_strjoin (2, "Xi", "'an"));
|
||||
say (xy_strjoin (3, "屈身守分,", "以待天时,", "不可与命争也"));
|
||||
@ -85,7 +88,7 @@ main (int argc, char const *argv[])
|
||||
xy_str_gsub ("abcdefabcdef", "abc", "DEF")); // 等量
|
||||
|
||||
|
||||
assert (xy_file_exist ("./image/chsrc.png"));
|
||||
assert (xy_file_exist ("./doc/image/chsrc.png"));
|
||||
assert (xy_dir_exist ("~"));
|
||||
if (xy_on_windows)
|
||||
{
|
||||
@ -95,12 +98,18 @@ main (int argc, char const *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (xy_file_exist ("~/.bashrc"));
|
||||
/**
|
||||
* debuild 过程会创建虚拟的 HOME 环境,导致检查 .bashrc 的测试会失败,所以我们先检查一下 .profile
|
||||
* 如果没有,则大概率也没有 .bashrc
|
||||
*/
|
||||
if (xy_file_exist ("~/.profile"))
|
||||
{
|
||||
assert (xy_file_exist (xy_bashrc));
|
||||
}
|
||||
assert (xy_dir_exist ("/etc"));
|
||||
}
|
||||
|
||||
|
||||
puts (xy_normalize_path (" \n ~/haha/test/123 \n\r "));
|
||||
println (xy_normalize_path (" \n ~/haha/test/123 \n\r "));
|
||||
assert_str (xy_normalize_path ("~/haha/test"), xy_parent_dir (" ~/haha/test/123"));
|
||||
|
||||
xy_succ ("测试完成", "xy.h 测试全部通过");
|
||||
|
@ -1,10 +1,11 @@
|
||||
# ---------------------------------------------------------------
|
||||
# File Name : download-pre-onGitHub.ps1
|
||||
# File Name : download-pre-on-GitHub.ps1
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Created On : <2023-09-21>
|
||||
# Last Modified : <2024-10-25>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
# Download all files from the `pre` release on GitHub
|
||||
# Download all files from the `pre` release on GitHub:
|
||||
# https://github.com/RubyMetric/chsrc/releases/tag/pre
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
$destination = "~\Desktop\chsrc-pre-onGitHub"
|
||||
@ -22,6 +23,7 @@ $names = @(
|
||||
'chsrc-aarch64-linux'
|
||||
'chsrc-riscv64-linux'
|
||||
'chsrc-armv7-linux'
|
||||
'chsrc_latest-1_amd64.deb'
|
||||
)
|
||||
|
||||
# Like https://github.com/RubyMetric/chsrc/releases/download/latest/chsrc-x64-windows.exe
|