Files
endoflife-date-release-data/src/atlassian_eol.py
Marc Wrobel 6091ef55fe [samsung-mobile] Add automation (#437)
Detect new models and aggregate EOL data for Samsung Mobile devices.

This script works cumulatively: when a model is not listed anymore on https://security.samsungmobile.com/workScope.smsb
it retains the date and use it as the model's EOL date.
2025-05-07 23:29:33 +02:00

35 lines
1.3 KiB
Python

import logging
import re
import sys
from bs4 import BeautifulSoup
from common import dates, endoflife, http, releasedata
"""Fetches EOL dates from Atlassian EOL page.
This script takes a single argument which is the product title identifier on the Atlassian EOL page, such as
`AtlassianSupportEndofLifePolicy-JiraSoftware`.
"""
METHOD = "atlassian_eol"
REGEX = r"(?P<release>\d+(\.\d+)+) \(EO[SL] date: (?P<date>.+)\).*$"
PATTERN = re.compile(REGEX, re.MULTILINE)
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
m_filter = sys.argv[2] if len(sys.argv) > 2 else None
for config in endoflife.list_configs(p_filter, METHOD, m_filter):
with releasedata.ProductData(config.product) as product_data:
content = http.fetch_javascript_url('https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html')
soup = BeautifulSoup(content, features="html5lib")
for li in soup.select(f"#{config.url}+ul li"):
match = PATTERN.match(li.get_text(strip=True))
if not match:
logging.warning(f"Failed to parse EOL date from '{li.get_text(strip=True)}'")
continue
release_name = match.group("release")
date = dates.parse_date(match.group("date"))
release = product_data.get_release(release_name)
release.set_eol(date)