Compare commits

...

377 Commits
v0.2.2 ... 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
156 changed files with 6365 additions and 5051 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 # http://editorconfig.org
# --------------------------------------------------------------
root = true root = true
[*] [*]
@ -6,18 +19,31 @@ indent_style = space
indent_size = 2 indent_size = 2
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true 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}] [*.{c,C,cpp,cxx,cc,h,hpp}]
indent_style = space indent_style = space
indent_size = 2 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}] [Makefile,makefile,*.{mk,make,makefile}]
indent_style = tab indent_style = tab
[*.md]
trim_trailing_whitespace = true
# 使用 VS Code 生成文件的默认格式 # 使用 VS Code 生成文件的默认格式
[*.json] [*.json]
indent_size = 4 indent_size = 4

View File

@ -45,7 +45,7 @@ body:
attributes: attributes:
label: chsrc 版本 label: chsrc 版本
# description: 你正在使用 chsrc 哪个版本? # description: 你正在使用 chsrc 哪个版本?
placeholder: 请使用 chsrc -h 查看*带有发布日期*的精确版本 (chsrc -v 并不含有日期信息) placeholder: 请使用 chsrc -h 或 chsrc -v 查看,并*复制发布日期*
validations: validations:
required: true required: true

4
.github/READIT.md vendored
View File

@ -3,8 +3,8 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : (Overview .github) READIT.md ! Doc Name : (Overview .github) READIT.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Nul None <nul@none.org>
! | ! |
! Created On : <2025-06-20> ! Created On : <2025-06-20>
! Last Modified : <2025-06-20> ! Last Modified : <2025-06-20>

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: 一定要保持注释,因为它记录了重要的维护信息

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : PR-notify.yml # Workflow File : PR-notify.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2025-06-19> # Created On : <2025-06-19>
# Last Modified : <2025-06-28> # Last Modified : <2025-08-07>
# #
# Notify PR # Notify PR
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -40,15 +40,23 @@ jobs:
welcome: welcome:
name: 欢迎PR者 name: 欢迎PR者
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'dev' # 仅在 opened 时欢迎,其他情况都不再重复欢迎了
if: github.event.pull_request.base.ref == 'dev' && github.event.action == 'opened'
steps: steps:
- name: 评论 - name: 查看 GitHub Actions 环境
uses: peter-evans/create-or-update-comment@v4 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: with:
issue-number: ${{ github.event.pull_request.number }} issue-number: ${{ github.event.pull_request.number }}
body: | body: |
Hi @${{github.event.pull_request.user.login}}, Hi @${{github.event.pull_request.user.login}}
❤️ 感谢你的贡献我们将在5天内阅读此 PR 并回复你 ❤️ 感谢你的贡献!我们将在最少半小时,最多5天内阅读此 PR 并回复你
edit-mode: replace edit-mode: replace
reactions: heart

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : PR-test.yml # Workflow File : PR-test.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Mikachu2333 <mikachu2333@zohomail.com>
# | # |
# Created On : <2025-06-19> # Created On : <2025-06-19>
# Last Modified : <2025-06-19> # Last Modified : <2025-08-17>
# #
# Test PR # Test PR
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -13,11 +13,15 @@ name: 测试PR
on: on:
pull_request: pull_request:
types: [opened, # 仅在开 pr、草稿转正式、手动要求 review、reopen的时候运行测试
synchronize, # 后续提交 types: [
ready_for_review, # draft PR 转为正式 PR opened,
review_requested, # 因 synchronize 将导致 pr 的构建过于频繁而禁用
reopened] # synchronize, # 在 pr 者 push commit 时每次构建
ready_for_review, # draft PR 转为正式 PR
review_requested,
reopened,
]
paths: paths:
- "src/**" - "src/**"
- "lib/**" - "lib/**"
@ -30,7 +34,7 @@ jobs:
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: 测试构建情况 - name: 测试构建情况
run: | run: |
@ -42,12 +46,18 @@ jobs:
test-on-windows: test-on-windows:
name: 在Windows上测试 name: 在Windows上测试
runs-on: ubuntu-latest runs-on: windows-latest
if: github.event.pull_request.base.ref == 'dev' if: github.event.pull_request.base.ref == 'dev'
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 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: 安装依赖 - name: 安装依赖
run: | run: |

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-Linux-AArch64.yml # Workflow File : build-on-Linux-AArch64.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-14> # Created On : <2023-09-14>
# Last Modified : <2025-06-20> # Last Modified : <2025-09-12>
# #
# Build chsrc on Linux (AArch64) and upload it to GitHub: the 'pre' release # Build chsrc on Linux (AArch64) and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -45,4 +45,3 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
./artifacts/chsrc-aarch64-linux ./artifacts/chsrc-aarch64-linux
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-Linux-ARMv7.yml # Workflow File : build-on-Linux-ARMv7.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-14> # Created On : <2023-09-14>
# Last Modified : <2025-06-20> # Last Modified : <2025-09-12>
# #
# Build chsrc on Linux (ARMv7) and upload it to GitHub: the 'pre' release # Build chsrc on Linux (ARMv7) and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -45,5 +45,3 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
./artifacts/chsrc-armv7-linux ./artifacts/chsrc-armv7-linux
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-Linux-riscv64.yml # Workflow File : build-on-Linux-riscv64.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-14> # Created On : <2023-09-14>
# Last Modified : <2025-06-20> # Last Modified : <2025-09-12>
# #
# Build chsrc on Linux (riscv64) and upload it to GitHub: the 'pre' release # Build chsrc on Linux (riscv64) and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -45,4 +45,3 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
./artifacts/chsrc-riscv64-linux ./artifacts/chsrc-riscv64-linux
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-Linux-x64.yml # Workflow File : build-on-Linux-x64.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-14> # Created On : <2023-09-14>
# Last Modified : <2025-06-20> # Last Modified : <2025-09-12>
# #
# Build chsrc on Linux (x64) and upload it to GitHub: the 'pre' release # Build chsrc on Linux (x64) and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -20,7 +20,7 @@ jobs:
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: 构建 - name: 构建
run: | run: |
@ -37,4 +37,3 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
chsrc-x64-linux chsrc-x64-linux
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-Windows.yml # Workflow File : build-on-Windows.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-14> # Created On : <2023-09-14>
# Last Modified : <2025-07-22> # Last Modified : <2025-09-12>
# #
# Build chsrc on Windows and upload it to GitHub: the 'pre' release # Build chsrc on Windows and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -24,7 +24,7 @@ jobs:
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: 安装 GCC - name: 安装 GCC
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
@ -78,4 +78,3 @@ jobs:
chsrc-x64-windows.exe chsrc-x64-windows.exe
chsrc-x86-windows.exe chsrc-x86-windows.exe
chsrc-arm64-android chsrc-arm64-android
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : build-on-macOS.yml # Workflow File : build-on-macOS.yml
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Nul None <nul@none.org>
# | # |
# Created On : <2023-09-15> # Created On : <2023-09-15>
# Last Modified : <2025-07-22> # Last Modified : <2025-12-18>
# #
# Build chsrc on macOS and upload it to GitHub: the 'pre' release # Build chsrc on macOS and upload it to GitHub: the 'pre' release
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -20,7 +20,7 @@ jobs:
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: 检查编译器版本 - name: 检查编译器版本
run: | run: |
@ -45,15 +45,16 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
chsrc-aarch64-macos chsrc-aarch64-macos
token: ${{ secrets.UPLOAD_TO_GITHUB }}
on-x64: on-x64:
runs-on: macos-13 # macos-14 is AArch64(ARMv8-A) # macos-13 是 x64macos-14 是 AArch64(ARMv8-A)
# 但是 macos-13 已经于 2025-12-04 下线
runs-on: macos-15-intel
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: 检查编译器版本 - name: 检查编译器版本
run: | run: |
@ -78,4 +79,3 @@ jobs:
tag_name: pre tag_name: pre
files: | files: |
chsrc-x64-macos chsrc-x64-macos
token: ${{ secrets.UPLOAD_TO_GITHUB }}

View File

@ -1,10 +1,10 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Workflow File : pkg-deb.yml # Workflow File : pkg-deb.yml
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Aoran Zeng <ccmywish@qq.com> # Contributors : 曾奥然 <ccmywish@qq.com>
# | # |
# Created On : <2025-06-10> # Created On : <2025-06-10>
# Last Modified : <2025-06-16> # Last Modified : <2025-10-29>
# #
# Build and publish deb packages # Build and publish deb packages
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -30,7 +30,7 @@ jobs:
steps: steps:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
ref: gh-build ref: gh-build
@ -44,7 +44,7 @@ jobs:
elif [ "${{ github.event_name }}" = "push" ];then elif [ "${{ github.event_name }}" = "push" ];then
# 从源代码中提取版本号 # 从源代码中提取版本号
version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/chsrc-main.c) version=$(sed -E -n 's/^#define Chsrc_Version +"([0-9]+\.[0-9]+\.[0-9]+).*"/\1/p' ./src/framework/version.h)
else else
version="${{ github.event.inputs.version }}" version="${{ github.event.inputs.version }}"
@ -73,7 +73,7 @@ jobs:
* Release version $version * Release version $version
-- Aoran Zeng <ccmywish@qq.com> $(date -R) -- 曾奥然 <ccmywish@qq.com> $(date -R)
EOF EOF
@ -121,7 +121,7 @@ jobs:
bash pkg/deb/deb-installation-test.sh bash pkg/deb/deb-installation-test.sh
- name: 上传deb包到artifacts - name: 上传deb包到artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: chsrc-deb-files name: chsrc-deb-files
path: dist/chsrc_*.deb path: dist/chsrc_*.deb
@ -133,7 +133,6 @@ jobs:
with: with:
# 用 * 省略版本号,以及指代各种架构 # 用 * 省略版本号,以及指代各种架构
files: dist/chsrc_*.deb files: dist/chsrc_*.deb
token: ${{ secrets.UPLOAD_TO_GITHUB }}
- name: 上传附件到GitHub Releases(the 'pre' release) - name: 上传附件到GitHub Releases(the 'pre' release)
if: github.event_name == 'push' if: github.event_name == 'push'
@ -142,7 +141,6 @@ jobs:
tag_name: pre tag_name: pre
# 用 * 指代各种架构 # 用 * 指代各种架构
files: dist-for-pre/chsrc_latest-1_*.deb files: dist-for-pre/chsrc_latest-1_*.deb
token: ${{ secrets.UPLOAD_TO_GITHUB }}
@ -156,7 +154,7 @@ jobs:
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v7
with: with:
pattern: chsrc-deb-files pattern: chsrc-deb-files
merge-multiple: true merge-multiple: true
@ -174,7 +172,7 @@ jobs:
dpkg-scanpackages . /dev/null > Packages dpkg-scanpackages . /dev/null > Packages
- name: Upload repository metadata - name: Upload repository metadata
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: debian-repository-metadata name: debian-repository-metadata
path: debs/Packages* path: debs/Packages*

5
.gitignore vendored
View File

@ -22,7 +22,7 @@
*.dll *.dll
*.out *.out
*.exe *.exe
*.res
############################## ##############################
@ -41,6 +41,9 @@ chsrc-ci-release
xy xy
fw fw
README.md.bak* README.md.bak*
*.tmp
chsrc_tmp_test.txt
chsrc_tmp_test.txt.bak
# Generated when testing (when there's a bug) # Generated when testing (when there's a bug)
nul nul

4
.vscode/README.md vendored
View File

@ -3,8 +3,8 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : (for VS Code users) README.md ! Doc Name : (for VS Code users) README.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Nul None <nul@none.org>
! | ! |
! Created On : <2025-06-18> ! Created On : <2025-06-18>
! Last Modified : <2025-06-20> ! Last Modified : <2025-06-20>

11
.vscode/launch.json vendored
View File

@ -8,13 +8,15 @@
"program": "${workspaceFolder}/chsrc-debug", "program": "${workspaceFolder}/chsrc-debug",
"args": [ "args": [
"get", "get",
"python" "nodejs"
], ],
"preLaunchTask": "构建 debug 版 chsrc", "preLaunchTask": "构建 debug 版 chsrc",
"stopAtEntry": true, "stopAtEntry": true,
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"environment": [], "environment": [],
"externalConsole": false, // 使false
"externalConsole": true,
// lldb
"MIMode": "gdb", "MIMode": "gdb",
// "miDebuggerPath": "/path/to/gdb", // "miDebuggerPath": "/path/to/gdb",
"setupCommands": [ "setupCommands": [
@ -28,7 +30,8 @@
"text": "-gdb-set disassembly-flavor intel", "text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true "ignoreFailures": true
} }
] ],
"postDebugTask": "停止 debug 程序"
}, },
{ {
@ -58,4 +61,4 @@
] ]
} }
] ]
} }

23
.vscode/settings.json vendored
View File

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

78
.vscode/tasks.json vendored
View File

@ -17,7 +17,8 @@
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
}, },
"detail": "使用 just build 编译" "dependsOn": "停止程序",
"detail": "先停止原有程序,然后使用 just build 编译"
}, },
{ {
"type": "shell", "type": "shell",
@ -36,7 +37,6 @@
"kind": "build", "kind": "build",
"isDefault": false "isDefault": false
}, },
"detail": "使用 just build-in-debug-mode 编译 debug 版"
}, },
{ {
"type": "shell", "type": "shell",
@ -94,7 +94,79 @@
"isDefault": false "isDefault": false
}, },
"detail": "使用 just test-xy 测试 xy.h" "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" "version": "2.0.0"
} }

View File

@ -2,15 +2,15 @@
# -------------------------------------------------------------- # --------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# -------------------------------------------------------------- # --------------------------------------------------------------
# Build File : Makefile # Build File : Makefile
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Yangmoooo <yangmoooo@outlook.com> # Contributors : Yangmoooo <yangmoooo@outlook.com>
# | sanchuanhehe <wyihe5520@gmail.com> # | sanchuanhehe <wyihe5520@gmail.com>
# | # |
# Created On : <2023-08-28> # Created On : <2023-08-28>
# Last Modified : <2025-07-22> # Last Modified : <2025-10-15>
# #
# 请阅读 ./doc/01-Develop.md 来使用 # 请阅读 ./doc/01-开发与构建.md 来使用
# -------------------------------------------------------------- # --------------------------------------------------------------
#=========== OS Check ================ #=========== OS Check ================
@ -26,10 +26,12 @@ ifeq ($(shell uname), Darwin)
On-macOS = 1 On-macOS = 1
endif endif
# 只有Windows会定义$(OS)变量 # 只有 MSYS2 会定义 $(OS) 变量
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
On-Windows = 1 On-Windows = 1
endif endif
# 注意, 原生 Windows 会定义 $(ComSpec) 变量,且区分大小写
# 但是 MSYS2 并不会定义
#===================================== #=====================================
@ -196,6 +198,7 @@ test-cli: $(DevMode-Target-Name)
clean: clean:
-@rm *.exe 2>/dev/null -@rm *.exe 2>/dev/null
-@rm *.res 2>/dev/null
-@rm xy 2>/dev/null -@rm xy 2>/dev/null
-@rm fw 2>/dev/null -@rm fw 2>/dev/null
-@rm README.md.bak* 2>/dev/null -@rm README.md.bak* 2>/dev/null

View File

@ -3,11 +3,12 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : README.md ! Doc Name : README.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com> ! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
! | BingChunMoLi <bingchunmoli@bingchunmoli.com>
! | ! |
! Created On : <2023-12-28> ! Created On : <2023-12-28>
! Last Modified : <2025-07-22> ! Last Modified : <2025-08-22>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
<div align="center"> <div align="center">
@ -16,7 +17,7 @@
全平台通用换源工具与框架 `chsrc`**目标支持 Linux, Windows (native, MSYS2, Cygwin), macOS, BSD, Android 等尽可能多的操作系统环境龙芯、飞腾、RISC-V 等尽可能多的 CPU**。 全平台通用换源工具与框架 `chsrc`**目标支持 Linux, Windows (native, MSYS2, Cygwin), macOS, BSD, Android 等尽可能多的操作系统环境龙芯、飞腾、RISC-V 等尽可能多的 CPU**。
我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JS 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。 我们使用 **C11** 来完成上述目标。我们并不使用 Python 或 JavaScript 等解释语言,因为一个简单的换源工具,不应该强行塞给用户一个庞大的解释器和数十、数百 MB 其他文件。
本软件为**自由软件**SDPX 软件许可证为 `GPL-3.0-or-later and MIT` 本软件为**自由软件**SDPX 软件许可证为 `GPL-3.0-or-later and MIT`
@ -39,22 +40,35 @@
## ❤️ 致所有的朋友们
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] > [!TIP]
> **`chsrc` 不仅是一个命令行工具,同时也是一个体现了 Ruby on Rails 思想的 MVC 换源框架它甚至使你能够在不了解C语言的情况下编写出新的换源方法 (recipe)。** 配合使用 [rawstr4c], 这将比写 shell 脚本更加轻松。 [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] > [!NOTE]
> 这是你可以参与的第一个现实世界中有用的C语言项目[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-Develop.md) > 这也许是你可以参与的第一个现实世界中有用的C语言项目[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-开发与构建.md)
> >
> 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR我们覆盖全流程文档](./doc/) > 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR我们覆盖全流程文档](./doc/)
,作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50)
--- ---
> [!IMPORTANT] > [!IMPORTANT]
> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130) > **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/275)
<br> <br>
@ -461,7 +475,7 @@ chsrc set rust | cargo | crate
chsrc set rustup chsrc set rustup
chsrc set go chsrc set go
chsrc set java | maven | mvn | gradle chsrc set java | maven | mvn | maven-daemon | mvnd | gradle
chsrc set clojure | clojars chsrc set clojure | clojars
chsrc set dart | pub chsrc set dart | pub
chsrc set flutter chsrc set flutter

View File

@ -3,8 +3,8 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : (chsrc-bootstrap Introduction.md) ! Doc Name : (chsrc-bootstrap Introduction.md)
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Nul None <nul@none.org>
! | ! |
! Created On : <2025-07-12> ! Created On : <2025-07-12>
! Last Modified : <2025-07-22> ! Last Modified : <2025-07-22>

View File

@ -2,12 +2,12 @@
! SPDX-License-Identifier: GFDL-1.3-or-later ! SPDX-License-Identifier: GFDL-1.3-or-later
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : 01-Develop.md ! Doc Name : 01-开发与构建.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
! | ! |
! Created On : <2024-12-27> ! Created On : <2024-12-27>
! Last Modified : <2025-07-21> ! Last Modified : <2025-10-11>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# 开发 chsrc # 开发 chsrc
@ -53,7 +53,7 @@ git clone https://gitee.com/RubyMetric/chsrc.git -b dev
3. **`RELEASE mode`** 3. **`RELEASE mode`**
4. **`CI-RELEASE mode`** 4. **`CI-RELEASE mode`**
第四种只在 GitHub Actions 使用,一般只需要前三者;而在开发时你仅需要前两者;如果不需要 Debug仅仅第一个 **DEV mode** 就够了 开发时只需要前两种模式;第四种模式只在 GitHub Actions 使用。
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建** **如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建**

View File

@ -2,12 +2,12 @@
! SPDX-License-Identifier: GFDL-1.3-or-later ! SPDX-License-Identifier: GFDL-1.3-or-later
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : 03-CONTRIBUTING.md ! Doc Name : 02-提交与贡献.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Nul None <nul@none.org>
! | ! |
! Created On : <2024-12-13> ! Created On : <2024-12-13>
! Last Modified : <2025-07-21> ! Last Modified : <2025-08-22>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# 贡献说明 # 贡献说明
@ -22,6 +22,8 @@
## 提交与审阅 ## 提交与审阅
当你提交 PR 的时候,一定要将 PR 指定 chsrc 原仓库的 dev 分支。
### 一个简单的 Bug ### 一个简单的 Bug
一个简单的 Bug fix有写权限的维护者可以直接推送到主仓库的 `dev` 分支 一个简单的 Bug fix有写权限的维护者可以直接推送到主仓库的 `dev` 分支
@ -34,15 +36,14 @@
1 1
1. **如果你是 recipe Chef则你完全负责这个 recipe如果你拥有写权限你可以直接推送代码到 `dev` 分支** **如果你是 recipe Chef则你完全负责这个 recipe如果你拥有写权限你可以直接推送代码到 `dev` 分支**
2. 如果你是 recipe Sous Chef则你需要参考 [04-MAINTAINERS.md](./04-MAINTAINERS.md),如果只有你一个人,且你拥有写权限,你可以直接推送代码。如果有多人,则需要提一个 issue介绍方案然后 @ 所有 Sous Chef 来 review
--- ---
2 2
1. 需要先搜索你修改的部分涉及到的 recipe然后提 issue @ 所有相关的 recipe Sous Chef 来 review 1. 需要先搜索你修改的部分涉及到的 recipe然后提 issue @ 所有相关的 recipe Chef 来 review
2. 如果涉及了所有 recipe则 @ framework Sous Chef而无需把所有 recipe 的 Sous Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review 2. 如果涉及了所有 recipe则 @ framework Chef而无需把所有 recipe 的 Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
<br> <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,331 +0,0 @@
# 协作者与维护者
作为该语言的资深用户、该软件的专家、镜像站维护人员等,你总是对镜像站和源的可用状态拥有一手信息,我们需要你的帮助。如果想要达到最理想的维护状态,每一个 recipe 都需要有专人长时间维护。所以我们在这个文件记录的是愿意**长期**维护的人,如果是一次性提交代码,只需要在对应 recipe 的文件标头中记录即可。
**我们的代码里使用了 recipe (某个菜的烹饪方法) 这个词,因而整个项目便和 "饮食" 有关,比如 `menu`: 汇集了所有的 target 的菜单。因此,我们的维护者身份依然使用了这个惯例:**
一个 recipe 的协作者可分为:
1. **Chef**
主厨: 对一个 recipe 完全负责,有写权限时可以直接推代码
**目前项目的发展阶段还处于 *外行实现内行* 的情况,比如 Homebrew recipe实现者根本不是 Homebrew 的真实用户,只是根据各种文档来实现,然后等待用户反馈。所以这里当前的实现者最多只能是 Sous Chef无法承担 Chef 的责任**
2. **Sous Chef**
副主厨:实现和持续维护 recipe需要和 Chef 一起 review 代码。可参考 [03-CONTRIBUTING.md](./03-CONTRIBUTING.md) 了解项目是如何进行提交和审阅代码的
3. **Taster**
试吃员:对该 target 和 recipe 持续反馈和关注的用户。如果你觉得你无法承担作为维护者的责任,可以退而求其次作为观察者积极参与其中
<br>
**项目采用申请制,请提交 PULL REQUEST 在该文件中添加自己,并在 [issue #130](https://github.com/RubyMetric/chsrc/issues/130) 留言。考虑到真正参与维护的人并不多,所以上述人数均不设限。**
`@`后面跟的是GitHub账户名`@ccmywish`。若使用Gitee账号则使用 `@gitee:ccmywish`。对我们来说,镜像站成员非常重要,所以请额外标注身份,如 `@username [TUNA]`
<br>
## Framework
1. **Chef**: `@ccmywish` `@gitee:G_I_Y`
2. **Sous Chef**:
3. **Taster**:
<br>
## 编程语言
### Ruby
1. **Chef**: `@ccmywish`
2. **Sous Chef**:
3. **Taster**:
### Python
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@happy-game`
3. **Taster**:
### NodeJS
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@happy-game`
3. **Taster**:
### Perl
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### PHP
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Go
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Rust
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Java
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Clojure
1. **Chef**:
2. **Sous Chef**:
3. **Taster**:
### NuGet
1. **Chef**:
2. **Sous Chef**:
3. **Taster**:
### Dart
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Haskell
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### OCaml
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### R
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**: `@gitee:tfcolin`
### Julia
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
<br>
## 操作系统
### Ubuntu
1. **Chef**: `@ccmywish`
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**: `@wickdynex`
### Debian
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@gitee:G_I_Y`
3. **Taster**: `@happy-game`
### Fedora
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@gitee:G_I_Y` `@happy-game`
3. **Taster**:
### Kali
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**:
### Linux Mint
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@gitee:G_I_Y`
3. **Taster**:
### Armbian
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Raspberry Pi OS
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### ROS
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**:
### Trisquel
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Arch
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@gitee:G_I_Y` `@happy-game`
3. **Taster**:
### Manjaro
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**:
### msys2
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**:
### Alpine
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### OpenWrt
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**: `@happy-game`
### Gentoo
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**:
### Void Linux
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### deepin
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**:
### OpenKylin
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**:
### OpenEuler
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y`
3. **Taster**:
### FreeBSD
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**: `@ykla`
### NetBSD
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**:
### OpenBSD
1. **Chef**:
2. **Sous Chef**: `@gitee:G_I_Y` `@ccmywish`
3. **Taster**:
<br>
## 软件
### Homebrew
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**: `@wickdynex`
### WinGet
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Flathub
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Nix
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Guix
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### CocoaPods
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Docker Hub
1. **Chef**:
2. **Sous Chef**: `@ccmywish` `@happy-game`
3. **Taster**:
### Anaconda
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**: `@happy-game`
### Emacs
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
### Tex Live
1. **Chef**:
2. **Sous Chef**: `@ccmywish`
3. **Taster**:
<br>

View File

@ -2,12 +2,12 @@
! SPDX-License-Identifier: GFDL-1.3-or-later ! SPDX-License-Identifier: GFDL-1.3-or-later
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : 02-Write-A-Recipe-Even-If-You-Dont-Know-C.md ! Doc Name : 10-如何编写recipe.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nul None <nul@none.org> ! Contributors : Nul None <nul@none.org>
! | ! |
! Created On : <2024-08-19> ! Created On : <2024-08-19>
! Last Modified : <2025-07-21> ! Last Modified : <2025-10-28>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# Write A Recipe Even If You Don't Know C # Write A Recipe Even If You Don't Know C
@ -18,7 +18,7 @@
<br> <br>
我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/130))。 我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/275))。
- 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件 - 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件
- 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳) - 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳)
@ -52,7 +52,10 @@
- `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source` - `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source`
- `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录 - `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录
- `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等 - `chef DSL`:是 `chef Domain Specific Language` 的简写,这是一组以 `chef_` 开头的函数,用来定义维护者信息、可用源等元信息
- **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL
- **测速链接**: 用来测速的URL与 "换源链接" 不同,可分为 **精准测速** 和 **模糊测速**
- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一 - **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
@ -76,17 +79,24 @@
5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站 5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站
6. 可以使用这些函数: 6. 使用 chef DSL 定义 `_prelude()` 函数
该函数将填充 target 所有的必要信息,包括维护信息、换源信息
7. [设置/修改 "换源链接" 和 "测速链接" (how?)](./11-如何设置换源链接与测速链接.md)
8. 按需实现 `_setsrc()` `_getsrc()` `_resetsrc()` 可以使用这些函数:
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏 1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
2. `xy.h` 中以 `xy_` 开头的所有函数或宏 2. `xy.h` 中以 `xy_` 开头的所有函数或宏
3. `chec.h` 中以 `chef_` 开头的所有函数或宏 3. `chec.c` 中以 `chef_` 开头的所有函数或宏
4. `helper.c` 中以 `hp_` 开头的所有函数或宏
一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀 一个简单的方法是,在 VS Code 中按快捷键 `Ctrl-T` 搜索上述三种前缀
7. 在 `recipe/menu.c` 中添加用户可以使用的 `target` 别名 9. 在 `recipe/menu.c` 中登记此 target
8. [编译、运行、测试 (how?)](./01-Develop.md),若无问题可提交 Pull Request 10. [编译、运行、测试 (how?)](./01-开发与构建.md),若无问题可提交 Pull Request
<br> <br>

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

View File

@ -2,14 +2,14 @@
.\" SPDX-License-Identifier: GFDL-1.3-or-later .\" SPDX-License-Identifier: GFDL-1.3-or-later
.\" -------------------------------------------------------------- .\" --------------------------------------------------------------
.\" Doc Type : Man Page .\" Doc Type : Man Page
.\" Doc Authors : Aoran Zeng <ccmywish@qq.com> .\" Doc Authors : 曾奥然 <ccmywish@qq.com>
.\" Contributors : Nul None <nul@none.org> .\" Contributors : Nul None <nul@none.org>
.\" | .\" |
.\" Created On : <2024-08-21> .\" Created On : <2024-08-21>
.\" Last Modified : <2025-06-16> .\" Last Modified : <2025-10-29>
.\" -------------------------------------------------------------- .\" ----------------------------------------------------------------
.TH chsrc 1 "2025-06-16" "v0.2.1.2" "RubyMetric chsrc" .TH chsrc 1 "2025-10-29" "v0.2.3.1" "RubyMetric chsrc"
.SH NAME .SH NAME
chsrc - Change Source for every software on every platform from the command line chsrc - Change Source for every software on every platform from the command line

View File

@ -2,29 +2,29 @@
@c SPDX-License-Identifier: GFDL-1.3-or-later @c SPDX-License-Identifier: GFDL-1.3-or-later
@c -------------------------------------------------------------- @c --------------------------------------------------------------
@c Doc Type : Texinfo @c Doc Type : Texinfo
@c Doc Authors : Aoran Zeng <ccmywish@qq.com> @c Doc Authors : 曾奥然 <ccmywish@qq.com>
@c Contributors : Nul None <nul@none.org> @c Contributors : Nul None <nul@none.org>
@c | @c |
@c Created On : <2024-08-22> @c Created On : <2024-08-22>
@c Last Modified : <2025-06-19> @c Last Modified : <2025-10-29>
@c -------------------------------------------------------------- @c --------------------------------------------------------------
\input texinfo \input texinfo
@setfilename chsrc.info @setfilename chsrc.info
@settitle chsrc @settitle chsrc
@set Chsrc_Version v0.2.1.2 @set Chsrc_Version v0.2.3.1
@set Doc_Publish_Date 2025-06-19 @set Doc_Publish_Date 2025-10-29
@copying @copying
@comment 这是软件copyright不是文档copyright因此不放在titlepage @comment 这是软件copyright不是文档copyright因此不放在titlepage
Copyright @copyright{} 2025 Aoran Zeng, Heng Guo Copyright @copyright{} 2025 曾奥然, 郭恒
@end copying @end copying
@titlepage @titlepage
@title chsrc printed manual @title chsrc printed manual
@subtitle Change Source everywhere for every software! @subtitle Change Source everywhere for every software!
@author Aoran Zeng @author 曾奥然
@c @insertcopying @c @insertcopying
For chsrc @value{Chsrc_Version} For chsrc @value{Chsrc_Version}
@page @page

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

@ -2,12 +2,12 @@
# -------------------------------------------------------------- # --------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# -------------------------------------------------------------- # --------------------------------------------------------------
# Build File : justfile # Build File : justfile
# File Authors : Aoran Zeng <ccmywish@qq.com> # File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org> # Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
# | # |
# Created On : <2025-06-18> # Created On : <2025-06-18>
# Last Modified : <2025-07-21> # Last Modified : <2025-10-15>
# #
# 该文件主要用于在原生Windows上执行项目的基本任务而不借助于 # 该文件主要用于在原生Windows上执行项目的基本任务而不借助于
# GNU make 以及相应的 MSYS2、Cygwin 环境 # GNU make 以及相应的 MSYS2、Cygwin 环境
@ -104,9 +104,9 @@ alias c := clean
default: build-in-dev-mode default: build-in-dev-mode
build-in-dev-mode: build-in-dev-mode:
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}} @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}} @{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
@echo Finished: Build in DEV mode @echo Finished: Build in DEV mode
build-in-debug-mode: build-in-debug-mode:
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}} @echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
@ -114,9 +114,17 @@ build-in-debug-mode:
@echo Finished: Build in DEBUG mode @echo Finished: Build in DEBUG mode
build-in-release-mode: build-in-release-mode:
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}} @echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}} @{{ if os() == 'windows' { \
@echo Finished: Build in RELEASE mode '(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 debug: build-in-debug-mode
@{{DEBUGGER}} {{DebugMode-Target-Name}} @{{DEBUGGER}} {{DebugMode-Target-Name}}
@ -140,6 +148,7 @@ test-cli:
clean: clean:
-@{{BIN_rm}} *.exe -@{{BIN_rm}} *.exe
-@{{BIN_rm}} *.res
-@{{BIN_rm}} xy -@{{BIN_rm}} xy
-@{{BIN_rm}} fw -@{{BIN_rm}} fw
-@{{BIN_rm}} chsrc -@{{BIN_rm}} chsrc

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

1246
lib/xy.h

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : README.md ! Doc Name : README.md
! Doc Authors : Aoran Zeng <ccmywish@qq.com> ! Doc Authors : 曾奥然 <ccmywish@qq.com>
! Contributors : Nil Null <nil@null.org> ! Contributors : Nil Null <nil@null.org>
! | ! |
! Created On : <2025-06-15> ! Created On : <2025-06-15>
! Last Modified : <2025-06-16> ! Last Modified : <2025-06-16>

View File

@ -4,7 +4,7 @@
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : BUILD.md ! Doc Name : BUILD.md
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com> ! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
! Contributors : Aoran Zeng <ccmywish@qq.com> ! Contributors : 曾奥然 <ccmywish@qq.com>
! | ! |
! Created On : <2025-06-14> ! Created On : <2025-06-14>
! Last Modified : <2025-06-16> ! Last Modified : <2025-06-16>

View File

@ -4,7 +4,7 @@
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : CI.md ! Doc Name : CI.md
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com> ! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
! Contributors : Aoran Zeng <ccmywish@qq.com> ! Contributors : 曾奥然 <ccmywish@qq.com>
! | ! |
! Created On : <2025-06-14> ! Created On : <2025-06-14>
! Last Modified : <2025-06-16> ! Last Modified : <2025-06-16>

View File

@ -4,7 +4,7 @@
# -------------------------------------------------------------- # --------------------------------------------------------------
# Build File : Makefile # Build File : Makefile
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Aoran Zeng <ccmywish@qq.com> # Contributors : 曾奥然 <ccmywish@qq.com>
# | # |
# Created On : <2025-06-14> # Created On : <2025-06-14>
# Last Modified : <2025-06-16> # Last Modified : <2025-06-16>

View File

@ -4,8 +4,8 @@
! Doc Type : Markdown ! Doc Type : Markdown
! Doc Name : README.md ! Doc Name : README.md
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com> ! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
! | Aoran Zeng <ccmywish@qq.com> ! | 曾奥然 <ccmywish@qq.com>
! Contributors : Nil Null <nil@null.org> ! Contributors : Nil Null <nil@null.org>
! | ! |
! Created On : <2025-06-14> ! Created On : <2025-06-14>
! Last Modified : <2025-06-16> ! Last Modified : <2025-06-16>

View File

@ -4,7 +4,7 @@
# -------------------------------------------------------------- # --------------------------------------------------------------
# Test File : deb-installation-test.sh # Test File : deb-installation-test.sh
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Aoran Zeng <ccmywish@qq.com> # Contributors : 曾奥然 <ccmywish@qq.com>
# | # |
# Created On : <2025-06-14> # Created On : <2025-06-14>
# Last Modified : <2025-06-16> # Last Modified : <2025-06-16>

View File

@ -1,8 +1,15 @@
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 chsrc (0.1.9-1) unstable; urgency=medium
* v0.1.9 已发布 * v0.1.9 已发布
-- Aoran Zeng <ccmywish@qq.com> Sun, 15 Jun 2025 13:32:50 +0800 -- 曾奥然 <ccmywish@qq.com> Sun, 15 Jun 2025 13:32:50 +0800
chsrc (0.0.1-1) unstable; urgency=medium chsrc (0.0.1-1) unstable; urgency=medium

View File

@ -1,17 +1,17 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: chsrc Upstream-Name: chsrc
Upstream-Contact: Aoran Zeng <ccmywish@qq.com> Upstream-Contact: 曾奥然 <ccmywish@qq.com>
Source: https://github.com/RubyMetric/chsrc Source: https://github.com/RubyMetric/chsrc
Files: * Files: *
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com> Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
2023-2025 Heng Guo <2085471348@qq.com> 2023-2025 郭恒 <2085471348@qq.com>
License: GPL-3+ License: GPL-3+
Comment: The authors' names are indicated in each source code file's header. Comment: The authors' names are indicated in each source code file's header.
Files: lib/xy.h Files: lib/xy.h
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com> Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
2023-2025 Heng Guo <2085471348@qq.com> 2023-2025 郭恒 <2085471348@qq.com>
License: MIT License: MIT
Files: pkg/deb/debian/* Files: pkg/deb/debian/*

View File

@ -5,7 +5,7 @@
# deb File : postinst # deb File : postinst
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Nil Null <nil@null.org> # Contributors : Nil Null <nil@null.org>
# | # |
# Created On : <2025-06-14> # Created On : <2025-06-14>
# Last Modified : <2025-06-16> # Last Modified : <2025-06-16>
# #

View File

@ -5,7 +5,7 @@
# deb File : prerm # deb File : prerm
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Nil Null <nil@null.org> # Contributors : Nil Null <nil@null.org>
# | # |
# Created On : <2025-06-14> # Created On : <2025-06-14>
# Last Modified : <2025-06-16> # Last Modified : <2025-06-16>
# #

View File

@ -4,8 +4,8 @@
# -------------------------------------------------------------- # --------------------------------------------------------------
# Build File : rules # Build File : rules
# File Authors : sanchuanhehe <wyihe5520@gmail.com> # File Authors : sanchuanhehe <wyihe5520@gmail.com>
# | Aoran Zeng <ccmywish@qq.com> # | 曾奥然 <ccmywish@qq.com>
# Contributors : Nil Null <nil@null.org> # Contributors : Nil Null <nil@null.org>
# | # |
# Created On : <2025-06-14> # Created On : <2025-06-14>
# Last Modified : <2025-06-20> # Last Modified : <2025-06-20>

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

View File

@ -1,20 +1,18 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : chef.h * File Name : helper.c
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org> * Contributors : Nul None <nul@none.org>
* Created On : <2025-07-14> * Created On : <2025-07-14>
* Last Modified : <2025-07-14> * Last Modified : <2025-10-28>
* *
* For chefs (recipe makers) and sometimes framewoker * For chefs (recipe makers) and sometimes framewoker
* to do some work not releated to OS operations * to do some work not releated to OS operations
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#pragma once
bool bool
chef_is_url (const char *str) hp_is_url (const char *str)
{ {
return (xy_str_start_with (str, "http://") || xy_str_start_with (str, "https://")); return (xy_str_start_with (str, "http://") || xy_str_start_with (str, "https://"));
} }
@ -23,7 +21,7 @@ chef_is_url (const char *str)
* @return * @return
*/ */
char * char *
chef_remove_trailing_slash (char *str) hp_remove_trailing_slash (char *str)
{ {
char *newstr = xy_strdup (str); char *newstr = xy_strdup (str);
size_t len = strlen (newstr); size_t len = strlen (newstr);
@ -36,11 +34,11 @@ chef_remove_trailing_slash (char *str)
* @return * @return
*/ */
char * char *
chef_ensure_trailing_slash (char *str) hp_ensure_trailing_slash (char *str)
{ {
size_t len = strlen (str); size_t len = strlen (str);
if (len == 0 || str[len - 1] == '/') if (len == 0 || str[len - 1] == '/')
return xy_strdup (str); return xy_strdup (str);
return xy_2strjoin (str, "/"); return xy_2strcat (str, "/");
} }

View File

@ -1,15 +1,16 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : mirror.c * File Name : mirror.c
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com> * | <2085471348@qq.com>
* Contributors : Shengwei Chen <414685209@qq.com> * Contributors : Shengwei Chen <414685209@qq.com>
* | Jialin Lyu <jialinlvcn@aliyun.com> * | Jialin Lyu <jialinlvcn@aliyun.com>
* | Mikachu2333 <mikachu.23333@zohomail.com> * | Mikachu2333 <mikachu.23333@zohomail.com>
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
* | * |
* Created On : <2023-08-29> * Created On : <2023-08-29>
* Last Modified : <2025-07-14> * Last Modified : <2025-10-07>
* *
* *
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
@ -260,6 +261,13 @@ Huawei =
{NotSkip, NA, NA, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu, ROUGH} {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 = Volcengine =
{ {
IS_GeneralMirrorSite, IS_GeneralMirrorSite,

View File

@ -2,12 +2,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Name : struct.h * File Name : struct.h
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com> * | <2085471348@qq.com>
* Contributors : Shengwei Chen <414685209@qq.com> * Contributors : Shengwei Chen <414685209@qq.com>
* | * |
* Created On : <2023-08-29> * Created On : <2023-08-29>
* Last Modified : <2025-07-11> * Last Modified : <2025-08-22>
* *
* chsrc struct * chsrc struct
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
@ -35,7 +35,7 @@ typedef enum ProviderType_t
IS_GeneralMirrorSite, /* 通用镜像站 */ IS_GeneralMirrorSite, /* 通用镜像站 */
IS_DedicatedMirrorSite, /* 专用镜像站 */ IS_DedicatedMirrorSite, /* 专用镜像站 */
IS_UpstreamProvider, /* 上游默认源 */ IS_UpstreamProvider, /* 上游默认源 */
IS_VirtualProvider, /* 用户提供 */ IS_UserDefinedProvider, /* 用户提供 */
} }
ProviderType_t; ProviderType_t;
@ -55,18 +55,17 @@ typedef SourceProvider_t MirrorSite_t;
SourceProvider_t UpstreamProvider = SourceProvider_t UpstreamProvider =
{ {
IS_UpstreamProvider, IS_UpstreamProvider,
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段,可使用 def_upstream 宏 */ /* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段 */
"upstream", "Upstream", "上游默认源", NULL, "upstream", "Upstream", "上游默认源", NULL,
/* 引入新的上游默认源时,请完全修改下面这个结构体,可使用 def_need_measure_info 宏 */ /* 引入新的上游默认源时,请完全修改下面这个结构体,可使用 def_need_measure_info 宏 */
{SKIP, "URL未知邀您参与贡献!", "URL unknown, welcome to contribute!", NULL, ACCURATE} {SKIP, "URL未知邀您参与贡献!", "URL unknown, welcome to contribute!", NULL, ACCURATE}
}; };
#define def_upstream IS_UpstreamProvider, "upstream", "Upstream", "上游默认源"
#define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL, ACCURATE} #define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL, ACCURATE}
SourceProvider_t UserDefinedProvider = SourceProvider_t UserDefinedProvider =
{ {
IS_VirtualProvider, IS_UserDefinedProvider,
"user", "用户自定义", "用户自定义", NULL, "user", "用户自定义", "用户自定义", NULL,
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL, ACCURATE} {SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL, ACCURATE}
}; };
@ -92,70 +91,89 @@ Source_t;
#define DelegateToMirror NULL #define DelegateToMirror NULL
/* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */ /* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */
#define NeedContribute NULL #define NeedContribute NULL
/* 由 _sources_prepare 填充 */ /* 由 prelude() 填充 */
#define FeedBySourcesPrepare NULL #define FeedByPrelude NULL
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
enum Capability_t typedef enum Capability_t
{ {
CanNot, CanNot,
FullyCan, FullyCan,
PartiallyCan 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 typedef struct Target_t
{ {
/* 以 / 为分隔符的多个目标别名 */
char *aliases;
void (*getfn) (char *option); void (*getfn) (char *option);
void (*setfn) (char *option); void (*setfn) (char *option);
void (*resetfn) (char *option); void (*resetfn) (char *option);
Feature_t (*featfn) (char *option); /* 初始化函数,用于填充该 struct 的各种信息 */
void (*preludefn) (void);
bool inited; /* 是否执行过了 preludefn() */
Source_t *sources; 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; 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 chef_allow_gsr(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
#define def_target(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)} #define chef_allow_s(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = NULL;
#define def_target_s(t) Target_t t##_target = {def_target_inner_s(t),def_target_sourcesn(t)} #define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
#define def_target_sr(t) Target_t t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)} #define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
#define def_target_sf(t) Target_t t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)} #define chef_allow_NOOP(t)
#define def_target_srf(t) Target_t t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)} #define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(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 use_this(t) Target_t *this = &t##_target;
#define def_target_gsf(t) Target_t t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)} #define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option);
#define def_target_gsrf(t) Target_t t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)}
#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"

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,10 @@
! SPDX-License-Identifier: GPL-3.0-or-later ! SPDX-License-Identifier: GPL-3.0-or-later
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Config Type : rawstr4c (Markdown) ! Config Type : rawstr4c (Markdown)
! Config Authors: Aoran Zeng <ccmywish@qq.com> ! Config Authors: 曾奥然 <ccmywish@qq.com>
! Contributors : Nil Null <nil@null.org> ! Contributors : Nil Null <nil@null.org>
! Created On : <2025-07-22> ! Created On : <2025-07-22>
! Last Modified : <2025-07-22> ! Last Modified : <2025-10-29>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# [rawstr4c] input for chsrc # [rawstr4c] input for chsrc
@ -24,7 +24,7 @@
- prefix = `RAWSTR_chsrc` - prefix = `RAWSTR_chsrc`
- output = `:global-variable-only-header` - output = `:global-variable-only-header`
- translate = `:oct` - translate = `:oct`
- keep-postfix = `false` - no-postfix = `true`
<br> <br>
@ -71,8 +71,8 @@
维护: 维护:
邀请您担任 Chef, 为用户把关您熟悉的 recipe 邀请您担任 Chef, 为用户把关您熟悉的 recipe
源代码地址: @url@ 源代码地址: https://github.com/RubyMetric/chsrc
成为维护者: https://github.com/RubyMetric/chsrc/issues/130 成为维护者: https://github.com/RubyMetric/chsrc/issues/275
``` ```
<br> <br>
@ -123,7 +123,7 @@ MAINTAIN:
We invite you to become a Chef to ensure the quality of recipes you are familiar with for users: We invite you to become a Chef to ensure the quality of recipes you are familiar with for users:
Source Code: @url@ Source Code: @url@
Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/130 Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/275
``` ```
<br> <br>
@ -132,16 +132,36 @@ MAINTAIN:
## for `chsrc -v` ## for `chsrc -v`
- name = `for__v` - name = `for__v_CHINESE`
``` ```
chsrc @ver@ chsrc @ver@
Copyright (C) 2025 Aoran Zeng, Heng Guo
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> 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. This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. There is NO WARRANTY, to the extent permitted by law.
Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c) Written by authors: Aoran Zeng, Heng Guo, collaborators: Mikachu2333, Happy Game, and contributors. (See chsrc-main.c, or `chsrc ls <target>`)
``` ```
<br> <br>
@ -154,6 +174,7 @@ Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c)
``` ```
我们同时在 GitHub 和 Gitee 接受 issue 和 Bug 报告: 我们同时在 GitHub 和 Gitee 接受 issue 和 Bug 报告:
- https://github.com/RubyMetric/chsrc/issues - https://github.com/RubyMetric/chsrc/issues
- https://gitee.com/RubyMetric/chsrc/issues - https://gitee.com/RubyMetric/chsrc/issues
@ -188,7 +209,7 @@ Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c)
## 最后告诉用户一些维护信息 ## 最后告诉用户一些维护信息
- name = `last_message` - name = `op_epilogue`
``` ```

View File

@ -1,32 +1,42 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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 : <2025-07-16>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_clojure, "clojure/clojars/cloj/lein");
* @update 2025-07-14
*/ void
static Source_t pl_clojure_sources[] = pl_clojure_prelude ()
{ {
{&UpstreamProvider, NULL, NULL}, 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}, {&MirrorZ, "https://mirrors.cernet.edu.cn/clojars/", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror},
{&Nyist, "https://mirror.nyist.edu.cn/clojars/", DelegateToMirror}, {&Nyist, "https://mirror.nyist.edu.cn/clojars/", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/clojars/", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/clojars/", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/clojars/", DelegateToMirror} {&Iscas, "https://mirror.iscas.ac.cn/clojars/", DelegateToMirror}
}; def_sources_end()
def_sources_n(pl_clojure); }
void void
pl_clojure_setsrc (char *option) pl_clojure_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_clojure); chsrc_use_this_source (pl_clojure);
if (chsrc_in_local_mode()) if (chsrc_in_local_mode())
{ {
@ -41,30 +51,5 @@ pl_clojure_setsrc (char *option)
println (config); println (config);
} }
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
/**
* chsrc ls clojure
*/
Feature_t
pl_clojure_feat (char *option)
{
Feature_t f = {0};
f.can_get = false;
f.can_reset = false;
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_sf(pl_clojure);

View File

@ -1,42 +1,36 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* | MadDogOwner <xiaoran@xrgzs.top>
* |
* Created On : <2023-09-10>
* Major Revision : 2
* Last Modified : <2025-07-11>
*
* 2024-09-14: Dart和Flutter拆分为两个Target
* 3 Dart Flutter URL模式都不一样
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define PL_Dart_Flutter_Speed_URL_Postfix "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz" def_target(pl_dart_flutter, "flutter");
/** void
* @update 2025-04-15 pl_dart_flutter_prelude (void)
*/
static SourceProvider_t pl_dart_flutter_upstream =
{ {
def_upstream, "https://storage.googleapis.com", chef_prep_this (pl_dart_flutter, gsr);
{NotSkip, NA, NA, "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz", ACCURATE} // 231 MB
};
static Source_t pl_dart_flutter_sources[] = chef_set_created_on (this, "2023-09-10");
{ chef_set_last_updated (this, "2025-07-11");
{&pl_dart_flutter_upstream, "https://storage.googleapis.com", DelegateToUpstream}, chef_set_sources_last_updated (this, "2025-04-15");
{&FlutterCN, "https://storage.flutter-io.cn", DelegateToMirror},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn", NULL }, /* 官方文档也没有给后缀,怀疑是否存在问题 */
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter", chef_set_chef (this, NULL);
"https://mirrors.tuna.tsinghua.edu.cn/flutter" PL_Dart_Flutter_Speed_URL_Postfix}, chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
{&Nju, "https://mirror.nju.edu.cn/flutter", chef_allow_local_mode (this, CanNot, NULL, NULL);
"https://mirror.nju.edu.cn/flutter" PL_Dart_Flutter_Speed_URL_Postfix} chef_allow_english(this);
}; chef_allow_user_define(this);
def_sources_n(pl_dart_flutter);
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");
}
/** /**
@ -57,13 +51,13 @@ pl_dart_flutter_getsrc (char *option)
void void
pl_dart_flutter_setsrc (char *option) pl_dart_flutter_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_dart_flutter); chsrc_use_this_source (pl_dart_flutter);
char *w = NULL; char *w = NULL;
char *cmd = NULL; char *cmd = NULL;
if (xy_on_windows) if (xy.on_windows)
{ {
cmd = xy_strjoin (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\""); cmd = xy_strcat (3, "setx FLUTTER_STORAGE_BASE_URL \"", source.url, "\"");
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
} }
else else
@ -72,7 +66,7 @@ pl_dart_flutter_setsrc (char *option)
char *bashrc = xy_bashrc; char *bashrc = xy_bashrc;
chsrc_backup (zshrc); 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); chsrc_append_to_file (w, zshrc);
if (xy_file_exist (bashrc)) if (xy_file_exist (bashrc))
@ -92,27 +86,3 @@ pl_dart_flutter_resetsrc (char *option)
{ {
pl_dart_flutter_setsrc (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,45 +1,36 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* | MadDogOwner <xiaoran@xrgzs.top>
* |
* Created On : <2023-09-10>
* Major Revision : 3
* Last Modified : <2025-07-11>
*
* Dart Pub
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define PL_Dart_Pub_Speed_URL_Postfix "/packages/flutter_vision/versions/1.1.4.tar.gz" def_target(pl_dart, "dart/pub");
/** void
* @update 2025-04-15 pl_dart_prelude (void)
*/
static SourceProvider_t pl_dart_upstream =
{ {
def_upstream, "https://pub.dev", chef_prep_this (pl_dart, gsr);
{NotSkip, NA, NA, "https://pub.dev/packages/flutter_vision/versions/1.1.4.tar.gz", ACCURATE} // 37.05 MB
};
static Source_t pl_dart_sources[] = chef_set_created_on (this, "2023-09-10");
{ chef_set_last_updated (this, "2025-07-11");
{&pl_dart_upstream, "https://pub.dev", DelegateToUpstream}, chef_set_sources_last_updated (this, "2025-04-15");
{&FlutterCN, "https://pub.flutter-io.cn", chef_set_chef (this, NULL);
"https://pub.flutter-io.cn" PL_Dart_Pub_Speed_URL_Postfix}, chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub", chef_allow_local_mode (this, FullyCan, NULL, NULL);
"https://mirror.sjtu.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix}, chef_allow_english(this);
chef_allow_user_define(this);
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub", def_sources_begin()
"https://mirrors.tuna.tsinghua.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix}, {&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()
{&Nju, "https://mirror.nju.edu.cn/dart-pub", chef_set_sources_speed_measure_url_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
"https://mirror.nju.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix} }
};
def_sources_n(pl_dart);
void void
@ -56,13 +47,13 @@ pl_dart_getsrc (char *option)
void void
pl_dart_setsrc (char *option) pl_dart_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_dart); chsrc_use_this_source (pl_dart);
char *w = NULL; char *w = NULL;
char *cmd = NULL; char *cmd = NULL;
if (xy_on_windows) if (xy.on_windows)
{ {
cmd = xy_strjoin (3, "setx PUB_HOSTED_URL \"", source.url, "\""); cmd = xy_strcat (3, "setx PUB_HOSTED_URL \"", source.url, "\"");
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
} }
else else
@ -71,7 +62,7 @@ pl_dart_setsrc (char *option)
char *bashrc = xy_bashrc; char *bashrc = xy_bashrc;
chsrc_backup (zshrc); 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); chsrc_append_to_file (w, zshrc);
@ -92,24 +83,3 @@ pl_dart_resetsrc (char *option)
{ {
pl_dart_setsrc (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

@ -1,21 +1,7 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : czyt <czyt.go@gmail.com>
* | Rui Yang <techoc@foxmail.com>
* |
* Created On : <2023-08-30>
* Major Revision : 1
* Last Modified : <2025-07-12>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_go_upstream =
{
def_upstream, "https://pkg.go.dev/",
def_need_measure_info
};
static MirrorSite_t GoProxyCN = static MirrorSite_t GoProxyCN =
{ {
IS_DedicatedMirrorSite, IS_DedicatedMirrorSite,
@ -30,31 +16,44 @@ GoProxyIO =
{NotSkip, NA, NA, "https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", ACCURATE} // 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");
/** void
* @update 2025-07-12 pl_go_prelude ()
*
* @note
*/
static Source_t pl_go_sources[] =
{ {
{&pl_go_upstream, "https://proxy.golang.org", NULL}, chef_prep_this (pl_go, gsr);
{&GoProxyCN, "https://goproxy.cn", DelegateToMirror},
{&Ali, "https://mirrors.aliyun.com/goproxy/", NULL}, 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 // 暂时停用华为镜像源, 详见 https://github.com/RubyMetric/chsrc/issues/227
// {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", NULL}, // {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", DelegateToMirror},
{&GoProxyIO, "https://goproxy.io", DelegateToMirror} {&GoProxyIO, "https://goproxy.io", DelegateToMirror}
}; def_sources_end()
def_sources_n(pl_go); }
void void
pl_go_check_cmd () 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); bool exist = query_program_exist (check_cmd, "go", Noisy_When_Exist|Noisy_When_NonExist);
if (!exist) if (!exist)
@ -74,8 +73,6 @@ pl_go_getsrc (char *option)
/** /**
* chsrc set go
*
* @consult https://goproxy.cn/ * @consult https://goproxy.cn/
*/ */
void void
@ -83,47 +80,20 @@ pl_go_setsrc (char *option)
{ {
pl_go_check_cmd (); pl_go_check_cmd ();
chsrc_yield_source_and_confirm (pl_go); chsrc_use_this_source (pl_go);
char *cmd = "go env -w GO111MODULE=on"; char *cmd = "go env -w GO111MODULE=on";
chsrc_run (cmd, RunOpt_Default); 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_run (cmd, RunOpt_Default);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
/**
* chsrc reset go
*/
void void
pl_go_resetsrc (char *option) pl_go_resetsrc (char *option)
{ {
pl_go_setsrc (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,26 +1,36 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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 : <2025-07-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_haskell, "haskell/cabal/stack/hackage");
* @update 2023-09-10
*/ void
static Source_t pl_haskell_sources[] = pl_haskell_prelude ()
{ {
{&UpstreamProvider, NULL, NULL}, 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}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/hackage", DelegateToMirror},
{&Bfsu, "https://mirrors.bfsu.edu.cn/hackage", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/hackage", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/hackage", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/hackage", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/hackage", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/hackage", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/hackage", DelegateToMirror}, {&Iscas, "https://mirror.iscas.ac.cn/hackage", DelegateToMirror},
{&Nyist, "https://mirror.nyist.edu.cn/hackage", DelegateToMirror} {&Nyist, "https://mirror.nyist.edu.cn/hackage", DelegateToMirror}
}; def_sources_end()
def_sources_n(pl_haskell); }
/** /**
@ -29,12 +39,12 @@ def_sources_n(pl_haskell);
void void
pl_haskell_setsrc (char *option) pl_haskell_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_haskell); chsrc_use_this_source (pl_haskell);
char *content = xy_str_gsub (RAWSTR_pl_haskell_cabal_config, "@url@", source.url); char *content = xy_str_gsub (RAWSTR_pl_haskell_cabal_config, "@url@", source.url);
char *config = NULL; char *config = NULL;
if (xy_on_windows) if (xy.on_windows)
{ {
config = xy_normalize_path ("~/AppData/Roaming/cabal/config"); config = xy_normalize_path ("~/AppData/Roaming/cabal/config");
} }
@ -43,34 +53,13 @@ pl_haskell_setsrc (char *option)
config = "~/.cabal/config"; config = "~/.cabal/config";
} }
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:")); chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
print (content); println (content);
config = xy_normalize_path ("~/.stack/config.yaml"); config = xy_normalize_path ("~/.stack/config.yaml");
content = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url); content = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url);
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:")); chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
print (content); println (content);
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_haskell_feat (char *option)
{
Feature_t f = {0};
f.can_get = false;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_sf (pl_haskell);

View File

@ -1,84 +1,154 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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 : <2025-07-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_java_upstream = def_target(pl_java, "java/maven/mvn/maven-daemon/mvnd/gradle");
{
def_upstream, "https://mvnrepository.com/",
def_need_measure_info
};
/** void
* @update 2024-12-18 pl_java_prelude ()
*/
static Source_t pl_java_sources[] =
{ {
{&pl_java_upstream, NULL, NULL}, chef_prep_this (pl_java, gsr);
{&Ali, "https://maven.aliyun.com/repository/public/", DelegateToMirror},
{&Huawei, "https://mirrors.huaweicloud.com/repository/maven/", DelegateToMirror}, chef_set_created_on (this, "2023-08-31");
/* 网易的24小时更新一次 */ chef_set_last_updated (this, "2025-08-27");
{&Netease, "http://mirrors.163.com/maven/repository/maven-public/", DelegateToMirror} chef_set_sources_last_updated (this, "2024-12-18");
};
def_sources_n(pl_java); 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 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"); *maven_exist = chsrc_check_program ("mvn");
*gradle_exist = chsrc_check_program ("gradle"); *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); 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 * char *
pl_java_find_maven_config () pl_java_find_maven_config ()
{ {
char *buf = xy_run ("mvn -v", 2); char *output;
char *maven_home = xy_str_delete_prefix (buf, "Maven home: "); int status = xy_run_get_stdout ("mvn -v", &output);
maven_home = xy_str_strip (maven_home); 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")); chsrc_alert2 ("未找到 maven home, 将使用用户配置文件");
return maven_config; 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 void
pl_java_getsrc (char *option) pl_java_getsrc (char *option)
{ {
bool maven_exist, gradle_exist; bool maven_exist, gradle_exist, maven_daemon_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist); pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
char *maven_config = pl_java_find_maven_config (); if (maven_exist)
chsrc_note2 (xy_2strjoin ("请查看 ", maven_config)); {
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 * @consult https://developer.aliyun.com/mirror/maven
*/ */
void void
pl_java_setsrc (char *option) pl_java_setsrc (char *option)
{ {
bool maven_exist, gradle_exist; bool maven_exist, gradle_exist, maven_daemon_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist); pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
chsrc_yield_source_and_confirm (pl_java);
chsrc_use_this_source(pl_java);
if (maven_exist) if (maven_exist)
{ {
char *file = xy_str_gsub (RAWSTR_pl_java_maven_config, "@1@", source.mirror->code); 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, "@name@", source.mirror->name);
file = xy_str_gsub (file, "@url@", source.url); file = xy_str_gsub (file, "@url@", source.url);
char *maven_config = pl_java_find_maven_config (); char *maven_config = pl_java_find_maven_config ();
chsrc_note2 (xy_strjoin (3, "请在 maven 配置文件 ", maven_config, " 中添加:")); 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); println (file);
} }
@ -90,26 +160,12 @@ pl_java_setsrc (char *option)
println (file); println (file);
} }
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t void
pl_java_feat (char *option) pl_java_resetsrc (char *option)
{ {
Feature_t f = {0}; pl_java_setsrc (option);
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
} }
def_target_gsf(pl_java);

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

@ -10,7 +10,7 @@
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
void void
pl_nodejs_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist) pl_js_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
{ {
*npm_exist = chsrc_check_program ("npm"); *npm_exist = chsrc_check_program ("npm");
*yarn_exist = chsrc_check_program ("yarn"); *yarn_exist = chsrc_check_program ("yarn");
@ -26,42 +26,36 @@ pl_nodejs_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
} }
/**
* chsrc get nodejs
*/
void void
pl_nodejs_group_getsrc (char *option) pl_js_group_getsrc (char *option)
{ {
bool npm_exist, yarn_exist, pnpm_exist; bool npm_exist, yarn_exist, pnpm_exist;
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist); pl_js_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
hr(); hr();
if (npm_exist) if (npm_exist)
{ {
pl_nodejs_npm_getsrc (option); pl_js_npm_getsrc (option);
br(); br();
} }
if (yarn_exist) if (yarn_exist)
{ {
pl_nodejs_yarn_getsrc (option); pl_js_yarn_getsrc (option);
br(); br();
} }
if (pnpm_exist) if (pnpm_exist)
{ {
pl_nodejs_pnpm_getsrc (option); pl_js_pnpm_getsrc (option);
br(); br();
} }
} }
/**
* chsrc set nodejs
*/
void void
pl_nodejs_group_setsrc (char *option) pl_js_group_setsrc (char *option)
{ {
{ {
char *msg = ENGLISH ? "Three package managers will be replaced for you at the same time: " char *msg = ENGLISH ? "Three package managers will be replaced for you at the same time: "
@ -72,26 +66,27 @@ pl_nodejs_group_setsrc (char *option)
} }
bool npm_exist, yarn_exist, pnpm_exist; bool npm_exist, yarn_exist, pnpm_exist;
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist); pl_js_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
chsrc_set_target_group_mode (); chsrc_set_target_group_mode ();
chsrc_yield_source_and_confirm (pl_nodejs_group);
chsrc_use_this_source (pl_js_group);
if (npm_exist) if (npm_exist)
{ {
pl_nodejs_npm_setsrc (option); pl_js_npm_setsrc (option);
br(); br();
} }
if (yarn_exist) if (yarn_exist)
{ {
pl_nodejs_yarn_setsrc (option); pl_js_yarn_setsrc (option);
br(); br();
} }
if (pnpm_exist) if (pnpm_exist)
{ {
pl_nodejs_pnpm_setsrc (option); pl_js_pnpm_setsrc (option);
} }
chsrc_determine_chgtype (ChgType_Auto); chsrc_determine_chgtype (ChgType_Auto);
@ -99,33 +94,8 @@ pl_nodejs_group_setsrc (char *option)
} }
/**
* chsrc reset nodejs
*/
void void
pl_nodejs_group_resetsrc (char *option) pl_js_group_resetsrc (char *option)
{ {
pl_nodejs_group_setsrc (option); pl_js_group_setsrc (option);
} }
/**
* chsrc ls nodejs
*/
Feature_t
pl_nodejs_group_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = "Support `npm` & `yarn v2` & `pnpm`. No support for `yarn v1`";
f.can_english = true;
f.can_user_define = true;
return f;
}
def_target_gsrf (pl_nodejs_group);

View File

@ -1,15 +1,31 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-09-09>
* Major Reviison : 3
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
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 static double
pl_nodejs_yarn_get_yarn_version () pl_js_yarn_get_yarn_version ()
{ {
char *ver = xy_run ("yarn --version", 0); char *ver = xy_run ("yarn --version", 0);
double version = atof (ver); double version = atof (ver);
@ -17,14 +33,11 @@ pl_nodejs_yarn_get_yarn_version ()
} }
/**
* chsrc get yarn
*/
void void
pl_nodejs_yarn_getsrc (char *option) pl_js_yarn_getsrc (char *option)
{ {
// 最后一个版本应该是 v1.22.22 // 最后一个版本应该是 v1.22.22
if (pl_nodejs_yarn_get_yarn_version () >= 2) if (pl_js_yarn_get_yarn_version () >= 2)
// https://github.com/RubyMetric/chsrc/issues/53 // https://github.com/RubyMetric/chsrc/issues/53
// 从 Yarn V2 开始,使用新的配置名 // 从 Yarn V2 开始,使用新的配置名
chsrc_run ("yarn config get npmRegistryServer", RunOpt_No_Last_New_Line); chsrc_run ("yarn config get npmRegistryServer", RunOpt_No_Last_New_Line);
@ -38,21 +51,21 @@ pl_nodejs_yarn_getsrc (char *option)
* @consult https://yarnpkg.com/cli/config/set * @consult https://yarnpkg.com/cli/config/set
*/ */
void void
pl_nodejs_yarn_setsrc (char *option) pl_js_yarn_setsrc (char *option)
{ {
chsrc_yield_source (pl_nodejs_group); Source_t source = chsrc_yield_source (&pl_js_group_target, option);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
chsrc_confirm_source(); chsrc_confirm_source(&source);
char *cmd = NULL; char *cmd = NULL;
// 从 Yarn V2 开始,使用新的配置名 // 从 Yarn V2 开始,使用新的配置名
if (pl_nodejs_yarn_get_yarn_version () >= 2) if (pl_js_yarn_get_yarn_version () >= 2)
{ {
if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源 if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源
cmd = xy_2strjoin ("yarn config set npmRegistryServer ", source.url); cmd = xy_2strcat ("yarn config set npmRegistryServer ", source.url);
else else
cmd = xy_2strjoin ("yarn config set npmRegistryServer --home ", source.url); cmd = xy_2strcat ("yarn config set npmRegistryServer --home ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
} }
@ -65,8 +78,8 @@ pl_nodejs_yarn_setsrc (char *option)
// 不能直接退出,因为 Leader target 不能就此结束 // 不能直接退出,因为 Leader target 不能就此结束
return; return;
} }
// 不再阻止换源命令输出到终端,即不再调用 xy_str_to_quietcmd() // 不再阻止换源命令输出到终端,即不再调用 xy_quiet_cmd()
cmd = xy_2strjoin ("yarn config set registry ", source.url); cmd = xy_2strcat ("yarn config set registry ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
} }
@ -78,35 +91,8 @@ pl_nodejs_yarn_setsrc (char *option)
} }
/**
* chsrc reset yarn
*/
void void
pl_nodejs_yarn_resetsrc (char *option) pl_js_yarn_resetsrc (char *option)
{ {
pl_nodejs_yarn_setsrc (option); pl_js_yarn_setsrc (option);
} }
/**
* chsrc ls yarn
*/
Feature_t
pl_nodejs_yarn_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_nodejs_yarn);
Target_t pl_nodejs_yarn_target = {def_target_inner_gsrf(pl_nodejs_yarn),def_target_sourcesn(pl_nodejs_group)};

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);
}

View File

@ -1,23 +1,33 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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 : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_julia, "julia");
* @update 2025-07-14
*/ void
static Source_t pl_julia_sources[] = pl_julia_prelude ()
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (pl_julia, gs);
chef_set_created_on (this, "2023-08-31");
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_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://pkg.julialang.org", DelegateToUpstream},
{&Pku, "https://mirrors.pku.edu.cn/julia", DelegateToMirror}, {&Pku, "https://mirrors.pku.edu.cn/julia", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/julia", DelegateToMirror}, {&Nju, "https://mirror.nju.edu.cn/julia", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/julia", DelegateToMirror} {&Iscas, "https://mirror.iscas.ac.cn/julia", DelegateToMirror}
}; def_sources_end()
def_sources_n(pl_julia); }
#define PL_Julia_Config "~/.julia/config/startup.jl" #define PL_Julia_Config "~/.julia/config/startup.jl"
@ -42,32 +52,11 @@ pl_julia_getsrc (char *option)
void void
pl_julia_setsrc (char *option) pl_julia_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_julia); chsrc_use_this_source (pl_julia);
char *w = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); char *w = xy_strcat (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
chsrc_append_to_file (w, PL_Julia_Config); chsrc_append_to_file (w, PL_Julia_Config);
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_julia_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsf(pl_julia);

View File

@ -1,10 +1,5 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-27>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static MirrorSite_t Api7 = static MirrorSite_t Api7 =
@ -14,17 +9,30 @@ static MirrorSite_t Api7 =
{SKIP, ToFill, ToFill, NULL, ROUGH} {SKIP, ToFill, ToFill, NULL, ROUGH}
}; };
def_target(pl_lua, "lua/luarocks");
/** void
* @update 2025-07-14 pl_lua_prelude ()
* @note
*/
static Source_t pl_lua_sources[] =
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (pl_lua, gs);
{&Api7, "https://luarocks.cn", NULL},
}; chef_set_created_on (this, "2023-09-27");
def_sources_n(pl_lua); 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://luarocks.org", DelegateToUpstream},
{&Api7, "https://luarocks.cn", DelegateToMirror}
def_sources_end()
}
void void
@ -40,41 +48,20 @@ pl_lua_getsrc (char *option)
void void
pl_lua_setsrc (char *option) pl_lua_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_lua); chsrc_use_this_source (pl_lua);
char *config = xy_strjoin (3, "rocks_servers = {\n" char *config = xy_strcat (3, "rocks_servers = {\n"
" \"", source.url, "\"\n" " \"", source.url, "\"\n"
"}"); "}");
chsrc_note2 ("请手动修改 ~/.luarocks/config.lua 文件 (用于下载):"); chsrc_note2 ("请手动修改 ~/.luarocks/config.lua 文件 (用于下载):");
println (config); println (config);
char *upload_config = xy_strjoin (3, "key = \"<Your API Key>\"\n" char *upload_config = xy_strcat (3, "key = \"<Your API Key>\"\n"
"server = \"", source.url, "\""); "server = \"", source.url, "\"");
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):"); chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
println (upload_config); println (upload_config);
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_lua_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsf(pl_lua);

View File

@ -1,84 +0,0 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Lontten <lontten@163.com>
* Created On : <2024-09-29>
* Last Modified : <2025-07-22>
* ------------------------------------------------------------*/
/**
* chsrc get bun
*/
void
pl_nodejs_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_nodejs_bun_setsrc (char *option)
{
// 用的是 npm Registry 的源
chsrc_yield_source (pl_nodejs_group);
char *content = RAWSTR_pl_nodejs_bun_config;
content = xy_str_gsub (content, "@url@", source.url);
if (chsrc_in_local_mode())
{
chsrc_note2 ("请手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
}
else
{
chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
}
print (content);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
/**
* chsrc reset bun
*/
void
pl_nodejs_bun_resetsrc (char *option)
{
pl_nodejs_bun_setsrc (option);
}
/**
* chsrc ls bun
*/
Feature_t
pl_nodejs_bun_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_nodejs_bun);
Target_t pl_nodejs_bun_target = {def_target_inner_gsrf(pl_nodejs_bun),def_target_sourcesn(pl_nodejs_group)};

View File

@ -1,86 +0,0 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* |
* Created On : <2023-09-09>
* Major Revision : 1
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
#define PL_Nodejs_Group_Speed_URL_Postfix "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"
static SourceProvider_t pl_nodejs_npm_upstream =
{
def_upstream, "https://www.npmjs.com/",
{NotSkip, NA, NA, "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz", ACCURATE}
};
static MirrorSite_t NpmMirror =
{
IS_DedicatedMirrorSite,
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
// 注意,下面这个是跳转后的地址,不确定未来会不会改变
{NotSkip, NA, NA, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.22.0/tfjs-4.22.0.tgz", ACCURATE} // 29MB
};
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
* @note
* Sjtug, Tuna, Lzuoss, Jlu, Bfsu,
*/
static Source_t pl_nodejs_group_sources[] =
{
{&pl_nodejs_npm_upstream, "https://registry.npmjs.org/", DelegateToUpstream}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", DelegateToMirror},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/",
"https://mirrors.huaweicloud.com/repository/npm/" PL_Nodejs_Group_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/",
"https://mirrors.cloud.tencent.com/npm/" PL_Nodejs_Group_Speed_URL_Postfix},
};
def_sources_n(pl_nodejs_group);
#define PL_Nodejs_Binary_Speed_URL_Postfix "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"
static SourceProvider_t pl_nodejs_binary_release_upstream =
{
def_upstream, "https://nodejs.org/",
{NotSkip, NA, NA, "https://nodejs.org/dist/v23.4.0/node-v23.4.0.tar.gz", ACCURATE} // 100MB
};
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-BinaryRelease-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
*/
static Source_t pl_nodejs_binary_release_sources[] =
{
{&pl_nodejs_binary_release_upstream, "https://nodejs.org/dist/", DelegateToUpstream},
{&NpmMirror, "https://npmmirror.com/mirrors",
"https://registry.npmmirror.com/-/binary/node/v23.4.0/node-v23.4.0.tar.gz"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",
"https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",
"https://mirrors.bfsu.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Ustc, "https://mirrors.ustc.edu.cn/node/",
"https://mirrors.ustc.edu.cn/node/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",
"https://mirrors.huaweicloud.com/nodejs/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/",
"https://mirrors.cloud.tencent.com/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix}
};
def_sources_n(pl_nodejs_binary_release);

View File

@ -1,81 +0,0 @@
/** ------------------------------------------------------------
* 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>
* ------------------------------------------------------------*/
/**
* chsrc get npm
*/
void
pl_nodejs_npm_getsrc (char *option)
{
chsrc_run ("npm config get registry", RunOpt_No_Last_New_Line);
}
/**
* @consult https://npmmirror.com/
*
* chsrc set npm
*/
void
pl_nodejs_npm_setsrc (char *option)
{
chsrc_yield_source (pl_nodejs_group);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
char *cmd = NULL;
if (chsrc_in_local_mode())
cmd = xy_2strjoin ("npm config --location project set registry ", source.url);
else
cmd = xy_2strjoin ("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);
}
}
/**
* chsrc reset npm
*/
void
pl_nodejs_npm_resetsrc (char *option)
{
pl_nodejs_npm_setsrc (option);
}
/**
* chsrc ls npm
*/
Feature_t
pl_nodejs_npm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_nodejs_npm);
Target_t pl_nodejs_npm_target = {def_target_inner_gsrf(pl_nodejs_npm),def_target_sourcesn(pl_nodejs_group)};

View File

@ -1,83 +0,0 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* |
* Created On : <2024-09-23>
* Last Modified : <2025-06-19>
* ------------------------------------------------------------*/
/**
* chsrc get nvm
*/
void
pl_nodejs_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
*
* chsrc set nvm
*
* @note nvm does not support Fish
*/
void
pl_nodejs_nvm_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_nodejs_binary_release);
char *w = xy_strjoin (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);
}
/**
* chsrc reset nvm
*/
void
pl_nodejs_nvm_resetsrc (char *option)
{
// pl_nodejs_nvm_setsrc (ChgType_Reset);
chsrc_error ("暂不支持对 nvm 重置");
exit (Exit_Unsupported);
}
/**
* chsrc ls nvm
*/
Feature_t
pl_nodejs_nvm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = "";
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_nodejs_nvm);
Target_t pl_nodejs_nvm_target = {def_target_inner_gsrf(pl_nodejs_nvm),def_target_sourcesn(pl_nodejs_binary_release)};

View File

@ -1,83 +0,0 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-04-18>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get pnpm
*/
void
pl_nodejs_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
*
* chsrc set pnpm
*/
void
pl_nodejs_pnpm_setsrc (char *option)
{
chsrc_yield_source (pl_nodejs_group);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
char *cmd = NULL;
if (chsrc_in_local_mode())
cmd = xy_2strjoin ("pnpm config --location project set registry ", source.url);
else
cmd = xy_2strjoin ("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);
}
}
/**
* chsrc reset pnpm
*/
void
pl_nodejs_pnpm_resetsrc (char *option)
{
pl_nodejs_pnpm_setsrc (option);
}
/**
* chsrc ls pnpm
*/
Feature_t
pl_nodejs_pnpm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_nodejs_pnpm);
Target_t pl_nodejs_pnpm_target = {def_target_inner_gsrf(pl_nodejs_pnpm),def_target_sourcesn(pl_nodejs_group)};

View File

@ -1,33 +1,31 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static MirrorSite_t NugetOrg = def_target(pl_nuget, "nuget/net/.net/dotnet");
{
IS_UpstreamProvider,
"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/",
{SKIP, ToFill, ToFill, NULL, ROUGH}
};
/** void
* @update 2024-04-18 pl_nuget_prelude ()
* @note {
*
* https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language
* }
*/
static Source_t pl_nuget_sources[] =
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (pl_nuget, gs);
{&NugetOrg, "https://www.nuget.org/api/v2/", NULL},
chef_set_created_on (this, "2023-09-10");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2024-04-18");
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_deny_english(this);
chef_deny_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://www.nuget.org/api/v3/", DelegateToUpstream},
{&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3", DelegateToMirror} {&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3", DelegateToMirror}
}; def_sources_end()
def_sources_n(pl_nuget); }
void void
@ -37,28 +35,11 @@ pl_nuget_getsrc (char *option)
} }
/**
* https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language
*/
void void
pl_nuget_setsrc (char *option) pl_nuget_setsrc (char *option)
{ {
chsrc_error ("暂时无法为NuGet换源若有需求请提交issue"); chsrc_error ("暂时无法为NuGet换源若有需求请提交issue");
} }
Feature_t
pl_nuget_feat (char *option)
{
Feature_t f = {0};
f.can_get = false;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = false;
f.note = NULL;
return f;
}
def_target_gsf(pl_nuget);

View File

@ -1,21 +1,31 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-15>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_ocaml, "ocaml/opam");
* @update 2025-07-14
*/ void
static Source_t pl_ocaml_sources[] = pl_ocaml_prelude ()
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (pl_ocaml, gs);
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/git/opam-repository.git", NULL}
}; chef_set_created_on (this, "2023-09-15");
def_sources_n(pl_ocaml); chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2025-07-14");
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://opam.ocaml.org/", DelegateToUpstream},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/git/opam-repository.git", DelegateToMirror}
def_sources_end()
}
void void
@ -41,38 +51,16 @@ pl_ocaml_setsrc (char *option)
{ {
pl_ocaml_check_cmd (); pl_ocaml_check_cmd ();
chsrc_yield_source_and_confirm (pl_ocaml); chsrc_use_this_source (pl_ocaml);
char *cmd = xy_strjoin (3, "opam repo set-url default ", char *cmd = xy_strcat (3, "opam repo set-url default ",
source.url, source.url,
" --all --set-default"); " --all --set-default");
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
chsrc_alert2 ("如果是首次使用 opam ,请使用以下命令进行初始化"); chsrc_alert2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
println (xy_2strjoin ("opam init default ", source.url)); println (xy_2strcat ("opam init default ", source.url));
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_ocaml_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsf(pl_ocaml);

View File

@ -1,25 +1,34 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-30>
* Last Modified : <2024-11-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_php, "php/composer");
* @update 2024-09-14
* @note void
*/ pl_php_prelude ()
static Source_t pl_php_sources[] =
{ {
{&UpstreamProvider, NULL}, chef_prep_this (pl_php, gs);
{&Ali, "https://mirrors.aliyun.com/composer/"},
{&Tencent, "https://mirrors.tencent.com/composer/"}, chef_set_created_on (this, "2023-08-30");
// {&Tencent_Intra, "https://mirrors.tencentyun.com/composer/"}, chef_set_last_updated (this, "2025-08-10");
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"} chef_set_sources_last_updated (this, "2025-08-24");
};
def_sources_n(pl_php); 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://packagist.org/", DelegateToUpstream},
{&Ali, "https://mirrors.aliyun.com/composer/", DelegateToMirror},
{&Tencent, "https://mirrors.tencent.com/composer/", DelegateToMirror},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/composer/", DelegateToMirror},
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/", DelegateToMirror}
def_sources_end()
}
void void
@ -46,7 +55,7 @@ pl_php_setsrc (char *option)
{ {
pl_php_check_cmd (); pl_php_check_cmd ();
chsrc_yield_source_and_confirm (pl_php); chsrc_use_this_source (pl_php);
char *where = " -g "; char *where = " -g ";
if (chsrc_in_local_mode()) if (chsrc_in_local_mode())
@ -54,28 +63,8 @@ pl_php_setsrc (char *option)
where = " "; where = " ";
} }
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url); char *cmd = xy_strcat (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_php_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = FullyCan;
f.cap_locally_explain = "Support `composer`";
f.can_english = false;
f.can_user_define = true;
return f;
}
def_target_gsf (pl_php);

View File

@ -1,33 +1,46 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-31>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_perl_upstream = def_target(pl_perl, "perl/cpan");
{
def_upstream, "https://metacpan.org/",
def_need_measure_info
};
/** void
* @update 2024-05-24 pl_perl_prelude ()
*/
static Source_t pl_perl_sources[] =
{ {
{&pl_perl_upstream, NULL, NULL}, chef_prep_this (pl_perl, gs);
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", DelegateToMirror}, chef_set_created_on (this, "2023-09-31");
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", DelegateToMirror}, chef_set_last_updated (this, "2025-10-07");
{&Hust, "https://mirrors.hust.edu.cn/CPAN/", DelegateToMirror}, chef_set_sources_last_updated (this, "2025-10-07");
{&Ali, "https://mirrors.aliyun.com/CPAN/", DelegateToMirror},
{&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/", DelegateToMirror} chef_set_chef (this, NULL);
}; chef_set_cooks (this, 1, "@ccmywish");
def_sources_n(pl_perl); chef_set_sauciers (this, 2, "@hezonglun", "@Mikachu2333");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english (this);
chef_allow_user_define (this);
def_sources_begin()
{&UpstreamProvider, "https://www.cpan.org/", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/CPAN/", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", FeedByPrelude},
{&Cqu, "https://mirrors.cqu.edu.cn/CPAN/", FeedByPrelude},
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", FeedByPrelude},
{&Nju, "https://mirrors.nju.edu.cn/CPAN/", FeedByPrelude},
{&Nyist, "https://mirror.nyist.edu.cn/CPAN/", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/CPAN/", FeedByPrelude},
{&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/cpan/", FeedByPrelude},
{&Iscas, "https://mirror.iscas.ac.cn/CPAN/", FeedByPrelude},
{&Zju, "https://mirrors.zju.edu.cn/CPAN/", FeedByPrelude},
{&Lzuoss, "https://mirrors.lzu.edu.cn/CPAN/", FeedByPrelude},
{&Hust, "https://mirrors.hust.edu.cn/CPAN/", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/CPAN/", FeedByPrelude}
def_sources_end()
chef_set_sources_speed_measure_url_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz");
}
void void
@ -54,36 +67,14 @@ pl_perl_getsrc (char *option)
void void
pl_perl_setsrc (char *option) pl_perl_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_perl); chsrc_use_this_source (pl_perl);
char *cmd = xy_strjoin (3, char *cmd = xy_strcat (3,
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\""); "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
chsrc_alert2 ("请使用 perl -v 以及 cpan -v若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令"); chsrc_alert2 ("请使用 perl -v 以及 cpan -v若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
p ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\""); p ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_perl_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsf(pl_perl);

View File

@ -1,15 +1,30 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-06-05>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_python_pdm, "pdm");
* chsrc get pdm
*/ void
pl_python_pdm_prelude (void)
{
chef_prep_this (pl_python_pdm, gsr);
chef_set_created_on (this, "2024-06-05");
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_python_group_target);
}
void void
pl_python_pdm_getsrc (char *option) pl_python_pdm_getsrc (char *option)
{ {
@ -22,22 +37,20 @@ pl_python_pdm_getsrc (char *option)
/** /**
* @consult https://github.com/RubyMetric/chsrc/issues/19 * @consult https://github.com/RubyMetric/chsrc/issues/19
*
* chsrc set pdm
*/ */
void void
pl_python_pdm_setsrc (char *option) pl_python_pdm_setsrc (char *option)
{ {
chsrc_yield_source (pl_python_group); Source_t source = chsrc_yield_source (&pl_python_group_target, option);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
chsrc_confirm_source(); chsrc_confirm_source(&source);
char *cmd = NULL; char *cmd = NULL;
if (chsrc_in_local_mode()) if (chsrc_in_local_mode())
cmd = xy_2strjoin ("pdm config --local pypi.url ", source.url); cmd = xy_2strcat ("pdm config --local pypi.url ", source.url);
else else
cmd = xy_2strjoin ("pdm config --global pypi.url ", source.url); cmd = xy_2strcat ("pdm config --global pypi.url ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
@ -48,38 +61,8 @@ pl_python_pdm_setsrc (char *option)
} }
} }
/**
* chsrc reset pdm
*/
void void
pl_python_pdm_resetsrc (char *option) pl_python_pdm_resetsrc (char *option)
{ {
pl_python_pdm_setsrc (option); pl_python_pdm_setsrc (option);
} }
/**
* chsrc ls pdm
*/
Feature_t
pl_python_pdm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
// PDM 完全支持项目级换源
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_pdm);
Target_t pl_python_pdm_target = {def_target_inner_gsrf(pl_python_pdm),def_target_sourcesn(pl_python_group)};

View File

@ -1,17 +1,29 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2024-08-08>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
// @note Poetry 默认使用项目级换源 def_target(pl_python_poetry, "poetry");
void
pl_python_poetry_prelude (void)
{
chef_prep_this (pl_python_poetry, gsr);
chef_set_created_on (this, "2024-08-08");
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, "Poetry 默认使用项目级换源", "Poetry uses project-level source changing by default");
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_python_group_target);
}
/**
* chsrc get poetry
*/
void void
pl_python_poetry_getsrc (char *option) pl_python_poetry_getsrc (char *option)
{ {
@ -21,22 +33,20 @@ pl_python_poetry_getsrc (char *option)
/** /**
* @consult https://python-poetry.org/docs/repositories/#project-configuration * @consult https://python-poetry.org/docs/repositories/#project-configuration
*
* chsrc set poetry
*/ */
void void
pl_python_poetry_setsrc (char *option) pl_python_poetry_setsrc (char *option)
{ {
chsrc_yield_source (pl_python_group); Source_t source = chsrc_yield_source (&pl_python_group_target, option);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
chsrc_confirm_source(); chsrc_confirm_source(&source);
char *cmd = NULL; char *cmd = NULL;
if (!chsrc_in_local_mode()) if (!chsrc_in_local_mode())
chsrc_alert2 ("Poetry 仅支持项目级换源"); chsrc_alert2 ("Poetry 仅支持项目级换源");
cmd = xy_2strjoin ("poetry source add my_mirror ", source.url); cmd = xy_2strcat ("poetry source add my_mirror ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
@ -47,35 +57,8 @@ pl_python_poetry_setsrc (char *option)
} }
/**
* chsrc reset poetry
*/
void void
pl_python_poetry_resetsrc (char *option) pl_python_poetry_resetsrc (char *option)
{ {
pl_python_poetry_setsrc (option); pl_python_poetry_setsrc (option);
} }
/**
* chsrc ls poetry
*/
Feature_t
pl_python_poetry_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_poetry);
Target_t pl_python_poetry_target = {def_target_inner_gsrf(pl_python_poetry),def_target_sourcesn(pl_python_group)};

View File

@ -6,7 +6,6 @@
* | * |
* Created On : <2023-09-03> * Created On : <2023-09-03>
* Last Modified : <2025-07-14> * Last Modified : <2025-07-14>
*
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
void void
@ -58,7 +57,8 @@ pl_python_group_setsrc (char *option)
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist); pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist);
chsrc_set_target_group_mode (); chsrc_set_target_group_mode ();
chsrc_yield_source_and_confirm (pl_python_group);
chsrc_use_this_source (pl_python_group);
// 交给后面检查命令的存在性 // 交给后面检查命令的存在性
@ -85,27 +85,9 @@ pl_python_group_setsrc (char *option)
chsrc_conclude (&source); chsrc_conclude (&source);
} }
void void
pl_python_group_resetsrc (char *option) pl_python_group_resetsrc (char *option)
{ {
pl_python_group_setsrc (option); pl_python_group_setsrc (option);
} }
Feature_t
pl_python_group_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = PartiallyCan;
f.cap_locally_explain = "Support Poetry, PDM, uv. No support for pip";
f.can_english = false;
f.can_user_define = true;
return f;
}
def_target_gsrf(pl_python_group);

View File

@ -1,14 +1,31 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-12-06>
* Last Modified : <2025-07-22>
*
* Rye已经有后继uv了Python group中 * Rye已经有后继uv了Python group中
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
def_target(pl_python_rye, "rye");
void
pl_python_rye_prelude (void)
{
chef_prep_this (pl_python_rye, gsr);
chef_set_created_on (this, "2024-12-06");
chef_set_last_updated (this, "2025-08-09");
chef_set_sources_last_updated (this, "2025-08-09");
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_python_group_target);
}
char * char *
pl_python_find_rye_config () pl_python_find_rye_config ()
{ {
@ -18,28 +35,24 @@ pl_python_find_rye_config ()
return rye_config; return rye_config;
} }
/**
* chsrc get rye
*/
void void
pl_python_rye_getsrc (char *option) pl_python_rye_getsrc (char *option)
{ {
char *rye_config = pl_python_find_rye_config (); char *rye_config = pl_python_find_rye_config ();
chsrc_note2 (xy_strjoin (3, "请查看 ", rye_config, " 配置文件中的 [[sources]] 节内容")); chsrc_note2 (xy_strcat (3, "请查看 ", rye_config, " 配置文件中的 [[sources]] 节内容"));
} }
/** /**
* @consult https://github.com/RubyMetric/chsrc/issues/127 * @consult https://github.com/RubyMetric/chsrc/issues/127
* @consult recipe Java
*
* chsrc set rye
*/ */
void void
pl_python_rye_setsrc (char *option) pl_python_rye_setsrc (char *option)
{ {
/* 并不在 Python group 中,所以不考虑 target group 情况,仅使用 Python group 提供的源 */ /* 并不在 Python group 中,所以不考虑 target group 情况,仅使用 Python group 提供的源 */
chsrc_yield_source_and_confirm (pl_python_group); Source_t source = chsrc_yield_source_and_confirm (&pl_python_group_target, option);
const char *content = RAWSTR_pl_python_rye_config; const char *content = RAWSTR_pl_python_rye_config;
@ -47,44 +60,16 @@ pl_python_rye_setsrc (char *option)
content = xy_str_gsub (content, "@2@", source.url); content = xy_str_gsub (content, "@2@", source.url);
char *rye_config = pl_python_find_rye_config (); char *rye_config = pl_python_find_rye_config ();
chsrc_note2 (xy_strjoin (3, "请在配置文件 ", rye_config, " 中添加:")); chsrc_note2 (xy_strcat (3, "请在配置文件 ", rye_config, " 中添加:"));
print (content); println (content);
chsrc_determine_chgtype (ChgType_Manual); chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
/**
* chsrc reset rye
*/
void void
pl_python_rye_resetsrc (char *option) pl_python_rye_resetsrc (char *option)
{ {
pl_python_rye_setsrc (option); pl_python_rye_setsrc (option);
} }
/**
* chsrc ls rye
*/
Feature_t
pl_python_rye_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = true;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_rye);
Target_t pl_python_rye_target = {def_target_inner_gsrf(pl_python_rye),def_target_sourcesn(pl_python_group)};

View File

@ -1,80 +1,76 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : yongxiang <1926885268@qq.com>
* | happy game <happygame1024@gmail.com>
* |
* Created On : <2023-09-03>
* Major Revision : 1
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#include "rawstr4c.h" #include "rawstr4c.h"
def_target(pl_python_group, "python/pypi/py");
/** /**
* host/pipi/web/pacakges.... * @note ${host}/pipi/web/pacakges/56/e4....
* packages * packages
* @note 2025-09-29 pkg 40M
*
* @warning 2025-09-29 Sjtug
*/ */
#define PL_Python_Group_Speed_URL_Postfix "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" static char *
pl_python_speed_url_constructor (const char *url, const char *user_data)
static SourceProvider_t pl_python_pypi_upstream =
{ {
def_upstream, "https://pypi.org/", char *str = xy_str_delete_suffix (url, "/simple");
{NotSkip, NA, NA, "https://files.pythonhosted.org/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", ACCURATE} // 260MB str = xy_2strcat (str, "/packages/fa/80/eb88edc2e2b11cd2dd2e56f1c80b5784d11d6e6b7f04a1145df64df40065/opencv_python-4.12.0.88-cp37-abi3-win_amd64.whl");
}; if (strstr (url, "mirror.sjtu.edu.cn"))
// e.g. https://mirror.sjtu.edu.cn/pypi-packages/fa/80/eb88edc2e2b11cd2dd2e56f1c80b5784d11d6e6b7f04a1145df64df40065/opencv_python-4.12.0.88-cp37-abi3-win_amd64.whl
str = xy_str_gsub (str, "pypi-packages/packages", "pypi-packages");// 针对 Sjtug
/** return str;
* @update 2025-07-11 }
* @note ZjuPyPI服务在校外访问会自动转向Tuna
*/
static Source_t pl_python_group_sources[] = void
pl_python_group_prelude (void)
{ {
{&pl_python_pypi_upstream, "https://pypi.org/simple", DelegateToUpstream}, chef_prep_this (pl_python_group, gsr);
{&MirrorZ, "https://mirrors.cernet.edu.cn/pypi/web/simple", chef_set_created_on (this, "2023-09-03");
"https://mirrors.cernet.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix}, chef_set_last_updated (this, "2025-09-30");
chef_set_sources_last_updated (this, "2025-09-30");
{&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple", chef_set_chef (this, "@happy-game");
"https://mirrors.bfsu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix}, // 组换源的 leader target 应把所有 follower target 的贡献者都记录过来
chef_set_cooks (this, 2, "@ccmywish", "@happy-game");
chef_set_sauciers (this, 3, "@xyx1926885268", "@Kattos", "@Mikachu2333");
{&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple", chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
"https://mirror.lzu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix}, chef_allow_english(this);
chef_allow_user_define(this);
{&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple",
"https://mirrors.jlu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple", def_sources_begin()
"https://mirror.sjtu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix}, {&UpstreamProvider, "https://pypi.org/simple", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/pypi/web/simple", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple", FeedByPrelude},
// 不要添加Zju浙大的PyPI服务在校外访问会自动转向Tuna
{&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple", FeedByPrelude},
// 2025-09-29 此源已停用
// @ref https://mirrors.jlu.edu.cn/_news/#2025-04-06-pypi-repo-down
// {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple", FeedByPrelude},
{&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/pypi-packages", FeedByPrelude},
{&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/pypi/simple", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/pypi/web/simple", FeedByPrelude},
{&Pku, "https://mirrors.pku.edu.cn/pypi/web/simple", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple", FeedByPrelude},
{&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple", // {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple",FeedByPrelude}
"https://pypi.tuna.tsinghua.edu.cn" PL_Python_Group_Speed_URL_Postfix}, {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple",FeedByPrelude},
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple",FeedByPrelude}
{&Ali, "https://mirrors.aliyun.com/pypi/simple/",
"https://mirrors.aliyun.com/pypi" PL_Python_Group_Speed_URL_Postfix},
{&Nju, "https://mirror.nju.edu.cn/pypi/web/simple",
"https://mirror.nju.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Pku, "https://mirrors.pku.edu.cn/pypi/web/simple",
"https://mirrors.pku.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple",
"https://mirrors.cloud.tencent.com/pypi" PL_Python_Group_Speed_URL_Postfix},
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple",
// "https://mirrors.cloud.tencentyun.com/pypi" PL_Python_Group_Speed_URL_Postfix,
{&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple",
"https://mirrors.huaweicloud.com/repository/pypi" PL_Python_Group_Speed_URL_Postfix},
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple",
"https://mirrors.hust.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
/* 不启用原因24小时更新一次 */ /* 不启用原因24小时更新一次 */
// {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL} // {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL}
}; def_sources_end()
def_sources_n(pl_python_group);
chef_set_sources_speed_measure_url_with_func (this, pl_python_speed_url_constructor, NULL);
}
void void
pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist, bool *uv_exist) pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist, bool *uv_exist)
@ -86,7 +82,7 @@ pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist, bool *uv_
/** /**
* @param[out] prog Python NULL * @param[out] prog_name Python NULL
*/ */
void void
pl_python_get_py_program_name (char **prog_name) pl_python_get_py_program_name (char **prog_name)

View File

@ -1,30 +1,60 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2023-09-03>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_python_pip, "pip");
* chsrc get pip
*/ void
pl_python_pip_prelude (void)
{
chef_prep_this (pl_python_pip, gsr);
chef_set_created_on (this, "2023-09-03");
chef_set_last_updated (this, "2025-09-12");
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, "@happy-game");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_python_group_target);
}
void void
pl_python_pip_getsrc (char *option) pl_python_pip_getsrc (char *option)
{ {
char *py_prog_name = NULL; char *py_prog_name = NULL;
pl_python_get_py_program_name (&py_prog_name); pl_python_get_py_program_name (&py_prog_name);
char *cmd = xy_2strjoin (py_prog_name, " -m pip config get global.index-url"); char *cmd = xy_2strcat (py_prog_name, " -m pip config get global.index-url");
chsrc_run (cmd, RunOpt_Default);
int status = chsrc_run_directly (cmd);
if (0 == status)
{
// 执行成功时显示当前源
xy_noop ();
}
else
{
// 执行失败时显示默认源
if (ENGLISH)
chsrc_note2 ("No source configured in pip, showing default upstream source:");
else
chsrc_note2 ("pip 中未配置源,显示默认上游源:");
Source_t default_source = chsrc_yield_source (&pl_python_group_target, "upstream");
say (default_source.url);
}
} }
/** /**
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ * @consult https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
*
* chsrc set pip
*/ */
void void
pl_python_pip_setsrc (char *option) pl_python_pip_setsrc (char *option)
@ -38,9 +68,9 @@ pl_python_pip_setsrc (char *option)
return; return;
} }
chsrc_yield_source (pl_python_group); Source_t source = chsrc_yield_source (&pl_python_group_target, option);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
chsrc_confirm_source(); chsrc_confirm_source(&source);
char *py_prog_name = NULL; char *py_prog_name = NULL;
pl_python_get_py_program_name (&py_prog_name); pl_python_get_py_program_name (&py_prog_name);
@ -48,7 +78,7 @@ pl_python_pip_setsrc (char *option)
// 这里用的是 config --user会写入用户目录而不是项目目录 // 这里用的是 config --user会写入用户目录而不是项目目录
// https://github.com/RubyMetric/chsrc/issues/39 // https://github.com/RubyMetric/chsrc/issues/39
// 经测试Windows上调用换源命令会写入 C:\Users\RubyMetric\AppData\Roaming\pip\pip.ini // 经测试Windows上调用换源命令会写入 C:\Users\RubyMetric\AppData\Roaming\pip\pip.ini
char *cmd = xy_2strjoin (py_prog_name, xy_2strjoin (" -m pip config --user set global.index-url ", source.url)); char *cmd = xy_2strcat (py_prog_name, xy_2strcat (" -m pip config --user set global.index-url ", source.url));
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
@ -59,36 +89,8 @@ pl_python_pip_setsrc (char *option)
} }
/**
* chsrc reset pip
*/
void void
pl_python_pip_resetsrc (char *option) pl_python_pip_resetsrc (char *option)
{ {
pl_python_pip_setsrc (option); pl_python_pip_setsrc (option);
} }
/**
* chsrc ls pip
*/
Feature_t
pl_python_pip_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
// pip 不支持项目级换源
f.cap_locally = CanNot;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_pip);
Target_t pl_python_pip_target = {def_target_inner_gsrf(pl_python_pip),def_target_sourcesn(pl_python_group)};

View File

@ -1,16 +1,16 @@
#pragma once #pragma once
/** /**
* Generated by rawstr4c v0.2.3-2025/07/22 * Generated by rawstr4c v1.0.0-2025/08/09
*/ */
char RAWSTR_pl_python_uv_config_source_content[] = "\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x0a\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x0a\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x0a\x0a"; char RAWSTR_pl_python_uv_config_source_content[] = "\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x0a\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x0a\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x0a";
char RAWSTR_pl_python_get_uv_config[] = "\x67\x72\x65\x70\x20\x2d\x41\x20\x32\x20\x27\x69\x6e\x64\x65\x78\x27\x20\x40\x66\x40\x20\x7c\x20\x73\x65\x64\x20\x2d\x6e\x20\x27\x73\x2f\x5e\x75\x72\x6c\x20\x3d\x20\x22\x5c\x28\x2e\x2a\x5c\x29\x22\x2f\x5c\x31\x2f\x70\x27\x0a"; char RAWSTR_pl_python_get_uv_config[] = "\x67\x72\x65\x70\x20\x2d\x41\x20\x32\x20\x27\x69\x6e\x64\x65\x78\x27\x20\x40\x66\x40\x20\x7c\x20\x73\x65\x64\x20\x2d\x6e\x20\x27\x73\x2f\x5e\x75\x72\x6c\x20\x3d\x20\x22\x5c\x28\x2e\x2a\x5c\x29\x22\x2f\x5c\x31\x2f\x70\x27";
char RAWSTR_pl_python_set_uv_config[] = "\x40\x73\x65\x64\x40\x20\x27\x2f\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x2f\x2c\x2f\x5e\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x24\x2f\x7b\x73\x7c\x5e\x75\x72\x6c\x20\x3d\x20\x22\x2e\x2a\x22\x24\x7c\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x7c\x7d\x27\x20\x40\x66\x40\x0a"; char RAWSTR_pl_python_set_uv_config[] = "\x40\x73\x65\x64\x40\x20\x27\x2f\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5c\x5d\x5c\x5d\x24\x2f\x2c\x2f\x5e\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x24\x2f\x7b\x73\x7c\x5e\x75\x72\x6c\x20\x3d\x20\x22\x2e\x2a\x22\x24\x7c\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x40\x22\x7c\x3b\x7d\x27\x20\x40\x66\x40";
char RAWSTR_pl_python_test_uv_if_set_source[] = "\x67\x72\x65\x70\x20\x2d\x71\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x24\x27\x20\x40\x66\x40\x0a"; char RAWSTR_pl_python_test_uv_if_set_source[] = "\x67\x72\x65\x70\x20\x2d\x71\x20\x27\x5e\x5c\x5b\x5c\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x24\x27\x20\x40\x66\x40";
char RAWSTR_pl_python_rye_config[] = "\x5b\x5b\x73\x6f\x75\x72\x63\x65\x73\x5d\x5d\x0a\x6e\x61\x6d\x65\x20\x3d\x20\x22\x40\x31\x40\x22\x0a\x75\x72\x6c\x20\x20\x3d\x20\x22\x40\x32\x40\x22\x0a"; char RAWSTR_pl_python_rye_config[] = "\x5b\x5b\x73\x6f\x75\x72\x63\x65\x73\x5d\x5d\x0a\x6e\x61\x6d\x65\x20\x3d\x20\x22\x40\x31\x40\x22\x0a\x75\x72\x6c\x20\x20\x3d\x20\x22\x40\x32\x40\x22";

View File

@ -6,7 +6,7 @@
! | happy game <happygame1024@gmail.com> ! | happy game <happygame1024@gmail.com>
! Contributors : Nil Null <nil@null.org> ! Contributors : Nil Null <nil@null.org>
! Created On : <2025-07-14> ! Created On : <2025-07-14>
! Last Modified : <2025-07-26> ! Last Modified : <2025-12-17>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# rawstr4c input for Python # rawstr4c input for Python
@ -14,7 +14,7 @@
- prefix = `RAWSTR_pl_python` - prefix = `RAWSTR_pl_python`
- output = `:global-variable-only-header` - output = `:global-variable-only-header`
- translate = `:hex` - translate = `:hex`
- keep-postfix = `false` - no-postfix = `true`
<br> <br>
@ -42,7 +42,7 @@ grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'
### Set uv config ### Set uv config
```sh ```sh
@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|}' @f@ @sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|;}' @f@
``` ```

View File

@ -1,15 +1,30 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : happy game <happygame1024@gmail.com>
* Contributors : ccy <icuichengyi@gmail.com>
* | Aoran Zeng <ccmywish@qq.com>
* |
* Created On : <2024-12-11>
* Major Revision : 1
* Last Modified : <2025-07-26>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
def_target(pl_python_uv, "uv");
void
pl_python_uv_prelude (void)
{
chef_prep_this (pl_python_uv, gsr);
chef_set_created_on (this, "2024-12-11");
chef_set_last_updated (this, "2025-12-17");
chef_set_sources_last_updated (this, "2025-08-09");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@happy-game");
chef_set_sauciers (this, 2, "@Kattos", "@ccmywish");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_use_other_target_sources (this, &pl_python_group_target);
}
/** /**
* chsrc get uv * chsrc get uv
* *
@ -30,11 +45,11 @@ pl_python_find_uv_config (bool mkdir)
{ {
if (chsrc_in_local_mode()) if (chsrc_in_local_mode())
{ {
return xy_2strjoin (PL_Python_uv_Local_ConfigPath, PL_Python_uv_ConfigFile); return xy_2strcat (PL_Python_uv_Local_ConfigPath, PL_Python_uv_ConfigFile);
} }
else else
{ {
if (xy_on_windows) if (xy.on_windows)
{ {
/* config path on Windows */ /* config path on Windows */
char *appdata = getenv ("APPDATA"); char *appdata = getenv ("APPDATA");
@ -45,12 +60,12 @@ pl_python_find_uv_config (bool mkdir)
return NULL; return NULL;
} }
char *config_dir = xy_2strjoin(appdata, "\\uv\\"); char *config_dir = xy_2strcat(appdata, "\\uv\\");
if (mkdir) if (mkdir)
{ {
chsrc_ensure_dir (config_dir); chsrc_ensure_dir (config_dir);
} }
return xy_2strjoin (config_dir, PL_Python_uv_ConfigFile); return xy_2strcat (config_dir, PL_Python_uv_ConfigFile);
} }
else else
{ {
@ -59,7 +74,7 @@ pl_python_find_uv_config (bool mkdir)
{ {
chsrc_ensure_dir (PL_Python_uv_User_ConfigPath); chsrc_ensure_dir (PL_Python_uv_User_ConfigPath);
} }
return xy_2strjoin (PL_Python_uv_User_ConfigPath, PL_Python_uv_ConfigFile); return xy_2strcat (PL_Python_uv_User_ConfigPath, PL_Python_uv_ConfigFile);
} }
} }
} }
@ -84,17 +99,15 @@ pl_python_uv_getsrc (char *option)
/** /**
* @consult https://docs.astral.sh/uv/configuration/files/ * @consult https://docs.astral.sh/uv/configuration/files/
* https://github.com/RubyMetric/chsrc/issues/139 * https://github.com/RubyMetric/chsrc/issues/139
*
* chsrc set uv
*/ */
void void
pl_python_uv_setsrc (char *option) pl_python_uv_setsrc (char *option)
{ {
chsrc_ensure_program ("uv"); chsrc_ensure_program ("uv");
chsrc_yield_source (pl_python_group); Source_t source = chsrc_yield_source (&pl_python_group_target, option);
if (chsrc_in_standalone_mode()) if (chsrc_in_standalone_mode())
chsrc_confirm_source(); chsrc_confirm_source(&source);
char *uv_config = pl_python_find_uv_config (true); char *uv_config = pl_python_find_uv_config (true);
if (NULL==uv_config) if (NULL==uv_config)
@ -106,7 +119,7 @@ pl_python_uv_setsrc (char *option)
const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url); const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url);
#if defined(XY_On_macOS) || defined(XY_On_BSD) #if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD)
char *sed_cmd = "sed -i '' "; char *sed_cmd = "sed -i '' ";
#else #else
char *sed_cmd = "sed -i "; char *sed_cmd = "sed -i ";
@ -119,8 +132,6 @@ pl_python_uv_setsrc (char *option)
update_config_cmd = xy_str_gsub (update_config_cmd, "@f@", uv_config); update_config_cmd = xy_str_gsub (update_config_cmd, "@f@", uv_config);
update_config_cmd = xy_str_gsub (update_config_cmd, "@url@", source.url); update_config_cmd = xy_str_gsub (update_config_cmd, "@url@", source.url);
char *append_config_cmd = xy_strjoin (4, "printf '", source_content, "' >> ", uv_config);
if (!xy_file_exist (uv_config)) if (!xy_file_exist (uv_config))
{ {
/* 当 uv_config 不存在,直接写入文件 */ /* 当 uv_config 不存在,直接写入文件 */
@ -131,7 +142,7 @@ pl_python_uv_setsrc (char *option)
/* 当 uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾 */ /* 当 uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾 */
char *cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source, "@f@", uv_config); char *cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source, "@f@", uv_config);
chsrc_ensure_program ("grep"); chsrc_ensure_program ("grep");
int status = system (cmd); int status = xy_run_get_status (cmd);
if (0==status) if (0==status)
{ {
chsrc_run (update_config_cmd, RunOpt_Default); chsrc_run (update_config_cmd, RunOpt_Default);
@ -150,36 +161,8 @@ pl_python_uv_setsrc (char *option)
} }
/**
* chsrc reset uv
*/
void void
pl_python_uv_resetsrc (char *option) pl_python_uv_resetsrc (char *option)
{ {
pl_python_uv_setsrc (option); pl_python_uv_setsrc (option);
} }
/**
* chsrc ls uv
*/
Feature_t
pl_python_uv_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = true;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_uv);
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python_group)};

View File

@ -1,30 +1,37 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-21>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(pl_r, "r/cran");
* @update 2023-09-04
* void
* @note pl_r_prelude ()
* bioconductor的镜像站
* cran的同时bioconductor
*/
static Source_t pl_r_sources[] =
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (pl_r, gs);
chef_set_created_on (this, "2023-09-21");
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, CanNot, NULL, NULL);
chef_deny_english(this);
chef_allow_user_define(this);
// 以下注释的是不含有bioconductor的镜像站我们在换cran的同时也直接帮助用户换bioconductor
def_sources_begin()
{&UpstreamProvider, "https://cran.r-project.org/", DelegateToUpstream},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/", DelegateToMirror},
// {&Ali, "https://mirrors.aliyun.com/CRAN/", DelegateToMirror}, // {&Ali, "https://mirrors.aliyun.com/CRAN/", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/", DelegateToMirror},
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN", DelegateToMirror}, // {&Sustech, "https://mirrors.sustech.edu.cn/CRAN", DelegateToMirror},
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/", DelegateToMirror}, // {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/", DelegateToMirror},
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/", DelegateToMirror}, // {&Bjtu, "https://mirror.bjtu.edu.cn/cran/", DelegateToMirror},
}; def_sources_end()
def_sources_n(pl_r); }
#define PL_R_Config_Windows "~/Documents/.Rprofile" #define PL_R_Config_Windows "~/Documents/.Rprofile"
@ -39,7 +46,7 @@ pl_r_getsrc (char *option)
* options()$repos * options()$repos
* options()$BioC_mirror * options()$BioC_mirror
*/ */
if (xy_on_windows) if (xy.on_windows)
{ {
chsrc_view_file (PL_R_Config_Windows); chsrc_view_file (PL_R_Config_Windows);
} }
@ -55,42 +62,21 @@ pl_r_getsrc (char *option)
void void
pl_r_setsrc (char *option) pl_r_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_r); chsrc_use_this_source (pl_r);
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/"); char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor"); bioconductor_url = xy_2strcat(bioconductor_url, "bioconductor");
const char *w1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))\n" ); const char *w1 = xy_strcat (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))\n" );
const char *w2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")\n" ); const char *w2 = xy_strcat (3, "options(BioC_mirror=\"", bioconductor_url, "\")\n" );
char *w = xy_2strjoin (w1, w2); char *w = xy_2strcat (w1, w2);
// 或者我们调用 r.exe --slave -e 上面的内容 // 或者我们调用 r.exe --slave -e 上面的内容
char *config = xy_on_windows ? PL_R_Config_Windows : PL_R_Config_POSIX; char *config = xy.on_windows ? PL_R_Config_Windows : PL_R_Config_POSIX;
chsrc_append_to_file (w, config); chsrc_append_to_file (w, config);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
Feature_t
pl_r_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NA;
f.can_english = false;
f.can_user_define = false;
f.note = NULL;
return f;
}
def_target_gsf(pl_r);

View File

@ -1,19 +1,7 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * 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-29>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_ruby_upstream =
{
def_upstream, "https://rubygems.org",
{NotSkip, NA, NA, "https://rubygems.org/gems/nokogiri-1.15.0-java.gem", ACCURATE}
};
static MirrorSite_t RubyChina = static MirrorSite_t RubyChina =
{ {
IS_DedicatedMirrorSite, IS_DedicatedMirrorSite,
@ -21,24 +9,38 @@ static MirrorSite_t RubyChina =
{NotSkip, NA, NA, "https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem", ACCURATE} // 9.9 MB {NotSkip, NA, NA, "https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem", ACCURATE} // 9.9 MB
}; };
/** def_target(pl_ruby, "gem/ruby/rb/rubygem/rubygems/bundler");
* @update 2024-12-18
*/ void
static Source_t pl_ruby_sources[] = pl_ruby_prelude (void)
{ {
{&pl_ruby_upstream, "https://rubygems.org", NULL}, chef_prep_this (pl_ruby, gsr);
{&RubyChina, "https://gems.ruby-china.com/", NULL},
{&Ustc, "https://mirrors.ustc.edu.cn/rubygems/", NULL}
// {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rubygems/", NULL}, chef_set_created_on (this, "2023-08-29");
// {&Bfsu, "https://mirrors.bfsu.edu.cn/rubygems/", NULL}, chef_set_last_updated (this, "2025-08-11");
chef_set_sources_last_updated (this, "2024-12-18");
// {&Tencent, "https://mirrors.tencent.com/rubygems/", NULL}, chef_set_chef (this, "@ccmywish");
// {&Tencent_Intra, "https://mirrors.tencentyun.com/rubygems/", NULL}, chef_set_cooks (this, 1, "@ccmywish");
// {&Ali, "https://mirrors.aliyun.com/rubygems/", NULL}, chef_set_sauciers (this, 1, "@BingChunMoLi");
// {&Huawei, "https://mirrors.huaweicloud.com/repository/rubygems/", NULL},
}; chef_allow_local_mode (this, PartiallyCan, "支持 bundler. 不支持 gem", "Support bundler. Not support gem");
def_sources_n(pl_ruby); chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://rubygems.org/", "https://rubygems.org/gems/nokogiri-1.15.0-java.gem"},
{&RubyChina, "https://gems.ruby-china.com/", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/rubygems/", DelegateToMirror}
// {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rubygems/", DelegateToMirror},
// {&Bfsu, "https://mirrors.bfsu.edu.cn/rubygems/", DelegateToMirror},
// {&Tencent, "https://mirrors.tencent.com/rubygems/", DelegateToMirror},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/rubygems/", DelegateToMirror},
// {&Ali, "https://mirrors.aliyun.com/rubygems/", DelegateToMirror},
// {&Huawei, "https://mirrors.huaweicloud.com/repository/rubygems/", DelegateToMirror},
def_sources_end()
}
void void
@ -48,15 +50,16 @@ pl_ruby_getsrc (char *option)
chsrc_run ("bundle config get mirror.https://rubygems.org", RunOpt_Default); chsrc_run ("bundle config get mirror.https://rubygems.org", RunOpt_Default);
} }
void bool
pl_ruby_remove_gem_source (const char *source) pl_ruby_remove_gem_source (const char *source)
{ {
char *cmd = NULL; char *cmd = NULL;
if (chef_is_url (source)) if (hp_is_url (source))
{ {
cmd = xy_2strjoin ("gem sources -r ", source); cmd = xy_2strcat ("gem sources -r ", source);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
} }
return false;
} }
/** /**
@ -67,15 +70,20 @@ pl_ruby_setsrc (char *option)
{ {
chsrc_ensure_program ("gem"); chsrc_ensure_program ("gem");
chsrc_yield_source_and_confirm (pl_ruby); chsrc_use_this_source (pl_ruby);
char *cmd = NULL; char *cmd = NULL;
xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source); // step1
xy_run_iter_lines ("gem sources -l", 0, pl_ruby_remove_gem_source);
cmd = xy_2strjoin ("gem source -a ", source.url); cmd = xy_2strcat ("gem source -a ", source.url);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
// 我们在 step1 中,把源全部清空了,但是现在 RubyGems 的行为是: 当清空会自动给你把默认源给加回来
// 所以我们在这一步,最后一次删除默认源,确保它不存在
pl_ruby_remove_gem_source (this->sources[0].url);
chsrc_ensure_program ("bundle"); chsrc_ensure_program ("bundle");
@ -85,7 +93,7 @@ pl_ruby_setsrc (char *option)
where = " --local "; where = " --local ";
} }
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url); cmd = xy_strcat (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_No_Last_New_Line);
chsrc_determine_chgtype (ChgType_Auto); chsrc_determine_chgtype (ChgType_Auto);
@ -97,24 +105,3 @@ pl_ruby_resetsrc (char *option)
{ {
pl_ruby_setsrc (option); pl_ruby_setsrc (option);
} }
Feature_t
pl_ruby_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = PartiallyCan;
f.cap_locally_explain = "Support `bundler`. No support for `gem`";
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsrf(pl_ruby);

View File

@ -1,116 +1,189 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
* |
* Created On : <2023-08-30>
* Last Modified : <2025-07-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_rust_cargo_upstream = def_target(pl_rust_cargo, "rust/cargo/crate/crates");
void
pl_rust_cargo_prelude (void)
{ {
def_upstream, "https://crates.io/", chef_prep_this (pl_rust_cargo, gsr);
{NotSkip, NA, NA, "https://crates.io/api/v1/crates/windows/0.58.0/download", ACCURATE}
/* 跳转为: https://static.crates.io/crates/windows/windows-0.58.0.crate */ chef_set_created_on (this, "2023-08-30");
}; chef_set_last_updated (this, "2025-10-06");
chef_set_sources_last_updated (this, "2025-06-18");
chef_set_chef (this, NULL);
chef_set_cooks (this, 2, "@Mikachu2333", "@ccmywish");
chef_set_sauciers (this, 1, "@happy-game");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_deny_english (this);
chef_allow_user_define (this);
/** // 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`。链接末尾的 `/` 不能缺少
* @update 2025-06-18 def_sources_begin()
* {&UpstreamProvider, "https://crates.io/", FeedByPrelude},
* @note `sparse+` {&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/", FeedByPrelude},
* @note `/` {&RsProxyCN, "https://rsproxy.cn/index/", FeedByPrelude},
*/ {&Ali, "https://mirrors.aliyun.com/crates.io-index/", FeedByPrelude},
static Source_t pl_rust_cargo_sources[] = {&Zju, "https://mirrors.zju.edu.cn/crates.io-index/", FeedByPrelude},
{
{&pl_rust_cargo_upstream, "https://github.com/rust-lang/crates.io-index/", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/", DelegateToMirror},
{&RsProxyCN, "https://rsproxy.cn/index/", DelegateToMirror},
{&Ali, "https://mirrors.aliyun.com/crates.io-index/",
"https://mirrors.aliyun.com/crates/api/v1/crates/windows/0.58.0/download"},
{&Zju, "https://mirrors.zju.edu.cn/crates.io-index/", DelegateToMirror},
/* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */ /* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */
// {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/", DelegateToMirror}, // {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/",FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/",
"https://crates-io.proxy.ustclug.org/api/v1/crates/windows/0.58.0/download"},
/* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */ /* 注释原因: (2025-06-17) 镜像同步失败,多数包都不可用 */
// {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/", DelegateToMirror}, // {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/", FeedByPrelude},
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/", DelegateToMirror} {&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/", FeedByPrelude}
}; def_sources_end()
def_sources_n(pl_rust_cargo);
chef_set_sources_speed_measure_url_with_postfix (this, "api/v1/crates/windows/0.58.0/download");
}
/** void
* chsrc get cargo pl_rust_cargo_note_get_src_default ()
*/ {
if (ENGLISH)
chsrc_note2 ("No source configured in Cargo, showing default upstream source:");
else
chsrc_note2 ("Cargo 中未自定义源,显示默认源:");
Source_t default_source = chsrc_yield_source (&pl_rust_cargo_target, "upstream");
say (default_source.url);
}
void
pl_rust_cargo_note_get_src_mirror (char *url, bool sparse)
{
chsrc_note2 (ENGLISH ? "Custom source found: " : "已找到自定义源:");
say (xy_2strcat (url, sparse ? " (sparse)" : ""));
}
void void
pl_rust_cargo_getsrc (char *option) pl_rust_cargo_getsrc (char *option)
{ {
chsrc_view_file ("~/.cargo/config.toml"); char *cargo_config_file = xy_normalize_path ("~/.cargo/config.toml");
char *raw_content = xy_file_read (cargo_config_file);
char *formatted_content = xy_str_gsub (raw_content, " ", "");
formatted_content = xy_str_gsub (formatted_content, "'", "\"");
XyStrFindResult_t result_has_mirror = xy_str_find (formatted_content, "replace-with");
if (result_has_mirror.found)
{
char *mirror_name = xy_str_next_nonempty_line (formatted_content + result_has_mirror.end + 1);
mirror_name = xy_str_delete_prefix (mirror_name, "=\"");
mirror_name = xy_str_delete_suffix (mirror_name, "\"");
XyStrFindResult_t result_mirror = xy_str_find (formatted_content, xy_strcat (3, "[source.", mirror_name, "]"));
if (!result_mirror.found)
{
pl_rust_cargo_note_get_src_default();
return;
}
char *mirror_url = xy_str_next_nonempty_line (formatted_content + result_mirror.end + 1);
mirror_url = xy_str_delete_prefix (mirror_url, "registry=\"");
mirror_url = xy_str_delete_suffix (mirror_url, "\"");
if (xy_str_find (mirror_url, "sparse+").found)
{
pl_rust_cargo_note_get_src_mirror (xy_str_delete_prefix (mirror_url, "sparse+"), true);
}
}
else
{
pl_rust_cargo_note_get_src_default();
}
} }
void
pl_write_rust_config (const char *path, const char *url)
{
remove (path);
char *content = RAWSTR_pl_rust_cargo_config;
content = xy_str_gsub (content, "@url@", url);
chsrc_overwrite_file (content, path);
}
/** /**
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index/ * @consult https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index/
* @consult https://help.mirrors.cernet.edu.cn/crates.io-index * @consult https://help.mirrors.cernet.edu.cn/crates.io-index
*
* chsrc set cargo
*/ */
void void
pl_rust_cargo_setsrc (char *option) pl_rust_cargo_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_rust_cargo); chsrc_ensure_program ("cargo");
char *content = RAWSTR_pl_rust_cargo_config; chsrc_use_this_source (pl_rust_cargo);
content = xy_str_gsub (content, "@url@", source.url); char *default_content = RAWSTR_pl_rust_cargo_config;
char *cargo_config_dir = "~/.cargo/";
char *cargo_config_file = xy_2strcat (cargo_config_dir, "config.toml");
chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:")); chsrc_ensure_dir (cargo_config_dir);
print (content);
cargo_config_file = xy_normalize_path (cargo_config_file);
if (xy_file_exist (cargo_config_file))
{
chsrc_backup (cargo_config_file);
char *raw_content = xy_file_read (cargo_config_file);
XyStrFindResult_t result_has_mirror = xy_str_find (raw_content, "replace-with");
if (!result_has_mirror.found)
{
pl_write_rust_config (cargo_config_file, source.url);
goto finish;
}
char *mirror_name = xy_str_next_nonempty_line (raw_content + result_has_mirror.end + 1);
mirror_name = xy_str_gsub (mirror_name, " ", "");
mirror_name = xy_str_gsub (mirror_name, "'", "\"");
mirror_name = xy_str_delete_prefix (mirror_name, "=\"");
mirror_name = xy_str_delete_suffix (mirror_name, "\"");
XyStrFindResult_t result_mirror = xy_str_find (raw_content, xy_strcat (3, "[source.", mirror_name, "]"));
if (!result_mirror.found)
{
pl_write_rust_config (cargo_config_file, source.url);
goto finish;
}
char *mirror_url = xy_str_next_nonempty_line (raw_content + result_mirror.end + 1);
mirror_url = xy_str_gsub (mirror_url, " ", "");
if (!xy_str_find (mirror_url, "registry").found)
{
pl_write_rust_config (cargo_config_file, source.url);
goto finish;
}
mirror_url = xy_str_delete_prefix (mirror_url, "registry=\"");
mirror_url = xy_str_delete_suffix (mirror_url, "\"");
char *final_content = xy_str_gsub (raw_content, mirror_url, xy_2strcat ("sparse+", source.url));
chsrc_overwrite_file (final_content, cargo_config_file);
goto finish;
}
pl_write_rust_config (cargo_config_file, source.url);
goto finish;
finish:
chsrc_determine_chgtype (ChgType_Auto); chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source); chsrc_conclude (&source);
} }
/**
* chsrc reset cargo
*/
void void
pl_rust_cargo_resetsrc (char *option) pl_rust_cargo_resetsrc (char *option)
{ {
pl_rust_cargo_setsrc (option); pl_rust_cargo_setsrc (option);
} }
Feature_t
pl_rust_cargo_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = PartiallyCan;
f.cap_locally_explain = "可以基于本项目换源吗?请帮助确认";
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsrf(pl_rust_cargo);

View File

@ -1,40 +1,48 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Yangmoooo <yangmoooo@outlook.com>
* | Mikachu2333 <mikachu.23333@zohomail.com>
* |
* Created On : <2024-10-02>
* Last Modified : <2025-06-19>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t pl_rust_binary_upstream = // Size: 20MB
#define PL_Rustup_Speed_URL_Suffix
def_target(pl_rust_rustup, "rustup");
void
pl_rust_rustup_prelude (void)
{ {
def_upstream, "https://www.rust-lang.org/", chef_prep_this (pl_rust_rustup, gsr);
def_need_measure_info
}; chef_set_created_on (this, "2024-10-02");
chef_set_last_updated (this, "2025-08-07");
chef_set_sources_last_updated (this, "2025-08-07");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 2, "@Yangmoooo", "@Mikachu2333");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english (this);
chef_allow_user_define(this);
def_sources_begin()
{&UpstreamProvider, "https://static.rust-lang.org", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/rustup", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/rust-static", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/rustup", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static", FeedByPrelude},
{&Zju, "https://mirrors.zju.edu.cn/rustup", FeedByPrelude},
{&Iscas, "https://mirror.iscas.ac.cn/rustup", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/rustup", FeedByPrelude},
{&RsProxyCN, "https://rsproxy.cn", FeedByPrelude}
def_sources_end()
// 20MB大小
chef_set_sources_speed_measure_url_with_postfix (this, "/dist/2025-06-26/cargo-1.88.0-x86_64-unknown-illumos.tar.gz");
}
/**
* @update 2025-06-17
*/
static Source_t pl_rust_rustup_sources[] = {
{&pl_rust_binary_upstream, "https://static.rust-lang.org", NULL},
{&MirrorZ, "https://mirrors.cernet.edu.cn/rustup", NULL},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup", NULL},
{&Ustc, "https://mirrors.ustc.edu.cn/rust-static", NULL},
{&Nju, "https://mirror.nju.edu.cn/rustup", NULL},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static", NULL},
{&Zju, "https://mirrors.zju.edu.cn/rustup", NULL},
{&Iscas, "https://mirror.iscas.ac.cn/rustup", NULL},
{&Ali, "https://mirrors.aliyun.com/rustup", NULL},
{&RsProxyCN, "https://rsproxy.cn"}};
def_sources_n(pl_rust_rustup);
/**
* chsrc get rustup
*/
void void
pl_rust_rustup_getsrc (char *option) pl_rust_rustup_getsrc (char *option)
{ {
@ -44,28 +52,26 @@ pl_rust_rustup_getsrc (char *option)
/** /**
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/rustup/ * @consult https://mirrors.tuna.tsinghua.edu.cn/help/rustup/
*
* chsrc set rustup
*/ */
void void
pl_rust_rustup_setsrc (char *option) pl_rust_rustup_setsrc (char *option)
{ {
chsrc_yield_source_and_confirm (pl_rust_rustup); chsrc_use_this_source (pl_rust_rustup);
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
char *cmd1 = xy_strjoin (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\""); char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\"");
char *cmd2 = xy_strjoin (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\""); char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\"");
char *cmd = xy_strjoin (3, cmd1, " & ", cmd2); char *cmd = xy_strcat (3, cmd1, " & ", cmd2);
chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line); chsrc_run (cmd, RunOpt_Dont_Notify_On_Success|RunOpt_No_Last_New_Line);
#else #else
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n"); char *w1 = xy_strcat (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
char *w2 = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n"); char *w2 = xy_strcat (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n");
char *w = xy_2strjoin (w1, w2); char *w = xy_2strcat (w1, w2);
char *bashrc = xy_bashrc; char *bashrc = xy_bashrc;
if (xy_file_exist (bashrc)) if (xy_file_exist (bashrc))
@ -84,10 +90,10 @@ pl_rust_rustup_setsrc (char *option)
char *fishrc = xy_fishrc; char *fishrc = xy_fishrc;
if (xy_file_exist (fishrc)) if (xy_file_exist (fishrc))
{ {
char *w1 = xy_strjoin (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n"); char *w1 = xy_strcat (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n");
char *w2 = xy_strjoin (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n"); char *w2 = xy_strcat (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n");
char *w = xy_2strjoin (w1, w2); char *w = xy_2strcat (w1, w2);
chsrc_backup (fishrc); chsrc_backup (fishrc);
chsrc_append_to_file (w, fishrc); chsrc_append_to_file (w, fishrc);
@ -100,35 +106,9 @@ pl_rust_rustup_setsrc (char *option)
} }
/**
* chsrc reset rustup
*/
void void
pl_rust_rustup_resetsrc (char *option) pl_rust_rustup_resetsrc (char *option)
{ {
pl_rust_rustup_setsrc (option); pl_rust_rustup_setsrc (option);
} }
/**
* chsrc ls rustup
*/
Feature_t
pl_rust_rustup_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = "";
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsrf(pl_rust_rustup);

View File

@ -1,22 +1,22 @@
#pragma once #pragma once
/** /**
* Generated by rawstr4c v0.2.3-2025/07/22 * Generated by rawstr4c v1.0.0-2025/08/09
*/ */
char RAWSTR_pl_nodejs_bun_config[] = "\133\151\156\163\164\141\154\154\135\012\162\145\147\151\163\164\162\171\040\075\040\042\100\165\162\154\100\042\012"; char RAWSTR_pl_js_bun_config[] = "\133\151\156\163\164\141\154\154\135\012\162\145\147\151\163\164\162\171\040\075\040\042\100\165\162\154\100\042";
char RAWSTR_pl_java_maven_config[] = "\074\155\151\162\162\157\162\076\012\040\040\040\040\074\151\144\076\100\061\100\074\057\151\144\076\012\040\040\040\040\074\155\151\162\162\157\162\117\146\076\052\074\057\155\151\162\162\157\162\117\146\076\012\040\040\040\040\074\156\141\155\145\076\100\156\141\155\145\100\074\057\156\141\155\145\076\012\040\040\040\040\074\165\162\154\076\100\165\162\154\100\074\057\165\162\154\076\012\074\057\155\151\162\162\157\162\076\012"; char RAWSTR_pl_java_maven_config[] = "\074\155\151\162\162\157\162\076\012\040\040\040\040\074\151\144\076\100\061\100\074\057\151\144\076\012\040\040\040\040\074\155\151\162\162\157\162\117\146\076\052\074\057\155\151\162\162\157\162\117\146\076\012\040\040\040\040\074\156\141\155\145\076\100\156\141\155\145\100\074\057\156\141\155\145\076\012\040\040\040\040\074\165\162\154\076\100\165\162\154\100\074\057\165\162\154\076\012\074\057\155\151\162\162\157\162\076";
char RAWSTR_pl_java_build_gradle[] = "\141\154\154\160\162\157\152\145\143\164\163\040\173\012\040\040\040\040\162\145\160\157\163\151\164\157\162\151\145\163\040\173\012\040\040\040\040\040\040\040\040\155\141\166\145\156\040\173\040\165\162\154\040\047\100\165\162\154\100\047\040\175\012\040\040\040\040\040\040\040\040\155\141\166\145\156\114\157\143\141\154\050\051\012\040\040\040\040\040\040\040\040\155\141\166\145\156\103\145\156\164\162\141\154\050\051\012\040\040\040\040\175\012\175\012"; char RAWSTR_pl_java_build_gradle[] = "\141\154\154\160\162\157\152\145\143\164\163\040\173\012\040\040\040\040\162\145\160\157\163\151\164\157\162\151\145\163\040\173\012\040\040\040\040\040\040\040\040\155\141\166\145\156\040\173\040\165\162\154\040\047\100\165\162\154\100\047\040\175\012\040\040\040\040\040\040\040\040\155\141\166\145\156\114\157\143\141\154\050\051\012\040\040\040\040\040\040\040\040\155\141\166\145\156\103\145\156\164\162\141\154\050\051\012\040\040\040\040\175\012\175";
char RAWSTR_pl_rust_cargo_config[] = "\133\163\157\165\162\143\145\056\143\162\141\164\145\163\055\151\157\135\012\162\145\160\154\141\143\145\055\167\151\164\150\040\075\040\047\155\151\162\162\157\162\047\012\012\133\163\157\165\162\143\145\056\155\151\162\162\157\162\135\012\162\145\147\151\163\164\162\171\040\075\040\042\163\160\141\162\163\145\053\100\165\162\154\100\042\012"; char RAWSTR_pl_rust_cargo_config[] = "\133\163\157\165\162\143\145\056\143\162\141\164\145\163\055\151\157\135\012\162\145\160\154\141\143\145\055\167\151\164\150\040\075\040\042\155\151\162\162\157\162\042\012\012\133\163\157\165\162\143\145\056\155\151\162\162\157\162\135\012\162\145\147\151\163\164\162\171\040\075\040\042\163\160\141\162\163\145\053\100\165\162\154\100\042\012";
char RAWSTR_pl_haskell_cabal_config[] = "\162\145\160\157\163\151\164\157\162\171\040\155\151\162\162\157\162\012\040\040\165\162\154\072\040\100\165\162\154\100\012\040\040\163\145\143\165\162\145\072\040\124\162\165\145\012"; char RAWSTR_pl_haskell_cabal_config[] = "\162\145\160\157\163\151\164\157\162\171\040\155\151\162\162\157\162\012\040\040\165\162\154\072\040\100\165\162\154\100\012\040\040\163\145\143\165\162\145\072\040\124\162\165\145";
char RAWSTR_pl_haskell_stackage_yaml[] = "\160\141\143\153\141\147\145\055\151\156\144\145\170\072\012\040\040\144\157\167\156\154\157\141\144\055\160\162\145\146\151\170\072\040\100\165\162\154\100\012\040\040\150\141\143\153\141\147\145\055\163\145\143\165\162\151\164\171\072\012\040\040\040\040\153\145\171\151\144\163\072\012\040\040\040\040\040\040\055\040\060\141\065\143\067\145\141\064\067\143\144\061\142\061\065\146\060\061\146\065\146\065\061\141\063\063\141\144\144\141\067\145\066\065\065\142\143\060\146\060\142\060\066\061\065\142\141\141\070\145\062\067\061\146\064\143\063\063\065\061\145\062\061\144\012\040\040\040\040\040\040\055\040\061\145\141\071\142\141\063\062\143\065\062\066\144\061\143\143\071\061\141\142\065\145\065\142\144\063\066\064\145\143\065\145\071\145\070\143\142\066\067\061\067\071\141\064\067\061\070\067\062\146\066\145\062\066\146\060\141\145\067\067\063\144\064\062\012\040\040\040\040\040\040\055\040\062\070\060\142\061\060\061\065\063\141\065\062\062\066\070\061\061\066\063\066\065\070\143\142\064\071\146\066\063\062\143\144\145\063\146\063\070\144\067\066\070\142\067\063\066\144\144\142\143\071\060\061\144\071\071\141\061\141\067\067\062\070\063\063\012\040\040\040\040\040\040\055\040\062\141\071\066\142\061\070\070\071\144\143\062\062\061\143\061\067\062\071\066\146\143\143\062\142\142\063\064\142\071\060\070\143\141\071\067\063\064\063\067\066\146\060\146\063\066\061\066\066\060\062\060\060\071\063\065\071\061\066\145\146\062\060\061\012\040\040\040\040\040\040\055\040\062\143\066\143\063\066\062\067\142\144\066\143\071\070\062\071\071\060\062\063\071\064\070\067\146\061\141\142\144\060\062\145\060\070\141\060\062\145\066\143\146\061\066\145\144\142\061\060\065\141\070\060\061\062\144\064\064\064\144\070\067\060\143\063\012\040\040\040\040\040\040\055\040\065\061\146\060\061\066\061\142\071\060\066\060\061\061\142\065\062\143\066\066\061\063\063\067\066\142\061\141\145\071\063\067\066\067\060\144\141\066\071\063\062\062\061\061\063\141\062\064\066\141\060\071\146\070\060\067\143\066\062\146\066\071\062\061\012\040\040\040\040\040\040\055\040\067\067\062\145\071\146\064\143\067\144\142\063\063\144\062\065\061\144\065\143\066\145\063\065\067\061\071\071\143\070\061\071\145\065\066\071\144\061\063\060\070\065\067\144\143\062\062\065\065\064\071\142\064\060\070\064\065\146\146\060\070\071\060\144\012\040\040\040\040\040\040\055\040\141\141\063\061\065\062\070\066\145\066\141\144\062\070\061\141\144\066\061\061\070\062\062\063\065\065\063\063\143\064\061\145\070\060\066\145\065\141\067\070\067\145\060\142\066\144\061\145\067\145\145\146\063\146\060\071\144\061\063\067\144\062\145\071\012\040\040\040\040\040\040\055\040\146\145\063\063\061\065\060\062\066\060\066\070\060\062\146\145\141\143\061\065\145\065\061\064\144\071\142\071\145\141\070\063\146\145\145\070\142\066\146\146\145\146\067\061\063\063\065\064\067\071\141\062\145\066\070\144\070\064\141\144\143\066\142\060\012\040\040\040\040\153\145\171\055\164\150\162\145\163\150\157\154\144\072\040\063\040\043\040\156\165\155\142\145\162\040\157\146\040\153\145\171\163\040\162\145\161\165\151\162\145\144\012\040\040\040\040\043\040\151\147\156\157\162\145\040\145\170\160\151\162\141\164\151\157\156\040\144\141\164\145\054\040\163\145\145\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\143\157\155\155\145\162\143\151\141\154\150\141\163\153\145\154\154\057\163\164\141\143\153\057\160\165\154\154\057\064\066\061\064\012\040\040\040\040\151\147\156\157\162\145\055\145\170\160\151\162\171\072\040\156\157\012"; char RAWSTR_pl_haskell_stackage_yaml[] = "\160\141\143\153\141\147\145\055\151\156\144\145\170\072\012\040\040\144\157\167\156\154\157\141\144\055\160\162\145\146\151\170\072\040\100\165\162\154\100\012\040\040\150\141\143\153\141\147\145\055\163\145\143\165\162\151\164\171\072\012\040\040\040\040\153\145\171\151\144\163\072\012\040\040\040\040\040\040\055\040\060\141\065\143\067\145\141\064\067\143\144\061\142\061\065\146\060\061\146\065\146\065\061\141\063\063\141\144\144\141\067\145\066\065\065\142\143\060\146\060\142\060\066\061\065\142\141\141\070\145\062\067\061\146\064\143\063\063\065\061\145\062\061\144\012\040\040\040\040\040\040\055\040\061\145\141\071\142\141\063\062\143\065\062\066\144\061\143\143\071\061\141\142\065\145\065\142\144\063\066\064\145\143\065\145\071\145\070\143\142\066\067\061\067\071\141\064\067\061\070\067\062\146\066\145\062\066\146\060\141\145\067\067\063\144\064\062\012\040\040\040\040\040\040\055\040\062\070\060\142\061\060\061\065\063\141\065\062\062\066\070\061\061\066\063\066\065\070\143\142\064\071\146\066\063\062\143\144\145\063\146\063\070\144\067\066\070\142\067\063\066\144\144\142\143\071\060\061\144\071\071\141\061\141\067\067\062\070\063\063\012\040\040\040\040\040\040\055\040\062\141\071\066\142\061\070\070\071\144\143\062\062\061\143\061\067\062\071\066\146\143\143\062\142\142\063\064\142\071\060\070\143\141\071\067\063\064\063\067\066\146\060\146\063\066\061\066\066\060\062\060\060\071\063\065\071\061\066\145\146\062\060\061\012\040\040\040\040\040\040\055\040\062\143\066\143\063\066\062\067\142\144\066\143\071\070\062\071\071\060\062\063\071\064\070\067\146\061\141\142\144\060\062\145\060\070\141\060\062\145\066\143\146\061\066\145\144\142\061\060\065\141\070\060\061\062\144\064\064\064\144\070\067\060\143\063\012\040\040\040\040\040\040\055\040\065\061\146\060\061\066\061\142\071\060\066\060\061\061\142\065\062\143\066\066\061\063\063\067\066\142\061\141\145\071\063\067\066\067\060\144\141\066\071\063\062\062\061\061\063\141\062\064\066\141\060\071\146\070\060\067\143\066\062\146\066\071\062\061\012\040\040\040\040\040\040\055\040\067\067\062\145\071\146\064\143\067\144\142\063\063\144\062\065\061\144\065\143\066\145\063\065\067\061\071\071\143\070\061\071\145\065\066\071\144\061\063\060\070\065\067\144\143\062\062\065\065\064\071\142\064\060\070\064\065\146\146\060\070\071\060\144\012\040\040\040\040\040\040\055\040\141\141\063\061\065\062\070\066\145\066\141\144\062\070\061\141\144\066\061\061\070\062\062\063\065\065\063\063\143\064\061\145\070\060\066\145\065\141\067\070\067\145\060\142\066\144\061\145\067\145\145\146\063\146\060\071\144\061\063\067\144\062\145\071\012\040\040\040\040\040\040\055\040\146\145\063\063\061\065\060\062\066\060\066\070\060\062\146\145\141\143\061\065\145\065\061\064\144\071\142\071\145\141\070\063\146\145\145\070\142\066\146\146\145\146\067\061\063\063\065\064\067\071\141\062\145\066\070\144\070\064\141\144\143\066\142\060\012\040\040\040\040\153\145\171\055\164\150\162\145\163\150\157\154\144\072\040\063\040\043\040\156\165\155\142\145\162\040\157\146\040\153\145\171\163\040\162\145\161\165\151\162\145\144\012\040\040\040\040\043\040\151\147\156\157\162\145\040\145\170\160\151\162\141\164\151\157\156\040\144\141\164\145\054\040\163\145\145\040\150\164\164\160\163\072\057\057\147\151\164\150\165\142\056\143\157\155\057\143\157\155\155\145\162\143\151\141\154\150\141\163\153\145\154\154\057\163\164\141\143\153\057\160\165\154\154\057\064\066\061\064\012\040\040\040\040\151\147\156\157\162\145\055\145\170\160\151\162\171\072\040\156\157";
char RAWSTR_pl_clojure_project_clj[] = "\050\144\145\146\160\162\157\152\145\143\164\040\155\171\141\160\160\040\042\061\056\060\056\060\042\012\040\040\040\072\144\145\163\143\162\151\160\164\151\157\156\040\042\115\171\040\101\160\160\154\151\143\141\164\151\157\156\042\012\040\040\040\072\144\145\160\145\156\144\145\156\143\151\145\163\040\133\133\154\151\142\061\040\042\061\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\062\040\042\062\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\063\040\042\063\056\060\056\060\042\135\135\012\040\040\040\072\155\151\162\162\157\162\163\040\173\042\143\154\157\152\141\162\163\042\040\173\072\156\141\155\145\040\042\155\151\162\162\157\162\042\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\072\165\162\154\040\042\100\165\162\154\100\042\175\175\012\040\040\040\072\155\141\151\156\040\154\145\151\156\151\156\147\145\156\056\167\145\142\051\012"; char RAWSTR_pl_clojure_project_clj[] = "\050\144\145\146\160\162\157\152\145\143\164\040\155\171\141\160\160\040\042\061\056\060\056\060\042\012\040\040\040\072\144\145\163\143\162\151\160\164\151\157\156\040\042\115\171\040\101\160\160\154\151\143\141\164\151\157\156\042\012\040\040\040\072\144\145\160\145\156\144\145\156\143\151\145\163\040\133\133\154\151\142\061\040\042\061\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\062\040\042\062\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\063\040\042\063\056\060\056\060\042\135\135\012\040\040\040\072\155\151\162\162\157\162\163\040\173\042\143\154\157\152\141\162\163\042\040\173\072\156\141\155\145\040\042\155\151\162\162\157\162\042\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\072\165\162\154\040\042\100\165\162\154\100\042\175\175\012\040\040\040\072\155\141\151\156\040\154\145\151\156\151\156\147\145\156\056\167\145\142\051";
char RAWSTR_pl_clojure_projfiles_clj[] = "\072\165\163\145\162\040\173\072\162\145\160\157\163\151\164\157\162\151\145\163\040\133\133\042\143\154\157\152\141\162\163\042\040\173\072\165\162\154\040\042\100\165\162\154\100\042\175\135\135\012\040\040\040\040\040\040\040\073\073\040\157\164\150\145\162\040\072\165\163\145\162\040\160\162\157\146\151\154\145\040\163\145\164\164\151\156\147\163\012\040\040\040\040\040\040\175\012"; char RAWSTR_pl_clojure_projfiles_clj[] = "\072\165\163\145\162\040\173\072\162\145\160\157\163\151\164\157\162\151\145\163\040\133\133\042\143\154\157\152\141\162\163\042\040\173\072\165\162\154\040\042\100\165\162\154\100\042\175\135\135\012\040\040\040\040\040\040\040\073\073\040\157\164\150\145\162\040\072\165\163\145\162\040\160\162\157\146\151\154\145\040\163\145\164\164\151\156\147\163\012\040\040\040\040\040\040\175";

View File

@ -3,9 +3,9 @@
! ------------------------------------------------------------- ! -------------------------------------------------------------
! Config Type : rawstr4c (Markdown) ! Config Type : rawstr4c (Markdown)
! Config Authors: Aoran Zeng <ccmywish@qq.com> ! Config Authors: Aoran Zeng <ccmywish@qq.com>
! Contributors : Nil Null <nil@null.org> ! Contributors : Happy Game <happygame1024@gmail.com>
! Created On : <2025-07-14> ! Created On : <2025-07-14>
! Last Modified : <2025-07-22> ! Last Modified : <2025-09-13>
! ---------------------------------------------------------- --> ! ---------------------------------------------------------- -->
# rawstr4c input for PL # rawstr4c input for PL
@ -13,7 +13,7 @@
- prefix = `RAWSTR_pl` - prefix = `RAWSTR_pl`
- output = `:global-variable-only-header` - output = `:global-variable-only-header`
- translate = `:oct` - translate = `:oct`
- keep-postfix = `false` - no-postfix = `true`
<br> <br>
@ -75,10 +75,11 @@ allprojects {
```toml ```toml
[source.crates-io] [source.crates-io]
replace-with = 'mirror' replace-with = "mirror"
[source.mirror] [source.mirror]
registry = "sparse+@url@" registry = "sparse+@url@"
``` ```
<br> <br>
@ -101,7 +102,7 @@ repository mirror
### stackage ### stackage
- name = `stackage` - name = `stackage`
- keep-postfix = `true` - no-postfix = `false`
- postfix = `yaml` - postfix = `yaml`
```yaml ```yaml

View File

@ -1,150 +1,201 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : <ccmywish@qq.com>
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com> * Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
* | * |
* Created On : <2023-09-01> * Created On : <2023-09-01>
* Major Revision : 1 * Major Revision : 5
* Last Modified : <2025-07-21> * Last Modified : <2025-08-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/* Begin Target Matrix */ #include "lang/rawstr4c.h"
#define t(a) (const char*)(a)
static const char
*pl_ruby [] = {"gem", "ruby", "rb", "rubygem", "rubygems", "bundler", NULL, t(&pl_ruby_target)},
*pl_python[] = {"python", "pypi", "py", NULL, t(&pl_python_group_target)}, #include "lang/Ruby/Ruby.c"
*pl_python_pip[] = {"pip", NULL, t(&pl_python_pip_target)}, #include "lang/Python/common.h"
*pl_python_poetry[] = {"poetry", NULL, t(&pl_python_poetry_target)}, #include "lang/Python/pip.c"
*pl_python_pdm[] = {"pdm", NULL, t(&pl_python_pdm_target)}, #include "lang/Python/Poetry.c"
*pl_python_rye[] = {"rye", NULL, t(&pl_python_rye_target)}, #include "lang/Python/PDM.c"
*pl_python_uv[] = {"uv", NULL, t(&pl_python_uv_target)}, #include "lang/Python/Rye.c"
#include "lang/Python/uv.c"
#include "lang/Python/Python.c"
*pl_nodejs[] = {"node", "nodejs", NULL, t(&pl_nodejs_group_target)}, #include "lang/JavaScript/common.h"
*pl_nodejs_bun[] = {"bun", NULL, t(&pl_nodejs_bun_target)}, #include "lang/JavaScript/npm.c"
*pl_nodejs_npm[] = {"npm", NULL, t(&pl_nodejs_npm_target)}, #include "lang/JavaScript/pnpm.c"
*pl_nodejs_yarn[] = {"yarn", NULL, t(&pl_nodejs_yarn_target)}, #include "lang/JavaScript/Yarn.c"
*pl_nodejs_pnpm[] = {"pnpm", NULL, t(&pl_nodejs_pnpm_target)}, #include "lang/JavaScript/JavaScript.c"
*pl_nodejs_nvm[] = {"nvm", NULL, t(&pl_nodejs_nvm_target)}, #include "lang/JavaScript/Bun.c"
#include "lang/JavaScript/nvm.c"
*pl_perl [] = {"perl", "cpan", NULL, t(&pl_perl_target)}, #include "lang/Perl.c"
*pl_php [] = {"php", "composer", NULL, t(&pl_php_target)}, #include "lang/PHP.c"
*pl_lua [] = {"lua", "luarocks", NULL, t(&pl_lua_target)}, #include "lang/Lua.c"
*pl_go [] = {"go", "golang", "goproxy", NULL, t(&pl_go_target)} , #include "lang/Go.c"
#include "lang/Java.c"
*pl_rust_cargo[] = {"rust", "cargo", "crate", "crates", NULL, t(&pl_rust_cargo_target)}, #include "lang/Rust/common.h"
*pl_rust_rustup[]= {"rustup", NULL, t(&pl_rust_rustup_target)}, #include "lang/Rust/rustup.c"
#include "lang/Rust/Cargo.c"
*pl_java [] = {"java", "maven", "mvn", "gradle", NULL, t(&pl_java_target)}, #include "lang/Dart/common.h"
*pl_clojure[]= {"clojure","clojars","cloj", "lein", NULL, t(&pl_clojure_target)}, #include "lang/Dart/Pub.c"
#include "lang/Dart/Flutter.c"
*pl_dart [] = {"dart", "pub", NULL, t(&pl_dart_target)}, #include "lang/Haskell.c"
*pl_dart_flutter [] = {"flutter", NULL, t(&pl_dart_flutter_target)}, #include "lang/OCaml.c"
#include "lang/R.c"
#include "lang/Julia.c"
#include "lang/NuGet.c"
#include "lang/Clojure.c"
*pl_nuget[] = {"nuget", "net", ".net", "dotnet", NULL, t(&pl_nuget_target)},
*pl_haskell[]= {"haskell", "cabal", "stack", "hackage", NULL, t(&pl_haskell_target)}, #include "os/rawstr4c.h"
*pl_ocaml[] = {"ocaml", "opam", NULL, t(&pl_ocaml_target)}, #include "os/APT/common.h"
*pl_r [] = {"cran", "r", NULL, t(&pl_r_target)}, // Debian-based
*pl_julia [] = {"julia", NULL, t(&pl_julia_target)}, #include "os/APT/Debian.c"
**pl_packagers[] = #include "os/APT/Ubuntu.c"
#include "os/APT/Kali-Linux.c"
#include "os/APT/Raspberry-Pi-OS.c"
// Ubuntu-based
#include "os/APT/Linux-Mint.c"
#include "os/APT/Trisquel.c"
#include "os/APT/Linux-Lite.c"
// Debian-based and Ubuntu-based
#include "os/APT/Armbian.c"
// Independent
#include "os/APT/ROS.c"
#include "os/APT/Termux.c"
#include "os/APT/openKylin.c"
#include "os/APT/deepin.c"
#include "os/YUM/common.h"
#include "os/YUM/Fedora-Linux.c"
#include "os/YUM/AlmaLinux.c"
#include "os/YUM/Rocky-Linux.c"
#include "os/YUM/openEuler.c"
#include "os/YUM/Anolis-OS.c"
#include "os/pacman/Arch-Linux.c"
#include "os/pacman/Manjaro-Linux.c"
#include "os/pacman/MSYS2.c"
#include "os/openSUSE.c"
#include "os/Alpine-Linux.c"
#include "os/Gentoo-Linux.c"
#include "os/Void-Linux.c"
#include "os/Solus.c"
#include "os/OpenWrt.c"
#include "os/BSD/FreeBSD.c"
#include "os/BSD/NetBSD.c"
#include "os/BSD/OpenBSD.c"
#include "ware/TeX-Live.c"
#include "ware/Emacs.c"
#include "ware/WinGet.c"
#include "ware/Homebrew/Homebrew.c"
#include "ware/CocoaPods.c"
#include "ware/Nix.c"
#include "ware/Guix.c"
#include "ware/Flatpak.c"
#include "ware/Docker/Docker.c"
#include "ware/Anaconda/Anaconda.c"
void
chsrc_init_menu ()
{ {
pl_ruby, #define add(t) xy_seq_push(ProgStore.pl, &pl_##t##_target); (&pl_##t##_target)->preludefn = pl_##t##_prelude
pl_python, pl_python_pip, pl_python_poetry, pl_python_pdm, pl_python_rye, pl_python_uv, add (ruby);
pl_nodejs, pl_nodejs_bun, add (python_group);
pl_nodejs_npm, pl_nodejs_pnpm, pl_nodejs_yarn, add (python_pip);
pl_nodejs_nvm, add (python_poetry);
pl_perl, pl_php, add (python_pdm);
pl_lua, add (python_rye);
pl_rust_cargo, pl_rust_rustup, add (python_uv);
pl_go, add (js_group);
/*pl_nuget,*/ add (js_bun);
pl_java, pl_clojure, add (js_npm);
pl_dart, pl_dart_flutter, add (js_yarn);
pl_ocaml, add (js_pnpm);
pl_r, pl_julia, add (js_nvm);
pl_haskell, add (perl);
}; add (php);
add (lua);
add (go);
add (rust_cargo);
add (rust_rustup);
add (java);
add (clojure);
add (dart);
add (dart_flutter);
add (nuget);
add (haskell);
add (ocaml);
add (r);
add (julia);
#undef add
#define add(t) xy_seq_push(ProgStore.os, &os_##t##_target); (&os_##t##_target)->preludefn = os_##t##_prelude
add (ubuntu);
add (linuxmint);
add (debian);
add (fedora);
add (opensuse);
add (kali);
add (msys2);
add (arch);
add (archlinuxcn);
add (manjaro);
add (gentoo);
add (rockylinux);
add (almalinux);
add (alpine);
add (voidlinux);
add (solus);
add (trisquel);
add (linuxlite);
add (ros);
add (raspberrypi);
add (armbian);
add (openwrt);
add (termux);
add (openkylin);
add (openeuler);
add (anolis);
add (deepin);
add (freebsd);
add (netbsd);
add (openbsd);
#undef add
static const char #define add(t) xy_seq_push(ProgStore.wr, &wr_##t##_target); (&wr_##t##_target)->preludefn = wr_##t##_prelude
/* Zorin OS 完全使用 Ubuntu 的换源方法,二者兼容 */ add (winget);
*os_ubuntu [] = {"ubuntu", "zorinos", NULL, t(&os_ubuntu_target)}, add (homebrew);
*os_linuxmint [] = {"linuxmint", NULL, t(&os_linuxmint_target)}, add (cocoapods);
*os_debian [] = {"debian", NULL, t(&os_debian_target)}, add (docker);
*os_fedora [] = {"fedora", NULL, t(&os_fedora_target)}, add (flatpak);
*os_opensuse [] = {"opensuse", "opensuse-leap", "opensuse-tumbleweed", NULL, t(&os_opensuse_target)}, add (nix);
*os_kali [] = {"kali", NULL, t(&os_kali_target)}, add (guix);
*os_msys2 [] = {"msys2", "msys", NULL, t(&os_msys2_target)}, add (emacs);
*os_arch [] = {"arch", "archlinux", NULL, t(&os_arch_target)}, add (tex);
*os_archlinuxcn[] = {"archlinuxcn", "archcn",NULL, t(&os_archlinuxcn_target)}, add (anaconda);
*os_manjaro [] = {"manjaro", NULL, t(&os_manjaro_target)}, #undef add
*os_gentoo [] = {"gentoo", NULL, t(&os_gentoo_target)},
*os_rockylinux [] = {"rocky", "rockylinux", NULL, t(&os_rockylinux_target)},
*os_almalinux [] = {"alma", "almalinux", NULL, t(&os_almalinux_target)},
*os_alpine [] = {"alpine", NULL, t(&os_alpine_target)},
*os_voidlinux [] = {"voidlinux", NULL, t(&os_voidlinux_target)},
*os_solus [] = {"solus", NULL, t(&os_solus_target)},
*os_trisquel [] = {"trisquel", NULL, t(&os_trisquel_target)},
*os_linuxlite [] = {"linuxlite", NULL, t(&os_linuxlite_target)},
*os_ros [] = {"ros", "ros2", NULL, t(&os_ros_target)},
*os_raspberrypi[] = {"raspi", "raspberrypi",NULL, t(&os_raspberrypi_target)}, // Internal Target 不会由用户使用,需要特殊对待
*os_armbian [] = {"armbian", NULL, t(&os_armbian_target)}, pl_js_nodejs_binary_target.preludefn = pl_js_nodejs_binary_prelude;
*os_openwrt [] = {"openwrt", "opkg", "LEDE", NULL, t(&os_openwrt_target)}, }
*os_termux [] = {"termux", NULL, t(&os_termux_target)},
*os_openkylin [] = {"openkylin", NULL, t(&os_openkylin_target)},
*os_openeuler [] = {"openeuler", NULL, t(&os_openeuler_target)},
*os_anolis [] = {"openanolis", "anolis", NULL, t(&os_anolis_target)},
*os_deepin [] = {"deepin", NULL, t(&os_deepin_target)},
*os_freebsd [] = {"freebsd", NULL, t(&os_freebsd_target)},
*os_netbsd [] = {"netbsd", NULL, t(&os_netbsd_target)},
*os_openbsd [] = {"openbsd", NULL, t(&os_openbsd_target)},
**os_systems[] =
{
os_debian, os_ubuntu, os_linuxmint, os_kali,
os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt, os_termux,
os_deepin, os_openkylin, os_ros,
os_fedora, os_rockylinux, os_almalinux, os_openeuler, os_anolis,
os_opensuse,
os_arch, os_archlinuxcn, os_manjaro, os_gentoo,
os_alpine, os_voidlinux, os_solus,
os_msys2,
os_freebsd, os_netbsd, os_openbsd,
};
static const char
*wr_winget [] = {"winget", NULL, t(&wr_winget_target)},
*wr_homebrew[] = {"brew", "homebrew", NULL, t(&wr_homebrew_target)},
*wr_cocoapods[] = {"cocoa", "cocoapods","pod", "cocoapod", NULL, t(&wr_cocoapods_target)},
*wr_dockerhub [] ={"dockerhub", "docker", NULL, t(&wr_dockerhub_target)},
*wr_flathub [] = {"flathub", "flatpak", NULL, t(&wr_flathub_target)},
*wr_nix [] = {"nix", NULL, t(&wr_nix_target)},
*wr_guix [] = {"guix", NULL, t(&wr_guix_target)},
*wr_emacs [] = {"emacs", "elpa", NULL, t(&wr_emacs_target)},
*wr_tex [] = {"latex", "ctan", "tex", "texlive", "miktex", "tlmgr", "mpm", NULL, t(&wr_tex_target)},
*wr_anaconda[] = {"conda", "anaconda", NULL, t(&wr_anaconda_target)},
**wr_softwares[] =
{
wr_winget, wr_homebrew, wr_cocoapods, wr_dockerhub, wr_flathub, wr_nix, wr_guix, wr_emacs, wr_tex, wr_anaconda
};
#undef t
/** /**
* @sync https://github.com/RubyMetric/chsrc/wiki * @sync https://github.com/RubyMetric/chsrc/wiki
*/ */
static MirrorSite_t* static MirrorSite_t*
available_mirrors[] = { chsrc_available_mirrors[] = {
/* ------------------------ 教育网(通用镜像站) ------------------------ */ /* ------------------------ 教育网(通用镜像站) ------------------------ */
&MirrorZ, &Tuna, &Sjtug_Zhiyuan, &Sjtug_Siyuan, &Bfsu, &Ustc, &Zju, &Jlu, &Lzuoss, &Pku, &Bjtu, &Sustech, &Nju, &Xjtu, &MirrorZ, &Tuna, &Sjtug_Zhiyuan, &Sjtug_Siyuan, &Bfsu, &Ustc, &Zju, &Jlu, &Lzuoss, &Pku, &Bjtu, &Sustech, &Nju, &Xjtu,
@ -154,12 +205,10 @@ available_mirrors[] = {
&Cqupt, &Cqu, &Neosoft, &Cqupt, &Cqu, &Neosoft,
/* ------------------------ 商业公司(通用镜像站) ------------------------ */ /* ------------------------ 商业公司(通用镜像站) ------------------------ */
&Ali, // &Ali_ECS_VPC, &Ali_ECS_classic, &Ali, // &Ali_ECS_VPC, &Ali_ECS_classic,
&Tencent, // &Tencent_Intra, &Tencent, // &Tencent_Intra,
&Huawei, &Huawei, &HuaweiCDN,
&Volcengine, &Volcengine,
&Netease, &Netease,
&Sohu, &Sohu,
@ -167,18 +216,11 @@ available_mirrors[] = {
&Api7, &Fit2Cloud, &DaoCloud, &Api7, &Fit2Cloud, &DaoCloud,
/* ------------------------ 专用镜像站 ------------------------ */ /* ------------------------ 专用镜像站 ------------------------ */
&RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN, &RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN,
/* 暂不支持 &NugetOrg */ /* 暂不支持 &NugetOrg */
/* ------------------------ chsrc 内部实现 ------------------------ */ /* ------------------------ chsrc 内部实现 ------------------------ */
/* 不要列出 &UpstreamProvider 和 &UserDefinedProvider */ /* 不要列出 &UpstreamProvider 和 &UserDefinedProvider */
}; };
/* End Target Matrix */

View File

@ -1,20 +1,30 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Shengwei Chen <414685209@qq.com>
* Contributors : Aoran Zeng <ccmywish@qq.com>
* | Yangmoooo <yangmoooo@outlook.com>
* |
* Created On : <2024-06-14>
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(os_armbian, "armbian");
* @update 2024-11-21
*/ void
static Source_t os_armbian_sources[] = os_armbian_prelude ()
{ {
{&UpstreamProvider, "http://apt.armbian.com", NULL}, chef_prep_this (os_armbian, gsr);
chef_set_created_on (this, "2024-06-14");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2024-11-21");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@livelycode36");
chef_set_sauciers (this, 2, "@ccmywish", "@Yangmoooo");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_deny_user_define(this);
chef_set_note(this, NULL, NULL);
def_sources_begin()
{&UpstreamProvider, "http://apt.armbian.com", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/armbian", DelegateToMirror}, {&MirrorZ, "https://mirrors.cernet.edu.cn/armbian", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/armbian", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/armbian", DelegateToMirror},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/armbian", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/armbian", DelegateToMirror},
@ -22,9 +32,9 @@ static Source_t os_armbian_sources[] =
{&Sustech, "https://mirrors.sustech.edu.cn/armbian", DelegateToMirror}, {&Sustech, "https://mirrors.sustech.edu.cn/armbian", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/armbian", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/armbian", DelegateToMirror},
{&Nju, "https://mirrors.nju.edu.cn/armbian", DelegateToMirror}, {&Nju, "https://mirrors.nju.edu.cn/armbian", DelegateToMirror},
{&Ali, "https://mirrors.aliyun.com/armbian", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/armbian", DelegateToMirror}
}; def_sources_end()
def_sources_n(os_armbian); }
void void
@ -50,11 +60,11 @@ os_armbian_setsrc (char *option)
{ {
chsrc_ensure_root (); chsrc_ensure_root ();
chsrc_yield_source_and_confirm (os_armbian); chsrc_use_this_source (os_armbian);
chsrc_backup (OS_Armbian_SourceList); chsrc_backup (OS_Armbian_SourceList);
char *cmd = xy_strjoin (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url, char *cmd = xy_strcat (3, "sed -E -i 's@https?[^ ]*armbian/?[^ ]*@", source.url,
"@g' " OS_Armbian_SourceList); "@g' " OS_Armbian_SourceList);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
@ -70,21 +80,3 @@ os_armbian_resetsrc (char *option)
{ {
os_armbian_setsrc (option); os_armbian_setsrc (option);
} }
Feature_t
os_armbian_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = CanNot;
f.can_english = true;
f.can_user_define = true;
return f;
}
def_target_gsrf(os_armbian);

View File

@ -1,69 +1,48 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com>
* Contributors : Yangmoooo <yangmoooo@outlook.com>
* | GitHub Copilot <https://github.com/copilot>
* |
* Created On : <2023-09-02>
* Major Revision : 3
* Last Modified : <2025-07-21>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define OS_Debian_Speed_URL_Postfix "/dists/bookworm/main/Contents-all.gz" def_target(os_debian, "debian");
static SourceProvider_t os_debian_upstream =
{
def_upstream, "https://ftp.debian.org/debian/",
{NotSkip, NA, NA, "https://ftp.debian.org/debian/dists/bookworm/main/Contents-all.gz", ACCURATE} // 32MB
};
/**
* @update 2025-07-11
*/
static Source_t os_debian_sources[] =
{
{&os_debian_upstream, "http://deb.debian.org/debian", DelegateToUpstream},
/* MirrorZ 的速度这么测也是可以的 */
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian/",
"https://mirrors.cernet.edu.cn/debian/" OS_Debian_Speed_URL_Postfix},
{&Ali, "https://mirrors.aliyun.com/debian",
"https://mirrors.aliyun.com/debian" OS_Debian_Speed_URL_Postfix},
{&Volcengine, "https://mirrors.volces.com/debian",
"https://mirrors.volces.com/debian" OS_Debian_Speed_URL_Postfix},
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian",
"https://mirrors.bfsu.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Ustc, "https://mirrors.ustc.edu.cn/debian",
"https://mirrors.ustc.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian",
"https://mirrors.tuna.tsinghua.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Tencent, "https://mirrors.tencent.com/debian",
"https://mirrors.tencent.com/debian" OS_Debian_Speed_URL_Postfix},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian", FeedBySourcesPrepare},
/* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/debian", FeedBySourcesPrepare},
/* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/debian", FeedBySourcesPrepare}
};
def_sources_n(os_debian);
void void
os_debian_sources_prepare () os_debian_prelude ()
{ {
chsrc_sources_prepare_speedurl_with_postfix (os_debian, OS_Debian_Speed_URL_Postfix); chef_prep_this (os_debian, gsr);
chef_set_created_on (this, "2023-09-02");
chef_set_last_updated (this, "2025-11-09");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_chef (this, NULL);
chef_set_cooks (this, 2, "@ccmywish", "@G_I_Y");
chef_set_sauciers (this, 1, "@Yangmoooo");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_deny_user_define(this);
chef_set_note(this, NULL, NULL);
def_sources_begin()
{&UpstreamProvider, "http://deb.debian.org/debian", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/debian", FeedByPrelude},
{&Volcengine, "https://mirrors.volces.com/debian", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/debian", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian", FeedByPrelude},
{&Tencent, "https://mirrors.tencent.com/debian", FeedByPrelude}
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian", FeedByPrelude},
/* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/debian", FeedByPrelude},
/* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/debian", FeedByPrelude}
def_sources_end()
chef_set_sources_speed_measure_url_with_postfix (this, "/dists/bookworm/main/Contents-all.gz");
} }
@ -93,8 +72,8 @@ static bool
os_debian_does_old_sourcelist_use_cdrom (void) os_debian_does_old_sourcelist_use_cdrom (void)
{ {
/* 我们只检查旧版sourcelist因为 common.h 中的填充只支持旧版 */ /* 我们只检查旧版sourcelist因为 common.h 中的填充只支持旧版 */
char *cmd = xy_2strjoin ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList); char *cmd = xy_2strcat ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList);
int ret = system (cmd); int ret = xy_run_get_status (cmd);
bool use_cdrom = ret == 0; bool use_cdrom = ret == 0;
return use_cdrom; return use_cdrom;
@ -104,15 +83,15 @@ os_debian_does_old_sourcelist_use_cdrom (void)
void void
os_debian_setsrc_for_deb822 (char *option) os_debian_setsrc_for_deb822 (char *option)
{ {
chsrc_yield_source_and_confirm (os_debian); chsrc_use_this_source (os_debian);
chsrc_backup (OS_Debian_SourceList_DEB822); chsrc_backup (OS_Debian_SourceList_DEB822);
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/debian/?@", source.url, "@g' " OS_Debian_SourceList_DEB822); char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/debian/?@", source.url, "@g' " OS_Debian_SourceList_DEB822);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
/* debian-security 源和其他源不一样 */ /* debian-security 源和其他源不一样 */
cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/debian-security/?@", source.url, "-security@g' " OS_Debian_SourceList_DEB822); cmd = xy_strcat (3, "sed -E -i 's@https?://.*/debian-security/?@", source.url, "-security@g' " OS_Debian_SourceList_DEB822);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line); chsrc_run ("apt update", RunOpt_No_Last_New_Line);
@ -156,7 +135,7 @@ os_debian_setsrc (char *option)
if (use_cdrom) if (use_cdrom)
{ {
chsrc_backup (OS_Debian_old_SourceList); chsrc_backup (OS_Debian_old_SourceList);
int rm_status = system ("rm " OS_Debian_old_SourceList); int rm_status = xy_run_get_status ("rm " OS_Debian_old_SourceList);
if (rm_status != 0) { /* Placate -Wunused-result */ } if (rm_status != 0) { /* Placate -Wunused-result */ }
chsrc_warn2 ("旧版源配置文件中使用了 CDROM 源,已删除(但备份)该配置文件,重新配置"); chsrc_warn2 ("旧版源配置文件中使用了 CDROM 源,已删除(但备份)该配置文件,重新配置");
@ -165,7 +144,7 @@ os_debian_setsrc (char *option)
} }
} }
chsrc_yield_source_and_confirm (os_debian); chsrc_use_this_source (os_debian);
chsrc_alert2 ("如果遇到无法拉取 HTTPS 源的情况,请手动运行:"); chsrc_alert2 ("如果遇到无法拉取 HTTPS 源的情况,请手动运行:");
say ("apt install apt-transport-https ca-certificates"); say ("apt install apt-transport-https ca-certificates");
@ -176,7 +155,7 @@ os_debian_setsrc (char *option)
chsrc_backup (OS_Debian_old_SourceList); chsrc_backup (OS_Debian_old_SourceList);
} }
char *cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/debian/?@", source.url, "@g\' " OS_Debian_old_SourceList); char *cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/debian/?@", source.url, "@g\' " OS_Debian_old_SourceList);
chsrc_run (cmd, RunOpt_Default); chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line); chsrc_run ("apt update", RunOpt_No_Last_New_Line);
@ -191,23 +170,3 @@ os_debian_resetsrc (char* option)
{ {
os_debian_setsrc (option); os_debian_setsrc (option);
} }
Feature_t
os_debian_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(os_debian);

View File

@ -1,40 +1,40 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Heng Guo <2085471348@qq.com>
* Contributors : Yangmoooo <yangmoooo@outlook.com>
* | Happy Game <happygame1024@gmail.com>
* |
* Created On : <2023-09-29>
* Last Modified : <2025-07-21>
*
* Kali Linux Debian Testing branch
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t os_kali_upstream = def_target(os_kali, "kali");
{
def_upstream, "http://http.kali.org/kali",
// https://github.com/RubyMetric/chsrc/issues/121
{NotSkip, NA, NA, "https://http.kali.org/kali/dists/kali-dev/Contents-amd64.gz", ACCURATE} // 47MB
};
/** void
* @update 2025-06-20 os_kali_prelude ()
*/
static Source_t os_kali_sources[] =
{ {
{&os_kali_upstream, "http://http.kali.org/kali", DelegateToUpstream}, chef_prep_this (os_kali, gsr);
chef_set_created_on (this, "2023-09-29");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2025-06-20");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@G_I_Y");
chef_set_sauciers (this, 2, "@Yangmoooo", "@happy-game");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_deny_user_define(this);
chef_set_note(this, NULL, NULL);
def_sources_begin()
{&UpstreamProvider, "http://http.kali.org/kali", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/kali", DelegateToMirror}, {&MirrorZ, "https://mirrors.cernet.edu.cn/kali", DelegateToMirror},
{&Ali, "https://mirrors.aliyun.com/kali", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/kali", DelegateToMirror},
{&Volcengine, "https://mirrors.volces.com/kali", DelegateToMirror}, {&Volcengine, "https://mirrors.volces.com/kali", DelegateToMirror},
{&Bfsu, "https://mirrors.bfsu.edu.cn/kali", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/kali", DelegateToMirror},
{&Ustc, "https://mirrors.ustc.edu.cn/kali", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/kali", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/kali", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/kali", DelegateToMirror}
/* 不启用原因: 未与上游同步 */ /* 不启用原因: 未与上游同步 */
// {&Huawei, "https://mirrors.huaweicloud.com/kali", DelegateToMirror}, // {&Huawei, "https://mirrors.huaweicloud.com/kali", DelegateToMirror},
}; def_sources_end()
def_sources_n(os_kali); }
void void
os_kali_getsrc (char *option) os_kali_getsrc (char *option)
@ -47,11 +47,11 @@ os_kali_setsrc (char *option)
{ {
chsrc_ensure_root (); chsrc_ensure_root ();
chsrc_yield_source_and_confirm (os_kali); chsrc_use_this_source (os_kali);
chsrc_backup (OS_Apt_SourceList); chsrc_backup (OS_Apt_SourceList);
char *cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/kali/?@", char *cmd = xy_strcat (3, "sed -E -i \'s@https?://.*/kali/?@",
source.url, source.url,
"@g\' " OS_Apt_SourceList); "@g\' " OS_Apt_SourceList);
@ -68,24 +68,3 @@ os_kali_resetsrc (char *option)
{ {
os_kali_setsrc (option); os_kali_setsrc (option);
} }
Feature_t
os_kali_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 = NULL;
return f;
}
def_target_gsrf(os_kali);

View File

@ -1,30 +1,35 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Yangmoooo <yangmoooo@outlook.com>
* |
* Created On : <2023-09-29>
* Last Modified : <2025-07-21>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t os_linuxlite_upstream = def_target(os_linuxlite, "linuxlite");
{
def_upstream, "http://repo.linuxliteos.com/linuxlite/",
{NotSkip, NA, NA, "http://repo.linuxliteos.com/linuxlite/isos/7.2/linux-lite-7.2-64bit.iso", ACCURATE} // 2.9GB
};
/** void
* @update 2024-11-21 os_linuxlite_prelude ()
*/
static Source_t os_linuxlite_sources[] =
{ {
{&os_linuxlite_upstream, "http://repo.linuxliteos.com/linuxlite/", DelegateToUpstream}, chef_prep_this (os_linuxlite, gsr);
chef_set_created_on (this, "2023-09-29");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2024-11-21");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@Yangmoooo");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_deny_user_define(this);
chef_set_note(this, NULL, NULL);
def_sources_begin()
{&UpstreamProvider, "http://repo.linuxliteos.com/linuxlite/", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/linuxliteos/", DelegateToMirror}, {&MirrorZ, "https://mirrors.cernet.edu.cn/linuxliteos/", DelegateToMirror},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/linuxliteos/", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/linuxliteos/", DelegateToMirror},
{&Nju, "https://mirror.nju.edu.cn/linuxliteos/", DelegateToMirror} {&Nju, "https://mirror.nju.edu.cn/linuxliteos/", DelegateToMirror}
}; def_sources_end()
def_sources_n(os_linuxlite); }
void void
@ -41,11 +46,11 @@ os_linuxlite_setsrc (char *option)
{ {
chsrc_ensure_root (); chsrc_ensure_root ();
chsrc_yield_source_and_confirm (os_linuxlite); chsrc_use_this_source (os_linuxlite);
chsrc_backup (OS_Apt_SourceList); chsrc_backup (OS_Apt_SourceList);
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList); char *cmd = xy_strcat (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList);
chsrc_run ("apt update", RunOpt_No_Last_New_Line); chsrc_run ("apt update", RunOpt_No_Last_New_Line);
@ -59,24 +64,3 @@ os_linuxlite_resetsrc (char *option)
{ {
os_linuxlite_setsrc (option); os_linuxlite_setsrc (option);
} }
Feature_t
os_linuxlite_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 = NULL;
return f;
}
def_target_gsrf(os_linuxlite);

View File

@ -1,21 +1,31 @@
/** ------------------------------------------------------------ /** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Happy Game <happygame1024@gmail.com>
* |
* Created On : <2023-09-29>
* Last Modified : <2025-07-21>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
/** def_target(os_linuxmint, "linuxmint");
* @update 2024-11-21
* @note Ubuntu的不太一样 void
*/ os_linuxmint_prelude ()
static Source_t os_linuxmint_sources[] =
{ {
{&UpstreamProvider, NULL, NULL}, chef_prep_this (os_linuxmint, gs);
{&MirrorZ, "https://mirrors.cernet.edu.cn/linuxmint/", DelegateToMirror},
chef_set_created_on (this, "2023-09-29");
chef_set_last_updated (this, "2025-08-10");
chef_set_sources_last_updated (this, "2024-11-21");
chef_set_chef (this, NULL);
chef_set_cooks (this, 1, "@ccmywish");
chef_set_sauciers (this, 1, "@happy-game");
chef_allow_local_mode (this, CanNot, NULL, NULL);
chef_deny_english(this);
chef_deny_user_define(this);
/* @note 实际上镜像站里的内容和Ubuntu的不太一样 */
def_sources_begin()
{&UpstreamProvider, "http://packages.linuxmint.com", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/linuxmint/", DelegateToMirror},
{&Ali, "http://mirrors.aliyun.com/linuxmint-packages/", DelegateToMirror}, {&Ali, "http://mirrors.aliyun.com/linuxmint-packages/", DelegateToMirror},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/linuxmint/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/linuxmint/", DelegateToMirror},
{&Bfsu, "https://mirrors.bfsu.edu.cn/linuxmint/", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/linuxmint/", DelegateToMirror},
@ -26,11 +36,11 @@ static Source_t os_linuxmint_sources[] =
{&Zju, "https://mirrors.zju.edu.cn/linuxmint/", DelegateToMirror}, {&Zju, "https://mirrors.zju.edu.cn/linuxmint/", DelegateToMirror},
{&Sustech, "https://mirrors.sustech.edu.cn/linuxmint/", DelegateToMirror}, {&Sustech, "https://mirrors.sustech.edu.cn/linuxmint/", DelegateToMirror},
{&Iscas, "https://mirror.iscas.ac.cn/linuxmint/", DelegateToMirror}, {&Iscas, "https://mirror.iscas.ac.cn/linuxmint/", DelegateToMirror},
{&Scau, "https://mirrors.scau.edu.cn/linuxmint/", DelegateToMirror}, {&Scau, "https://mirrors.scau.edu.cn/linuxmint/", DelegateToMirror}
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/linuxmint/packages/", DelegateToMirror} // {&Netease, "https://mirrors.163.com/linuxmint/packages/", DelegateToMirror}
}; def_sources_end()
def_sources_n(os_linuxmint); }
void void
@ -39,6 +49,7 @@ os_linuxmint_getsrc (char *option)
chsrc_view_file (OS_LinuxMint_SourceList); chsrc_view_file (OS_LinuxMint_SourceList);
} }
/** /**
* @consult https://help.mirrors.cernet.edu.cn/linuxmint/ * @consult https://help.mirrors.cernet.edu.cn/linuxmint/
*/ */
@ -47,7 +58,7 @@ os_linuxmint_setsrc (char *option)
{ {
chsrc_ensure_root (); chsrc_ensure_root ();
chsrc_yield_source_and_confirm (os_linuxmint); chsrc_use_this_source (os_linuxmint);
chsrc_backup (OS_LinuxMint_SourceList); chsrc_backup (OS_LinuxMint_SourceList);
@ -55,7 +66,7 @@ os_linuxmint_setsrc (char *option)
// 暂不实现自动替换基于debian或ubuntu的基础源 // 暂不实现自动替换基于debian或ubuntu的基础源
char *version_codename = xy_run ("sed -nr 's/^VERSION_CODENAME=([^\"]+)/\1/p' " ETC_OS_RELEASE, 0); char *version_codename = xy_run ("sed -nr 's/^VERSION_CODENAME=([^\"]+)/\1/p' " ETC_OS_RELEASE, 0);
// sed -i '/<version_codename>/ s|http[^ ]*|<source.url>|g' OS_LinuxMint_SourceList // sed -i '/<version_codename>/ s|http[^ ]*|<source.url>|g' OS_LinuxMint_SourceList
char* cmd = xy_strjoin (5, "sed -i '/", char* cmd = xy_strcat (5, "sed -i '/",
version_codename, "/ s|http[^ ]*|", version_codename, "/ s|http[^ ]*|",
source.url, "|g' " OS_LinuxMint_SourceList); source.url, "|g' " OS_LinuxMint_SourceList);
@ -67,25 +78,3 @@ os_linuxmint_setsrc (char *option)
chsrc_warn2 ("完成后请不要再使用 mintsources自带的图形化软件源设置工具进行任何操作因为在操作后无论是否有按“确定”mintsources 均会覆写我们刚才换源的内容"); chsrc_warn2 ("完成后请不要再使用 mintsources自带的图形化软件源设置工具进行任何操作因为在操作后无论是否有按“确定”mintsources 均会覆写我们刚才换源的内容");
chsrc_warn2 ("已自动更换mint主要源, 但mint也使用基于debian或ubuntu的基础源, 可参考对应的debian或ubuntu换源方法进行手动换源"); chsrc_warn2 ("已自动更换mint主要源, 但mint也使用基于debian或ubuntu的基础源, 可参考对应的debian或ubuntu换源方法进行手动换源");
} }
Feature_t
os_linuxmint_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
def_target_gsf(os_linuxmint);

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