diff --git a/scripts/pinned_browsers.py b/scripts/pinned_browsers.py index 5f87546cffb45..f8cbdca353a5b 100755 --- a/scripts/pinned_browsers.py +++ b/scripts/pinned_browsers.py @@ -20,6 +20,8 @@ def calculate_hash(url): print(f"Calculate hash for {url}", file=sys.stderr) h = hashlib.sha256() r = http.request("GET", url, preload_content=False) + if r.status != 200: + raise ValueError(f"Download unavailable (HTTP {r.status}): {url}") for b in iter(lambda: r.read(4096), b""): h.update(b) return h.hexdigest() @@ -28,14 +30,9 @@ def calculate_hash(url): def get_chrome_info_for_channel(channel): r = http.request( "GET", - f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux", + "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json", ) - all_versions = json.loads(r.data) - # use the same milestone for all chrome releases, so pick the lowest - milestones = [version["milestone"] for version in all_versions if version["milestone"]] - if not milestones: - raise ValueError(f"No Chrome versions with milestones found for channel '{channel}'") - milestone = min(milestones) + milestone = json.loads(r.data)["channels"][channel]["version"].split(".")[0] r = http.request( "GET", "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json", diff --git a/scripts/update_cdp.py b/scripts/update_cdp.py index 9886651234fba..56bf9548888f8 100755 --- a/scripts/update_cdp.py +++ b/scripts/update_cdp.py @@ -27,14 +27,9 @@ def get_chrome_milestone(): r = http.request( "GET", - f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux", + "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json", ) - all_versions = json.loads(r.data) - # use the same milestone for all Chrome releases, so pick the lowest - milestones = [version["milestone"] for version in all_versions if version["milestone"]] - if not milestones: - raise ValueError(f"No Chrome versions with milestones found for channel '{channel}'") - milestone = min(milestones) + milestone = json.loads(r.data)["channels"][channel]["version"].split(".")[0] r = http.request( "GET", "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json", @@ -49,6 +44,8 @@ def get_chrome_milestone(): def fetch_and_save(url, file_path): response = http.request("GET", url) + if response.status != 200: + raise ValueError(f"Fetch failed (HTTP {response.status}): {url}") with open(file_path, "wb") as file: file.write(response.data) @@ -79,6 +76,8 @@ def flatten_browser_pdl(file_path, chrome_version): for domain_file in includes: url = base_url + domain_file response = http.request("GET", url) + if response.status != 200: + raise ValueError(f"Fetch failed (HTTP {response.status}): {url}") concatenated += response.data.decode("utf-8") + "\n" # Overwrite the file with version block + concatenated domains with open(file_path, "w") as file: