Migrate to anda update

This commit is contained in:
windowsboy111
2022-11-28 00:16:44 +08:00
parent 40e5fb10d1
commit fb43ccdff1
43 changed files with 41 additions and 404 deletions
+12 -2
View File
@@ -15,7 +15,7 @@ jobs:
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Install packages
run: dnf install -y rpmdevtools git python
run: dnf install -y rpmdevtools git python anda
- name: Checkout
uses: actions/checkout@v3
@@ -23,8 +23,18 @@ jobs:
fetch-depth: 2
token: ${{ secrets.PAT }}
- name: Run Update
- name: Run Update (Python)
run: bash ./update.sh
<<<<<<< Updated upstream
=======
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Update (anda)
run: anda update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
>>>>>>> Stashed changes
- name: Save
run: |
+1
View File
@@ -0,0 +1 @@
rpm.update(gh("Bonandry/adwaita-plus"));
-39
View File
@@ -1,39 +0,0 @@
import os
import re
from requests import get
import json
NAME = "authy"
SPEC = f"{NAME}.spec"
REGEX_VER = r'Version:(\s*)([\.\d]+)\n'
REGEX_SRC = r'Source0:(\s*)([^\n]+)\n'
def run_cmds(*cmds: str):
for cmd in cmds:
print(f"{NAME}: $ {cmd}")
if rc := os.system(cmd):
exit(f"{NAME}: Stopping because {rc=}")
raw = get('https://api.snapcraft.io/v2/snaps/info/authy', headers={'Snap-Device-Series': '16'}).text
data = json.loads(raw)
ver = data['channel-map'][0]['version']
f = open(SPEC, 'r')
content = f.read()
found = re.findall(REGEX_VER, content)
try:
assert found
curver = found[0][1]
if ver == curver:
exit(f"{NAME}: Up to date!")
print(f"{NAME}: {curver} -> {ver}")
except IndexError or AssertionError:
exit(f"{NAME}: Failed to read spec!")
link = data['channel-map'][0]['download']['url']
newspec = re.sub(REGEX_VER, f'Version:{found[0][0]}{ver}\n', content)
newspec = re.sub(REGEX_SRC, f'Source0:{found[0][0]}{link}\n', content)
f.close()
f = open(SPEC, 'w')
f.write(newspec)
f.close()
+6
View File
@@ -0,0 +1,6 @@
let req = new_req("https://api.snapcraft.io/v2/snaps/info/authy");
req.head("Snap-Device-Series", "16");
let obj = json(req.get());
let obj2 = get_json(obj, "channel-map");
let obj3 = get_json(obj2, 0);
rpm.version(string_json(get_json(obj3, "version")));
-21
View File
@@ -1,21 +0,0 @@
import os
import requests
import re
NAME = 'blackbox-terminal'
ID = 20397
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://gitlab.gnome.org/api/v4/projects/{ID}/releases/'
# BIG ASSUMPTION THAT IT'S THE FIRST ONE :3
ver = requests.get(LINK).json()[0]['tag_name']
ver = ver[1:] # starts with v
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
+3
View File
@@ -0,0 +1,3 @@
let txt = get("https://gitlab.gnome.org/api/v4/projects/20397/releases/");
let ver = json(txt).get_json(0).get_json("tag_name").string_json()[1:];
rpm.version(ver);
@@ -0,0 +1 @@
rpm.version(gh("UbuntuBudgie/budgie-extras"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'contractor'
REPO = "elementary/contractor"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.version(gh("elementary/contractor"))
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'editorconfig'
REPO = "elementary/editorconfig-core-c"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.version(gh("editorconfig/editorconfig-core-c"))
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-calculator'
REPO = "elementary/calculator"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.version(gh("elementary/calculator"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-calendar'
REPO = "elementary/calendar"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.version(gh("elementary/calendar"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-camera'
REPO = "elementary/camera"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/camera"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-capnet-assist'
REPO = "elementary/capnet-assist"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/capnet-assist"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-code'
REPO = "elementary/code"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/code"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-files'
REPO = "elementary/files"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/files"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-greeter'
REPO = "elementary/greeter"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/greeter"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-icon-theme'
REPO = "elementary/icons"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/icons"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-music'
REPO = "elementary/music"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/music"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-notifications'
REPO = "elementary/notifications"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/notifications"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-onboarding'
REPO = "elementary/onboarding"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/onboarding"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-photos'
REPO = "elementary/photos"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/photos"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-print'
REPO = "elementary/print"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/print"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-screenshot-tool'
REPO = "elementary/screenshot"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/screenshot"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-settings-daemon'
REPO = "elementary/settings-daemon"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/settings-daemon"));
@@ -1,19 +0,0 @@
import os
import requests
import re
NAME = 'elementary-shortcut-overlay'
REPO = "elementary/shortcut-overlay"
REGEX_VER = r'Version:\s*([\.\d]+)\n'
SPEC = f"{NAME}.spec"
LINK = f'https://api.github.com/repos/{REPO}/releases/latest'
ver = requests.get(LINK).json()['tag_name']
with open(SPEC, 'r') as f:
matches = re.findall(REGEX_VER, f.read())
if not len(matches): exit(f"{NAME}: Failed to match regex!")
cur = matches[0]
if ver == cur: exit(f'{NAME}: Up to date!')
print(f'{NAME}: {cur} -> {ver}')
os.system(f'rpmdev-bumpspec -n {ver} {SPEC}')
@@ -0,0 +1 @@
rpm.update(gh("elementary/shortcut-overlay"));