[update-product-data] Allow disabling auto configuration (#482)

This commit is contained in:
Marc Wrobel
2025-08-02 15:01:47 +02:00
committed by GitHub
parent b2f4028314
commit 3f65ff9d9e
5 changed files with 44 additions and 4 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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', ' ')

View File

@@ -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)

View File

@@ -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")