mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
Create chkupdate.py
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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}')
|
||||
Reference in New Issue
Block a user