Skip to content
This repository was archived by the owner on Jun 23, 2024. It is now read-only.

Commit 431d06d

Browse files
authored
Bump version to 2.0.0 (#26)
2 parents cbb0d5f + c43c1a4 commit 431d06d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1717
-904
lines changed

README.md

+129-78
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,46 @@
22

33
- This util is to build module repository for [MRepo](https://github.com/ya0211/MRepo)
44
- `sync` is a python package
5+
- `cli.py` is a cli tool
56

67
## Getting Started
78
### Initialize repository
89
You should create a folder, or a git repository and clone it, for example `your-repo`, and clone util
910
```shell
1011
$ git clone -b main https://github.com/ya0211/magisk-modules-repo-util.git util
1112
```
12-
or add it as a submodule of the git repository
13+
or add it as a submodule of your git repository
1314
```shell
1415
$ git submodule add https://github.com/ya0211/magisk-modules-repo-util.git util
1516
```
1617

1718
### Install dependencies
1819
```shell
19-
$ python3 -m pip install -r requirements.txt
20+
$ python3 -m pip install -r util/requirements.txt
2021
```
2122

22-
### Create config.json
23-
You can write it to `your-repo/config/config.json` by yourself, or
23+
### New config.json
24+
You can write it to `your-repo/json/config.json` by yourself, or
2425
```shell
2526
$ cli.py config --stdin << EOF
2627
{
27-
"repo_name": "Your Magisk Repo",
28-
"repo_url": "https://you.github.io/magisk-modules-repo/",
29-
"max_num": 3,
30-
"show_log": true,
31-
"log_dir": "log"
28+
"NAME": "Your Magisk Repo",
29+
"BASE_URL": "https://you.github.io/magisk-modules-repo/",
30+
"MAX_NUM": 3,
31+
"ENABLE_LOG": true,
32+
"LOG_DIR": "log"
3233
}
3334
EOF
3435
```
3536
or
3637
```shell
37-
$ cli.py config --write repo_name="Your Magisk Repo" repo_url="https://you.github.io/magisk-modules-repo/" max_num=3 show_log=true log_dir="log"
38+
$ cli.py config --write NAME="Your Magisk Repo" BASE_URL="https://you.github.io/magisk-modules-repo/" MAX_NUM=3 ENABLE_LOG=true LOG_DIR="log"
3839
```
3940

40-
### Create track.json
41+
### New track.json
4142
You can write it to `your-repo/modules/{id}/track.json` by yourself, or
4243
```shell
43-
$ cli.py module --stdin << EOF
44+
$ cli.py track --stdin << EOF
4445
{
4546
"id": "zygisk_lsposed",
4647
"update_to": "https://lsposed.github.io/LSPosed/release/zygisk.json",
@@ -50,9 +51,9 @@ EOF
5051
```
5152
or
5253
```shell
53-
$ cli.py module --add id="zygisk_lsposed" update_to="https://lsposed.github.io/LSPosed/release/zygisk.json" license="GPL-3.0"
54+
$ cli.py track --add id="zygisk_lsposed" update_to="https://lsposed.github.io/LSPosed/release/zygisk.json" license="GPL-3.0"
5455
```
55-
If you want to generate track.json from repositories on github
56+
If you want to generate track.json from repository on github
5657
```shell
5758
$ cli.py github --user-name <github-user-name> --api-token=<github-api-token>
5859
```
@@ -72,11 +73,12 @@ Magisk Modules Repo Util
7273
7374
positional arguments:
7475
command
75-
config Modify config values of repository.
76-
module Magisk module tracks utility.
77-
github Generate track(s) from github.
78-
sync Sync modules and push to repository.
76+
config Modify config of repository.
77+
track Module tracks utility.
78+
github Generate tracks from GitHub.
79+
sync Sync modules in repository.
7980
index Generate modules.json from local.
81+
check Content check and migrate.
8082
8183
options:
8284
-h, --help Show this help message and exit.
@@ -87,39 +89,49 @@ options:
8789
## config.json
8890
```json
8991
{
90-
"repo_name": "required",
91-
"repo_url": "required",
92-
"max_num": "optional",
93-
"show_log": "optional",
94-
"log_dir": "optional"
92+
"NAME": "str",
93+
"BASE_URL": "str",
94+
"MAX_NUM": "int",
95+
"ENABLE_LOG": "bool",
96+
"LOG_DIR": "str"
9597
}
9698
```
9799
| Key | Attribute | Description |
98100
|:-:|:-:|:-:|
99-
| repo_name | required | Name of your module repository |
100-
| repo_url | required | Need to end with `/` |
101-
| max_num | optional | Max number of keeping old version modules, default value is 3 |
102-
| show_log | optional | If false, the log will never be showed and stored, default value is true |
103-
| log_dir | optional | If defined, the log file will be stored in this directory |
101+
| NAME | required | Name of your module repository |
102+
| BASE_URL | required | Need to end with `/` |
103+
| MAX_NUM | optional | Max num of versions for modules, default is `3` |
104+
| ENABLE_LOG | optional | default is `true` |
105+
| LOG_DIR | optional | default is `null` |
104106

105107
## track.json
106108
```json
107109
{
108-
"id": "required",
109-
"update_to": "required",
110-
"license": "optional",
111-
"changelog": "optional"
110+
"id": "str",
111+
"update_to": "str",
112+
"changelog": "str",
113+
"license": "str",
114+
"homepage": "str",
115+
"source": "str",
116+
"support": "str",
117+
"donate": "str",
118+
"max_num": "int"
112119
}
113120
```
114121
| Key | Attribute | Description |
115122
|:-:|:-:|:-:|
116-
| id | required | Id of the module itself |
117-
| update_to | required | Url of updateJson or zipFile, or file name of zipFile, or url of a git repository (end with `.git`) |
123+
| id | required | Id of Module (_in `module.prop`_) |
124+
| update_to | required | Follow examples below |
125+
| changelog | optional | Markdown or Simple Text (**_no HTML_**) |
118126
| license | optional | SPDX ID |
119-
| changelog | optional | Url of changelog.md or file name of changelog.md (markdown is the best, simple text is also ok, **no html**) |
127+
| homepage | optional | Url |
128+
| source | optional | Url |
129+
| support | optional | Url |
130+
| donate | optional | Url |
131+
| max_num | optional | Overload `MAX_NUM` in config.json |
120132

121133
### Update from updateJson
122-
This is for those modules that provide [updateJson](https://topjohnwu.github.io/Magisk/guides.html#moduleprop).
134+
> For those modules that provide [updateJson](https://topjohnwu.github.io/Magisk/guides.html#moduleprop).
123135
124136
```json
125137
{
@@ -130,10 +142,7 @@ This is for those modules that provide [updateJson](https://topjohnwu.github.io/
130142
```
131143

132144
### Update from local updateJson
133-
The `update_to` requires a relative directory of *local*.
134-
1. Create a new folder named *local* in *your-repo*
135-
2. Put the update.json into *local*
136-
145+
> `update_to` requires a relative directory of *local*.
137146
```json
138147
{
139148
"id": "zygisk_lsposed",
@@ -143,9 +152,7 @@ The `update_to` requires a relative directory of *local*.
143152
```
144153

145154
### Update from url
146-
This is for those have a same url to release new modules.
147-
- If url has changed, you have to edit it.
148-
155+
> For those have a same url to release new modules.
149156
```json
150157
{
151158
"id": "zygisk_lsposed",
@@ -156,8 +163,7 @@ This is for those have a same url to release new modules.
156163
```
157164

158165
### Update from git
159-
This is for those you can **get the module by packaging all files** in the repository, such as [Magisk-Modules-Repo](https://github.com/Magisk-Modules-Repo) and [Magisk-Modules-Alt-Repo](https://github.com/Magisk-Modules-Alt-Repo).
160-
- If you are looking how to add *Magisk-Modules-Alt-Repo* to *MRepo*, you can refer to [ya0211/magisk-modules-alt-repo](https://github.com/ya0211/magisk-modules-alt-repo).
166+
> For those we can get module by packaging all files in the repository, such as [Magisk-Modules-Repo](https://github.com/Magisk-Modules-Repo) and [Magisk-Modules-Alt-Repo](https://github.com/Magisk-Modules-Alt-Repo).
161167
162168
```json
163169
{
@@ -169,9 +175,7 @@ This is for those you can **get the module by packaging all files** in the repos
169175
```
170176

171177
### Update from local zip
172-
The `update_to` requires a relative directory of *local*.
173-
1. Create a new folder named *local* in *your-repo*
174-
2. Put the zip file (and changelog.md) into *local*
178+
> `update_to` and `changelog` requires a relative directory of *local*.
175179
176180
```json
177181
{
@@ -185,10 +189,8 @@ The `update_to` requires a relative directory of *local*.
185189
## For developer
186190
```
187191
your-repo
188-
├── config
189-
│   └── config.json
190-
191192
├── json
193+
│   ├── config.json
192194
│   └── modules.json
193195
194196
├── local
@@ -216,41 +218,19 @@ your-repo
216218
217219
└── util
218220
```
219-
### modules.json
220-
```json
221-
{
222-
"name": "{repo_name}",
223-
"timestamp": 1679036889.233794,
224-
"modules": [
225-
{
226-
"id": "zygisk_lsposed",
227-
"license": "GPL-3.0",
228-
"name": "Zygisk - LSPosed",
229-
"version": "v1.8.6 (6712)",
230-
"versionCode": 6712,
231-
"author": "LSPosed Developers",
232-
"description": "Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 13. Requires Magisk 24.0+ and Zygisk enabled.",
233-
"states": {
234-
"zipUrl": "{repo_url}modules/zygisk_lsposed/v1.8.6_6712.zip",
235-
"changelog": "{repo_url}modules/zygisk_lsposed/v1.8.6_6712.md"
236-
}
237-
}
238-
]
239-
}
240-
```
241221

242222
### update.json
243223
```json
244224
{
245225
"id": "zygisk_lsposed",
246-
"timestamp": 1679025505.129431,
226+
"timestamp": 1673882223.0,
247227
"versions": [
248228
{
249-
"timestamp": 1679025505.129431,
229+
"timestamp": 1673882223.0,
250230
"version": "v1.8.6 (6712)",
251231
"versionCode": 6712,
252-
"zipUrl": "{repo_url}modules/zygisk_lsposed/v1.8.6_6712.zip",
253-
"changelog": "{repo_url}modules/zygisk_lsposed/v1.8.6_6712.md"
232+
"zipUrl": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.zip",
233+
"changelog": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.md"
254234
}
255235
]
256236
}
@@ -262,8 +242,79 @@ your-repo
262242
"id": "zygisk_lsposed",
263243
"update_to": "https://lsposed.github.io/LSPosed/release/zygisk.json",
264244
"license": "GPL-3.0",
245+
"homepage": "https://lsposed.org/",
246+
"source": "https://github.com/LSPosed/LSPosed.git",
247+
"support": "https://github.com/LSPosed/LSPosed/issues",
265248
"added": 1679025505.129431,
266-
"last_update": 1679025505.129431,
249+
"last_update": 1673882223.0,
267250
"versions": 1
268251
}
269252
```
253+
254+
## modules.json
255+
### v1
256+
> For MRepo v2.0.0-beta01 and higher
257+
```json
258+
{
259+
"name": "{NAME}",
260+
"metadata": {
261+
"version": 1,
262+
"timestamp": 1692439764.10608
263+
},
264+
"modules": [
265+
{
266+
"id": "zygisk_lsposed",
267+
"name": "Zygisk - LSPosed",
268+
"version": "v1.8.6 (6712)",
269+
"versionCode": 6712,
270+
"author": "LSPosed Developers",
271+
"description": "Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 13. Requires Magisk 24.0+ and Zygisk enabled.",
272+
"track": {
273+
"type": "ONLINE_JSON",
274+
"added": 1679025505.129431,
275+
"license": "GPL-3.0",
276+
"homepage": "https://lsposed.org/",
277+
"source": "https://github.com/LSPosed/LSPosed.git",
278+
"support": "https://github.com/LSPosed/LSPosed/issues",
279+
"donate": ""
280+
},
281+
"versions": [
282+
{
283+
"timestamp": 1673882223.0,
284+
"version": "v1.8.6 (6712)",
285+
"versionCode": 6712,
286+
"zipUrl": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.zip",
287+
"changelog": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.md"
288+
}
289+
]
290+
}
291+
]
292+
}
293+
```
294+
### v0
295+
> For MRepo v1.5.0-alpha02 and lower
296+
```json
297+
{
298+
"name": "{NAME}",
299+
"timestamp": 1692439602.46997,
300+
"metadata": {
301+
"version": "1.0.0",
302+
"versionCode": 100
303+
},
304+
"modules": [
305+
{
306+
"id": "zygisk_lsposed",
307+
"name": "Zygisk - LSPosed",
308+
"version": "v1.8.6 (6712)",
309+
"versionCode": 6712,
310+
"author": "LSPosed Developers",
311+
"description": "Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 13. Requires Magisk 24.0+ and Zygisk enabled.",
312+
"license": "GPL-3.0",
313+
"states": {
314+
"zipUrl": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.zip",
315+
"changelog": "{BASE_URL}modules/zygisk_lsposed/v1.8.6_(6712)_6712.md"
316+
}
317+
}
318+
]
319+
}
320+
```

cli.py

+9
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
import os
44
import sys
55
from pathlib import Path
6+
from signal import SIGINT, signal
7+
68
from sync.cli import Main
79

10+
11+
# noinspection PyUnresolvedReferences,PyProtectedMember
12+
def signal_handler(*args):
13+
os._exit(1)
14+
15+
816
if __name__ == "__main__":
17+
signal(SIGINT, signal_handler)
918
cwd_folder = Path(__name__).resolve().parent
1019

1120
try:

demo

Submodule demo updated from 49a4446 to 376084c

sync/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
from .core import *
2+
from .track import *
23
from .utils import Log
34

45
Log.set_file_prefix("sync")
56

67
__all__ = [
8+
"Check",
79
"Config",
10+
"Index",
811
"Pull",
9-
"Sync"
12+
"Sync",
13+
"LocalTracks",
14+
"GithubTracks"
1015
]

0 commit comments

Comments
 (0)