From 8cd366eab597040c0b710af31409c12e7b3f6f0d Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 5 Dec 2022 02:25:07 -0500 Subject: [PATCH] support auto updating more packages --- anda/adwaita++-icons/chkupdate.py | 27 +++++++++++++++++++ anda/apps/openasar-canary/chkupdate.py | 23 ++++++++++++++++ .../apps/openasar-canary/openasar-canary.spec | 2 ++ .../budgie/budgie-extras/chkupdate.py | 27 +++++++++++++++++++ anda/moby-extras/moby-buildx/chkupdate.py | 27 +++++++++++++++++++ anda/moby-extras/moby-compose/chkupdate.py | 27 +++++++++++++++++++ anda/rust/bat-extras/chkupdate.py | 27 +++++++++++++++++++ anda/rust/pop-launcher/chkupdate.py | 27 +++++++++++++++++++ anda/rust/sccache/chkupdate.py | 27 +++++++++++++++++++ anda/rust/youki/chkupdate.py | 27 +++++++++++++++++++ anda/rust/zellij/chkupdate.py | 27 +++++++++++++++++++ anda/tools/appimagelauncher/chkupdate.py | 27 +++++++++++++++++++ anda/tools/gcm-core/chkupdate.py | 27 +++++++++++++++++++ 13 files changed, 322 insertions(+) create mode 100644 anda/adwaita++-icons/chkupdate.py create mode 100644 anda/apps/openasar-canary/chkupdate.py create mode 100644 anda/desktops/budgie/budgie-extras/chkupdate.py create mode 100644 anda/moby-extras/moby-buildx/chkupdate.py create mode 100644 anda/moby-extras/moby-compose/chkupdate.py create mode 100644 anda/rust/bat-extras/chkupdate.py create mode 100644 anda/rust/pop-launcher/chkupdate.py create mode 100644 anda/rust/sccache/chkupdate.py create mode 100644 anda/rust/youki/chkupdate.py create mode 100644 anda/rust/zellij/chkupdate.py create mode 100644 anda/tools/appimagelauncher/chkupdate.py create mode 100644 anda/tools/gcm-core/chkupdate.py diff --git a/anda/adwaita++-icons/chkupdate.py b/anda/adwaita++-icons/chkupdate.py new file mode 100644 index 0000000000..36fecb566c --- /dev/null +++ b/anda/adwaita++-icons/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "adwaita++-icons" +REPO = "Bonandry/adwaita-plus" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/apps/openasar-canary/chkupdate.py b/anda/apps/openasar-canary/chkupdate.py new file mode 100644 index 0000000000..02e3e48131 --- /dev/null +++ b/anda/apps/openasar-canary/chkupdate.py @@ -0,0 +1,23 @@ +import requests +import re +import os + + +NAME = "openasar-canary" +REPO = "GooseMod/OpenAsar" +REGEX_SHA = r"%define commit (.+)" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/commits/HEAD" + +token = os.getenv("GITHUB_TOKEN") +sha = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()["sha"] +f = open(SPEC, "r") + +matches = re.findall(REGEX_SHA, txt := f.read()) +if not len(matches): + exit(f"{NAME}: Failed to match regex!") +cur = matches[0] + +if sha == cur: + exit(f"{NAME}: Up to date!") +print(f"{NAME}: {cur} -> {sha}") diff --git a/anda/apps/openasar-canary/openasar-canary.spec b/anda/apps/openasar-canary/openasar-canary.spec index c8596ae954..8b60d95c08 100644 --- a/anda/apps/openasar-canary/openasar-canary.spec +++ b/anda/apps/openasar-canary/openasar-canary.spec @@ -1,3 +1,5 @@ +%define commit ad9b161744b27acc5e333ee70df11afca09301ef + Name: openasar-canary Version: nightly.%{autogitdate} Release: 1%{?dist} diff --git a/anda/desktops/budgie/budgie-extras/chkupdate.py b/anda/desktops/budgie/budgie-extras/chkupdate.py new file mode 100644 index 0000000000..76360ad614 --- /dev/null +++ b/anda/desktops/budgie/budgie-extras/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "budgie-extras" +REPO = "UbuntuBudgie/budgie-extras" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/moby-extras/moby-buildx/chkupdate.py b/anda/moby-extras/moby-buildx/chkupdate.py new file mode 100644 index 0000000000..b61367dc4b --- /dev/null +++ b/anda/moby-extras/moby-buildx/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "moby-buildx" +REPO = "docker/buildx" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/moby-extras/moby-compose/chkupdate.py b/anda/moby-extras/moby-compose/chkupdate.py new file mode 100644 index 0000000000..dd79458b2e --- /dev/null +++ b/anda/moby-extras/moby-compose/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "moby-compose" +REPO = "docker/compose" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/rust/bat-extras/chkupdate.py b/anda/rust/bat-extras/chkupdate.py new file mode 100644 index 0000000000..5eaa9bfedc --- /dev/null +++ b/anda/rust/bat-extras/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "bat-extras" +REPO = "eth-p/bat-extras" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/rust/pop-launcher/chkupdate.py b/anda/rust/pop-launcher/chkupdate.py new file mode 100644 index 0000000000..6b742ea67d --- /dev/null +++ b/anda/rust/pop-launcher/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "pop-launcher" +REPO = "pop-os/launcher" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).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}") diff --git a/anda/rust/sccache/chkupdate.py b/anda/rust/sccache/chkupdate.py new file mode 100644 index 0000000000..2f328d6ad9 --- /dev/null +++ b/anda/rust/sccache/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "rust-sccache" +REPO = "mozilla/sccache" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/rust/youki/chkupdate.py b/anda/rust/youki/chkupdate.py new file mode 100644 index 0000000000..16b2d6beda --- /dev/null +++ b/anda/rust/youki/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "youki" +REPO = "containers/youki" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/rust/zellij/chkupdate.py b/anda/rust/zellij/chkupdate.py new file mode 100644 index 0000000000..078f063ce3 --- /dev/null +++ b/anda/rust/zellij/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "rust-zellij" +REPO = "zellij-org/zellij" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/tools/appimagelauncher/chkupdate.py b/anda/tools/appimagelauncher/chkupdate.py new file mode 100644 index 0000000000..76a5b44328 --- /dev/null +++ b/anda/tools/appimagelauncher/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "appimagelauncher" +REPO = "TheAssassin/AppImageLauncher" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}") diff --git a/anda/tools/gcm-core/chkupdate.py b/anda/tools/gcm-core/chkupdate.py new file mode 100644 index 0000000000..ce4b7159c4 --- /dev/null +++ b/anda/tools/gcm-core/chkupdate.py @@ -0,0 +1,27 @@ +import os +import requests +import re + +NAME = "gcm-core" +REPO = "GitCredentialManager/git-credential-manager" +REGEX_VER = r"Version:\s*([\.\d]+)\n" +SPEC = f"{NAME}.spec" +LINK = f"https://api.github.com/repos/{REPO}/releases/latest" + + +token = os.getenv("GITHUB_TOKEN") +ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[ + "tag_name" +][1:] + +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}")