diff --git a/README.md b/README.md index 9927311b..9eabcb6c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Common Release Data for various projects in a consumable format. Current format ## Currently Updated -As of 2023-06-25, 159 of the 232 products tracked by endoflife.date have automatically tracked releases: +As of 2023-06-25, 160 of the 232 products tracked by endoflife.date have automatically tracked releases: | Product | Permalink | Auto | Method | |--------------------------------------|-------------------------------|------|-----------------| @@ -208,7 +208,7 @@ As of 2023-06-25, 159 of the 232 products tracked by endoflife.date have automat | React | `/react` | ✔️ | npm | | Red Hat Enterprise Linux | `/rhel` | ❌ | n/a | | Red Hat OpenShift | `/red-hat-openshift` | ❌ | n/a | -| Red Hat Satellite | `/redhat-satellite` | ❌ | n/a | +| Red Hat Satellite | `/redhat-satellite` | ✔️ | custom | | Redis | `/redis` | ✔️ | git | | Redmine | `/redmine` | ✔️ | git | | Rocky Linux | `/rocky-linux` | ✔️ | distrowatch | diff --git a/src/redhat-satellite.py b/src/redhat-satellite.py new file mode 100644 index 00000000..08a6a175 --- /dev/null +++ b/src/redhat-satellite.py @@ -0,0 +1,38 @@ +import re +from bs4 import BeautifulSoup +from common import endoflife + +"""Fetch versions with their dates from access.redhat.com. + +A few of the older versions, such as 'Satellite 6.1 GA Release (Build 6.1.1)', +were ignored because too hard to parse. +""" + +URL = "https://access.redhat.com/articles/1365633" +# https://regex101.com/r/m8aWXG/1 +regex = r"^Satellite (?P\d+\.\d+\.\d+([.-]\d+)?) ([Uu]pdate|[Rr]elease)$" + +print("::group::redhat-satellite") +response = endoflife.fetch_url(URL) +soup = BeautifulSoup(response, features="html5lib") + +versions = {} +for table in soup.findAll("tbody"): + for tr in table.findAll("tr"): + td_list = tr.findAll("td") + + # Versions x.y GA are transformed to x.y.0 + version = td_list[0].get_text().replace(' GA', '.0').strip() + m = re.match(regex, version) + if m: + # Versions a.b.c-d are transformed to a.b.c.d + version = m["version"].replace('-', '.') + date = td_list[1].get_text().strip() + versions[version] = date + print(f"{version}: {date}") + +endoflife.write_releases('redhat-satellite', dict( + # sort by date then version (desc) + sorted(versions.items(), key=lambda x: (x[1], x[0]), reverse=True) +)) +print("::endgroup::")