mirror of
https://gitee.com/RubyMetric/chsrc.git
synced 2025-12-25 20:52:49 +00:00
Compare commits
377 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3816263878 | ||
|
|
3657c9f7dd | ||
|
|
f5c78c5a04 | ||
|
|
db9449993b | ||
|
|
6613c676cc | ||
|
|
b8ff421a8a | ||
|
|
7e6c90319d | ||
|
|
9a6f39216c | ||
|
|
55aef454e9 | ||
|
|
64581bb718 | ||
|
|
46e2cb8d43 | ||
|
|
c22fae679e | ||
|
|
6a527dba00 | ||
|
|
dafbb302bb | ||
|
|
6e03939f45 | ||
|
|
1264b4192f | ||
|
|
332186224f | ||
|
|
fed349827c | ||
|
|
fd309e7300 | ||
|
|
4a13358c8b | ||
|
|
8833eb99c1 | ||
|
|
6af042ca9f | ||
|
|
0c3405803a | ||
|
|
cbf22a7f29 | ||
|
|
37710884a8 | ||
|
|
066ac191a6 | ||
|
|
985a6344b3 | ||
|
|
8e392b04b8 | ||
|
|
6060b325be | ||
|
|
d84bdba08a | ||
|
|
c6897bd73e | ||
|
|
1058d3310b | ||
|
|
28d8e4ad0c | ||
|
|
8ebe5812ed | ||
|
|
19d09e537a | ||
|
|
ebc9e167f2 | ||
|
|
e030c8095e | ||
|
|
f926834384 | ||
|
|
6af3e51566 | ||
|
|
990b8d0df3 | ||
|
|
1ac8b892e2 | ||
|
|
c44377f2d9 | ||
|
|
16602d0e7f | ||
|
|
6f312a66c0 | ||
|
|
948d55185f | ||
|
|
41783b8531 | ||
|
|
5588beb542 | ||
|
|
547931c4e4 | ||
|
|
e64778911a | ||
|
|
2a9d13bfc8 | ||
|
|
a3600bf05f | ||
|
|
437729a5cf | ||
|
|
b2a844b676 | ||
|
|
5771a308a6 | ||
|
|
0b4215f257 | ||
|
|
cfe850382d | ||
|
|
717b0f96b8 | ||
|
|
91692d6215 | ||
|
|
6aac016c02 | ||
|
|
1829f6e622 | ||
|
|
b84f2f9edd | ||
|
|
de75aaa62b | ||
|
|
a5e358fc4a | ||
|
|
9666b769a1 | ||
|
|
730d18a8a9 | ||
|
|
d6c2111868 | ||
|
|
9dfffbb8f2 | ||
|
|
db2ba39763 | ||
|
|
ec43c09caf | ||
|
|
cc85521a93 | ||
|
|
54dbb0ea68 | ||
|
|
984186f376 | ||
|
|
1a791f2fd1 | ||
|
|
c6b4049a36 | ||
|
|
e335d34eee | ||
|
|
0ff604060d | ||
|
|
dec55705c7 | ||
|
|
4e4b4731ee | ||
|
|
31c93f0844 | ||
|
|
04da1243f5 | ||
|
|
0a49c7b2d9 | ||
|
|
da003f5fd1 | ||
|
|
027c40c8e9 | ||
|
|
bb2d3af1f3 | ||
|
|
128a9c2c8b | ||
|
|
9aa000c3a6 | ||
|
|
f92ebbee04 | ||
|
|
5ccd609dd6 | ||
|
|
7648b6b2f2 | ||
|
|
ebf0176245 | ||
|
|
4bea910d4d | ||
|
|
14be64fc1d | ||
|
|
e8d1890c81 | ||
|
|
438e19a4d6 | ||
|
|
c1e3522303 | ||
|
|
143bc80870 | ||
|
|
a04ea51ab5 | ||
|
|
bceeaa8a21 | ||
|
|
d478be8431 | ||
|
|
d424ed2850 | ||
|
|
6d5ab715e5 | ||
|
|
885bb5103b | ||
|
|
d71ea423dd | ||
|
|
d1149d8d00 | ||
|
|
a7989d3131 | ||
|
|
f2228cb34d | ||
|
|
9758a79d25 | ||
|
|
2f11a11623 | ||
|
|
7b01893dc8 | ||
|
|
9d1a287f91 | ||
|
|
c7e5c1fafb | ||
|
|
d3e8024553 | ||
|
|
32feeaea1b | ||
|
|
95de30d62d | ||
|
|
0d6523eba1 | ||
|
|
9f52a4d2be | ||
|
|
cf07b13776 | ||
|
|
afc4ba3d06 | ||
|
|
4cffe05711 | ||
|
|
7f1832b5fd | ||
|
|
8e1f6a35f6 | ||
|
|
55865d6a7b | ||
|
|
28d913c58b | ||
|
|
90315917e9 | ||
|
|
60ad6c1fc6 | ||
|
|
bcc3206bdd | ||
|
|
b309c46a4c | ||
|
|
58ef09fadd | ||
|
|
5b8bf70407 | ||
|
|
78ff7adf52 | ||
|
|
844cd55cde | ||
|
|
64b5df65b1 | ||
|
|
b98a616bcd | ||
|
|
7b18dfee7b | ||
|
|
56198df675 | ||
|
|
49e15b1584 | ||
|
|
8b4504fc07 | ||
|
|
99dd21f719 | ||
|
|
7c9e351fc5 | ||
|
|
1cac4e8878 | ||
|
|
ac50bd24cb | ||
|
|
51863e7808 | ||
|
|
f42088fa9e | ||
|
|
d22a4e50bc | ||
|
|
c872c9122d | ||
|
|
93088fe4b8 | ||
|
|
645a3d6bf1 | ||
|
|
6a89e41934 | ||
|
|
f2a50d0963 | ||
|
|
43ff5c3fd1 | ||
|
|
981a191de8 | ||
|
|
fd21308870 | ||
|
|
3f82ef355f | ||
|
|
2a3aa24995 | ||
|
|
ad1e488b70 | ||
|
|
6267972622 | ||
|
|
25965b18d7 | ||
|
|
18ba902da5 | ||
|
|
536caa73eb | ||
|
|
4237e8272a | ||
|
|
e7aae2808d | ||
|
|
475e8f3060 | ||
|
|
64924a7ffc | ||
|
|
c8818e4923 | ||
|
|
6600099283 | ||
|
|
8130f11cd1 | ||
|
|
106cb97e08 | ||
|
|
adca7b3ea2 | ||
|
|
12e69edb86 | ||
|
|
0a51b7ebd8 | ||
|
|
eb995e055d | ||
|
|
1eb0e7ee06 | ||
|
|
ed4545d9f2 | ||
|
|
5375a9da19 | ||
|
|
1f81fa4efc | ||
|
|
4b11ee3d8b | ||
|
|
83e8084d22 | ||
|
|
4d70428e35 | ||
|
|
16dff95df0 | ||
|
|
d7ca422100 | ||
|
|
f1eaffab4a | ||
|
|
a08ef58579 | ||
|
|
2f46cd63f5 | ||
|
|
4e9ea3ccc2 | ||
|
|
46083f03ec | ||
|
|
2156dbacad | ||
|
|
7d7e6e1702 | ||
|
|
6776e9a1a9 | ||
|
|
c609a10988 | ||
|
|
79cbceb683 | ||
|
|
404807e69b | ||
|
|
4ef5fc7f18 | ||
|
|
449da90daa | ||
|
|
f7f52691a7 | ||
|
|
058fc62568 | ||
|
|
224021f0f7 | ||
|
|
98b2e14747 | ||
|
|
1ea20097ad | ||
|
|
e6d512eb83 | ||
|
|
9d7543b681 | ||
|
|
3d8a98a2a9 | ||
|
|
4a5aba9140 | ||
|
|
7d230bcf57 | ||
|
|
f195709493 | ||
|
|
98516e0f4d | ||
|
|
0d232fba92 | ||
|
|
aabec77833 | ||
|
|
63b3832ce9 | ||
|
|
81b9c2911a | ||
|
|
f4718a05fd | ||
|
|
6496ff0b9e | ||
|
|
1773745b76 | ||
|
|
ef65acc5df | ||
|
|
51b6ece5b7 | ||
|
|
560a47f358 | ||
|
|
ad087be36a | ||
|
|
0a421eb1cb | ||
|
|
b4e2a56abc | ||
|
|
2692f07a2b | ||
|
|
57d81b2edd | ||
|
|
77a3b458bd | ||
|
|
e2c8525027 | ||
|
|
c33a9dafd0 | ||
|
|
9023f8d0e7 | ||
|
|
6fb8677451 | ||
|
|
6178b212a0 | ||
|
|
34fa12edde | ||
|
|
b6a910143d | ||
|
|
795ed0964f | ||
|
|
3dfe2bb3cf | ||
|
|
978d4c68c4 | ||
|
|
03af965c4e | ||
|
|
80f4690b14 | ||
|
|
62341da96d | ||
|
|
1a1a863938 | ||
|
|
329b97a245 | ||
|
|
62bbe6de24 | ||
|
|
5e4bf57d45 | ||
|
|
e98361f33b | ||
|
|
afd1b08b6d | ||
|
|
7dfe942973 | ||
|
|
7e00ec6523 | ||
|
|
555eb91d35 | ||
|
|
0d19ee249f | ||
|
|
4d813893e9 | ||
|
|
07685390b0 | ||
|
|
0a91a9bdd5 | ||
|
|
5f77b80a4b | ||
|
|
97f307c93c | ||
|
|
e2146a5709 | ||
|
|
a3cf4fcc99 | ||
|
|
41c449f4ac | ||
|
|
2e3dc93499 | ||
|
|
a31bfe0377 | ||
|
|
6315f44950 | ||
|
|
fbca61a7e2 | ||
|
|
3fe354930f | ||
|
|
68175ed8fa | ||
|
|
162deaf807 | ||
|
|
ef154fed2b | ||
|
|
066a377947 | ||
|
|
f099a86e53 | ||
|
|
67915c36c4 | ||
|
|
9c51e8c0f1 | ||
|
|
d48bbc92e0 | ||
|
|
a9cb459609 | ||
|
|
c2747c58be | ||
|
|
41a5e772f5 | ||
|
|
8e066b6d5b | ||
|
|
8531a2c80e | ||
|
|
7e00a49078 | ||
|
|
24a0aff66d | ||
|
|
1be3dc2a0b | ||
|
|
7c1b3c2a91 | ||
|
|
52004a1033 | ||
|
|
492ca4288c | ||
|
|
13d4c7a43f | ||
|
|
e86afb55a6 | ||
|
|
d6f2d65579 | ||
|
|
b286b3e1b3 | ||
|
|
38e5f7df2e | ||
|
|
71e7312002 | ||
|
|
dc20eeeb75 | ||
|
|
3c42e8be2d | ||
|
|
9bec7f30cd | ||
|
|
5aeb706796 | ||
|
|
4da60f0c7d | ||
|
|
5af9e5a2b1 | ||
|
|
a0b7aaabf4 | ||
|
|
0cde3bb45a | ||
|
|
797563c1db | ||
|
|
0ecd128f8f | ||
|
|
097097c664 | ||
|
|
5c44b140e4 | ||
|
|
fec96b812b | ||
|
|
efd2ea2712 | ||
|
|
915dbe1477 | ||
|
|
827a26951b | ||
|
|
f36fd1ccb2 | ||
|
|
ff65de3a75 | ||
|
|
b1ee34862c | ||
|
|
bef1fc9f26 | ||
|
|
616b0caa48 | ||
|
|
caa90fee32 | ||
|
|
341369f347 | ||
|
|
27f145ba2b | ||
|
|
c531b8b56e | ||
|
|
a936136d14 | ||
|
|
4d10023993 | ||
|
|
4829ada7d8 | ||
|
|
e36bdffaff | ||
|
|
ee8b031ee7 | ||
|
|
425ae19d9d | ||
|
|
82aafbca62 | ||
|
|
c9940ec71f | ||
|
|
1af6008c50 | ||
|
|
820591362b | ||
|
|
aa923b4276 | ||
|
|
e235b6dd17 | ||
|
|
d6fbaf91ce | ||
|
|
8458a193a6 | ||
|
|
d146a8a62a | ||
|
|
fd0907bf4b | ||
|
|
6c86e24b9d | ||
|
|
35ef3a4c37 | ||
|
|
2d358fbc6a | ||
|
|
16d643a8ee | ||
|
|
1f1008c440 | ||
|
|
23ba6b8419 | ||
|
|
a7001636c9 | ||
|
|
4ff53269f0 | ||
|
|
ca6498b547 | ||
|
|
68b921d9c5 | ||
|
|
e797b6f282 | ||
|
|
8ffe5bc12d | ||
|
|
777f9175e4 | ||
|
|
d3f6e16bc3 | ||
|
|
8b60633230 | ||
|
|
a417afa4b5 | ||
|
|
d97365ed4e | ||
|
|
c3e24ee3d5 | ||
|
|
2304d4b2aa | ||
|
|
52d8673b9b | ||
|
|
91a2fe3488 | ||
|
|
173e5a3ffc | ||
|
|
64e625d486 | ||
|
|
da82acc251 | ||
|
|
ee3bef5eab | ||
|
|
3200e2ab3b | ||
|
|
8df5363007 | ||
|
|
8df311e700 | ||
|
|
d7704712d7 | ||
|
|
ab5d20638d | ||
|
|
49cf464eb2 | ||
|
|
1a73a31e06 | ||
|
|
695ce1072c | ||
|
|
c36be5f59c | ||
|
|
27243a62bc | ||
|
|
43131e3653 | ||
|
|
fdfd1b20ce | ||
|
|
e500140bc6 | ||
|
|
d87b722b1c | ||
|
|
5e679b1c33 | ||
|
|
c490b73072 | ||
|
|
9542ce33bc | ||
|
|
f17a1c70b8 | ||
|
|
60ce1ba580 | ||
|
|
94279c795b | ||
|
|
a644c271fb | ||
|
|
013c95386c | ||
|
|
851bb508b1 | ||
|
|
f18c72f471 | ||
|
|
d70514e357 | ||
|
|
26e3c60ae8 | ||
|
|
53225997d2 | ||
|
|
bfb6022beb | ||
|
|
53adda7268 |
|
|
@ -1,4 +1,17 @@
|
|||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Config Type : EditorConfig
|
||||
# Config Authors: 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# Created On : <2023-09-06>
|
||||
# Last Modified : <2025-08-27>
|
||||
#
|
||||
# 请参考 ./doc/03-为什么拒绝使用代码格式化工具.md
|
||||
#
|
||||
# http://editorconfig.org
|
||||
# --------------------------------------------------------------
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
|
|
@ -6,18 +19,31 @@ indent_style = space
|
|||
indent_size = 2
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
|
||||
# VS Code 对该配置(为 false)的实现有问题,这是确定的,
|
||||
# 然而 CLion 似乎对该配置(为 false)的实现是正确的,这导致不同贡献者反而产生了冲突
|
||||
# 所以我们现在改成 true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{c,C,cpp,cxx,cc,h,hpp}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.pl]
|
||||
indent_size = 4
|
||||
|
||||
[*.{raku,rakumod,rakutest}]
|
||||
indent_size = 2
|
||||
|
||||
[*.ps1]
|
||||
indent_size = 4
|
||||
|
||||
[*.{sh,bash}]
|
||||
indent_size = 2
|
||||
|
||||
[Makefile,makefile,*.{mk,make,makefile}]
|
||||
indent_style = tab
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# 使用 VS Code 生成文件的默认格式
|
||||
[*.json]
|
||||
indent_size = 4
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ body:
|
|||
attributes:
|
||||
label: chsrc 版本
|
||||
# description: 你正在使用 chsrc 哪个版本?
|
||||
placeholder: 请使用 chsrc -h 查看*带有发布日期*的精确版本 (chsrc -v 并不含有日期信息)
|
||||
placeholder: 请使用 chsrc -h 或 chsrc -v 查看,并*复制发布日期*
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (Overview .github) READIT.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2025-06-20>
|
||||
! Last Modified : <2025-06-20>
|
||||
|
|
|
|||
|
|
@ -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: 一定要保持注释,因为它记录了重要的维护信息
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : PR-notify.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Created On : <2025-06-19>
|
||||
# Last Modified : <2025-06-28>
|
||||
# Last Modified : <2025-08-07>
|
||||
#
|
||||
# Notify PR
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -40,15 +40,23 @@ jobs:
|
|||
welcome:
|
||||
name: 欢迎PR者
|
||||
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:
|
||||
- name: 评论
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
- name: 查看 GitHub Actions 环境
|
||||
run: |
|
||||
echo "Event 类型: ${{ github.event.action }}"
|
||||
echo "Event 名: ${{ github.event_name }}"
|
||||
|
||||
# 2025-10-06 移除点赞的步骤
|
||||
# 因原 peter-evans/create-or-update-comment@v5 已不再支持空body,而如果使用 Github Token 之类又过于大材小用因此移除
|
||||
|
||||
- name: 添加评论欢迎 PRer
|
||||
uses: peter-evans/create-or-update-comment@v5
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
Hi @${{github.event.pull_request.user.login}},
|
||||
Hi @${{github.event.pull_request.user.login}}
|
||||
|
||||
❤️ 感谢你的贡献!我们将在5天内阅读此 PR 并回复你
|
||||
❤️ 感谢你的贡献!我们将在最少半小时,最多5天内阅读此 PR 并回复你
|
||||
edit-mode: replace
|
||||
reactions: heart
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : PR-test.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Mikachu2333 <mikachu2333@zohomail.com>
|
||||
# |
|
||||
# Created On : <2025-06-19>
|
||||
# Last Modified : <2025-06-19>
|
||||
# Last Modified : <2025-08-17>
|
||||
#
|
||||
# Test PR
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -13,11 +13,15 @@ name: 测试PR
|
|||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened,
|
||||
synchronize, # 后续提交
|
||||
ready_for_review, # draft PR 转为正式 PR
|
||||
review_requested,
|
||||
reopened]
|
||||
# 仅在开 pr、草稿转正式、手动要求 review、reopen的时候运行测试
|
||||
types: [
|
||||
opened,
|
||||
# 因 synchronize 将导致 pr 的构建过于频繁而禁用
|
||||
# synchronize, # 在 pr 者 push commit 时每次构建
|
||||
ready_for_review, # draft PR 转为正式 PR
|
||||
review_requested,
|
||||
reopened,
|
||||
]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "lib/**"
|
||||
|
|
@ -30,7 +34,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 测试构建情况
|
||||
run: |
|
||||
|
|
@ -42,12 +46,18 @@ jobs:
|
|||
|
||||
test-on-windows:
|
||||
name: 在Windows上测试
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
if: github.event.pull_request.base.ref == 'dev'
|
||||
|
||||
steps:
|
||||
- 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: 安装依赖
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-AArch64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -45,4 +45,3 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-aarch64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-ARMv7.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -45,5 +45,3 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-armv7-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-riscv64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -45,4 +45,3 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
./artifacts/chsrc-riscv64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Linux-x64.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 构建
|
||||
run: |
|
||||
|
|
@ -37,4 +37,3 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-linux
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-Windows.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 安装 GCC
|
||||
uses: msys2/setup-msys2@v2
|
||||
|
|
@ -78,4 +78,3 @@ jobs:
|
|||
chsrc-x64-windows.exe
|
||||
chsrc-x86-windows.exe
|
||||
chsrc-arm64-android
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : build-on-macOS.yml
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# 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
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 检查编译器版本
|
||||
run: |
|
||||
|
|
@ -45,15 +45,16 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
chsrc-aarch64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
||||
on-x64:
|
||||
runs-on: macos-13 # macos-14 is AArch64(ARMv8-A)
|
||||
# macos-13 是 x64,macos-14 是 AArch64(ARMv8-A)
|
||||
# 但是 macos-13 已经于 2025-12-04 下线
|
||||
runs-on: macos-15-intel
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 检查编译器版本
|
||||
run: |
|
||||
|
|
@ -78,4 +79,3 @@ jobs:
|
|||
tag_name: pre
|
||||
files: |
|
||||
chsrc-x64-macos
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# ---------------------------------------------------------------
|
||||
# Workflow File : pkg-deb.yml
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-10>
|
||||
# Last Modified : <2025-06-16>
|
||||
# Last Modified : <2025-10-29>
|
||||
#
|
||||
# Build and publish deb packages
|
||||
# ---------------------------------------------------------------
|
||||
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: gh-build
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ jobs:
|
|||
|
||||
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
|
||||
version="${{ github.event.inputs.version }}"
|
||||
|
|
@ -73,7 +73,7 @@ jobs:
|
|||
|
||||
* Release version $version
|
||||
|
||||
-- Aoran Zeng <ccmywish@qq.com> $(date -R)
|
||||
-- 曾奥然 <ccmywish@qq.com> $(date -R)
|
||||
|
||||
EOF
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ jobs:
|
|||
bash pkg/deb/deb-installation-test.sh
|
||||
|
||||
- name: 上传deb包到artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: chsrc-deb-files
|
||||
path: dist/chsrc_*.deb
|
||||
|
|
@ -133,7 +133,6 @@ jobs:
|
|||
with:
|
||||
# 用 * 省略版本号,以及指代各种架构
|
||||
files: dist/chsrc_*.deb
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
- name: 上传附件到GitHub Releases(the 'pre' release)
|
||||
if: github.event_name == 'push'
|
||||
|
|
@ -142,7 +141,6 @@ jobs:
|
|||
tag_name: pre
|
||||
# 用 * 指代各种架构
|
||||
files: dist-for-pre/chsrc_latest-1_*.deb
|
||||
token: ${{ secrets.UPLOAD_TO_GITHUB }}
|
||||
|
||||
|
||||
|
||||
|
|
@ -156,7 +154,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
pattern: chsrc-deb-files
|
||||
merge-multiple: true
|
||||
|
|
@ -174,7 +172,7 @@ jobs:
|
|||
dpkg-scanpackages . /dev/null > Packages
|
||||
|
||||
- name: Upload repository metadata
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: debian-repository-metadata
|
||||
path: debs/Packages*
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*.dll
|
||||
*.out
|
||||
*.exe
|
||||
|
||||
*.res
|
||||
|
||||
|
||||
##############################
|
||||
|
|
@ -41,6 +41,9 @@ chsrc-ci-release
|
|||
xy
|
||||
fw
|
||||
README.md.bak*
|
||||
*.tmp
|
||||
chsrc_tmp_test.txt
|
||||
chsrc_tmp_test.txt.bak
|
||||
|
||||
# Generated when testing (when there's a bug)
|
||||
nul
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (for VS Code users) README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2025-06-18>
|
||||
! Last Modified : <2025-06-20>
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@
|
|||
"program": "${workspaceFolder}/chsrc-debug",
|
||||
"args": [
|
||||
"get",
|
||||
"python"
|
||||
"nodejs"
|
||||
],
|
||||
"preLaunchTask": "构建 debug 版 chsrc",
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
// 如果你认为使用弹出窗口难以调试,可尝试设置为false
|
||||
"externalConsole": true,
|
||||
// lldb 等请自行设置,不作额外说明
|
||||
"MIMode": "gdb",
|
||||
// "miDebuggerPath": "/path/to/gdb",
|
||||
"setupCommands": [
|
||||
|
|
@ -28,7 +30,8 @@
|
|||
"text": "-gdb-set disassembly-flavor intel",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"postDebugTask": "停止 debug 程序"
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -58,4 +61,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,27 @@
|
|||
{
|
||||
"editor.fontLigatures": false,
|
||||
|
||||
"C_Cpp.autoAddFileAssociations": false,
|
||||
"C_Cpp.intelliSenseEngine": "Tag Parser",
|
||||
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false,
|
||||
|
||||
"editor.formatOnSave": false,
|
||||
"vscode-just.formatOnSave": false,
|
||||
"[yaml]": {
|
||||
"editor.defaultFormatter": "redhat.vscode-yaml"
|
||||
|
||||
"C_Cpp.clang_format_fallbackStyle": "GNU",
|
||||
"C_Cpp.formatting": "disabled",
|
||||
|
||||
"[c]": {
|
||||
"editor.defaultFormatter": null,
|
||||
},
|
||||
"[h]": {
|
||||
"editor.defaultFormatter": null
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "vscode.json-language-features"
|
||||
}
|
||||
},
|
||||
"[yaml]": {
|
||||
"editor.defaultFormatter": "redhat.vscode-yaml"
|
||||
},
|
||||
|
||||
"vscode-just.formatOnSave": false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "使用 just build 编译"
|
||||
"dependsOn": "停止程序",
|
||||
"detail": "先停止原有程序,然后使用 just build 编译"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
|
|
@ -36,7 +37,6 @@
|
|||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"detail": "使用 just build-in-debug-mode 编译 debug 版"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
|
|
@ -94,7 +94,79 @@
|
|||
"isDefault": false
|
||||
},
|
||||
"detail": "使用 just test-xy 测试 xy.h"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "停止 debug 程序",
|
||||
"windows": {
|
||||
"command": "powershell",
|
||||
"args": [
|
||||
"-c",
|
||||
"Get-Process -Name \"chsrc-debug\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
|
||||
"Get-Process -Name \"gdb\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
|
||||
"Get-Process -Name \"WindowsDebugLauncher\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
|
||||
]
|
||||
},
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": false
|
||||
},
|
||||
"detail": "停止 debug 版本的 chsrc"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "停止程序",
|
||||
"windows": {
|
||||
"command": "powershell",
|
||||
"args": [
|
||||
"-c",
|
||||
"Get-Process -Name \"chsrc\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
|
||||
]
|
||||
},
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": false
|
||||
},
|
||||
"detail": "跨平台停止 chsrc"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
}
|
||||
15
Makefile
15
Makefile
|
|
@ -2,15 +2,15 @@
|
|||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : Makefile
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
# Build File : Makefile
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Yangmoooo <yangmoooo@outlook.com>
|
||||
# | sanchuanhehe <wyihe5520@gmail.com>
|
||||
# |
|
||||
# Created On : <2023-08-28>
|
||||
# Last Modified : <2025-07-22>
|
||||
# Last Modified : <2025-10-15>
|
||||
#
|
||||
# 请阅读 ./doc/01-Develop.md 来使用
|
||||
# 请阅读 ./doc/01-开发与构建.md 来使用
|
||||
# --------------------------------------------------------------
|
||||
|
||||
#=========== OS Check ================
|
||||
|
|
@ -26,10 +26,12 @@ ifeq ($(shell uname), Darwin)
|
|||
On-macOS = 1
|
||||
endif
|
||||
|
||||
# 只有Windows会定义$(OS)变量
|
||||
# 只有 MSYS2 会定义 $(OS) 变量
|
||||
ifeq ($(OS), Windows_NT)
|
||||
On-Windows = 1
|
||||
endif
|
||||
# 注意, 原生 Windows 会定义 $(ComSpec) 变量,且区分大小写
|
||||
# 但是 MSYS2 并不会定义
|
||||
#=====================================
|
||||
|
||||
|
||||
|
|
@ -196,6 +198,7 @@ test-cli: $(DevMode-Target-Name)
|
|||
|
||||
clean:
|
||||
-@rm *.exe 2>/dev/null
|
||||
-@rm *.res 2>/dev/null
|
||||
-@rm xy 2>/dev/null
|
||||
-@rm fw 2>/dev/null
|
||||
-@rm README.md.bak* 2>/dev/null
|
||||
|
|
|
|||
30
README.md
30
README.md
|
|
@ -3,11 +3,12 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
! | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||
! |
|
||||
! Created On : <2023-12-28>
|
||||
! Last Modified : <2025-07-22>
|
||||
! Last Modified : <2025-08-22>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
<div align="center">
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
|
||||
全平台通用换源工具与框架 `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`
|
||||
|
||||
|
|
@ -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]
|
||||
> **`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]
|
||||
> 这是你可以参与的第一个现实世界中有用的C语言项目,[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-Develop.md)
|
||||
> 这也许是你可以参与的第一个现实世界中有用的C语言项目,[用 VS Code 一分钟内上手编译、运行、测试 chsrc](./doc/01-开发与构建.md)
|
||||
>
|
||||
> 欢迎对 GitHub、Gitee 协作不熟悉的人以此为契机学习参与贡献, 欢迎任何编程初学者。[从开发到提交PR,我们覆盖全流程文档](./doc/)
|
||||
,作者可提供一定的 [贡献指导](https://github.com/RubyMetric/chsrc/discussions/50)
|
||||
---
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/130)
|
||||
> **`chsrc` 可换源 65+ 目标。每个人仅仅贡献和维护自己熟悉的部分,回报是得到其他所有领域专家的帮助。** [欢迎成为 recipe 维护者](https://github.com/RubyMetric/chsrc/issues/275)
|
||||
|
||||
<br>
|
||||
|
||||
|
|
@ -461,7 +475,7 @@ chsrc set rust | cargo | crate
|
|||
chsrc set rustup
|
||||
|
||||
chsrc set go
|
||||
chsrc set java | maven | mvn | gradle
|
||||
chsrc set java | maven | mvn | maven-daemon | mvnd | gradle
|
||||
chsrc set clojure | clojars
|
||||
chsrc set dart | pub
|
||||
chsrc set flutter
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (chsrc-bootstrap Introduction.md)
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2025-07-12>
|
||||
! Last Modified : <2025-07-22>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : 01-Develop.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Name : 01-开发与构建.md
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
! |
|
||||
! Created On : <2024-12-27>
|
||||
! Last Modified : <2025-07-21>
|
||||
! Last Modified : <2025-10-11>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 开发 chsrc
|
||||
|
|
@ -53,7 +53,7 @@ git clone https://gitee.com/RubyMetric/chsrc.git -b dev
|
|||
3. **`RELEASE mode`**
|
||||
4. **`CI-RELEASE mode`**
|
||||
|
||||
第四种只在 GitHub Actions 使用,一般只需要前三者;而在开发时你仅需要前两者;如果不需要 Debug,仅仅第一个 **DEV mode** 就够了。
|
||||
开发时只需要前两种模式;第四种模式只在 GitHub Actions 使用。
|
||||
|
||||
**如果你使用 `just`,可以在 VS Code 中获得更好的体验,按 `Ctrl-Shift-B` 直接使用 DEV mode 构建**
|
||||
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : 03-CONTRIBUTING.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Name : 02-提交与贡献.md
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2024-12-13>
|
||||
! Last Modified : <2025-07-21>
|
||||
! Last Modified : <2025-08-22>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 贡献说明
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
## 提交与审阅
|
||||
|
||||
当你提交 PR 的时候,一定要将 PR 指定 chsrc 原仓库的 dev 分支。
|
||||
|
||||
### 一个简单的 Bug
|
||||
|
||||
一个简单的 Bug fix,有写权限的维护者可以直接推送到主仓库的 `dev` 分支
|
||||
|
|
@ -34,15 +36,14 @@
|
|||
|
||||
(1)
|
||||
|
||||
1. **如果你是 recipe Chef,则你完全负责这个 recipe,如果你拥有写权限,你可以直接推送代码到 `dev` 分支**
|
||||
2. 如果你是 recipe Sous Chef,则你需要参考 [04-MAINTAINERS.md](./04-MAINTAINERS.md),如果只有你一个人,且你拥有写权限,你可以直接推送代码。如果有多人,则需要提一个 issue,介绍方案,然后 @ 所有 Sous Chef 来 review
|
||||
**如果你是 recipe Chef,则你完全负责这个 recipe,如果你拥有写权限,你可以直接推送代码到 `dev` 分支**
|
||||
|
||||
---
|
||||
|
||||
(2)
|
||||
|
||||
1. 需要先搜索你修改的部分涉及到的 recipe,然后提 issue @ 所有相关的 recipe Sous Chef 来 review
|
||||
2. 如果涉及了所有 recipe,则 @ framework Sous Chef,而无需把所有 recipe 的 Sous Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
|
||||
1. 需要先搜索你修改的部分涉及到的 recipe,然后提 issue @ 所有相关的 recipe Chef 来 review
|
||||
2. 如果涉及了所有 recipe,则 @ framework Chef,而无需把所有 recipe 的 Chef 都喊过来,但是如果觉得有必要,可以 @ 任意你觉得有能力 review 和能给出建议的人来 review
|
||||
|
||||
<br>
|
||||
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
! SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : 02-Write-A-Recipe-Even-If-You-Dont-Know-C.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Name : 10-如何编写recipe.md
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! 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
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<br>
|
||||
|
||||
我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/130))。
|
||||
我鼓励你为新的软件添加换源支持,因为通过 `chsrc` 框架,这将比写 shell 脚本更加轻松,你的贡献也将非常有价值。理论上每一个 `recipe` 都需要有专人长时间维护 ([招募](https://github.com/RubyMetric/chsrc/issues/275))。
|
||||
|
||||
- 本项目采用 `GPLv3+` 协议,是真正的**自由软件**,而非仅仅是开源软件
|
||||
- 代码规范灵活遵循 `GNU` 标准(若标准干扰了可维护性,则并不采纳)
|
||||
|
|
@ -52,7 +52,10 @@
|
|||
- `source`: 该 `target` 所能换的具体的源,由 `mirror` 提供服务,往往一个 `mirror` 会提供许多 `source`
|
||||
- `recipe`: 是为一个 `target` 定义的具体换源方法,请参考 `src` 目录中的 `recipe` 目录
|
||||
|
||||
- `feature`: 一个 `target` 可以支持的功能,比如能否重置回上游默认源等
|
||||
- `chef DSL`:是 `chef Domain Specific Language` 的简写,这是一组以 `chef_` 开头的函数,用来定义维护者信息、可用源等元信息
|
||||
|
||||
- **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL
|
||||
- **测速链接**: 用来测速的URL,与 "换源链接" 不同,可分为 **精准测速** 和 **模糊测速**
|
||||
|
||||
- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
|
||||
|
||||
|
|
@ -76,17 +79,24 @@
|
|||
|
||||
5. 在 [Wiki] 中记录的镜像站中寻找可用源;可以额外补充镜像站
|
||||
|
||||
6. 可以使用这些函数:
|
||||
6. 使用 chef DSL 定义 `_prelude()` 函数
|
||||
|
||||
该函数将填充 target 所有的必要信息,包括维护信息、换源信息
|
||||
|
||||
7. [设置/修改 "换源链接" 和 "测速链接" (how?)](./11-如何设置换源链接与测速链接.md)
|
||||
|
||||
8. 按需实现 `_setsrc()` `_getsrc()` `_resetsrc()`, 可以使用这些函数:
|
||||
|
||||
1. `framework/core.c` 中以 `chsrc_` 开头的所有函数或宏
|
||||
2. `xy.h` 中以 `xy_` 开头的所有函数或宏
|
||||
3. `chec.h` 中以 `chef_` 开头的所有函数或宏
|
||||
3. `chec.c` 中以 `chef_` 开头的所有函数或宏
|
||||
4. `helper.c` 中以 `hp_` 开头的所有函数或宏
|
||||
|
||||
一个简单的方法是,在 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>
|
||||
|
||||
|
|
@ -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);;
|
||||
```
|
||||
|
|
@ -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) 留言。**
|
||||
|
|
@ -3,21 +3,31 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : (Document Introduction.md)
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2024-12-27>
|
||||
! Last Modified : <2025-03-06>
|
||||
! Last Modified : <2025-08-22>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# 文档说明
|
||||
|
||||
E2E (End-to-End) 开发文档:
|
||||
|
||||
1. 开发环境准备,如何编译和测试,请参考 [./01-Develop.md](./01-Develop.md)
|
||||
2. 如何编写一个具体的 recipe,请参考 [./02-Write-A-Recipe-Even-If-You-Dont-Know-C.md](./02-Write-A-Recipe-Even-If-You-Dont-Know-C.md)
|
||||
3. 直接推送还是提交 PR,请参考 [./03-CONTRIBUTING.md](./03-CONTRIBUTING.md)
|
||||
4. 找谁来审阅 PR,请参考 [./04-MAINTAINERS.md](./04-MAINTAINERS.md)
|
||||
- 开发环境准备,如何编译和测试,请参考 [01-开发与构建.md](./01-开发与构建.md)
|
||||
- 直接推送还是提交 PR,请参考 [02-提交与贡献.md](./02-提交与贡献.md)
|
||||
- 代码风格,请参考 [03-为什么拒绝使用代码格式化工具.md](./03-为什么拒绝使用代码格式化工具.md)
|
||||
|
||||
<br>
|
||||
|
||||
具体 recipe 相关:
|
||||
|
||||
- 如何编写一个具体的 recipe,请参考 [10-如何编写recipe.md](./10-如何编写recipe.md)
|
||||
- 如何修改换源链接、模糊/精准测速链接,请参考 [11-如何设置换源链接与测速链接.md](./11-如何设置换源链接与测速链接.md)
|
||||
|
||||
<br>
|
||||
|
||||
- 关于维护者身份的说明,请参考 [50-协作者与维护者.md](./50-协作者与维护者.md)
|
||||
|
||||
<br>
|
||||
|
||||
|
|
|
|||
10
doc/chsrc.1
10
doc/chsrc.1
|
|
@ -2,14 +2,14 @@
|
|||
.\" SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
.\" --------------------------------------------------------------
|
||||
.\" Doc Type : Man Page
|
||||
.\" Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
.\" Contributors : Nul None <nul@none.org>
|
||||
.\" Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
.\" Contributors : Nul None <nul@none.org>
|
||||
.\" |
|
||||
.\" Created On : <2024-08-21>
|
||||
.\" Last Modified : <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
|
||||
chsrc - Change Source for every software on every platform from the command line
|
||||
|
|
|
|||
|
|
@ -2,29 +2,29 @@
|
|||
@c SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
@c --------------------------------------------------------------
|
||||
@c Doc Type : Texinfo
|
||||
@c Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
@c Contributors : Nul None <nul@none.org>
|
||||
@c Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
@c Contributors : Nul None <nul@none.org>
|
||||
@c |
|
||||
@c Created On : <2024-08-22>
|
||||
@c Last Modified : <2025-06-19>
|
||||
@c Last Modified : <2025-10-29>
|
||||
@c --------------------------------------------------------------
|
||||
|
||||
\input texinfo
|
||||
@setfilename chsrc.info
|
||||
@settitle chsrc
|
||||
|
||||
@set Chsrc_Version v0.2.1.2
|
||||
@set Doc_Publish_Date 2025-06-19
|
||||
@set Chsrc_Version v0.2.3.1
|
||||
@set Doc_Publish_Date 2025-10-29
|
||||
|
||||
@copying
|
||||
@comment 这是软件copyright,不是文档copyright,因此不放在titlepage
|
||||
Copyright @copyright{} 2025 Aoran Zeng, Heng Guo
|
||||
Copyright @copyright{} 2025 曾奥然, 郭恒
|
||||
@end copying
|
||||
|
||||
@titlepage
|
||||
@title chsrc printed manual
|
||||
@subtitle Change Source everywhere for every software!
|
||||
@author Aoran Zeng
|
||||
@author 曾奥然
|
||||
@c @insertcopying
|
||||
For chsrc @value{Chsrc_Version}
|
||||
@page
|
||||
|
|
|
|||
|
|
@ -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 |
31
justfile
31
justfile
|
|
@ -2,12 +2,12 @@
|
|||
# --------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# --------------------------------------------------------------
|
||||
# Build File : justfile
|
||||
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nul None <nul@none.org>
|
||||
# |
|
||||
# Build File : justfile
|
||||
# File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
# |
|
||||
# Created On : <2025-06-18>
|
||||
# Last Modified : <2025-07-21>
|
||||
# Last Modified : <2025-10-15>
|
||||
#
|
||||
# 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于
|
||||
# GNU make 以及相应的 MSYS2、Cygwin 环境
|
||||
|
|
@ -104,9 +104,9 @@ alias c := clean
|
|||
default: build-in-dev-mode
|
||||
|
||||
build-in-dev-mode:
|
||||
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
|
||||
@echo Finished: Build in DEV mode
|
||||
@echo Starting: Build in DEV mode: '{{CC}}' {{CFLAGS_dev_mode_prompt}} -o {{DevMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_dev_mode}} -o {{DevMode-Target-Name}}
|
||||
@echo Finished: Build in DEV mode
|
||||
|
||||
build-in-debug-mode:
|
||||
@echo Starting: Build in DEBUG mode: '{{CC}}' {{CFLAGS_debug_mode_prompt}} -o {{DebugMode-Target-Name}}
|
||||
|
|
@ -114,9 +114,17 @@ build-in-debug-mode:
|
|||
@echo Finished: Build in DEBUG mode
|
||||
|
||||
build-in-release-mode:
|
||||
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
|
||||
@{{CC}} src/chsrc-main.c {{CFLAGS_release_mode}} -o {{ReleaseMode-Target-Name}}
|
||||
@echo Finished: Build in RELEASE mode
|
||||
@echo Starting: Build in RELEASE mode: '{{CC}}' {{CFLAGS_release_mode_prompt}} -o {{ReleaseMode-Target-Name}}
|
||||
@{{ if os() == 'windows' { \
|
||||
'(if exist chsrc.res del chsrc.res)' + \
|
||||
' & windres src/resource/chsrc.rc -O coff -o chsrc.res' \
|
||||
} else { '' } }}
|
||||
@{{ if os() == 'windows' { \
|
||||
CC + ' src/chsrc-main.c chsrc.res ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
|
||||
} else { \
|
||||
CC + ' src/chsrc-main.c ' + CFLAGS_release_mode + ' -o ' + ReleaseMode-Target-Name \
|
||||
} }}
|
||||
@echo Finished: Build in RELEASE mode
|
||||
|
||||
debug: build-in-debug-mode
|
||||
@{{DEBUGGER}} {{DebugMode-Target-Name}}
|
||||
|
|
@ -140,6 +148,7 @@ test-cli:
|
|||
|
||||
clean:
|
||||
-@{{BIN_rm}} *.exe
|
||||
-@{{BIN_rm}} *.res
|
||||
-@{{BIN_rm}} xy
|
||||
-@{{BIN_rm}} fw
|
||||
-@{{BIN_rm}} chsrc
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
! -------------------------------------------------------------
|
||||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Doc Authors : 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! |
|
||||
! Created On : <2025-06-15>
|
||||
! Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
! Doc Type : Markdown
|
||||
! Doc Name : BUILD.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : 曾奥然 <ccmywish@qq.com>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
! Doc Type : Markdown
|
||||
! Doc Name : CI.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : 曾奥然 <ccmywish@qq.com>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------
|
||||
# Build File : Makefile
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
! Doc Type : Markdown
|
||||
! Doc Name : README.md
|
||||
! Doc Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
! | Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! | 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! |
|
||||
! Created On : <2025-06-14>
|
||||
! Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------
|
||||
# Test File : deb-installation-test.sh
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : 曾奥然 <ccmywish@qq.com>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: chsrc
|
||||
Upstream-Contact: Aoran Zeng <ccmywish@qq.com>
|
||||
Upstream-Contact: 曾奥然 <ccmywish@qq.com>
|
||||
Source: https://github.com/RubyMetric/chsrc
|
||||
|
||||
Files: *
|
||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
||||
2023-2025 Heng Guo <2085471348@qq.com>
|
||||
Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
|
||||
2023-2025 郭恒 <2085471348@qq.com>
|
||||
License: GPL-3+
|
||||
Comment: The authors' names are indicated in each source code file's header.
|
||||
|
||||
Files: lib/xy.h
|
||||
Copyright: 2023-2025 Aoran Zeng <ccmywish@qq.com>
|
||||
2023-2025 Heng Guo <2085471348@qq.com>
|
||||
Copyright: 2023-2025 曾奥然 <ccmywish@qq.com>
|
||||
2023-2025 郭恒 <2085471348@qq.com>
|
||||
License: MIT
|
||||
|
||||
Files: pkg/deb/debian/*
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# deb File : postinst
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# |
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# deb File : prerm
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# |
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-16>
|
||||
#
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
# --------------------------------------------------------------
|
||||
# Build File : rules
|
||||
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
|
||||
# | Aoran Zeng <ccmywish@qq.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# | 曾奥然 <ccmywish@qq.com>
|
||||
# Contributors : Nil Null <nil@null.org>
|
||||
# |
|
||||
# Created On : <2025-06-14>
|
||||
# Last Modified : <2025-06-20>
|
||||
|
|
|
|||
743
src/chsrc-main.c
743
src/chsrc-main.c
File diff suppressed because it is too large
Load Diff
|
|
@ -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 贡献者 ID,这个ID最好是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
|
|
@ -1,20 +1,18 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Name : chef.h
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nul None <nul@none.org>
|
||||
* File Name : helper.c
|
||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
* Contributors : Nul None <nul@none.org>
|
||||
* Created On : <2025-07-14>
|
||||
* Last Modified : <2025-07-14>
|
||||
* Last Modified : <2025-10-28>
|
||||
*
|
||||
* For chefs (recipe makers) and sometimes framewoker
|
||||
* to do some work not releated to OS operations
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
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://"));
|
||||
}
|
||||
|
|
@ -23,7 +21,7 @@ chef_is_url (const char *str)
|
|||
* @return 一律返回新字符串
|
||||
*/
|
||||
char *
|
||||
chef_remove_trailing_slash (char *str)
|
||||
hp_remove_trailing_slash (char *str)
|
||||
{
|
||||
char *newstr = xy_strdup (str);
|
||||
size_t len = strlen (newstr);
|
||||
|
|
@ -36,11 +34,11 @@ chef_remove_trailing_slash (char *str)
|
|||
* @return 一律返回新字符串
|
||||
*/
|
||||
char *
|
||||
chef_ensure_trailing_slash (char *str)
|
||||
hp_ensure_trailing_slash (char *str)
|
||||
{
|
||||
size_t len = strlen (str);
|
||||
if (len == 0 || str[len - 1] == '/')
|
||||
return xy_strdup (str);
|
||||
|
||||
return xy_2strjoin (str, "/");
|
||||
return xy_2strcat (str, "/");
|
||||
}
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Name : mirror.c
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* File Name : mirror.c
|
||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
* | 郭恒 <2085471348@qq.com>
|
||||
* Contributors : Shengwei Chen <414685209@qq.com>
|
||||
* | Jialin Lyu <jialinlvcn@aliyun.com>
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* | Jialin Lyu <jialinlvcn@aliyun.com>
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||
* |
|
||||
* 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}
|
||||
},
|
||||
|
||||
HuaweiCDN =
|
||||
{
|
||||
IS_GeneralMirrorSite,
|
||||
"huawei-cdn", "Huawei Cloud CDN", "华为开源镜像站(CDN)", "https://repo.huaweicloud.com/",
|
||||
{NotSkip, NA, NA, "https://repo.huaweicloud.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Volcengine =
|
||||
{
|
||||
IS_GeneralMirrorSite,
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Name : struct.h
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
* | 郭恒 <2085471348@qq.com>
|
||||
* Contributors : Shengwei Chen <414685209@qq.com>
|
||||
* |
|
||||
* Created On : <2023-08-29>
|
||||
* Last Modified : <2025-07-11>
|
||||
* Last Modified : <2025-08-22>
|
||||
*
|
||||
* chsrc struct
|
||||
* ------------------------------------------------------------*/
|
||||
|
|
@ -35,7 +35,7 @@ typedef enum ProviderType_t
|
|||
IS_GeneralMirrorSite, /* 通用镜像站 */
|
||||
IS_DedicatedMirrorSite, /* 专用镜像站 */
|
||||
IS_UpstreamProvider, /* 上游默认源 */
|
||||
IS_VirtualProvider, /* 用户提供 */
|
||||
IS_UserDefinedProvider, /* 用户提供 */
|
||||
}
|
||||
ProviderType_t;
|
||||
|
||||
|
|
@ -55,18 +55,17 @@ typedef SourceProvider_t MirrorSite_t;
|
|||
SourceProvider_t UpstreamProvider =
|
||||
{
|
||||
IS_UpstreamProvider,
|
||||
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段,可使用 def_upstream 宏 */
|
||||
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段 */
|
||||
"upstream", "Upstream", "上游默认源", NULL,
|
||||
/* 引入新的上游默认源时,请完全修改下面这个结构体,可使用 def_need_measure_info 宏 */
|
||||
{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}
|
||||
|
||||
SourceProvider_t UserDefinedProvider =
|
||||
{
|
||||
IS_VirtualProvider,
|
||||
IS_UserDefinedProvider,
|
||||
"user", "用户自定义", "用户自定义", NULL,
|
||||
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL, ACCURATE}
|
||||
};
|
||||
|
|
@ -92,70 +91,89 @@ Source_t;
|
|||
#define DelegateToMirror NULL
|
||||
/* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */
|
||||
#define NeedContribute NULL
|
||||
/* 由 _sources_prepare 填充 */
|
||||
#define FeedBySourcesPrepare NULL
|
||||
|
||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||
/* 由 prelude() 填充 */
|
||||
#define FeedByPrelude NULL
|
||||
|
||||
|
||||
enum Capability_t
|
||||
typedef enum Capability_t
|
||||
{
|
||||
CanNot,
|
||||
FullyCan,
|
||||
PartiallyCan
|
||||
};
|
||||
|
||||
|
||||
/* Target Feature */
|
||||
typedef struct Feature_t
|
||||
{
|
||||
bool can_get;
|
||||
bool can_reset; /* 有的reset不是暂时没有实现,而是现在的实现根本就无法重置 */
|
||||
|
||||
bool can_english;
|
||||
|
||||
bool can_user_define; /* 用户自定义换源URL */
|
||||
|
||||
enum Capability_t cap_locally;
|
||||
char *cap_locally_explain;
|
||||
|
||||
char *note;
|
||||
}
|
||||
Feature_t;
|
||||
Capability_t;
|
||||
|
||||
|
||||
|
||||
typedef struct Contributor_t
|
||||
{
|
||||
char *id; /* 全局唯一贡献者标识符,防止反复写信息,以 @ 开头 */
|
||||
char *name; /* 贡献者姓名; 鉴于该项目完全依赖于贡献者,建议留下真实姓名或者昵称 */
|
||||
char *email;
|
||||
char *display_name; /* recipe 结束时会显示贡献者信息,如果你不愿显示真实姓名或者昵称,可以另外提供一个名字 */
|
||||
}
|
||||
Contributor_t;
|
||||
|
||||
|
||||
typedef struct Target_t
|
||||
{
|
||||
/* 以 / 为分隔符的多个目标别名 */
|
||||
char *aliases;
|
||||
|
||||
void (*getfn) (char *option);
|
||||
void (*setfn) (char *option);
|
||||
void (*resetfn) (char *option);
|
||||
|
||||
Feature_t (*featfn) (char *option);
|
||||
/* 初始化函数,用于填充该 struct 的各种信息 */
|
||||
void (*preludefn) (void);
|
||||
bool inited; /* 是否执行过了 preludefn() */
|
||||
|
||||
Source_t *sources;
|
||||
size_t sources_n;
|
||||
int sources_n;
|
||||
|
||||
|
||||
/* Features */
|
||||
bool can_english; /* 是否支持英文输出 */
|
||||
|
||||
bool can_user_define; /* 是否支持用户自定义URL来换源 */
|
||||
char *can_user_define_explain; /* 用户自定义URL的说明 */
|
||||
|
||||
Capability_t cap_local; /* 是否支持 local mode */
|
||||
char *cap_local_explain; /* local mode 的说明 */
|
||||
|
||||
char *note; /* 备注 */
|
||||
|
||||
|
||||
/* recipe 维护信息 */
|
||||
char *created_on;
|
||||
char *last_updated;
|
||||
char *sources_last_updated;
|
||||
|
||||
Contributor_t *chef; /* 该 recipe *当前*的总负责人 (可以任职也可以休职) */
|
||||
Contributor_t **cooks; /* 该 recipe 的主要作者 */
|
||||
int cooks_n;
|
||||
Contributor_t **sauciers; /* 该 recipe 的次要贡献者 (除主要作者外的其他人) */
|
||||
int sauciers_n;
|
||||
}
|
||||
Target_t;
|
||||
|
||||
|
||||
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
|
||||
#define def_target_inner_sr(t) NULL, t##_setsrc, t##_resetsrc, NULL
|
||||
#define def_target_inner_sf(t) NULL, t##_setsrc, NULL, t##_feat
|
||||
#define def_target_inner_srf(t) NULL, t##_setsrc, t##_resetsrc, t##_feat
|
||||
#define def_target_inner_gs(t) t##_getsrc, t##_setsrc, NULL, NULL
|
||||
#define def_target_inner_gsr(t) t##_getsrc, t##_setsrc, t##_resetsrc, NULL
|
||||
#define def_target_inner_gsf(t) t##_getsrc, t##_setsrc, NULL, t##_feat
|
||||
#define def_target_inner_gsrf(t) t##_getsrc, t##_setsrc, t##_resetsrc, t##_feat
|
||||
|
||||
#define def_target_sourcesn(t) t##_sources, t##_sources_n
|
||||
#define def_target(t, aliases) void t##_getsrc(char *option);void t##_setsrc(char *option);void t##_resetsrc(char *option); Target_t t##_target={aliases};
|
||||
|
||||
/* 大部分target还不支持reset,所以暂时先默认设置为NULL来过渡 */
|
||||
#define def_target(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
||||
#define def_target_s(t) Target_t t##_target = {def_target_inner_s(t),def_target_sourcesn(t)}
|
||||
#define def_target_sr(t) Target_t t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)}
|
||||
#define def_target_sf(t) Target_t t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)}
|
||||
#define def_target_srf(t) Target_t t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)}
|
||||
#define def_target_gs(t) Target_t t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsr(t) Target_t t##_target = {def_target_inner_gsr(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsf(t) Target_t t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)}
|
||||
#define def_target_gsrf(t) Target_t t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)}
|
||||
#define chef_allow_gsr(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
|
||||
#define chef_allow_s(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = NULL;
|
||||
#define chef_allow_sr(t) this->getfn = NULL; this->setfn = t##_setsrc; this->resetfn = t##_resetsrc;
|
||||
#define chef_allow_gs(t) this->getfn = t##_getsrc; this->setfn = t##_setsrc; this->resetfn = NULL;
|
||||
#define chef_allow_NOOP(t)
|
||||
#define chef_prep_this(t,op) Target_t *this = &t##_target; this->inited = true; chef_allow_##op(t);
|
||||
|
||||
#define use_this(t) Target_t *this = &t##_target;
|
||||
#define chsrc_use_this_source(t) Target_t *this = &t##_target; Source_t source = chsrc_yield_source_and_confirm (this, option);
|
||||
|
||||
#define def_sources_begin() Source_t sources[] = {
|
||||
#define def_sources_end() }; \
|
||||
this->sources_n = xy_c_array_len(sources); \
|
||||
char *_sources_storage = xy_malloc0 (sizeof(sources)); \
|
||||
memcpy (_sources_storage, sources, sizeof(sources)); \
|
||||
this->sources = (Source_t *)_sources_storage;
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -2,10 +2,10 @@
|
|||
! SPDX-License-Identifier: GPL-3.0-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Config Type : rawstr4c (Markdown)
|
||||
! Config Authors: Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Config Authors: 曾奥然 <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Created On : <2025-07-22>
|
||||
! Last Modified : <2025-07-22>
|
||||
! Last Modified : <2025-10-29>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# [rawstr4c] input for chsrc
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
- prefix = `RAWSTR_chsrc`
|
||||
- output = `:global-variable-only-header`
|
||||
- translate = `:oct`
|
||||
- keep-postfix = `false`
|
||||
- no-postfix = `true`
|
||||
|
||||
<br>
|
||||
|
||||
|
|
@ -71,8 +71,8 @@
|
|||
维护:
|
||||
邀请您担任 Chef, 为用户把关您熟悉的 recipe
|
||||
|
||||
源代码地址: @url@
|
||||
成为维护者: https://github.com/RubyMetric/chsrc/issues/130
|
||||
源代码地址: https://github.com/RubyMetric/chsrc
|
||||
成为维护者: https://github.com/RubyMetric/chsrc/issues/275
|
||||
```
|
||||
|
||||
<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:
|
||||
|
||||
Source Code: @url@
|
||||
Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/130
|
||||
Become a Maintainer: https://github.com/RubyMetric/chsrc/issues/275
|
||||
```
|
||||
|
||||
<br>
|
||||
|
|
@ -132,16 +132,36 @@ MAINTAIN:
|
|||
|
||||
## for `chsrc -v`
|
||||
|
||||
- name = `for__v`
|
||||
- name = `for__v_CHINESE`
|
||||
|
||||
```
|
||||
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>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
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>
|
||||
|
|
@ -154,6 +174,7 @@ Written by Aoran Zeng, Heng Guo and contributors. (See chsrc-main.c)
|
|||
|
||||
```
|
||||
我们同时在 GitHub 和 Gitee 接受 issue 和 Bug 报告:
|
||||
|
||||
- https://github.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`
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,42 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2025-07-14
|
||||
*/
|
||||
static Source_t pl_clojure_sources[] =
|
||||
def_target(pl_clojure, "clojure/clojars/cloj/lein");
|
||||
|
||||
void
|
||||
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},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror},
|
||||
{&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror},
|
||||
{&Nyist, "https://mirror.nyist.edu.cn/clojars/", DelegateToMirror},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/clojars/", DelegateToMirror},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/clojars/", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_clojure);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pl_clojure_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_clojure);
|
||||
chsrc_use_this_source (pl_clojure);
|
||||
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
|
|
@ -41,30 +51,5 @@ pl_clojure_setsrc (char *option)
|
|||
println (config);
|
||||
}
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,42 +1,36 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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");
|
||||
|
||||
/**
|
||||
* @update 2025-04-15
|
||||
*/
|
||||
static SourceProvider_t pl_dart_flutter_upstream =
|
||||
void
|
||||
pl_dart_flutter_prelude (void)
|
||||
{
|
||||
def_upstream, "https://storage.googleapis.com",
|
||||
{NotSkip, NA, NA, "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz", ACCURATE} // 231 MB
|
||||
};
|
||||
chef_prep_this (pl_dart_flutter, gsr);
|
||||
|
||||
static Source_t pl_dart_flutter_sources[] =
|
||||
{
|
||||
{&pl_dart_flutter_upstream, "https://storage.googleapis.com", DelegateToUpstream},
|
||||
{&FlutterCN, "https://storage.flutter-io.cn", DelegateToMirror},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn", NULL }, /* 官方文档也没有给后缀,怀疑是否存在问题 */
|
||||
chef_set_created_on (this, "2023-09-10");
|
||||
chef_set_last_updated (this, "2025-07-11");
|
||||
chef_set_sources_last_updated (this, "2025-04-15");
|
||||
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter",
|
||||
"https://mirrors.tuna.tsinghua.edu.cn/flutter" PL_Dart_Flutter_Speed_URL_Postfix},
|
||||
chef_set_chef (this, NULL);
|
||||
chef_set_cooks (this, 1, "@ccmywish");
|
||||
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
|
||||
|
||||
{&Nju, "https://mirror.nju.edu.cn/flutter",
|
||||
"https://mirror.nju.edu.cn/flutter" PL_Dart_Flutter_Speed_URL_Postfix}
|
||||
};
|
||||
def_sources_n(pl_dart_flutter);
|
||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||
chef_allow_english(this);
|
||||
chef_allow_user_define(this);
|
||||
|
||||
def_sources_begin()
|
||||
{&UpstreamProvider, "https://storage.googleapis.com", FeedByPrelude},
|
||||
{&FlutterCN, "https://storage.flutter-io.cn", FeedByPrelude},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn", FeedByPrelude }, /* 官方文档也没有给后缀,怀疑是否存在问题 */
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/flutter", FeedByPrelude},
|
||||
{&Nju, "https://mirror.nju.edu.cn/flutter", FeedByPrelude}
|
||||
def_sources_end()
|
||||
|
||||
chef_set_sources_speed_measure_url_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -57,13 +51,13 @@ pl_dart_flutter_getsrc (char *option)
|
|||
void
|
||||
pl_dart_flutter_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_dart_flutter);
|
||||
chsrc_use_this_source (pl_dart_flutter);
|
||||
|
||||
char *w = NULL;
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
@ -72,7 +66,7 @@ pl_dart_flutter_setsrc (char *option)
|
|||
char *bashrc = xy_bashrc;
|
||||
|
||||
chsrc_backup (zshrc);
|
||||
w = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n");
|
||||
w = xy_strcat (3, "export FLUTTER_STORAGE_BASE_URL=\"", source.url, "\"\n");
|
||||
chsrc_append_to_file (w, zshrc);
|
||||
|
||||
if (xy_file_exist (bashrc))
|
||||
|
|
@ -92,27 +86,3 @@ pl_dart_flutter_resetsrc (char *option)
|
|||
{
|
||||
pl_dart_flutter_setsrc (option);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc ls flutter
|
||||
*/
|
||||
Feature_t
|
||||
pl_dart_flutter_feat (char *option)
|
||||
{
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
||||
f.cap_locally = CanNot;
|
||||
f.cap_locally_explain = NULL;
|
||||
f.can_english = true;
|
||||
|
||||
f.can_user_define = true;
|
||||
|
||||
f.note = "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件";
|
||||
return f;
|
||||
}
|
||||
|
||||
def_target_gsrf(pl_dart_flutter);
|
||||
|
|
|
|||
|
|
@ -1,45 +1,36 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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");
|
||||
|
||||
/**
|
||||
* @update 2025-04-15
|
||||
*/
|
||||
static SourceProvider_t pl_dart_upstream =
|
||||
void
|
||||
pl_dart_prelude (void)
|
||||
{
|
||||
def_upstream, "https://pub.dev",
|
||||
{NotSkip, NA, NA, "https://pub.dev/packages/flutter_vision/versions/1.1.4.tar.gz", ACCURATE} // 37.05 MB
|
||||
};
|
||||
chef_prep_this (pl_dart, gsr);
|
||||
|
||||
static Source_t pl_dart_sources[] =
|
||||
{
|
||||
{&pl_dart_upstream, "https://pub.dev", DelegateToUpstream},
|
||||
chef_set_created_on (this, "2023-09-10");
|
||||
chef_set_last_updated (this, "2025-07-11");
|
||||
chef_set_sources_last_updated (this, "2025-04-15");
|
||||
|
||||
{&FlutterCN, "https://pub.flutter-io.cn",
|
||||
"https://pub.flutter-io.cn" PL_Dart_Pub_Speed_URL_Postfix},
|
||||
chef_set_chef (this, NULL);
|
||||
chef_set_cooks (this, 1, "@ccmywish");
|
||||
chef_set_sauciers (this, 2, "@czyt", "@xrgzs");
|
||||
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub",
|
||||
"https://mirror.sjtu.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix},
|
||||
chef_allow_local_mode (this, FullyCan, NULL, NULL);
|
||||
chef_allow_english(this);
|
||||
chef_allow_user_define(this);
|
||||
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub",
|
||||
"https://mirrors.tuna.tsinghua.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix},
|
||||
def_sources_begin()
|
||||
{&UpstreamProvider, "https://pub.dev", FeedByPrelude},
|
||||
{&FlutterCN, "https://pub.flutter-io.cn", FeedByPrelude},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub", FeedByPrelude},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub", FeedByPrelude},
|
||||
{&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude}
|
||||
def_sources_end()
|
||||
|
||||
{&Nju, "https://mirror.nju.edu.cn/dart-pub",
|
||||
"https://mirror.nju.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix}
|
||||
};
|
||||
def_sources_n(pl_dart);
|
||||
chef_set_sources_speed_measure_url_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -56,13 +47,13 @@ pl_dart_getsrc (char *option)
|
|||
void
|
||||
pl_dart_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_dart);
|
||||
chsrc_use_this_source (pl_dart);
|
||||
|
||||
char *w = NULL;
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
@ -71,7 +62,7 @@ pl_dart_setsrc (char *option)
|
|||
char *bashrc = xy_bashrc;
|
||||
|
||||
chsrc_backup (zshrc);
|
||||
w = xy_strjoin (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n");
|
||||
w = xy_strcat (3, "export PUB_HOSTED_URL=\"", source.url, "\"\n");
|
||||
|
||||
chsrc_append_to_file (w, zshrc);
|
||||
|
||||
|
|
@ -92,24 +83,3 @@ pl_dart_resetsrc (char *option)
|
|||
{
|
||||
pl_dart_setsrc (option);
|
||||
}
|
||||
|
||||
|
||||
Feature_t
|
||||
pl_dart_feat (char *option)
|
||||
{
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
||||
f.cap_locally = CanNot;
|
||||
f.cap_locally_explain = NULL;
|
||||
f.can_english = true;
|
||||
|
||||
f.can_user_define = true;
|
||||
|
||||
f.note = "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件";
|
||||
return f;
|
||||
}
|
||||
|
||||
def_target_gsrf(pl_dart);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,7 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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 =
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
def_target(pl_go, "go/golang/goproxy");
|
||||
|
||||
/**
|
||||
* @update 2025-07-12
|
||||
*
|
||||
* @note 缺少教育网软件源
|
||||
*/
|
||||
static Source_t pl_go_sources[] =
|
||||
void
|
||||
pl_go_prelude ()
|
||||
{
|
||||
{&pl_go_upstream, "https://proxy.golang.org", NULL},
|
||||
{&GoProxyCN, "https://goproxy.cn", DelegateToMirror},
|
||||
{&Ali, "https://mirrors.aliyun.com/goproxy/", NULL},
|
||||
chef_prep_this (pl_go, gsr);
|
||||
|
||||
chef_set_created_on (this, "2023-08-30");
|
||||
chef_set_last_updated (this, "2025-08-10");
|
||||
chef_set_sources_last_updated (this, "2025-07-12");
|
||||
|
||||
chef_set_chef (this, NULL);
|
||||
chef_set_cooks (this, 1, "@ccmywish");
|
||||
chef_set_sauciers (this, 2, "@czyt", "@techoc");
|
||||
|
||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||
chef_deny_english(this);
|
||||
chef_allow_user_define(this);
|
||||
|
||||
|
||||
def_sources_begin()
|
||||
{&UpstreamProvider, "https://proxy.golang.org", DelegateToUpstream},
|
||||
{&GoProxyCN, "https://goproxy.cn", DelegateToMirror},
|
||||
{&Ali, "https://mirrors.aliyun.com/goproxy/", DelegateToMirror},
|
||||
|
||||
// 暂时停用华为镜像源, 详见 https://github.com/RubyMetric/chsrc/issues/227
|
||||
// {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", NULL},
|
||||
// {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", DelegateToMirror},
|
||||
|
||||
{&GoProxyIO, "https://goproxy.io", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_go);
|
||||
{&GoProxyIO, "https://goproxy.io", DelegateToMirror}
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
pl_go_check_cmd ()
|
||||
{
|
||||
char *check_cmd = xy_str_to_quietcmd ("go version");
|
||||
char *check_cmd = xy_quiet_cmd ("go version");
|
||||
bool exist = query_program_exist (check_cmd, "go", Noisy_When_Exist|Noisy_When_NonExist);
|
||||
|
||||
if (!exist)
|
||||
|
|
@ -74,8 +73,6 @@ pl_go_getsrc (char *option)
|
|||
|
||||
|
||||
/**
|
||||
* chsrc set go
|
||||
*
|
||||
* @consult https://goproxy.cn/
|
||||
*/
|
||||
void
|
||||
|
|
@ -83,47 +80,20 @@ pl_go_setsrc (char *option)
|
|||
{
|
||||
pl_go_check_cmd ();
|
||||
|
||||
chsrc_yield_source_and_confirm (pl_go);
|
||||
chsrc_use_this_source (pl_go);
|
||||
|
||||
char *cmd = "go env -w GO111MODULE=on";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
cmd = xy_strcat (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
||||
/**
|
||||
* chsrc reset go
|
||||
*/
|
||||
|
||||
void
|
||||
pl_go_resetsrc (char *option)
|
||||
{
|
||||
pl_go_setsrc (option);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc ls go
|
||||
*/
|
||||
Feature_t
|
||||
pl_go_feat (char *option)
|
||||
{
|
||||
Feature_t f = {0};
|
||||
|
||||
f.can_get = true;
|
||||
f.can_reset = true;
|
||||
|
||||
f.cap_locally = CanNot;
|
||||
f.cap_locally_explain = NULL;
|
||||
f.can_english = false;
|
||||
|
||||
f.can_user_define = true;
|
||||
|
||||
f.note = NULL;
|
||||
return f;
|
||||
}
|
||||
|
||||
def_target_gsrf(pl_go);
|
||||
|
|
|
|||
|
|
@ -1,26 +1,36 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2023-09-10
|
||||
*/
|
||||
static Source_t pl_haskell_sources[] =
|
||||
def_target(pl_haskell, "haskell/cabal/stack/hackage");
|
||||
|
||||
void
|
||||
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},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/hackage", DelegateToMirror},
|
||||
{&Nju, "https://mirror.nju.edu.cn/hackage", DelegateToMirror},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/hackage", DelegateToMirror},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/hackage", DelegateToMirror},
|
||||
{&Nyist, "https://mirror.nyist.edu.cn/hackage", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_haskell);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -29,12 +39,12 @@ def_sources_n(pl_haskell);
|
|||
void
|
||||
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 *config = NULL;
|
||||
if (xy_on_windows)
|
||||
if (xy.on_windows)
|
||||
{
|
||||
config = xy_normalize_path ("~/AppData/Roaming/cabal/config");
|
||||
}
|
||||
|
|
@ -43,34 +53,13 @@ pl_haskell_setsrc (char *option)
|
|||
config = "~/.cabal/config";
|
||||
}
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
print (content);
|
||||
chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
|
||||
println (content);
|
||||
|
||||
config = xy_normalize_path ("~/.stack/config.yaml");
|
||||
content = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url);
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
print (content);
|
||||
chsrc_note2 (xy_strcat (3, "请向 ", config, " 中手动添加:"));
|
||||
println (content);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,84 +1,154 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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_upstream, "https://mvnrepository.com/",
|
||||
def_need_measure_info
|
||||
};
|
||||
def_target(pl_java, "java/maven/mvn/maven-daemon/mvnd/gradle");
|
||||
|
||||
/**
|
||||
* @update 2024-12-18
|
||||
*/
|
||||
static Source_t pl_java_sources[] =
|
||||
void
|
||||
pl_java_prelude ()
|
||||
{
|
||||
{&pl_java_upstream, NULL, NULL},
|
||||
{&Ali, "https://maven.aliyun.com/repository/public/", DelegateToMirror},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/maven/", DelegateToMirror},
|
||||
/* 网易的24小时更新一次 */
|
||||
{&Netease, "http://mirrors.163.com/maven/repository/maven-public/", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_java);
|
||||
chef_prep_this (pl_java, gsr);
|
||||
|
||||
chef_set_created_on (this, "2023-08-31");
|
||||
chef_set_last_updated (this, "2025-08-27");
|
||||
chef_set_sources_last_updated (this, "2024-12-18");
|
||||
|
||||
chef_set_chef (this, NULL);
|
||||
chef_set_cooks (this, 2, "@BingChunMoLi", "@ccmywish");
|
||||
chef_set_sauciers (this, 0);
|
||||
|
||||
chef_allow_local_mode (this, CanNot, NULL, NULL);
|
||||
chef_deny_english(this);
|
||||
chef_allow_user_define(this);
|
||||
|
||||
// 阿里巴巴开源镜像站需要修改为此才能测速
|
||||
// https://github.com/RubyMetric/chsrc/issues/238#issuecomment-3162367686
|
||||
chef_set_user_agent ("Maven/3.9.11");
|
||||
|
||||
def_sources_begin()
|
||||
{&UpstreamProvider, "https://repo1.maven.org/maven2/", FeedByPrelude},
|
||||
{&Ali, "https://maven.aliyun.com/repository/public/", FeedByPrelude},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/maven/", FeedByPrelude},
|
||||
{&HuaweiCDN, "https://repo.huaweicloud.com/repository/maven/", FeedByPrelude},
|
||||
{&Tencent, "https://mirrors.cloud.tencent.com/nexus/repository/maven-public/",FeedByPrelude},
|
||||
// 网易的24小时更新一次
|
||||
{&Netease, "http://mirrors.163.com/maven/repository/maven-public/", FeedByPrelude}
|
||||
def_sources_end()
|
||||
|
||||
// 220MB
|
||||
chef_set_sources_speed_measure_url_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pl_java_check_cmd (bool *maven_exist, bool *gradle_exist)
|
||||
pl_java_check_cmd (bool *maven_exist, bool *gradle_exist, bool *maven_daemon_exist)
|
||||
{
|
||||
*maven_exist = chsrc_check_program ("mvn");
|
||||
*gradle_exist = chsrc_check_program ("gradle");
|
||||
*maven_daemon_exist = chsrc_check_program ("mvnd");
|
||||
|
||||
if (! *maven_exist && ! *gradle_exist)
|
||||
if (! *maven_exist && ! *gradle_exist && ! *maven_daemon_exist)
|
||||
{
|
||||
chsrc_error ("maven 与 gradle 命令均未找到,请检查是否存在其一");
|
||||
chsrc_error ("maven(maven-daemon) 与 gradle 命令均未找到,请检查是否存在其一");
|
||||
exit (Exit_UserCause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
pl_java_is_maven_home_line (const char *line)
|
||||
{
|
||||
if (xy_str_start_with (line, "Maven home:"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @consult https://github.com/RubyMetric/chsrc/pull/268#issuecomment-3209071819
|
||||
*/
|
||||
char *
|
||||
pl_java_find_maven_config ()
|
||||
{
|
||||
char *buf = xy_run ("mvn -v", 2);
|
||||
char *maven_home = xy_str_delete_prefix (buf, "Maven home: ");
|
||||
maven_home = xy_str_strip (maven_home);
|
||||
char *output;
|
||||
int status = xy_run_get_stdout ("mvn -v", &output);
|
||||
if (0==status)
|
||||
{
|
||||
char *maven_home_line = xy_run_iter_lines ("mvn -v", 0, pl_java_is_maven_home_line);
|
||||
char *maven_home = xy_str_delete_prefix (maven_home_line, "Maven home: ");
|
||||
char *maven_config = xy_normalize_path (xy_2strcat (maven_home, "/conf/settings.xml"));
|
||||
return maven_config;
|
||||
}
|
||||
|
||||
char *maven_config = xy_normalize_path (xy_2strjoin (maven_home, "/conf/settings.xml"));
|
||||
return maven_config;
|
||||
chsrc_alert2 ("未找到 maven home, 将使用用户配置文件");
|
||||
return "~/.m2/settings.xml";
|
||||
}
|
||||
|
||||
char *
|
||||
pl_java_find_maven_daemon_config ()
|
||||
{
|
||||
char *output;
|
||||
int status = xy_run_get_stdout ("mvnd -v", &output);
|
||||
if (0==status)
|
||||
{
|
||||
char *maven_home_line = xy_run_iter_lines ("mvnd -v", 0, pl_java_is_maven_home_line);
|
||||
char *maven_home = xy_str_delete_prefix (maven_home_line, "Maven home: ");
|
||||
char *maven_config = xy_normalize_path (xy_2strcat (maven_home, "/conf/settings.xml"));
|
||||
return maven_config;
|
||||
}
|
||||
|
||||
chsrc_alert2 ("未找到 maven home, 将使用用户配置文件");
|
||||
return "~/.m2/settings.xml";
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pl_java_getsrc (char *option)
|
||||
{
|
||||
bool maven_exist, gradle_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist);
|
||||
char *maven_config = pl_java_find_maven_config ();
|
||||
chsrc_note2 (xy_2strjoin ("请查看 ", maven_config));
|
||||
bool maven_exist, gradle_exist, maven_daemon_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
|
||||
if (maven_exist)
|
||||
{
|
||||
char *maven_config = pl_java_find_maven_config ();
|
||||
chsrc_note2 (xy_2strcat ("请查看 ", maven_config));
|
||||
}
|
||||
if (maven_daemon_exist)
|
||||
{
|
||||
char *maven_config = pl_java_find_maven_daemon_config ();
|
||||
chsrc_note2 (xy_2strcat ("请查看 ", maven_config));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @consult https://developer.aliyun.com/mirror/maven
|
||||
*/
|
||||
void
|
||||
pl_java_setsrc (char *option)
|
||||
{
|
||||
bool maven_exist, gradle_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist);
|
||||
|
||||
chsrc_yield_source_and_confirm (pl_java);
|
||||
bool maven_exist, gradle_exist, maven_daemon_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist, &maven_daemon_exist);
|
||||
|
||||
chsrc_use_this_source(pl_java);
|
||||
if (maven_exist)
|
||||
{
|
||||
char *file = xy_str_gsub (RAWSTR_pl_java_maven_config, "@1@", source.mirror->code);
|
||||
file = xy_str_gsub (file, "@name@", source.mirror->name);
|
||||
file = xy_str_gsub (file, "@url@", source.url);
|
||||
char *maven_config = pl_java_find_maven_config ();
|
||||
chsrc_note2 (xy_strjoin (3, "请在 maven 配置文件 ", maven_config, " 中添加:"));
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -90,26 +160,12 @@ pl_java_setsrc (char *option)
|
|||
println (file);
|
||||
}
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
||||
|
||||
Feature_t
|
||||
pl_java_feat (char *option)
|
||||
void
|
||||
pl_java_resetsrc (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;
|
||||
pl_java_setsrc (option);
|
||||
}
|
||||
|
||||
def_target_gsf(pl_java);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
* ------------------------------------------------------------*/
|
||||
|
||||
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");
|
||||
*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
|
||||
pl_nodejs_group_getsrc (char *option)
|
||||
pl_js_group_getsrc (char *option)
|
||||
{
|
||||
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();
|
||||
|
||||
if (npm_exist)
|
||||
{
|
||||
pl_nodejs_npm_getsrc (option);
|
||||
pl_js_npm_getsrc (option);
|
||||
br();
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
{
|
||||
pl_nodejs_yarn_getsrc (option);
|
||||
pl_js_yarn_getsrc (option);
|
||||
br();
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
{
|
||||
pl_nodejs_pnpm_getsrc (option);
|
||||
pl_js_pnpm_getsrc (option);
|
||||
br();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc set nodejs
|
||||
*/
|
||||
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: "
|
||||
|
|
@ -72,26 +66,27 @@ pl_nodejs_group_setsrc (char *option)
|
|||
}
|
||||
|
||||
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_yield_source_and_confirm (pl_nodejs_group);
|
||||
|
||||
chsrc_use_this_source (pl_js_group);
|
||||
|
||||
if (npm_exist)
|
||||
{
|
||||
pl_nodejs_npm_setsrc (option);
|
||||
pl_js_npm_setsrc (option);
|
||||
br();
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
{
|
||||
pl_nodejs_yarn_setsrc (option);
|
||||
pl_js_yarn_setsrc (option);
|
||||
br();
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
{
|
||||
pl_nodejs_pnpm_setsrc (option);
|
||||
pl_js_pnpm_setsrc (option);
|
||||
}
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
|
|
@ -99,33 +94,8 @@ pl_nodejs_group_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset nodejs
|
||||
*/
|
||||
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);
|
||||
|
|
@ -1,15 +1,31 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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
|
||||
pl_nodejs_yarn_get_yarn_version ()
|
||||
pl_js_yarn_get_yarn_version ()
|
||||
{
|
||||
char *ver = xy_run ("yarn --version", 0);
|
||||
double version = atof (ver);
|
||||
|
|
@ -17,14 +33,11 @@ pl_nodejs_yarn_get_yarn_version ()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get yarn
|
||||
*/
|
||||
void
|
||||
pl_nodejs_yarn_getsrc (char *option)
|
||||
pl_js_yarn_getsrc (char *option)
|
||||
{
|
||||
// 最后一个版本应该是 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
|
||||
// 从 Yarn V2 开始,使用新的配置名
|
||||
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
|
||||
*/
|
||||
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())
|
||||
chsrc_confirm_source();
|
||||
chsrc_confirm_source(&source);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
// 从 Yarn V2 开始,使用新的配置名
|
||||
if (pl_nodejs_yarn_get_yarn_version () >= 2)
|
||||
if (pl_js_yarn_get_yarn_version () >= 2)
|
||||
{
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
|
@ -65,8 +78,8 @@ pl_nodejs_yarn_setsrc (char *option)
|
|||
// 不能直接退出,因为 Leader target 不能就此结束
|
||||
return;
|
||||
}
|
||||
// 不再阻止换源命令输出到终端,即不再调用 xy_str_to_quietcmd()
|
||||
cmd = xy_2strjoin ("yarn config set registry ", source.url);
|
||||
// 不再阻止换源命令输出到终端,即不再调用 xy_quiet_cmd()
|
||||
cmd = xy_2strcat ("yarn config set registry ", source.url);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
|
|
@ -78,35 +91,8 @@ pl_nodejs_yarn_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset yarn
|
||||
*/
|
||||
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)};
|
||||
|
|
@ -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");
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -1,23 +1,33 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2025-07-14
|
||||
*/
|
||||
static Source_t pl_julia_sources[] =
|
||||
def_target(pl_julia, "julia");
|
||||
|
||||
void
|
||||
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},
|
||||
{&Nju, "https://mirror.nju.edu.cn/julia", DelegateToMirror},
|
||||
{&Iscas, "https://mirror.iscas.ac.cn/julia", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_julia);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
#define PL_Julia_Config "~/.julia/config/startup.jl"
|
||||
|
||||
|
|
@ -42,32 +52,11 @@ pl_julia_getsrc (char *option)
|
|||
void
|
||||
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_determine_chgtype (ChgType_Untested);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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 =
|
||||
|
|
@ -14,17 +9,30 @@ static MirrorSite_t Api7 =
|
|||
{SKIP, ToFill, ToFill, NULL, ROUGH}
|
||||
};
|
||||
|
||||
def_target(pl_lua, "lua/luarocks");
|
||||
|
||||
/**
|
||||
* @update 2025-07-14
|
||||
* @note 目前只有一个源
|
||||
*/
|
||||
static Source_t pl_lua_sources[] =
|
||||
void
|
||||
pl_lua_prelude ()
|
||||
{
|
||||
{&UpstreamProvider, NULL, NULL},
|
||||
{&Api7, "https://luarocks.cn", NULL},
|
||||
};
|
||||
def_sources_n(pl_lua);
|
||||
chef_prep_this (pl_lua, gs);
|
||||
|
||||
chef_set_created_on (this, "2023-09-27");
|
||||
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
|
||||
|
|
@ -40,41 +48,20 @@ pl_lua_getsrc (char *option)
|
|||
void
|
||||
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"
|
||||
"}");
|
||||
|
||||
chsrc_note2 ("请手动修改 ~/.luarocks/config.lua 文件 (用于下载):");
|
||||
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, "\"");
|
||||
|
||||
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
||||
println (upload_config);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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)};
|
||||
|
|
@ -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);
|
||||
|
|
@ -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)};
|
||||
|
|
@ -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)};
|
||||
|
|
@ -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)};
|
||||
|
|
@ -1,33 +1,31 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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 =
|
||||
{
|
||||
IS_UpstreamProvider,
|
||||
"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/",
|
||||
{SKIP, ToFill, ToFill, NULL, ROUGH}
|
||||
};
|
||||
def_target(pl_nuget, "nuget/net/.net/dotnet");
|
||||
|
||||
/**
|
||||
* @update 2024-04-18
|
||||
* @note {
|
||||
* 暂时未实现该换源功能,可参照
|
||||
* https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language
|
||||
* }
|
||||
*/
|
||||
static Source_t pl_nuget_sources[] =
|
||||
void
|
||||
pl_nuget_prelude ()
|
||||
{
|
||||
{&UpstreamProvider, NULL, NULL},
|
||||
{&NugetOrg, "https://www.nuget.org/api/v2/", NULL},
|
||||
chef_prep_this (pl_nuget, gs);
|
||||
|
||||
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}
|
||||
};
|
||||
def_sources_n(pl_nuget);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -37,28 +35,11 @@ pl_nuget_getsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 暂时未实现该换源功能,可参照 https://mirrors.huaweicloud.com/mirrorDetail/5ebf85de07b41baf6d0882ab?mirrorName=nuget&catalog=language
|
||||
*/
|
||||
void
|
||||
pl_nuget_setsrc (char *option)
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,31 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2025-07-14
|
||||
*/
|
||||
static Source_t pl_ocaml_sources[] =
|
||||
def_target(pl_ocaml, "ocaml/opam");
|
||||
|
||||
void
|
||||
pl_ocaml_prelude ()
|
||||
{
|
||||
{&UpstreamProvider, NULL, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/git/opam-repository.git", NULL}
|
||||
};
|
||||
def_sources_n(pl_ocaml);
|
||||
chef_prep_this (pl_ocaml, gs);
|
||||
|
||||
chef_set_created_on (this, "2023-09-15");
|
||||
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
|
||||
|
|
@ -41,38 +51,16 @@ pl_ocaml_setsrc (char *option)
|
|||
{
|
||||
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,
|
||||
" --all --set-default");
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,25 +1,34 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-09-14
|
||||
* @note 缺少教育网或开源社区软件源
|
||||
*/
|
||||
static Source_t pl_php_sources[] =
|
||||
def_target(pl_php, "php/composer");
|
||||
|
||||
void
|
||||
pl_php_prelude ()
|
||||
{
|
||||
{&UpstreamProvider, NULL},
|
||||
{&Ali, "https://mirrors.aliyun.com/composer/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/composer/"},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/composer/"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
|
||||
};
|
||||
def_sources_n(pl_php);
|
||||
chef_prep_this (pl_php, gs);
|
||||
|
||||
chef_set_created_on (this, "2023-08-30");
|
||||
chef_set_last_updated (this, "2025-08-10");
|
||||
chef_set_sources_last_updated (this, "2025-08-24");
|
||||
|
||||
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
|
||||
|
|
@ -46,7 +55,7 @@ pl_php_setsrc (char *option)
|
|||
{
|
||||
pl_php_check_cmd ();
|
||||
|
||||
chsrc_yield_source_and_confirm (pl_php);
|
||||
chsrc_use_this_source (pl_php);
|
||||
|
||||
char *where = " -g ";
|
||||
if (chsrc_in_local_mode())
|
||||
|
|
@ -54,28 +63,8 @@ pl_php_setsrc (char *option)
|
|||
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_determine_chgtype (ChgType_Auto);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,33 +1,46 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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_upstream, "https://metacpan.org/",
|
||||
def_need_measure_info
|
||||
};
|
||||
def_target(pl_perl, "perl/cpan");
|
||||
|
||||
/**
|
||||
* @update 2024-05-24
|
||||
*/
|
||||
static Source_t pl_perl_sources[] =
|
||||
void
|
||||
pl_perl_prelude ()
|
||||
{
|
||||
{&pl_perl_upstream, NULL, NULL},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/", DelegateToMirror},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/", DelegateToMirror},
|
||||
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/", DelegateToMirror},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/CPAN/", DelegateToMirror},
|
||||
{&Ali, "https://mirrors.aliyun.com/CPAN/", DelegateToMirror},
|
||||
{&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(pl_perl);
|
||||
chef_prep_this (pl_perl, gs);
|
||||
|
||||
chef_set_created_on (this, "2023-09-31");
|
||||
chef_set_last_updated (this, "2025-10-07");
|
||||
chef_set_sources_last_updated (this, "2025-10-07");
|
||||
|
||||
chef_set_chef (this, NULL);
|
||||
chef_set_cooks (this, 1, "@ccmywish");
|
||||
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
|
||||
|
|
@ -54,36 +67,14 @@ pl_perl_getsrc (char *option)
|
|||
void
|
||||
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()\"");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
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()\"");
|
||||
|
||||
chsrc_determine_chgtype (ChgType_SemiAuto);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,30 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* chsrc get pdm
|
||||
*/
|
||||
def_target(pl_python_pdm, "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
|
||||
pl_python_pdm_getsrc (char *option)
|
||||
{
|
||||
|
|
@ -22,22 +37,20 @@ pl_python_pdm_getsrc (char *option)
|
|||
|
||||
/**
|
||||
* @consult https://github.com/RubyMetric/chsrc/issues/19
|
||||
*
|
||||
* chsrc set pdm
|
||||
*/
|
||||
void
|
||||
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())
|
||||
chsrc_confirm_source();
|
||||
chsrc_confirm_source(&source);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
|
|
@ -48,38 +61,8 @@ pl_python_pdm_setsrc (char *option)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset pdm
|
||||
*/
|
||||
void
|
||||
pl_python_pdm_resetsrc (char *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)};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,29 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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
|
||||
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
|
||||
*
|
||||
* chsrc set poetry
|
||||
*/
|
||||
void
|
||||
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())
|
||||
chsrc_confirm_source();
|
||||
chsrc_confirm_source(&source);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
if (!chsrc_in_local_mode())
|
||||
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);
|
||||
|
||||
if (chsrc_in_standalone_mode())
|
||||
|
|
@ -47,35 +57,8 @@ pl_python_poetry_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset poetry
|
||||
*/
|
||||
void
|
||||
pl_python_poetry_resetsrc (char *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)};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* |
|
||||
* Created On : <2023-09-03>
|
||||
* Last Modified : <2025-07-14>
|
||||
*
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
|
|
@ -58,7 +57,8 @@ pl_python_group_setsrc (char *option)
|
|||
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pl_python_group_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,31 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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中
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
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 *
|
||||
pl_python_find_rye_config ()
|
||||
{
|
||||
|
|
@ -18,28 +35,24 @@ pl_python_find_rye_config ()
|
|||
return rye_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* chsrc get rye
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
pl_python_rye_getsrc (char *option)
|
||||
{
|
||||
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 recipe Java
|
||||
*
|
||||
* chsrc set rye
|
||||
*/
|
||||
void
|
||||
pl_python_rye_setsrc (char *option)
|
||||
{
|
||||
/* 并不在 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;
|
||||
|
||||
|
|
@ -47,44 +60,16 @@ pl_python_rye_setsrc (char *option)
|
|||
content = xy_str_gsub (content, "@2@", source.url);
|
||||
|
||||
char *rye_config = pl_python_find_rye_config ();
|
||||
chsrc_note2 (xy_strjoin (3, "请在配置文件 ", rye_config, " 中添加:"));
|
||||
print (content);
|
||||
chsrc_note2 (xy_strcat (3, "请在配置文件 ", rye_config, " 中添加:"));
|
||||
println (content);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Manual);
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset rye
|
||||
*/
|
||||
void
|
||||
pl_python_rye_resetsrc (char *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)};
|
||||
|
|
|
|||
|
|
@ -1,80 +1,76 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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 目录就好
|
||||
* @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 SourceProvider_t pl_python_pypi_upstream =
|
||||
static char *
|
||||
pl_python_speed_url_constructor (const char *url, const char *user_data)
|
||||
{
|
||||
def_upstream, "https://pypi.org/",
|
||||
{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
|
||||
};
|
||||
char *str = xy_str_delete_suffix (url, "/simple");
|
||||
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
|
||||
|
||||
/**
|
||||
* @update 2025-07-11
|
||||
* @note 不要添加Zju,浙大的PyPI服务在校外访问会自动转向Tuna
|
||||
*/
|
||||
static Source_t pl_python_group_sources[] =
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
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",
|
||||
"https://mirrors.cernet.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
|
||||
chef_set_created_on (this, "2023-09-03");
|
||||
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",
|
||||
"https://mirrors.bfsu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
|
||||
chef_set_chef (this, "@happy-game");
|
||||
// 组换源的 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",
|
||||
"https://mirror.lzu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
|
||||
chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
|
||||
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",
|
||||
"https://mirror.sjtu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
|
||||
def_sources_begin()
|
||||
{&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",
|
||||
"https://pypi.tuna.tsinghua.edu.cn" PL_Python_Group_Speed_URL_Postfix},
|
||||
|
||||
{&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},
|
||||
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple",FeedByPrelude}
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple",FeedByPrelude},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple",FeedByPrelude}
|
||||
|
||||
/* 不启用原因:24小时更新一次 */
|
||||
// {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL}
|
||||
};
|
||||
def_sources_n(pl_python_group);
|
||||
def_sources_end()
|
||||
|
||||
chef_set_sources_speed_measure_url_with_func (this, pl_python_speed_url_constructor, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
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
|
||||
pl_python_get_py_program_name (char **prog_name)
|
||||
|
|
|
|||
|
|
@ -1,30 +1,60 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* chsrc get pip
|
||||
*/
|
||||
def_target(pl_python_pip, "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
|
||||
pl_python_pip_getsrc (char *option)
|
||||
{
|
||||
char *py_prog_name = NULL;
|
||||
pl_python_get_py_program_name (&py_prog_name);
|
||||
|
||||
char *cmd = xy_2strjoin (py_prog_name, " -m pip config get global.index-url");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
char *cmd = xy_2strcat (py_prog_name, " -m pip config get global.index-url");
|
||||
|
||||
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/
|
||||
*
|
||||
* chsrc set pip
|
||||
*/
|
||||
void
|
||||
pl_python_pip_setsrc (char *option)
|
||||
|
|
@ -38,9 +68,9 @@ pl_python_pip_setsrc (char *option)
|
|||
return;
|
||||
}
|
||||
|
||||
chsrc_yield_source (pl_python_group);
|
||||
Source_t source = chsrc_yield_source (&pl_python_group_target, option);
|
||||
if (chsrc_in_standalone_mode())
|
||||
chsrc_confirm_source();
|
||||
chsrc_confirm_source(&source);
|
||||
|
||||
char *py_prog_name = NULL;
|
||||
pl_python_get_py_program_name (&py_prog_name);
|
||||
|
|
@ -48,7 +78,7 @@ pl_python_pip_setsrc (char *option)
|
|||
// 这里用的是 config --user,会写入用户目录(而不是项目目录)
|
||||
// https://github.com/RubyMetric/chsrc/issues/39
|
||||
// 经测试,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);
|
||||
|
||||
if (chsrc_in_standalone_mode())
|
||||
|
|
@ -59,36 +89,8 @@ pl_python_pip_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset pip
|
||||
*/
|
||||
void
|
||||
pl_python_pip_resetsrc (char *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)};
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
#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";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
! | happy game <happygame1024@gmail.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Created On : <2025-07-14>
|
||||
! Last Modified : <2025-07-26>
|
||||
! Last Modified : <2025-12-17>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# rawstr4c input for Python
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
- prefix = `RAWSTR_pl_python`
|
||||
- output = `:global-variable-only-header`
|
||||
- translate = `:hex`
|
||||
- keep-postfix = `false`
|
||||
- no-postfix = `true`
|
||||
|
||||
<br>
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'
|
|||
### Set uv config
|
||||
|
||||
```sh
|
||||
@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|}' @f@
|
||||
@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|;}' @f@
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,30 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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
|
||||
*
|
||||
|
|
@ -30,11 +45,11 @@ pl_python_find_uv_config (bool mkdir)
|
|||
{
|
||||
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
|
||||
{
|
||||
if (xy_on_windows)
|
||||
if (xy.on_windows)
|
||||
{
|
||||
/* config path on Windows */
|
||||
char *appdata = getenv ("APPDATA");
|
||||
|
|
@ -45,12 +60,12 @@ pl_python_find_uv_config (bool mkdir)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char *config_dir = xy_2strjoin(appdata, "\\uv\\");
|
||||
char *config_dir = xy_2strcat(appdata, "\\uv\\");
|
||||
if (mkdir)
|
||||
{
|
||||
chsrc_ensure_dir (config_dir);
|
||||
}
|
||||
return xy_2strjoin (config_dir, PL_Python_uv_ConfigFile);
|
||||
return xy_2strcat (config_dir, PL_Python_uv_ConfigFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -59,7 +74,7 @@ pl_python_find_uv_config (bool mkdir)
|
|||
{
|
||||
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/
|
||||
* https://github.com/RubyMetric/chsrc/issues/139
|
||||
*
|
||||
* chsrc set uv
|
||||
*/
|
||||
void
|
||||
pl_python_uv_setsrc (char *option)
|
||||
{
|
||||
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())
|
||||
chsrc_confirm_source();
|
||||
chsrc_confirm_source(&source);
|
||||
|
||||
char *uv_config = pl_python_find_uv_config (true);
|
||||
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);
|
||||
|
||||
#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 '' ";
|
||||
#else
|
||||
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, "@url@", source.url);
|
||||
|
||||
char *append_config_cmd = xy_strjoin (4, "printf '", source_content, "' >> ", uv_config);
|
||||
|
||||
if (!xy_file_exist (uv_config))
|
||||
{
|
||||
/* 当 uv_config 不存在,直接写入文件 */
|
||||
|
|
@ -131,7 +142,7 @@ pl_python_uv_setsrc (char *option)
|
|||
/* 当 uv_config 存在,如果存在 [[index]] 则更新,否则追加到文件末尾 */
|
||||
char *cmd = xy_str_gsub (RAWSTR_pl_python_test_uv_if_set_source, "@f@", uv_config);
|
||||
chsrc_ensure_program ("grep");
|
||||
int status = system (cmd);
|
||||
int status = xy_run_get_status (cmd);
|
||||
if (0==status)
|
||||
{
|
||||
chsrc_run (update_config_cmd, RunOpt_Default);
|
||||
|
|
@ -150,36 +161,8 @@ pl_python_uv_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset uv
|
||||
*/
|
||||
void
|
||||
pl_python_uv_resetsrc (char *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)};
|
||||
|
|
|
|||
|
|
@ -1,30 +1,37 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2023-09-04
|
||||
*
|
||||
* @note
|
||||
* 以下注释的,是不含有bioconductor的镜像站,
|
||||
* 我们在换cran的同时,也直接帮助用户换bioconductor
|
||||
*/
|
||||
static Source_t pl_r_sources[] =
|
||||
def_target(pl_r, "r/cran");
|
||||
|
||||
void
|
||||
pl_r_prelude ()
|
||||
{
|
||||
{&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},
|
||||
// {&Ali, "https://mirrors.aliyun.com/CRAN/", DelegateToMirror},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/", DelegateToMirror},
|
||||
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN", DelegateToMirror},
|
||||
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/", DelegateToMirror},
|
||||
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/", DelegateToMirror},
|
||||
};
|
||||
def_sources_n(pl_r);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
#define PL_R_Config_Windows "~/Documents/.Rprofile"
|
||||
|
|
@ -39,7 +46,7 @@ pl_r_getsrc (char *option)
|
|||
* options()$repos
|
||||
* options()$BioC_mirror
|
||||
*/
|
||||
if (xy_on_windows)
|
||||
if (xy.on_windows)
|
||||
{
|
||||
chsrc_view_file (PL_R_Config_Windows);
|
||||
}
|
||||
|
|
@ -55,42 +62,21 @@ pl_r_getsrc (char *option)
|
|||
void
|
||||
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/");
|
||||
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 *w2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")\n" );
|
||||
const char *w1 = xy_strcat (3, "options(\"repos\" = c(CRAN=\"", source.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 上面的内容
|
||||
|
||||
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_determine_chgtype (ChgType_Auto);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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 =
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
* @update 2024-12-18
|
||||
*/
|
||||
static Source_t pl_ruby_sources[] =
|
||||
def_target(pl_ruby, "gem/ruby/rb/rubygem/rubygems/bundler");
|
||||
|
||||
void
|
||||
pl_ruby_prelude (void)
|
||||
{
|
||||
{&pl_ruby_upstream, "https://rubygems.org", NULL},
|
||||
{&RubyChina, "https://gems.ruby-china.com/", NULL},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/rubygems/", NULL}
|
||||
chef_prep_this (pl_ruby, gsr);
|
||||
|
||||
// {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rubygems/", NULL},
|
||||
// {&Bfsu, "https://mirrors.bfsu.edu.cn/rubygems/", NULL},
|
||||
chef_set_created_on (this, "2023-08-29");
|
||||
chef_set_last_updated (this, "2025-08-11");
|
||||
chef_set_sources_last_updated (this, "2024-12-18");
|
||||
|
||||
// {&Tencent, "https://mirrors.tencent.com/rubygems/", NULL},
|
||||
// {&Tencent_Intra, "https://mirrors.tencentyun.com/rubygems/", NULL},
|
||||
// {&Ali, "https://mirrors.aliyun.com/rubygems/", NULL},
|
||||
// {&Huawei, "https://mirrors.huaweicloud.com/repository/rubygems/", NULL},
|
||||
};
|
||||
def_sources_n(pl_ruby);
|
||||
chef_set_chef (this, "@ccmywish");
|
||||
chef_set_cooks (this, 1, "@ccmywish");
|
||||
chef_set_sauciers (this, 1, "@BingChunMoLi");
|
||||
|
||||
chef_allow_local_mode (this, PartiallyCan, "支持 bundler. 不支持 gem", "Support bundler. Not support gem");
|
||||
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
|
||||
|
|
@ -48,15 +50,16 @@ pl_ruby_getsrc (char *option)
|
|||
chsrc_run ("bundle config get mirror.https://rubygems.org", RunOpt_Default);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
pl_ruby_remove_gem_source (const char *source)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -67,15 +70,20 @@ pl_ruby_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_program ("gem");
|
||||
|
||||
chsrc_yield_source_and_confirm (pl_ruby);
|
||||
chsrc_use_this_source (pl_ruby);
|
||||
|
||||
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);
|
||||
|
||||
// 我们在 step1 中,把源全部清空了,但是现在 RubyGems 的行为是: 当清空会自动给你把默认源给加回来
|
||||
// 所以我们在这一步,最后一次删除默认源,确保它不存在
|
||||
pl_ruby_remove_gem_source (this->sources[0].url);
|
||||
|
||||
|
||||
chsrc_ensure_program ("bundle");
|
||||
|
||||
|
|
@ -85,7 +93,7 @@ pl_ruby_setsrc (char *option)
|
|||
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_determine_chgtype (ChgType_Auto);
|
||||
|
|
@ -97,24 +105,3 @@ pl_ruby_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,116 +1,189 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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/",
|
||||
{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_prep_this (pl_rust_cargo, gsr);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* @update 2025-06-18
|
||||
*
|
||||
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
|
||||
* @note 链接末尾的 `/` 不能缺少
|
||||
*/
|
||||
static Source_t pl_rust_cargo_sources[] =
|
||||
{
|
||||
{&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},
|
||||
// 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`。链接末尾的 `/` 不能缺少
|
||||
def_sources_begin()
|
||||
{&UpstreamProvider, "https://crates.io/", FeedByPrelude},
|
||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/", FeedByPrelude},
|
||||
{&RsProxyCN, "https://rsproxy.cn/index/", FeedByPrelude},
|
||||
{&Ali, "https://mirrors.aliyun.com/crates.io-index/", FeedByPrelude},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/crates.io-index/", FeedByPrelude},
|
||||
|
||||
/* 注释原因: (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},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/", DelegateToMirror},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", DelegateToMirror},
|
||||
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/",
|
||||
"https://crates-io.proxy.ustclug.org/api/v1/crates/windows/0.58.0/download"},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/", FeedByPrelude},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/",FeedByPrelude},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", FeedByPrelude},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/", FeedByPrelude},
|
||||
|
||||
/* 注释原因: (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}
|
||||
};
|
||||
def_sources_n(pl_rust_cargo);
|
||||
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/", FeedByPrelude}
|
||||
def_sources_end()
|
||||
|
||||
chef_set_sources_speed_measure_url_with_postfix (this, "api/v1/crates/windows/0.58.0/download");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get cargo
|
||||
*/
|
||||
void
|
||||
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
|
||||
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://help.mirrors.cernet.edu.cn/crates.io-index
|
||||
*
|
||||
* chsrc set cargo
|
||||
*/
|
||||
void
|
||||
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"), " 文件中:"));
|
||||
print (content);
|
||||
chsrc_ensure_dir (cargo_config_dir);
|
||||
|
||||
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_conclude (&source);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset cargo
|
||||
*/
|
||||
void
|
||||
pl_rust_cargo_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,40 +1,48 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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/",
|
||||
def_need_measure_info
|
||||
};
|
||||
chef_prep_this (pl_rust_rustup, gsr);
|
||||
|
||||
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
|
||||
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/
|
||||
*
|
||||
* chsrc set rustup
|
||||
*/
|
||||
void
|
||||
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 *cmd2 = xy_strjoin (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\"");
|
||||
char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\"");
|
||||
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);
|
||||
|
||||
#else
|
||||
|
||||
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
|
||||
char *w2 = xy_strjoin (3, "export RUSTUP_UPDATE_ROOT=\"", source.url, "/rustup\"\n");
|
||||
char *w1 = xy_strcat (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\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;
|
||||
if (xy_file_exist (bashrc))
|
||||
|
|
@ -84,10 +90,10 @@ pl_rust_rustup_setsrc (char *option)
|
|||
char *fishrc = xy_fishrc;
|
||||
if (xy_file_exist (fishrc))
|
||||
{
|
||||
char *w1 = xy_strjoin (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\n");
|
||||
char *w2 = xy_strjoin (3, "set -x RUSTUP_UPDATE_ROOT ", source.url, "/rustup\n");
|
||||
char *w1 = xy_strcat (3, "set -x RUSTUP_DIST_SERVER ", source.url, "\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_append_to_file (w, fishrc);
|
||||
|
|
@ -100,35 +106,9 @@ pl_rust_rustup_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* chsrc reset rustup
|
||||
*/
|
||||
|
||||
void
|
||||
pl_rust_rustup_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
#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";
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
! -------------------------------------------------------------
|
||||
! Config Type : rawstr4c (Markdown)
|
||||
! Config Authors: Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Contributors : Happy Game <happygame1024@gmail.com>
|
||||
! Created On : <2025-07-14>
|
||||
! Last Modified : <2025-07-22>
|
||||
! Last Modified : <2025-09-13>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# rawstr4c input for PL
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
- prefix = `RAWSTR_pl`
|
||||
- output = `:global-variable-only-header`
|
||||
- translate = `:oct`
|
||||
- keep-postfix = `false`
|
||||
- no-postfix = `true`
|
||||
|
||||
<br>
|
||||
|
||||
|
|
@ -75,10 +75,11 @@ allprojects {
|
|||
|
||||
```toml
|
||||
[source.crates-io]
|
||||
replace-with = 'mirror'
|
||||
replace-with = "mirror"
|
||||
|
||||
[source.mirror]
|
||||
registry = "sparse+@url@"
|
||||
|
||||
```
|
||||
|
||||
<br>
|
||||
|
|
@ -101,7 +102,7 @@ repository mirror
|
|||
### stackage
|
||||
|
||||
- name = `stackage`
|
||||
- keep-postfix = `true`
|
||||
- no-postfix = `false`
|
||||
- postfix = `yaml`
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
|
|
@ -1,150 +1,201 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* | BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||
* |
|
||||
* Created On : <2023-09-01>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2025-07-21>
|
||||
* Major Revision : 5
|
||||
* Last Modified : <2025-08-22>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/* Begin Target Matrix */
|
||||
#define t(a) (const char*)(a)
|
||||
static const char
|
||||
*pl_ruby [] = {"gem", "ruby", "rb", "rubygem", "rubygems", "bundler", NULL, t(&pl_ruby_target)},
|
||||
#include "lang/rawstr4c.h"
|
||||
|
||||
*pl_python[] = {"python", "pypi", "py", NULL, t(&pl_python_group_target)},
|
||||
*pl_python_pip[] = {"pip", NULL, t(&pl_python_pip_target)},
|
||||
*pl_python_poetry[] = {"poetry", NULL, t(&pl_python_poetry_target)},
|
||||
*pl_python_pdm[] = {"pdm", NULL, t(&pl_python_pdm_target)},
|
||||
*pl_python_rye[] = {"rye", NULL, t(&pl_python_rye_target)},
|
||||
*pl_python_uv[] = {"uv", NULL, t(&pl_python_uv_target)},
|
||||
#include "lang/Ruby/Ruby.c"
|
||||
#include "lang/Python/common.h"
|
||||
#include "lang/Python/pip.c"
|
||||
#include "lang/Python/Poetry.c"
|
||||
#include "lang/Python/PDM.c"
|
||||
#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)},
|
||||
*pl_nodejs_bun[] = {"bun", NULL, t(&pl_nodejs_bun_target)},
|
||||
*pl_nodejs_npm[] = {"npm", NULL, t(&pl_nodejs_npm_target)},
|
||||
*pl_nodejs_yarn[] = {"yarn", NULL, t(&pl_nodejs_yarn_target)},
|
||||
*pl_nodejs_pnpm[] = {"pnpm", NULL, t(&pl_nodejs_pnpm_target)},
|
||||
*pl_nodejs_nvm[] = {"nvm", NULL, t(&pl_nodejs_nvm_target)},
|
||||
#include "lang/JavaScript/common.h"
|
||||
#include "lang/JavaScript/npm.c"
|
||||
#include "lang/JavaScript/pnpm.c"
|
||||
#include "lang/JavaScript/Yarn.c"
|
||||
#include "lang/JavaScript/JavaScript.c"
|
||||
#include "lang/JavaScript/Bun.c"
|
||||
#include "lang/JavaScript/nvm.c"
|
||||
|
||||
*pl_perl [] = {"perl", "cpan", NULL, t(&pl_perl_target)},
|
||||
*pl_php [] = {"php", "composer", NULL, t(&pl_php_target)},
|
||||
*pl_lua [] = {"lua", "luarocks", NULL, t(&pl_lua_target)},
|
||||
*pl_go [] = {"go", "golang", "goproxy", NULL, t(&pl_go_target)} ,
|
||||
#include "lang/Perl.c"
|
||||
#include "lang/PHP.c"
|
||||
#include "lang/Lua.c"
|
||||
#include "lang/Go.c"
|
||||
#include "lang/Java.c"
|
||||
|
||||
*pl_rust_cargo[] = {"rust", "cargo", "crate", "crates", NULL, t(&pl_rust_cargo_target)},
|
||||
*pl_rust_rustup[]= {"rustup", NULL, t(&pl_rust_rustup_target)},
|
||||
#include "lang/Rust/common.h"
|
||||
#include "lang/Rust/rustup.c"
|
||||
#include "lang/Rust/Cargo.c"
|
||||
|
||||
*pl_java [] = {"java", "maven", "mvn", "gradle", NULL, t(&pl_java_target)},
|
||||
*pl_clojure[]= {"clojure","clojars","cloj", "lein", NULL, t(&pl_clojure_target)},
|
||||
#include "lang/Dart/common.h"
|
||||
#include "lang/Dart/Pub.c"
|
||||
#include "lang/Dart/Flutter.c"
|
||||
|
||||
*pl_dart [] = {"dart", "pub", NULL, t(&pl_dart_target)},
|
||||
*pl_dart_flutter [] = {"flutter", NULL, t(&pl_dart_flutter_target)},
|
||||
#include "lang/Haskell.c"
|
||||
#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)},
|
||||
*pl_ocaml[] = {"ocaml", "opam", NULL, t(&pl_ocaml_target)},
|
||||
*pl_r [] = {"cran", "r", NULL, t(&pl_r_target)},
|
||||
*pl_julia [] = {"julia", NULL, t(&pl_julia_target)},
|
||||
**pl_packagers[] =
|
||||
|
||||
#include "os/rawstr4c.h"
|
||||
#include "os/APT/common.h"
|
||||
// Debian-based
|
||||
#include "os/APT/Debian.c"
|
||||
#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,
|
||||
pl_python, pl_python_pip, pl_python_poetry, pl_python_pdm, pl_python_rye, pl_python_uv,
|
||||
pl_nodejs, pl_nodejs_bun,
|
||||
pl_nodejs_npm, pl_nodejs_pnpm, pl_nodejs_yarn,
|
||||
pl_nodejs_nvm,
|
||||
pl_perl, pl_php,
|
||||
pl_lua,
|
||||
pl_rust_cargo, pl_rust_rustup,
|
||||
pl_go,
|
||||
/*pl_nuget,*/
|
||||
pl_java, pl_clojure,
|
||||
pl_dart, pl_dart_flutter,
|
||||
pl_ocaml,
|
||||
pl_r, pl_julia,
|
||||
pl_haskell,
|
||||
};
|
||||
#define add(t) xy_seq_push(ProgStore.pl, &pl_##t##_target); (&pl_##t##_target)->preludefn = pl_##t##_prelude
|
||||
add (ruby);
|
||||
add (python_group);
|
||||
add (python_pip);
|
||||
add (python_poetry);
|
||||
add (python_pdm);
|
||||
add (python_rye);
|
||||
add (python_uv);
|
||||
add (js_group);
|
||||
add (js_bun);
|
||||
add (js_npm);
|
||||
add (js_yarn);
|
||||
add (js_pnpm);
|
||||
add (js_nvm);
|
||||
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
|
||||
/* Zorin OS 完全使用 Ubuntu 的换源方法,二者兼容 */
|
||||
*os_ubuntu [] = {"ubuntu", "zorinos", NULL, t(&os_ubuntu_target)},
|
||||
*os_linuxmint [] = {"linuxmint", NULL, t(&os_linuxmint_target)},
|
||||
*os_debian [] = {"debian", NULL, t(&os_debian_target)},
|
||||
*os_fedora [] = {"fedora", NULL, t(&os_fedora_target)},
|
||||
*os_opensuse [] = {"opensuse", "opensuse-leap", "opensuse-tumbleweed", NULL, t(&os_opensuse_target)},
|
||||
*os_kali [] = {"kali", NULL, t(&os_kali_target)},
|
||||
*os_msys2 [] = {"msys2", "msys", NULL, t(&os_msys2_target)},
|
||||
*os_arch [] = {"arch", "archlinux", NULL, t(&os_arch_target)},
|
||||
*os_archlinuxcn[] = {"archlinuxcn", "archcn",NULL, t(&os_archlinuxcn_target)},
|
||||
*os_manjaro [] = {"manjaro", NULL, t(&os_manjaro_target)},
|
||||
*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)},
|
||||
#define add(t) xy_seq_push(ProgStore.wr, &wr_##t##_target); (&wr_##t##_target)->preludefn = wr_##t##_prelude
|
||||
add (winget);
|
||||
add (homebrew);
|
||||
add (cocoapods);
|
||||
add (docker);
|
||||
add (flatpak);
|
||||
add (nix);
|
||||
add (guix);
|
||||
add (emacs);
|
||||
add (tex);
|
||||
add (anaconda);
|
||||
#undef add
|
||||
|
||||
*os_raspberrypi[] = {"raspi", "raspberrypi",NULL, t(&os_raspberrypi_target)},
|
||||
*os_armbian [] = {"armbian", NULL, t(&os_armbian_target)},
|
||||
*os_openwrt [] = {"openwrt", "opkg", "LEDE", NULL, t(&os_openwrt_target)},
|
||||
*os_termux [] = {"termux", NULL, t(&os_termux_target)},
|
||||
// Internal Target 不会由用户使用,需要特殊对待
|
||||
pl_js_nodejs_binary_target.preludefn = pl_js_nodejs_binary_prelude;
|
||||
}
|
||||
|
||||
*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
|
||||
*/
|
||||
static MirrorSite_t*
|
||||
available_mirrors[] = {
|
||||
chsrc_available_mirrors[] = {
|
||||
|
||||
/* ------------------------ 教育网(通用镜像站) ------------------------ */
|
||||
&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,
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------ 商业公司(通用镜像站) ------------------------ */
|
||||
&Ali, // &Ali_ECS_VPC, &Ali_ECS_classic,
|
||||
&Tencent, // &Tencent_Intra,
|
||||
&Huawei,
|
||||
&Huawei, &HuaweiCDN,
|
||||
&Volcengine,
|
||||
&Netease,
|
||||
&Sohu,
|
||||
|
|
@ -167,18 +216,11 @@ available_mirrors[] = {
|
|||
&Api7, &Fit2Cloud, &DaoCloud,
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------ 专用镜像站 ------------------------ */
|
||||
&RubyChina, &EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN,
|
||||
/* 暂不支持 &NugetOrg */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------ chsrc 内部实现 ------------------------ */
|
||||
/* 不要列出 &UpstreamProvider 和 &UserDefinedProvider */
|
||||
|
||||
};
|
||||
|
||||
/* End Target Matrix */
|
||||
|
|
|
|||
|
|
@ -1,20 +1,30 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-11-21
|
||||
*/
|
||||
static Source_t os_armbian_sources[] =
|
||||
def_target(os_armbian, "armbian");
|
||||
|
||||
void
|
||||
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},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.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},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/armbian", DelegateToMirror},
|
||||
{&Nju, "https://mirrors.nju.edu.cn/armbian", DelegateToMirror},
|
||||
{&Ali, "https://mirrors.aliyun.com/armbian", DelegateToMirror},
|
||||
};
|
||||
def_sources_n(os_armbian);
|
||||
{&Ali, "https://mirrors.aliyun.com/armbian", DelegateToMirror}
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -50,11 +60,11 @@ os_armbian_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
chsrc_yield_source_and_confirm (os_armbian);
|
||||
chsrc_use_this_source (os_armbian);
|
||||
|
||||
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);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
|
@ -70,21 +80,3 @@ os_armbian_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,69 +1,48 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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"
|
||||
|
||||
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);
|
||||
|
||||
def_target(os_debian, "debian");
|
||||
|
||||
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)
|
||||
{
|
||||
/* 我们只检查旧版sourcelist,因为 common.h 中的填充只支持旧版 */
|
||||
char *cmd = xy_2strjoin ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList);
|
||||
int ret = system (cmd);
|
||||
char *cmd = xy_2strcat ("grep -q '^deb cdrom:' ", OS_Debian_old_SourceList);
|
||||
int ret = xy_run_get_status (cmd);
|
||||
bool use_cdrom = ret == 0;
|
||||
|
||||
return use_cdrom;
|
||||
|
|
@ -104,15 +83,15 @@ os_debian_does_old_sourcelist_use_cdrom (void)
|
|||
void
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
/* 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 ("apt update", RunOpt_No_Last_New_Line);
|
||||
|
|
@ -156,7 +135,7 @@ os_debian_setsrc (char *option)
|
|||
if (use_cdrom)
|
||||
{
|
||||
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 */ }
|
||||
|
||||
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 源的情况,请手动运行:");
|
||||
say ("apt install apt-transport-https ca-certificates");
|
||||
|
|
@ -176,7 +155,7 @@ os_debian_setsrc (char *option)
|
|||
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 ("apt update", RunOpt_No_Last_New_Line);
|
||||
|
|
@ -191,23 +170,3 @@ os_debian_resetsrc (char* 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);
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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_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
|
||||
};
|
||||
def_target(os_kali, "kali");
|
||||
|
||||
/**
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
static Source_t os_kali_sources[] =
|
||||
void
|
||||
os_kali_prelude ()
|
||||
{
|
||||
{&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},
|
||||
{&Ali, "https://mirrors.aliyun.com/kali", DelegateToMirror},
|
||||
{&Volcengine, "https://mirrors.volces.com/kali", DelegateToMirror},
|
||||
{&Bfsu, "https://mirrors.bfsu.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},
|
||||
};
|
||||
def_sources_n(os_kali);
|
||||
// {&Huawei, "https://mirrors.huaweicloud.com/kali", DelegateToMirror},
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
void
|
||||
os_kali_getsrc (char *option)
|
||||
|
|
@ -47,11 +47,11 @@ os_kali_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
chsrc_yield_source_and_confirm (os_kali);
|
||||
chsrc_use_this_source (os_kali);
|
||||
|
||||
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,
|
||||
"@g\' " OS_Apt_SourceList);
|
||||
|
||||
|
|
@ -68,24 +68,3 @@ os_kali_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,30 +1,35 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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_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
|
||||
};
|
||||
def_target(os_linuxlite, "linuxlite");
|
||||
|
||||
/**
|
||||
* @update 2024-11-21
|
||||
*/
|
||||
static Source_t os_linuxlite_sources[] =
|
||||
void
|
||||
os_linuxlite_prelude ()
|
||||
{
|
||||
{&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},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/linuxliteos/", DelegateToMirror},
|
||||
{&Nju, "https://mirror.nju.edu.cn/linuxliteos/", DelegateToMirror}
|
||||
};
|
||||
def_sources_n(os_linuxlite);
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -41,11 +46,11 @@ os_linuxlite_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
chsrc_yield_source_and_confirm (os_linuxlite);
|
||||
chsrc_use_this_source (os_linuxlite);
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -59,24 +64,3 @@ os_linuxlite_resetsrc (char *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);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,31 @@
|
|||
/** ------------------------------------------------------------
|
||||
* 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>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-11-21 更新
|
||||
* @note 实际上镜像站里的内容和Ubuntu的不太一样
|
||||
*/
|
||||
static Source_t os_linuxmint_sources[] =
|
||||
def_target(os_linuxmint, "linuxmint");
|
||||
|
||||
void
|
||||
os_linuxmint_prelude ()
|
||||
{
|
||||
{&UpstreamProvider, NULL, NULL},
|
||||
{&MirrorZ, "https://mirrors.cernet.edu.cn/linuxmint/", DelegateToMirror},
|
||||
chef_prep_this (os_linuxmint, gs);
|
||||
|
||||
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},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.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},
|
||||
{&Sustech, "https://mirrors.sustech.edu.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}
|
||||
};
|
||||
def_sources_n(os_linuxmint);
|
||||
// {&Netease, "https://mirrors.163.com/linuxmint/packages/", DelegateToMirror}
|
||||
def_sources_end()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -39,6 +49,7 @@ os_linuxmint_getsrc (char *option)
|
|||
chsrc_view_file (OS_LinuxMint_SourceList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @consult https://help.mirrors.cernet.edu.cn/linuxmint/
|
||||
*/
|
||||
|
|
@ -47,7 +58,7 @@ os_linuxmint_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
chsrc_yield_source_and_confirm (os_linuxmint);
|
||||
chsrc_use_this_source (os_linuxmint);
|
||||
|
||||
chsrc_backup (OS_LinuxMint_SourceList);
|
||||
|
||||
|
|
@ -55,7 +66,7 @@ os_linuxmint_setsrc (char *option)
|
|||
// 暂不实现自动替换基于debian或ubuntu的基础源
|
||||
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
|
||||
char* cmd = xy_strjoin (5, "sed -i '/",
|
||||
char* cmd = xy_strcat (5, "sed -i '/",
|
||||
version_codename, "/ s|http[^ ]*|",
|
||||
source.url, "|g' " OS_LinuxMint_SourceList);
|
||||
|
||||
|
|
@ -67,25 +78,3 @@ os_linuxmint_setsrc (char *option)
|
|||
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
|
||||
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
Loading…
Reference in New Issue