-
Notifications
You must be signed in to change notification settings - Fork 4
/
autoupdate.py
82 lines (80 loc) · 3.23 KB
/
autoupdate.py
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
import json
from urllib import request
import in_place
resp = request.urlopen('https://github.com/nyfair/nginx-nosni/raw/master/old.json')
x = json.loads(resp.read().decode('utf-8'))
x = dict(map(lambda p: (p, x['data'][p]['version']), x['data'].keys()))
mingw = x['Mingw-w64'][:x['Mingw-w64'].find('ucrt')+4]
with in_place.InPlace('.github/workflows/toolchain.yml', newline='') as f:
for l in f:
if (i:=l.find('key: mcf_')) > -1:
l = '%s%s\n' % (l[:i+9], mingw)
elif (i:=l.find('curl')) > -1:
l = '%s%s.7z --resolve "gcc-mcf.lhmouse.com:443:204.152.213.15"\n' % (l[:i+55], x['Mingw-w64'])
f.write(l)
pkgs = {}
pkgs['mcfgthread'] = mingw[:8]
# pkgs['libvorbis_aotuv-dev'] = x['libvorbis']
pkgs['python-embed'] = x['Python']
pkgs['vapoursynth'] = x['VapourSynth'][1:]
pkgs['ffmpeg'] = x['ffmpeg']
pkgs['mpv'] = x['mpv']
for p in ['ffnvcodec', 'freetype2', 'fribidi', 'harfbuzz', 'lame', 'lcms2', 'libass', 'libbluray', 'libdovi', 'libdvdcss', 'libdvdread', 'libdvdnav', 'libogg', 'libplacebo', 'opus', 'shaderc', 'spirv-cross', 'vulkan']:
pkgs['%s-dev' % p] = x[p]
for p in pkgs:
with in_place.InPlace('%s/PKGBUILD' % p, newline='') as f:
for l in f:
if l.startswith('pkgver'):
l = 'pkgver=%s\n' % pkgs[p]
f.write(l)
pkgs['vapoursynth-dev'] = pkgs['vapoursynth']
pkgs['vapoursynth-plugin-core-extra'] = pkgs['vapoursynth']
pkgs['ffmpeg-dev'] = pkgs['ffmpeg']
for t in ['batch-stable.yml', 'batch-bleeding_edge-weekly.yml', 'ci.yml']:
with in_place.InPlace('.github/workflows/%s' % t, newline='') as f:
for l in f:
if (i:=l.find('key: mcf_')) > -1:
l = '%s%s\n' % (l[:i+9], mingw)
elif (i:=l.find('/dev/')) > -1:
r = l.find('-1-x86_64')
rr = l.rfind('-', i, r)
p = l[i+5:rr]
if p in pkgs:
l = '%s%s-%s%s' % (l[:i+5], p, pkgs[p], l[r:])
elif (i:=l.find('/latest/')) > -1:
r = l.find('-1-x86_64')
rr = l.rfind('-', i, r)
p = l[i+8:rr]
if p in pkgs:
l = '%s%s-%s%s' % (l[:i+8], p, pkgs[p], l[r:])
f.write(l)
ffmpeg_git = pkgs['ffmpeg'].split('.')[:2]
mpv_git = pkgs['mpv'].split('.')[:2]
pkgs_git = {
'ffmpeg': '%s.%dpre' % (ffmpeg_git[0], int(ffmpeg_git[1])+1),
'mpv': '%s.%dpre' % (mpv_git[0], int(mpv_git[1])+1)
}
for p in pkgs_git:
with in_place.InPlace('%s/PKGBUILD-git' % p, newline='') as f:
for l in f:
if l.startswith('pkgver'):
l = 'pkgver=%s\n' % pkgs_git[p]
f.write(l)
with in_place.InPlace('mpv/PKGBUILD-stablelib', newline='') as f:
for l in f:
if l.startswith('pkgver'):
l = 'pkgver=%s\n' % pkgs_git['mpv']
f.write(l)
with in_place.InPlace('.github/workflows/batch-bleeding_edge-weekly.yml', newline='') as f:
for l in f:
if (i:=l.find('tags/libdovi')) > -1:
l = '%s%s.zip\n' % (l[0:i+13], pkgs['libdovi-dev'])
if (i:=l.find('/bleeding_edge/')) > -1:
r = l[i+15:]
if r.startswith('ffmpeg-git-dev'):
l = '%sffmpeg-git-dev-%s-1-x86_64.pkg.tar.zst\n' % (l[0:i+15], pkgs_git['ffmpeg'])
elif r.startswith('ffmpeg-git'):
l = '%sffmpeg-git-%s-1-x86_64.pkg.tar.xz\n' % (l[0:i+15], pkgs_git['ffmpeg'])
elif r.startswith('mpv-git'):
l = '%smpv-git-%s-1-x86_64.pkg.tar.xz\n' % (l[0:i+15], pkgs_git['mpv'])
f.write(l)