[ibm-aix] Refactor script (#231)

Make the script more readable, mostly by:

- using the Product classes,
- removing the use of functions when unnecessary,
- a little bit of renaming and documentation.

Also add a link to web.archive.org to fetch new oldest versions.
This commit is contained in:
Marc Wrobel
2023-12-10 22:23:13 +01:00
committed by GitHub
parent 2c1f083c33
commit ccd9deca70
2 changed files with 20 additions and 20 deletions

View File

@@ -8,5 +8,11 @@
"7.2.2": "2017-10-31",
"7.1.5": "2017-10-31",
"7.2.1": "2016-11-30",
"7.2.0": "2015-12-31"
"7.2.0": "2015-12-31",
"7.1.4": "2015-12-31",
"7.1.3": "2013-11-30",
"6.1.9": "2013-11-30",
"7.1.2": "2012-11-30",
"7.1.1": "2011-10-31",
"7.1.0": "2010-09-30"
}

View File

@@ -3,28 +3,22 @@ from common import http
from common import dates
from common import endoflife
PRODUCT = "ibm-aix"
URL = "https://www.ibm.com/support/pages/aix-support-lifecycle-information"
URLS = [
"https://web.archive.org/web/20210123024247/https://www.ibm.com/support/pages/aix-support-lifecycle-information",
"https://www.ibm.com/support/pages/aix-support-lifecycle-information",
]
def fetch_releases():
response = http.fetch_url(URL)
soup = BeautifulSoup(response.text, features="html5lib")
product = endoflife.Product("ibm-aix")
print(f"::group::{product.name}")
for page in http.fetch_urls(URLS):
page_soup = BeautifulSoup(page.text, features="html5lib")
releases = {}
# for all release tables
for release_table in soup.find("div", class_="ibm-container-body").find_all("table", class_="ibm-data-table ibm-grid"):
# for all rows except the header one
for row in release_table.find_all("tr")[1:]:
for release_table in page_soup.find("div", class_="ibm-container-body").find_all("table", class_="ibm-data-table ibm-grid"):
for row in release_table.find_all("tr")[1:]: # for all rows except the header
cells = row.find_all("td")
version = cells[0].text.strip("AIX ").replace(' TL', '.')
date = dates.parse_month_year_date(cells[1].text).strftime("%Y-%m-%d")
print(f"{version} : {date}")
releases[version] = date
date = dates.parse_month_year_date(cells[1].text)
product.declare_version(version, date)
return releases
print(f"::group::{PRODUCT}")
versions = fetch_releases()
endoflife.write_releases(PRODUCT, versions)
product.write()
print("::endgroup::")