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.
18 lines
660 B
Python
18 lines
660 B
Python
from common import dates, endoflife, releasedata
|
|
from common.git import Git
|
|
|
|
"""Fetches versions from tags in a git repository. This replace the old update.rb script."""
|
|
|
|
for config in endoflife.list_configs_from_argv():
|
|
with releasedata.ProductData(config.product) as product_data:
|
|
git = Git(config.url)
|
|
git.setup(bare=True)
|
|
|
|
tags = git.list_tags()
|
|
for tag, date_str in tags:
|
|
version_match = config.first_match(tag)
|
|
if version_match:
|
|
version = config.render(version_match)
|
|
date = dates.parse_date(date_str)
|
|
product_data.declare_version(version, date)
|