Compare commits

...

761 Commits
v0.2.1 ... main

Author SHA1 Message Date
Aoran Zeng 3816263878
CI deprecated `macos-13`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-12-18 14:10:15 +08:00
Aoran Zeng 3657c9f7dd
Prerelease `0.2.3.4` 2025-12-18 14:01:49 +08:00
happygame f5c78c5a04 Fix: 修复 Mac 上 `uv` 换源 #323 2025-12-18 13:56:12 +08:00
dependabot[bot] db9449993b Bump actions/download-artifact from 6 to 7
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 21:20:15 +08:00
dependabot[bot] 6613c676cc Bump actions/upload-artifact from 5 to 6
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 21:19:48 +08:00
dependabot[bot] b8ff421a8a Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-25 10:50:06 +08:00
Aoran Zeng 7e6c90319d
Prerelease `0.2.3.3`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-11-09 13:05:48 +08:00
Aoran Zeng 9a6f39216c
Fix `Debian` recipe: 多余的 `/`
[GitHub #319]
2025-11-09 12:58:30 +08:00
Aoran Zeng 55aef454e9
Prerelease `0.2.3.2`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-10-30 20:21:12 +08:00
Aoran Zeng 64581bb718
Update `lefthook.yml` 2025-10-30 20:20:21 +08:00
Aoran Zeng 46e2cb8d43
Add missing `\n` for `Arch`
[GitHub #317]
2025-10-30 20:19:36 +08:00
Aoran Zeng c22fae679e
Rewrite `chsrc_prepend_to_file()`
[GitHub #317]
2025-10-30 20:18:08 +08:00
Aoran Zeng 6a527dba00
Fix deb building in CI
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-10-29 13:28:56 +08:00
Aoran Zeng dafbb302bb
Fix `cli.pl` 2025-10-29 13:25:27 +08:00
Aoran Zeng 6e03939f45
Update doc 2025-10-29 12:41:07 +08:00
Aoran Zeng 1264b4192f
Fix deb building in CI 2025-10-29 11:35:38 +08:00
Aoran Zeng 332186224f
Prerelease `v0.2.3.1`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-10-28 22:34:40 +08:00
Aoran Zeng fed349827c
Rename to helper.c 2025-10-28 22:29:57 +08:00
Aoran Zeng fd309e7300
Update `lefthook.yml` 2025-10-28 20:21:28 +08:00
Aoran Zeng 4a13358c8b
Use internal warn for xy.h 2025-10-28 20:10:04 +08:00
Aoran Zeng 8833eb99c1
Update lefthook.yml 2025-10-28 20:00:34 +08:00
Aoran Zeng 6af042ca9f
Update lefthook.yml 2025-10-28 19:38:07 +08:00
Aoran Zeng 0c3405803a
Update lefthook.yml 2025-10-28 19:30:55 +08:00
Aoran Zeng cbf22a7f29
Add lefthook.yml 2025-10-28 19:01:21 +08:00
Aoran Zeng 37710884a8
Add `xy.os_family` 2025-10-28 14:55:17 +08:00
Aoran Zeng 066ac191a6
Refactor `xy_ptr_replace()` 2025-10-28 13:44:42 +08:00
dependabot[bot] 985a6344b3 Bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 13:11:33 +08:00
dependabot[bot] 8e392b04b8 Bump actions/download-artifact from 5 to 6
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 13:10:45 +08:00
曾奥然 6060b325be
Merge pull request #300 from Mikachu2333/fix/free_hwnd
处理 `xy.h` 内存以及部分资源未释放的问题
2025-10-28 13:10:03 +08:00
曾奥然 d84bdba08a
Merge branch 'dev' into fix/free_hwnd 2025-10-28 13:09:06 +08:00
Aoran Zeng c6897bd73e
Remove `free()` in recipes 2025-10-27 22:11:34 +08:00
Aoran Zeng 1058d3310b
Rename option controlling API to `deny` 2025-10-27 22:05:17 +08:00
Aoran Zeng 28d8e4ad0c
Only use `$(OS)` to ensure MSYS2
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-10-15 18:33:21 +08:00
Aoran Zeng 8ebe5812ed
Redefine Windows resource script macro 2025-10-15 18:21:41 +08:00
Aoran Zeng 19d09e537a
Rename directory from `res` to `resource` 2025-10-15 18:10:19 +08:00
Aoran Zeng ebc9e167f2
Refactor Windows resource compiling 2025-10-15 18:09:50 +08:00
曾奥然 e030c8095e
Merge pull request #307 from Mikachu2333/feat/win_rc_support
为win的exe文件增添附加的属性,便于区分版本
2025-10-15 17:10:18 +08:00
Aoran Zeng f926834384
避免API使用消极用语 2025-10-15 17:02:43 +08:00
Mikachu2333 6af3e51566
修复Android系统检测 (#313) 2025-10-15 16:51:04 +08:00
Mikachu2333 990b8d0df3 refactor(lib): 重命名字符串替换函数、优化空指针处理 2025-10-15 15:05:48 +08:00
Mikachu2333 1ac8b892e2 style(lib): 调整函数参数括号前空格 2025-10-15 15:05:48 +08:00
Mikachu2333 c44377f2d9 build(lib): 更新版本号和最后修改日期 2025-10-15 15:05:48 +08:00
Mikachu2333 16602d0e7f refactor(lib): 重命名字符串替换函数
将函数名从 `xy_str_swap` 更改为 `xy_str_replace`,以更准确地反映其实际功能。
该函数并非简单交换两个字符串,而是用新字符串替换旧字符串的内容。

此更改涉及多个文件中的调用点,包括路径处理和文件读取相关的逻辑。
2025-10-15 15:05:48 +08:00
Mikachu2333 6f312a66c0 fix(lib): 优化字符串前缀删除逻辑并修复内存泄漏
重构 `xy_str_delete_prefix` 函数以避免不必要的内存分配和释放,
直接使用原字符串进行处理。同时修复 `xy_dir_exist` 函数中 system
调用后未释放临时命令字符串的内存泄漏问题。
2025-10-15 15:05:48 +08:00
Mikachu2333 948d55185f 修复 xy_normalize_path 内存泄漏问题 2025-10-15 15:05:48 +08:00
Mikachu2333 41783b8531 修复 xy_str_strip 误释放的问题 2025-10-15 15:05:48 +08:00
Mikachu2333 5588beb542 修复 xy_str_delete_prefix 误释放的问题 2025-10-15 15:05:48 +08:00
Mikachu2333 547931c4e4 修复 xy_detect_os 内存泄露 2025-10-15 15:05:48 +08:00
Mikachu2333 e64778911a 修复 xy_parent_dir 内存泄露 2025-10-15 15:05:48 +08:00
Mikachu2333 2a9d13bfc8 修复 xy_normalize_path 内存泄露 2025-10-15 15:05:48 +08:00
Mikachu2333 a3600bf05f 修复 xy_dir_exist 的内存泄露 2025-10-15 15:05:47 +08:00
Mikachu2333 437729a5cf 改进 xy_file_exist 的变量命名,修复内存泄露 2025-10-15 15:05:47 +08:00
Mikachu2333 b2a844b676 修复 xy_file_to_str 的内存泄露 2025-10-15 15:05:47 +08:00
Mikachu2333 5771a308a6 xy.h + `xy_str_swap` 帮助释放内存 2025-10-15 15:05:47 +08:00
Mikachu2333 0b4215f257 修复 core.c 中未手动释放的内存 2025-10-15 15:05:47 +08:00
Mikachu2333 cfe850382d revert(Makefile): 彻底回退,未保留任何更改 2025-10-15 14:55:13 +08:00
Mikachu2333 717b0f96b8 feat(build): 增强Windows支持,动态检测目标机器类型 2025-10-15 14:55:13 +08:00
Mikachu2333 91692d6215 build(Makefile): 更新编译配置以包含新的头文件路径 2025-10-15 14:55:13 +08:00
Mikachu2333 6aac016c02 refactor(include): 更新头文件引用路径 2025-10-15 14:55:13 +08:00
Mikachu2333 1829f6e622 feat(chsrc): 移除一处无用的宏定义,删除文档过时内容 2025-10-15 14:55:13 +08:00
Mikachu2333 b84f2f9edd feat(build): 支持编译资源文件
修复just
修复makefile
2025-10-15 14:55:13 +08:00
Mikachu2333 de75aaa62b docs(chsrc): 更新文档贡献者信息 2025-10-15 14:55:13 +08:00
Mikachu2333 a5e358fc4a feat(logo): 添加项目图标文件
svg为矢量图,因无损所以可作为备份
2025-10-15 14:55:12 +08:00
Mikachu2333 9666b769a1 build(.gitignore): 添加 .res 文件到忽略列表 2025-10-15 14:55:12 +08:00
dependabot[bot] 730d18a8a9
Bump peter-evans/create-or-update-comment from 4 to 5 (#314)
Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 4 to 5.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/v4...v5)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 13:00:57 +08:00
Mikachu2333 d6c2111868
更新 `Perl` recipe (#304) 2025-10-11 19:27:58 +08:00
dependabot[bot] 9dfffbb8f2 Bump peter-evans/create-or-update-comment from 4 to 5
Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 4 to 5.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/v4...v5)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-07 09:42:49 +08:00
Aoran Zeng db2ba39763
Bump version to `v0.2.3`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-10-06 18:35:14 +08:00
Aoran Zeng ec43c09caf
使用两种维护信息展示方式 2025-10-06 18:25:56 +08:00
Aoran Zeng cc85521a93
重命名部分 API 2025-10-06 17:40:48 +08:00
Mikachu2333 54dbb0ea68 调整 contributor 2025-10-06 14:40:05 +08:00
Mikachu2333 984186f376 重命名 `pl_write_rust_config`
增加前缀避免命名冲突
2025-10-06 14:40:05 +08:00
mikachu2333 1a791f2fd1 fix `rust_cargo_getsrc` unexcepted on linux 2025-10-06 14:40:05 +08:00
Mikachu2333 c6b4049a36 重命名 `rust_cargo_note_get_src_default`,增加 `pl_` 前缀避免冲突
删除了一处无用的赋值
2025-10-06 14:40:05 +08:00
Mikachu2333 e335d34eee 删除 rawstr4c 多余的rust常量 2025-10-06 14:40:05 +08:00
Mikachu2333 0ff604060d 修复cargo换源
原来使用了sed和grep导致在win上无法运行
现在直接手动解析str
2025-10-06 14:40:05 +08:00
Mikachu2333 dec55705c7 source: fix cargo 2025-10-06 14:40:05 +08:00
Mikachu2333 4e4b4731ee add test files 2025-10-06 14:40:05 +08:00
Mikachu2333 31c93f0844 改进 chsrc_prepend_to_file
1. 改进了获取新创建文件名的方式
2. 改进了内存泄漏问题
2025-10-06 13:56:54 +08:00
Mikachu2333 04da1243f5 修复 chsrc_make_tmpfile 在win上错误处理不完善的问题 2025-10-06 13:56:54 +08:00
Mikachu2333 0a49c7b2d9 移除点赞的步骤 2025-10-06 13:54:34 +08:00
Mikachu2333 da003f5fd1 增加 xy_str_take_until_newline 2025-10-03 09:04:24 +08:00
Mikachu2333 027c40c8e9 增加 xy_str_find 2025-10-03 09:04:24 +08:00
Mikachu2333 bb2d3af1f3 增加相应的测试 2025-10-03 09:03:35 +08:00
Mikachu2333 128a9c2c8b 改进 chsrc_overwrite_file 函数 2025-10-03 09:03:35 +08:00
Mikachu2333 9aa000c3a6 为win实现chsrc_prepend_to_file 2025-10-03 09:03:35 +08:00
Mikachu2333 f92ebbee04 消歧义chsrc_make_tmpfile的参数 2025-10-03 09:03:35 +08:00
Mikachu2333 5ccd609dd6 chsrc_log_write 为覆写增加提示 2025-10-03 09:03:35 +08:00
Mikachu2333 7648b6b2f2 增加 xy_file_to_str 2025-10-01 18:54:44 +08:00
Mikachu2333 ebf0176245 add url tip 2025-10-01 14:34:53 +08:00
Mikachu2333 4bea910d4d fix 2025-10-01 14:34:53 +08:00
Mikachu2333 14be64fc1d update comments 2025-10-01 14:34:53 +08:00
Mikachu2333 e8d1890c81 fix error 2025-10-01 14:34:53 +08:00
Aoran Zeng 438e19a4d6
Fix Perl test 2025-09-27 18:06:13 +08:00
Aoran Zeng c1e3522303
podchecker 2025-09-27 12:23:38 +08:00
Aoran Zeng 143bc80870
更新Bug报告模版
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-09-19 12:14:30 +08:00
Aoran Zeng a04ea51ab5
改变版本时间的输出方式 2025-09-19 12:12:47 +08:00
Aoran Zeng bceeaa8a21
停止告知用户有关精准测速与模糊测速的区别 2025-09-19 11:53:49 +08:00
Aoran Zeng d478be8431
调整时间打印位置 2025-09-19 11:44:04 +08:00
happygame d424ed2850 refactor(cargo): 优化配置文件解析和跨平台检查 2025-09-19 11:06:26 +08:00
happygame 6d5ab715e5 fix(cargo): 修复 cargo getsrc
1. 如果存在配置文件,则过滤出 mirror
2. 如果不存在配置文件或配置文件未定义 source.mirror 则显示默认源
2025-09-19 11:06:26 +08:00
happygame 885bb5103b feat(cargo): 实现cargo自动换源
参考 uv 换源实现

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 11:06:26 +08:00
Mikachu2333 d71ea423dd
Use yellow as error log color when use `RunOpt_Dont_Abort_On_Failure` 2025-09-13 11:26:27 +08:00
Aoran Zeng d1149d8d00
使用默认值 2025-09-12 20:55:59 +08:00
Aoran Zeng a7989d3131
使用默认值 2025-09-12 20:06:42 +08:00
Aoran Zeng f2228cb34d
尝试使用默认 token 2025-09-12 19:54:16 +08:00
Aoran Zeng 9758a79d25
Prerelease `v0.2.2.4`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-09-12 12:43:00 +08:00
Aoran Zeng 2f11a11623
更新 `rawstr4c.h` 2025-09-12 12:42:12 +08:00
Aoran Zeng 7b01893dc8
尽量消除对 `system()` 的直接调用 2025-09-12 12:38:26 +08:00
Aoran Zeng 9d1a287f91
增加 `chsrc_run_directly()` 并修复 `pip` 在 `get` 时在 Windows 上找不到路径的问题
[GitHub #286]
2025-09-12 12:30:03 +08:00
happy-game c7e5c1fafb
Merge pull request #286 from happy-game/main
fix(pip): 修复 pip 的 getsrc
2025-09-10 15:12:21 +08:00
happy-game d3e8024553 fix(pip): 修复 pip 的 getsrc
使用  `python -m pip config get global.index-url 2>/dev/null`
获取源,失败时会退至显示默认源

Close: #272
2025-09-10 04:52:34 +00:00
HeZongLun 32feeaea1b 添加了 OCaml 的官方镜像源
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
Signed-off-by: HeZongLun <hezonglun123456@outlook.com>
2025-08-27 10:56:36 +00:00
LY 95de30d62d 为 Arch Linux (及 CN) 添加上海交通大学的镜像源 2025-08-27 18:53:31 +08:00
Aoran Zeng 0d6523eba1
补充 Java recipe 注释
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
[GitHub #278]
2025-08-27 15:23:35 +08:00
Aoran Zeng 9f52a4d2be
重命名为 `xy_quiet_cmd()` 2025-08-27 15:13:15 +08:00
Aoran Zeng cf07b13776
重命名为 `xy_run_get_stdout()` 2025-08-27 14:52:54 +08:00
Aoran Zeng afc4ba3d06
添加 `xy_run_get_status()` 2025-08-27 14:50:38 +08:00
HeZongLun 4cffe05711 添加了 `*BSD` 的官方镜像源 (Gitee !13 )
* 添加了 `OpenBSD` 的官方镜像源
* 添加了 `NetBSD` 的官方镜像源
* 添加了 `FreeBSD` 的官方镜像源
2025-08-27 06:19:52 +00:00
Aoran Zeng 7f1832b5fd
优化注释 2025-08-27 12:17:49 +08:00
Aoran Zeng 8e1f6a35f6
Bump `xy` version to `v0.2.0` 2025-08-27 12:05:33 +08:00
Aoran Zeng 55865d6a7b
使用 `xy.` 2025-08-27 11:58:43 +08:00
Aoran Zeng 28d913c58b
使用 `xy.os_devnull` 2025-08-27 11:54:53 +08:00
Aoran Zeng 90315917e9
使用 `xy.enable_color` 2025-08-27 11:53:08 +08:00
Aoran Zeng 60ad6c1fc6
简化 Java recipe 源信息填充方式
[GitHub #278]
2025-08-27 11:44:37 +08:00
Aoran Zeng bcc3206bdd
稍简化 Java recipe 实现 以及 格式化代码
[GitHub #278]
2025-08-27 11:32:06 +08:00
Aoran Zeng b309c46a4c
重命名为 `chef_set_user_agent()`
[GitHub #278]
2025-08-27 11:07:05 +08:00
Aoran Zeng 58ef09fadd
更新镜像站信息
[GitHub #278]
2025-08-27 10:57:30 +08:00
Aoran Zeng 5b8bf70407
更新贡献者信息
[GitHub #278]
2025-08-27 10:53:14 +08:00
Aoran Zeng 78ff7adf52
尝试解决不同IDE下editorconfig不同的表现 2025-08-27 10:42:30 +08:00
曾奥然 844cd55cde
增强 Java recipe #278 from BingChunMoLi/dev 2025-08-27 10:28:13 +08:00
Aoran Zeng 64b5df65b1
修复测试文件 `fw.c` 2025-08-27 10:06:37 +08:00
BingChunMoLi b98a616bcd
fix: 手机修改遗留变更 2025-08-26 19:37:23 +08:00
Aoran Zeng 7b18dfee7b
修改参数名称
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-08-26 17:50:16 +08:00
HeZongLun 56198df675
修改了错误 2025-08-26 07:42:28 +00:00
冰彦糖 49e15b1584
更新 Java.c
避免额外的函数定义
2025-08-26 11:01:08 +08:00
冰彦糖 8b4504fc07
更新 core.c
为user_agent设置正确的默认值
2025-08-26 10:59:27 +08:00
HeZongLun 99dd21f719
修复了代码样式问题 2025-08-26 02:12:11 +00:00
BingChunMoLi 7c9e351fc5
fix: 设置user_agent 支持阿里云 测速 2025-08-25 23:05:03 +08:00
HeZongLun 1cac4e8878
添加了 MSYS2 的官方镜像源 2025-08-25 12:57:52 +00:00
BingChunMoLi ac50bd24cb
fix: 错误的检测
更好的提示
2025-08-24 15:49:20 +08:00
BingChunMoLi 51863e7808
fix: error 2025-08-24 15:37:59 +08:00
Aoran Zeng f42088fa9e
更新贡献者信息
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-24 11:48:21 +08:00
HeZongLun d22a4e50bc 添加了 PHP 的官方镜像 2025-08-23 20:52:32 +08:00
BingChunMoLi c872c9122d
fix: 合并问题 2025-08-23 14:50:03 +08:00
冰彦糖 93088fe4b8
Merge branch 'dev' into dev 2025-08-23 13:58:54 +08:00
BingChunMoLi 645a3d6bf1
feat: 使用xy_run_capture 防止查找不到maven home 返回错误的结果 2025-08-23 13:28:11 +08:00
BingChunMoLi 6a89e41934
fix: user_agent 2025-08-23 13:14:28 +08:00
BingChunMoLi f2a50d0963
feat: custom_user_agent 2025-08-23 12:58:23 +08:00
Aoran Zeng 43ff5c3fd1
消除 warning
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-22 19:16:58 +08:00
Mikachu2333 981a191de8
优化 VS Code DEBUG 设置 (#270) 2025-08-22 18:54:02 +08:00
Aoran Zeng fd21308870
Leader target 记录 follower target 贡献者 2025-08-22 18:39:58 +08:00
Aoran Zeng 3f82ef355f
更新 `AlmaLinux` 的精准测速链接 2025-08-22 18:25:59 +08:00
Aoran Zeng 2a3aa24995
更新维护者信息 2025-08-22 17:39:17 +08:00
HeZongLun ad1e488b70 添加了Haskell、Juila、Lua 的官方镜像源 2025-08-22 09:35:53 +00:00
Aoran Zeng 6267972622
Misc 2025-08-22 17:33:13 +08:00
Aoran Zeng 25965b18d7
使用新宏 2025-08-22 17:15:11 +08:00
Aoran Zeng 18ba902da5
规范注释 2025-08-22 16:41:05 +08:00
Aoran Zeng 536caa73eb
更新文档 2025-08-22 16:29:52 +08:00
Aoran Zeng 4237e8272a
DEBUG 模式下运行所有 prelude 2025-08-22 16:06:16 +08:00
Aoran Zeng e7aae2808d
修复 `nvm` 的 `ls` 问题 2025-08-22 16:05:53 +08:00
Aoran Zeng 475e8f3060
更新 `chef_debug_target()` 2025-08-22 15:01:12 +08:00
Aoran Zeng 64924a7ffc
重命名为 `chsrc_use_this_source()` 2025-08-22 14:40:25 +08:00
Aoran Zeng c8818e4923
重命名为 `chef_set_sauciers()` 2025-08-22 14:36:55 +08:00
Aoran Zeng 6600099283
重命名 contributors 为 sauciers 2025-08-22 14:34:58 +08:00
Aoran Zeng 8130f11cd1
修复 Python 和 JavaScript 组中 target 的 `ls` 问题 2025-08-22 13:38:41 +08:00
Aoran Zeng 106cb97e08
添加 `chef_use_other_target_sources()` 2025-08-22 13:11:45 +08:00
Aoran Zeng adca7b3ea2
使用 `chef_prep_this()` 2025-08-22 13:08:27 +08:00
Aoran Zeng 12e69edb86
添加 `chef_prep_this()` 2025-08-22 13:06:55 +08:00
Aoran Zeng 0a51b7ebd8
重命名 last message 函数 2025-08-22 12:27:34 +08:00
Aoran Zeng eb995e055d
添加 user_data 2025-08-22 12:16:53 +08:00
Aoran Zeng 1eb0e7ee06
重构部分 cli_print 函数重新使编译成功 2025-08-22 12:11:41 +08:00
Aoran Zeng ed4545d9f2
将 `contributors` 字段挪至 `ProgStore` 中 2025-08-22 11:29:58 +08:00
Aoran Zeng 5375a9da19
重写 `iterate_menu()` 2025-08-22 11:24:26 +08:00
Aoran Zeng 1f81fa4efc
添加 `xy_seq_find()` 2025-08-22 11:23:19 +08:00
Aoran Zeng 4b11ee3d8b
重写 `menu.c` 2025-08-22 11:01:13 +08:00
Aoran Zeng 83e8084d22
添加 `ProgStore` 2025-08-22 11:00:41 +08:00
Aoran Zeng 4d70428e35
`ls` 时备注信息增加空行 2025-08-22 09:45:35 +08:00
Aoran Zeng 16dff95df0
修复贡献者id
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-08-21 20:12:05 +08:00
Aoran Zeng d7ca422100
更新维护信息显示方式 2025-08-21 19:22:26 +08:00
Aoran Zeng f1eaffab4a
为 Chef 和 Cooks 人数设限制 2025-08-21 18:53:25 +08:00
Aoran Zeng a08ef58579
添加维护者信息 2025-08-21 18:47:33 +08:00
Aoran Zeng 2f46cd63f5
更新维护信息显示方式 2025-08-21 18:41:15 +08:00
Aoran Zeng 4e9ea3ccc2
修复某位贡献者信息 2025-08-21 18:40:08 +08:00
Aoran Zeng 46083f03ec
添加 `chef_debug_contributor()` 2025-08-21 18:28:33 +08:00
Aoran Zeng 2156dbacad
修复编译错误 2025-08-21 18:12:49 +08:00
Aoran Zeng 7d7e6e1702
更新 pl 的 `chef_set_cooks()` 2025-08-21 18:03:46 +08:00
Aoran Zeng 6776e9a1a9
更新 wr 与 os 的 `chef_set_cooks()` 2025-08-21 17:46:54 +08:00
Aoran Zeng c609a10988
删除 `authors` 字段,将其由 `cooks` 代替 2025-08-21 17:16:33 +08:00
Aoran Zeng 79cbceb683
添加 `chef_verify_contributor()` 以及 重写 `chef_set_chef()` 2025-08-21 16:48:07 +08:00
Aoran Zeng 404807e69b
添加 `chsrc_panic()` 2025-08-21 16:46:16 +08:00
Aoran Zeng 4ef5fc7f18
使用 `xy_panic()` 2025-08-21 16:25:52 +08:00
Aoran Zeng 449da90daa
添加 `xy_developer_mistake()` 2025-08-21 16:04:09 +08:00
HeZongLun f7f52691a7 添加了 Clojure、R 的官方镜像源 2025-08-21 10:43:37 +08:00
Aoran Zeng 058fc62568
重命名为 `chsrc_framework_init()`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-08-21 00:18:52 +08:00
Aoran Zeng 224021f0f7
更新 xy 测试 2025-08-21 00:15:38 +08:00
Aoran Zeng 98b2e14747
动态检测 OS 以及添加 `xy_init()` 2025-08-21 00:14:02 +08:00
BingChunMoLi 1ea20097ad
fix: 补充缺少的 pl_java_find_maven_home and pl_java_is_home
添加maven-daemon 和 mvnd 命令
2025-08-21 00:13:14 +08:00
Aoran Zeng e6d512eb83
重命名为 `XY_Build_On_xx` 2025-08-20 22:05:07 +08:00
Aoran Zeng 9d7543b681
更新文件头 2025-08-20 21:53:22 +08:00
HeZongLun 3d8a98a2a9 update src/chsrc-main.c.
添加了 HeZongLun 的贡献信息

Signed-off-by: HeZongLun <hezonglun123456@outlook.com>
2025-08-20 13:00:43 +00:00
HeZongLun 4a5aba9140 添加了 Perl 的官方镜像源 2025-08-20 13:00:06 +00:00
Aoran Zeng 7d230bcf57
重命名为 `xy_run_iter_lines()` 2025-08-20 19:52:54 +08:00
Aoran Zeng f195709493
实现 `xy_run_capture()`
[GitHub #268 #269]
2025-08-20 19:49:01 +08:00
Aoran Zeng 98516e0f4d
更新代码风格文档 2025-08-20 18:35:58 +08:00
Aoran Zeng 0d232fba92
全部使用 `xy_strcat()` 弃用 `xy_strjoin()` 2025-08-20 18:32:30 +08:00
Aoran Zeng aabec77833
更新贡献者 2025-08-20 18:27:30 +08:00
Aoran Zeng 63b3832ce9
重命名为 `xy_use_utf8()` 2025-08-20 18:19:58 +08:00
Aoran Zeng 81b9c2911a
使用 `chsrc_register_contributors()` 并将大部分 `#include` 放于 `menu.c` 中 2025-08-20 18:14:30 +08:00
Aoran Zeng f4718a05fd
添加 `chef_register_contributor()` 2025-08-20 18:12:23 +08:00
Aoran Zeng 6496ff0b9e
使用 `chsrc_framework_prelude()` 2025-08-20 17:01:01 +08:00
Aoran Zeng 1773745b76
为 `Contributor_t` 增加 `id` 和 `display_name` 2025-08-20 16:59:16 +08:00
Aoran Zeng ef65acc5df
迁移 `xy_strjoin()` 2025-08-20 16:42:04 +08:00
Aoran Zeng 51b6ece5b7
测试 map 2025-08-20 16:37:54 +08:00
Aoran Zeng 560a47f358
实现 `xy_map_get/each()` 2025-08-20 16:37:35 +08:00
Aoran Zeng ad087be36a
实现 `xy_map_set()` 2025-08-20 16:15:32 +08:00
Aoran Zeng 0a421eb1cb
测试 seq 2025-08-20 15:34:29 +08:00
Aoran Zeng b4e2a56abc
实现 `xy_seq_at()` 2025-08-20 15:34:05 +08:00
Aoran Zeng 2692f07a2b
使用 `xy_cant_be_null()` 2025-08-20 15:06:50 +08:00
Aoran Zeng 57d81b2edd
实现 `xy_seq_each/len/first/last()` 2025-08-20 14:57:58 +08:00
Aoran Zeng 77a3b458bd
实现 `xy_seq_pop()` 2025-08-20 13:31:15 +08:00
Aoran Zeng e2c8525027
添加 `xy_seq_push()` 2025-08-20 13:01:46 +08:00
Aoran Zeng c33a9dafd0
Rename `xy_arylen()` to `xy_c_array_len()` 2025-08-20 12:30:27 +08:00
Aoran Zeng 9023f8d0e7
Rename `xy_strjoin()` to `xy_strcat()` 2025-08-20 12:25:08 +08:00
Aoran Zeng 6fb8677451
标注更多 flavor 2025-08-20 12:02:37 +08:00
Aoran Zeng 6178b212a0
添加 `echo()` 并使用 `@flavor` 标注API参考依据 2025-08-20 11:42:45 +08:00
Aoran Zeng 34fa12edde
添加 `xy_noop()` 2025-08-20 11:32:37 +08:00
Mikachu2333 b6a910143d
修复某些系统`which`不存在的问题 (#271) 2025-08-20 10:45:08 +08:00
Aoran Zeng 795ed0964f
更新代码风格文档
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-19 09:55:03 +08:00
Aoran Zeng 3dfe2bb3cf
Fix xy.c 2025-08-19 09:52:16 +08:00
Mikachu2333 978d4c68c4 typo 2025-08-19 09:19:33 +08:00
Mikachu2333 03af965c4e fix 2025-08-19 09:19:33 +08:00
Mikachu2333 80f4690b14 remove warn msg 2025-08-19 09:19:33 +08:00
Mikachu2333 62341da96d improve 2025-08-19 09:19:33 +08:00
Mikachu2333 1a1a863938 update 2025-08-19 09:18:33 +08:00
Mikachu2333 329b97a245 fix with suggestions 2025-08-19 09:18:33 +08:00
Mikachu2333 62bbe6de24 avoid vscode autoAddFileAssociations 2025-08-19 09:18:33 +08:00
Mikachu2333 5e4bf57d45 template comments 2025-08-19 09:18:33 +08:00
Mikachu2333 e98361f33b xy.h comments 2025-08-19 09:18:33 +08:00
BingChunMoLi afd1b08b6d
feat: maven 测速预览 2025-08-18 23:31:20 +08:00
BingChunMoLi 7dfe942973
Merge branch 'feat-maven_daemon_support' into dev
# Conflicts:
#	src/recipe/lang/Java.c
#	src/recipe/menu.c
2025-08-18 19:49:32 +08:00
BingChunMoLi 7e00ec6523
Merge branch 'feat-java_tencent_support' into dev
# Conflicts:
#	src/recipe/lang/Java.c
2025-08-18 19:43:37 +08:00
Aoran Zeng 555eb91d35
Fix and add test 2025-08-18 19:23:32 +08:00
Aoran Zeng 0d19ee249f
Fix `xy_normalize_path()` 2025-08-18 19:23:16 +08:00
Mikachu2333 4d813893e9 add tests 2025-08-18 18:42:44 +08:00
Mikachu2333 07685390b0 fix parent 2025-08-18 18:42:44 +08:00
Mikachu2333 0a91a9bdd5 test 2025-08-18 18:42:44 +08:00
Aoran Zeng 5f77b80a4b
Ignore the annoying changes to `.vscode/settings.json`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-17 17:38:50 +08:00
Aoran Zeng 97f307c93c
Add `Markdown` writing style 2025-08-17 17:27:58 +08:00
Aoran Zeng e2146a5709
Update code style 2025-08-17 17:17:56 +08:00
Mikachu2333 a3cf4fcc99
fix pwsh path error (#250)
* add version

* improve test actions

* use XY_On_Windows

---------

Co-authored-by: mikachu2333 <mikachu23333@zohomail.com>
2025-08-17 16:15:52 +08:00
Aoran Zeng 41c449f4ac
Update README 2025-08-17 11:09:51 +08:00
Aoran Zeng 2e3dc93499
Update doc 2025-08-17 11:02:26 +08:00
Aoran Zeng a31bfe0377
Update README 2025-08-17 10:59:50 +08:00
dependabot[bot] 6315f44950
Bump actions/download-artifact from 4 to 5 (#253)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-17 09:33:54 +08:00
dependabot[bot] fbca61a7e2
Bump actions/checkout from 4 to 5 (#254)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-17 09:33:22 +08:00
Aoran Zeng 3fe354930f
Update recipe template
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-11 06:24:13 +08:00
Aoran Zeng 68175ed8fa
Fix code 2025-08-11 06:13:02 +08:00
Aoran Zeng 162deaf807
Rename doc 2025-08-11 05:35:39 +08:00
Aoran Zeng ef154fed2b
Fix cli test 2025-08-11 05:28:24 +08:00
Aoran Zeng 066a377947
Adjust time order 2025-08-11 05:08:45 +08:00
Aoran Zeng f099a86e53
Use `chef_` 2025-08-11 05:05:15 +08:00
Aoran Zeng 67915c36c4
Improve `Ruby` recipe 2025-08-11 04:58:23 +08:00
Aoran Zeng 9c51e8c0f1
Update doc 2025-08-11 04:47:17 +08:00
Aoran Zeng d48bbc92e0
Update sources 2025-08-11 04:43:21 +08:00
Aoran Zeng a9cb459609
Update manual time 2025-08-11 04:38:29 +08:00
Aoran Zeng c2747c58be
Update doc 2025-08-11 04:37:04 +08:00
Aoran Zeng 41a5e772f5
Add doc 11 2025-08-11 04:33:28 +08:00
Aoran Zeng 8e066b6d5b
Rename doc 2025-08-11 04:14:35 +08:00
Aoran Zeng 8531a2c80e
Rename doc 2025-08-11 04:06:52 +08:00
Aoran Zeng 7e00a49078
Rename doc 2025-08-11 04:04:00 +08:00
Aoran Zeng 24a0aff66d
All recipes use `UpstreamProvider` 2025-08-11 03:43:17 +08:00
Aoran Zeng 1be3dc2a0b
Call `chef_debug_target()` 2025-08-11 03:25:12 +08:00
Aoran Zeng 7c1b3c2a91
Debug note 2025-08-11 03:10:56 +08:00
Aoran Zeng 52004a1033
Remove `chef_forbid_local_mode()` 2025-08-11 03:06:53 +08:00
Aoran Zeng 492ca4288c
Debug with \n 2025-08-11 03:00:26 +08:00
Aoran Zeng 13d4c7a43f
Update contributors 2025-08-11 02:58:47 +08:00
Aoran Zeng e86afb55a6
Using `Cook` 2025-08-11 02:55:52 +08:00
Aoran Zeng d6f2d65579
Adjust doc order 2025-08-11 02:52:28 +08:00
Aoran Zeng b286b3e1b3
Update MAINTAINERS 2025-08-11 02:51:02 +08:00
Aoran Zeng 38e5f7df2e
Add wr aliases 2025-08-10 23:09:25 +08:00
BingChunMoLi 71e7312002
feat: 修改maven_home的获取方式 todo
resolve RubyMetric/chsrc#238
2025-08-10 23:06:31 +08:00
Aoran Zeng dc20eeeb75
Add os aliases 2025-08-10 22:58:09 +08:00
Aoran Zeng 3c42e8be2d
Add pl aliases 2025-08-10 22:49:53 +08:00
BingChunMoLi 9bec7f30cd
feat: support huawei cdn 并且添加精准测速链接
resolve RubyMetric/chsrc#238
2025-08-10 22:43:01 +08:00
BingChunMoLi 5aeb706796
feat: support maven-daemon
resolve RubyMetric/chsrc#183
2025-08-10 22:40:00 +08:00
Aoran Zeng 4da60f0c7d
We should define aliases in target 2025-08-10 22:39:05 +08:00
Aoran Zeng 5af9e5a2b1
Rename to `Docker` 2025-08-10 22:18:11 +08:00
Aoran Zeng a0b7aaabf4
Rename to `Flatpak` 2025-08-10 22:15:02 +08:00
Aoran Zeng 0cde3bb45a
Adjust maintain info 2025-08-10 21:53:05 +08:00
Aoran Zeng 797563c1db
Fix wr recipes 2025-08-10 21:24:42 +08:00
Aoran Zeng 0ecd128f8f
Fix os recipes 2025-08-10 21:10:13 +08:00
Aoran Zeng 097097c664
Fix lang recipes 2025-08-10 20:53:02 +08:00
Aoran Zeng 5c44b140e4
Fix pl recipes 2025-08-10 20:45:56 +08:00
Aoran Zeng fec96b812b
Fix python and js group 2025-08-10 20:37:36 +08:00
Aoran Zeng efd2ea2712
Fix group target 2025-08-10 20:17:21 +08:00
Aoran Zeng 915dbe1477
Fix group target 2025-08-10 20:14:30 +08:00
Aoran Zeng 827a26951b
Use chef_allow_gsr for os 2025-08-10 20:01:19 +08:00
Aoran Zeng f36fd1ccb2
Use chef_allow_gsr for ware 2025-08-10 19:53:21 +08:00
Aoran Zeng ff65de3a75
Use chef_allow_gsr for lang 2025-08-10 19:50:17 +08:00
Aoran Zeng b1ee34862c
Display maintain info 2025-08-10 19:07:05 +08:00
Aoran Zeng bef1fc9f26
Update recipes 2025-08-10 18:55:52 +08:00
Aoran Zeng 616b0caa48
Update pl recipes using chef DSL 2025-08-10 18:33:28 +08:00
Aoran Zeng caa90fee32
Add set by postfix 2025-08-10 15:43:46 +08:00
Aoran Zeng 341369f347
Update pl recipes using chef DSL 2025-08-10 15:01:52 +08:00
Aoran Zeng 27f145ba2b
Remove `def_upstream` 2025-08-10 14:31:07 +08:00
Aoran Zeng c531b8b56e
Rename to `JavaScript` 2025-08-10 13:36:10 +08:00
Aoran Zeng a936136d14
Update BSD and pacman recipes using chef DSL 2025-08-10 13:29:11 +08:00
Aoran Zeng 4d10023993
Update YUM recipes using chef DSL 2025-08-10 13:15:58 +08:00
Aoran Zeng 4829ada7d8
Update APT recipes using chef DSL 2025-08-10 13:04:25 +08:00
Aoran Zeng e36bdffaff
Update os recipes using chef DSL 2025-08-10 12:54:07 +08:00
Aoran Zeng ee8b031ee7
Update instructions 2025-08-10 12:48:45 +08:00
Aoran Zeng 425ae19d9d
Update wr recipes using chef DSL 2025-08-10 12:31:05 +08:00
Aoran Zeng 82aafbca62
Update chef DSL 2025-08-10 12:26:09 +08:00
Aoran Zeng c9940ec71f
Add copilot instructions 2025-08-10 12:13:42 +08:00
Aoran Zeng 1af6008c50
Add doc about code style 2025-08-10 12:06:55 +08:00
Aoran Zeng 820591362b
Update recipe-template 2025-08-10 10:34:51 +08:00
Aoran Zeng aa923b4276
Split chef and chef-helper 2025-08-10 10:33:56 +08:00
Aoran Zeng e235b6dd17
Use allow_ 2025-08-10 10:15:26 +08:00
Aoran Zeng d6fbaf91ce
DSL for user define capability 2025-08-10 10:08:26 +08:00
Aoran Zeng 8458a193a6
Update `struct.h` 2025-08-10 10:07:32 +08:00
Aoran Zeng d146a8a62a
Update os recipes using framework v2 2025-08-10 09:54:52 +08:00
Aoran Zeng fd0907bf4b
Update ware recipes using framework v2 2025-08-10 09:18:19 +08:00
Aoran Zeng 6c86e24b9d
Update recipe template 2025-08-09 21:55:13 +08:00
Aoran Zeng 35ef3a4c37
Update `WinGet` 2025-08-09 21:46:44 +08:00
Aoran Zeng 2d358fbc6a
Add argument option 2025-08-09 21:35:08 +08:00
Aoran Zeng 16d643a8ee
Use less macros in `core.c` 2025-08-09 21:32:27 +08:00
Aoran Zeng 1f1008c440
Simplify chef api 2025-08-09 20:58:50 +08:00
Aoran Zeng 23ba6b8419
Update struct 2025-08-09 20:31:38 +08:00
Aoran Zeng a7001636c9
Print target maintain info 2025-08-09 20:21:41 +08:00
Aoran Zeng 4ff53269f0
Warn when` xy_strdup()` called with NULL 2025-08-09 19:38:14 +08:00
Aoran Zeng ca6498b547
Add `<stdint.h>` for `xy.h` 2025-08-09 19:36:41 +08:00
Aoran Zeng 68b921d9c5
Add recipe file info helper in chef 2025-08-09 19:33:03 +08:00
Aoran Zeng e797b6f282
Move file header info to functions 2025-08-09 19:28:15 +08:00
Aoran Zeng 8ffe5bc12d
Define most content in `prelude()` 2025-08-09 18:34:18 +08:00
Aoran Zeng 777f9175e4
New iterations 2025-08-09 16:41:52 +08:00
Aoran Zeng d3f6e16bc3
Remove old menus 2025-08-09 16:41:30 +08:00
Aoran Zeng 8b60633230
Iterate registry to find target 2025-08-09 15:59:46 +08:00
Aoran Zeng a417afa4b5
Add registry 2025-08-09 14:56:44 +08:00
Aoran Zeng d97365ed4e
Fix: add missing `<ctype.h>`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-08-09 12:26:07 +08:00
Aoran Zeng c3e24ee3d5
Prerelease `v0.2.2.2` 2025-08-09 12:22:37 +08:00
Aoran Zeng 2304d4b2aa
No need to notify when `reset` 2025-08-09 11:52:07 +08:00
Aoran Zeng 52d8673b9b
Rename to `IS_UserDefinedProvider` 2025-08-09 11:30:35 +08:00
Aoran Zeng 91a2fe3488
Update `rawstr4c.md` using `rawstr4c v1.0.0` 2025-08-09 11:09:51 +08:00
Aoran Zeng 173e5a3ffc
Use `println()` for raw strings 2025-08-09 11:05:38 +08:00
Aoran Zeng 64e625d486
Fix: add source URL in script for `openSUSE` 2025-08-09 11:00:33 +08:00
Aoran Zeng da82acc251
Update os using `rawstr4c v1.0.0` 2025-08-09 10:50:14 +08:00
Aoran Zeng ee3bef5eab
Update main using `rawstr4c v1.0.0` 2025-08-09 10:46:45 +08:00
Aoran Zeng 3200e2ab3b
Update Python group using `rawstr4c v1.0.0` 2025-08-09 10:32:13 +08:00
Aoran Zeng 8df5363007
Update `rawstr4c.md` using `rawstr4c v1.0.0` 2025-08-09 10:21:37 +08:00
Aoran Zeng 8df311e700
Update `rawstr4c.md` using `rawstr4c v1.0.0` 2025-08-08 23:08:49 +08:00
Aoran Zeng d7704712d7
Update `rawstr4c.md` for `Homebrew` 2025-08-08 23:03:48 +08:00
Aoran Zeng ab5d20638d
Format `rustup` recipe 2025-08-08 00:20:31 +08:00
Mikachu2333 49cf464eb2
Add accurate speed test for `rustup` 2025-08-08 00:13:06 +08:00
Aoran Zeng 1a73a31e06
Add test for `xy_streql_ic()` 2025-08-08 00:08:32 +08:00
Mikachu2333 695ce1072c
Add `xy_streql_ic` (#242)
* add xy_streql_ic

* fix format

* only target use it
2025-08-08 00:01:33 +08:00
Aoran Zeng c36be5f59c
Format pl file 2025-08-07 23:59:07 +08:00
Aoran Zeng 27243a62bc
Format ps1 file 2025-08-07 23:57:43 +08:00
Aoran Zeng 43131e3653
Update `.editorconfig` 2025-08-07 23:57:02 +08:00
Aoran Zeng fdfd1b20ce
Update VS Code settings 2025-08-07 22:34:06 +08:00
Aoran Zeng e500140bc6
+1 for PR 2025-08-07 20:54:12 +08:00
Aoran Zeng d87b722b1c
Welcome PRer only when opened 2025-08-07 20:40:57 +08:00
Mikachu2333 5e679b1c33
Update VS Code settings to avoid auto format (#239) 2025-08-07 20:25:28 +08:00
Mikachu2333 c490b73072 re-fix 2025-08-07 20:05:44 +08:00
BingChunMoLi 9542ce33bc
feat: java maven 支持tencent镜像
resolve RubyMetric/chsrc#238
2025-08-05 20:08:40 +08:00
Aoran Zeng f17a1c70b8
Update recipes
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-31 16:56:16 +08:00
Aoran Zeng 60ce1ba580
Support `ls` for `NetBSD` 2025-07-31 16:50:09 +08:00
Aoran Zeng 94279c795b
Update `NetBSD` sources 2025-07-31 16:49:53 +08:00
Aoran Zeng a644c271fb
Support `ls` for `openBSD` 2025-07-31 16:38:47 +08:00
Aoran Zeng 013c95386c
Update `OpenBSD` sources 2025-07-31 16:35:28 +08:00
Aoran Zeng 851bb508b1
Support `reset` for `Java`
[GitHub #237]
2025-07-31 16:18:56 +08:00
BingChunMoLi f18c72f471 feat: 添加 contributors 2025-07-30 19:42:55 +08:00
BingChunMoLi d70514e357 feat: 设置默认java仓库地址 2025-07-30 19:42:55 +08:00
Aoran Zeng 26e3c60ae8
println script content
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-28 18:48:17 +08:00
Aoran Zeng 53225997d2
Fix `mkstemps()` argument 2025-07-28 18:43:14 +08:00
Aoran Zeng bfb6022beb
Format code 2025-07-28 18:08:52 +08:00
Mikachu2333 53adda7268 add tlmgr speed test url 2025-07-28 18:04:11 +08:00
Aoran Zeng e95e9f7a9e
Bump version to `v0.2.2`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-26 20:57:02 +08:00
Aoran Zeng 61944e01de
Don't use `printf` in `uv` 2025-07-26 20:49:47 +08:00
Aoran Zeng ff3e80c6ee
Fix: Escape regexp used in grep for `uv` 2025-07-26 20:48:16 +08:00
Aoran Zeng d1fbf1e2af
Fix: Add the missing @ in uv.toml
[GitHub #234]
2025-07-26 19:22:09 +08:00
Aoran Zeng 4d51d5dcd3
Update README
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-22 22:02:32 +08:00
Aoran Zeng 3c2a133fd7
Add images of running status on `Android` 2025-07-22 21:56:38 +08:00
Aoran Zeng e186b33850
Download for Android 2025-07-22 21:19:05 +08:00
Aoran Zeng fde3b37f01
Update bootstrap `Termux` 2025-07-22 20:55:03 +08:00
Aoran Zeng 6dcb85a5f4
Are you lacking the suffix? 2025-07-22 20:07:47 +08:00
Aoran Zeng 434af1cd93
Commonly include first 2025-07-22 19:59:45 +08:00
Aoran Zeng ef09616b77
Commonly include first 2025-07-22 19:56:31 +08:00
Aoran Zeng 9213e86643
Update `Bun` use `rawstr4c` 2025-07-22 19:56:19 +08:00
Aoran Zeng 1754a1a943
This is the last R 2025-07-22 19:49:56 +08:00
Aoran Zeng 94bf2f5caf
Update README 2025-07-22 19:28:17 +08:00
Aoran Zeng 8ecc0fd705
Fix typo 2025-07-22 19:24:58 +08:00
Aoran Zeng 62e94ad00c
Fix small tips 2025-07-22 19:20:58 +08:00
Aoran Zeng ffa8f397ff
Update `chsrc issue` content 2025-07-22 19:18:13 +08:00
Aoran Zeng f4483a40e7
Move last message to `rawstr4c.md` 2025-07-22 18:59:29 +08:00
Aoran Zeng acc55c7d91
Update `Bun` not use R 2025-07-22 18:51:39 +08:00
Aoran Zeng 5e9b56399e
Remove extra empty line when `chsrc_run_as_x_file()` 2025-07-22 18:48:23 +08:00
Aoran Zeng 6b7af05a7f
Update `openSUSE` not use R 2025-07-22 18:46:05 +08:00
Aoran Zeng 86e0165733
Add `Rye` config via `rawstr4c` 2025-07-22 18:42:28 +08:00
Aoran Zeng 6b883db9ac
Update `rawstr4c.md` in PL 2025-07-22 18:32:07 +08:00
Aoran Zeng f6374fae9c
Add `Haskell` cabal config via `rawstr4c` 2025-07-22 18:26:19 +08:00
Aoran Zeng 31f1f30c31
Use `rawstr4c` for usage and `-v` 2025-07-22 18:18:04 +08:00
Aoran Zeng 2ea11f3e83
Fix macOS compiler on GitHub Actions 2025-07-22 17:38:44 +08:00
Aoran Zeng 1b8323816c
Use `gcc` on `macOS` when CI
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-07-22 15:14:44 +08:00
Aoran Zeng 5d89f4f0e6
Check compiler version 2025-07-22 14:53:14 +08:00
Aoran Zeng 8e59c0e0ac
Prerelease `v0.2.2-beta2` 2025-07-22 13:15:36 +08:00
Aoran Zeng 29bdd09dab
Update `cli.pl` 2025-07-22 13:14:24 +08:00
Aoran Zeng f0ae6c1dba
Update strings 2025-07-22 12:45:58 +08:00
Aoran Zeng 4feb51f12f
Update English usage 2025-07-22 12:35:01 +08:00
Aoran Zeng 63f678d1a6
Update Chinese usage 2025-07-22 10:40:20 +08:00
Aoran Zeng c058c91a83
Try build for `Android` 2025-07-22 09:40:41 +08:00
Aoran Zeng d8284ef287
Use `GCC` for `macOS` on GitHub Actions 2025-07-22 08:45:36 +08:00
Aoran Zeng ba8e841dde
Update `03-CONTRIBUTING.md`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-07-21 22:24:39 +08:00
Aoran Zeng 0703551fd0
Prerelease `v0.2.2-beta1` 2025-07-21 22:21:55 +08:00
Aoran Zeng 92f341179b
Use `chsrc_alert2()` 2025-07-21 22:21:07 +08:00
Aoran Zeng fa4a69b4b9
Add `chsrc_alert2()` 2025-07-21 22:10:50 +08:00
Aoran Zeng b8d8ceb7b4
Fix the missing `break` 2025-07-21 21:56:46 +08:00
Aoran Zeng d1ec1f0dd8
Output script content faintly 2025-07-21 21:56:30 +08:00
Aoran Zeng 77278e1119
Update menu 2025-07-21 21:48:36 +08:00
Aoran Zeng f4812cd65b
Support `openSUSE tumbleweed` 2025-07-21 21:48:02 +08:00
Aoran Zeng 7011fc1f79
Update pl recipes 2025-07-21 21:09:11 +08:00
Aoran Zeng 00f6deafb9
Update `Debian` recipe 2025-07-21 20:08:01 +08:00
Aoran Zeng c7015c6504
Update OS recipes 2025-07-21 20:03:06 +08:00
Aoran Zeng 78e863a2a1
Rewrite `openSUSE Leap` recipe 2025-07-21 19:34:41 +08:00
Aoran Zeng a3a8127543
Update OS recipes 2025-07-21 18:54:07 +08:00
Aoran Zeng cf32d388fe
Update doc 2025-07-21 16:46:50 +08:00
Aoran Zeng 62da78c363
Update dev doc 2025-07-21 15:06:24 +08:00
Aoran Zeng 777ca5a246
Update `rawstr4c` location 2025-07-21 10:54:41 +08:00
Aoran Zeng ff82bc632b
Make `rawstr4c` a separate project 2025-07-21 10:45:56 +08:00
Aoran Zeng 38bafe6ed1
Update `.gitignore` 2025-07-21 05:25:57 +08:00
Aoran Zeng e1d25a25c4
Add `-upload` 2025-07-21 05:25:43 +08:00
Aoran Zeng de32ec5aa7
Add `make-distribution.ps1` 2025-07-21 05:19:29 +08:00
Aoran Zeng 3520891247
Fix `META6.json` according to `meta-ok` 2025-07-21 04:40:41 +08:00
Aoran Zeng 4197e6769f
Add `01-distribution.rakutest` 2025-07-21 04:40:15 +08:00
Aoran Zeng e628908baf
Update default test fixture 2025-07-21 03:02:11 +08:00
Aoran Zeng 2300c3052c
Fix prefix 2025-07-21 03:01:27 +08:00
Aoran Zeng 498eabf869
Rewrite tool `README` 2025-07-21 02:46:32 +08:00
Aoran Zeng 88dfac2d86
Use English 2025-07-21 02:39:16 +08:00
Aoran Zeng e31d600cb3
Note for dev 2025-07-21 02:39:02 +08:00
Aoran Zeng 6348cc5187
Add Artistic License 2.0 `LICENSE` 2025-07-21 02:16:56 +08:00
Aoran Zeng 42d6ba7716
Update header 2025-07-21 02:16:29 +08:00
Aoran Zeng 651a4cba3c
Add `META6.json` 2025-07-21 02:07:22 +08:00
Aoran Zeng 88ecbb22de
Add dev doc 2025-07-21 02:06:58 +08:00
Aoran Zeng dee86dbcef
Test default file name 2025-07-21 02:00:50 +08:00
Aoran Zeng e2c79fe87d
Rename test file 2025-07-21 01:43:16 +08:00
Aoran Zeng 56636911b5
Add simple test 2025-07-21 01:42:15 +08:00
Aoran Zeng a36f2f8664
Prefix with module name 2025-07-21 01:38:38 +08:00
Aoran Zeng 3eb948f1cf
Move to sub lib 2025-07-21 01:28:29 +08:00
Aoran Zeng 47129d36f7
Update invoker 2025-07-21 01:15:06 +08:00
Aoran Zeng cf6bf35af0
Move to `run` 2025-07-21 01:13:46 +08:00
Aoran Zeng cfea697870
Move to `bin` 2025-07-21 01:10:15 +08:00
Aoran Zeng c399d074c8
Fix test 2025-07-21 01:05:31 +08:00
Aoran Zeng 4127c83bab
Move ignore config to root config 2025-07-21 01:05:16 +08:00
Aoran Zeng bb14dd3a41
Update README 2025-07-20 14:58:07 +08:00
Aoran Zeng f9ad8ea242
Prerelease `v0.2.2-alpha3`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-19 05:41:06 +08:00
Aoran Zeng 6f913b2170
Larger default allocation size for `xy_strjoin()` 2025-07-19 05:39:47 +08:00
Aoran Zeng 41d1775fb9
Fix: Undercounted one byte in `xy_strjoin()` causes buffer overflow
[GitHub #232]
2025-07-19 05:37:56 +08:00
Aoran Zeng c840acc785
Prerelease `v0.2.2-alpha2`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-16 23:58:26 +08:00
Aoran Zeng 71f3e7b175
Update strings 2025-07-16 23:56:34 +08:00
Aoran Zeng 80c9db59b4
Update doc 2025-07-16 23:53:41 +08:00
Aoran Zeng a813429924
Better help 2025-07-16 23:53:29 +08:00
Aoran Zeng c989f250b0
Update global variable names 2025-07-16 23:14:27 +08:00
Aoran Zeng f62e3f3397
Bump up `rawstr4c` version to `v0.2.1.0` 2025-07-16 23:10:52 +08:00
Aoran Zeng 7669a0417b
Better MAIN 2025-07-16 23:09:59 +08:00
Aoran Zeng 174ba78f0d
Debug Generator 2025-07-16 22:35:09 +08:00
Aoran Zeng e0396164ac
Move `postfix` config value into Config 2025-07-16 22:34:21 +08:00
Aoran Zeng d15d865cc5
Update `rawstr4c.md` 2025-07-16 22:00:22 +08:00
Aoran Zeng 8259a5fd9a
Give Unknown if codeblock not specify 2025-07-16 21:02:44 +08:00
Aoran Zeng 2a27fd4fc1
Move `name` config value into Config 2025-07-16 20:51:08 +08:00
Aoran Zeng f26817f433
Implement namespace 2025-07-16 20:37:19 +08:00
Aoran Zeng a8c82a7476
Re-generate header 2025-07-16 19:46:44 +08:00
Aoran Zeng 3b7147b25a
Bump `rawstr4c` version to `v0.2.0.0` 2025-07-16 19:41:19 +08:00
Aoran Zeng 9aeb3541ed
Fix: not to escape `'` 2025-07-16 19:40:29 +08:00
Aoran Zeng 85d8ee940c
Fix multiple output kinds 2025-07-16 19:33:14 +08:00
Aoran Zeng b1a45fb4d7
Fix output condition 2025-07-16 19:07:46 +08:00
Aoran Zeng 4035984d72
Update `.gitignore` 2025-07-16 19:07:01 +08:00
Aoran Zeng d8b53cbfdb
Add test file 2025-07-16 19:05:57 +08:00
Aoran Zeng 2ec3c3d8d1
Respect `name-literally` 2025-07-16 18:41:27 +08:00
Aoran Zeng ac114dd2f8
Add `translate-` file 2025-07-16 18:24:26 +08:00
Aoran Zeng f64ccf4870
Fix config `output` name 2025-07-16 18:21:21 +08:00
Aoran Zeng 2dbee0b272
Show config blocks when debugging Parser 2025-07-16 18:16:10 +08:00
Aoran Zeng ff14468b14
Use new Config for Generator 2025-07-16 17:54:03 +08:00
Aoran Zeng e0988351eb
Add Config 2025-07-16 17:37:43 +08:00
Aoran Zeng bdba1fac31
Fight with the type 2025-07-16 17:31:11 +08:00
Aoran Zeng 8032921182
Strict types 2025-07-16 15:47:21 +08:00
Aoran Zeng 286843b40b
Rename to `ConfigBlock` 2025-07-16 12:19:05 +08:00
Aoran Zeng 2387b4e9f8
Remove fixtures prefix 2025-07-16 11:19:18 +08:00
Aoran Zeng 15ce694967
Add test file 2025-07-16 11:17:40 +08:00
Aoran Zeng 08da1c712b
Implement inherited config 2025-07-16 11:16:46 +08:00
Aoran Zeng 04b15fec17
Add `USAGE` 2025-07-16 03:29:58 +08:00
Aoran Zeng 902a40bed7
Move files handler back to main 2025-07-16 03:12:05 +08:00
Aoran Zeng 66e5c1f7e0
Adjust Generator according to the new Parser 2025-07-16 02:28:15 +08:00
Aoran Zeng c86b75987e
Parser new with a path, not a `IO::Path` 2025-07-16 02:14:16 +08:00
Aoran Zeng cefa25a883
Rename type 2025-07-16 02:01:16 +08:00
Aoran Zeng a6b0338ee0
Move debug functions to Parser 2025-07-16 01:52:07 +08:00
Aoran Zeng c3657b44ef
Little update 2025-07-16 01:45:09 +08:00
Aoran Zeng c4d0d1eb0e
Rewrite Parser consistent from bottom to top 2025-07-16 01:38:02 +08:00
Aoran Zeng 4e5003f36e
Rename to `root` 2025-07-16 00:23:09 +08:00
Aoran Zeng 676089ee7a
Test parser hierarchy 2025-07-16 00:10:45 +08:00
Aoran Zeng efd98676b8
Add `test-parser.rakutest` 2025-07-15 21:12:07 +08:00
Aoran Zeng 094acc1e85
Move to `fixture` 2025-07-15 20:44:40 +08:00
Aoran Zeng 7369734df6
Add test-hierarchy 2025-07-15 20:44:01 +08:00
Aoran Zeng 02f08acf5c
Add type 2025-07-15 19:02:31 +08:00
Aoran Zeng 5ac415801c
Fix destination 2025-07-15 07:57:14 +08:00
Aoran Zeng 35f85e048a
Prerelease `0.2.2-alpha1`
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-15 00:44:28 +08:00
Aoran Zeng 887eec51f6
Update dev doc 2025-07-15 00:43:49 +08:00
Aoran Zeng 4ac8ae9cc0
Deal with more illegal chars in C variable 2025-07-15 00:10:34 +08:00
Aoran Zeng 78001c002f
Rewrite `Java` recipe 2025-07-15 00:08:38 +08:00
Aoran Zeng fcdcbf058a
Rewrite `Haskell` recipe 2025-07-15 00:00:17 +08:00
Aoran Zeng 7bb3aab285
Update PL recipes 2025-07-14 23:44:21 +08:00
Aoran Zeng 4686f71cde
Implement `Clojure` recipe 2025-07-14 23:23:33 +08:00
Aoran Zeng 56e0907609
Update launch configurations 2025-07-14 22:46:40 +08:00
Aoran Zeng eb7753511e
Update tasks 2025-07-14 22:46:25 +08:00
Aoran Zeng f2a383412c
Test file use `DEBUG` mode 2025-07-14 22:40:30 +08:00
Aoran Zeng 8f501dd50e
Update framework test 2025-07-14 22:36:55 +08:00
Aoran Zeng 3e3e9aede2
Add `chsrc_run_as_x_file()` 2025-07-14 22:35:33 +08:00
Aoran Zeng fbdeeb125d
Update framework test 2025-07-14 20:41:11 +08:00
Aoran Zeng 0b5c67811e
Add `chsrc_make_tmpfile()` 2025-07-14 20:40:48 +08:00
Aoran Zeng 5c85073939
Update maintainers 2025-07-14 18:23:21 +08:00
Aoran Zeng eb51b1d7d3
Inform to use `Wget` 2025-07-14 17:45:25 +08:00
Aoran Zeng 895d0b4823
Update doc 2025-07-14 17:36:44 +08:00
Aoran Zeng 0fb89b854b
Rewrite `uv` recipe using `rawstr4c` 2025-07-14 17:32:09 +08:00
Aoran Zeng 0dba3904cf
Rewrite old source list for `Ubuntu` and `Debian` 2025-07-14 17:06:10 +08:00
Aoran Zeng ec8f57dc98
Update `APT` recipes 2025-07-14 16:38:08 +08:00
Aoran Zeng 43dd694054
Add speed URL for `MirrorZ` 2025-07-14 16:34:12 +08:00
Aoran Zeng 3a1ec43d8d
Update `Solus` recipe 2025-07-14 16:29:18 +08:00
Aoran Zeng b914a17549
Update `Void Linux` recipe 2025-07-14 16:26:43 +08:00
Aoran Zeng 87997aeeb6
Rewrite `Docker Hub` recipe using `rawstr4c` 2025-07-14 16:20:02 +08:00
Aoran Zeng 686c0c0891
Move into subdir 2025-07-14 15:31:29 +08:00
Aoran Zeng 5c275c1b82
Remove `Huecker` for `Docker Hub` 2025-07-14 15:16:37 +08:00
Aoran Zeng d0b0cdaae7
Update macro 2025-07-14 15:08:10 +08:00
Aoran Zeng a71a39230b
Using group name 2025-07-14 14:53:14 +08:00
Aoran Zeng f9b3362dbd
Move wiki page into source code 2025-07-14 14:39:04 +08:00
Aoran Zeng 681ea40cee
Use `chef_` prefix 2025-07-14 14:02:17 +08:00
Aoran Zeng fac71e0dcb
Add URL routines 2025-07-14 13:54:47 +08:00
Aoran Zeng 06067d35b4
Add `chef.h` 2025-07-14 13:36:31 +08:00
Aoran Zeng f6d78d0399
Add mirror site `HIT` `QLU` `Neosoft` and sync orders 2025-07-14 13:27:18 +08:00
Aoran Zeng 572851f576
Fix `prefix` in section 2025-07-14 04:05:09 +08:00
Aoran Zeng 685ae27d23
Update maintain URL 2025-07-14 03:58:34 +08:00
Aoran Zeng 6c07328071
Add version to `rawstr4c` 2025-07-14 03:45:17 +08:00
Aoran Zeng 65ca09e332
Rewrite `Anaconda` 2025-07-14 03:32:39 +08:00
Aoran Zeng 2aef111e74
Add missing license notice in header 2025-07-14 02:54:08 +08:00
Aoran Zeng cb7310845f
Add missing contributor info for `Homebrew`
[GitHub #75]
2025-07-14 02:45:31 +08:00
Aoran Zeng 34c90e13f4
Rewrite `Homebrew` 2025-07-14 01:56:09 +08:00
Aoran Zeng e3dd337b28
Refined output 2025-07-14 01:44:50 +08:00
Aoran Zeng bd45eff13c
Fix generated files destination 2025-07-14 01:32:58 +08:00
Aoran Zeng 64513e8d15
Update some wares 2025-07-13 21:34:32 +08:00
Aoran Zeng b38b75d316
Update `Nix` 2025-07-13 21:19:06 +08:00
Aoran Zeng 8b4dff9c4a
Update `CocoaPods` 2025-07-13 21:17:36 +08:00
Aoran Zeng 00e0f28d5c
Update sources for `Nix` 2025-07-13 21:12:16 +08:00
Aoran Zeng d2d7374786
Update `TeX` 2025-07-13 21:05:36 +08:00
Aoran Zeng 15268cfd0f
Fix setsrc for `WinGet` >=v1.8 2025-07-13 20:52:26 +08:00
Aoran Zeng 93a5ed2e6f
Update sources for `WinGet` 2025-07-13 20:49:51 +08:00
Aoran Zeng a40e3b1525
Add `XJTU` mirror site 2025-07-13 20:47:47 +08:00
Aoran Zeng 4dc7908e74
Update download script 2025-07-13 20:36:23 +08:00
Aoran Zeng fababf3aec
Add license to header 2025-07-13 20:12:38 +08:00
Aoran Zeng 22beaa7f4c
Move to `test` 2025-07-13 19:55:54 +08:00
Aoran Zeng 7d7ff19d86
Move to `tool` 2025-07-13 19:53:19 +08:00
Aoran Zeng e1a32fe044
Add `rawstr4c` task 2025-07-13 19:49:47 +08:00
Aoran Zeng ea0a54398f
Add bat and shell file for `rawstr4c` 2025-07-13 19:21:41 +08:00
Aoran Zeng 88558af591
Move to `bin` 2025-07-13 19:16:52 +08:00
Aoran Zeng 2c2befd950
Add `run.ps1` 2025-07-13 19:08:55 +08:00
Aoran Zeng a63af77e02
Add MAIN 2025-07-13 18:50:24 +08:00
Aoran Zeng 662898f628
Update lib 2025-07-13 18:29:58 +08:00
Aoran Zeng 9042fb5134
Rename lib file 2025-07-13 18:12:39 +08:00
Aoran Zeng 033f93b620
Implement `Generator` for `rawstr4c` 2025-07-13 17:43:41 +08:00
Aoran Zeng 964fea4e11
Implement converter and var generator 2025-07-13 09:45:14 +08:00
Aoran Zeng 1755ea5b2d
Add real-world experiment for `rawstr4c` 2025-07-13 01:48:11 +08:00
Aoran Zeng 7642898eab
Update configuration manual for `rawstr4c` 2025-07-13 01:47:39 +08:00
Aoran Zeng efb802b0c8
Add sub `.gitignore` 2025-07-13 01:46:24 +08:00
Aoran Zeng 659fbc53ce
Add ConfigParser 2025-07-13 01:45:56 +08:00
Aoran Zeng f8473dfac7
Update config doc 2025-07-12 19:42:10 +08:00
Aoran Zeng 5b681e2a68
Add config doc for `rawstr4c` 2025-07-12 19:26:04 +08:00
Aoran Zeng aa2fd3381d
Instant use for test `rawstr4c` 2025-07-12 19:16:33 +08:00
Aoran Zeng a54f704719
Basic implementation of `rawstr4c` 2025-07-12 19:16:08 +08:00
Aoran Zeng 747c29e85f
Add test files for `rawstr4c` 2025-07-12 16:54:31 +08:00
Aoran Zeng 4a5724cacc
Add `rawstr4c.raku` 2025-07-12 16:54:15 +08:00
Aoran Zeng d4e77a4050
Format comments
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-07-12 13:11:22 +08:00
Rui Yang c455dda5fc
Disable `Huawei` mirror for `Go` (#231) 2025-07-12 13:03:03 +08:00
Aoran Zeng 109ac591c4
Use more intimate terms 2025-07-12 12:10:45 +08:00
Aoran Zeng 09010c2ba1
Notice `chsrc-bootstrap` in `installer.sh` 2025-07-12 11:56:16 +08:00
Aoran Zeng d656430142
Notice `chsrc-bootstrap` 2025-07-12 11:41:10 +08:00
Aoran Zeng 7e3a3f5260
Add `Termux` bootstrapper 2025-07-12 11:03:08 +08:00
Aoran Zeng a70ae801b9
Add `chsrc-bootstrap` README 2025-07-12 10:25:41 +08:00
Aoran Zeng ed402a22ff
Inform users that they can install the older version 2025-07-12 09:12:06 +08:00
Aoran Zeng 0df9d54b27
Prerelease `v0.2.1.4`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-07-12 07:44:44 +08:00
Aoran Zeng a70b251fa2
Fix cmd checking tool
[GitHub #229]
2025-07-12 07:35:30 +08:00
Aoran Zeng d9dac7af6e
Fix typo
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-07-11 21:22:43 +08:00
Aoran Zeng 87ec78340a
Prerelease `v0.2.1.3` 2025-07-11 21:08:54 +08:00
Aoran Zeng 48be5f5acb
Notify users 2025-07-11 21:06:28 +08:00
Aoran Zeng c0598b2dad
Add accurate speed url for `Python` 2025-07-11 20:27:17 +08:00
Aoran Zeng 543848ad2f
Add accurate speed url for `Node.js` 2025-07-11 20:07:02 +08:00
Aoran Zeng 4010970b7f
Add accurate speed url for `Dart` 2025-07-11 19:56:00 +08:00
Aoran Zeng 6e40cfe238
Add sources prepare for `Debian` 2025-07-11 19:43:39 +08:00
Aoran Zeng 6e2b33269a
Add provider type 2025-07-11 19:28:56 +08:00
Aoran Zeng 1c27e328c9
Make `Ubuntu` all sources accurate 2025-07-11 17:58:29 +08:00
Aoran Zeng dce39ed6c8
Fix accurate info 2025-07-11 17:57:37 +08:00
Aoran Zeng 291fd3cfc9
Faster check program 2025-07-11 17:30:36 +08:00
Aoran Zeng b6eaa9721c
Softly dispose garbage 2025-07-11 17:00:24 +08:00
Aoran Zeng 5080fc5864
Use official name for `MirrorZ` 2025-07-11 17:00:02 +08:00
Aoran Zeng e48958c275
Add some dedicated speed URL for `Cargo`
[GitHub #215]
2025-07-11 16:50:31 +08:00
Aoran Zeng 459c1cf3cd
Add provider measure info 2025-07-11 16:46:32 +08:00
Aoran Zeng 026c4e4b5b
Implement accurate and rough speed measure 2025-07-11 16:43:42 +08:00
Aoran Zeng 8dbf5625ee
`chsrc_debug()` only when debug mode 2025-07-11 16:42:27 +08:00
Aoran Zeng f6731adf81
Accurate and rough measure for mirror site 2025-07-11 15:14:47 +08:00
Aoran Zeng 4fed086f7d
Explicitly use group as name for `Node.js` 2025-07-11 13:11:25 +08:00
Aoran Zeng cb0021ded8
Global program status 2025-07-11 12:39:04 +08:00
Aoran Zeng b543c124be
Use original yield source 2025-07-11 12:12:48 +08:00
Aoran Zeng 4b5aff7862
Use new ProgMode 2025-07-11 11:24:29 +08:00
Aoran Zeng 5f8da597ff
Refactor ProgMode 2025-07-11 10:43:16 +08:00
Aoran Zeng e953aceb54
Refactor target group mode 2025-07-11 10:12:27 +08:00
Aoran Zeng 8b9c0b565b
Update extensions 2025-06-28 16:29:18 +08:00
Aoran Zeng 007465c996
Better notification for PR 2025-06-28 16:27:59 +08:00
Aoran Zeng 9f679383c8
Echo more variables 2025-06-28 16:18:45 +08:00
Aoran Zeng c53bd62534
Fix run condition for PR 2025-06-28 15:58:13 +08:00
Aoran Zeng 6120d98688
Echo more variables 2025-06-28 15:48:03 +08:00
Aoran Zeng 805234a474
Merge branch 'main' into dev 2025-06-21 14:00:13 +08:00
Aoran Zeng 2e58b7325d
Fix with key for action: `actions-comment-pull-request` 2025-06-21 13:56:14 +08:00
dependabot[bot] 9256daa5bc Bump uraimo/run-on-arch-action from 2 to 3
Bumps [uraimo/run-on-arch-action](https://github.com/uraimo/run-on-arch-action) from 2 to 3.
- [Release notes](https://github.com/uraimo/run-on-arch-action/releases)
- [Commits](https://github.com/uraimo/run-on-arch-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: uraimo/run-on-arch-action
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-21 13:35:30 +08:00
Aoran Zeng cf9516b2c2
Use new issue types 2025-06-21 12:50:30 +08:00
Aoran Zeng f9c81e695a
Use 2 spaces for yaml 2025-06-21 11:56:39 +08:00
Aoran Zeng 0119eb0db9
Add `dependabot.yml` 2025-06-21 11:53:53 +08:00
Aoran Zeng 4119466247
Better doc for dev
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-06-20 23:07:42 +08:00
Aoran Zeng 54e13aa77f
Directly at the root dir 2025-06-20 22:57:14 +08:00
Aoran Zeng 21527184b6
Use 4 spaces for JSON 2025-06-20 22:44:48 +08:00
Aoran Zeng 789240dd2f
Update `tasks.json` according to the new `justfile` 2025-06-20 22:42:52 +08:00
Aoran Zeng 168cce314f
Fix `Makefile` for `deb` 2025-06-20 22:30:05 +08:00
Aoran Zeng 429fe656b2
Update default build targets 2025-06-20 22:14:30 +08:00
Aoran Zeng 2ad8c63b59
Update `.gitignore` 2025-06-20 22:01:35 +08:00
Aoran Zeng 90cf624f53
Sync with `justfile` 2025-06-20 22:01:25 +08:00
Aoran Zeng 2e0059978c
Refactor CI target of `Makefile` 2025-06-20 21:32:05 +08:00
Aoran Zeng dc34c4494a
Add 3 build modes for `Makefile` 2025-06-20 20:58:19 +08:00
Aoran Zeng efa31ca0fc
Clean built executables 2025-06-20 19:18:05 +08:00
Aoran Zeng 765da083da
Refactor `justfile` 2025-06-20 19:14:56 +08:00
Aoran Zeng 7e629fe96d
Add 3 build modes in `justfile` 2025-06-20 18:11:33 +08:00
Aoran Zeng 72c752bfdd
Configure default compiler for `just` 2025-06-20 17:36:28 +08:00
Aoran Zeng 5bd1b61755
Rename to `READIT` 2025-06-20 17:16:18 +08:00
Aoran Zeng 6b1a364fe6
Update speed URL for `ali` and `tencent` 2025-06-20 17:10:31 +08:00
Aoran Zeng 2da1dffca4
Disable most sources from `sohu` 2025-06-20 16:30:52 +08:00
Aoran Zeng c60e740549
Disable most sources from `netease` 2025-06-20 16:22:58 +08:00
Aoran Zeng 5b70f7fd8c
Use `println` in chsrc 2025-06-20 14:55:04 +08:00
Aoran Zeng ba6fa809d4
Enforce C11 2025-06-20 14:44:05 +08:00
Aoran Zeng 7841e9bf1e
Remove deprecated 2025-06-20 14:41:45 +08:00
Aoran Zeng 537ed4fd8c
Use `print` and `println` 2025-06-20 14:32:00 +08:00
Aoran Zeng 9cbad804c5
Add deprecations 2025-06-20 09:08:32 +08:00
Aoran Zeng 28a3aae6e1
Add `xy_os_family` 2025-06-20 08:51:00 +08:00
Aoran Zeng 75c1401776
Add `build` task for `make` 2025-06-20 08:18:23 +08:00
Aoran Zeng b9e7937526
Update doc 2025-06-20 08:13:20 +08:00
Aoran Zeng 31852b4f57
Update PR template 2025-06-20 07:42:09 +08:00
Aoran Zeng a2851d5246
Update doc
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-06-19 21:34:01 +08:00
Aoran Zeng 54a93f9e19
Reduce unnecessary CI build
Co-authored-by: Mikachu2333 <mikachu.23333@zohomail.com>
2025-06-19 21:03:47 +08:00
Mikachu2333 72030ccec6 notes for dev branch 2025-06-19 20:01:17 +08:00
Mikachu2333 5372ace76f format readme 2025-06-19 20:01:17 +08:00
Mikachu2333 e60ff265d0 fix struct 2025-06-19 20:01:17 +08:00
Mikachu2333 944a803ba4 format and use comments 2025-06-19 20:01:17 +08:00
Aoran Zeng 82efdf97d4
`just clean` 2025-06-19 19:39:19 +08:00
Aoran Zeng acc8f8bf72
Test it on native Windows env 2025-06-19 19:34:19 +08:00
Aoran Zeng cd13b48c21
Bypass `debuild` 2025-06-19 19:28:49 +08:00
Aoran Zeng 899297de22
Fix and sync with `Makefile` 2025-06-19 19:21:53 +08:00
Aoran Zeng 74be327274
Fix Windows path issue of `just` 2025-06-19 19:11:07 +08:00
Aoran Zeng c3d6b1c5f3
Sync with `justfile` 2025-06-19 18:43:37 +08:00
Aoran Zeng d49377f166
Add format settings 2025-06-19 18:27:58 +08:00
Aoran Zeng dd2333f0c8
Add VS Code extensions 2025-06-19 18:09:57 +08:00
Aoran Zeng 5cde6622b5
Support `rustup` on Windows
[GitHub #218]
2025-06-19 14:56:13 +08:00
Aoran Zeng ca00e0233b
set quietly on Windows 2025-06-19 14:27:57 +08:00
Aoran Zeng 7d0923e9de
Use `chsrc_view_env()` 2025-06-19 14:17:27 +08:00
Aoran Zeng a978659696
Add `chsrc_view_env()` 2025-06-19 14:02:14 +08:00
Aoran Zeng 27696d707e
Update default task 2025-06-19 13:53:08 +08:00
Aoran Zeng 99748a51da
Rename to `PR-test.yml` 2025-06-19 13:16:37 +08:00
Aoran Zeng 670acaf247
Add `PR-notify.yml` 2025-06-19 13:16:02 +08:00
Aoran Zeng 2c64d724ef
Add `test-PR.yml` 2025-06-19 10:22:43 +08:00
Aoran Zeng f307795e57
Add VS Code README
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-06-18 22:26:44 +08:00
Aoran Zeng 211e98cce1
Add VS Code debug launch 2025-06-18 22:21:33 +08:00
Aoran Zeng f312dd3b8d
Add VS Code tasks 2025-06-18 22:14:53 +08:00
Aoran Zeng eb24afc650
Add `justfile` 2025-06-18 22:10:11 +08:00
Aoran Zeng e8a22c13f2
Use `C11` 2025-06-18 19:47:20 +08:00
Aoran Zeng 17bd90f09b
Fix multiple definition
[GitHub #215]
2025-06-18 19:16:16 +08:00
Aoran Zeng b3915738d8
Update `.gitignore` 2025-06-18 19:07:01 +08:00
Aoran Zeng a41d76b84f
Add `.vscode` 2025-06-18 19:05:51 +08:00
Mikachu2333 5106de1185 merge 2025-06-18 00:18:55 +08:00
Mikachu2333 14b4c77125 add rustup mirror 2025-06-18 00:16:01 +08:00
Aoran Zeng 73c63d117f
Format code and header
Some checks failed
Publish 'chsrc-git' to AUR / publish (push) Has been cancelled
2025-06-17 12:58:56 +08:00
Mikachu2333 c1a16582ff add contributor infos 2025-06-17 12:52:54 +08:00
Mikachu2333 08dd6228f3 update cargo 2025-06-17 11:27:33 +08:00
Mikachu2333 32b7477d21 Re-add `cqu` mirror 2025-06-17 11:27:02 +08:00
Mikachu2333 7f0888c9da format 2025-06-17 11:25:59 +08:00
Aoran Zeng cacc70029a
Prerelease `v0.2.1.2`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-06-16 18:23:54 +08:00
Aoran Zeng 86a1fa3b16
Add `deb` to download 2025-06-16 18:06:04 +08:00
Aoran Zeng a7b55064b1
Update README for `deb` URL 2025-06-16 18:03:21 +08:00
Aoran Zeng 50d6324b40
Fix `lintian` warning 2025-06-16 17:59:40 +08:00
Aoran Zeng 31addff431
Fix warning of `debuild` 2025-06-16 17:20:43 +08:00
Aoran Zeng a86ed49615
Fix `chsrc get rustup` 2025-06-16 17:08:57 +08:00
Aoran Zeng 7c7c1ddc00
Fix `chsrc get nvm` 2025-06-16 17:07:03 +08:00
Aoran Zeng d292c0c3fb
Add `make check` target 2025-06-16 16:53:54 +08:00
Aoran Zeng 0821663073
Add `clean-deb` target 2025-06-16 16:52:11 +08:00
Aoran Zeng 2124770aeb
Use simplified name for deb makefile 2025-06-16 16:49:33 +08:00
Aoran Zeng 975b2391cb
Use standard lower-case `deb` 2025-06-16 16:45:32 +08:00
Aoran Zeng 02c3a815de
Workflows use zh
[skip ci]
2025-06-16 16:34:10 +08:00
Aoran Zeng d798da80f7
`cp` is so stupid 2025-06-16 16:17:41 +08:00
Aoran Zeng 9e66fe4e93
Debug `dist-for-pre` 2025-06-16 15:57:32 +08:00
Aoran Zeng 1c630d3c5b
Use zh step name and stabilize `pre` URL for `deb` 2025-06-16 15:30:17 +08:00
Aoran Zeng 7543e67920
Upgrade `softprops/action-gh-release` to `v2`
Some checks are pending
Publish 'chsrc-git' to AUR / publish (push) Waiting to run
2025-06-16 02:23:57 +08:00
Aoran Zeng e2b6bb9233
Deprecate `actions/upload-release-asset`
[GitHub #202]
2025-06-16 02:20:43 +08:00
Aoran Zeng 40ef2ae201
Upgrade `actions/checkout` to `v4` 2025-06-16 01:43:44 +08:00
Aoran Zeng 91e0696bc5
Extract version number from source code 2025-06-16 01:37:07 +08:00
Aoran Zeng d6a3de0558
Rename workflow file 2025-06-16 00:44:42 +08:00
Aoran Zeng 4339e856d3
Rename workflows and add headers 2025-06-16 00:40:04 +08:00
Aoran Zeng ac676e07c6
Simplify PR template 2025-06-15 23:59:30 +08:00
Aoran Zeng 5d992335f1
Update `README.md` 2025-06-15 23:44:12 +08:00
Aoran Zeng aea231bbc0
Rename to `deb-installation-test.sh` 2025-06-15 23:38:04 +08:00
Aoran Zeng 5a1c1f5470
Update homepage of `debian/control` 2025-06-15 23:37:41 +08:00
Aoran Zeng 8a288b90bc
Add file header to debian scripts 2025-06-15 23:37:13 +08:00
Aoran Zeng 187f90dca5
Update `DEB` doc 2025-06-15 23:18:33 +08:00
Aoran Zeng aa1ab323d9
Update `debian/copyright` according to the standard copyright-format 2025-06-15 23:15:43 +08:00
Aoran Zeng ecb083208f
Fix working dir in `pkg-deb.yml`
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
[GitHub #202]
2025-06-15 14:47:01 +08:00
Aoran Zeng 42135de152
Rewrite updating of `debian/changelog`, step build and step move of the package in `pkg-deb.yml`
[GitHub #202]
2025-06-15 14:36:07 +08:00
Aoran Zeng ebbe2521bc
Add `push` event trigger for `pkg-deb.yml`
[GitHub #202]
2025-06-15 14:22:19 +08:00
Aoran Zeng d4e1e7dd37
Try use same GitHub token for CI 2025-06-15 13:49:12 +08:00
Aoran Zeng 075f91cbde
Update `DEB` contributor info 2025-06-15 13:46:24 +08:00
Aoran Zeng 258b54ba32
Update `debian/changelog` 2025-06-15 13:36:32 +08:00
Aoran Zeng 683aadee17
Update `pkg` doc 2025-06-15 13:28:35 +08:00
Aoran Zeng c6bbf99883
Update `DEB` doc
Some checks are pending
Publish AUR Package (chsrc-git) / publish (push) Waiting to run
[GitHub #207]
2025-06-15 13:00:31 +08:00
Aoran Zeng 5de4f64133
Add notes to `debian/rules` 2025-06-15 12:26:27 +08:00
Aoran Zeng 62fefdb09d
Fix `Makefile` 2025-06-15 12:04:01 +08:00
Aoran Zeng 9b3ca55818
Separate `deb.makefile` 2025-06-15 12:02:44 +08:00
Aoran Zeng 3c84ad550d
Move `debian` into `pkg/DEB` 2025-06-15 11:34:26 +08:00
Aoran Zeng eb808c49a5
Move `deb` related doc and test file into `pkg/DEB`
[GitHub #207]
2025-06-15 11:26:33 +08:00
Aoran Zeng 7c7408e4b8
Ignore DEB build artifacts
[GitHub #207]
2025-06-15 11:19:26 +08:00
Aoran Zeng a2321fdc06
All use `Starting` and `Finished`, remove `deb-prepare` prerequisite
[GitHub #207]
2025-06-15 11:15:31 +08:00
Aoran Zeng aab3042c88
Let `deb-clean` delete all artifacts
[GitHub #207 #206 #202]
2025-06-15 11:04:10 +08:00
ccmywish c41bcf7e38
Merge pull request #206 from sanchuanhehe/main 2025-06-15 10:13:59 +08:00
sanchuanhehe cac040efdf fix(makefile): 添加测试环境信息输出,更新测试目标
fix(xy.c): 注释掉对虚拟HOME环境的断言,待后续解决
2025-06-14 23:58:54 +08:00
sanchuanhehe 74915f629d fix(test): 更新测试中`chsrc.png`文件路径,修正图片文件的引用位置 2025-06-14 22:10:55 +08:00
sanchuanhehe d425fff037 fix(debian): 移除不再需要的 compat 文件 2025-06-14 21:39:10 +08:00
sanchuanhehe d25c0addcb fix(docs): 移除暂时不支持的 arm64 和 armhf 架构说明,移除level 13 不需要的make 目标 2025-06-14 21:36:36 +08:00
sanchuanhehe dc9cb70217 fix(debian): 更新安装步骤,使用 install 命令简化文件复制,更新兼容性和标准版本 2025-06-14 21:29:13 +08:00
sanchuanhehe a67fc7c859 Merge branch 'main' of https://github.com/sanchuanhehe/chsrc 2025-06-14 21:20:26 +08:00
sanchuanhehe 8f99e12efb fix(debian): 简化安装步骤,使用 DESTDIR 变量替代手动创建目录和复制文件 2025-06-14 21:19:08 +08:00
sanchuanhehe 6ecf028c84
Merge branch 'main' into main 2025-06-14 16:26:50 +08:00
Aoran Zeng 19b9e54261
Update `README.md`
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
2025-06-12 12:31:37 +08:00
Aoran Zeng 662cd7c311
Move `image` to `doc` 2025-06-12 12:27:40 +08:00
Aoran Zeng 573c981de5
Add `mirrorz` for `PyPI`
[GitHub #199]
2025-06-12 12:26:56 +08:00
sanchuanhehe 1cf40ae473 fix(debian): 移除对 ARM 架构的支持,简化 DEB 包构建流程 2025-06-11 10:02:20 +08:00
sanchuanhehe 7d190fcbc1
Merge pull request #2 from sanchuanhehe/deb-dev
fix(debian): 移除 armhf 架构支持,更新交叉编译环境配置
2025-06-11 09:50:38 +08:00
sanchuanhehe 0c7e65db05 fix(debian): 移除 armhf 架构支持,更新交叉编译环境配置 2025-06-11 09:48:11 +08:00
sanchuanhehe 8e0fbb2f6b
Merge pull request #1 from sanchuanhehe/deb-dev
Deb 包支持
2025-06-10 15:03:36 +08:00
sanchuanhehe 7ee02b8fea chore(gitignore): 更新忽略文件,移除不再需要的 debhelper 日志和替代变量文件 2025-06-10 14:52:49 +08:00
sanchuanhehe 089fc77486 feat(debian): 添加 DEB 包构建和发布工作流及相关文件 2025-06-10 14:33:48 +08:00
Aoran Zeng 463f9092a6
Format `uv.c`
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
2025-06-02 21:50:12 +08:00
happy-game 7bfe7c7d26
Merge pull request #200 from happy-game/main
Fix(uv): Resolve issue with setsrc on Windows
2025-06-02 17:03:31 +08:00
happy 7e3eb3d5ed Fix(uv): Resolve issue with setsrcon Windows 2025-06-02 16:38:19 +08:00
Aoran Zeng ef5933a412
Fix `menu.c`
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
Cause: We omit `sjtu-sy`
2025-05-27 19:24:33 +08:00
Aoran Zeng e8c0085c47
Prerelease `v0.2.1.1` 2025-05-27 18:43:09 +08:00
Aoran Zeng 61a049b776
Support `get` `reset` `ls` for `Flathub`
[GitHub #191]
2025-05-27 18:33:18 +08:00
Aoran Zeng 283acfa4ba
Distinguish two `sjtu` mirror sites
[GitHub #191 #178]
2025-05-27 18:18:22 +08:00
happy-game b8034c44e7
Merge pull request #198 from happy-game/main
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
fix(archcn): Fixed Arch CN set source
2025-05-24 23:10:34 +08:00
happy game 1b4d088b42 fix(archcn): Fixed Arch CN set source
- Correct the mirrorlist file for the Arch CN repository
- The `sed` command was generated by Claude

Fixes #197
2025-05-24 23:01:57 +08:00
MadDogOwner 8f1498e73c Translate the China Flutter User Group name into Chinese
Some checks failed
Publish AUR Package (chsrc-git) / publish (push) Has been cancelled
2025-04-16 16:43:56 +08:00
MadDogOwner 56dfa4f1fd Update the file author information and modify the last modified date 2025-04-16 16:43:56 +08:00
MadDogOwner b2a5b0add3 Add CUFG (China Flutter User Group) 2025-04-16 16:43:56 +08:00
MadDogOwner 5e0b02cf3f Use `setx` in Windows for Dart 2025-04-16 16:43:56 +08:00
200 changed files with 11543 additions and 5893 deletions

View File

@ -1,4 +1,17 @@
# --------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------
# Config Type : EditorConfig
# Config Authors: 曾奥然 <ccmywish@qq.com>
# Contributors : Nil Null <nil@null.org>
# Created On : <2023-09-06>
# Last Modified : <2025-08-27>
#
# 请参考 ./doc/03-为什么拒绝使用代码格式化工具.md
#
# http://editorconfig.org
# --------------------------------------------------------------
root = true
[*]
@ -6,14 +19,34 @@ indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
# VS Code 对该配置(为 false)的实现有问题,这是确定的,
# 然而 CLion 似乎对该配置(为 false)的实现是正确的,这导致不同贡献者反而产生了冲突
# 所以我们现在改成 true
insert_final_newline = true
[*.{c,C,cpp,cxx,cc,h,hpp}]
indent_style = space
indent_size = 2
[*.pl]
indent_size = 4
[*.{raku,rakumod,rakutest}]
indent_size = 2
[*.ps1]
indent_size = 4
[*.{sh,bash}]
indent_size = 2
[Makefile,makefile,*.{mk,make,makefile}]
indent_style = tab
[*.md]
trim_trailing_whitespace = true
# 使用 VS Code 生成文件的默认格式
[*.json]
indent_size = 4
[*.{yaml,yml}]
indent_size = 2

5
.github/FUNDING.yml vendored
View File

@ -1 +1,4 @@
custom: ['https://github.com/ccmywish/support-my-oss-work']
custom: [
'https://afdian.com/a/ccmywish',
'https://github.com/ccmywish/support-my-oss-work'
]

View File

@ -1,13 +1,17 @@
name: 🐞 Bug 报告
description: 有 Bug 了吗?
title: "详细报告BUG是chsrc用户的一大美德"
labels: ['Bug']
# labels: [ ]
type: Bug
body:
- type: markdown
attributes:
value: |
感谢您花时间填写此 Bug 报告!
感谢花时间填写此 Bug 报告!
1. 你可能是通过包管理器安装的 `chsrc`其版本往往稍旧你可先尝试使用REAME中提供的安装命令来获取最新版本
2. 有时 Bug 是在最新版本中引入的,此时你可在安装命令时指定 `-v` 参数临时使用旧版本解决燃眉之急详情查看README
- type: textarea
id: what-did-you-do
@ -41,7 +45,7 @@ body:
attributes:
label: chsrc 版本
# description: 你正在使用 chsrc 哪个版本?
placeholder: 请使用 chsrc -h 查看第一行*带有日期*的精确版本
placeholder: 请使用 chsrc -h 或 chsrc -v 查看,并*复制发布日期*
validations:
required: true
@ -81,7 +85,7 @@ body:
id: terms
attributes:
label: 防止重复问题
description: 您确认在打开这个新的 issue 之前已经搜索过类似的issue。您可以评论或订阅已经存在的相关 issue
description: 请确认在打开这个新的 issue 之前已经搜索过类似的issue。你可以评论或订阅已经存在的相关 issue
options:
- label: 我已在项目的 GitHub 和 Gitee 两个仓库分别搜索过类似的 issue
- label: 我已在项目搜索过类似的 issue
required: true

View File

@ -1,7 +1,8 @@
name: 🫡 我想要对 target 换源!
description: 想要对尚未支持的 target 进行换源?
title: "提前找好方案怎么换源是chsrc用户的一大美德"
labels: []
# labels: [ ]
type: Request
body:
- type: markdown
attributes:

View File

@ -1,7 +1,8 @@
name: 🎉 我找到了新的镜像站或源!
description: 为大家分享新的镜像站或可用源!
title: "分享是chsrc用户的一大美德"
labels: ['']
# labels: [ ]
type: Contribute
body:
- type: markdown
attributes:

View File

@ -1,7 +1,8 @@
name: ⛓️‍💥 镜像源已失效
description: 该镜像站已关停/该源已不再被支持
title: "报告镜像源情况是chsrc用户的一大美德"
labels: ['Deprecate']
# labels: [ ]
type: Deprecate
body:
- type: markdown
attributes:

View File

@ -1,11 +1,6 @@
blank_issues_enabled: true
contact_links:
- name: ✏️ 协作更新镜像源可用状态
url: https://github.com/RubyMetric/chsrc/wiki
about: 作为该语言的资深用户、该软件的专家、镜像站维护人员等,你总是对镜像站和源的可用状态拥有一手信息
- name: ❤️ 感谢 chsrc
url: https://github.com/RubyMetric/chsrc/discussions/categories/%E6%84%9F%E8%B0%A2-chsrc
about: chsrc 是否帮助到了你?
- name: 🚀 赞赏支持 chsrc
url: https://github.com/ccmywish/support-my-oss-work
about: 通过经济支持帮助作者更好的开发和维护 chsrc
- name: ❤️ 赞赏支持 chsrc
url: https://afdian.com/a/ccmywish
# about 不支持 Markdown 语法
about: 你是否因为 chsrc 而受到启发、节省了时间精力 or whatever?

View 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
View File

@ -0,0 +1,15 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : (Overview .github) READIT.md
! Doc Authors : 曾奥然 <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) 的最简化版

32
.github/copilot-instructions.md vendored Normal file
View File

@ -0,0 +1,32 @@
# chsrc Project Rules for AI Assistants
## 项目概述
这是 chsrc 项目,一个用 C 语言编写的跨平台命令行换源工具,帮助用户在不同的镜像之间切换,适用于编程语言、操作系统、其他软件。它的最强大之处在于它是一个框架,能够帮助用户轻松地为不同的目标换源。
## 架构
- **Framework**: 在目录 `src/framework/` 中,包含了核心实现,支持 recipe
- `struct.h` 里定义了各种数据结构和宏,这是整个 chsrc 的核心,也是 chef DSL 的核心
- `chef.c` 里实现了 chef DSL你可以使用它来确定正确的使用方法
- **Recipes**: 在目录 `src/recipe/` 中,包含了针对不同目标的具体实现
- `lang/` - 编程语言 (Ruby, JavaScript 等等)
- `os/` - 操作系统 (Ubuntu, Arch Linux 等等)
- `ware/` - 软件工具和应用 (Docker, Homebrew 等等)
## Coding Guidelines
### C Coding Style:
请阅读 `doc/03-为什么拒绝使用代码格式化工具.md`
### Important Project Concepts:
请阅读 `doc/10-如何编写recipe.md`
## Important: 一定要保持注释,因为它记录了重要的维护信息

6
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly

View File

@ -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>

62
.github/workflows/PR-notify.yml vendored Normal file
View File

@ -0,0 +1,62 @@
# ---------------------------------------------------------------
# Workflow File : PR-notify.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2025-06-19>
# Last Modified : <2025-08-07>
#
# 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
# github.event.pull_request_target 内容为空,转而用 pull_request
if: github.event.pull_request.base.ref != 'dev'
steps:
- name: 评论
uses: thollander/actions-comment-pull-request@v3
with:
message: |
Hi @${{github.event.pull_request.user.login}},
❤️ 感谢你的贡献!你的 PR 当前基于 `${{github.base_ref}}` 分支,请修改使用 `dev` 分支
comment-tag: "❤️ 感谢你的贡献!"
- run: |
echo "::error::❌ PR 必须以 dev 分支为目标!当前是 ${GITHUB_BASE_REF}"
exit 1
welcome:
name: 欢迎PR者
runs-on: ubuntu-latest
# 仅在 opened 时欢迎,其他情况都不再重复欢迎了
if: github.event.pull_request.base.ref == 'dev' && github.event.action == 'opened'
steps:
- name: 查看 GitHub Actions 环境
run: |
echo "Event 类型: ${{ github.event.action }}"
echo "Event 名: ${{ github.event_name }}"
# 2025-10-06 移除点赞的步骤
# 因原 peter-evans/create-or-update-comment@v5 已不再支持空body而如果使用 Github Token 之类又过于大材小用因此移除
- name: 添加评论欢迎 PRer
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Hi @${{github.event.pull_request.user.login}}
❤️ 感谢你的贡献我们将在最少半小时最多5天内阅读此 PR 并回复你
edit-mode: replace

72
.github/workflows/PR-test.yml vendored Normal file
View File

@ -0,0 +1,72 @@
# ---------------------------------------------------------------
# Workflow File : PR-test.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Mikachu2333 <mikachu2333@zohomail.com>
# |
# Created On : <2025-06-19>
# Last Modified : <2025-08-17>
#
# Test PR
# ---------------------------------------------------------------
name: 测试PR
on:
pull_request:
# 仅在开 pr、草稿转正式、手动要求 review、reopen的时候运行测试
types: [
opened,
# 因 synchronize 将导致 pr 的构建过于频繁而禁用
# synchronize, # 在 pr 者 push commit 时每次构建
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@v6
- name: 测试构建情况
run: |
make
- name: 测试test情况
run: |
make test
test-on-windows:
name: 在Windows上测试
runs-on: windows-latest
if: github.event.pull_request.base.ref == 'dev'
steps:
- name: 检出代码
uses: actions/checkout@v6
- name: 创建测试文件
shell: powershell
run: |
New-Item -Path "$env:USERPROFILE\Documents\Powershell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force
New-Item -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force
- name: 安装依赖
run: |
choco install just
- name: 测试构建情况
run: |
just
- name: 测试test情况
run: |
just test

View File

@ -0,0 +1,47 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Linux-AArch64.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-14>
# Last Modified : <2025-09-12>
#
# 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

View File

@ -0,0 +1,47 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Linux-ARMv7.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-14>
# Last Modified : <2025-09-12>
#
# 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

View File

@ -0,0 +1,47 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Linux-riscv64.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-14>
# Last Modified : <2025-09-12>
#
# 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

View File

@ -0,0 +1,39 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Linux-x64.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-14>
# Last Modified : <2025-09-12>
#
# 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@v6
- 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

80
.github/workflows/build-on-Windows.yml vendored Normal file
View File

@ -0,0 +1,80 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Windows.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-14>
# Last Modified : <2025-09-12>
#
# 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@v6
- 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: 为 Android 构建
run: |
compiler=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android21-clang
# 检查编译器版本
$compiler --version
echo
mingw32-make.exe build-in-ci-release-mode CC=$compiler CROSS_BUILD_WINDOWS_FOR_ANDROID=1
echo
# 让我们看看里面有啥
ls
echo
mv chsrc-ci-release chsrc-arm64-android
- 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
chsrc-arm64-android

81
.github/workflows/build-on-macOS.yml vendored Normal file
View File

@ -0,0 +1,81 @@
# ---------------------------------------------------------------
# Workflow File : build-on-macOS.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2023-09-15>
# Last Modified : <2025-12-18>
#
# 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@v6
- name: 检查编译器版本
run: |
clang --version
echo
gcc --version
echo
gcc-14 --version
- 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
on-x64:
# macos-13 是 x64macos-14 是 AArch64(ARMv8-A)
# 但是 macos-13 已经于 2025-12-04 下线
runs-on: macos-15-intel
steps:
- name: 检出代码
uses: actions/checkout@v6
- name: 检查编译器版本
run: |
clang --version
echo
gcc --version
echo
gcc-14 --version
- 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

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

179
.github/workflows/pkg-deb.yml vendored Normal file
View File

@ -0,0 +1,179 @@
# ---------------------------------------------------------------
# Workflow File : pkg-deb.yml
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : 曾奥然 <ccmywish@qq.com>
# |
# Created On : <2025-06-10>
# Last Modified : <2025-10-29>
#
# 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@v6
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/framework/version.h)
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
-- 曾奥然 <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@v6
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
- 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
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@v7
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@v6
with:
name: debian-repository-metadata
path: debs/Packages*
retention-days: 30

View File

@ -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 }}"

View File

@ -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
View 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 }}

View File

@ -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 }}

View File

@ -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 }}

68
.gitignore vendored
View File

@ -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
@ -8,28 +22,66 @@
*.dll
*.out
*.exe
*.res
# target exe name
##############################
# Built executables
##############################
chsrc
chsrc-debug
chsrc-release
chsrc-ci-release
# test files
##############################
# Test files
##############################
xy
fw
README.md.bak*
*.tmp
chsrc_tmp_test.txt
chsrc_tmp_test.txt.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
View 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 : 曾奥然 <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
View 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
}

12
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"recommendations": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"editorconfig.editorconfig",
"redhat.vscode-yaml",
"nefrob.vscode-just-syntax"
],
"unwantedRecommendations": [
"esbenp.prettier-vscode"
]
}

64
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,64 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug chsrc",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/chsrc-debug",
"args": [
"get",
"nodejs"
],
"preLaunchTask": "构建 debug 版 chsrc",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
// 使false
"externalConsole": true,
// lldb
"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
}
],
"postDebugTask": "停止 debug 程序"
},
{
"name": "Debug framework",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/fw",
"args": [],
"preLaunchTask": "测试 framework",
"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
}
]
}
]
}

27
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"editor.fontLigatures": false,
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.intelliSenseEngine": "Tag Parser",
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false,
"editor.formatOnSave": false,
"C_Cpp.clang_format_fallbackStyle": "GNU",
"C_Cpp.formatting": "disabled",
"[c]": {
"editor.defaultFormatter": null,
},
"[h]": {
"editor.defaultFormatter": null
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"vscode-just.formatOnSave": false,
}

172
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,172 @@
{
"tasks": [
{
"type": "shell",
"label": "构建 chsrc",
"command": "just",
"args": [
"build"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": "停止程序",
"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
},
},
{
"type": "shell",
"label": "测试 chsrc",
"command": "just",
"args": [
"test"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "test",
"isDefault": true
},
"detail": "使用 just test 测试"
},
{
"type": "shell",
"label": "测试 framework",
"command": "just",
"args": [
"test-fw"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "test",
"isDefault": false
},
"detail": "使用 just test-fw 测试 framework"
},
{
"type": "shell",
"label": "测试 xy.h",
"command": "just",
"args": [
"test-xy"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "test",
"isDefault": false
},
"detail": "使用 just test-xy 测试 xy.h"
},
{
"type": "shell",
"label": "停止 debug 程序",
"windows": {
"command": "powershell",
"args": [
"-c",
"Get-Process -Name \"chsrc-debug\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
"Get-Process -Name \"gdb\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
"Get-Process -Name \"WindowsDebugLauncher\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
]
},
"linux": {
"command": "bash",
"args": [
"-c",
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
]
},
"osx": {
"command": "bash",
"args": [
"-c",
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
]
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"detail": "停止 debug 版本的 chsrc"
},
{
"type": "shell",
"label": "停止程序",
"windows": {
"command": "powershell",
"args": [
"-c",
"Get-Process -Name \"chsrc\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
]
},
"linux": {
"command": "bash",
"args": [
"-c",
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
]
},
"osx": {
"command": "bash",
"args": [
"-c",
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
]
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"detail": "跨平台停止 chsrc"
}
],
"version": "2.0.0"
}

210
Makefile Normal file → Executable file
View 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>
# File Authors : 曾奥然 <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-10-15>
#
# 请阅读 ./doc/01-开发与构建.md 来使用
# --------------------------------------------------------------
#=========== OS Check ================
On-Linux = 0
On-Windows = 0
On-macOS = 0
@ -17,12 +22,40 @@ ifeq ($(shell uname), Linux)
On-Linux = 1
endif
# 只有Windows会定义$(OS)变量
ifeq ($(shell uname), Darwin)
On-macOS = 1
endif
# 只有 MSYS2 会定义 $(OS) 变量
ifeq ($(OS), Windows_NT)
On-Windows = 1
endif
#=======================
# 注意, 原生 Windows 会定义 $(ComSpec) 变量,且区分大小写
# 但是 MSYS2 并不会定义
#=====================================
#======== 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,65 +70,162 @@ 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
# 由 GitHub Actions 在调用时修改
CI_ARTIFACT_NAME = chsrc
ifeq ($(MAKECMDGOALS), CI)
ifeq ($(On-Linux), 1)
STATIC = 1
endif
endif
#=======================
all:
ifeq ($(STATIC), 1)
CFLAGS += -static
CFLAGS += $(CFLAGS_static)
endif
all:
@$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(Target-Name)
@echo; echo Compile done using \'$(CC)\' $(CFLAGS)
CI: all
@mv $(Target-Name) $(CI_ARTIFACT_NAME)
#=====================================
debug: CFLAGS += -g
debug: all
@$(DEBUGGER) ./chsrc
test: test-xy test-fw
#====== CI release mode 的配置 =======
ifeq ($(MAKECMDGOALS), build-in-ci-release-mode)
CFLAGS += $(CFLAGS_optimization)
# 仅在 Linux 上使用静态链接
ifeq ($(On-Linux), 1)
CFLAGS += $(CFLAGS_static)
endif
# GitHub Actions 上的 macOS 中的 LLVM 太老了
# 而且 gcc 被重命名为了 clang
# 需要直接指定版本
ifeq ($(On-macOS), 1)
CC = gcc-14
endif
endif
#=====================================
#============ Aliases ================
all: build
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
#=====================================
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
# 这两个测试文件都用 DEBUG mode
test-xy: CFLAGS += $(CFLAGS_debug)
test-xy:
@$(CC) test/xy.c $(CFLAGS) -o xy
@./xy
test-fw: CFLAGS += $(CFLAGS_debug)
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 *.res 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
# 这样还是太麻烦,不用,我们还是靠 just 来调用吧
#
# 通过 make rawstr4c ARGS="[--debug] Markdown.md" 来调用
#rawstr4c:
# @bash ./tool/rawstr4c/run/run.sh $(ARGS)
.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 rawstr4c

247
README.md
View File

@ -1,15 +1,30 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : README.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
! | BingChunMoLi <bingchunmoli@bingchunmoli.com>
! |
! Created On : <2023-12-28>
! Last Modified : <2025-08-22>
! ---------------------------------------------------------- -->
<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**。
全平台通用换源工具与框架 `chsrc`**目标支持 Linux, Windows (native, MSYS2, Cygwin), macOS, BSD, Android 等尽可能多的操作系统环境龙芯、飞腾、RISC-V 等尽可能多的 CPU**。
我们使用 **C99** 来完成上述目标。我们并不使用 Python 或 JS 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。
我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JavaScript 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。
本软件为**自由软件**SDPX 软件许可证为 `GPL-3.0-or-later and MIT`
<br>
<table align="center">
<tr>
<td>
@ -23,25 +38,49 @@
<br>
## ❤️ 致所有的朋友们
2025年8月11日我因通宵重构本项目代码而被送去抢救[#252](https://github.com/RubyMetric/chsrc/issues/252)[突发!换源工具 chsrc 作者在重构过程中被送去 120 抢救](https://v2ex.com/t/1151802))。大家给予的关心和帮助让我非常非常感动!在此,我衷心感谢每一位朋友!**无论是开源还是闭源,无论是否为职业程序员,我们其实都是一群使用软件、热心互助、充满友爱的人,这是一个温暖的大家庭**。
我为 `chsrc` 采用 GPL 协议,怀着殷切的期望:**希望能够营造像 Richard Stallman 在创建 GNU 项目之前,在 MIT 那样的氛围——写自己用得上的软件,与大家一起开发、维护,简单纯粹,无关商业利益。就像小区、校园自发组建的足球篮球队,从一次偶然的加入,逐渐成长为互相支持的伙伴**。
这次经历让我更加深刻地体会到:开源,是一种把大家联系在一起的方式,**它让友情、互助和协作成为可能,也让我们在共同的目标中建立起长期的纽带**。
最后,希望大家能够**时刻关注**自己的身体,**你可以随时 `chsrc` `chown` `chgrp` `chmod` 无限次,但是无法 `chbody`**
<br>
## 🤝 协作与贡献
> [!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)
> **`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架它甚至使你能够在不了解C语言的情况下编写出新的换源方法 (recipe)。** 配合使用 [rawstr4c], 这将比写 shell 脚本更加轻松。 [如何编写 recipe?](./doc/10-如何编写recipe.md)
---
> [!NOTE]
> **`chsrc` 可换源 60+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助**。欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者参与贡献。[从开发到提交贡献,我们覆盖全流程文档](./doc/)
,另外作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50)
> 这也许是你可以参与的第一个现实世界中有用的C语言项目[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-开发与构建.md)
>
> 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR我们覆盖全流程文档](./doc/)
---
> [!IMPORTANT]
> [招募 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130)
> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/275)
<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. [搜集测速地址,进行精准测速](https://github.com/RubyMetric/chsrc/issues/205)
4. [chsrc-bootstrap: 为不存在预编译 `chsrc` 的平台提供支持](https://github.com/RubyMetric/chsrc/issues/230)
<br>
@ -54,20 +93,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`
@ -81,14 +118,28 @@
<br>
## 📌 示例
桌面端:
<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>
安卓:
<div align="center">
<img alt="chsrc set python and chsrc set termux" src="doc/image/chsrc-on-Android-set-python-and-termux.jpg" width="300" height="750"/>
</div>
<br>
## 🚀 安装
<a href="https://repology.org/project/chsrc/versions">
@ -104,7 +155,7 @@
- 可通过 `scoop` 安装,感谢 [@Gn3po4g] 与 [@niheaven]
```bash
$ scoop install chsrc
scoop install chsrc
```
<br>
@ -112,7 +163,7 @@ $ scoop install chsrc
- 可通过 `WinGet` 安装,感谢 [@YU-7]
```bash
$ winget install RubyMetric.chsrc
winget install RubyMetric.chsrc
```
<br>
@ -122,6 +173,9 @@ $ winget install RubyMetric.chsrc
若下方链接无法访问,可使用 `https://gitee.com/RubyMetric/chsrc/raw/main/tool/installer.ps1` 替代
```PowerShell
# 使用 -Version 指定版本 (不指定时默认为 pre)
# 1. 安装 pre 版本; 这比从包管理器安装的总是更新一些
# 2. 安装旧版本; 有时新版本可能引入某些 Bug临时使用旧版本解决燃眉之急
"& { $(iwr -useb https://chsrc.run/windows) } -Version pre" | iex
```
@ -136,11 +190,30 @@ 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 -LO https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc_latest-1_amd64.deb
# 也可以使用 Wget
wget https://gitee.com/RubyMetric/chsrc/releases/download/pre/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
@ -160,12 +233,20 @@ $ yay -S chsrc # Build from GitHub Release
# 非root用户默认安装至 ~/.local/bin
$ curl https://chsrc.run/posix | bash
# 也可以使用 Wget
$ wget -O - https://chsrc.run/posix | bash
# root用户默认安装至 /usr/local/bin
$ curl https://chsrc.run/posix | sudo bash
# 使用 -d 指定目录安装
$ curl https://chsrc.run/posix | bash -s -- -d ./
# 使用 -v 指定版本 (不指定时默认为 pre)
# 1. 安装 pre 版本; 这比从包管理器安装的总是更新一些
# 2. 安装旧版本; 有时新版本可能引入某些 Bug临时使用旧版本解决燃眉之急
$ curl https://chsrc.run/posix | bash -s -- -v 0.2.1
# 使用 -l en 输出英文
$ curl https://chsrc.run/posix | bash -s -- -l en
```
@ -188,15 +269,19 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-riscv64-l
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-armv7-linux -o chsrc; chmod +x ./chsrc
```
如果你所在的处理器架构没有预编译版本,可以使用 [chsrc-bootstrap]
</details>
<details>
<summary>macOS</summary>
- 可通过 `homebrew` 安装,感谢 [@Aaron-212] 与 [@chenrui333]
```bash
$ brew install chsrc
brew install chsrc
```
<br>
@ -215,6 +300,11 @@ $ curl https://chsrc.run/posix | sudo bash
# 使用 -d 指定目录安装
$ curl https://chsrc.run/posix | bash -s -- -d ./
# 使用 -v 指定版本 (不指定时默认为 pre)
# 1. 安装 pre 版本; 这比从包管理器安装的总是更新一些
# 2. 安装旧版本; 有时新版本可能引入某些 Bug临时使用旧版本解决燃眉之急
$ curl https://chsrc.run/posix | bash -s -- -v 0.2.1
# 使用 -l en 输出英文
$ curl https://chsrc.run/posix | bash -s -- -l en
```
@ -230,23 +320,64 @@ 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>
如果已安装好了编译 `chsrc` 所需要的依赖,可直接运行:
```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
```
**如果还不存在这些依赖,你将会被死锁住: 我还没有换源,我该如何安装这些依赖呢?**
这就是 [chsrc-bootstrap] 起作用的时刻你可使用BSD系统的原生脚本语言编写 `bootstrapper`[并向我们提交](https://github.com/RubyMetric/chsrc/issues/230)
注: `chsrc` 实现的 `FreeBSD recipe` 长期存在问题,因此一个新的 `bootstrapper` 是相当必要的,请帮助你自己和大家!
</details>
<details>
<summary>Android/Termux</summary>
Termux 中默认无 `Wget`,我们都用 `cURL` 来下载安装
```bash
# arm64/aarch64
curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-arm64-android -o chsrc; chmod +x ./chsrc
```
如果你所在的处理器架构没有预编译版本,可以使用 [chsrc-bootstrap]:
```bash
curl -L https://gitee.com/RubyMetric/chsrc/raw/main/bootstrap/Termux.bash | bash
```
</details>
<details>
<summary>其他平台</summary>
若你所在的平台不存在预编译好的 `chsrc`,你需要手动编译。如果已安装好了编译 `chsrc` 所需要的依赖,可直接运行:
```bash
$ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make
git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make
```
**如果还不存在这些依赖,你将会被死锁住: 我还没有换源,我该如何安装这些依赖呢?**
这就是 [chsrc-bootstrap] 起作用的时刻,你可使用该平台原生脚本语言编写 `bootstrapper`[并向我们提交](https://github.com/RubyMetric/chsrc/issues/230)
</details>
<br>
@ -254,33 +385,37 @@ $ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make
## 💡 使用
```bash
使用: chsrc <command> [options] [target] [mirror]
名称:
chsrc - Change Source - (GPLv3+)
help # 打印此帮助,或 h, -h, --help
issue # 查看相关issue
使用:
chsrc <command> [options] [target] [mirror]
list (或 ls, 或 l) # 列出可用镜像源,和可换源目标
list mirror/target # 列出可用镜像源,或可换源目标
list os/lang/ware # 列出可换源的操作系统/编程语言/软件
命令:
help, h 打印此帮助,或 -h, --help
issue, i 查看相关issue
measure <target> # 对该目标所有源测速
cesu <target>
list, ls, l 列出可用镜像站和可换源目标
list mirror|target 列出支持的: 镜像站/换源目标
list os|lang|ware 列出支持的: 操作系统/编程语言/软件
list <target> 查看该目标可用源与支持功能
list <target> # 查看该目标可用源与支持功能
get <target> # 查看该目标当前源的使用情况
measure, m, cesu <target> 对该目标所有源测速
set <target> # 换源,自动测速后挑选最快源
set <target> first # 换源,使用维护团队测速第一的源
set <target> <mirror> # 换源,指定使用某镜像站 (通过list命令查看)
set <target> https://url # 换源用户自定义源URL
reset <target> # 重置,使用上游默认使用的源
get, g <target> 查看该目标当前源的使用情况
set, s <target> 换源,自动测速后挑选最快源
set <target> first 换源,使用维护团队测速第一的源
set <target> <mirror> 换源,指定使用某镜像站 (通过list <target>查看)
set <target> <URL> 换源用户自定义源URL
reset <target> 重置,使用上游默认使用的源
选项:
-dry # Dry Run模拟换源过程命令仅打印并不运行
-local # 仅对某项目而非全局换源 (仅部分软件如bundler,pdm支持)
-ipv6 # 使用IPv6测速
-en(glish) # 使用英文输出
-no-color # 无颜色输出
-dry Dry Run模拟换源过程命令仅打印并不运行
-local 仅对本项目而非全局换源 (通过ls <target>查看支持情况)
-ipv6 使用IPv6测速
-en(glish) 使用英文输出
-no-color 无颜色输出
```
<br>
@ -299,7 +434,7 @@ reset <target> # 重置,使用上游默认使用的源
$ chsrc ls ruby
$ chsrc set ruby rubychina
有自己的镜像地址使用自定义URL
若有自己的镜像,可以使用自定义URL
$ chsrc set ruby https://gems.ruby-china.com/
@ -340,7 +475,7 @@ chsrc set rust | cargo | crate
chsrc set rustup
chsrc set go
chsrc set java | maven | mvn | gradle
chsrc set java | maven | mvn | maven-daemon | mvnd | gradle
chsrc set clojure | clojars
chsrc set dart | pub
chsrc set flutter
@ -358,10 +493,12 @@ chsrc set julia
```bash
sudo chsrc set ubuntu
sudo chsrc set linuxmint | mint
sudo chsrc set zorinos
sudo chsrc set linuxmint
sudo chsrc set debian
sudo chsrc set fedora
sudo chsrc set suse | opensuse
# 同时支持 Leap 和 Tumbleweed
sudo chsrc set opensuse
sudo chsrc set kali
sudo chsrc set arch
sudo chsrc set archlinuxcn
@ -370,11 +507,11 @@ sudo chsrc set gentoo
sudo chsrc set rocky | rockylinux
sudo chsrc set alma | almalinux
sudo chsrc set alpine
sudo chsrc set void | voidlinux
sudo chsrc set voidlinux
sudo chsrc set solus
sudo chsrc set ros | ros2
sudo chsrc set trisquel
sudo chsrc set lite | linuxlite
sudo chsrc set linuxlite
sudo chsrc set raspi | raspberrypi
sudo chsrc set armbian
sudo chsrc set openwrt
@ -424,12 +561,13 @@ chsrc set conda | anaconda
## ❤️ 致谢
感谢各个镜像站提供的优质免费镜像服务
1. [mirror.c](./src/framework/mirror.c) 包含了通用的镜像站信息
2. 各个recipe内部定义的专用镜像站
另外特别感谢以下组织或项目:
1. [MirrorZ 教育网镜像站](https://help.mirrors.cernet.edu.cn/)
1. [校园网联合镜像站(MirrorZ)](https://help.mirrors.cernet.edu.cn/)
2. [清华大学 Tuna](https://mirrors.tuna.tsinghua.edu.cn/)
3. [上海交通大学软件源镜像服务](https://mirrors.sjtug.sjtu.edu.cn/)
4. [中国科学技术大学 Linux 用户协会](https://github.com/ustclug)
@ -439,22 +577,23 @@ chsrc set conda | anaconda
## 🚀 赞赏支持
你是否因为使用 `chsrc` 而节省了时间精力 or whatever?
你是否因为 `chsrc`受到启发、节省了时间精力 or whatever?
<img src="https://raw.githubusercontent.com/ccmywish/support-my-oss-work/main/wechat.png" alt="wechat-reward" style="width:300px;"/>
爱发电主页: <https://afdian.com/a/ccmywish>
<img src="https://raw.githubusercontent.com/ccmywish/support-my-oss-work/main/wechat-reward.png" alt="wechat-reward" style="width:300px;"/>
<br>
[rawstr4c]: https://github.com/RubyMetric/rawstr4c
[chsrc-bootstrap]: ./bootstrap/
[@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

104
bootstrap/README.md Normal file
View File

@ -0,0 +1,104 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : (chsrc-bootstrap Introduction.md)
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2025-07-12>
! Last Modified : <2025-07-22>
! ---------------------------------------------------------- -->
# Bootstrap
```ruby
begin
download_prebuilt_chsrc_binary_for_my_platform
rescue NoReadyMadeBinary => e
bootstrap! e.my_platform
end
```
<br>
## 预编译产生的死锁问题
我们支持预编译的操作系统目前只有 `Windows`, `Linux`, `macOS`,支持的架构请参考[项目 README](../README.md)
某些操作系统如 BSD 家族,甚至是更小众的操作系统, 或者上述操作系统的某些架构,无法享受直接下载二进制立即使用的便利性,这导致用户需要自己编译 `chsrc`.
然而用户自己编译则面临着一个问题: **需要提前安装项目依赖**
1. 把代码 `git clone` 下来 或 下载 `zip` 包进行解压缩
2. C语言编译器
3. `GNU make``just` (这二者非强制,但是有了更好)
可是如果用户还没有换源,他/她又如何获得上述这些程序呢?**这是一把死锁,导致用户最终回到手动换源的原始农耕时代。**
<br>
## `chsrc-bootstrap` to the Rescue
`chsrc-bootstrap` 是一组使用原生脚本语言的脚本,每个脚本称为 `bootstrapper`,用来完成两件事情:
1. 帮助用户进行最基本的换源,让用户能够立即开始使用该系统安装其他软件
2. 用户自行决定是否需要安装 `chsrc`
- 若不需要: 流程直接结束,用户已可以完成基本日常工作
- 若需要: 帮助用户安装好所需的最少依赖,并编译安装 `chsrc`
注意,最基本的换源,即不测速,由维护者暂时决定先切换到某一个具体的源,先让系统跑起来。
### 支持的语言
上述提到的原生脚本语言只能是这些:
1. Windows: `PowerShell`, `CMD`
2. Linux: `Bash`, `sh`
备选: `Perl`
3. macOS: `Zsh`, `Bash`, `sh`
备选: `Ruby`, `Perl`
4. BSD: `sh`
备选: 待议
5. 其他平台: 一切该平台支持的脚本语言,无需额外安装
<br>
## `chsrc``chsrc-bootstrap`
`chsrc` 需要实现 `chsrc-bootstrap` 中支持的平台。这是因为,`chsrc-bootstrap` 只换到了某一个具体的源,只是临时性的,后续用户可能还想要换到其他源,此时 `chsrc` 就可以接管。
而事实上,`chsrc-bootstrap` 可以完成一些操作,使得系统已经满足一些前置条件,这样的话 `chsrc` 可以在这些前置条件存在时接着换源,从而大幅减轻 `recipe` 的实现难度。
<br>
## 帮助
1. [FreeBSD 的换源](https://github.com/RubyMetric/chsrc/issues/11) 从项目一开始就是我们的目标之一,然而由于其:
- 换源所需的步骤太多
- 面临着特有的鸡蛋困境
- BSD 工具和 GNU 工具总是有不兼容之处
- 在C语言中实现困难重重
因此我们一直没有很好的办法去实现
2. 任何你所在的平台,都可以添加到此

60
bootstrap/Termux.bash Normal file
View File

@ -0,0 +1,60 @@
#!/usr/bin/env bash
# ---------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later
# ---------------------------------------------------------------
# File Name : Termux.bash
# File Authors : Aoran Zeng <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# Created On : <2025-07-12>
# Last Modified : <2025-07-22>
#
# Termux:
#
# Bootstrap Termux: https://github.com/RubyMetric/chsrc/issues/173
#
# @consult https://help.mirrors.cernet.edu.cn/termux/
#
# 我们默认采用校园网联合镜像站提供的源
# ---------------------------------------------------------------
bs_echo() {
echo "[chsrc-bootstrap] $*"
}
if command -v termux-change-repo &>/dev/null; then
termux-change-repo
else
# $PREFIX 的值为: /data/data/com.termux/files/usr
# 用户主目录 ~ 为: /data/data/com.termux/files/home
# 必要的
sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.cernet.edu.cn/termux/apt/termux-main stable main@' $PREFIX/etc/apt/sources.list
apt update
# x11-repo
sed -i 's@^\(deb.*x11 main\)$@#\1\ndeb https://mirrors.cernet.edu.cn/termux/apt/termux-x11 x11 main @' $PREFIX/etc/apt/sources.list.d/x11.list
# root-repo
sed -i 's@^\(deb.*root main\)$@#\1\ndeb https://mirrors.cernet.edu.cn/termux/apt/termux-root root main @' $PREFIX/etc/apt/sources.list.d/root.list
fi
# 立即更新测试换源状态
apt update && apt upgrade
bs_echo "基础换源已完成"
read -p "是否需要安装 chsrc ? (y/n): " need_install_chsrc
if [[ $need_install_chsrc == "y" || $need_install_chsrc == "Y" ]]; then
bs_echo "正在安装依赖项..."
apt-get install -y gcc make git
git clone https://gitee.com/RubyMetric/chsrc.git --depth 1
bs_echo "依赖安装完成!"
bs_echo "正在开始编译和安装"
cd chsrc
make build-in-release-mode
make install
bs_echo "chsrc 安装完成!"
fi

View File

@ -1,65 +0,0 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 01-Develop.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-12-27>
! Last Modified : <2025-03-06>
! ---------------------------------------------------------- -->
# 开发
## 环境
请安装好 `GCC``Clang``make` 以及 `curl`
```bash
# 请务必使用 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 编译
```
```bash
# 重新编译并启动 GDB 调试
$ make debug
# 重新编译并启动 LLDB 调试
$ make debug DEBUGGER=lldb
# 如果需要单独生成含有编译信息的二进制文件这个不会自己启动debugger
$ make DEBUG=1
```
<br>
## 测试
```bash
$ 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>

143
doc/01-开发与构建.md Normal file
View File

@ -0,0 +1,143 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 01-开发与构建.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
! |
! Created On : <2024-12-27>
! Last Modified : <2025-10-11>
! ---------------------------------------------------------- -->
# 开发 chsrc
## 依赖与开发环境
请安装好:
1. `GCC``Clang`
2. [just] 或 `make`
3. `curl`
4. [rawstr4c] (可选)
**我推荐你使用 VS Code 开发,你可以在一分钟内成功编译、运行和 Debug `chsrc`**
1. `Ctrl-Shift-B` 直接构建
2. `F5` 直接开始 Debug
<br>
## 获取代码
**请务必使用 dev 分支开发**
```bash
git clone https://gitee.com/RubyMetric/chsrc.git -b dev
```
关于分支的说明,可参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
<br>
## 编译运行
共有四种构建模式:
1. **`DEV mode`**
2. **`DEBUG mode`**
3. **`RELEASE mode`**
4. **`CI-RELEASE mode`**
开发时只需要前两种模式;第四种模式只在 GitHub Actions 使用。
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建**
```bash
just (b) # 在Windows上默认使用 gcc 编译在macOS上默认使用 clang 编译,在其他系统上默认使用 cc 编译
just CC=clang # 使用 clang 编译
just CC=gcc # 使用 gcc 编译
# 编译出 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
```
<br>
## 提交 PR
关于分支的说明以及如何提交代码,请参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
<br>
[rawstr4c]: https://github.com/RubyMetric/rawstr4c
[just]: https://github.com/casey/just

View File

@ -1,106 +0,0 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 02-Write-A-Recipe-Even-If-You-Dont-Know-C.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-08-19>
! Last Modified : <2025-03-06>
! ---------------------------------------------------------- -->
# Write A Recipe Even If You Don't Know C
# 介绍
**`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架它甚至使你能够在不了解C语言的情况下编写出新的换源方法(recipe)。**
<br>
我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 这将非常简单,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/130))。
1. 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件
2. 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳)
3. 高度模块化,目录结构清晰易懂
4. 极小依赖,极易构建,只需要 `GCC``Clang` 即可编译
5. 易于将 `shell` 脚本转换为等价的 `recipe`
6. 已有大量 `recipe` 可提供参考,并提供了 [recipe template] 供直接使用
7. 提供持续关注镜像站可用性的协作平台:
1. https://github.com/RubyMetric/chsrc/wiki
2. https://github.com/RubyMetric/chsrc/discussions
<br>
成功案例:
1. [Armbian](../src/recipe/os/APT/Armbian.c)
2. [uv](../src/recipe/lang/Python/uv.c)
<br>
# 基本概念
1. `target`: 所要换源的目标
2. `category`: 是 `target category` 的简写,即 `target` 所属的类别,可以是 **编程语言****操作系统****软件** 三类之一
1. 在目录中,三者分别为 `lang`, `os`, `ware`
2. 在代码中,三者前缀分别为 `pl`, `os`, `wr`
3. `mirror`: 是 `mirror site` 的简写,指镜像站,如清华大学开源软件镜像站
4. `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source`
5. `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录
6. `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等
7. **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
<br>
# 编写 `recipe` 步骤
1. 确定你要编写的 `target` 的标准名称,创建 `Target-Name.c` 文件
大小写需严格按官方,若名称包含空格,需使用 `-` 代替空格
2. 根据类别将上述文件放在 `recipe/` 目录的某个子目录中
3. 复制 [recipe template] 的内容到上述文件中,并替换 `<...>` 占位符
4. 参考现有 `recipe` 的写法
1. 看一眼就能上手的参照物是 [PHP recipe](../src/recipe/lang/PHP.c)
2. 最好的参照物是 [Ruby recipe](../src/recipe/lang/Ruby.c)
3. 组换源参照物是 [Python Group recipe](../src/recipe/lang/Python/Python.c)
5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站
并创建或更新对应 `target` 的镜像站可用状态 [Wiki] 页
6. 可以使用这些函数:
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
2. `xy.h` 中以 `xy_` 开头的所有函数或宏
7. 在 `recipe/menu.c` 中添加用户可以使用的 `target` 别名
8. [编译、运行、测试 (how?)](./01-Develop.md),若无问题可提交 Pull Request
<br>
# 开发准则
1. 代码高度可移植
2. Convention over Configuration
3. [NO UFO 原则: 不要乱丢文件到$HOME等目录尤其是使用各种隐晦的文件名](https://www.yuque.com/ccmywish/blog/no-ufo)
`chsrc` 主程序不提供配置文件,不提供数据文件,干净无污染。那么在实现 `recipe` 的时候,除了备份文件外,也不要污染用户环境。
<br>
[recipe template]: ../src/recipe/recipe-template.c
[Wiki]: https://github.com/RubyMetric/chsrc/wiki

View File

@ -2,12 +2,12 @@
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 03-CONTRIBUTING.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! Doc Name : 02-提交与贡献.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-12-13>
! Last Modified : <2024-12-27>
! Last Modified : <2025-08-22>
! ---------------------------------------------------------- -->
# 贡献说明
@ -15,7 +15,6 @@
## 分支
- `gh-build`:仅仅在发布版本时由 `@ccmywish` 推送,触发编译到 GitHub Releases 中
- `gh-site``chsrc.run` 的工作分支,由 `@ccmywish` 推送
- `main`: stable代码一定是可以编译运行的我们假设 end users 在其他条件都得不到二进制时,会自己编译这个分支来运行 `chsrc`
- `dev`:开发分支,工作分支,在此分支上解决冲突
@ -23,6 +22,8 @@
## 提交与审阅
当你提交 PR 的时候,一定要将 PR 指定 chsrc 原仓库的 dev 分支。
### 一个简单的 Bug
一个简单的 Bug fix有写权限的维护者可以直接推送到主仓库的 `dev` 分支
@ -35,15 +36,14 @@
1
1. **如果你是 recipe director则你完全负责这个 recipe如果你拥有写权限你可以直接推送代码到 `dev` 分支**
2. 如果你是 recipe maintainer则你需要参考 [04-MAINTAINERS.md](./04-MAINTAINERS.md),如果只有你一个人,且你拥有写权限,你可以直接推送代码。如果有多人,则需要提一个 issue介绍方案然后 @ 所有 maintainer 来 review
**如果你是 recipe Chef则你完全负责这个 recipe如果你拥有写权限你可以直接推送代码到 `dev` 分支**
---
2
1. 需要先搜索你修改的部分涉及到的 recipe然后提 issue @ 所有相关的 recipe maintainer 来 review
2. 如果涉及了所有 recipe则 @ framework maintainer而无需把所有 recipe 的 maintainer 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
1. 需要先搜索你修改的部分涉及到的 recipe然后提 issue @ 所有相关的 recipe Chef 来 review
2. 如果涉及了所有 recipe则 @ framework Chef而无需把所有 recipe 的 Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
<br>

View File

@ -0,0 +1,122 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 03-为什么拒绝使用代码格式化工具.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! Created On : <2025-08-10>
! Last Modified : <2025-08-20>
! ---------------------------------------------------------- -->
# chsrc 代码风格
Ruby 的语法优美性在编程行业中具有标杆地位。Matz松本行弘提出的 **代码应该为人类而写,偶尔为机器执行** 这一理念,已经成为现代编程语言设计的重要指导原则。`chsrc` 项目的第一作者深受 **Ruby** 语言哲学的影响。
本项目起源于 AI 编程尚未流行的时代,所有代码全部依赖人类的耐心来维护。现在,我们的代码以及这篇文章不仅会由人类阅读,也会由 AI 阅读。我们始终坚持:**代码的可读性和维护性是项目长期发展的根本保障**。
<br>
## 为什么我们坚持不使用代码格式化工具
代码格式化工具code formatter在多人协作的代码仓库中确实有其价值**参与的人越多,统一格式的需求越迫切**。然而,`chsrc` 项目经过深思熟虑后,拒绝使用代码格式化工具。让我来说明这一决定背后的深层原因。
### 被强迫使用
`Prettier` 这样的工具表面上带来了统一性,但其代价是什么?**它是极度专制的opiniated**,我们必须**完全交出代码审美的自主权**。今天我们大部分人使用 `Prettier`**并非出于真心的认同,而是因为整个前端生态圈的集体胁迫——不用就意味着被边缘化**。
这种现象的本质令人深思:**少数 `Prettier` 维护者的个人偏好,竟然决定了全球数百万开发者的代码美学标准。这显然是一种技术独裁,坚决拒绝向格式化工具的霸权低头**。
<br>
### 一致性 ≠ 美观 ≠ 可读
格式化工具只保证了表面的一致性,就像一些校服,一致不一定代表美。同样,一致不一定代表代码就是最易读易懂的。
每一个有追求的程序员都应该保留**对代码美学的最后决定权,格式化工具的便利性不应该以牺牲美观性和可维护性为代价**。
<br>
### 满足不了我们的需求
C语言的格式化工具通常选择 `clang-format`,它的配置选项十分丰富,比 `Prettier` 要理性得多。然而,即便如此,**其配置的复杂性和局限性仍然无法满足 chsrc 对代码格式的严苛要求**。如果你是一位 `clang-format` 的配置专家,我们诚挚邀请您告诉我们如何优雅地处理以下代码场景,**也许这能改变我的立场**。
<br>
### 挑战案例
以下是我认为自动格式化工具很难完美处理的代码场景:
`=` 对齐:
```c
char *name = va_arg (args, char*);
char *email = va_arg (args, char*);
```
复杂逻辑的 `=` 对齐:
```c
bool matched = iterate_menu (chsrc_pl_menu, input, &target_tmp);
if (!matched) matched = iterate_menu (chsrc_os_menu, input, &target_tmp);
if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp);
```
预处理指令的层次缩进:
```c
#ifdef _WIN32
#define XY_Build_On_Windows 1
#define xy_on_windows true
#ifdef XY_DEBUG
#define xy_debug_mode 1
#endif
#endif
```
...... 等等
<br>
## C语言代码风格
- 整体上基于 `GNU style`,但我们坚持自己的美学原则,在细节上有所改进
- 类型名: `PascalCase_t`,即 `UpperCamelCase_t`
- 函数定义和调用时,**函数名和`()`之间始终保持一个空格**,如果是在宏中,可紧凑一些,无硬性规定
- 函数和函数定义之间**一般保持2个空行**
- 若函数之间有高度关联性,**可用1个空行**
- 若一系列函数和一系列函数存在主题性区别,**可用3个空行**
<br>
## Markdown 写作风格
维护者很多时候不是从渲染好的界面来看 Markdown 文件的,而是阅读 Markdown 源文件,所以 Markdown 在源文件层面也要易读。
我们保持每个主题之间 **1个`<br>` + 3个空行** 的简单风格。
拒绝使用 VS Code 的 `markdownlint` 插件,**因为它总是用它狭隘的标准给我们增加了巨多的黄色下划线**。
<br>
## 其他语言代码风格
我们秉承 **入乡随俗、尊重传统** 的原则,尊重每种语言社区的既定传统。比如,`YAML` 使用2个空格`JSON`使用4个空格`Perl` 使用 Larry Wall 钟爱的4个空格。
我们使用 `.editorconfig` 来确保这些格式的应用。
<br>

View File

@ -1,287 +0,0 @@
# 协作者与维护者
作为该语言的资深用户、该软件的专家、镜像站维护人员等,你总是对镜像站和源的可用状态拥有一手信息,我们需要你的帮助。如果想要达到最理想的维护状态,每一个 recipe 都需要有专人长时间维护。所以我们在这个文件记录的是愿意**长期**维护的人,如果是一次性提交代码,只需要在对应 recipe 的文件标头中记录即可。
一个 recipe 的协作者可分为:
1. **Director**
负责人:对一个 recipe 完全负责,有写权限时可以直接推代码
**目前项目的发展阶段还处于 *外行实现内行* 的情况,比如 Homebrew recipe实现者根本不是 Homebrew 的真实用户,只是根据各种文档来实现,然后等待用户反馈。所以这里当前的实现者最多只能是 Maintainer无法承担 Director 的责任**
2. **Maintainers**
维护者:实现和持续维护 recipe需要和 Director 一起 review 代码。可参考 [03-CONTRIBUTING.md](./03-CONTRIBUTING.md) 了解项目是如何进行提交和审阅代码的
3. **Observers**
观察者:对该 target 和 recipe 持续反馈和关注的用户。如果你觉得你无法承担作为维护者的责任,可以退而求其次作为观察者积极参与其中
<br>
**项目采用申请制,请提交 PULL REQUEST 在该文件中添加自己,并在 [issue #130](https://github.com/RubyMetric/chsrc/issues/130) 留言。考虑到真正参与维护的人并不多,所以上述人数均不设限。**
`@`后面跟的是GitHub账户名`@ccmywish`。若使用Gitee账号则使用 `@gitee:ccmywish`。对我们来说,镜像站成员非常重要,所以请额外标注身份,如 `@username [TUNA]`
<br>
## Framework
1. **Director**: `@ccmywish` `@gitee:G_I_Y`
2. **Maintainers**:
3. **Observers**:
<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**:
<br>
## 操作系统
### 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**:
<br>

View File

@ -0,0 +1,118 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 10-如何编写recipe.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-08-19>
! Last Modified : <2025-10-28>
! ---------------------------------------------------------- -->
# Write A Recipe Even If You Don't Know C
## 介绍
**`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架它甚至使你能够在不了解C语言的情况下编写出新的换源方法(recipe)。**
<br>
我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/275))。
- 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件
- 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳)
- 高度模块化,目录结构清晰易懂
- 极小依赖,极易构建,只需要 `GCC``Clang` 即可编译 (`make` 和 `just`可简化编译,但不是必需的)
- 易于将 `shell` 脚本转换为等价的 `recipe`
- 已有大量 `recipe` 可提供参考,并提供了 [recipe template] 供直接使用
- 本仓库外的子项目 [rawstr4c] 帮助你在C语言中维护复杂的字符串
- [chsrc-bootstrap] 帮助你在没有预编译 `chsrc` 的平台上 bootstrap 自己
<br>
成功案例:
- [Armbian](../src/recipe/os/APT/Armbian.c)
- [uv](../src/recipe/lang/Python/uv.c)
<br>
## 基本概念
- `target`: 所要换源的目标
- `target group`: 一个 `target` 包含了多个子 `target`,比如 `Python group` 包含了该语言的多个包管理器
- `category`: 是 `target category` 的简写,即 `target` 所属的类别,可以是 **编程语言****操作系统****软件** 三类之一
1. 在目录中,三者分别为 `lang`, `os`, `ware`
2. 在代码中,三者前缀分别为 `pl`, `os`, `wr`
- `mirror`: 是 `mirror site` 的简写,指镜像站,如清华大学开源软件镜像站
- `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source`
- `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录
- `chef DSL`:是 `chef Domain Specific Language` 的简写,这是一组以 `chef_` 开头的函数,用来定义维护者信息、可用源等元信息
- **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL
- **测速链接**: 用来测速的URL与 "换源链接" 不同,可分为 **精准测速** 和 **模糊测速**
- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
<br>
## 编写 `recipe` 步骤
1. 确定你要编写的 `target` 的标准名称,创建 `Target-Name.c` 文件
大小写需严格按官方,若名称包含空格,需使用 `-` 代替空格
2. 根据类别将上述文件放在 `recipe/` 目录的某个子目录中
3. 复制 [recipe template] 的内容到上述文件中,并替换 `<...>` 占位符
4. 参考现有 `recipe` 的写法
1. 看一眼就能上手的参照物是 [PHP recipe](../src/recipe/lang/PHP.c)
2. 最好的参照物是 [Ruby recipe](../src/recipe/lang/Ruby/Ruby.c)
3. 组换源参照物是 [Python group recipe](../src/recipe/lang/Python/Python.c)
5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站
6. 使用 chef DSL 定义 `_prelude()` 函数
该函数将填充 target 所有的必要信息,包括维护信息、换源信息
7. [设置/修改 "换源链接" 和 "测速链接" (how?)](./11-如何设置换源链接与测速链接.md)
8. 按需实现 `_setsrc()` `_getsrc()` `_resetsrc()` 可以使用这些函数:
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
2. `xy.h` 中以 `xy_` 开头的所有函数或宏
3. `chec.c` 中以 `chef_` 开头的所有函数或宏
4. `helper.c` 中以 `hp_` 开头的所有函数或宏
一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀
9. 在 `recipe/menu.c` 中登记此 target
10. [编译、运行、测试 (how?)](./01-开发与构建.md),若无问题可提交 Pull Request
<br>
## 开发准则
1. 代码高度可移植
2. Convention over Configuration
3. [NO UFO 原则: 不要乱丢文件到$HOME等目录尤其是使用各种隐晦的文件名](https://www.yuque.com/ccmywish/blog/no-ufo)
`chsrc` 主程序不提供配置文件,不提供数据文件,干净无污染。那么在实现 `recipe` 的时候,除了备份文件外,也不要污染用户环境。
<br>
[rawstr4c]: https://github.com/RubyMetric/rawstr4c
[chsrc-bootstrap]: ../bootstrap/
[recipe template]: ../src/recipe/recipe-template.c
[Wiki]: https://github.com/RubyMetric/chsrc/wiki

View File

@ -0,0 +1,63 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 11-如何设置换源链接与测速链接.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2025-08-11>
! Last Modified : <2025-08-11>
! ---------------------------------------------------------- -->
# 新增/修改 "换源链接"
`_prelude()` 函数中,在 `def_sources_begin()` 的位置的**第二列**,新增/修改你想要替换的链接。
**注: 以下代码仅起解释作用JavaScript换源的真正实现可能不同**
```c
def_sources_begin()
{&UpstreamProvider, "https://registry.npmjs.org/", FeedByPrelude},
{&NpmMirror, "https://registry.npmmirror.com", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/", FeedByPrelude},
{&某新镜像站, "某镜像站提供的换源链接" FeedByPrelude}
def_sources_end()
```
<br>
# 设置/修改 "测速链接"
`_prelude()` 函数中,在 `def_sources_begin()` 的位置的**第三列**,设置/修改你想要替换的链接。
1. 在下面代码的第一行中,我们直接给了一个链接,**这就是精准测速链接**
2. 在下面代码的第二行和第三行中,我们都设置了一个宏 `DelegateToMirror`,这意味着我们没有直接提供精准测速链接,而是让 `chsrc` 去测试其对应镜像站定义的测速链接
- `NpmMirror` 是专用镜像站,所以其测速链接被设置为了 `ACCURATE`,即精准测速
- `Huawei` 是通用镜像站,所以其测速链接被设置为了 `ROUGH `,即模糊测速
3. 在下面代码的第四行中,我们设置了一个宏 `FeedByPrelude`,这意味着我们将在 `_prelude()` 函数的后续动态计算 URL
**注: 以下代码仅起解释作用JavaScript换源的真正实现可能不同**
```c
def_sources_begin()
{&UpstreamProvider, "https://registry.npmjs.org/", "https://registry.npmjs.org/BigFile.tar.gz"},
{&NpmMirror, "https://registry.npmmirror.com", DelegateToMirror},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/", DelegateToMirror},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/", FeedByPrelude},
def_sources_end()
// 把所有上述源的 "测速链接" 设置为 "换源链接" + postfix
chef_set_sources_speed_measure_url_with_postfix (this, "/dir/BigFile.tar.gz");
// 基于 "换源链接" 做更自定义的操作
chef_set_sources_speed_measure_url_with_func (this, func, data);
// 调整某一个镜像站(Provider)的 "测速链接"
chef_set_provider_speed_measure_url (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz")
// 调整某一个镜像站(Provider)的 "测速精度"
chef_set_provider_speed_measure_accuracy (&UpstreamProvider, ROUGH);;
```

View File

@ -0,0 +1,34 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : 50-协作者与维护者.md
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-12-06>
! Last Modified : <2025-08-22>
! ---------------------------------------------------------- -->
# 协作者与维护者
想要达到最理想的维护状态,每一个 recipe 都需要有专人长时间维护。**我们的代码里使用了 recipe (某个菜的烹饪方法) 这个词,因而整个项目便和 "饮食" 有关,比如 `menu`: 汇集了所有的 target 的菜单。因此,我们的维护者和贡献者身份依然使用了这个惯例:**
1. **Chef**
品控 (主厨): 对一个 recipe 完全负责,有写权限时可以直接推代码
**目前项目的发展阶段还处于 *外行实现内行* 的情况,比如 Homebrew recipe实现者根本不是 Homebrew 的真实用户,只是根据各种文档来实现,然后等待用户反馈。所以这里当前的实现者最多只能是 Cook无法承担 Chef 的责任**
2. **Cook**
掌勺:一个 recipe 的主要作者
3. **Saucier**
调味:一个 recipe 的次要贡献者 (除主要作者外的其他人)
<br>
**Chef 采用申请制,每个 recipe 仅有1人请提交 PULL REQUEST 在对应的 recipe 文件中添加自己,并在 [issue #275
](https://github.com/RubyMetric/chsrc/issues/275) 留言。**

View File

@ -3,21 +3,31 @@
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : (Document Introduction.md)
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org>
! |
! Created On : <2024-12-27>
! Last Modified : <2025-03-06>
! Last Modified : <2025-08-22>
! ---------------------------------------------------------- -->
# 文档说明
E2E (End-to-End) 开发文档:
1. 开发环境准备,如何编译和测试,请参考 [./01-Develop.md](./01-Develop.md)
2. 如何编写一个具体的 recipe请参考 [./02-Write-A-Recipe-Even-If-You-Dont-Know-C.md](./02-Write-A-Recipe-Even-If-You-Dont-Know-C.md)
3. 直接推送还是提交 PR请参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
4. 找谁来审阅 PR请参考 [./04-MAINTAINERS.md](./04-MAINTAINERS.md)
- 开发环境准备,如何编译和测试,请参考 [01-开发与构建.md](./01-开发与构建.md)
- 直接推送还是提交 PR请参考 [02-提交与贡献.md](./02-提交与贡献.md)
- 代码风格,请参考 [03-为什么拒绝使用代码格式化工具.md](./03-为什么拒绝使用代码格式化工具.md)
<br>
具体 recipe 相关:
- 如何编写一个具体的 recipe请参考 [10-如何编写recipe.md](./10-如何编写recipe.md)
- 如何修改换源链接、模糊/精准测速链接,请参考 [11-如何设置换源链接与测速链接.md](./11-如何设置换源链接与测速链接.md)
<br>
- 关于维护者身份的说明,请参考 [50-协作者与维护者.md](./50-协作者与维护者.md)
<br>

View File

@ -2,14 +2,14 @@
.\" SPDX-License-Identifier: GFDL-1.3-or-later
.\" --------------------------------------------------------------
.\" Doc Type : Man Page
.\" Doc Authors : Aoran Zeng <ccmywish@qq.com>
.\" Contributors : Nul None <nul@none.org>
.\" Doc Authors : 曾奥然 <ccmywish@qq.com>
.\" Contributors : Nul None <nul@none.org>
.\" |
.\" Created On : <2024-08-21>
.\" Last Modified : <2024-10-09>
.\" --------------------------------------------------------------
.\" Last Modified : <2025-10-29>
.\" ----------------------------------------------------------------
.TH chsrc 1 "2024-10-09" "v0.1.9" "RubyMetric chsrc"
.TH chsrc 1 "2025-10-29" "v0.2.3.1" "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
@ -121,7 +121,7 @@ $ chsrc set ruby
$ chsrc ls ruby
$ chsrc set ruby rubychina
# 如果您有自己的镜像地址,使用自定义URL
# 可以使用自定义URL
$ chsrc set ruby https://gems.ruby-china.com/
# 使用维护团队测试的最快镜像站

View File

@ -2,29 +2,29 @@
@c SPDX-License-Identifier: GFDL-1.3-or-later
@c --------------------------------------------------------------
@c Doc Type : Texinfo
@c Doc Authors : Aoran Zeng <ccmywish@qq.com>
@c Contributors : Nul None <nul@none.org>
@c Doc Authors : 曾奥然 <ccmywish@qq.com>
@c Contributors : Nul None <nul@none.org>
@c |
@c Created On : <2024-08-22>
@c Last Modified : <2024-10-09>
@c Last Modified : <2025-10-29>
@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.3.1
@set Doc_Publish_Date 2025-10-29
@copying
@comment 这是软件copyright不是文档copyright因此不放在titlepage
Copyright @copyright{} 2025 Aoran Zeng, Heng Guo
Copyright @copyright{} 2025 曾奥然, 郭恒
@end copying
@titlepage
@title chsrc printed manual
@subtitle Change Source everywhere for every software!
@author Aoran Zeng
@author 曾奥然
@c @insertcopying
For chsrc @value{Chsrc_Version}
@page
@ -160,7 +160,7 @@ $ chsrc set ruby
$ chsrc ls ruby
$ chsrc set ruby rubychina
# 如果您有自己的镜像地址,使用自定义URL
# 可以使用自定义URL
$ chsrc set ruby https://gems.ruby-china.com/
# 使用维护团队测试的最快镜像站

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

9
doc/image/chsrc.svg Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g>
<path d="M13.392,207.176L130.909,79.868L369.203,79.868L486.608,207.055L486.608,210.821L255.801,459.814L244.311,459.814L13.392,210.7L13.392,207.176ZM250.056,118.434C186.007,118.434 134.008,170.433 134.008,234.482C134.008,298.53 186.007,350.53 250.056,350.53C314.104,350.53 366.104,298.53 366.104,234.482C366.104,170.433 314.104,118.434 250.056,118.434Z" style="fill:#a52019;"/>
<path d="M189.09,222.379C183.346,222.379 178.683,217.716 178.683,211.972C178.683,209.1 179.849,206.498 181.733,204.614L204.205,182.142C204.253,182.092 204.302,182.042 204.351,181.993C208.413,177.931 215.007,177.931 219.069,181.993C223.131,186.055 223.131,192.649 219.069,196.711C219.02,196.76 218.97,196.808 218.921,196.856L214.212,201.565L312.183,201.565C317.927,201.565 322.59,206.228 322.59,211.972C322.59,217.716 317.927,222.379 312.183,222.379L189.09,222.379Z" style="fill:#a52019;"/>
<path d="M311.547,245.378C317.29,245.378 321.954,250.042 321.954,255.785C321.954,258.657 320.788,261.259 318.904,263.143L296.431,285.616C296.383,285.665 296.335,285.715 296.286,285.764C292.224,289.826 285.629,289.826 281.568,285.764C277.506,281.703 277.506,275.108 281.568,271.046C281.617,270.997 281.666,270.949 281.716,270.901L286.424,266.193L188.453,266.193C182.71,266.193 178.046,261.529 178.046,255.785C178.046,250.042 182.71,245.378 188.453,245.378L311.547,245.378Z" style="fill:#a52019;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

View File

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

161
justfile Normal file
View File

@ -0,0 +1,161 @@
#!/usr/bin/env just --justfile
# --------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------
# Build File : justfile
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
# |
# Created On : <2025-06-18>
# Last Modified : <2025-10-15>
#
# 该文件主要用于在原生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}}
@{{ if os() == 'windows' { \
'(if exist chsrc.res del chsrc.res)' + \
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
} else { '' } }}
@{{ if os() == 'windows' { \
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
} else { \
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
# 这两个测试文件都用 DEBUG mode
test-xy:
@{{CC}} test/xy.c {{CFLAGS_debug_mode}} -o xy
@{{BIN_xy}}
test-fw:
@{{CC}} test/fw.c {{CFLAGS_debug_mode}} -o fw
@{{BIN_fw}}
fastcheck:
@perl ./test/cli.pl fastcheck
test-cli:
@perl ./test/cli.pl
clean:
-@{{BIN_rm}} *.exe
-@{{BIN_rm}} *.res
-@{{BIN_rm}} xy
-@{{BIN_rm}} fw
-@{{BIN_rm}} chsrc
-@{{BIN_rm}} chsrc-debug
-@{{BIN_rm}} chsrc-release
-@{{BIN_rm}} README.md.bak*
# 使用: just rawstr4c [--debug] Markdown.md
# rawstr4c *args:
# @{{ if os() == 'windows' { 'tool\\rawstr4c\\run\\run.bat' } else { 'bash ./tool/rawstr4c/run/run.sh' } }} {{args}}

53
lefthook.yml Normal file
View File

@ -0,0 +1,53 @@
# ---------------------------------------------------------------
# Lefthook File : lefthook.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2025-10-28>
# Last Modified : <2025-10-30>
# ---------------------------------------------------------------
min_version: 2.0.1
pre-commit:
only:
- ref: dev
parallel: false
jobs:
- name: 试运行 DEBUG mode
# 触发所有 _prelude() 函数检查
run: |
just build-in-debug-mode
./chsrc-debug get pip
glob: "*.{c,h}"
exclude: test/*
- name: 测试 xy.h
run: just test-xy
glob:
- lib/xy.h
- test/xy.c
- name: 测试 framework
run: just test-fw
glob:
- "src/framework/*.{c,h}"
- src/chsrc-main.c
- test/fw.c
post-merge:
only:
- ref: main
jobs:
- name: 测试编译 DEV mode
run: just build-in-dev-mode
pre-push:
only:
- ref: gh-build
jobs:
- name: 测试编译 RELEASE mode
run: just build-in-release-mode
- name: 测试运行
run: just test-cli

1327
lib/xy.h

File diff suppressed because it is too large Load Diff

36
pkg/AUR/README.md Normal file
View File

@ -0,0 +1,36 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GFDL-1.3-or-later
! -------------------------------------------------------------
! Doc Type : Markdown
! Doc Name : README.md
! Doc Authors : 曾奥然 <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):从最新源码构建的版本,偶尔可能不稳定

View File

@ -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
View 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 : 曾奥然 <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
View 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 : 曾奥然 <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
View 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 : 曾奥然 <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
View 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>
! | 曾奥然 <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>

View 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 : 曾奥然 <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!"

19
pkg/deb/debian/changelog Normal file
View File

@ -0,0 +1,19 @@
chsrc (0.2.3-1) unstable; urgency=medium
* v0.2.3 已发布
-- 曾奥然 <ccmywish@qq.com> Wed, 29 Oct 2025 11:29:05 +0800
chsrc (0.1.9-1) unstable; urgency=medium
* v0.1.9 已发布
-- 曾奥然 <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
View 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
View File

@ -0,0 +1,50 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: chsrc
Upstream-Contact: 曾奥然 <ccmywish@qq.com>
Source: https://github.com/RubyMetric/chsrc
Files: *
Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
2023-2025 郭恒 <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 曾奥然 <ccmywish@qq.com>
2023-2025 郭恒 <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
View 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
View 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
View 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>
# | 曾奥然 <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

File diff suppressed because it is too large Load Diff

388
src/framework/chef.c Normal file
View File

@ -0,0 +1,388 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : chef.c
* File Authors : <ccmywish@qq.com>
* Contributors : BingChunMoLi <bingchunmoli@bingchunmoli.com>
* Created On : <2025-08-09>
* Last Modified : <2025-10-27>
*
* chef DSL: for chefs (recipe makers) to define a target
* ------------------------------------------------------------*/
#pragma once
void
chef_debug_target (Target_t *target)
{
#ifdef XY_DEBUG
if (!target)
{
chsrc_debug2 ("target", "Target is NULL");
return;
}
say ("DEBUG Target Information:");
printf (" Aliases: %s\n", target->aliases);
printf (" Get Function: %p\n", target->getfn);
printf (" Set Function: %p\n", target->setfn);
printf (" Reset Function: %p\n", target->resetfn);
printf (" Prelude Function: %p\n", target->preludefn);
printf (" Inited?: %d\n", target->inited);
printf (" Sources: %p\n", target->sources);
printf (" Sources Count: %d\n", target->sources_n);
printf (" Chef: %p\n", target->chef);
printf (" Cooks: %p\n", target->cooks);
printf (" Cooks Count: %d\n", target->cooks_n);
printf (" Sauciers: %p\n", target->sauciers);
printf (" Sauciers Count: %d\n", target->sauciers_n);
#endif
}
void
chef_debug_contributor (Contributor_t *contributor)
{
#ifdef XY_DEBUG
if (!contributor)
{
chsrc_debug2 ("contrib", "Contributor is NULL");
return;
}
say ("DEBUG Contributor Information:");
printf (" ID: %s\n", contributor->id);
printf (" Name: %s\n", contributor->name);
printf (" Email: %s\n", contributor->email);
printf (" DisplayName: %s\n", contributor->display_name);
#endif
}
/**
* @brief
*
* @param id IDID最好是GitHub用户名 chsrc
* @param display_name 使 name
*/
void
chef_register_contributor (char *id, char *name, char *email, char *display_name)
{
if (!id || !name || !email)
xy_unreached();
Contributor_t *contributor = xy_malloc0 (sizeof (Contributor_t));
contributor->id = xy_strdup (id);
contributor->name = xy_strdup (name);
contributor->email = xy_strdup (email);
if (!display_name)
contributor->display_name = xy_strdup (name);
else
contributor->display_name = xy_strdup (display_name);
xy_map_set (ProgStore.contributors, id, contributor);
}
/**
* @brief Provider
*
* @note Provider UpstreamProvider
*/
void
chef_set_provider_speed_measure_url (SourceProvider_t *provider, char *url)
{
provider->psmi.skip = NotSkip;
provider->psmi.url = xy_strdup (url);
chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, "(镜像站信息本身) 设置测速链接: ", url));
}
/**
* @brief Provider
*
* @note Provider UpstreamProvider
*/
void
chef_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accuracy)
{
provider->psmi.accurate = accuracy;
chsrc_debug ("m", xy_strcat (4, "recipe 重新为 ", provider->code, "(镜像站信息本身) 设置测速精度: ", accuracy ? "精准" : "粗略"));
}
/**
* @brief "换源链接"
*/
void
chef_set_sources_speed_measure_url_with_func (
Target_t *target,
char *(*func)(const char *url, const char *user_data),
char *user_data)
{
xy_cant_be_null (target);
Source_t *sources = target->sources;
int n = target->sources_n;
for (int i=0; i<n; i++)
{
Source_t *src = &sources[i];
ProviderType_t type = src->provider->type;
if (src->url)
{
/* 为空时才修改 或者里面是脏数据 */
if (NULL==src->speed_measure_url || !hp_is_url (src->speed_measure_url))
{
src->speed_measure_url = func (src->url, user_data);
}
}
}
}
/**
* @brief "换源链接"
*/
void
chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix)
{
chef_set_sources_speed_measure_url_with_func (target, xy_2strcat, postfix);
}
/**
* @note : item target standalone
*/
void
chef_use_other_target_sources (Target_t *this, Target_t *other)
{
if (!other->inited)
{
if (other->preludefn)
other->preludefn();
else
{
chef_debug_target (other);
chsrc_panic ("`other` 未定义 _prelude() !");
}
}
this->sources = other->sources;
this->sources_n = other->sources_n;
}
void
chef_allow_english (Target_t *target)
{
xy_cant_be_null (target);
target->can_english = true;
}
void
chef_deny_english (Target_t *target)
{
xy_cant_be_null (target);
target->can_english = false;
}
void
chef_allow_local_mode (Target_t *target, Capability_t cap, const char *explain_zh, const char *explain_en)
{
xy_cant_be_null (target);
target->cap_local = cap;
if (cap == FullyCan)
{
target->cap_local_explain = xy_strdup (CHINESE ? "完全支持项目级换源" : "Supports project-level source switching");
return;
}
if (cap == CanNot)
{
target->cap_local_explain = xy_strdup (CHINESE ? "无法进行项目级换源" : "Unable to perform project-level source switching");
return;
}
target->cap_local_explain = xy_strdup (CHINESE ? explain_zh : explain_en);
}
void
chef_allow_user_define (Target_t *target)
{
xy_cant_be_null (target);
target->can_user_define = true;
target->can_user_define_explain = NULL;
}
void
chef_deny_user_define (Target_t *target)
{
xy_cant_be_null (target);
target->can_user_define = false;
char *reason = CHINESE ? "URL将会根据内部实现重写,因此不能自定义"
: "The URL will be rewritten based on internal implementation, so it cannot be customized";
target->can_user_define_explain = reason;
}
void
chef_set_note (Target_t *target, const char *note_zh, const char *note_en)
{
xy_cant_be_null (target);
const char *msg = CHINESE ? note_zh : note_en;
if (msg)
target->note = xy_strdup (msg);
}
/**
* @brief `id`
*/
Contributor_t *
chef_verify_contributor (const char *id)
{
xy_cant_be_null (id);
Contributor_t *c = xy_map_get (ProgStore.contributors, id);
if (!c)
{
char error[256];
snprintf (error, sizeof (error), "贡献者 %s 不存在, 是否写错?或请在 chsrc-main.c 中登记该贡献者", id);
chsrc_panic (error);
}
return c;
}
/**
* @brief Chef (recipe )
*/
void
chef_set_chef (Target_t *target, const char *id)
{
xy_cant_be_null (target);
/* Chef 可为空 */
if (!id)
{
target->chef = NULL;
return;
}
Contributor_t *c = chef_verify_contributor (id);
target->chef = c;
}
/**
* @brief Cooks (recipe )
*/
void
chef_set_cooks (Target_t *target, size_t count, ...)
{
xy_cant_be_null (target);
if (count == 0)
{
chsrc_panic ("recipe 一定至少有1位作者(cooks)");
return;
}
va_list args;
va_start (args, count);
target->cooks = xy_malloc0 (count * sizeof (Contributor_t*));
target->cooks_n = count;
for (size_t i = 0; i < count; i++)
{
char *id = va_arg (args, char*);
target->cooks[i] = chef_verify_contributor (id);
}
va_end (args);
}
void
chef_set_sauciers (Target_t *target, uint32_t count, ...)
{
xy_cant_be_null (target);
if (count == 0)
{
target->sauciers = NULL;
target->sauciers_n = 0;
return;
}
va_list args;
va_start (args, count);
target->sauciers = xy_malloc0 (count * sizeof (Contributor_t*));
target->sauciers_n = count;
for (uint32_t i = 0; i < count; i++)
{
char *id = va_arg (args, char*);
target->sauciers[i] = chef_verify_contributor (id);
}
}
void
chef_set_created_on (Target_t *target, char *date)
{
xy_cant_be_null (target);
xy_cant_be_null (date);
target->created_on = xy_strdup (date);
}
void
chef_set_last_updated (Target_t *target, char *date)
{
xy_cant_be_null (target);
xy_cant_be_null (date);
target->last_updated = xy_strdup (date);
}
void
chef_set_sources_last_updated (Target_t *target, char *date)
{
xy_cant_be_null (target);
xy_cant_be_null (date);
target->sources_last_updated = xy_strdup (date);
}
/**
* @note target User-Agent
* (chsrc measure)
* _setsrc() _prelude()
*/
void
chef_set_user_agent (char *user_agent)
{
ProgStatus.user_agent = user_agent;
}

File diff suppressed because it is too large Load Diff

44
src/framework/helper.c Normal file
View File

@ -0,0 +1,44 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : helper.c
* File Authors : <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2025-07-14>
* Last Modified : <2025-10-28>
*
* For chefs (recipe makers) and sometimes framewoker
* to do some work not releated to OS operations
* ------------------------------------------------------------*/
bool
hp_is_url (const char *str)
{
return (xy_str_start_with (str, "http://") || xy_str_start_with (str, "https://"));
}
/**
* @return
*/
char *
hp_remove_trailing_slash (char *str)
{
char *newstr = xy_strdup (str);
size_t len = strlen (newstr);
if (len > 0 && newstr[len - 1] == '/')
newstr[len - 1] = '\0';
return newstr;
}
/**
* @return
*/
char *
hp_ensure_trailing_slash (char *str)
{
size_t len = strlen (str);
if (len == 0 || str[len - 1] == '/')
return xy_strdup (str);
return xy_2strcat (str, "/");
}

View File

@ -1,14 +1,16 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : mirror.c
* File Authors : Aoran Zeng <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com>
* File Name : mirror.c
* File Authors : <ccmywish@qq.com>
* | <2085471348@qq.com>
* Contributors : Shengwei Chen <414685209@qq.com>
* | Jialin Lyu <jialinlvcn@aliyun.com>
* | Jialin Lyu <jialinlvcn@aliyun.com>
* | Mikachu2333 <mikachu.23333@zohomail.com>
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
* |
* Created On : <2023-08-29>
* Last Modified : <2025-03-09>
* Last Modified : <2025-10-07>
*
*
* ------------------------------------------------------------*/
@ -23,145 +25,190 @@
*
* @sync https://github.com/RubyMetric/chsrc/wiki
*
* Wiki中的排序是根据 https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
* https://github.com/mirrorz-org/oh-my-mirrorz
*/
MirrorSite_t MirrorZ =
{
"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/",
{SKIP, "功能特殊无法测速,跳过", "SKIP because of its special function"}
IS_GeneralMirrorSite,
"mirrorz", "MirrorZ", "校园网联合镜像站(MirrorZ)", "https://mirrors.cernet.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.cernet.edu.cn/ubuntu/dists/noble/Contents-amd64.gz", ROUGH}
},
Tuna =
{
IS_GeneralMirrorSite,
"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"}
{NotSkip, NA, NA, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin", ROUGH}
},
/**
* @note 2025-3-17 SJTUG SJTU
* @note 2025-03-17 SJTUG SJTU
* @note targetflathub
*/
Sjtug_Zhiyuan =
{
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan}
IS_GeneralMirrorSite,
"sjtu-zy", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan, ROUGH}
},
Sjtug_Siyuan =
{
"sjtu", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan}
},
Zju =
{
"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu}
},
Lzuoss =
{
"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.lzu.edu.cn/CTAN" Big_File_ctan}
},
Jlu =
{
"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.jlu.edu.cn/_static/speedtest.bin"}
IS_GeneralMirrorSite,
"sjtu-sy", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan, ROUGH}
},
Bfsu =
{
IS_GeneralMirrorSite,
"bfsu", "BFSU", "北京外国语大学开源软件镜像站", "https://mirrors.bfsu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"}
},
Pku =
{
"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu}
},
Bjtu =
{
"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux}
},
Sustech =
{
"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"}
{NotSkip, NA, NA, "https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin", ROUGH}
},
Ustc =
{
"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"ustc", "USTC", "中国科学技术大学开源软件镜像", "https://mirrors.ustc.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Hust =
Zju =
{
"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
// 速度暂时处于10位以后或者无测速报告但是目前可用的源
Iscas =
Jlu =
{
"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
{NotSkip, NA, NA, "https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.jlu.edu.cn/_static/speedtest.bin", ROUGH}
},
Scau =
Lzuoss =
{
"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.lzu.edu.cn/CTAN" Big_File_ctan, ROUGH}
},
NJTech =
Pku =
{
"njtech", "NJTech", "南京工业大学开源软件镜像站", "https://mirrors.njtech.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.njtech.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Nyist =
Bjtu =
{
"nyist", "NYIST", "南阳理工学院开源软件镜像站", "https://mirror.nyist.edu.cn/",
{NotSkip, NA, NA, "https://mirror.nyist.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux, ROUGH}
},
Sdu =
Sustech =
{
"sdu", "SDU", "山东大学镜像站", "https://mirrors.sdu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sdu.edu.cn/ubuntu-releases" Big_File_ubuntu}
},
Cqupt =
{
"cqupt", "CQUPT", "重庆邮电大学开源镜像站", "https://mirrors.cqupt.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.cqupt.edu.cn/ubuntu-releases" Big_File_ubuntu}
IS_GeneralMirrorSite,
"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin", ROUGH}
},
Nju =
{
IS_GeneralMirrorSite,
"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux}
};
{NotSkip, NA, NA, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux, ROUGH}
},
Xjtu =
{
IS_GeneralMirrorSite,
"xjtu", "XJTU", "西安交通大学软件镜像站", "https://mirrors.xjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.xjtu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Hust =
{
IS_GeneralMirrorSite,
"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Iscas =
{
IS_GeneralMirrorSite,
"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
{NotSkip, NA, NA, "https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Hit =
{
IS_GeneralMirrorSite,
"hit", "HIT", "哈尔滨工业大学开源软件镜像站", "https://mirrors.hit.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.hit.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Scau =
{
IS_GeneralMirrorSite,
"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
NJTech =
{
IS_GeneralMirrorSite,
"njtech", "NJTech", "南京工业大学开源软件镜像站", "https://mirrors.njtech.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.njtech.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Nyist =
{
IS_GeneralMirrorSite,
"nyist", "NYIST", "南阳理工学院开源软件镜像站", "https://mirror.nyist.edu.cn/",
{NotSkip, NA, NA, "https://mirror.nyist.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Sdu =
{
IS_GeneralMirrorSite,
"sdu", "SDU", "山东大学镜像站", "https://mirrors.sdu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sdu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Qlu =
{
IS_GeneralMirrorSite,
"qlu", "QLU", "齐鲁工业大学开源镜像站", "https://mirrors.qlu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.qlu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Cqupt =
{
IS_GeneralMirrorSite,
"cqupt", "CQUPT", "重庆邮电大学开源镜像站", "https://mirrors.cqupt.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.cqupt.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
/**
* @note 2023-09-05 使5ip封杀了
*
* Cqu =
* {
* "cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
* {NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"}
* };
*
* @note 2023-09-05 使
*/
Cqu =
{
IS_GeneralMirrorSite,
"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Neosoft =
{
IS_GeneralMirrorSite,
"neosoft", "Neosoft", "大连东软信息学院开源镜像站", "https://mirrors.neusoft.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.neusoft.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
};
@ -170,65 +217,89 @@ Nju =
*/
MirrorSite_t Ali =
{
IS_GeneralMirrorSite,
"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", ROUGH} // 31MB左右
},
/*
// https://mirrors.cloud.aliyuncs.com/
Ali_ECS_VPC =
{
IS_GeneralMirrorSite,
"ali-ECS-VPC", "Ali OPSX ECS VPC", "阿里巴巴开源镜像站(ECS VPC网络)", "https://developer.aliyun.com/mirror/",
{NotSkip, NA, NA, "https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin}
{NotSkip, NA, NA, "https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin, ROUGH}
},
// https://mirrors.aliyuncs.com/
Ali_ECS_classic =
{
IS_GeneralMirrorSite,
"ali-ECS", "Ali OPSX ECS", "阿里巴巴开源镜像站(ECS 经典网络)", "https://developer.aliyun.com/mirror/",
{NotSkip, NA, NA, "https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin}
{NotSkip, NA, NA, "https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin, ROUGH}
},
*/
Tencent =
{
IS_GeneralMirrorSite,
"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", ROUGH} // 110MB左右
},
/*
Tencent_Intra =
{
IS_GeneralMirrorSite,
"tencent-intra", "Tencent Intranet", "腾讯软件源(内网)", "https://mirrors.tencent.com/",
{NotSkip, NA, NA, "https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu}
{NotSkip, NA, NA, "https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
*/
Huawei =
{
IS_GeneralMirrorSite,
"huawei", "Huawei Cloud", "华为开源镜像站", "https://mirrors.huaweicloud.com/",
{NotSkip, NA, NA, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu}
{NotSkip, NA, NA, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
HuaweiCDN =
{
IS_GeneralMirrorSite,
"huawei-cdn", "Huawei Cloud CDN", "华为开源镜像站(CDN)", "https://repo.huaweicloud.com/",
{NotSkip, NA, NA, "https://repo.huaweicloud.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
Volcengine =
{
IS_GeneralMirrorSite,
"volc", "Volcengine", "火山引擎开源软件镜像站(公网)", "https://developer.volcengine.com/mirror/",
{NotSkip, NA, NA, "https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu}
{NotSkip, NA, NA, "https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
},
/*
Volceengine_Intra =
{
IS_GeneralMirrorSite,
"volc-intra", "Volcengine Intranet", "火山引擎开源软件镜像站(内网)",
"https://developer.volcengine.com/mirror/",
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu },
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu, ROUGH},
*/
/**
* @note 2025-06-20 使
*/
Netease =
{
IS_GeneralMirrorSite,
"netease", "Netease", "网易开源镜像站", "https://mirrors.163.com/",
{NotSkip, NA, NA, "https://mirrors.163.com/deepin-cd" Big_File_deepin}
{NotSkip, NA, NA, "https://mirrors.163.com/deepin-cd" Big_File_deepin, ROUGH}
},
/**
* @note 2025-06-20 使
*/
Sohu =
{
IS_GeneralMirrorSite,
"sohu", "SOHU", "搜狐开源镜像站", "https://mirrors.sohu.com/",
{NotSkip, NA, NA, "https://mirrors.sohu.com/deepin-cd" Big_File_deepin}
{NotSkip, NA, NA, "https://mirrors.sohu.com/deepin-cd" Big_File_deepin, ROUGH}
};

View File

@ -2,37 +2,51 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : struct.h
* File Authors : Aoran Zeng <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com>
* File Authors : <ccmywish@qq.com>
* | <2085471348@qq.com>
* Contributors : Shengwei Chen <414685209@qq.com>
* |
* Created On : <2023-08-29>
* Last Modified : <2024-12-18>
* Last Modified : <2025-08-22>
*
* chsrc struct
* ------------------------------------------------------------*/
typedef struct SpeedMeasureInfo_t
typedef struct ProviderSpeedMeasureInfo_t
{
bool skip; /* 是否默认跳过 */
char *skip_reason_CN; /* 跳过的原因(中文)*/
char *skip_reason_EN; /* 跳过的原因(英文)*/
char *url; /* 测速链接 */
bool accurate; /* 是否为精准测速,上游源和专用镜像站为 ACCURATE通用镜像站为 ROUGH */
}
SpeedMeasureInfo_t;
ProviderSpeedMeasureInfo_t;
#define SKIP true
#define NotSkip false
#define ToFill NULL
#define NA NULL
#define ACCURATE true
#define ROUGH false
typedef enum ProviderType_t
{
IS_GeneralMirrorSite, /* 通用镜像站 */
IS_DedicatedMirrorSite, /* 专用镜像站 */
IS_UpstreamProvider, /* 上游默认源 */
IS_UserDefinedProvider, /* 用户提供 */
}
ProviderType_t;
typedef struct SourceProvider_t
{
const ProviderType_t type; /* 类型 */
const char *code; /* 用于用户指定某一 Provider */
const char *abbr; /* 需要使用 Provider 的英文名时,用这个代替,因为大部分 Provider 没有提供正式的英文名 */
const char *name; /* Provider 中文名 */
const char *site; /* Provider 首页 */
SpeedMeasureInfo_t smi;
ProviderSpeedMeasureInfo_t psmi;
}
SourceProvider_t;
@ -40,19 +54,20 @@ typedef SourceProvider_t MirrorSite_t;
SourceProvider_t UpstreamProvider =
{
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段,可使用 def_upstream 宏 */
IS_UpstreamProvider,
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段 */
"upstream", "Upstream", "上游默认源", NULL,
/* 引入新的上游默认源时,请完全修改下面这个结构体,可使用 def_need_measure_info 宏 */
{SKIP, "URL未知邀您参与贡献!", "URL unknown, welcome to contribute!", NULL}
{SKIP, "URL未知邀您参与贡献!", "URL unknown, welcome to contribute!", NULL, ACCURATE}
};
#define def_upstream "upstream", "Upstream", "上游默认源"
#define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL}
#define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL, ACCURATE}
SourceProvider_t UserDefinedProvider =
{
IS_UserDefinedProvider,
"user", "用户自定义", "用户自定义", NULL,
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL}
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL, ACCURATE}
};
@ -62,71 +77,103 @@ typedef struct Source_t
SourceProvider_t *provider;
MirrorSite_t *mirror;
};
/* 用于换源的 URL */
char *url;
/* 对该 source 的专用测速链接,这就是精准测速 */
char *speed_measure_url;
}
Source_t;
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
/* 不用给专用测速链接,因为 Upstream 的整体测速链接已是精准测速 */
#define DelegateToUpstream NULL
/* 不用给专用测速链接,因为该镜像站是专用镜像站,其整体测速链接已是精准测速 */
#define DelegateToMirror NULL
/* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */
#define NeedContribute NULL
/* 由 prelude() 填充 */
#define FeedByPrelude NULL
enum Capability_t
typedef enum Capability_t
{
CanNot,
FullyCan,
PartiallyCan
};
/* Target Feature */
typedef struct Feature_t
{
bool can_get;
bool can_reset; /* 有的reset不是暂时没有实现而是现在的实现根本就无法重置 */
bool can_english;
bool can_user_define; /* 用户自定义换源URL */
enum Capability_t cap_locally;
char *cap_locally_explain;
char *note;
}
Feature_t;
Capability_t;
typedef struct Contributor_t
{
char *id; /* 全局唯一贡献者标识符,防止反复写信息,以 @ 开头 */
char *name; /* 贡献者姓名; 鉴于该项目完全依赖于贡献者,建议留下真实姓名或者昵称 */
char *email;
char *display_name; /* recipe 结束时会显示贡献者信息,如果你不愿显示真实姓名或者昵称,可以另外提供一个名字 */
}
Contributor_t;
typedef struct Target_t
{
/* 以 / 为分隔符的多个目标别名 */
char *aliases;
void (*getfn) (char *option);
void (*setfn) (char *option);
void (*resetfn) (char *option);
Feature_t (*featfn) (char *option);
/* 初始化函数,用于填充该 struct 的各种信息 */
void (*preludefn) (void);
bool inited; /* 是否执行过了 preludefn() */
Source_t *sources;
size_t sources_n;
int sources_n;
/* Features */
bool can_english; /* 是否支持英文输出 */
bool can_user_define; /* 是否支持用户自定义URL来换源 */
char *can_user_define_explain; /* 用户自定义URL的说明 */
Capability_t cap_local; /* 是否支持 local mode */
char *cap_local_explain; /* local mode 的说明 */
char *note; /* 备注 */
/* recipe 维护信息 */
char *created_on;
char *last_updated;
char *sources_last_updated;
Contributor_t *chef; /* 该 recipe *当前*的总负责人 (可以任职也可以休职) */
Contributor_t **cooks; /* 该 recipe 的主要作者 */
int cooks_n;
Contributor_t **sauciers; /* 该 recipe 的次要贡献者 (除主要作者外的其他人) */
int sauciers_n;
}
Target_t;
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
#define def_target_inner_sr(t) NULL, t##_setsrc, t##_resetsrc, NULL
#define def_target_inner_sf(t) NULL, t##_setsrc, NULL, t##_feat
#define def_target_inner_srf(t) NULL, t##_setsrc, t##_resetsrc, t##_feat
#define def_target_inner_gs(t) t##_getsrc, t##_setsrc, NULL, NULL
#define def_target_inner_gsr(t) t##_getsrc, t##_setsrc, t##_resetsrc, NULL
#define def_target_inner_gsf(t) t##_getsrc, t##_setsrc, NULL, t##_feat
#define def_target_inner_gsrf(t) t##_getsrc, t##_setsrc, t##_resetsrc, t##_feat
#define def_target_sourcesn(t) t##_sources, t##_sources_n
#define def_target(t, aliases) void t##_getsrc(char *option);void t##_setsrc(char *option);void t##_resetsrc(char *option); Target_t t##_target={aliases};
/* 大部分target还不支持reset所以暂时先默认设置为NULL来过渡 */
#define def_target(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
#define def_target_s(t) Target_t t##_target = {def_target_inner_s(t),def_target_sourcesn(t)}
#define def_target_sr(t) Target_t t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)}
#define def_target_sf(t) Target_t t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)}
#define def_target_srf(t) Target_t t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)}
#define def_target_gs(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
#define def_target_gsr(t) Target_t t##_target = {def_target_inner_gsr(t),def_target_sourcesn(t)}
#define def_target_gsf(t) Target_t t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)}
#define def_target_gsrf(t) Target_t t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)}
#define chef_allow_gsr(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
#define chef_allow_s(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = NULL;
#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
#define chef_allow_NOOP(t)
#define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t);
#define use_this(t) Target_t *this = &t##_target;
#define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option);
#define def_sources_begin() Source_t sources[] = {
#define def_sources_end() }; \
this->sources_n = xy_c_array_len(sources); \
char *_sources_storage = xy_malloc0 (sizeof(sources)); \
memcpy (_sources_storage, sources, sizeof(sources)); \
this->sources = (Source_t *)_sources_storage;

23
src/framework/version.h Normal file
View File

@ -0,0 +1,23 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : version.h
* File Authors : <ccmywish@qq.com>
* | Mikachu2333 <mikachu.23333@zohomail.com>
* Contributors : Nil Null <nil@null.org>
* |
* Created On : <2025-10-10>
* Last Modified : <See 'Chsrc_Release_Date'>
*
*
* ------------------------------------------------------------*/
#define Chsrc_Version "0.2.3.4"
// 以下四个宏仅用于 resource/chsrc.rc
#define Chsrc_Version_Major 0
#define Chsrc_Version_Minor 2
#define Chsrc_Version_Patch 3
#define Chsrc_Version_Pre 4
#define Chsrc_Release_Date "2025/12/18"

18
src/rawstr4c.h Normal file

File diff suppressed because one or more lines are too long

225
src/rawstr4c.md Normal file
View File

@ -0,0 +1,225 @@
<!-- -----------------------------------------------------------
! SPDX-License-Identifier: GPL-3.0-or-later
! -------------------------------------------------------------
! Config Type : rawstr4c (Markdown)
! Config Authors: 曾奥然 <ccmywish@qq.com>
! Contributors : Nil Null <nil@null.org>
! Created On : <2025-07-22>
! Last Modified : <2025-10-29>
! ---------------------------------------------------------- -->
# [rawstr4c] input for chsrc
`chsrc` 使用的 C标准 (最低要求) 是 `gnu11` (`c11` 的超集),这也就是说,我们项目是可以,而且是 **推荐** 同时混用 `R"()"``rawstr4c`
`LLVM``R"()"` 的支持是在 2024年07月 以后。但是在 GitHub Actions 中,所有出现的 `LLVM` 版本都太低了,
这使得我们被迫把已经写过的 `R"()"` 全部再转换为 `rawstr4c`.
用户端的编译器一般比较新,然而可能也没有新到如此的地步,通过使用 `rawstr4c` 我们也放宽了用户对编译器的要求。
我们预计等2~3年后在项目中重新开始 `R"()"` 的写法
<br>
- prefix = `RAWSTR_chsrc`
- output = `:global-variable-only-header`
- translate = `:oct`
- no-postfix = `true`
<br>
## 中文帮助
- name = `USAGE_CHINESE`
```
名称:
chsrc - Change Source - (GPLv3+)
版本:
@ver@
使用:
chsrc <command> [options] [target] [mirror]
命令:
help, h 打印此帮助,或 -h, --help
issue, i 查看相关issue
list, ls, l 列出可用镜像站和可换源目标
list mirror|target 列出支持的: 镜像站/换源目标
list os|lang|ware 列出支持的: 操作系统/编程语言/软件
list <target> 查看该目标可用源与支持功能
measure, m, cesu <target> 对该目标所有源测速
get, g <target> 查看该目标当前源的使用情况
set, s <target> 换源,自动测速后挑选最快源
set <target> first 换源,使用维护团队测速第一的源
set <target> <mirror> 换源,指定使用某镜像站 (通过list <target>查看)
set <target> <URL> 换源用户自定义源URL
reset <target> 重置,使用上游默认使用的源
选项:
-dry Dry Run模拟换源过程命令仅打印并不运行
-local 仅对本项目而非全局换源 (通过ls <target>查看支持情况)
-ipv6 使用IPv6测速
-en(glish) 使用英文输出
-no-color 无颜色输出
维护:
邀请您担任 Chef, 为用户把关您熟悉的 recipe
源代码地址: https://github.com/RubyMetric/chsrc
成为维护者: https://github.com/RubyMetric/chsrc/issues/275
```
<br>
## 英文帮助
- name = `USAGE_ENGLISH`
```
NAME:
chsrc - Change Source - (GPLv3+)
VERSION:
@ver@
USAGE:
chsrc <command> [options] [target] [mirror]
COMMANDS:
help, h Print this help, or -h, --help
issue, i See related issues
list, ls, l List available mirror sites and supported targets
list mirror|target List supported: mirror sites/supported targets
list os|lang|ware List supported: OSes/Programming Languages/Softwares
list <target> View available sources and supporting features for <target>
measure, m, cesu <target> Measure velocity of all sources of <target>
get, g <target> View the current source state for <target>
set, s <target> Change source, select the fastest source by automatic speed measurement
set <target> first Change source, select the fastest source measured by the maintainers team
set <target> <mirror> Change source, specify a mirror site (Via `list <target>`)
set <target> <URL> Change source, using user-defined source URL
reset <target> Reset source to the upstream's default
OPTIONS:
-dry Dry Run. Simulate the source changing process, command only prints, not run
-local Change source only for this project rather than globally (Via `ls <target>`)
-ipv6 Speed measurement using IPv6
-en(glish) Output in English
-no-color Output without color
MAINTAIN:
We invite you to become a Chef to ensure the quality of recipes you are familiar with for users:
Source Code: @url@
Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/275
```
<br>
## for `chsrc -v`
- name = `for__v_CHINESE`
```
chsrc @ver@
Copyright (C) 2023-2025 曾奥然, 郭恒
许可证 GPLv3+GNU GPL 第 3 版或更高版本 <https://gnu.org/licenses/gpl.html>
这是自由软件:您可以自由修改和分发它。
在法律允许的最大范围内,本软件按'原样'提供,不作任何明示或暗示的保证。
由作者曾奥然、郭恒协作者Mikachu2333、Happy Game 以及各位贡献者开发。(详见 chsrc-main.c, 或 `chsrc ls <target>`)
```
<br>
## for `chsrc -v -en`
- name = `for__v_ENGLISH`
```
chsrc @ver@
Copyright (C) 2023-2025 Aoran Zeng, Heng Guo
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by authors: Aoran Zeng, Heng Guo, collaborators: Mikachu2333, Happy Game, and contributors. (See chsrc-main.c, or `chsrc ls <target>`)
```
<br>
## for `chsrc issue`
- name = `for_issue`
```
我们同时在 GitHub 和 Gitee 接受 issue 和 Bug 报告:
- https://github.com/RubyMetric/chsrc/issues
- https://gitee.com/RubyMetric/chsrc/issues
欢迎参与具体任务:
Shell auto-completion 终端命令自动补全:
https://github.com/RubyMetric/chsrc/issues/204
搜集上游默认源地址,帮助进行 chsrc reset:
https://github.com/RubyMetric/chsrc/issues/111
搜集测速地址,进行精准测速:
https://github.com/RubyMetric/chsrc/issues/205
帮助没有预编译的平台编写 shell 脚本:
https://github.com/RubyMetric/chsrc/issues/230
支持的通用镜像站:
- https://github.com/RubyMetric/chsrc/wiki
```
<br>
## 最后告诉用户一些维护信息
- name = `op_epilogue`
```
* 精准测速: 能真实反映你未来使用该资源时的速度,因为它直接测量你关注的那个资源。
* 模糊测速: 仅代表该镜像站提供服务的一个可能速度。因而可能会出现测速数值较高,但实际使用体验不佳的现象。
当你遇到模糊测速时,请尽可能向我们提交准确的测速链接: chsrc issue
```
<br>
[rawstr4c]: https://github.com/RubyMetric/rawstr4c

View File

@ -1,35 +1,55 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-10>
* Last Modified : <2024-08-09>
* ------------------------------------------------------------*/
/**
* @update 2023-09-10
* @note
*/
static Source_t pl_clojure_sources[] =
def_target(pl_clojure, "clojure/clojars/cloj/lein");
void
pl_clojure_prelude ()
{
{&UpstreamProvider, NULL},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/clojars/"},
{&Ustc, "https://mirrors.ustc.edu.cn/help/clojars.html"}
};
def_sources_n(pl_clojure);
chef_prep_this (pl_clojure, s);
chef_set_created_on (this, "2023-09-10");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2025-08-21");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@hezonglun");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_deny_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider,"https://repo.clojars.org/", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/clojars/", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror},
{&Nyist, "https://mirror.nyist.edu.cn/clojars/", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/clojars/", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/clojars/", DelegateToMirror}
def_sources_end()
}
void
pl_clojure_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_clojure);
chsrc_use_this_source (pl_clojure);
chsrc_note2 ("抱歉Clojure换源较复杂您可手动查阅并换源:");
p(source.url);
if (chsrc_in_local_mode())
{
chsrc_note2 ("请在项目根目录中的 project.clj 中手动添加 :mirrors 关键字:");
char *config = xy_str_gsub (RAWSTR_pl_clojure_project_clj, "@url@", source.url);
println (config);
}
else
{
chsrc_note2 ("请在 ~/.lein/projfiles.clj 中手动添加 :mirrors 关键字:");
char *config = xy_str_gsub (RAWSTR_pl_clojure_projfiles_clj, "@url@", source.url);
println (config);
}
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}
def_target_s (pl_clojure);

View File

@ -1,28 +1,36 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* |
* Created On : <2023-09-10>
* Major Revision : 2
* Last Modified : <2024-11-22>
*
* 2024-09-14: Dart和Flutter拆分为两个Target
* 3 Dart Flutter URL模式都不一样
* ------------------------------------------------------------*/
/**
* @update 2024-10-31
*/
static Source_t pl_dart_flutter_sources[] =
def_target(pl_dart_flutter, "flutter");
void
pl_dart_flutter_prelude (void)
{
{&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"}
};
def_sources_n(pl_dart_flutter);
chef_prep_this (pl_dart_flutter, gsr);
chef_set_created_on (this, "2023-09-10");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-04-15");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://storage.googleapis.com", FeedByPrelude},
{&FlutterCN, "https://storage.flutter-io.cn", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn", FeedByPrelude }, /* 官方文档也没有给后缀,怀疑是否存在问题 */
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/flutter", FeedByPrelude}
def_sources_end()
chef_set_sources_speed_measure_url_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz");
}
/**
@ -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);
}
@ -54,19 +51,14 @@ pl_dart_flutter_getsrc (char *option)
void
pl_dart_flutter_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_dart_flutter);
chsrc_use_this_source (pl_dart_flutter);
char *w = NULL;
if (xy_on_windows)
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_strcat (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\"");
chsrc_run (cmd, RunOpt_No_Last_New_Line);
}
else
{
@ -74,7 +66,7 @@ pl_dart_flutter_setsrc (char *option)
char *bashrc = xy_bashrc;
chsrc_backup (zshrc);
w = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n");
w = xy_strcat (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n");
chsrc_append_to_file (w, zshrc);
if (xy_file_exist (bashrc))
@ -94,27 +86,3 @@ pl_dart_flutter_resetsrc (char *option)
{
pl_dart_flutter_setsrc (option);
}
/**
* chsrc ls flutter
*/
Feature_t
pl_dart_flutter_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 = true;
f.can_user_define = true;
f.note = "该换源通过写入环境变量实现若多次换源请手动清理profile文件";
return f;
}
def_target_gsrf(pl_dart_flutter);

View File

@ -1,44 +1,42 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* |
* Created On : <2023-09-10>
* Major Revision : 3
* Last Modified : <2024-10-31>
*
* Dart Pub
* ------------------------------------------------------------*/
/**
* @update 2024-10-31
*/
static Source_t pl_dart_sources[] =
def_target(pl_dart, "dart/pub");
void
pl_dart_prelude (void)
{
{&UpstreamProvider, "https://pub.dev"},
{&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"}
};
def_sources_n(pl_dart);
chef_prep_this (pl_dart, gsr);
chef_set_created_on (this, "2023-09-10");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-04-15");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://pub.dev", FeedByPrelude},
{&FlutterCN, "https://pub.flutter-io.cn", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude}
def_sources_end()
chef_set_sources_speed_measure_url_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
}
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);
}
/**
@ -49,19 +47,14 @@ pl_dart_getsrc (char *option)
void
pl_dart_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_dart);
chsrc_use_this_source (pl_dart);
char *w = NULL;
if (xy_on_windows)
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_strcat (3, "setx PUB_HOSTED_URL \"", source.url, "\"");
chsrc_run (cmd, RunOpt_No_Last_New_Line);
}
else
{
@ -69,7 +62,7 @@ pl_dart_setsrc (char *option)
char *bashrc = xy_bashrc;
chsrc_backup (zshrc);
w = xy_strjoin (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n");
w = xy_strcat (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n");
chsrc_append_to_file (w, zshrc);
@ -90,24 +83,3 @@ pl_dart_resetsrc (char *option)
{
pl_dart_setsrc (option);
}
Feature_t
pl_dart_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 = true;
f.can_user_define = true;
f.note = "该换源通过写入环境变量实现若多次换源请手动清理profile文件";
return f;
}
def_target_gsrf(pl_dart);

View File

@ -0,0 +1,17 @@
/** ------------------------------------------------------------
* 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-07-11>
* ------------------------------------------------------------*/
static MirrorSite_t FlutterCN =
{
IS_DedicatedMirrorSite,
"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", ACCURATE} // 231 MB
};

View File

@ -1,53 +1,59 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* |
* Created On : <2023-08-30>
* Major Revision : 1
* Last Modified : <2024-12-18>
* ------------------------------------------------------------*/
static SourceProvider_t pl_go_upstream =
{
def_upstream, "https://pkg.go.dev/",
def_need_measure_info
};
static MirrorSite_t GoProxyCN =
{
IS_DedicatedMirrorSite,
"goproxy.cn", "Goproxy.cn", "Goproxy.cn (七牛云)", "https://goproxy.cn/",
{NotSkip, NA, NA, "https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"} // 30 MB
{NotSkip, NA, NA, "https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", ACCURATE} // 30 MB
},
GoProxyIO =
{
IS_DedicatedMirrorSite,
"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/",
{NotSkip, NA, NA, "https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"} // 30 MB
{NotSkip, NA, NA, "https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", ACCURATE} // 30 MB
};
def_target(pl_go, "go/golang/goproxy");
/**
* @update 2024-12-18
* @note
*/
static Source_t pl_go_sources[] =
void
pl_go_prelude ()
{
{&pl_go_upstream, "https://proxy.golang.org"},
{&GoProxyCN, "https://goproxy.cn"},
{&Ali, "https://mirrors.aliyun.com/goproxy/"},
{&Huawei, "https://mirrors.huaweicloud.com/goproxy/"},
{&GoProxyIO, "https://goproxy.io"}
};
def_sources_n(pl_go);
chef_prep_this (pl_go, gsr);
chef_set_created_on (this, "2023-08-30");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2025-07-12");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@czyt", "@techoc");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://proxy.golang.org", DelegateToUpstream},
{&GoProxyCN, "https://goproxy.cn", DelegateToMirror},
{&Ali, "https://mirrors.aliyun.com/goproxy/", DelegateToMirror},
// 暂时停用华为镜像源, 详见 https://github.com/RubyMetric/chsrc/issues/227
// {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", DelegateToMirror},
{&GoProxyIO, "https://goproxy.io", DelegateToMirror}
def_sources_end()
}
void
pl_go_check_cmd ()
{
char *check_cmd = xy_str_to_quietcmd ("go version");
char *check_cmd = xy_quiet_cmd ("go version");
bool exist = query_program_exist (check_cmd, "go", Noisy_When_Exist|Noisy_When_NonExist);
if (!exist)
@ -67,8 +73,6 @@ pl_go_getsrc (char *option)
/**
* chsrc set go
*
* @consult https://goproxy.cn/
*/
void
@ -76,47 +80,20 @@ pl_go_setsrc (char *option)
{
pl_go_check_cmd ();
chsrc_yield_source_and_confirm (pl_go);
chsrc_use_this_source (pl_go);
char *cmd = "go env -w GO111MODULE=on";
chsrc_run (cmd, RunOpt_Default);
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
cmd = xy_strcat (3, "go env -w GOPROXY=", source.url, ",direct");
chsrc_run (cmd, RunOpt_Default);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
/**
* chsrc reset go
*/
void
pl_go_resetsrc (char *option)
{
pl_go_setsrc (option);
}
/**
* chsrc ls go
*/
Feature_t
pl_go_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 = NULL;
return f;
}
def_target_gsrf(pl_go);

View File

@ -1,37 +1,50 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-10>
* Last Modified : <2024-08-15>
* ------------------------------------------------------------*/
/**
* @update 2023-09-10
*/
static Source_t pl_haskell_sources[] =
def_target(pl_haskell, "haskell/cabal/stack/hackage");
void
pl_haskell_prelude ()
{
{&UpstreamProvider, NULL},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/hackage"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/hackage"},
{&Nju, "https://mirror.nju.edu.cn/hackage"},
{&Ustc, "https://mirrors.ustc.edu.cn/hackage"}
};
def_sources_n(pl_haskell);
chef_prep_this (pl_haskell, s);
chef_set_created_on (this, "2023-09-10");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2025-08-22");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@hezonglun");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://hackage.haskell.org", DelegateToUpstream},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/hackage", DelegateToMirror},
{&Bfsu, "https://mirrors.bfsu.edu.cn/hackage", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/hackage", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/hackage", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/hackage", DelegateToMirror},
{&Nyist, "https://mirror.nyist.edu.cn/hackage", DelegateToMirror}
def_sources_end()
}
/**
* @consult https://help.mirrors.cernet.edu.cn/hackage/
*/
void
pl_haskell_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_haskell);
chsrc_use_this_source (pl_haskell);
char *file = xy_strjoin (3, "repository mirror\n"
" url: ", source.url,
"\n secure: True");
char *content = xy_str_gsub (RAWSTR_pl_haskell_cabal_config, "@url@", source.url);
char *config = NULL;
if (xy_on_windows)
if (xy.on_windows)
{
config = xy_normalize_path ("~/AppData/Roaming/cabal/config");
}
@ -40,31 +53,13 @@ pl_haskell_setsrc (char *option)
config = "~/.cabal/config";
}
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
puts (file); br();
chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
println (content);
config = xy_normalize_path ("~/.stack/config.yaml");
file = xy_strjoin (3, "package-indices:\n"
" - download-prefix: ", source.url,
"\n hackage-security:\n"
" keyids:\n"
" - 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d\n"
" - 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42\n"
" - 280b10153a522681163658cb49f632cde3f38d768b736ddbc901d99a1a772833\n"
" - 2a96b1889dc221c17296fcc2bb34b908ca9734376f0f361660200935916ef201\n"
" - 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3\n"
" - 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921\n"
" - 772e9f4c7db33d251d5c6e357199c819e569d130857dc225549b40845ff0890d\n"
" - aa315286e6ad281ad61182235533c41e806e5a787e0b6d1e7eef3f09d137d2e9\n"
" - fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0\n"
" key-threshold: 3\n"
" ignore-expiry: no");
content = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url);
chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
println (content);
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
p(file);
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}
def_target_s (pl_haskell);

View File

@ -1,109 +1,171 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* |
* Created On : <2023-08-31>
* Last Modified : <2024-12-18>
* ------------------------------------------------------------*/
static SourceProvider_t pl_java_upstream =
{
def_upstream, "https://mvnrepository.com/",
def_need_measure_info
};
def_target(pl_java, "java/maven/mvn/maven-daemon/mvnd/gradle");
/**
* @update 2024-12-18
*/
static Source_t pl_java_sources[] =
void
pl_java_prelude ()
{
{&pl_java_upstream, NULL},
{&Ali, "https://maven.aliyun.com/repository/public/"},
{&Huawei, "https://mirrors.huaweicloud.com/repository/maven/"},
{&Netease, "http://mirrors.163.com/maven/repository/maven-public/"} // 网易的24小时更新一次
};
def_sources_n(pl_java);
chef_prep_this (pl_java, gsr);
chef_set_created_on (this, "2023-08-31");
chef_set_last_updated (this, "2025-08-27");
chef_set_sources_last_updated (this, "2024-12-18");
chef_set_chef (this, NULL);
chef_set_cooks (this, 2, "@BingChunMoLi", "@ccmywish");
chef_set_sauciers (this, 0);
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_allow_user_define(this);
// 阿里巴巴开源镜像站需要修改为此才能测速
// https://github.com/RubyMetric/chsrc/issues/238#issuecomment-3162367686
chef_set_user_agent ("Maven/3.9.11");
def_sources_begin()
{&UpstreamProvider, "https://repo1.maven.org/maven2/", FeedByPrelude},
{&Ali, "https://maven.aliyun.com/repository/public/", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/repository/maven/", FeedByPrelude},
{&HuaweiCDN, "https://repo.huaweicloud.com/repository/maven/", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/nexus/repository/maven-public/",FeedByPrelude},
// 网易的24小时更新一次
{&Netease, "http://mirrors.163.com/maven/repository/maven-public/", FeedByPrelude}
def_sources_end()
// 220MB
chef_set_sources_speed_measure_url_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar");
}
void
pl_java_check_cmd (bool *maven_exist, bool *gradle_exist)
pl_java_check_cmd (bool *maven_exist, bool *gradle_exist, bool *maven_daemon_exist)
{
*maven_exist = chsrc_check_program ("mvn");
*gradle_exist = chsrc_check_program ("gradle");
*maven_daemon_exist = chsrc_check_program ("mvnd");
if (! *maven_exist && ! *gradle_exist)
if (! *maven_exist && ! *gradle_exist && ! *maven_daemon_exist)
{
chsrc_error ("maven 与 gradle 命令均未找到,请检查是否存在其一");
chsrc_error ("maven(maven-daemon) 与 gradle 命令均未找到,请检查是否存在其一");
exit (Exit_UserCause);
}
}
bool
pl_java_is_maven_home_line (const char *line)
{
if (xy_str_start_with (line, "Maven home:"))
return true;
else
return false;
}
/**
* @consult https://github.com/RubyMetric/chsrc/pull/268#issuecomment-3209071819
*/
char *
pl_java_find_maven_config ()
{
char *buf = xy_run ("mvn -v", 2);
char *maven_home = xy_str_delete_prefix (buf, "Maven home: ");
maven_home = xy_str_strip (maven_home);
char *output;
int status = xy_run_get_stdout ("mvn -v", &output);
if (0==status)
{
char *maven_home_line = xy_run_iter_lines ("mvn -v", 0, pl_java_is_maven_home_line);
char *maven_home = xy_str_delete_prefix (maven_home_line, "Maven home: ");
char *maven_config = xy_normalize_path (xy_2strcat (maven_home, "/conf/settings.xml"));
return maven_config;
}
char *maven_config = xy_normalize_path (xy_2strjoin (maven_home, "/conf/settings.xml"));
return maven_config;
chsrc_alert2 ("未找到 maven home, 将使用用户配置文件");
return "~/.m2/settings.xml";
}
char *
pl_java_find_maven_daemon_config ()
{
char *output;
int status = xy_run_get_stdout ("mvnd -v", &output);
if (0==status)
{
char *maven_home_line = xy_run_iter_lines ("mvnd -v", 0, pl_java_is_maven_home_line);
char *maven_home = xy_str_delete_prefix (maven_home_line, "Maven home: ");
char *maven_config = xy_normalize_path (xy_2strcat (maven_home, "/conf/settings.xml"));
return maven_config;
}
chsrc_alert2 ("未找到 maven home, 将使用用户配置文件");
return "~/.m2/settings.xml";
}
void
pl_java_getsrc (char *option)
{
bool maven_exist, gradle_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist);
char *maven_config = pl_java_find_maven_config ();
chsrc_note2 (xy_2strjoin ("请查看 ", maven_config));
bool maven_exist, gradle_exist, maven_daemon_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
if (maven_exist)
{
char *maven_config = pl_java_find_maven_config ();
chsrc_note2 (xy_2strcat ("请查看 ", maven_config));
}
if (maven_daemon_exist)
{
char *maven_config = pl_java_find_maven_daemon_config ();
chsrc_note2 (xy_2strcat ("请查看 ", maven_config));
}
}
/**
* @consult https://developer.aliyun.com/mirror/maven
*/
void
pl_java_setsrc (char *option)
{
bool maven_exist, gradle_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist);
chsrc_yield_source_and_confirm (pl_java);
bool maven_exist, gradle_exist, maven_daemon_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
chsrc_use_this_source(pl_java);
if (maven_exist)
{
const char *file = xy_strjoin (7,
"<mirror>\n"
" <id>", source.mirror->code, "</id>\n"
" <mirrorOf>*</mirrorOf>\n"
" <name>", source.mirror->name, "</name>\n"
" <url>", source.url, "</url>\n"
"</mirror>");
char *file = xy_str_gsub (RAWSTR_pl_java_maven_config, "@1@", source.mirror->code);
file = xy_str_gsub (file, "@name@", source.mirror->name);
file = xy_str_gsub (file, "@url@", source.url);
char *maven_config = pl_java_find_maven_config ();
chsrc_note2 (xy_strjoin (3, "请在您的 maven 配置文件 ", maven_config, " 中添加:"));
puts (file);
chsrc_note2 (xy_strcat (3, "请在 maven 配置文件 ", maven_config, " 中添加:"));
println (file);
}
if (maven_daemon_exist)
{
char *file = xy_str_gsub (RAWSTR_pl_java_maven_config, "@1@", source.mirror->code);
file = xy_str_gsub (file, "@name@", source.mirror->name);
file = xy_str_gsub (file, "@url@", source.url);
char *maven_daemon_config = pl_java_find_maven_daemon_config ();
chsrc_note2 (xy_strcat (3, "请在 maven daemon 配置文件 ", maven_daemon_config, " 中添加:"));
println (file);
}
if (gradle_exist)
{
if (maven_exist) br();
const char* file = xy_strjoin (3,
"allprojects {\n"
" repositories {\n"
" maven { url '", source.url, "' }\n"
" mavenLocal()\n"
" mavenCentral()\n"
" }\n"
"}");
chsrc_note2 ("请在您的 build.gradle 中添加:");
p(file);
char* file = xy_str_gsub (RAWSTR_pl_java_build_gradle, "@url@", source.url);
chsrc_note2 ("请在 build.gradle 中添加:");
println (file);
}
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}
def_target(pl_java);
void
pl_java_resetsrc (char *option)
{
pl_java_setsrc (option);
}

View File

@ -0,0 +1,77 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
def_target(pl_js_bun, "bun");
void
pl_js_bun_prelude (void)
{
chef_prep_this (pl_js_bun, gsr);
chef_set_created_on (this, "2024-09-29");
chef_set_last_updated (this, "2025-07-22");
chef_set_sources_last_updated (this, "2025-07-22");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@lontten");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_js_group_target);
}
/**
* chsrc get bun
*/
void
pl_js_bun_getsrc (char *option)
{
chsrc_view_file ("~/.bunfig.toml");
}
/**
* @consult https://bun.sh/docs/runtime/bunfig#global-vs-local
* @consult https://github.com/RubyMetric/chsrc/issues/83
* @consult https://github.com/RubyMetric/chsrc/pull/90
*
* chsrc set bun
*/
void
pl_js_bun_setsrc (char *option)
{
// 用的是 npm Registry 的源
Source_t source = chsrc_yield_source_and_confirm (&pl_js_group_target, option);
char *content = RAWSTR_pl_js_bun_config;
content = xy_str_gsub (content, "@url@", source.url);
if (chsrc_in_local_mode())
{
chsrc_note2 ("请手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
}
else
{
chsrc_note2 (xy_strcat (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
}
println (content);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
/**
* chsrc reset bun
*/
void
pl_js_bun_resetsrc (char *option)
{
pl_js_bun_setsrc (option);
}

View File

@ -0,0 +1,101 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mr. Will <mr.will.com@outlook.com>
* |
* Created On : <2023-08-30>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
void
pl_js_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
{
*npm_exist = chsrc_check_program ("npm");
*yarn_exist = chsrc_check_program ("yarn");
*pnpm_exist = chsrc_check_program ("pnpm");
if (!*npm_exist && !*yarn_exist && !*pnpm_exist)
{
char *msg = ENGLISH ? "No npm, yarn or pnpm command found, check if at least one is present"
: "未找到 npm 或 yarn 或 pnpm 命令,请检查是否存在其一";
chsrc_error (msg);
exit (Exit_UserCause);
}
}
void
pl_js_group_getsrc (char *option)
{
bool npm_exist, yarn_exist, pnpm_exist;
pl_js_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
hr();
if (npm_exist)
{
pl_js_npm_getsrc (option);
br();
}
if (yarn_exist)
{
pl_js_yarn_getsrc (option);
br();
}
if (pnpm_exist)
{
pl_js_pnpm_getsrc (option);
br();
}
}
void
pl_js_group_setsrc (char *option)
{
{
char *msg = ENGLISH ? "Three package managers will be replaced for you at the same time: "
"npm, pnpm, yarn. If you need to change the source independently, "
"please run independently `chsrc set <pkg-manager>`"
: "将同时更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>";
chsrc_alert2 (msg);
}
bool npm_exist, yarn_exist, pnpm_exist;
pl_js_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
chsrc_set_target_group_mode ();
chsrc_use_this_source (pl_js_group);
if (npm_exist)
{
pl_js_npm_setsrc (option);
br();
}
if (yarn_exist)
{
pl_js_yarn_setsrc (option);
br();
}
if (pnpm_exist)
{
pl_js_pnpm_setsrc (option);
}
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
void
pl_js_group_resetsrc (char *option)
{
pl_js_group_setsrc (option);
}

View File

@ -0,0 +1,98 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
def_target(pl_js_yarn, "yarn");
void
pl_js_yarn_prelude (void)
{
chef_prep_this (pl_js_yarn, gsr);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@MrWillCom");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_js_group_target);
}
static double
pl_js_yarn_get_yarn_version ()
{
char *ver = xy_run ("yarn --version", 0);
double version = atof (ver);
return version;
}
void
pl_js_yarn_getsrc (char *option)
{
// 最后一个版本应该是 v1.22.22
if (pl_js_yarn_get_yarn_version () >= 2)
// https://github.com/RubyMetric/chsrc/issues/53
// 从 Yarn V2 开始,使用新的配置名
chsrc_run ("yarn config get npmRegistryServer", RunOpt_No_Last_New_Line);
else
chsrc_run ("yarn config get registry", RunOpt_No_Last_New_Line);
}
/**
* @consult https://github.com/RubyMetric/chsrc/issues/53
* @consult https://yarnpkg.com/cli/config/set
*/
void
pl_js_yarn_setsrc (char *option)
{
Source_t source = chsrc_yield_source (&pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source(&source);
char *cmd = NULL;
// 从 Yarn V2 开始,使用新的配置名
if (pl_js_yarn_get_yarn_version () >= 2)
{
if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源
cmd = xy_2strcat ("yarn config set npmRegistryServer ", source.url);
else
cmd = xy_2strcat ("yarn config set npmRegistryServer --home ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line);
}
else
{
if (chsrc_in_local_mode())
{
char *msg = ENGLISH ? "Yarn v1 doesn't support `-local`. SKIP changing source!" : "Yarn v1 不支持 -local跳过换源";
chsrc_error (msg);
// 不能直接退出,因为 Leader target 不能就此结束
return;
}
// 不再阻止换源命令输出到终端,即不再调用 xy_quiet_cmd()
cmd = xy_2strcat ("yarn config set registry ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line);
}
if (chsrc_in_standalone_mode())
{
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}
void
pl_js_yarn_resetsrc (char *option)
{
pl_js_yarn_setsrc (option);
}

View File

@ -0,0 +1,77 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
static MirrorSite_t NpmMirror =
{
IS_DedicatedMirrorSite,
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
{SKIP, NULL, NULL, NULL, ACCURATE}
};
def_target(pl_js_group, "js/javascript/node/nodejs");
void
pl_js_group_prelude (void)
{
chef_prep_this (pl_js_group, gsr);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, "@happy-game");
// 组换源的 leader target 应把所有 follower target 的贡献者都记录过来
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@lontten", "@MrWillCom");
chef_allow_local_mode (this, PartiallyCan,
"支持 npm, yarn v2, pnpm, 不支持 yarn v1",
"Support npm, yarn v2, pnpm, not yarn v1");
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://registry.npmjs.org/", FeedByPrelude}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/", FeedByPrelude}
def_sources_end()
// 29MB 大小
chef_set_sources_speed_measure_url_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
}
def_target(pl_js_nodejs_binary, "__internal_target_nodejs_binary__");
void
pl_js_nodejs_binary_prelude (void)
{
chef_prep_this (pl_js_nodejs_binary, NOOP);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-08-22");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 0);
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://nodejs.org/dist/", FeedByPrelude},
{&NpmMirror, "https://npmmirror.com/mirrors", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/node/",FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude}
def_sources_end()
chef_set_sources_speed_measure_url_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
}

View File

@ -0,0 +1,66 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
def_target(pl_js_npm, "npm");
void
pl_js_npm_prelude (void)
{
chef_prep_this (pl_js_npm, gsr);
chef_set_created_on (this, "2023-08-30");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@MrWillCom");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_js_group_target);
}
void
pl_js_npm_getsrc (char *option)
{
chsrc_run ("npm config get registry", RunOpt_No_Last_New_Line);
}
/**
* @consult https://npmmirror.com/
*/
void
pl_js_npm_setsrc (char *option)
{
Source_t source = chsrc_yield_source (&pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source(&source);
char *cmd = NULL;
if (chsrc_in_local_mode())
cmd = xy_2strcat ("npm config --location project set registry ", source.url);
else
cmd = xy_2strcat ("npm config set registry ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line);
if (chsrc_in_standalone_mode())
{
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}
void
pl_js_npm_resetsrc (char *option)
{
pl_js_npm_setsrc (option);
}

View File

@ -0,0 +1,70 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
def_target(pl_js_nvm, "nvm");
void
pl_js_nvm_prelude (void)
{
chef_prep_this (pl_js_nvm, gsr);
chef_set_created_on (this, "2024-09-23");
chef_set_last_updated (this, "2025-06-19");
chef_set_sources_last_updated (this, "2025-06-19");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 0);
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_set_note (this, "nvm 不支持 Fish shell", "nvm does not support Fish");
chef_use_other_target_sources (this, &pl_js_nodejs_binary_target);
}
void
pl_js_nvm_getsrc (char *option)
{
chsrc_view_env ("NVM_NODEJS_ORG_MIRROR", NULL);
}
/**
* @consult https://github.com/nvm-sh/nvm?tab=readme-ov-file#use-a-mirror-of-node-binaries
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/nodejs-release/
* @issue https://github.com/RubyMetric/chsrc/issues/81
*
* @note nvm Fish
*/
void
pl_js_nvm_setsrc (char *option)
{
Source_t source = chsrc_yield_source_and_confirm (&pl_js_nodejs_binary_target, option);
char *w = xy_strcat (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n");
char *zshrc = xy_zshrc;
char *bashrc = xy_bashrc;
chsrc_append_to_file (w, bashrc);
if (xy_file_exist (zshrc))
chsrc_append_to_file (w, zshrc);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
void
pl_js_nvm_resetsrc (char *option)
{
// pl_js_nvm_setsrc (ChgType_Reset);
chsrc_error ("暂不支持对 nvm 重置");
exit (Exit_Unsupported);
}

View File

@ -0,0 +1,67 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/
def_target(pl_js_pnpm, "pnpm");
void
pl_js_pnpm_prelude (void)
{
chef_prep_this (pl_js_pnpm, gsr);
chef_set_created_on (this, "2024-04-18");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 0);
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_js_group_target);
}
void
pl_js_pnpm_getsrc (char *option)
{
chsrc_run ("pnpm config get registry", RunOpt_No_Last_New_Line);
}
/**
* @consult https://pnpm.io/feature-comparison
* @consult https://pnpm.io/cli/config
*/
void
pl_js_pnpm_setsrc (char *option)
{
Source_t source = chsrc_yield_source (&pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source(&source);
char *cmd = NULL;
if (chsrc_in_local_mode())
cmd = xy_2strcat ("pnpm config --location project set registry ", source.url);
else
cmd = xy_2strcat ("pnpm config -g set registry ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line);
if (chsrc_in_standalone_mode())
{
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}
void
pl_js_pnpm_resetsrc (char *option)
{
pl_js_pnpm_setsrc (option);
}

Some files were not shown because too many files have changed in this diff Show More