Align custom scripts with generic scripts (#445)
Align custom scripts with generic scripts, making them configurable. This has a few advantages: - script code is more unified, - no more hard-coded method names in scripts, which is less error prone and make it easier to rename scripts, - no more hard coded product names in scripts, which is less error prone and make it easier to rename products, - less hard-coded URLs and regexes in scripts, which makes auto-configuration more expressive / updatable, Also added method `endoflife.list_configs_from_argv()` so that it is easier to manipulate scripts arguments.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
from common import dates, endoflife, http, releasedata
|
||||
|
||||
with releasedata.ProductData("rocky-linux") as product_data:
|
||||
response = http.fetch_url("https://raw.githubusercontent.com/rocky-linux/wiki.rockylinux.org/main/docs/include/releng/version_table.md")
|
||||
for line in response.text.strip().split('\n'):
|
||||
items = line.split('|')
|
||||
if len(items) >= 5 and endoflife.DEFAULT_VERSION_PATTERN.match(items[1].strip()):
|
||||
version = items[1].strip()
|
||||
date = dates.parse_date(items[3])
|
||||
product_data.declare_version(version, date)
|
||||
for config in endoflife.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
response = http.fetch_url(config.url)
|
||||
for line in response.text.strip().split('\n'):
|
||||
items = line.split('|')
|
||||
if len(items) >= 5 and config.first_match(items[1].strip()):
|
||||
version = items[1].strip()
|
||||
date = dates.parse_date(items[3])
|
||||
product_data.declare_version(version, date)
|
||||
|
||||
Reference in New Issue
Block a user