From 3f65ff9d9ec887a33add4e023e4515d87aa1886a Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Sat, 2 Aug 2025 15:01:47 +0200 Subject: [PATCH] [update-product-data] Allow disabling auto configuration (#482) --- releases/coldfusion.json | 24 ++++++++++++++++++++++++ releases/unrealircd.json | 8 ++++++++ src/coldfusion.py | 3 ++- src/common/endoflife.py | 3 +++ update-release-data.py | 10 +++++++--- 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/releases/coldfusion.json b/releases/coldfusion.json index 9d0c9759..080050ba 100644 --- a/releases/coldfusion.json +++ b/releases/coldfusion.json @@ -1,6 +1,22 @@ { "releases": {}, "versions": { + "2025.0.03.331507": { + "name": "2025.0.03.331507", + "date": "2025-07-08" + }, + "2023.0.15.330825": { + "name": "2023.0.15.330825", + "date": "2025-07-08" + }, + "2021.0.21.330446": { + "name": "2021.0.21.330446", + "date": "2025-07-08" + }, + "2025.0.02.331451": { + "name": "2025.0.02.331451", + "date": "2025-05-13" + }, "2023.0.14.330784": { "name": "2023.0.14.330784", "date": "2025-05-13" @@ -9,6 +25,10 @@ "name": "2021.0.20.330407", "date": "2025-05-13" }, + "2025.0.01.331420": { + "name": "2025.0.01.331420", + "date": "2025-04-08" + }, "2023.0.13.330759": { "name": "2023.0.13.330759", "date": "2025-04-08" @@ -17,6 +37,10 @@ "name": "2021.0.19.330379", "date": "2025-04-08" }, + "2025.0.0": { + "name": "2025.0.0", + "date": "2025-02-25" + }, "2023.0.12.330713": { "name": "2023.0.12.330713", "date": "2024-12-23" diff --git a/releases/unrealircd.json b/releases/unrealircd.json index 961a79a2..c53b097b 100644 --- a/releases/unrealircd.json +++ b/releases/unrealircd.json @@ -24,6 +24,14 @@ } }, "versions": { + "6.1.10": { + "name": "6.1.10", + "date": "2025-03-07" + }, + "6.1.9.1": { + "name": "6.1.9.1", + "date": "2024-11-21" + }, "6.1.9": { "name": "6.1.9", "date": "2024-11-20" diff --git a/src/coldfusion.py b/src/coldfusion.py index 3184c10a..d9e458ab 100644 --- a/src/coldfusion.py +++ b/src/coldfusion.py @@ -1,5 +1,6 @@ import re +from bs4 import BeautifulSoup from common import dates, http from common.releasedata import ProductData, config_from_argv @@ -10,7 +11,7 @@ VERSION_AND_DATE_PATTERN = re.compile(r"Release Date[,|:]? (.*?)\).*?Build Numbe config = config_from_argv() with ProductData(config.product) as product_data: - html = http.fetch_html(config.url) + html = BeautifulSoup(http.fetch_javascript_url(config.url), "html5lib") for p in html.findAll("div", class_="text"): version_and_date_str = p.get_text().strip().replace('\xa0', ' ') diff --git a/src/common/endoflife.py b/src/common/endoflife.py index 385396aa..410f2f22 100644 --- a/src/common/endoflife.py +++ b/src/common/endoflife.py @@ -71,6 +71,9 @@ class ProductFrontmatter: def has_auto_configs(self) -> bool: return self.data and "methods" in self.data.get("auto", {}) + def is_auto_update_disabled(self) -> bool: + return self.data.get("auto", {}).get("disabled", False) + def is_auto_update_cumulative(self) -> bool: return self.data.get("auto", {}).get("cumulative", False) diff --git a/update-release-data.py b/update-release-data.py index 7d50691b..185b15d5 100644 --- a/update-release-data.py +++ b/update-release-data.py @@ -101,15 +101,18 @@ def __run_script(product: ProductFrontmatter, config: AutoConfig, summary: Scrip return success -def run_scripts(summary: GitHubStepSummary, products: list[ProductFrontmatter]) -> bool: +def run_scripts(summary: GitHubStepSummary, products: list[ProductFrontmatter], force: bool = False) -> bool: exec_summary = ScriptExecutionSummary() for product in products: configs = product.auto_configs() - if not configs: continue # skip products without auto configs + if product.is_auto_update_disabled() and not force: + logging.info(f"skipping {product.name} as auto update is disabled") + continue + # Add default configs configs = [AutoConfig(product.name, {"_copy_product_releases": ""})] + configs configs = configs + [AutoConfig(product.name, {"_remove_invalid_releases": ""})] @@ -177,6 +180,7 @@ if __name__ == "__main__": parser.add_argument('product', nargs='?', help='restrict update to the given product') parser.add_argument('-p', '--product-dir', required=True, help='path to the product directory') parser.add_argument('-v', '--verbose', action='store_true', help='enable verbose logging') + parser.add_argument('-f', '--force', action='store_true', help='force update even if auto update is disabled') args = parser.parse_args() logging.basicConfig(format=logging.BASIC_FORMAT, level=(logging.DEBUG if args.verbose else logging.INFO)) @@ -186,7 +190,7 @@ if __name__ == "__main__": products_list = list_products(products_dir, args.product) with GitHubStepSummary() as step_summary: - some_script_failed = run_scripts(step_summary, products_list) + some_script_failed = run_scripts(step_summary, products_list, force=args.force) updated_products = get_updated_products() step_summary.println("## Update summary\n")