Improve scripts execution orchestration (#299)
Until now products could declare multiple auto-update methods, but they all had to be of the same kind. For example if you used the git auto-update method, you could not use an additional github_releases or custom auto-update method. This is an issue as it prevents us to extend the auto-update process, for example by having a product using the 'git' auto-update method to retrieve all the versions, and a custom script to retrieve support and EOL dates. This improve the scripts execution orchestration to be able to support auto configurations using a mix of methods, meaning: - multiple kind of methods, such as git and github_release, - or multiple custom methods. A side-effect of those changes is that now a failure in a generic script does not cancel the update of subsequent products. Another side-effect, unwanted this time, is that now custom scripts managing multiple products, such as apple.py, are now executed multiple times instead of once.
This commit is contained in:
34
src/maven.py
34
src/maven.py
@@ -6,23 +6,23 @@ from common import endoflife, http, releasedata
|
||||
METHOD = "maven"
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product in endoflife.list_products(METHOD, p_filter):
|
||||
with releasedata.ProductData(product.name) as product_data:
|
||||
for config in product.get_auto_configs(METHOD):
|
||||
start = 0
|
||||
group_id, artifact_id = config.url.split("/")
|
||||
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:
|
||||
start = 0
|
||||
group_id, artifact_id = config.url.split("/")
|
||||
|
||||
while True:
|
||||
url = f"https://search.maven.org/solrsearch/select?q=g:{group_id}+AND+a:{artifact_id}&core=gav&wt=json&start={start}&rows=100"
|
||||
data = http.fetch_url(url).json()
|
||||
while True:
|
||||
url = f"https://search.maven.org/solrsearch/select?q=g:{group_id}+AND+a:{artifact_id}&core=gav&wt=json&start={start}&rows=100"
|
||||
data = http.fetch_url(url).json()
|
||||
|
||||
for row in data["response"]["docs"]:
|
||||
version_match = config.first_match(row["v"])
|
||||
if version_match:
|
||||
version = config.render(version_match)
|
||||
date = datetime.fromtimestamp(row["timestamp"] / 1000, tz=timezone.utc)
|
||||
product_data.declare_version(version, date)
|
||||
for row in data["response"]["docs"]:
|
||||
version_match = config.first_match(row["v"])
|
||||
if version_match:
|
||||
version = config.render(version_match)
|
||||
date = datetime.fromtimestamp(row["timestamp"] / 1000, tz=timezone.utc)
|
||||
product_data.declare_version(version, date)
|
||||
|
||||
start += 100
|
||||
if data["response"]["numFound"] <= start:
|
||||
break
|
||||
start += 100
|
||||
if data["response"]["numFound"] <= start:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user