forked from buhonghao/Redpill_CustomBuild
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (187 loc) · 9.8 KB
/
exts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Get Exts
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
exts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
run : |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Checkout rp-ext s
run: |
sudo rm -rf rp-ext_pocopico
git clone https://github.com/pocopico/rp-ext rp-ext_pocopico
# 容错
rm -f rp-ext_pocopico/asix/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/ax88179_178a/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/dm9601/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/nct6775/releases/dva3221_42218.json
rm -f rp-ext_pocopico/sfc/releases/ds918p_25556.json
rm -f rp-ext_pocopico/v9fs/releases/ds918p_42218.json
sudo rm -rf rp-ext_wjz304
git clone https://github.com/wjz304/rp-ext rp-ext_wjz304
# 容错
rm -f rp-ext_wjz304/asix/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/ax88179_178a/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/dm9601/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/nct6775/releases/dva3221_42218.json
rm -f rp-ext_wjz304/sfc/releases/ds918p_25556.json
rm -f rp-ext_wjz304/v9fs/releases/ds918p_42218.json
- name: Get exts lsit
uses: jannekem/run-python-script-action@v1.2
with:
script: |
# -*- coding: utf-8 -*-
import os, json, hashlib
root = '' # os.path.dirname(os.path.abspath(__file__))
def getjsonfile(file):
data = None
if os.path.isfile(file):
try:
with open(file, 'r') as f:
data = json.load(f)
except Exception as err:
print(err)
return data
def sha256sum(file):
sha256 = ''
if os.path.isfile(file):
with open(file, "rb") as f:
sha256=hashlib.sha256(f.read()).hexdigest()
return sha256
def pathstrsub(exp, reglist=[]):
ret = exp
try:
for re in reglist:
ret = ret.replace(re[0], re[1])
except Exception as err:
print(err)
return ret
def getextslist(work = 'rp-ext', reglist=[]):
exts = {}
try:
jext = 'rpext-index.json'
extdirs = os.listdir(os.path.join(root, work))
extdirs.sort()
print(extdirs)
for extdir in extdirs:
if extdir.startswith('.') or extdir.startswith('redpill'):
continue
if os.path.isdir(os.path.join(root, work, extdir)):
data_index = getjsonfile(os.path.join(root, work, extdir, jext))
if data_index != None:
try:
keys = data_index["releases"].keys()
for key in keys:
suffix = ''
data_releases = getjsonfile(os.path.join(root, work, pathstrsub(data_index["releases"][key], reglist)))
if data_releases != None:
if "files" in data_releases:
for file in data_releases["files"]:
sha256_online = file["sha256"]
sha256_local = sha256sum(os.path.join(root, work, pathstrsub( file["url"], reglist)))
if sha256_online != sha256_local:
suffix = '#'
print('file: {} -- key: {} -- error: {} -- really: {}'.format(pathstrsub(data_index["releases"][key], reglist), pathstrsub(file["url"], reglist), sha256_online, sha256_local))
else:
suffix = '*'
print('file: {} -- may not exists'.format(pathstrsub(data_index["releases"][key], reglist)))
if key in exts.keys():
exts[key][extdir + suffix] = data_index["info"]["description"]
else:
exts[key] = { extdir + suffix: data_index["info"]["description"]}
except Exception as err:
print(err)
except Exception as err:
print(err)
return exts
if __name__ == '__main__':
exts = {}
print('####################### pocopico #######################')
exts["pocopico"] = getextslist('rp-ext_pocopico', [['https://raw.githubusercontent.com/pocopico/rp-ext/master/',''], ['https://github.com/pocopico/rp-ext/raw/main/',''], ['https://github.com/pocopico/rp-ext/blob/main/','']])
print('####################### wjz304 #######################')
exts["wjz304"] = getextslist('rp-ext_wjz304', [['https://raw.githubusercontent.com/wjz304/rp-ext/master/','']])
if len(exts) > 0:
print('####################### exts #######################')
print(json.dumps(exts, indent=4))
with open(os.path.join(root, 'exts.json'), 'w', encoding='utf-8') as f:
f.write(json.dumps(exts, indent=4))
- name: Check and Push
run: |
if [ -n "$(git status -s | grep exts.json)" ]; then
git add exts.json
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi
- name: Checkout redpill-load s
run: |
sudo rm -rf redpill-load_pocopico_develop
git clone --branch develop https://github.com/pocopico/redpill-load.git redpill-load_pocopico_develop
# https://github.com/pocopico/rp-ext/blob/main/redpill/rpext-index.json 并不包含 DS3617xs/6.2.4-25556, 线上无法获取
rm -rf redpill-load_pocopico_develop/config/DS3617xs/6.2.4-25556
sudo rm -rf redpill-load_pocopico_jun
git clone --branch jun https://github.com/pocopico/redpill-load.git redpill-load_pocopico_jun
# https://github.com/pocopico/rp-ext/blob/main/redpill/rpext-index.json 并不包含 DS3617xs/6.2.4-25556, 线上无法获取
rm -rf redpill-load_pocopico_jun/config/DS3617xs/6.2.4-25556
sudo rm -rf redpill-load_jumkey_develop
git clone --branch develop https://github.com/jumkey/redpill-load.git redpill-load_jumkey_develop
- name: Get loads lsit
uses: jannekem/run-python-script-action@v1.2
with:
script: |
# -*- coding: utf-8 -*-
import os, json
root = '' # os.path.dirname(os.path.abspath(__file__))
def getloadlist(work = 'redpill-load'):
load = {}
try:
platforms = os.listdir(os.path.join(root, work, 'config'))
platforms.sort()
print(platforms)
for platform in platforms:
if platform.startswith('.') or platform.startswith('_'):
continue
load[platform] = []
if os.path.isdir(os.path.join(root, work, 'config', platform)):
versions = os.listdir(os.path.join(root, work, 'config', platform))
versions.sort()
print(versions)
for version in versions:
if os.path.exists(os.path.join(root, work, 'config', platform, version, 'config.json')):
load[platform].append(version)
except Exception as err:
print(err)
return load
if __name__ == '__main__':
loads = {}
print('################### pocopico develop ###################')
loads["pocopico_develop"] = getloadlist('redpill-load_pocopico_develop')
print('##################### pocopico jun #####################')
loads["pocopico_jun"] = getloadlist('redpill-load_pocopico_jun')
print('#################### jumkey develop ####################')
loads["jumkey_develop"] = getloadlist('redpill-load_jumkey_develop')
if len(loads) > 0:
print('####################### loads #######################')
print(json.dumps(loads, indent=4))
with open(os.path.join(root, 'loads.json'), 'w', encoding='utf-8') as f:
f.write(json.dumps(loads, indent=4))
- name: Check and Push
run: |
if [ -n "$(git status -s | grep loads.json)" ]; then
git add loads.json
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi