[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.
This commit is contained in:
@@ -127,3 +127,13 @@ def list_configs(products_filter: str = None, methods_filter: str = None, urls_f
|
||||
products = list_products(products_filter)
|
||||
configs_by_product = [p.auto_configs(methods_filter, urls_filter) for p in products]
|
||||
return list(itertools.chain.from_iterable(configs_by_product)) # flatten the list of lists
|
||||
|
||||
"""Convert a string to a valid endoflife.date identifier."""
|
||||
def to_identifier(s: str) -> str:
|
||||
identifier = s.strip().lower()
|
||||
identifier = identifier.replace(" ", "-")
|
||||
return re.sub(r"[^a-z0-9.\-+_]", "", identifier)
|
||||
|
||||
|
||||
|
||||
return s.lower().replace(" ", "_").replace(".", "_").replace("/", "_")
|
||||
|
||||
@@ -28,6 +28,9 @@ class ProductRelease:
|
||||
def name(self) -> str:
|
||||
return self.data["name"]
|
||||
|
||||
def set_label(self, new_value: str) -> None:
|
||||
self.set_field("releaseLabel", new_value)
|
||||
|
||||
def set_release_date(self, new_value: datetime) -> None:
|
||||
self.set_field("releaseDate", new_value)
|
||||
|
||||
@@ -43,6 +46,16 @@ class ProductRelease:
|
||||
def set_eol(self, new_value: datetime | bool) -> None:
|
||||
self.set_field("eol", new_value)
|
||||
|
||||
def get_eol(self) -> datetime | bool | None:
|
||||
if "eol" not in self.data:
|
||||
return None
|
||||
|
||||
eol = self.data["eol"]
|
||||
if isinstance(eol, bool):
|
||||
return eol
|
||||
|
||||
return datetime.strptime(self.data["eol"], "%Y-%m-%d").replace(tzinfo=timezone.utc)
|
||||
|
||||
def set_eoes(self, new_value: datetime | bool) -> None:
|
||||
self.set_field("eoes", new_value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user