''' The configuration file for issue_generator. Includes a custom reader for UDSClient, a shorthand custom reader and a shorthand custom poster for Forgejo. Two categories of project are given: software used on MIST and software packaged for ArchLinux by me. ''' import re from typing import Any import requests from issue_generator import FeedReader, GithubReader, GithubTagReader, PIPYReader, \ IssuePoster, ForgejoPoster, GitlabPoster, \ TIMEOUT import _secrets class AlpinePackageReader(FeedReader): '''Custom feed reader for Alpine packages''' def __init__(self, package: str, targets: IssuePoster): super().__init__(package, "https://gitlab.alpinelinux.org/alpine/aports/-/commits/master.atom", targets) self.regex = r'community/([^:]+): upgrade to (.+)' self.package = package def is_valid_item(self, entry) -> bool: match = re.search(self.regex, entry.title) return match and match.groups(1) == self.package def entry_get_version(self, entry: dict[str, Any]) -> tuple[str, str]: match = re.search(self.regex, entry.title) if match and match.groups(1) == self.package: return (match.groups(2),) * 2 raise RuntimeError(f"Checking version for package {self.package} in invalid entry titled: {entry.title}") def entry_get_link(self, entry: dict[str, Any]) -> str: return entry.id class UDSClientReader(FeedReader): '''Custom feed reader for UDSClient, whose version number appears in a .js file.''' def __init__(self, targets: IssuePoster): '''Creates a new UDSClient Reader.''' super().__init__("udsclient", "https://polilabs.upv.es/uds/utility/uds.js", targets) def read_feed(self) -> bool | None: '''Checks for a new version of udsclient, by checking a .js file.''' get = requests.get(self.url, timeout = TIMEOUT) for target in self.targets: if not target.check_req(get, self.name): return None match = re.search(r"[/a-zA-Z_-]+udsclient\d+-(\d+\.\d+\.\d+)\.tar\.gz", get.text) if not match: return None url = "https://polilabs.upv.es" + match.group(0) version = match.group(1) if requests.head(url, timeout = TIMEOUT).status_code != 200: return None return self.match_post_save(version, version, url) def entry_get_link(self, entry: dict[str, Any]) -> str: raise NotImplementedError() def entry_get_version(self, entry: dict[str, Any]) -> str: raise NotImplementedError() class CGJForgejoPoster(ForgejoPoster): '''All projects on Forgejo share the same assignee, instance and token.''' def __init__(self, project: str): super().__init__(project, token = _secrets.FORGEJO_REPORTER_TOKEN, instance = "https://git.cgj.es") class NCAppReader(GithubReader): '''All GitHub releases readers that must alert Forgejo's `archpkgs`.''' def __init__(self, app, project): super().__init__(name = app, project = project, targets = CGJForgejoPoster("archpkgs/" + app)) # Issue Posters GITLAB_BOIRA_CARGAJI = GitlabPoster(project=36, assignee=4, labels="upstream-update", instance="https://mist.dsic.upv.es/git", token=_secrets.GITLAB_BOIRA_TOKEN) GITLAB_SNAKES_CARGAJI = GitlabPoster(project=37, assignee=4, labels="upstream-update", instance="https://mist.dsic.upv.es/git", token=_secrets.GITLAB_SNAKES_TOKEN) # Feed Readers FEED_READERS = [ # Name FeedType Project TargetProject ################################ Software used in MIST (Gitlab) ################################### # LanguageTool GHTags languagetool-org/languagetool 36 (sysadmin/boira) GithubTagReader(name = "LanguageTool", project = "languagetool-org/languagetool", targets = GITLAB_BOIRA_CARGAJI), # meshcentral GHReleases Ylianst/MeshCentral 36 (sysadmin/boira) # meshcentral GHReleases Ylianst/MeshCentral archpkgs/meshcentral GithubReader(name = "meshcentral", project = "Ylianst/MeshCentral", targets = [GITLAB_BOIRA_CARGAJI, CGJForgejoPoster("archpkgs/meshcentral")]), # python3-snakes PIPY snakes 37 (packages/python3-snakes) PIPYReader(name = "python3-snakes", package = "snakes", targets = GITLAB_SNAKES_CARGAJI), ################################ Software that I package (Forgejo) ################################ # pdfbooklet GHReleases Averell7/PdfBooklet archpkgs/pdfbooklet NCAppReader(app = "pdfbooklet", project = "Averell7/PdfBooklet"), # nc-cospend GHReleases eneiluj/cospend-nc archpkgs/nextcloud-app-cospend NCAppReader(app = "nextcloud-app-cospend", project = "eneiluj/cospend-nc"), # nc-f_autotagging GHReleases NCAppReader(app = "nextcloud-app-files_automatedtagging", project = "nextcloud/files_automatedtagging"), # nc-f_retention GHReleases NCAppReader(app = "nextcloud-app-files_retention", project = "nextcloud/files_retention"), # nc-forms GHReleases nextcloud/forms archpkgs/nextcloud-app-forms NCAppReader(app = "nextcloud-app-forms", project = "nextcloud/forms"), # nc-maps GHReleases nextcloud/maps archpkgs/nextcloud-app-maps NCAppReader(app = "nextcloud-app-maps", project = "nextcloud/maps"), # nc-music GHReleases nc-music/music archpkgs/nextcloud-app-music NCAppReader(app = "nextcloud-app-music", project = "nc-music/music"), # nc-onlyoffice GHReleases ONLYOFFICE/onlyoffice-nextcloud archpkgs/nextcloud-app-onlyoffice # NCAppReader(app = "nextcloud-app-onlyoffice", project = "ONLYOFFICE/onlyoffice-nextcloud"), # nc-phonetrack GHReleases julien-nc/phonetrack archpkgs/nextcloud-app-phonetrack NCAppReader(app = "nextcloud-app-phonetrack", project = "julien-nc/phonetrack"), # nc-polls GHReleases nextcloud/polls archpkgs/nextcloud-app-polls NCAppReader(app = "nextcloud-app-polls", project = "nextcloud/polls"), # nc-socialsharing GHReleases nextcloud/socialsharing archpkgs/nextcloud-app-socialsharing NCAppReader(app = "nextcloud-app-socialsharing", project = "nextcloud/socialsharing"), # udsclient Custom --- archpkgs/udsclient UDSClientReader(targets = CGJForgejoPoster(project="archpkgs/udsclient")), # vigil GHReleases valeriansaliou/vigil archpkgs/vigil NCAppReader(app = "vigil", project = "valeriansaliou/vigil"), # vigil-local GHReleases valeriansaliou/vigil-local archpkgs/vigil-local NCAppReader(app = "vigil-local", project = "valeriansaliou/vigil-local"), # yourls GHReleases YOURLS/YOURLS archpkgs/yourls NCAppReader(app = "yourls", project = "YOURLS/YOURLS"), ################################ Critical software in servers ################################ # zfs GithubReader(name = "zfs-dkms", project = "openzfs/zfs", targets = CGJForgejoPoster("kauron/solaris-packages")), # yay GHReleases Jguer/yay aur? GithubReader(name = "yay", project = "Jguer/yay", targets = CGJForgejoPoster("kauron/solaris-packages")), # qbittorrent-alpine AlpinePackageReader(package = "qbittorrent", targets = CGJForgejoPoster("kauron/solaris-packages")), ] ## PENDING: # Software that I use exposed to the Internet # Name FeedType Project # gad GHReleases brianreumere/gandi-automatic-dns aur? # peertube GHReleases Chocobozzz/PeerTube aur? # Others? # duplicati ???