Skip to content

Commit

Permalink
Merge pull request #5 from mirrorz-org/ustc-github-release
Browse files Browse the repository at this point in the history
feat!: Add github-release items used by USTC mirrors, and arrange github-release inis
  • Loading branch information
Harry-Chen authored May 23, 2024
2 parents 4b60bab + fae3698 commit 01635ac
Show file tree
Hide file tree
Showing 34 changed files with 128 additions and 22 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ urlbase = /

!include includes/os/archlinux.ini
!include includes/app/vlc.ini
!include includes/font/google_fonts.ini
!include includes/app/github/rust-analyzer.ini
!include includes/font/adobe_source.ini
```

`!include` 后的路径如果是相对路径,则是相对于该 ini 文件的路径。
Expand Down Expand Up @@ -116,6 +117,16 @@ python3 utils/check-config.py includes/

如果参数是目录,则脚本会遍历目录下所有的 ini 文件,逐个尝试进行解析和检查;如果是单个文件,则只检查该文件。

### 公用配置目录结构

[`includes`](./includes/) 目录存储公用的配置文件,目前分为三类:

- [app](./includes/app/):软件安装包对应配置
- [font](./includes/font/):字体文件对应配置
- [os](./includes/os/):操作系统镜像对应配置

其中类别下名为 `github` 的文件夹对应 [github-release](https://mirrorz.org/list/github-release) 收录的软件对应的配置,文件名为对应仓库的所有者(组织)。

## 使用

[genisolist.py](./genisolist.py) 为参考实现,用于从配置与本地文件系统输出以上的 JSON 格式。可以使用其 `process_ini()``gen_from_sections()` 用于整合镜像站点的其他设施,也可以直接运行,例如下:
Expand Down Expand Up @@ -176,9 +187,15 @@ urlbase = /
!include mirrorz-genisolist/includes/distro.ini
!include mirrorz-genisolist/includes/os/archlinux.ini
!include mirrorz-genisolist/includes/app/vlc.ini
!include mirrorz-genisolist/includes/font/google_fonts.ini
!include mirrorz-genisolist/includes/app/github/rust-analyzer.ini
!include mirrorz-genisolist/includes/font/adobe_source.ini
# 导入镜像站自己维护的子配置
!include genisolist/os/example.ini
# 镜像站也可以直接写 section
[some-distro]
distro = Some Distro
# ...
```

3 changes: 2 additions & 1 deletion example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ urlbase = /
!include includes/distro.ini
!include includes/os/archlinux.ini
!include includes/app/vlc.ini
!include includes/font/google_fonts.ini
!include includes/app/github/rust-analyzer.ini
!include includes/font/adobe_source.ini
2 changes: 2 additions & 0 deletions genisolist.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ def process_include(ini: Path) -> str:
ini_contents += process_include(include_file)
else:
ini_contents += line
# add a newline at the end of the file, to avoid it being concatenated with the next file
ini_contents += "\n"
return ini_contents

ini_contents = process_include(ini)
Expand Down
8 changes: 8 additions & 0 deletions includes/app/github/3-manifolds.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[sage-3manifolds]
distro = SageMath
listvers = 1
location = github-release/3-manifolds/Sage_macOS/LatestRelease/*
pattern = SageMath-(\d+\.\d+)_(.+)\.dmg
version = $1
platform = macOS, $2
category = app
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions includes/app/github/TheThirdOne.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[rars]
distro = RARS
listvers = 1
location = github-release/TheThirdOne/rars/LatestRelease/*
pattern = rars(.+).jar
version = $1
pattern_use_name = true
category = app
File renamed without changes.
36 changes: 36 additions & 0 deletions includes/app/github/XmacsLabs.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[mogan-windows]
distro = Mogan
listvers = 1
location = github-release/XmacsLabs/mogan/LatestRelease/*
pattern = MoganResearch-v(\d+\.\d+\.\d+)-(.+)-installer.exe
version = $1
platform = Windows, $2
category = app

[mogan-macos-platform]
distro = Mogan
listvers = 1
location = github-release/XmacsLabs/mogan/LatestRelease/*
pattern = MoganResearch-v(\d+\.\d+\.\d+)-(.+).dmg
version = $1
platform = macOS, $2
category = app

[mogan-macos-default]
distro = Mogan
listvers = 1
location = github-release/XmacsLabs/mogan/LatestRelease/*
pattern = MoganResearch-v(\d+\.\d+\.\d+).dmg
version = $1
platform = macOS
category = app

[mogan-deb]
distro = Mogan
listvers = 1
location = github-release/XmacsLabs/mogan/LatestRelease/*
pattern = mogan-research-v(\d+\.\d+\.\d+)-(.+).deb
version = $1
platform = $2
type = deb
category = app
9 changes: 9 additions & 0 deletions includes/app/github/adoptium.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[temurin-binaries]
distro = Temurin by Adoptium
listvers = 4
location = github-release/adoptium/temurin*-binaries/LatestRelease/*
pattern = OpenJDK(\d+)U-(jdk|jre)_(.+)_hotspot_(\d+\.\d+\.\d+_\d+)\.(tar\.gz|zip|pkg)$
version = $4
platform = $3
type = $2
category = app
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions includes/app/github/coder.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[code-server]
distro = code-server
listvers = 1
location = github-release/coder/code-server/LatestRelease/*
pattern = code-server[-_](\d+\.\d+\.\d+)[-_](.+)\.(rpm|deb|tar\.gz)
version = $1
platform = $2
type = $3
category = app
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions includes/app/github/pbatard.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[rufus]
distro = Rufus
listvers = 1
location = github-release/pbatard/rufus/LatestRelease/*
pattern = rufus-(\d+\.\d+)_?([^p].+)?\.exe$
version = $1
platform = $2
category = app

[rufus-portable]
distro = Rufus
listvers = 1
location = github-release/pbatard/rufus/LatestRelease/*
pattern = rufus-(\d+\.\d+)p\.exe$
version = $1
platform = Windows
type = portable
category = app
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions includes/app/github/texstudio-org.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[texstudio]
distro = TeX 排版系统
listvers = 1
location = github-release/texstudio-org/texstudio/LatestRelease/*
pattern = texstudio-([\d\.]+)-(.+)\.(\w+)
platform = $2
type = $3
version = TeXstudio $1
category = app
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions includes/app/tex.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ type = $3
version = MikTeX $1
category = app

[texstudio]
distro = TeX 排版系统
listvers = 1
location = github-release/texstudio-org/texstudio/LatestRelease/*
pattern = texstudio-([\d\.]+)-(.+)\.(\w+)
platform = $2
type = $3
version = TeXstudio $1
category = app

[lyx]
distro = TeX 排版系统
listvers = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ version = $5
sort_by = $1 $4
category = font

[Sarasa Gothic]
distro = Sarasa Gothic
listvers = 10
location = github-release/be5invis/Sarasa-Gothic/LatestRelease/*
pattern = .+-(\w+)-([\.\d]+)\.\w+
platform = $1
version = $2
category = font
9 changes: 0 additions & 9 deletions includes/font/sarasa_gothic.ini

This file was deleted.

0 comments on commit 01635ac

Please sign in to comment.