summarylogtreecommitdiffstats
path: root/update.py
blob: 1f47d014c2cde207fd0ef6d0df39e6332bfa36a2 (plain)
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
#!/bin/python3
import json
import urllib.request
import subprocess

# get info
json = json.loads(urllib.request.urlopen("https://dolphin-emu.org/update/latest/beta/").read())

rev = json['shortrev'].split("-")
hash = json['hash']
hashshort = hash[:10]

# update pkgbuild
with open("PKGBUILD", "r") as file:
	pkgbuild = file.readlines()

pkgbuild[7] = "pkgver=" + rev[0] + ".r" + rev[1] + "." + hashshort + "\n"

pkgbuild[23] = "source=('dolphin-emu::git+https://github.com/dolphin-emu/dolphin.git#commit=" + hash + "')" + "\n"

with open("PKGBUILD", "w") as file:
	file.writelines(pkgbuild)

# update srcinfo
# makepkg --printsrcinfo > .SRCINFO
with open(".SRCINFO", "w") as file:
	file.write(subprocess.check_output(["makepkg", "--printsrcinfo"]).decode("utf-8"))