''' 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 UDSClientReader(FeedReader): '''Custom feed reader for UDSClient, whose version number appears in a .js file.''' def __init__(self, target: IssuePoster): '''Creates a new UDSClient Reader.''' super().__init__("udsclient", "https://polilabs.upv.es/uds/utility/uds.js", target) 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) if not self.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, target = 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", target = GITLAB_BOIRA_CARGAJI), # python3-snakes PIPY snakes 37 (packages/python3-snakes) PIPYReader(name = "python3-snakes", package = "snakes", target = GITLAB_SNAKES_CARGAJI), ################################ Software that I package (Forgejo) ################################ # meshcentral GHReleases Ylianst/MeshCentral archpkgs/meshcentral GithubReader(name = "meshcentral", project = "Ylianst/MeshCentral", target = CGJForgejoPoster("archpkgs/meshcentral")), # nc-cospend GHReleases eneiluj/cospend-nc archpkgs/nextcloud-app-cospend NCAppReader(app = "nextcloud-app-cospend", project = "eneiluj/cospend-nc"), # 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 owncloud/music archpkgs/nextcloud-app-music NCAppReader(app = "nextcloud-app-music", project = "owncloud/music"), # nc-onlyoffice GHReleases ONLYOFFICE/onlyoffice-nextcloud archpkgs/nextcloud-app-onlyoffice NCAppReader(app = "nextcloud-app-onlyoffice", project = "ONLYOFFICE/onlyoffice-nextcloud"), # 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(target = 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"), ] ## PENDING: # Software that I use exposed to the Internet # Name FeedType Project # gad GHReleases brianreumere/gandi-automatic-dns aur? # nextcloud GHReleases nextcloud/server pacman? # peertube GHReleases Chocobozzz/PeerTube aur? # vaultwarden GHReleases dani-garcia/vaultwarden pacman? # wallabag GHReleases wallabag/wallabag pacman? # yay GHReleases Jguer/yay aur? # Others? # duplicati ???